Wednesday, June 2, 2021

How to connect to an autonomous database

Connections can be established to autonomous database(OCI) using various tools. We will see how to establish connections using sql client and Sql developer 

Connecting to DB using Sqlplus:


Download sql clinet or sqlplus (.zip) files from oracle website and unzip into a folder Then go to autonomous database Home page in OCI and click on the database name to download the wallet files step 

1) Go to OCI homepage and select autonomous database
step 2) In autonomous database home click on dbname to download the wallet files
step 3) click on Db connection button
step 4) Select wallet type as instance wallet and hit download :
In the end it asks for a password before the download starts. Wallet_dbname.zip will be downloaded once the above steps are done. 


Let us consider sqlplus/oracle client is unzipped in /u01/app/oracle/product/19.8.0/db_1 and wallets are downloaded& unzipped into /u01/wallet/ folder We need to do couple of changes to sqlnet.ora file present in oracle client home

 goto --> /u01/app/oracle/product/19.8.0/db_1/network/admin open sqlnet.ora and edit the existing entries 

WALLET_LOCATION = (SOURCE = (METHOD = file) (METHOD_DATA = (DIRECTORY="?/network/admin"))) 
SSL_SERVER_DN_MATCH=yes 

to 


WALLET_LOCATION = (SOURCE = (METHOD = file) (METHOD_DATA = (DIRECTORY="/u01/wallet/"))) 
SSL_SERVER_DN_MATCH=yes 

We have changed the directory parameter to the location of DB wallets. 

export PATH=/u01/app/oracle/product/19.8.0/db_1:$PATH 
export TNS_ADMIN=/u01/app/oracle/product/19.8.0/db_1/network/admin 

sqlplus admin/password@myfirstdb_low --> you can find connection string in tnsnames.ora under wallet files

  

  Connecting to database using Sql developer:

Note : To connect to OCI we need the downloaded wallet zip file. Hence do not delete the zip file after unzipping the contents