The below will demonstrate how to install Oracle Database Express Edition and connect through Command prompt and Oracle SQL Developer in Windows.
Install Oracle Database Express Edition
For testing and learning the Oracle database, you can start with Oracle Database Express Edition (XE) which is free to use. You can download the same from the below link,
Link to download Oracle Database XE
After the downloading, you can run the setup and install the database. After completing the installation to start the database, open the command prompt and enter the following commands
SQL Plus is the most basic Oracle Database utility, with a basic command-line interface. In which you can enter and execute SQL, PL/SQL, SQL Plus, and operating system commands such as query results, database administration, and run batch scripts.
You can read more here about SQL Plus.
After opening SQL Plus, you have to enter the username and password to connect to the database. The default username is
sys and the password is oracle. You can enter the username as below,
Format: username/password as sysdba
If you entered username only as sys you will get the following error,
ORA-28009: connection as SYS should be as SYSDBA or SYSOPER
That is because when we are trying to login with
sys user we have to set
DBA Privilege=SYSDBA to get full access.
Connecting via Oracle SQL Developer
To connect the database from Oracle SQL Developer you need to create a new connection in the Oracle connections section. To get the connection details, you can run the below command in the command prompt.
select * from v$listener_network;
You can see the local listener as
(ADDRESS=(PROTOCOL=TCP)(HOST=HOST_NAME)(PORT=1522)) and the service name as
XE. Enter the details as shown in the below screenshot. You have to provide the same password when we entered it during the database installation.
After entering the details as above, test the connection. If all the details are correct status will show as Success. You can save the connection, and start using the database from a new query window.