Einhängen einer „RAC-PDB“ in eine Single-Instance-Datenbank
In diesem Blog-Post geht es mal wieder um eine Frage eines Kursteilnehmers: kann man eine Pluggable Database, die in einer RAC-Datenbank angelegt wurde, in eine Single-Instance-Container-Datenbank einhängen. Also grob gesagt: wie verhält es sich mit der RAC-Option beim Umhängen?
TL; DR: Es funktioniert.
Testen wir das doch einmal:
Mein Labor-Setup:
Eine RAC-CDB mit zwei Instanzen:
oracle@ernie:~/ [DEMOCDB1] srvctl status database -db DEMOCDB
Instance DEMOCDB1 is running on node ernie
Instance DEMOCDB2 is running on node bert
oracle@ernie:~/ [DEMOCDB1] srvctl config database -db DEMOCDB
Database unique name: DEMOCDB
Database name: DEMOCDB
Oracle home: /u00/app/oracle/product/19.14
Oracle user: oracle
[…]
oracle@ernie:~/ [DEMOCDB1] sqlplus / as sysdba
SQL*Plus: Release 19.0.0.0.0 - Production on Thu Sep 1 08:59:07 2022
Version 19.14.0.0.0
Copyright (c) 1982, 2021, Oracle. All rights reserved.
Connected to:
Oracle Database 19c Enterprise Edition Release 19.0.0.0.0 - Production
Version 19.14.0.0.0
SQL> show pdbs
CON_ID CON_NAME OPEN MODE RESTRICTED
---------- ------------------------------ ---------- ----------
2 PDB$SEED READ ONLY NO
3 DEMOPDB READ ONLY NO
6 MOVEPDB MOUNTED
SQL> exit
Disconnected from Oracle Database 19c Enterprise Edition Release 19.0.0.0.0 - Production
Version 19.14.0.0.0
Dazu habe ich eine leere Single-Instance-CDB „SICDB“ auf dem gleichen Rechner in der Version 19.16. Die zugehörige Software ist dabei ohne RAC-Option installiert. Wir haben also in diesem Fall nicht nur den Unterschied RAC vs. Single-Instance sondern auch unterschiedliche Patch-Stände.
Schritt 1: Aushängen der PDB MOVEPDB aus der RAC-CDB DEMOCDB
oracle@ernie:~/ [DEMOCDB1] sqlplus / as sysdba SQL*Plus: Release 19.0.0.0.0 - Production on Thu Sep 1 09:33:42 2022 Version 19.14.0.0.0 Copyright (c) 1982, 2021, Oracle. All rights reserved. Connected to: Oracle Database 19c Enterprise Edition Release 19.0.0.0.0 - Production Version 19.14.0.0.0 SQL> alter pluggable database MOVEPDB unplug into '/home/oracle/movepdb.xml'; Pluggable database altered. SQL> drop pluggable database MOVEPDB keep datafiles; Pluggable database dropped. SQL> exit Disconnected from Oracle Database 19c Enterprise Edition Release 19.0.0.0.0 - Production Version 19.14.0.0.0
Schritt 2: Einhängen der PDB in die Single-Instance CDB SICDB
oracle@ernie:~/ [SICDB] sqlplus / as sysdba SQL*Plus: Release 19.0.0.0.0 - Production on Thu Sep 1 09:34:56 2022 Version 19.16.0.0.0 Copyright (c) 1982, 2022, Oracle. All rights reserved. Connected to: Oracle Database 19c Enterprise Edition Release 19.0.0.0.0 - Production Version 19.16.0.0.0 SQL> create pluggable database MOVEPDB using '/home/oracle/movepdb.xml'; Pluggable database created. SQL> alter pluggable database MOVEPDB open; Warning: PDB altered with errors.
Diese Meldung kommt nicht unerwartet, denn die Ausgangsversion war ja 19.14 und unsere Ziel-CDB SICDB hat die Version 19.16. Welche Probleme hat Oracle denn mit der neuen PDB?
SQL> column cause format a15
SQL> column message format a30
SQL> column action format a30
SQL> set linesize 120
SQL> set pagesize 200
SQL> select TYPE,CAUSE,MESSAGE,ACTION from PDB_PLUG_IN_VIOLATIONS where name='MOVEPDB'
2 and status <>'RESOLVED';
TYPE CAUSE MESSAGE ACTION
--------- --------------- ------------------------------ ------------------------------
WARNING Parameter CDB parameter cluster_database Please check the parameter in
mismatch: Previous TRUE Curre the current CDB
nt FALSE
WARNING Parameter CDB parameter _fix_control mis Please check the parameter in
match: Previous '29331066:1', the current CDB
'28965084:1', '28776811:1', '2
8498976:1', '28567417:1', '285
[…]
'29738374:1', '33325981:1' Cu
rrent NULL
WARNING Parameter CDB parameter pga_aggregate_ta Please check the parameter in
rget mismatch: Previous 1600M the current CDB
Current 1200M
WARNING Oracle Opatch Oracle opatch mismatch: opatch Install the Oracle opatch in t
33561310 is missing in the CD he CDB.
B.
WARNING Oracle Opatch Oracle opatch mismatch: opatch Install the Oracle opatch in t
33515361 is missing in the CD he CDB.
B.
WARNING OPTION Database option RAC mismatch: Fix the database option in the
PDB installed version 19.0.0.0 PDB or the CDB
.0. CDB installed version NULL
.
ERROR SQL Patch Interim patch 34086870/2480307 Call datapatch to install in t
1 (OJVM RELEASE UPDATE: 19.16. he PDB or the CDB
0.0.220719 (34086870)): Instal
led in the CDB but not in the
PDB
ERROR SQL Patch Interim patch 33561310/2453886 Call datapatch to install in t
2 (OJVM RELEASE UPDATE: 19.14. he PDB or the CDB
0.0.220118 (33561310)): Not in
stalled in the CDB but install
ed in the PDB
ERROR SQL Patch '19.16.0.0.0 Release_Update 22 Call datapatch to install in t
07030222' is installed in the he PDB or the CDB
CDB but '19.14.0.0.0 Release_U
pdate 2112251221' is installed
in the PDB
9 rows selected.
Ein großes Thema sind also fehlende Patches – wie erwartet. Diese werden als „ERROR“ ausgegeben und verhindern das normale Öffnen der PDB.
Aber auch die fehlende RAC-Option wird bemängelt, allerdings nur als „Warning“. D.h. das sollte nach der Korrektur des Patch-Standes kein Problem mehr sein.
Wir lassen also erst einmal datapatch für die neue PDB MOVEPDB laufen:
Schritt 3: Datapatch für die PDB MOVEPDB
oracle@ernie:~/ [SICDB] $ORACLE_HOME/OPatch/datapatch -verbose -pdbs MOVEPDB SQL Patching tool version 19.16.0.0.0 Production on Thu Sep 1 12:15:55 2022 Copyright (c) 2012, 2022, Oracle. All rights reserved. Log file for this invocation: /u00/app/oracle/cfgtoollogs/sqlpatch/sqlpatch_20152_2022_09_01_12_15_55/sqlpatch_invocation.log Connecting to database...OK Gathering database info...done […] Patch installation complete. Total patches installed: 3 Validating logfiles...done Patch 33561310 rollback (pdb MOVEPDB): SUCCESS logfile: /u00/app/oracle/cfgtoollogs/sqlpatch/33561310/24538862/33561310_rollback_SICDB_MOVEPDB_2022Sep01_12_17_28.log (no errors) Patch 34133642 apply (pdb MOVEPDB): SUCCESS logfile: /u00/app/oracle/cfgtoollogs/sqlpatch/34133642/24865470/34133642_apply_SICDB_MOVEPDB_2022Sep01_12_17_52.log (no errors) Patch 34086870 apply (pdb MOVEPDB): SUCCESS logfile: /u00/app/oracle/cfgtoollogs/sqlpatch/34086870/24803071/34086870_apply_SICDB_MOVEPDB_2022Sep01_12_17_52.log (no errors) Automatic recompilation incomplete; run utlrp.sql to revalidate. PDBs: MOVEPDB SQL Patching tool complete on Thu Sep 1 12:19:31 2022
Dann lassen wir nochmal utlrp.sql in der PDB laufen:
oracle@ernie:~/ [SICDB] sqlplus / as sysdba
SQL*Plus: Release 19.0.0.0.0 - Production on Thu Sep 1 12:21:24 2022
Version 19.16.0.0.0
Copyright (c) 1982, 2022, Oracle. All rights reserved.
Connected to:
Oracle Database 19c Enterprise Edition Release 19.0.0.0.0 - Production
Version 19.16.0.0.0
SQL> alter session set container=MOVEPDB;
Session altered.
SQL> @?/rdbms/admin/utlrp
[…]
PL/SQL procedure successfully completed.
Function dropped.
PL/SQL procedure successfully completed.
SQL> select count(*) from dba_invalid_objects;
COUNT(*)
----------
0
Zum Abschluß schließen und öffnen wir die PDB noch einmal:
SQL> alter pluggable database MOVEPDB close; Pluggable database altered. SQL> alter pluggable database MOVEPDB open; Pluggable database altered.
Und bei den „PLUG_IN_VIOLATIONS“ gibt es auch keine Probleme mehr:
SQL> select TYPE,CAUSE,MESSAGE,ACTION from PDB_PLUG_IN_VIOLATIONS where name='MOVEPDB' 2 and status <>'RESOLVED'; no rows selected
Lange Rede, kurzer Sinn: Man kann eine „RAC-PDB“ in eine Single-Instance-CDB einhängen. Und wenn beide CDBs den gleichen Patchstand haben, dann geht das auch mit einem einfachen Öffnen der PDB in der neuen CDB.