Перенос PDB между 12cR1 и 12cR2 с помощью unplug/plug

Процесс переноса подключаемой БД (PDB) между платформами Oracle 12cR1 и 12cR2 возможен методом plug/unplug. Это позволит обойти ошибку различия версий.

Источники:

  1. Ссылки на документацию Oracle:
  2. Ссылки на стати:

Отключение (UNPLUGGING) PDB

Останавливаем PDB и извлекаем ее методом unplug. После извлечения рекомендуется остановить и контейнерную ДБ, чтобы не было проблемы блокировки системных табличных пространств при их копировании на новую платформу.

SQL> show pdbs

CON_ID CON_NAME OPEN MODE RESTRICTED
---------- ------------------------------ ---------- ----------
2 PDB$SEED READ ONLY NO
3 PDB1 READ WRITE NO

SQL> alter pluggable database PDB1 close;

Подключаемая база данных изменена.

SQL> alter pluggable database pdb1 unplug into '/u01/app/oracle/pdb1.xml';

Подключаемая база данных изменена.

SQL> shutdown immediate
База данных закрыта.
База данных размонтирована.
Экземпляр ORACLE завершен.
SQL> quit

 

Перенос файлов

Копирование извлеченной PDB на новую платформу. Копируются все табличные пространства и файл описания БД в формате xml.

[oracle@oradb01 ~] cd /u01/app/oracle/oradata/cdb/pdb1

[oracle@oradb01 pdb1] scp * oracle@oradb02:/u01/app/oracle/oradata/cdb/pdb2/

[oracle@oradb01 ~] cd /u01/app/oracle/

[oracle@oradb01 oracle] scp pdb1.xml oracle@oradb02:/u01/app/oracle/

 

Подключение (PLUGGING) PDB

На новой платформе создается новая PDB на основе скопированного описания. При вызове необходимо описать соответствие старых путей размещения файлов табличных пространств и новых.

SQL> CREATE PLUGGABLE DATABASE pdb2 USING '/u01/app/oracle/pdb1.xml'
SOURCE_FILE_NAME_CONVERT=('/u01/app/oracle/oradata/cdb/pdb1/sysaux01.dbf','/u01/app/oracle/oradata/cdb/pdb2/sysaux01.dbf',
'/u01/app/oracle/oradata/cdb/pdb1/temp01.dbf','/u01/app/oracle/oradata/cdb/pdb2/temp01.dbf',
'/u01/app/oracle/oradata/cdb/pdb1/system01.dbf','/u01/app/oracle/oradata/cdb/pdb2/system01.dbf',
'/u01/app/oracle/oradata/cdb/pdb1/users01.dbf','/u01/app/oracle/oradata/cdb/pdb2/users01.dbf')
NOCOPY
TEMPFILE REUSE;

Подключаемая база данных создана.

 

После создания PDB попытка ее запуска приведет к сообщению “Подключаемая база данных изменена с ошибками.”. Это связано с ошибками совместимости версий Oracle. Необходимо обновить созданную PDB до текущей версии Oracle.

SQL> show pdbs

CON_ID CON_NAME OPEN MODE RESTRICTED
---------- ------------------------------ ---------- ----------
2 PDB$SEED READ ONLY NO
3 PDB2 MOUNTED

SQL> alter pluggable database pdb2 open;

Предупреждение: Подключаемая база данных изменена с ошибками.

 

Процесс обновления (апгрейда) PDB относительно долгий. В данном примере занял около получаса (как видно из приведенного лога).

[oracle@oradb02 pdb2] $ORACLE_HOME/bin/dbupgrade -c PDB2

Argument list for [/u01/app/oracle/product/12.2.0/dbhome_1/rdbms/admin/catctl.pl]
Run in c = pdb2
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: [12.2.0.1.0]
STATUS: [production]
BUILD: [RDBMS_12.2.0.1.0_LINUX.X64_170125]

/u01/app/oracle/product/12.2.0/dbhome_1/rdbms/admin/orahome = [/u01/app/oracle/product/12.2.0/dbhome_1]
/u01/app/oracle/product/12.2.0/dbhome_1/bin/orabasehome = [/u01/app/oracle/product/12.2.0/dbhome_1]
catctlGetOrabase = [/u01/app/oracle/product/12.2.0/dbhome_1]

Analyzing file /u01/app/oracle/product/12.2.0/dbhome_1/rdbms/admin/catupgrd.sql

Log file directory = [/tmp/cfgtoollogs/upgrade20170614175558]

catcon: ALL catcon-related output will be written to [/tmp/cfgtoollogs/upgrade20170614175558/catupgrd_catcon_52401.lst]
catcon: See [/tmp/cfgtoollogs/upgrade20170614175558/catupgrd*.log] files for output generated by scripts
catcon: See [/tmp/cfgtoollogs/upgrade20170614175558/catupgrd_*.lst] files for spool files, if any

Number of Cpus = 8
Database Name = cdb
DataBase Version = 12.2.0.1.0
catcon: ALL catcon-related output will be written to [/u01/app/oracle/product/12.2.0/dbhome_1/cfgtoollogs/cdb/upgrade20170614175559/catupgrd_catcon_52401.lst]
catcon: See [/u01/app/oracle/product/12.2.0/dbhome_1/cfgtoollogs/cdb/upgrade20170614175559/catupgrd*.log] files for output generated by scripts
catcon: See [/u01/app/oracle/product/12.2.0/dbhome_1/cfgtoollogs/cdb/upgrade20170614175559/catupgrd_*.lst] files for spool files, if any

Log file directory = [/u01/app/oracle/product/12.2.0/dbhome_1/cfgtoollogs/cdb/upgrade20170614175559]

Parallel SQL Process Count (PDB) = 2
Parallel SQL Process Count (CDB$ROOT) = 8
Concurrent PDB Upgrades = 4
Generated PDB Inclusion:[PDB2]
CDB$ROOT Open Mode = [OPEN]

Start processing of PDB2
[/u01/app/oracle/product/12.2.0/dbhome_1/perl/bin/perl /u01/app/oracle/product/12.2.0/dbhome_1/rdbms/admin/catctl.pl -c 'PDB2' -I -i pdb2 -n 2 -l /u01/app/oracle/product/12.2.0/dbhome_1/cfgtoollogs/cdb/upgrade20170614175559 /u01/app/oracle/product/12.2.0/dbhome_1/rdbms/admin/catupgrd.sql]

Argument list for [/u01/app/oracle/product/12.2.0/dbhome_1/rdbms/admin/catctl.pl]
Run in c = PDB2
Do not run in C = 0
Input Directory d = 0
Echo OFF e = 1
Simulate E = 0
Forced cleanup F = 0
Log Id i = pdb2
Child Process I = 1
Log Dir l = /u01/app/oracle/product/12.2.0/dbhome_1/cfgtoollogs/cdb/upgrade20170614175559
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: [12.2.0.1.0]
STATUS: [production]
BUILD: [RDBMS_12.2.0.1.0_LINUX.X64_170125]

/u01/app/oracle/product/12.2.0/dbhome_1/rdbms/admin/orahome = [/u01/app/oracle/product/12.2.0/dbhome_1]
/u01/app/oracle/product/12.2.0/dbhome_1/bin/orabasehome = [/u01/app/oracle/product/12.2.0/dbhome_1]
catctlGetOrabase = [/u01/app/oracle/product/12.2.0/dbhome_1]

Analyzing file /u01/app/oracle/product/12.2.0/dbhome_1/rdbms/admin/catupgrd.sql

Log file directory = [/u01/app/oracle/product/12.2.0/dbhome_1/cfgtoollogs/cdb/upgrade20170614175559]

catcon: ALL catcon-related output will be written to [/u01/app/oracle/product/12.2.0/dbhome_1/cfgtoollogs/cdb/upgrade20170614175559/catupgrdpdb2_catcon_52696.lst]
catcon: See [/u01/app/oracle/product/12.2.0/dbhome_1/cfgtoollogs/cdb/upgrade20170614175559/catupgrdpdb2*.log] files for output generated by scripts
catcon: See [/u01/app/oracle/product/12.2.0/dbhome_1/cfgtoollogs/cdb/upgrade20170614175559/catupgrdpdb2_*.lst] files for spool files, if any

Number of Cpus = 8
Database Name = cdb
DataBase Version = 12.2.0.1.0
Generated PDB Inclusion:[PDB2]
CDB$ROOT Open Mode = [OPEN]
Components in [PDB2]
Installed [APEX APS CATALOG CATJAVA CATPROC CONTEXT DV JAVAVM OLS ORDIM OWM SDO XDB XML XOQ]
Not Installed [EM MGW ODM RAC WK]

------------------------------------------------------
Phases [0-115] Start Time:[2017_06_14 17:56:04]
Container Lists Inclusion:[PDB2] Exclusion:[NONE]
------------------------------------------------------
*********** Executing Change Scripts ***********
Serial Phase #:0 [PDB2] Files:1 Time: 22s
*************** Catalog Core SQL ***************
Serial Phase #:1 [PDB2] Files:5 Time: 34s
Restart Phase #:2 [PDB2] Files:1 Time: 0s
*********** Catalog Tables and Views ***********
Parallel Phase #:3 [PDB2] Files:19 Time: 13s
Restart Phase #:4 [PDB2] Files:1 Time: 0s
************* Catalog Final Scripts ************
Serial Phase #:5 [PDB2] Files:6 Time: 12s
***************** Catproc Start ****************
Serial Phase #:6 [PDB2] Files:1 Time: 7s
***************** Catproc Types ****************
Serial Phase #:7 [PDB2] Files:2 Time: 4s
Restart Phase #:8 [PDB2] Files:1 Time: 1s
**************** Catproc Tables ****************
Parallel Phase #:9 [PDB2] Files:69 Time: 16s
Restart Phase #:10 [PDB2] Files:1 Time: 0s
************* Catproc Package Specs ************
Serial Phase #:11 [PDB2] Files:1 Time: 21s
Restart Phase #:12 [PDB2] Files:1 Time: 0s
************** Catproc Procedures **************
Parallel Phase #:13 [PDB2] Files:97 Time: 4s
Restart Phase #:14 [PDB2] Files:1 Time: 0s
Parallel Phase #:15 [PDB2] Files:118 Time: 6s
Restart Phase #:16 [PDB2] Files:1 Time: 0s
Serial Phase #:17 [PDB2] Files:13 Time: 1s
Restart Phase #:18 [PDB2] Files:1 Time: 0s
***************** Catproc Views ****************
Parallel Phase #:19 [PDB2] Files:33 Time: 16s
Restart Phase #:20 [PDB2] Files:1 Time: 0s
Serial Phase #:21 [PDB2] Files:3 Time: 5s
Restart Phase #:22 [PDB2] Files:1 Time: 0s
Parallel Phase #:23 [PDB2] Files:24 Time: 55s
Restart Phase #:24 [PDB2] Files:1 Time: 0s
Parallel Phase #:25 [PDB2] Files:11 Time: 37s
Restart Phase #:26 [PDB2] Files:1 Time: 0s
Serial Phase #:27 [PDB2] Files:1 Time: 0s
Serial Phase #:28 [PDB2] Files:3 Time: 2s
Serial Phase #:29 [PDB2] Files:1 Time: 0s
Restart Phase #:30 [PDB2] Files:1 Time: 0s
*************** Catproc CDB Views **************
Serial Phase #:31 [PDB2] Files:1 Time: 1s
Restart Phase #:32 [PDB2] Files:1 Time: 0s
Serial Phase #:34 [PDB2] Files:1 Time: 0s
***************** Catproc PLBs *****************
Serial Phase #:35 [PDB2] Files:283 Time: 12s
Serial Phase #:36 [PDB2] Files:1 Time: 0s
Restart Phase #:37 [PDB2] Files:1 Time: 0s
Serial Phase #:38 [PDB2] Files:1 Time: 1s
Restart Phase #:39 [PDB2] Files:1 Time: 0s
*************** Catproc DataPump ***************
Serial Phase #:40 [PDB2] Files:3 Time: 36s
Restart Phase #:41 [PDB2] Files:1 Time: 0s
****************** Catproc SQL *****************
Parallel Phase #:42 [PDB2] Files:13 Time: 38s
Restart Phase #:43 [PDB2] Files:1 Time: 0s
Parallel Phase #:44 [PDB2] Files:12 Time: 3s
Restart Phase #:45 [PDB2] Files:1 Time: 0s
Parallel Phase #:46 [PDB2] Files:2 Time: 1s
Restart Phase #:47 [PDB2] Files:1 Time: 0s
************* Final Catproc scripts ************
Serial Phase #:48 [PDB2] Files:1 Time: 3s
Restart Phase #:49 [PDB2] Files:1 Time: 0s
************** Final RDBMS scripts *************
Serial Phase #:50 [PDB2] Files:1 Time: 12s
************ Upgrade Component Start ***********
Serial Phase #:51 [PDB2] Files:1 Time: 1s
Restart Phase #:52 [PDB2] Files:1 Time: 0s
**************** Upgrading Java ****************
Serial Phase #:53 [PDB2] Files:1 Time: 111s
Restart Phase #:54 [PDB2] Files:1 Time: 0s
***************** Upgrading XDK ****************
Serial Phase #:55 [PDB2] Files:1 Time: 34s
Restart Phase #:56 [PDB2] Files:1 Time: 0s
********* Upgrading APS,OLS,DV,CONTEXT *********
Serial Phase #:57 [PDB2] Files:1 Time: 47s
***************** Upgrading XDB ****************
Restart Phase #:58 [PDB2] Files:1 Time: 0s
Serial Phase #:60 [PDB2] Files:3 Time: 7s
Serial Phase #:61 [PDB2] Files:3 Time: 1s
Parallel Phase #:62 [PDB2] Files:9 Time: 1s
Parallel Phase #:63 [PDB2] Files:24 Time: 3s
Serial Phase #:64 [PDB2] Files:4 Time: 7s
Serial Phase #:65 [PDB2] Files:1 Time: 0s
Serial Phase #:66 [PDB2] Files:30 Time: 1s
Serial Phase #:67 [PDB2] Files:1 Time: 0s
Parallel Phase #:68 [PDB2] Files:6 Time: 3s
Serial Phase #:69 [PDB2] Files:2 Time: 13s
Serial Phase #:70 [PDB2] Files:3 Time: 22s
Restart Phase #:71 [PDB2] Files:1 Time: 0s
********* Upgrading CATJAVA,OWM,MGW,RAC ********
Serial Phase #:72 [PDB2] Files:1 Time: 46s
**************** Upgrading ORDIM ***************
Restart Phase #:73 [PDB2] Files:1 Time: 0s
Serial Phase #:75 [PDB2] Files:1 Time: 1s
Parallel Phase #:76 [PDB2] Files:2 Time: 15s
Serial Phase #:77 [PDB2] Files:1 Time: 20s
Restart Phase #:78 [PDB2] Files:1 Time: 0s
Parallel Phase #:79 [PDB2] Files:2 Time: 5s
Serial Phase #:80 [PDB2] Files:2 Time: 1s
***************** Upgrading SDO ****************
Restart Phase #:81 [PDB2] Files:1 Time: 0s
Serial Phase #:83 [PDB2] Files:1 Time: 17s
Serial Phase #:84 [PDB2] Files:1 Time: 1s
Restart Phase #:85 [PDB2] Files:1 Time: 0s
Serial Phase #:86 [PDB2] Files:1 Time: 3s
Restart Phase #:87 [PDB2] Files:1 Time: 0s
Parallel Phase #:88 [PDB2] Files:3 Time: 55s
Restart Phase #:89 [PDB2] Files:1 Time: 1s
Serial Phase #:90 [PDB2] Files:1 Time: 1s
Restart Phase #:91 [PDB2] Files:1 Time: 0s
Serial Phase #:92 [PDB2] Files:1 Time: 1s
Restart Phase #:93 [PDB2] Files:1 Time: 0s
Parallel Phase #:94 [PDB2] Files:4 Time: 19s
Restart Phase #:95 [PDB2] Files:1 Time: 1s
Serial Phase #:96 [PDB2] Files:1 Time: 0s
Restart Phase #:97 [PDB2] Files:1 Time: 0s
Serial Phase #:98 [PDB2] Files:2 Time: 27s
Restart Phase #:99 [PDB2] Files:1 Time: 1s
Serial Phase #:100 [PDB2] Files:1 Time: 0s
Restart Phase #:101 [PDB2] Files:1 Time: 0s
*********** Upgrading Misc. ODM, OLAP **********
Serial Phase #:102 [PDB2] Files:1 Time: 6s
**************** Upgrading APEX ****************
Restart Phase #:103 [PDB2] Files:1 Time: 0s
Serial Phase #:104 [PDB2] Files:1 Time: 527s
Restart Phase #:105 [PDB2] Files:1 Time: 0s
*********** Final Component scripts ***********
Serial Phase #:106 [PDB2] Files:1 Time: 0s
************* Final Upgrade scripts ************
Serial Phase #:107 [PDB2] Files:1 Time: 68s
********** End PDB Application Upgrade *********
Serial Phase #:108 [PDB2] Files:1 Time: 1s
******************* Migration ******************
Serial Phase #:109 [PDB2] Files:1 Time: 22s
Serial Phase #:110 [PDB2] Files:1 Time: 5s
Serial Phase #:111 [PDB2] Files:1 Time: 11s
***************** Post Upgrade *****************
Serial Phase #:112 [PDB2] Files:1 Time: 15s
**************** Summary report ****************
Serial Phase #:113 [PDB2] Files:1 Time: 1s
Serial Phase #:114 [PDB2] Files:1 Time: 1s
Serial Phase #:115 [PDB2] Files:1 Time: 0s

------------------------------------------------------
Phases [0-115] End Time:[2017_06_14 18:20:50]
Container Lists Inclusion:[PDB2] Exclusion:[NONE]
------------------------------------------------------

Grand Total Time: 1492s [PDB2]

LOG FILES: (/u01/app/oracle/product/12.2.0/dbhome_1/cfgtoollogs/cdb/upgrade20170614175559/catupgrdpdb2*.log)

Upgrade Summary Report Located in:
/u01/app/oracle/product/12.2.0/dbhome_1/cfgtoollogs/cdb/upgrade20170614175559/upg_summary.log

Total Upgrade Time: [0d:0h:24m:52s]

Time: 1498s For PDB(s)

Grand Total Time: 1498s

LOG FILES: (/u01/app/oracle/product/12.2.0/dbhome_1/cfgtoollogs/cdb/upgrade20170614175559/catupgrd*.log)

Grand Total Upgrade Time: [0d:0h:24m:58s]

[oracle@oradb02 pdb2] sqlplus / as sysdba

 

Теперь PDB открывается без ошибок.

SQL> alter pluggable database pdb2 open;

Подключаемая база данных изменена.

SQL>

 

Close Menu