Applies to:
Oracle Database - Enterprise Edition - Version 12.1.0.1 and laterOracle Database Cloud Schema Service - Version N/A and later
Oracle Database Exadata Cloud Machine - Version N/A and later
Oracle Cloud Infrastructure - Database Service - Version N/A and later
Oracle Database Cloud Exadata Service - Version N/A and later
Information in this document applies to any platform.
Goal
To provide the Multitenant Unplug/Plug Best Practices
Solution
When plugging into a new container a PDB may have violations due to Database version (12.1.0.1 vs 12.1.0.2)
- SQL patch mismatches
- Database parameter mismatches such as character sets or block size
The dbms_pdb.describe and dbms_pdb.check_plug_compatibility APIs can be used to determine if a given PDB can be plugged in successfully to a target container. Here are the steps to invoke dbms_pdb.describe and dbms_pdb.check_plug_compatibility to investigate this further:
Preparation:
1) Create PDB description XML file for PDB(PDB1) in question:
exec dbms_pdb.describe (‘PDB1_Unplug.xml’, ‘PDB1’);
2) In the target container environment, check plug compatibility
begin
if dbms_pdb.check_plug_compatibility('PDB1_Unplug.xml', ‘PDB1') then
dbms_output.put_line(‘no violations found');
else
dbms_output.put_line(‘violations found');
end if;
end;
Plugin compatibility issues, if any, will be reported in
pdb_plug_in_violations view
Scenarios:
Scenario 1 – No plug in violations
SQL> BEGIN
2 IF dbms_pdb.check_plug_compatibility('/tmp/PDBORCL.xml') THEN
3 dbms_output.put_line('no violations found');
4 ELSE
5 dbms_output.put_line('violations found');
6 END IF;
7 END;
8 /
no violations found
PL/SQL procedure successfully completed.
SQL> SELECT type, message, action
2 FROM pdb_plug_in_violations
3 WHERE name = 'PDBORCL';
no rows selected
Scenario 2 – SQL patch present in target container but not in source container
SQL> BEGIN
2 IF dbms_pdb.check_plug_compatibility('/tmp/PDBORCL.xml') THEN
3 dbms_output.put_line('no violations found');
4 ELSE
5 dbms_output.put_line('violations found');
6 END IF;
7 END;
8 /
violations found
SQL> SELECT type, message, action
2 FROM pdb_plug_in_violations
3 WHERE name = 'PDBORCL';
TYPE MESSAGE
--------- --------------------------------------------------------------------------------
ACTION
--------------------------------------------------------------------------------
ERROR PSU bundle patch 1 (PSU Patch 12345): Installed in the CDB but not in the PDB.
Call datapatch to install in the PDB or the CDB
NOTE** : The violation error message "Installed in the CDB but not in the PDB. PENDING" can also occur when either the CDB or PDB have invalid database components.
Post validating the database components in CDB and PDB, the status of the violation message in the view pdb_plug_in_violations will change to RESOLVED, as below.
MESSAGE STATUS ACTION
------------------------------------------ ------------------- ------------------------------------
Installed in the CDB but not in the PDB. RESOLVED Call datapatch to install in the PDB or the CDB
Scenario 3 – SQL patch present in source container but not in target container
SQL> BEGIN
2 IF dbms_pdb.check_plug_compatibility('/tmp/PDBORCL.xml') THEN
3 dbms_output.put_line('no violations found');
4 ELSE
5 dbms_output.put_line('violations found');
6 END IF;
7 END;
8 /
violations found
SQL> SELECT type, message, action
2 FROM pdb_plug_in_violations
3 WHERE name = 'PDBORCL';
TYPE MESSAGE
--------- --------------------------------------------------------------------------------
ACTION
--------------------------------------------------------------------------------
ERROR PSU bundle patch 1 (PSU Patch 12345): Installed in the PDB but not in the CDB.
Call datapatch to install in the PDB or the CDB
Scenario Summary and Actions
Scenario |
Recommended Action |
---|---|
1: SQL Patches in both source and target container |
None needed – safe to plug in (see Document 1633071.1) |
2: SQL Patches in target container only |
Run datapatch in target after plug in |
3: SQL Patches in source container only |
Option 1: Rollback the patch(es) on the source PDB before unplugging % datapatch -rollback < patch id > –force [–bundle_series] -pdbs <pdb1,pdb2,...,pdbn> Note: Option 2 will apply the new patches in the CDB and all PDBs in the target. |
References
NOTE:1609718.1 - Datapatch Known Issues
NOTE:18355572.8 - Bug 18355572 - Datapatch tries to roll back earlier PSU when applying a later PSU