$ cat tnsnames.ora

tnsnames.ora Network Configuration File: /u01/app/oracle/product/12.1.0.2/db_1/network/admin/tnsnames.ora
Generated by Oracle configuration tools.

CDB2 =
(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = TCP)(HOST = racnode1)(PORT = 1521))
)
(CONNECT_DATA =
(SERVICE_NAME = cdb2)
)
)

orcl12c =
(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = TCP)(HOST = racnode1)(PORT = 1521))
)
(CONNECT_DATA =
(SERVICE_NAME = orcl12c.us.oracle.com)
)
)

export ORACLE_SID=cdb2
sql

SQL> create database link orcl12c_dblink connect to system
identified by oracle_4U using ‘orcl12c’;

Database link created.

SQL> select count(*) from tab;

COUNT(*)

7026

SQL> select count(*) from tab@orcl12c_dblink;

COUNT(*)

200

SQL> show pdbs

CON_ID CON_NAME OPEN MODE RESTRICTED


2 PDB$SEED READ ONLY NO
3 PDB1 MOUNTED

–Example-1

SQL> create pluggable database pdb2 from MYPDB2@orcl12c_dblink
file_name_convert=(‘mypdb2′,’pdb2’)

Pluggable database created.

SQL> alter session set container=pdb2;

Session altered.

SQL> select name from v$datafile;

NAME

/u01/app/oracle/oradata/cdb2/undotbs01.dbf
/u01/app/oracle/oradata/orcl12c/pdb2/system01.dbf
/u01/app/oracle/oradata/orcl12c/pdb2/sysaux01.dbf
/u01/app/oracle/oradata/orcl12c/pdb2/pdb2_users01.dbf

–Example-2

SQL> create pluggable database pdb3 from mypdb4@orcl12c_dblink
file_name_convert=(‘/u01/app/oracle/oradata/orcl12c/mypdb4′,’/u01/app/oracle/oradata/cdb2/pdb3’)

Pluggable database created.

SQL> show pdbs

CON_ID CON_NAME OPEN MODE RESTRICTED


2 PDB$SEED READ ONLY NO
3 PDB1 READ WRITE NO
4 PDB2 READ WRITE NO
5 PDB3 MOUNTED
SQL> alter pluggable database pdb3 open;

Pluggable database altered.

SQL> alter session set container=pdb3;

Session altered.

SQL> select name from v$datafile;

NAME

/u01/app/oracle/oradata/cdb2/undotbs01.dbf
/u01/app/oracle/oradata/cdb2/pdb3/system01.dbf
/u01/app/oracle/oradata/cdb2/pdb3/sysaux01.dbf
/u01/app/oracle/oradata/cdb2/pdb3/mypdb4_users01.dbf

SQL>

No responses yet

Leave a Reply

Your email address will not be published. Required fields are marked *