Sunday, 17 February 2019

Run SQL & PL/SQL Query - Install Oracle Database Express Edition (XE) 11.2 on your PC/Laptop

*  To download Oracle Database Express Edition you must have an account on Oracle.

*  Go to to ==> Login Page


*  If you already have an account, leave it and see below steps.

*  Otherwise just click Create an Account.


*  Fill the form where * required fields.

Job Title --> Student (may be) or Developer etc.

Company Name --> College name (may be) or your company name

*  After filled the form click on Create an Account.

*  Now you will receive an e-mail to verify your account , open your mail and click on Verify e-mail address to verify.

*  After verification of your account, go to the given link ==> Oracle Database Express Edition (XE) 11.2

*   Accept License Agreement.

*  Click on download 1 ==> for Windows 64-bit (Refer Image)

*  Click on download 2 ==> for Windows 32-bit (Refer Image)




*   It will redirect to Login page, please login to download.

*  After downloading ,go to downloaded folder.

*  Extract the downloaded file OracleXE112_Win64 (for 64-bit)

*  Open OracleXE112_Win64 --> Disk1 

*  Open setup and click yes.

*  Click next , accept the terms and then click next.

*  Click next , now it ask for password

*  This is very important ,fill the password and click next (Don't forgot the password)

*  Now click install, please be patience it will take some time to install.

*  After installation was finished click finish.

*  Now you want to download SQL Developer tool. It's is a best tool to manage databases.

*  Go to ==> SQL Developer 18.4

*   Accept License Agreement.

*  Click on download 1 ==> for Windows 64-bit (Refer Image)

*  Click on download 2 ==> for Windows 32-bit (Refer Image)



*   It will redirect to Login page, please login to download.

*  After downloading ,go to downloaded folder.

*  Extract the downloaded file sqldeveloper-18.4.0-376.1900-x64.zip (for 64-bit)

*  Open sqldeveloper-18.4.0-376.1900-x64.zip and open sqldeveloper (see image)


*  This is what it look like.


Click on + button on top-left corner.


*  Now , Connection Name : SYS (I used SYS because this connection is admin-account ,may be you can have another name, your wish)

Username : SYSTEM (It's default)

Password : ************* (the password that you have entered while installing.)

Check Save Password. leave others as it is.

Click on Test.If the details are right status will be success.Otherwise check your details entered.

*  Now click on Connect.

* You have successfully connected your account to sqldeveloper.

* We can't do all operations on admin account because it can have original databases.

*  So,we have to create an user account.Please follow to create user account.

*  Now open Notepad and copy & paste the following lines.

CREATE USER user_name IDENTIFIED BY password;

GRANT CONNECT TO user_name ;

GRANT CREATE SESSION, GRANT ANY PRIVILEGE TO user_name ;

GRANT UNLIMITED TABLESPACE TO user_name ;

GRANT CREATE TABLE TO user_name ;

*  Here , replace the user_name : your user name 

*  replace the password : your password

For Example: Username : RSR and Password : 12345

CREATE USER RSR IDENTIFIED BY 12345;

GRANT CONNECT TO RSR ;

GRANT CREATE SESSION, GRANT ANY PRIVILEGE TO RSR ;

GRANT UNLIMITED TABLESPACE TO RSR ;

GRANT CREATE TABLE TO RSR ;

*  Save this with file name create-user.sql

*  Open sqldeveloper and press CTRL+O

*  Now open the create-user.sql that you have saved before.

*  Now press F5 to run script.

*  Now you have created user account successfully,but you have to connect it to sqldeveloper.

*  Now click  + button on top-left corner

*  Now , Connection Name : (any name your wish)

Username : user_name (the username that you have used in the script or notepad)

*  Password : password (the password that you have entered for the user user_name)

Check Save Password. leave others as it is.

*  Click on Test.If the details are right status will be success.Otherwise check your details entered.

*  Now click on Connect.

* You have successfully connected your user account to sqldeveloper.

*  Close sqldeveloper now;

*  Ya ! it's the end and now you can work with the Run SQL command line.

*  Open start and search Run SQL Command Line and open it.

*  Now type connect

*  Enter user_name and password to connect.

*  Now you have connected successfully.

*  Now you can do all your SQL and PL/SQL commands.

*  Enjoy.


Note:

*  SQL Command Line is not only way to do your SQL queries.

*  So, that the sqldeveloper tool is used, because it is easy and have better GUI.

* Open sqldeveloper and File-->New  or CTRL+N

* Select Database File from left and SQL File on right.

* Give filename.sql and the location , click ok.

* Now type your sql queries.

*  To run a single query use CTRL+ENTER

*  To run set of queries use F5.

*  Explore more on internet to know more about sqldeveloper tool

* Enjoy !


No comments:

Post a Comment