Monday, April 20, 2020

How to Connect to Locally Installed Oracle DB using Oracle SQL Developer

Hello Everyone,

If you have installed oracle database in your local machine and if you want to connect to the database using Oracle SQL Developer, you will need to do the following.
  1. Create a user

    create user myuser identified by myuser123;

    When executing the above you might get the following error.

    ORA-65096: invalid common user or role name

    In order to get rid of the above, execute the following and create the user again.

    alter session set "_ORACLE_SCRIPT"=true;
  2. Grant all privileges to the user

    Once you have created the user, execute the following to grant all privileges to the user.

    grant all privileges to myuser;
  3. Connect to the database using Oracle SQL Developer

    When you are going to connect to the oracle database, you need to know username, password, hostname, port and sid. Username and password are the ones of the user you have just created. Port is usually 1521 which is the default. Hostname is localhost as you have installed the database locally. What you need is to find sid. In order to find the sid, you can use the following query.

    select instance from v$thread;

    With the above you can find the SID and you can connect to SQL Developer.
Hope it helps 😀