Saturday, 8 August 2020

Multitenant- Create PDB using db links from remote PDB


Multitenant- Create PDB using db links from remote PDB

  • KEYWORDS:

CREATE PLUGGABLE DATABASE pdb6 FROM TEST1@STDRAC_LINK;

  • EXAMPLE

CREATE DATABASE LINK STDRAC_LINK   CONNECT TO system IDENTIFIED BY system123  USING 'STDRAC';

oracle@srv3:~> . oraenv
ORACLE_SID = [SMRCDB] ?
The Oracle base remains unchanged with value /u01/app/oracle
oracle@srv3:~> sqlplus / as sysdba

SQL*Plus: Release 12.2.0.1.0 Production on Fri Aug 7 12:52:47 2020

Copyright (c) 1982, 2016, Oracle.  All rights reserved.

Connected to:
Oracle Database 12c Enterprise Edition Release 12.2.0.1.0 - 64bit Production

SQL> CREATE DATABASE LINK STDRAC_LINK   CONNECT TO system IDENTIFIED BY system123  USING 'STDRAC';

Database link created.

SQL> set lines 200

SQL> col OWNER for a30
SQL> col DB_LINK for a30
SQL> col USERNAME for a30
SQL> col HOST for a30
SQL> set lines 200
SQL> select * from dba_db_links;

OWNER                          DB_LINK                        USERNAME                       HOST                           CREATED   HID
------------------------------ ------------------------------ ------------------------------ ------------------------------ --------- ---
SYS                            SYS_HUB                                                       SEEDDATA                       26-JAN-17 NO
SYS                            STDRAC_LINK                    SYSTEM                         STDRAC                         07-AUG-20 NO

SQL>
Disconnected from Oracle Database 12c Enterprise Edition Release 12.2.0.1.0 - 64bit Production
oracle@srv3:~> sqlplus / as sysdba

SQL*Plus: Release 12.2.0.1.0 Production on Fri Aug 7 13:04:32 2020

Copyright (c) 1982, 2016, Oracle.  All rights reserved.

Connected to:
Oracle Database 12c Enterprise Edition Release 12.2.0.1.0 - 64bit Production

SQL> sho pdbs

    CON_ID CON_NAME                       OPEN MODE  RESTRICTED
---------- ------------------------------ ---------- ----------
         2 PDB$SEED                       READ ONLY  NO
         3 PLM1                           READ WRITE NO
         4 PDB2                           READ WRITE NO
         5 PDB3                           READ WRITE NO
         7 PDB5                           READ WRITE NO
SQL> select sysdate from dual@STDRAC_LINK;

SYSDATE
---------
07-AUG-20

SQL>
CREATE PLUGGABLE DATABASE pdb6 FROM TEST1@STDRAC_LINK;

oracle@srv3:~> sqlplus / as sysdba

SQL*Plus: Release 12.2.0.1.0 Production on Fri Aug 7 13:04:32 2020

Copyright (c) 1982, 2016, Oracle.  All rights reserved.

Connected to:
Oracle Database 12c Enterprise Edition Release 12.2.0.1.0 - 64bit Production

SQL> sho pdbs

    CON_ID CON_NAME                       OPEN MODE  RESTRICTED
---------- ------------------------------ ---------- ----------
         2 PDB$SEED                       READ ONLY  NO
         3 PLM1                           READ WRITE NO
         4 PDB2                           READ WRITE NO
         5 PDB3                           READ WRITE NO
         7 PDB5                           READ WRITE NO
SQL> select sysdate from dual@STDRAC_LINK;

SYSDATE
---------
07-AUG-20

SQL> CREATE PLUGGABLE DATABASE pdb6 FROM TEST1@STDRAC_LINK;

Pluggable database created.

SQL> sho pdbs

    CON_ID CON_NAME                       OPEN MODE  RESTRICTED
---------- ------------------------------ ---------- ----------
         2 PDB$SEED                       READ ONLY  NO
         3 PLM1                           READ WRITE NO
         4 PDB2                           READ WRITE NO
         5 PDB3                           READ WRITE NO
         6 PDB6                           MOUNTED
         7 PDB5                           READ WRITE NO
SQL> alter pluggable database PDB6 open;

Pluggable database altered.

SQL> sho pdbs

    CON_ID CON_NAME                       OPEN MODE  RESTRICTED
---------- ------------------------------ ---------- ----------
         2 PDB$SEED                       READ ONLY  NO
         3 PLM1                           READ WRITE NO
         4 PDB2                           READ WRITE NO
         5 PDB3                           READ WRITE NO
         6 PDB6                           READ WRITE NO
         7 PDB5                           READ WRITE NO

NOTE : Make TNSNAMES.ORA  Entry using NETCA utility 

No comments:

Post a Comment