Meenal
Meenal

Reputation: 145

How can we connect to autonomous database through sqlplus

I am trying to connect to Autonomous database from kubernetes cluster.

In my shell script I am giving the syntax as sqlplus admin/pwd@adb_low.

Before this, I also download the wallet. Can anyone tell me whether or not there is anything wrong here, as it produces the error

ORA-12154:TNS:could not resolve the connect identifier specified. 
Enter user-name, invalid option.

Upvotes: 0

Views: 833

Answers (2)

Israel Ndou
Israel Ndou

Reputation: 261

We will use the mTLS wallet.

  1. Change the database admin password and make sure it doesnt end with letters, special characters and doesnt include @ symbol, have them in the middle such as '123Pass45'.
  2. You need to download the instant client basic and sql*plus.
  3. Extract all of them and put the extracted content of sqlplus into instant client basic extracted folders.
  4. Rotate(just in case) and download the wallet.
  5. In instant client basic, copy and paste the extracted content of the wallet into the network/admin folder.
  • In the wallet, you will see that sqlnet.ora includes the default wallet location which is (DIRECTORY="?/network/admin". You can change it if you want as long as it points to the wallet contents. Just leave it as default for now.
  • tnsnames.ora contains the service names mapped to the database service info such as the server's host name, port number, and database instance name. Meaning you can use the tns name (mydatabasename_high etc) to connect instead of the long connection string
  1. To connect: ./sqlplus admin/123Pass45@tnsname
  2. Thats it. It should be working. Let me know if it doesnt it.

Edit: to use step 6, open the terminal in the instant client basic folder where you pasted the sqlplus extracted contents. Alternatively, you can do path/sqlplus admin...

Upvotes: 0

kanchudurgaprasad
kanchudurgaprasad

Reputation: 1

Edit the sqlnet.ora file, by replacing ?/network/admin with the name of the folder containing the Autonomous database wallet credentials.

Set the TNS_ADMIN environment variable to the directory where the Autonomous database wallet is unzipped, for example:

export TNS_ADMIN=/home/myDBwallet

Upvotes: 0

Related Questions