Explore Oracle The database upgrade seven
11gR2 to 12c Insert after upgrade complete PDB
Objective:
fromOracle 12cat the beginning, the concept of container database is introduced, which can implement database plug-in operation, such as:
now let's take a look at how to11.2.0.4the database is inserted into the12cof theCDPgo inside and let it be aPDB
Database.
First, View database Information :
sql> Col BANNER format a80sql> set line 300sql> select * from V$version; BANNER con_id------------------------------------------------------------------------------------------Oracle Database 12c Enterprise Edition release 12.1.0.1.0-64bit Production 0pl/sql release 12.1.0.1.0-production 0CORE 12.1.0 .1.0 Production 0TNS for linux:version 12.1.0.1.0-production 0NLSRTL Version 12.1.0.1.0-productionsql> Select CDB, Name,dbid from V$database; CDB NAME DBID----------------------NO WOO 4199532651
From here we can see that the database that actually comes up after the upgrade is still a non-cdb , not CDB database, then this time we need to be in this none-cdb build user in library PDB of the XML file, and then create CDB database for insertion.
Second, view the table space and data file information:
Sql> select * from V$tablespace; ts# NAME INC BIG FLA ENC con_id-------------------------------------------------------------- 0 SYSTEM YES NO YE S 0 1 sysaux Yes No Yes 0 2 UNDOTBS1 Yes No Yes 0 4 USERS Yes No Yes 0 3 TEMP No no Yes 0sql> set line 300sql> Col file_name format a40sql> col tablespace_name format a10sql> select Tablespace_name,file_name from DBA _data_files; tablespace file_name--------------------------------------------------USERS/DBDATA/WOO/WOO/USERS01.DBFUNDOTBS1/ Dbdata/woo/woo/undotbs01.dbfsysaux/dbdata/woo/woo/sysaux01.dbfsystem/dbdata/woo/woo/system01.dbf
iii. Creating an XML file to generate the PDB
sql> shutdown immediatedatabase closed. Database dismounted. ORACLE instance shut down. Sql> Startup Mountoracle instance started. Total System Global area 2772574208 bytesfixed size 2292240 bytesvariable size 2533361136 bytesdatabase buffers 218103808 Bytesredo buffers 18817024 bytesdatabase mounted. Sql> ALTER DATABASE open read Only;database altered. sql> exec dbms_pdb.describe (pdb_descr_file = '/home/oracle/woo_ora11g.xml\ ');P L/sql procedure successfully Completed. Sql> host ls-rtl/home/oracle/woo*.xml-rw-r--r--1 Oracle oinstall 4147 Nov 19:17/home/oracle/woo_ora11g.xmlsql> ; Shutdown Immediatedatabase closed. Database dismounted. ORACLE instance shut down
Iv. Check if the upgraded database is suitable for PDB insertion into the CDB
Sql> set serveroutput on; Sql> declare 2 compat Boolean: = FALSE; 3 begin 4 compat: = dbms_pdb.check_plug_compatibility (pdb_descr_file = '/home/oracle/woo_ora11g.xml\ ') ; 5 If Compat 6 then 7 dbms_output.put_line (\ ' yes\ '); 8 Else 9 dbms_output.put_line (\ ' no\ '), ten End If, one end, 12/nopl/sql procedure successfully Completed.
because it is inserted for the first time, the execution result is displayed as NO, and the continuation insertion can be ignored.
V. Create a CDB database
5.1 Execute DBCA Create CDB database
5.2 Specify the CDB database name to create
5.3 Creating a CDB pre-check
5.4 Summar Click Finish to start creating
5.5 is now starting to create
5.6 Now created, tell us about the CDB database
5.7 Click Close to close the Create page
VI. Viewing current PDB information
[Email protected] ~]$ export oracle_sid=woo12csql> show PDBs; con_id con_name OPEN MODE RESTRICTED------------------------------------------------------------ 2 pdb$seed READ Only No. 3 PDB01 READ WRITE nosql> select Con_id,dbid,name,open_mode from V$pdbs; con_id DBID NAME open_mode------------------------------------------------------------ 2 4107385256 pdb$seed Read Only 3 3926295770 PDB01 READ WRITE
Vii. inserting the NON-CDB database into the CDB to become a PDB
sql> CREATE pluggable DATABASE woo_ora11g USING \ '/home/oracle/woo_ora11g.xml\ '; Pluggable database created.
viii. View alert log related information
Alert to insert non-cdb into the CDB as a PDB output Log.
Sql> show PDBs con_id con_name OPEN MODE RESTRICTED---------------------------------------------------------- -- 2 pdb$seed Read Only no 3 PDB01 read WRITE NO 4 woo_ora11g mountedsql> Select Con_id,dbid,name,open_mode from V$pdbs; con_id DBID NAME open_mode------------------------------------------------------------ 2 4107385256 pdb$seed Read only 3 3926295770 PDB01 read WRITE 4 4199532651 woo_ora11g mounted the first NO-CDB plug CDB is the Mount state, which needs to be open; sql> alter pluggable database open; Pluggable database altered. Sql> show PDBs; con_id con_name OPEN MODE RESTRICTED------------------------------------------------------------ 2 pdb$seed READ Only NO 3 PDB01 mounted 4 woo_ora11g READ WRITE YES
after the insert is complete, you need to perform noncdb_to_pdb script to fix the original non-cdb and the new PDB Incompatible issues:
10. Execute noncdb_pdb Script
Sql> alter session set CONTAINER=WOO_ORA11G; Session altered. sql> @ $ORACLE _home/rdbms/admin/noncdb_to_pdb.sql.........#### encounters warning, the script automatically ignores the error and resumes execution. These issues are fixed when the final script is compiled. The PDB information needs to be synchronized after the update sql> show PDBs con_id con_name OPEN MODE RESTRICTED-------------------------------------------- ---------------- 4 woo_ora11g mountedsql> alter pluggable database open restricted; Pluggable database altered. Sql> show PDBs con_id con_name OPEN MODE RESTRICTED---------------------------------------------------------- -- 4 woo_ora11g READ WRITE yessql> exec dbms_pdb.sync_pdb ();P L/sql procedure successfully completed. Sql> Alter pluggable database close immediate; Pluggable database altered. sql> alter pluggable database open; Pluggable database altered.
11. NO-CDB Plug to CDB successfully
Sql> show PDBs; con_id con_name OPEN MODE RESTRICTED------------------------------------------------------------ 2 pdb$seed READ Only NO 3 PDB01 mounted 4 woo_ora11g READ WRITE nosql>
Explore Oracle's database upgrade 11gR2 to 12c insert PDB after upgrade complete