远程克隆PDB

基础环境:

源端:Oracle Database 12c Enterprise Edition Release 12.2.0.1.0 - 64bit Production

目标端:Oracle Database 19c Enterprise Edition Release 19.0.0.0.0 - Production

源端:

1.查看undo管理方式,需要开启本地undo
SQL> col PROPERTY_NAME for a25;
SQL> col PROPERTY_VALUE for a25;
SQL> SELECT property_name, property_value FROM database_properties WHERE property_name = 'LOCAL_UNDO_ENABLED';

PROPERTY_NAME             PROPERTY_VALUE
------------------------- -------------------------
LOCAL_UNDO_ENABLED        TRUE

2.确认归档开启
SQL> archive log list;
Database log mode              Archive Mode
Automatic archival             Enabled
Archive destination            +FLASH
Oldest online log sequence     192
Next log sequence to archive   193
Current log sequence           193

3.创建克隆用户
CREATE USER c##adminpdb IDENTIFIED BY adminpdb CONTAINER=ALL;
GRANT CREATE SESSION, CREATE PLUGGABLE DATABASE TO c##adminpdb CONTAINER=ALL;

也可以使用pdb本身的system用户,需要提前授权。
grant create pluggable database to system;


目标端:

1.创建指向源端的tns
pdbtest =
  (DESCRIPTION =
    (ADDRESS = (PROTOCOL = TCP)(HOST = 172.16.48.10)(PORT = 1522))
    (CONNECT_DATA =
      (SERVER = DEDICATED)
      (SERVICE_NAME = pdbtest)
    )
  )
  
2.创建指向源端的dblink
SQL> CREATE DATABASE LINK to10291 CONNECT TO system IDENTIFIED BY oracle using 'pdbtest';
SQL> select * from [email protected];

D
-
X

SQL> CREATE PLUGGABLE DATABASE pdbnew FROM [email protected] FILE_NAME_CONVERT =('+DATA','+DATA01');

------------------------------------
select name, cause, type, message, status from PDB_PLUG_IN_VIOLATIONs order by name;
NAME	CAUSE	TYPE	MESSAGE	STATUS
PDBNEW	OPTION	ERROR	Database option APS mismatch: PDB installed version 12.2.0.1.0. CDB installed version 19.0.0.0.0.	PENDING
PDBNEW	OPTION	ERROR	Database option CATALOG mismatch: PDB installed version 12.2.0.1.0. CDB installed version 19.0.0.0.0.	PENDING
PDBNEW	OPTION	ERROR	Database option CATJAVA mismatch: PDB installed version 12.2.0.1.0. CDB installed version 19.0.0.0.0.	PENDING
PDBNEW	OPTION	ERROR	Database option CATPROC mismatch: PDB installed version 12.2.0.1.0. CDB installed version 19.0.0.0.0.	PENDING
PDBNEW	OPTION	ERROR	Database option CONTEXT mismatch: PDB installed version 12.2.0.1.0. CDB installed version 19.0.0.0.0.	PENDING
PDBNEW	OPTION	ERROR	Database option DV mismatch: PDB installed version 12.2.0.1.0. CDB installed version 19.0.0.0.0.	PENDING
PDBNEW	OPTION	ERROR	Database option JAVAVM mismatch: PDB installed version 12.2.0.1.0. CDB installed version 19.0.0.0.0.	PENDING
PDBNEW	OPTION	ERROR	Database option OLS mismatch: PDB installed version 12.2.0.1.0. CDB installed version 19.0.0.0.0.	PENDING
PDBNEW	OPTION	ERROR	Database option ORDIM mismatch: PDB installed version 12.2.0.1.0. CDB installed version 19.0.0.0.0.	PENDING
PDBNEW	OPTION	ERROR	Database option OWM mismatch: PDB installed version 12.2.0.1.0. CDB installed version 19.0.0.0.0.	PENDING
PDBNEW	OPTION	ERROR	Database option SDO mismatch: PDB installed version 12.2.0.1.0. CDB installed version 19.0.0.0.0.	PENDING
PDBNEW	OPTION	ERROR	Database option XDB mismatch: PDB installed version 12.2.0.1.0. CDB installed version 19.0.0.0.0.	PENDING
PDBNEW	OPTION	ERROR	Database option XML mismatch: PDB installed version 12.2.0.1.0. CDB installed version 19.0.0.0.0.	PENDING
PDBNEW	OPTION	ERROR	Database option XOQ mismatch: PDB installed version 12.2.0.1.0. CDB installed version 19.0.0.0.0.	PENDING
PDBNEW	OPTION	WARNING	Database option RAC mismatch: PDB installed version 12.2.0.1.0. CDB installed version 19.0.0.0.0.	PENDING
PDBNEW	Parameter	WARNING	CDB parameter sga_max_size mismatch: Previous 260G Current 100G	PENDING
PDBNEW	Parameter	WARNING	CDB parameter pga_aggregate_limit mismatch: Previous 120G Current 0	PENDING
PDBNEW	Parameter	WARNING	CDB parameter nls_language mismatch: Previous 'SIMPLIFIED CHINESE' Current 'AMERICAN'	PENDING
PDBNEW	Parameter	WARNING	CDB parameter nls_territory mismatch: Previous 'CHINA' Current 'AMERICA'	PENDING
PDBNEW	Parameter	WARNING	CDB parameter compatible mismatch: Previous '12.2.0' Current '19.0.0'	PENDING
PDBNEW	Parameter	WARNING	CDB parameter session_cached_cursors mismatch: Previous 300 Current 50	PENDING
PDBNEW	Parameter	WARNING	CDB parameter open_cursors mismatch: Previous 1000 Current 300	PENDING
PDBNEW	Parameter	WARNING	CDB parameter pga_aggregate_target mismatch: Previous 60G Current 40G	PENDING
PDBNEW	Oracle Opatch	WARNING	Oracle opatch mismatch: opatch 30122814 is missing in the CDB.	PENDING
PDBNEW	VSN not match	ERROR	PDB's version does not match CDB's version: PDB's version 12.2.0.1.0. CDB's version 19.0.0.0.0.	PENDING
UCDB	SQL Patch	ERROR	'19.9.0.0.0 Release_Update 2009301832' is installed in the CDB but no release updates are installed in the PDB	RESOLVED

SQL> show pdbs;

    CON_ID CON_NAME                       OPEN MODE  RESTRICTED
---------- ------------------------------ ---------- ----------
         2 PDB$SEED                       READ ONLY  NO
         3 UCDB                           READ WRITE NO
         4 PDBTEST                        READ WRITE NO
         5 PDBNEW                         MIGRATE    YES


升级PDBNEW

SQL> alter session set container=PDBNEW;
Session altered.
SQL> shut immediate;
Pluggable Database closed.
SQL> alter pluggable database open upgrade;
Pluggable database altered.
[[email protected] bin]$ cd $ORACLE_HOME/rdbms/admin
[[email protected] admin]$ $ORACLE_HOME/perl/bin/perl catctl.pl -c 'PDBNEW' catupgrd.sql                                                                                                     grd.sql
Argument list for [catctl.pl]
For Oracle internal use only A = 0
Run in                       c = PDBNEW
Do not run in                C = 0
Input Directory              d = 0
Echo OFF                     e = 1
Simulate                     E = 0
Forced cleanup               F = 0
Log Id                       i = 0
Child Process                I = 0
Log Dir                      l = 0
Priority List Name           L = 0
Upgrade Mode active          M = 0
SQL Process Count            n = 0
SQL PDB Process Count        N = 0
Open Mode Normal             o = 0
Start Phase                  p = 0
End Phase                    P = 0
Reverse Order                r = 0
AutoUpgrade Resume           R = 0
Script                       s = 0
Serial Run                   S = 0
RO User Tablespaces          T = 0
Display Phases               y = 0
Debug catcon.pm              z = 0
Debug catctl.pl              Z = 0
catctl.pl VERSION: [19.0.0.0.0]
           STATUS: [Production]
            BUILD: [RDBMS_19.9.0.0.0DBRU_LINUX.X64_200930]
/u01/app/oracle/product/19.0.0/db_1/rdbms/admin/orahome = [/u01/app/oracle/prod                                                                                                     uct/19.0.0/db_1]
/u01/app/oracle/product/19.0.0/db_1/bin/orabasehome = [/u01/app/oracle/product/                                                                                                     19.0.0/db_1]
catctlGetOraBaseLogDir = [/u01/app/oracle/product/19.0.0/db_1]
Analyzing file /u01/app/oracle/product/19.0.0/db_1/rdbms/admin/catupgrd.sql
Log file directory = [/tmp/cfgtoollogs/upgrade20210221153358]
catcon::set_log_file_base_path: ALL catcon-related output will be written to [/                                                                                                     tmp/cfgtoollogs/upgrade20210221153358/catupgrd_catcon_25981.lst]
catcon::set_log_file_base_path: catcon: See [/tmp/cfgtoollogs/upgrade2021022115                                                                                                     3358/catupgrd*.log] files for output generated by scripts
catcon::set_log_file_base_path: catcon: See [/tmp/cfgtoollogs/upgrade2021022115                                                                                                     3358/catupgrd_*.lst] files for spool files, if any
Number of Cpus        = 40
Database Name         = zjcdbb
DataBase Version      = 19.0.0.0.0
catcon::set_log_file_base_path: ALL catcon-related output will be written to [/                                                                                                     u01/app/oracle/product/19.0.0/db_1/cfgtoollogs/zjcdbb/upgrade20210221153359/cat                                                                                                     upgrd_catcon_25981.lst]
catcon::set_log_file_base_path: catcon: See [/u01/app/oracle/product/19.0.0/db_                                                                                                     1/cfgtoollogs/zjcdbb/upgrade20210221153359/catupgrd*.log] files for output gene                                                                                                     rated by scripts
catcon::set_log_file_base_path: catcon: See [/u01/app/oracle/product/19.0.0/db_                                                                                                     1/cfgtoollogs/zjcdbb/upgrade20210221153359/catupgrd_*.lst] files for spool file                                                                                                     s, if any
Log file directory = [/u01/app/oracle/product/19.0.0/db_1/cfgtoollogs/zjcdbb/up                                                                                                     grade20210221153359]
Parallel SQL Process Count (PDB)      = 2
Parallel SQL Process Count (CDB$ROOT) = 8
Concurrent PDB Upgrades               = 20
Generated PDB Inclusion:[PDBNEW]
CDB$ROOT  Open Mode = [OPEN]
Concurrent PDB Upgrades Reset           = 1
DataBase Version      = 19.0.0.0.0
Start processing of PDBs (PDBNEW)
[/u01/app/oracle/product/19.0.0/db_1/perl/bin/perl catctl.pl -c 'PDBNEW' -I -i pdbnew -n 2 -l /u01/app/oracle/product/19.0.0/db_1/cfgtoollogs/zjcdbb/upgrade20210221153359 catupgrd.sql]
Argument list for [catctl.pl]
For Oracle internal use only A = 0
Run in                       c = PDBNEW
Do not run in                C = 0
Input Directory              d = 0
Echo OFF                     e = 1
Simulate                     E = 0
Forced cleanup               F = 0
Log Id                       i = pdbnew
Child Process                I = 1
Log Dir                      l = /u01/app/oracle/product/19.0.0/db_1/cfgtoollogs/zjcdbb/upgrade20210221153359
Priority List Name           L = 0
Upgrade Mode active          M = 0
SQL Process Count            n = 2
SQL PDB Process Count        N = 0
Open Mode Normal             o = 0
Start Phase                  p = 0
End Phase                    P = 0
Reverse Order                r = 0
AutoUpgrade Resume           R = 0
Script                       s = 0
Serial Run                   S = 0
RO User Tablespaces          T = 0
Display Phases               y = 0
Debug catcon.pm              z = 0
Debug catctl.pl              Z = 0
catctl.pl VERSION: [19.0.0.0.0]
           STATUS: [Production]
            BUILD: [RDBMS_19.9.0.0.0DBRU_LINUX.X64_200930]
/u01/app/oracle/product/19.0.0/db_1/rdbms/admin/orahome = [/u01/app/oracle/product/19.0.0/db_1]
/u01/app/oracle/product/19.0.0/db_1/bin/orabasehome = [/u01/app/oracle/product/19.0.0/db_1]
catctlGetOraBaseLogDir = [/u01/app/oracle/product/19.0.0/db_1]
Analyzing file /u01/app/oracle/product/19.0.0/db_1/rdbms/admin/catupgrd.sql
Log file directory = [/u01/app/oracle/product/19.0.0/db_1/cfgtoollogs/zjcdbb/upgrade20210221153359]
catcon::set_log_file_base_path: ALL catcon-related output will be written to [/u01/app/oracle/product/19.0.0/db_1/cfgtoollogs/zjcdbb/upgrade20210221153359/catupgrdpdbnew_catcon_26323.lst]
catcon::set_log_file_base_path: catcon: See [/u01/app/oracle/product/19.0.0/db_1/cfgtoollogs/zjcdbb/upgrade20210221153359/catupgrdpdbnew*.log] files for output generated by scripts
catcon::set_log_file_base_path: catcon: See [/u01/app/oracle/product/19.0.0/db_1/cfgtoollogs/zjcdbb/upgrade20210221153359/catupgrdpdbnew_*.lst] files for spool files, if any
Number of Cpus        = 40
Database Name         = zjcdbb
DataBase Version      = 19.0.0.0.0
PDBNEW Open Mode = [MIGRATE]
Generated PDB Inclusion:[PDBNEW]
CDB$ROOT  Open Mode = [OPEN]
Components in [PDBNEW]
    Installed [APS CATALOG CATJAVA CATPROC CONTEXT DV JAVAVM OLS ORDIM OWM RAC SDO XDB XML XOQ]
Not Installed [APEX EM MGW ODM WK]
DataBase Version      = 19.0.0.0.0
------------------------------------------------------
Phases [0-107]         Start Time:[2021_02_21 15:34:08]
Container Lists Inclusion:[PDBNEW] Exclusion:[NONE]
------------------------------------------------------
***********   Executing Change Scripts   ***********
Serial   Phase #:0    [PDBNEW] Files:1    Time: 21s
***************   Catalog Core SQL   ***************
Serial   Phase #:1    [PDBNEW] Files:5    Time: 31s
Restart  Phase #:2    [PDBNEW] Files:1    Time: 0s
***********   Catalog Tables and Views   ***********
Parallel Phase #:3    [PDBNEW] Files:19   Time: 13s
Restart  Phase #:4    [PDBNEW] Files:1    Time: 0s
*************   Catalog Final Scripts   ************
Serial   Phase #:5    [PDBNEW] Files:7    Time: 14s
*****************   Catproc Start   ****************
Serial   Phase #:6    [PDBNEW] Files:1    Time: 7s
*****************   Catproc Types   ****************
Serial   Phase #:7    [PDBNEW] Files:2    Time: 6s
Restart  Phase #:8    [PDBNEW] Files:1    Time: 0s
****************   Catproc Tables   ****************
Parallel Phase #:9    [PDBNEW] Files:67   Time: 21s
Restart  Phase #:10   [PDBNEW] Files:1    Time: 0s
*************   Catproc Package Specs   ************
Serial   Phase #:11   [PDBNEW] Files:1    Time: 43s
Restart  Phase #:12   [PDBNEW] Files:1    Time: 0s
**************   Catproc Procedures   **************
Parallel Phase #:13   [PDBNEW] Files:94   Time: 4s
Restart  Phase #:14   [PDBNEW] Files:1    Time: 0s
Parallel Phase #:15   [PDBNEW] Files:121  Time: 7s
Restart  Phase #:16   [PDBNEW] Files:1    Time: 0s
Serial   Phase #:17   [PDBNEW] Files:22   Time: 2s
Restart  Phase #:18   [PDBNEW] Files:1    Time: 0s
*****************   Catproc Views   ****************
Parallel Phase #:19   [PDBNEW] Files:32   Time: 13s
Restart  Phase #:20   [PDBNEW] Files:1    Time: 0s
Serial   Phase #:21   [PDBNEW] Files:3    Time: 10s
Restart  Phase #:22   [PDBNEW] Files:1    Time: 0s
Parallel Phase #:23   [PDBNEW] Files:25   Time: 99s
Restart  Phase #:24   [PDBNEW] Files:1    Time: 0s
Parallel Phase #:25   [PDBNEW] Files:12   Time: 70s
Restart  Phase #:26   [PDBNEW] Files:1    Time: 0s
Serial   Phase #:27   [PDBNEW] Files:1    Time: 0s
Serial   Phase #:28   [PDBNEW] Files:3    Time: 3s
Serial   Phase #:29   [PDBNEW] Files:1    Time: 0s
Restart  Phase #:30   [PDBNEW] Files:1    Time: 0s
***************   Catproc CDB Views   **************
Serial   Phase #:31   [PDBNEW] Files:1    Time: 0s
Restart  Phase #:32   [PDBNEW] Files:1    Time: 0s
Serial   Phase #:34   [PDBNEW] Files:1    Time: 0s
*****************   Catproc PLBs   *****************
Serial   Phase #:35   [PDBNEW] Files:295  Time: 16s
Serial   Phase #:36   [PDBNEW] Files:1    Time: 0s
Restart  Phase #:37   [PDBNEW] Files:1    Time: 0s
Serial   Phase #:38   [PDBNEW] Files:6    Time: 2s
Restart  Phase #:39   [PDBNEW] Files:1    Time: 0s
***************   Catproc DataPump   ***************
Serial   Phase #:40   [PDBNEW] Files:3    Time: 36s
Restart  Phase #:41   [PDBNEW] Files:1    Time: 0s
******************   Catproc SQL   *****************
Parallel Phase #:42   [PDBNEW] Files:13   Time: 67s
Restart  Phase #:43   [PDBNEW] Files:1    Time: 0s
Parallel Phase #:44   [PDBNEW] Files:11   Time: 3s
Restart  Phase #:45   [PDBNEW] Files:1    Time: 1s
Parallel Phase #:46   [PDBNEW] Files:3    Time: 1s
Restart  Phase #:47   [PDBNEW] Files:1    Time: 0s
*************   Final Catproc scripts   ************
Serial   Phase #:48   [PDBNEW] Files:1    Time: 5s
Restart  Phase #:49   [PDBNEW] Files:1    Time: 1s
**************   Final RDBMS scripts   *************
Serial   Phase #:50   [PDBNEW] Files:1    Time: 5s
************   Upgrade Component Start   ***********
Serial   Phase #:51   [PDBNEW] Files:1    Time: 0s
Restart  Phase #:52   [PDBNEW] Files:1    Time: 0s
**********   Upgrading Java and non-Java   *********
Serial   Phase #:53   [PDBNEW] Files:2    Time: 166s
*****************   Upgrading XDB   ****************
Restart  Phase #:54   [PDBNEW] Files:1    Time: 0s
Serial   Phase #:56   [PDBNEW] Files:3    Time: 6s
Serial   Phase #:57   [PDBNEW] Files:3    Time: 2s
Parallel Phase #:58   [PDBNEW] Files:10   Time: 1s
Parallel Phase #:59   [PDBNEW] Files:25   Time: 4s
Serial   Phase #:60   [PDBNEW] Files:4    Time: 7s
Serial   Phase #:61   [PDBNEW] Files:1    Time: 0s
Serial   Phase #:62   [PDBNEW] Files:32   Time: 3s
Serial   Phase #:63   [PDBNEW] Files:1    Time: 0s
Parallel Phase #:64   [PDBNEW] Files:6    Time: 6s
Serial   Phase #:65   [PDBNEW] Files:2    Time: 16s
Serial   Phase #:66   [PDBNEW] Files:3    Time: 19s
****************   Upgrading ORDIM   ***************
Restart  Phase #:67   [PDBNEW] Files:1    Time: 0s
Serial   Phase #:69   [PDBNEW] Files:1    Time: 1s
Parallel Phase #:70   [PDBNEW] Files:2    Time: 6s
Restart  Phase #:71   [PDBNEW] Files:1    Time: 0s
Parallel Phase #:72   [PDBNEW] Files:2    Time: 1s
Serial   Phase #:73   [PDBNEW] Files:2    Time: 1s
*****************   Upgrading SDO   ****************
Restart  Phase #:74   [PDBNEW] Files:1    Time: 0s
Serial   Phase #:76   [PDBNEW] Files:1    Time: 27s
Serial   Phase #:77   [PDBNEW] Files:2    Time: 2s
Restart  Phase #:78   [PDBNEW] Files:1    Time: 0s
Serial   Phase #:79   [PDBNEW] Files:1    Time: 4s
Restart  Phase #:80   [PDBNEW] Files:1    Time: 0s
Parallel Phase #:81   [PDBNEW] Files:3    Time: 33s
Restart  Phase #:82   [PDBNEW] Files:1    Time: 0s
Serial   Phase #:83   [PDBNEW] Files:1    Time: 4s
Restart  Phase #:84   [PDBNEW] Files:1    Time: 0s
Serial   Phase #:85   [PDBNEW] Files:1    Time: 8s
Restart  Phase #:86   [PDBNEW] Files:1    Time: 0s
Parallel Phase #:87   [PDBNEW] Files:4    Time: 39s
Restart  Phase #:88   [PDBNEW] Files:1    Time: 0s
Serial   Phase #:89   [PDBNEW] Files:1    Time: 1s
Restart  Phase #:90   [PDBNEW] Files:1    Time: 1s
Serial   Phase #:91   [PDBNEW] Files:2    Time: 11s
Restart  Phase #:92   [PDBNEW] Files:1    Time: 1s
Serial   Phase #:93   [PDBNEW] Files:1    Time: 0s
Restart  Phase #:94   [PDBNEW] Files:1    Time: 0s
*******   Upgrading ODM, WK, EXF, RUL, XOQ   *******
Serial   Phase #:95   [PDBNEW] Files:1    Time: 8s
Restart  Phase #:96   [PDBNEW] Files:1    Time: 0s
***********   Final Component scripts    ***********
Serial   Phase #:97   [PDBNEW] Files:1    Time: 2s
*************   Final Upgrade scripts   ************
Serial   Phase #:98   [PDBNEW] Files:1   Time: 256s
*******************   Migration   ******************
Serial   Phase #:99   [PDBNEW] Files:1    Time: 1s
***   End PDB Application Upgrade Pre-Shutdown   ***
Serial   Phase #:100  [PDBNEW] Files:1    Time: 1s
Serial   Phase #:101  [PDBNEW] Files:1    Time: 3s
Serial   Phase #:102  [PDBNEW] Files:1    Time: 2s
*****************   Post Upgrade   *****************
Serial   Phase #:103  [PDBNEW] Files:1    Time: 41s
****************   Summary report   ****************
Serial   Phase #:104  [PDBNEW] Files:1    Time: 1s
***   End PDB Application Upgrade Post-Shutdown   **
Serial   Phase #:105  [PDBNEW] Files:1    Time: 1s
Serial   Phase #:106  [PDBNEW] Files:1    Time: 3s
Serial   Phase #:107  [PDBNEW] Files:1     Time: 0s
------------------------------------------------------
Phases [0-107]         End Time:[2021_02_21 15:53:58]
Container Lists Inclusion:[PDBNEW] Exclusion:[NONE]
------------------------------------------------------
Grand Total Time: 1192s [PDBNEW]
 LOG FILES: (/u01/app/oracle/product/19.0.0/db_1/cfgtoollogs/zjcdbb/upgrade20210221153359/catupgrdpdbnew*.log)
Upgrade Summary Report Located in:
/u01/app/oracle/product/19.0.0/db_1/cfgtoollogs/zjcdbb/upgrade20210221153359/upg_summary.log
     Time: 1203s For PDB(s)
Grand Total Time: 1203s
 LOG FILES: (/u01/app/oracle/product/19.0.0/db_1/cfgtoollogs/zjcdbb/upgrade20210221153359/catupgrd*.log)
Grand Total Upgrade Time:    [0d:0h:20m:3s]
SQL> show pdbs;
    CON_ID CON_NAME                       OPEN MODE  RESTRICTED
---------- ------------------------------ ---------- ----------
         2 PDB$SEED                       READ ONLY  NO
         3 UCDB                           READ WRITE NO
         4 PDBTEST                        READ WRITE NO
         5 PDBNEW                         MOUNTED
SQL> alter pluggable database pdbnew open;
Pluggable database altered.
SQL> show pdbs;
    CON_ID CON_NAME                       OPEN MODE  RESTRICTED
---------- ------------------------------ ---------- ----------
         2 PDB$SEED                       READ ONLY  NO
         3 UCDB                           READ WRITE NO
         4 PDBTEST                        READ WRITE NO
         5 PDBNEW                         READ WRITE NO

参考:

After 12c Database Plugging and Unplugging, PDB Database Cannot Be Turned On (Doc ID 1963868.1)


猜你喜欢

转载自blog.51cto.com/hunt1574/2633611

相关文章

pdb