Oracle 12c 3 pdb pluggable test, 12 cpdb
DECLAREl_result BOOLEAN; BEGINl_result: = partition (pdb_descr_file => '/u02/pdb/pdb3.xml', pdb_name => 'pdb3'); IF l_result THENDBMS_OUTPUT.PUT_LINE ('compuble '); ELSEDBMS_OUTPUT.PUT_LINE ('compatible '); end if; END;/1. Test the plug-in of the current database at 21:06:51 sys @ stldb> alter pluggable database prod unplug into'/u02/pdb/prod. xml '; Pluggable database altered. elapsed: 00:00:04. 88 21:07:48 sys @ stldb> d Drop pluggable database prod; Pluggable database dropped. elapsed: 00:00:04. 46 21:09:35 sys @ stldb> select con_id, dbid, guid, name, open_mode from v $ pdbs; CON_ID dbid guid name OPEN_MODE ------------- ---------------------------------- ---------------------------- ---------- 2 4117202806 bytes PDB $ seed read only 3 3382304421 bytes PDB1 read write 4 3940876746 117C20359794C040E0536506A8C0B458 PDB2 read write 6 3885367953 118F19327FCC760FE0536506A8C05BDF PDB4 read only Elapsed: 00:00:00. 01 21:09:50 sys @ stldb> DECLARE 21:12:41 2 l_result BOOLEAN; 21:12:42 3 BEGIN 21:12:42 4 l_result: = DBMS_PDB.check_plug_compatibility (21:12:42 5 pdb_descr_file => '/u02/pdb/prod. xml', 21:12:42 6 pdb_name => 'prod'); 21:12:42 7 IF l_result TH EN 21:12:42 8 DBMS_OUTPUT.PUT_LINE ('compute'); 21:12:42 9 ELSE 21:12:42 10 DBMS_OUTPUT.PUT_LINE ('compute'); 21:12:42 11 end if; 21:12:42 END; 21:12:42 13/compatible PL/SQL procedure successfully completed. elapsed: 00:00:00. 10 21:12:43 sys @ stldb> create pluggable database prod using '/u02/pdb/prod. xml 'nocopy tempfile reuse; of course, we can still rename this step, not necessarily using the original name 21:14:17 sys @ stldb> alter session Set container = prod; Session altered. elapsed: 00:00:00. 09 21:14:37 sys @ stldb> select name from v $ datafile; NAME example --- + DATA/STLDB/DATAFILE/undotbs1.261.874613095 + DATA/STLDB/example/DATAFILE/system.294.874633201 + DATA/STLDB/Example 8C0A25E/DATAFILE/sysaux.293.874633187 + DATA/STLDB/logs/DATAFILE/users.296.874633293 + DATA/STLDB/logs/DATAFILE/kiwi.339.874702947 Elapsed: 00:00:00. 08 21:14:45 sys @ stldb> select name from v $ tempfile; NAME example --- + DATA/STL DB/118073E7A685F068E0536506A8C0A25E/TEMPFILE/temp.295.8747036272 cross-database pluggable test 21:48:28 sys @ stldb> alter Pluggable database pdb3 close; pluggable database altered. elapsed: 00:00:03. 97 21:48:53 sys @ stldb> alter pluggable database pdb3 unplug into '/u02/pdb/pdb3.xml'; Pluggable database altered. elapsed: 00:00:05. 15 21:49:34 sys @ stldb> quit Disconnected from Oracle Database 12c Enterprise Edition Release 12.1.0.1.0-64bit Production With the Partitioning, Real Application Clusters, Automatic Storage Management, OLAP, Advanced Analytics and Real Application Testing options [21:50:07 oracle (db) @ rac1 ~] $ Rman target/Recovery Manager: Release 12.1.0.1.0-Production on Wed Mar 18 21:50:11 2015 Copyright (c) 1982,201 3, Oracle and/or its affiliates. all rights reserved. connected to target database: STLDB (DBID = 3188959514) RMAN> backup for transport as compressed backupset pluggable database 'pdb3 'format'/u02/pdb/pdb3.dfb '; starting backup at 18-MAR-15 using target database control file instead of recovery catalog allocated channel: ORA_DISK_1 channel ORA_DISK_1: SID = 258 instance = stldb1 device type = DISK channel ORA_DISK_1: starting compressed full datafile backup set channel ORA_DISK_1: specifying datafile (s) in backup set input datafile file number = 00049 name = + DATA/pdb3/pdb3_sysaux01.dbf input datafile file number = 00048 name = + DATA/pdb3/pdb3_system01.dbf input datafile file number = 00051 name = + DATA/pdb3/pdb3_kiwi01.dbf input datafile file number = 00050 name = + DATA/pdb3/pdb3_users01.dbf channel ORA_DISK_1: starting piece 1 at 18-MAR-15 channel ORA_DISK_1: finished piece 1 at 18-MAR-15 piece handle =/u02/pdb/pdb3.dfb tag = TAG20150318T215139 comment = NONE channel ORA_DISK_1: backup set complete, elapsed time: 00:01:15 Finished backup at 18-MAR-15 and then dump it on another database to restore the database RMAN> run2> {3> set command id to 'pdb3 '; 4> restore foreign datafile 48 to new, 49 to new, 50 to new, 51 to new from backupset 5> '/u02/pdb/pdb3.dfb'; 6 >}; executing command: set command IDStarting restore at least target database control file instead of recovery catalogallocated channel: ORA_DISK_1channel ORA_DISK_1: SID = 142 instance = prod1 device type = DISKchannel ORA_DISK_1: starting datafile backup set restorechannel ORA_DISK_1: using datafile (s) to restore from backup setchannel ORA_DISK_1: restoring foreign file 00048 channel ORA_DISK_1: restoring foreign file 00049 channel ORA_DISK_1: restoring foreign file 00050 channel usage: restoring foreign file 00051 channel usage: reading from backup piece/u02/pdb/pdb3.dfbchannel ORA_DISK_1: restoring foreign file 48 to + DATA/PROD/logs/DATAFILE/system.351.874714735channel ORA_DISK_1: restoring foreign file 49 to + DATA/PROD/logs/DATAFILE/export ORA_DISK_1: restoring foreign file 50 to + DATA/PROD/logs/DATAFILE/users.353.874714735channel ORA_DISK_1: restoring foreign file 51 to + DATA/PROD/logs/DATAFILE/kiwi.352.874714735channel ORA_DISK_1: foreign piece handle =/u02/pdb/pdb3.dfbchannel ORA_DISK_1: restored backup piece 1 channel ORA_DISK_1: restore complete, elapsed time: 00: 01: 06 Finished restore at 19-MAR-15 create pdbcreate pluggable database pdb3 as clone using '/u02/pdb/pdb3.xml 'source_file_name_convert = (' + DATA/pdb3/pdb3_system01.dbf ', '+ DATA/PROD/logs/DATAFILE/system.351.874714735', '+ DATA/pdb3/pdb3_sysaux01.dbf',' + DATA/PROD/logs/DATAFILE/sysaux.350.874714735 ', '+ DATA/pdb3/pdb3_users01.dbf', '+ DATA/PROD/logs/DATAFILE/users.353.874714735', '+ DATA/pdb3/pdb3_temp01.dbf ', '+ DATA/PROD/users/DATAFILE/temp01.dbf', '+ DATA/pdb3/pdb3_kiwi01.dbf', '+ DATA/PROD/users/DATAFILE/upload') file_name_convert = none nocopy; 00:45:17 sys @ prod> select con_id, dbid, guid, name, open_mode from v $ pdbs; CON_ID dbid guid name OPEN_MODE ------------- -------------------------------- ---------- 2 4117299261 bytes PDB $ seed read only 3 3990814677 bytes pdmounb3 Elapsed: 00:00:00. 01 00:46:04 sys @ prod> alter pluggable database pdb3 open; Pluggable database altered. elapsed: 00:00:20. 39 00:46:35 sys @ prod> alter session set container = pdb3 00:46:55 2; Session altered. elapsed: 00:00:00. 11 00:46:56 sys @ prod> select name from v $ tablespace; NAME -------------------------------- UNDOTBS1 SYSTEM SYSAUX TEMP USERS KIWI