Connecting Remotely to the Database by Using Oracle Net Services
Note:
How you connect to an Oracle RAC database on Database Classic Cloud Service differs from how you connect to a non-clustered database. For information, see Creating an Oracle Net Connection to an Oracle RAC Database.
Oracle Database Classic Cloud Service support access to Oracle Database on the standard Oracle Net Listener port.
How you make a Oracle Net connection to the Oracle Database depends on whether the Oracle Net Listener port has been unblocked. When a Database Classic Cloud Service database deployment is created on Oracle Cloud Infrastructure Classic, the Oracle Net Listener port is blocked to ensure network security. For information about unblocking a port, see Enabling Access to a Compute Node Port.
Before You Can Connect
-
The IP address for the compute node that you wish to connect to. You can obtain this information by viewing details as described in Viewing Detailed Information for a Database Deployment.
-
The database identifier, either the database SID or service name. For database deployments running Oracle Database 11g, you can identify the database by using the SID. For deployments running Oracle Database 12c or later, connecting to the database by specifying the database SID connects you to the CDB (container database). To connect to a PDB (pluggable database), specify the service name of the pluggable database. In Database Classic Cloud Service, the format of a database service name is:
pdb.identity-domain.oraclecloud.internal
where
pdb
is the name of the PDB andidentity-domain
is the name of the identity domain housing your Database Classic Cloud Service subscription; for example:PDB1.usexample5822.oraclecloud.internal
You can obtain the required information by viewing details as described in Viewing Detailed Information for a Database Deployment.
Creating an Oracle Net Connection When the Listener Port Is Unblocked
To create an Oracle Net connection when the listener port is unblocked, you can use the easy connect method to specify a connect identifier with the following format:
node-ip-address:listener-port-number/sid-or-service-name
For example:
198.51.100.101:1521/ORCL
or
198.51.100.102:1521/PDB1.usexample5822.oraclecloud.internal
Creating an Oracle Net Connection When the Listener Port Is Blocked
To create an Oracle Net connection when the listener port is blocked, you must create an SSH tunnel from your client (localhost) to the port of the compute node hosting the Oracle Net Listener. For information about creating an SSH tunnel, see Creating an SSH Tunnel to a Compute Node Port.
To create an Oracle Net connection that uses the SSH tunnel, you can use the easy connect method to specify a connect identifier with the following format:
localhost:listener-port-number/sid-or-service-name
For example:
localhost:1521/ORCL
or
localhost:1521/PDB1.usexample5822.oraclecloud.internal
Note:
Some database access products, such as Oracle SQL Developer 4.0.3 or later, include functionality to connect to a database through an SSH tunnel. When using these products, you create the SSH tunnel to the listener port within the product and do not need to follow the instructions in Creating an SSH Tunnel to a Compute Node Port.
Creating an Oracle Net Connection to an Oracle RAC Database
On an Oracle RAC database on Database Classic Cloud Service, the SCAN listeners on each compute node listen on the Oracle Net Services port. By default, this port and the port for the DB listener are blocked on the compute nodes. Therefore, you must first open access to these ports by enabling the ora_p2_scan_listener and ora_p2_db_listener security rules using the instructions Enabling Port Access by Enabling an Automatically Created Access Rule. Then, on the client, specify a connect descriptor that references the SCAN listeners on both compute nodes; for example:
alias-name = (DESCRIPTION = (ENABLE = BROKEN) (ADDRESS_LIST = (ADDRESS = (PROTOCOL = TCP)(HOST = node1-ip-address)(PORT = 1521)) (ADDRESS = (PROTOCOL = TCP)(HOST = node2-ip-address)(PORT = 1521)) ) (CONNECT_DATA = (SERVICE_NAME = service-name) ) )
-
alias-name
is the name you use to identify the alias. -
node1-ip-address
andnode2-ip-address
are the public IP addresses of the two compute nodes associated with the database deployment. -
service-name
is the service name in the form:pdb.identity-domain.oraclecloud.internal
For example:
PDB1.usexample5822.oraclecloud.internal