Connect to a Database By Using SSH and the Bequeath Protocol

This method allows you to connect to the database without using the network listener. It should be used to connect only for administration purposes.

When connecting to a multi-node DB system, you’ll SSH to each individual node in the cluster.

Connect From a UNIX-style System

Use the following SSH command to access the DB system:

ssh -i <private_key> opc@<DB_system_IP_address>

<private_key> is the full path and name of the file that contains the private key associated with the DB system you want to access.

Use the DB system’s private or public IP address depending on your network configuration.

For more information, see prerequisites in Overview of Connecting to a DB System.

Connect From a Windows System

  1. Open putty.exe.
  2. In the Category pane, select Session and enter the following fields:

    • Host Name (or IP address): opc@<DB_system_IP_address>

      Use the DB system’s private or public IP address depending on your network configuration.

    • Connection type: SSH
    • Port: 22
  3. In the Category pane, expand Connection, expand SSH, and then click Auth, and browse to select your private key.
  4. Optionally, return to the Session category screen and save this session information for reuse later.
  5. Click Open to start the session.

For more information, see prerequisites in Overview of Connecting to a DB System.

Access a Database After You Connect

  1. Log in as opc.

    login as: opc
  2. sudo to the grid user.

    sudo su - grid
  3. List all the databases on the system.

    srvctl config database -v

    Output:

    cdbm01 /u02/app/oracle/product/12.1.0/dbhome_2 12.1.0.2.0
    exadb /u02/app/oracle/product/11.2.0/dbhome_2 11.2.0.4.0
    mmdb /u02/app/oracle/product/12.1.0/dbhome_3 12.1.0.2.0
  4. Connect as the oracle user.

    [root@ed1db01 ~]# su - oracle
    [oracle@ed1db01 ~]$ . oraenv
    ORACLE_SID = [oracle] ? cdbm01
    The Oracle base has been set to /u02/app/oracle
  5. Get the details about one of the databases by using the srvctl command.

    srvctl config database -d cdbm01

    Output:

    Database unique name: cdbm01 <<== DB unique name
    Database name:
    Oracle home: /u02/app/oracle/product/12.1.0/dbhome_2
    Oracle user: oracle
    Spfile: +DATAC1/cdbm01/spfilecdbm01.ora
    Password file: +DATAC1/cdbm01/PASSWORD/passwd
    Domain: data.customer1.oraclevcn.com
    Start options: open
    Stop options: immediate
    Database role: PRIMARY
    Management policy: AUTOMATIC
    Server pools:
    Disk Groups: DATAC1,RECOC1
    Mount point paths:
    Services:
    Type: RAC
    Start concurrency:
    Stop concurrency:
    OSDBA group: dba
    OSOPER group: racoper
    Database instances: cdbm011,cdbm012 <<== SID
    Configured nodes: ed1db01,ed1db02
    Database is administrator managed
  6. Set the ORACLE_SID and ORACLE_UNIQUE_NAME using the values from the previous step.

    export ORACLE_SID=cdbm011
    export ORACLE_UNIQUE_NAME=cdbm01
    sqlplus / as sysdba
    SQL*Plus: Release 12.1.0.2.0 Production on Wed Apr 19 04:10:12 2017
    
    Copyright (c) 1982, 2014, Oracle. All rights reserved.
    
    Connected to:
    Oracle Database 12c EE Extreme Perf Release 12.1.0.2.0 - 64bit Production
    With the Partitioning, Real Application Clusters, Automatic Storage Management, Oracle Label Security,
    OLAP, Advanced Analytics and Real Application Testing options