Installing Oracle Database
To install the Oracle database on your computer, you need to download the installer from the download page of the Oracle website.
After having the installation files which are in ZIP format, you need to extract them into a specific folder on your computer. after that click on setup file as shown below:
In step 1, the Oracle installer asks you whether you want to create and configure a database(a single instance) , install database software only. Because you install the Oracle database for the first time, choose option 1 and click the Next button.
In Step 2 The installer allows you to choose the system class. Because you install Oracle on your local machine and not on a server, therefore, you can choose the first option: desktop-class and click the Next button.
In Step 3 Installer allows you to specify the Windows user account to install and configure Oracle Home for enhanced security. Choose the third option: โUse Windows Built-in Accountโ if you want it as system username and password other you can create new window user (it will not have window login privilege's). I have choose 2nd option. Password : Akash1991
In Step 4 you can choose the folder on which Oracle database will be installed, Global database name and password, pluggable database name. by default values will be there you can edit it. Password : Akash1991
The installer shows you the summary of the information such as global settings, database information, etc. You need to review the information and click the install button if everything is fine.
The installer starts installing the Oracle database. It will take a few minutes to complete, depending on your computer.
Now open your SQL developer if not present download SQL Developer and open it.
click on + icon on left top corner and click on new database connection. and provide the details as below.
As i have selected a new window user so i have given password for that and username and role will be same as shown below.
Click on Test and connect you can see below screen:
If you are unsure about service name, SID you can check in tnsnames.ora file present in WINDOWS.X64_193000_db_home\network\admin location.
In step 4 you can see a pluggable database is created, now we have to add it in tnsnames.ora file add below in it.
ORCLPDB =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = localhost)(PORT = 1521))
(CONNECT_DATA =
(SERVER = DEDICATED)
(SERVICE_NAME = orclpdb)
)
)
After adding save and close the file.
Now We will add our own database in Oracle pluggable database. Open your command prompt and type "sqlplus sys as sysdba" it will ask for password you have to give the password which we have created at the time of installation at step 4.
Once you provide the password you will see connected, and When you connect to the Oracle database server, you connect to a container database (CDB) named ROOT. To show the current database, you use the SHOW command
Next, you need to switch to a pluggable database. We already created a pluggable database named ORCLPDB. To switch to the ORCLPDB pluggable database, you use the following statement:
ALTER SESSION SET CONTAINER = orclpdb;
If you execute the show
command again, the database now is ORCLPDB.
Before creating a new user, you need to change the database to open by executing the following command: ALTER DATABASE OPEN it will open your pluggable database.
Then, you create a new user for creating the sample database in the pluggable database using the following CREATE USER statement:
CREATE USER USERNAME IDENTIFIED BY PASSWORD_FOR_THIS_USERNAME;
The above statement created a new user named JORDAN with a password specified after the IDENTIFIED BY clause, which is jordan1991 in this case. After that, you grant privileges to the OT user by using the following GRANT statement:
GRANT CONNECT, RESOURCE, DBA TO JORDAN;
Finally, you can connect to the pluggable database (ORCLPDB) using the JORDAN user account. Type the password ( jordan1991) for the JORDAN user when SQL*plus prompts you for the password.
Note that JORDAN user only exists in the ORCLPDB pluggable database, therefore, you must explicitly specify the username as JORDAN@ORCLPDB in the CONNECT command.
Now you can see the database in SQL developer open SQL Developer and click on + icon.
and fill the required data as below:
Click on Test and Connect if connection is successful you can see it in left panel as below:
Now you are all set for creating table, views, procedure etc.
Let me know for any Query. ๐๐๐๐๐๐๐๐๐
Comments
Post a Comment