Monday, February 23, 2015

Connecting to CDB and PDB - Oracle 12c

    Creation on a CDB (Container database) creates a service named is the CDB name. This is a side effect of creating a PDB (Pluggable Database) in the CDB, a service is created inside it with a property that identifies it as the initial current container. The service is also started as a side effect of creating the PDB. Although its metadata is recorded inside the PDB, the invariant is maintained so that a service name is unique within the entire CDB.

    Use the Easy Connect syntax to connect to the root unless a net service name is configured in the tnsnames for the root service.

    . oraenv
    [enter cdb1 at the prompt]
    sqlplus sys/oracle@localhost:1521/cdb1 as sysdba
    show con_name
    show con_id
    Connect to the root by using OS authentication.

    connect / as sysdba
    show con_name
    show con_id 

    Display the list of available services for the root and the PDBs.

    select name, con_id from v$active_services order by 1;
    Use the Easy Connect syntax to connect to the PDB unless a net service name is configured in the tnsnames for the PDB service.

    connect sys/oracle@localhost:1521/pdb1 as sysdba
    show con_name
    show con_id
    exit

No comments:

Post a Comment