Friday, 19 March 2021

19c Lab for cloning

 There are two CDB database 1)  EASYTRAINING and CDB2 , in EASYTRAINING . We have created application containter HR_ROOT


CREATE PLUGGABLE DATABASE  HR_ROOT AS APPLICATION CONTAINER ADMIN USER app_admin IDENTIFIED BY Password1

FILE_NAME_CONVERT=('F:\ORACLE\ORADATA\EASYTRAINING\','F:\ORACLE\ORADATA\EASYTRAINING\training_app\');



ALTER PLUGGABLE DATABASE HR_ROOT OPEN;


alter session set container = HR_ROOT;


HR_PDB1 


CREATE PLUGGABLE DATABASE HR_PDB1 ADMIN USER pdb_admin IDENTIFIED BY Password1

FILE_NAME_CONVERT=('F:\ORACLE\ORADATA\EASYTRAINING\','

CREATE PLUGGABLE DATABASE HR_PDB1 ADMIN USER pdb_admin IDENTIFIED BY Password1

FILE_NAME_CONVERT=('F:\ORACLE\ORADATA\EASYTRAINING\','F:\oracle\oradata\EASYTRAINING\training_app\app_pdb');


CREATE PLUGGABLE DATABASE HR_PDBT AS APPLICATION  ADMIN USER app_admin IDENTIFIED BY Password1

FILE_NAME_CONVERT=('F:\ORACLE\ORADATA\EASYTRAINING\','F:\ORACLE\ORADATA\EASYTRAINING\training_app\');




=====================================



--- ------------------------------ --- ---------------------------- ---

    CON_ID

----------

PENDING_ROLE_CHANGE_TASKS

--------------------------------------------------------------------------------

  CON_DBID FOR SUP

---------- --- ---



SQL>

SQL>

SQL> show pdbs


    CON_ID CON_NAME                       OPEN MODE  RESTRICTED

---------- ------------------------------ ---------- ----------

         2 PDB$SEED                       READ ONLY  NO

         3 CDB_PDB1                       MOUNTED

         4 PDB1                           READ WRITE NO

         5 PDBTEST                        MOUNTED

SQL> exit

Disconnected from Oracle Database 19c Enterprise Edition Release 19.0.0.0.0 - Production

Version 19.3.0.0.0


C:\Users\admin>set ORACLE_SID=EASYTRAINING


C:\Users\admin>sqlplus


SQL*Plus: Release 19.0.0.0.0 - Production on Fri Mar 19 11:57:21 2021

Version 19.3.0.0.0


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


Enter user-name: / as sysdba

ERROR:

ORA-12560: TNS:protocol adapter error



Enter user-name: / as sysdba

Connected.

SQL> exit

Disconnected


C:\Users\admin>sqlplus


SQL*Plus: Release 19.0.0.0.0 - Production on Fri Mar 19 11:58:19 2021

Version 19.3.0.0.0


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


Enter user-name: / as sysdba

Connected.

SQL> show pdbs

ERROR:

ORA-01012: not logged on

Process ID: 0

Session ID: 0 Serial number: 0



SP2-1545: This feature requires Database availability.

SQL> exit

Disconnected


C:\Users\admin>sqlplus


SQL*Plus: Release 19.0.0.0.0 - Production on Fri Mar 19 11:58:58 2021

Version 19.3.0.0.0


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


Enter user-name: / as sysdba


Connected to:

Oracle Database 19c Enterprise Edition Release 19.0.0.0.0 - Production

Version 19.3.0.0.0


SQL> show pdbs


    CON_ID CON_NAME                       OPEN MODE  RESTRICTED

---------- ------------------------------ ---------- ----------

         2 PDB$SEED                       READ ONLY  NO

         3 ORCLPDB                        MOUNTED

SQL> CREATE PLUGGABLE DATABASE  HR_ROOT AS APPLICATION CONTAINER ADMIN USER app_admin IDENTIFIED BY Password1;

CREATE PLUGGABLE DATABASE  HR_ROOT AS APPLICATION CONTAINER ADMIN USER app_admin IDENTIFIED BY Password1

                                                                                                       *

ERROR at line 1:

ORA-65016: FILE_NAME_CONVERT must be specified



SQL> select file_name from dba_data_files;


FILE_NAME

--------------------------------------------------------------------------------

F:\ORACLE\ORADATA\EASYTRAINING\SYSTEM01.DBF

F:\ORACLE\ORADATA\EASYTRAINING\SYSAUX01.DBF

F:\ORACLE\ORADATA\EASYTRAINING\UNDOTBS01.DBF

F:\ORACLE\ORADATA\EASYTRAINING\USERS01.DBF


SQL> CREATE PLUGGABLE DATABASE  HR_ROOT AS APPLICATION CONTAINER ADMIN USER app_admin IDENTIFIED BY Password1

  2  FILE_NAME_CONVERT=('F:\ORACLE\ORADATA\EASYTRAINING/');

FILE_NAME_CONVERT=('F:\ORACLE\ORADATA\EASYTRAINING/')

                                                    *

ERROR at line 2:

ORA-02000: missing , keyword



SQL>

SQL> CREATE PLUGGABLE DATABASE  HR_ROOT AS APPLICATION CONTAINER ADMIN USER app_admin IDENTIFIED BY Password1

  2  FILE_NAME_CONVERT=('F:\ORACLE\ORADATA\EASYTRAINING\');

FILE_NAME_CONVERT=('F:\ORACLE\ORADATA\EASYTRAINING\')

                                                    *

ERROR at line 2:

ORA-02000: missing , keyword



SQL> CREATE PLUGGABLE DATABASE  HR_ROOT AS APPLICATION CONTAINER ADMIN USER app_admin IDENTIFIED BY Password1

  2  FILE_NAME_CONVERT=('F:\ORACLE\ORADATA\EASYTRAINING\',F:\ORACLE\ORADATA\EASYTRAINING\training_app\');

FILE_NAME_CONVERT=('F:\ORACLE\ORADATA\EASYTRAINING\',F:\ORACLE\ORADATA\EASYTRAINING\training_app\')

                                                     *

ERROR at line 2:

ORA-65005: missing or invalid file name pattern for file -



SQL> CREATE PLUGGABLE DATABASE  HR_ROOT AS APPLICATION CONTAINER ADMIN USER app_admin IDENTIFIED BY Password1

  2  FILE_NAME_CONVERT=('F:\ORACLE\ORADATA\EASYTRAINING\','F:\ORACLE\ORADATA\EASYTRAINING\training_app\');


Pluggable database created.


SQL> show pdbs


    CON_ID CON_NAME                       OPEN MODE  RESTRICTED

---------- ------------------------------ ---------- ----------

         2 PDB$SEED                       READ ONLY  NO

         3 ORCLPDB                        MOUNTED

         4 HR_ROOT                        MOUNTED

SQL> ALTER PLUGGABLE DATABASE HR_ROOT OPEN;


Pluggable database altered.


SQL> alter session set container = HR_ROOT;


Session altered.


SQL> CREATE PLUGGABLE DATABASE HR_PDB1 ADMIN USER pdb_admin IDENTIFIED BY Password1;

CREATE PLUGGABLE DATABASE HR_PDB1 ADMIN USER pdb_admin IDENTIFIED BY Password1

                                                                             *

ERROR at line 1:

ORA-65016: FILE_NAME_CONVERT must be specified



SQL>

SQL> CREATE PLUGGABLE DATABASE HR_PDB1 ADMIN USER pdb_admin IDENTIFIED BY Password1

  2  FILE_NAME_CONVERT=('F:\ORACLE\ORADATA\EASYTRAINING\','F:\ORACLE\ORADATA\EASYTRAINING\training_app\');

CREATE PLUGGABLE DATABASE HR_PDB1 ADMIN USER pdb_admin IDENTIFIED BY Password1

*

ERROR at line 1:

ORA-01537: cannot add file

'F:\ORACLE\ORADATA\EASYTRAINING\TRAINING_APP\PDBSEED\SYSTEM01.DBF' - file

already part of database





SQL> CREATE PLUGGABLE DATABASE HR_PDB1 ADMIN USER pdb_admin IDENTIFIED BY Password1

  2  FILE_NAME_CONVERT=('F:\ORACLE\ORADATA\EASYTRAINING\','F:\oracle\oradata\EASYTRAINING\training_app\app_pdb');


Pluggable database created.


SQL>



CREATE PLUGGABLE DATABASE hr_root_dev

AS APPLICATION CONTAINER FROM HR_ROOT@HR_ROOT

  FILE_NAME_CONVERT=('F:\ORACLE\ORADATA\CDB2\', 'F:\ORACLE\ORADATA\CDB2\training_app\app_pdb');


SQL> CREATE PLUGGABLE DATABASE hr_root_dev

  2  AS APPLICATION CONTAINER FROM HR_ROOT@HR_ROOT

  3    FILE_NAME_CONVERT=('F:\ORACLE\ORADATA\CDB2\', 'F:\ORACLE\ORADATA\CDB2\training_app\app_pdb');

CREATE PLUGGABLE DATABASE hr_root_dev

*

ERROR at line 1:

ORA-04054: database link HR_ROOT does not exist


CREATE PUBLIC DATABASE LINK  HR_ROOT 

   USING ' HR_ROOT'; 




CREATE PUBLIC DATABASE LINK  HR_ROOT1 

   USING ' EASYTRAINING'; 




SQL>





CREATE PLUGGABLE DATABASE hr_root_dev

AS APPLICATION CONTAINER FROM HR_ROOT1@HR_ROOT1

  FILE_NAME_CONVERT=('F:\ORACLE\ORADATA\CDB2\', 'F:\ORACLE\ORADATA\CDB2\training_app\app_pdb');


No comments:

Post a Comment