Despite the availability of tools such as SQL Developer, there may be times when you may prefer to use good old SQL*Plus to connect to an Oracle Cloud database instance. Here's how to do it...
These instructions assume that you already have an up to date version of Oracle Instant Client (at least 12.x and above) installed on your PC, along with the SQL*Plus additional software. If you don't have these, they are available from the Oracle web site (Instant Client for Microsoft Windows (x64) 64-bit | Oracle United Kingdom). You'll find plenty of instructions on how to install Instant Client and SQL*Plus if you search online.
- If you haven't already, download the credentials wallet for your Oracle Cloud Database instance from your Oracle Cloud console page.
Here's how to do this: - Log into your Oracle Cloud account.
- Go to the database details page for the relevant database instance.
- Select the "DB Connection" button.
- Select the "Download Wallet" button.
- Go to the folder in which you installed the Oracle Instant Client and SQL*Plus.
- Create a new subfolder called "network".
- In the "network" subfolder, create a new subfolder called "admin".
- In the folder in which you downloaded the database wallet zip file, double click the zip file in Windows Explorer and copy the contents of the zip file to the <instant client>\network\admin folder.
- Create a system environment variable called "TNS_ADMIN". Point this environment variable at the admin subfolder into which you copied the contents of the wallet zip file.
- Open the contents of the tnsnames.ora files in the admin folder. Note the SID for the "HIGH" entry.
- Open a console window.
- In the console window, enter "sqlplus". (If you have not put the Instant Client folder in the PATH environment variable, you will need to go into the Instant Client folder before opening SQL*Plus). If all goes well, you will see something similar to the following:
- At the prompt "Enter user-name:", enter your Oracle Cloud database user name followed by the @ character, followed by the SID as stored in the tnsnames.ora file. For example, if you wish to log in as user "admin" to a database instance with SID "db1_high", type the following:
- Next enter the password for your database user.
- If your login details are accepted, you will see something similar to this:
Congratulations! You are now connected to your Oracle Cloud database from SQL*Plus on your desktop!
