不太严谨的测试
将11.2.0.4 RAC异机恢复到19c后
数据库切换到upgrade
SQL> startup upgrade
ORACLE instance started.Total System Global Area 843052528 bytes
Fixed Size 8902128 bytes
Variable Size 549453824 bytes
Database Buffers 281018368 bytes
Redo Buffers 3678208 bytes
Database mounted.
Database opened.
跑升级脚本,重新编译
[oracle@rac19c1 dbs]$ dbupgrade -u sys
Argument list for [/u01/app/oracle/product/11.2.0/dbhome_1/rdbms/admin/catctl.pl]
For Oracle internal use only A = 0
Run in c = 0
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 = 0catctl.pl VERSION: [19.0.0.0.0]
STATUS: [Production]
......Serial Phase #:105 [RAC11] Files:1 Time: 2s
Serial Phase #:106 [RAC11] Files:1 Time: 0s
Serial Phase #:107 [RAC11] Files:1 Time: 39s------------------------------------------------------
Phases [0-107] End Time:[2019_11_18 11:51:57]
------------------------------------------------------Grand Total Time: 2979s
LOG FILES: (/u01/app/oracle/product/11.2.0/dbhome_1/cfgtoollogs/RAC11/upgrade20191118110204/catupgrd*.log)
Upgrade Summary Report Located in:
/u01/app/oracle/product/11.2.0/dbhome_1/cfgtoollogs/RAC11/upgrade20191118110204/upg_summary.logGrand Total Upgrade Time: [0d:0h:49m:39s]
SQL> startup upgrade
ORACLE instance started.Total System Global Area 843052528 bytes
Fixed Size 8902128 bytes
Variable Size 750780416 bytes
Database Buffers 79691776 bytes
Redo Buffers 3678208 bytes
Database mounted.
Database opened.
SQL> @?/rdbms/admin/utlirp.sql
SQL>
SQL> WHENEVER SQLERROR EXIT;
SQL>
SQL> DOC
DOC>#######################################################################
DOC>#######################################################################
DOC> The following statement will cause an "ORA-01722: invalid number"
DOC> error if there the database was not opened in UPGRADE mode
DOC>
DOC> If you encounter this error, execute "SHUTDOWN", "STARTUP UPGRADE" and
DOC> re-execute utlirp.sql
DOC>#######################################################################
DOC>#######################################################################
DOC>#
SQL> SELECT TO_NUMBER('MUST_BE_OPEN_UPGRADE') FROM v$instance
2 WHERE status != 'OPEN MIGRATE';no rows selected
SQL>
SQL> Rem #(8264899): The former code here to store object numbers of all valid
SQL> Rem PL/SQL-based functional indexes, is no longer needed.
SQL>.....
SQL>
SQL> SET ECHO ON
SQL>
SQL> DECLARE
2 objid NUMBER;
3 BEGIN
4 IF dbms_registry.is_loaded('OLS') IS NOT NULL THEN
5 BEGIN
6 SELECT object_id into objid from dba_objects WHERE
7 object_name='LBAC_EVENTS' AND status = 'INVALID'
8 AND object_type='PACKAGE BODY';
9 dbms_utility.validate(objid);
10 EXCEPTION
11 WHEN OTHERS THEN
12 RETURN;
13 END;
14 END IF;
15 END;
16 /PL/SQL procedure successfully completed.
SQL> shutdown immediate
Database closed.
Database dismounted.
ORACLE instance shut down.
SQL> startup
ORACLE instance started.Total System Global Area 843052528 bytes
Fixed Size 8902128 bytes
Variable Size 750780416 bytes
Database Buffers 79691776 bytes
Redo Buffers 3678208 bytes
Database mounted.
Database opened.
SQL> @?/rdbms/admin/utlrp.sql
SQL> Rem
SQL> Rem $Header: rdbms/admin/utlrp.sql /main/23 2017/03/20 12:21:12 raeburns Exp $
SQL> Rem
SQL> Rem utlrp.sql
SQL> Rem
SQL> Rem Copyright (c) 1998, 2017, Oracle and/or its affiliates.
SQL> Rem All rights reserved.
SQL> Rem
SQL> Rem NAME
SQL> Rem utlrp.sql - Recompile invalid objects
SQL> Rem
SQL> Rem DESCRIPTION
SQL> Rem This script recompiles invalid objects in the database.
SQL> Rem
SQL> Rem When run as one of the last steps during upgrade or downgrade,
SQL> Rem this script will validate all remaining invalid objects. It will
SQL> Rem also run a component validation procedure for each component in
SQL> Rem the database. See the README notes for your current release and
SQL> Rem the Oracle Database Upgrade book for more information about
SQL> Rem using utlrp.sql......
ORDIM INVALID OBJECTS: ORDAUDIO - INVALID - TYPE
ORDIM INVALID OBJECTS: ORDAUDIOEXCEPTIONS - INVALID - PACKAGE
ORDIM INVALID OBJECTS: ORDVIDEO - INVALID - TYPE
ORDIM INVALID OBJECTS: ORDVIDEOEXCEPTIONS - INVALID - PACKAGEPL/SQL procedure successfully completed.
SQL> SET serveroutput off
SQL>
SQL>
SQL> Rem ===========================================================================
SQL> Rem END utlrp.sql
SQL> Rem ===========================================================================
SQL>
SQL>
查看数据库
SQL> show con_name
CON_NAME
------------------------------
RAC11
创建XML元数据文件
SQL> shutdown immediate;
Database closed.
Database dismounted.
ORACLE instance shut down.
SQL> startup open read only;
ORACLE instance started.Total System Global Area 843052528 bytes
Fixed Size 8902128 bytes
Variable Size 750780416 bytes
Database Buffers 79691776 bytes
Redo Buffers 3678208 bytes
Database mounted.
Database opened.
SQL> BEGIN
DBMS_PDB.DESCRIBE(
pdb_descr_file => '/tmp/db11g.xml');
END;
2 3 4 5 /PL/SQL procedure successfully completed.
SQL> shutdown
Database closed.
Database dismounted.
ORACLE instance shut down.
检查升级后数据库是否适合插入到该cdb
[oracle@rac19c1 ~]$ export ORACLE_SID=RAC19c1
[oracle@rac19c1 ~]$ sqlplus / as sysdbaSQL*Plus: Release 19.0.0.0.0 - Production on Mon Nov 18 13:46:31 2019
Version 19.3.0.0.0Copyright (c) 1982, 2019, Oracle. All rights reserved.
Connected to:
Oracle Database 19c Enterprise Edition Release 19.0.0.0.0 - Production
Version 19.3.0.0.0SQL> show con_name
CON_NAME
------------------------------
CDB$ROOTSQL> SET SERVEROUTPUT ON
DECLARE
compatible CONSTANT VARCHAR2(3) :=
CASE DBMS_PDB.CHECK_PLUG_COMPATIBILITY(
pdb_descr_file => '/tmp/db11g.xml',
pdb_name => 'orcl')
WHEN TRUE THEN 'YES'
ELSE 'NO'
END;
BEGIN
DBMS_OUTPUT.PUT_LINE(compatible);
END;
/SQL> 2 3 4 5 6 7 8 9 10 11 12
YESPL/SQL procedure successfully completed.
插入cdb
SQL> CREATE PLUGGABLE DATABASE pdb11g using '/tmp/db11g.xml' copy file_name_convert=('+DATADG','+DATADG') NOCOPY TEMPFILE REUSE;
Pluggable database created.
查看数据库
SQL> show pdbs
CON_ID CON_NAME OPEN MODE RESTRICTED
---------- ------------------------------ ---------- ----------
2 PDB$SEED READ ONLY NO
3 PDB11G MOUNTED
跑noncdb_to_pdb.sql
SQL> alter session set container =PDB11G;
Session altered.
SQL> alter database open;Database altered.
Connected to:
Oracle Database 19c Enterprise Edition Release 19.0.0.0.0 - Production
Version 19.3.0.0.0SQL> alter pluggable database all save state;
Pluggable database altered.
SQL> show pdbs
CON_ID CON_NAME OPEN MODE RESTRICTED
---------- ------------------------------ ---------- ----------
2 PDB$SEED READ ONLY NO
3 PDB11G READ WRITE YES
SQL> shutdown immediateSQL> @$ORACLE_HOME/rdbms/admin/noncdb_to_pdb.sql
......
15:48:23 SQL> set sqlterminator ";"
15:48:23 SQL> set statementcache 0
15:48:23 SQL> set suffix "sql"
15:48:23 SQL> set tab OFF
15:48:23 SQL> set termout ON
15:48:23 SQL> set time OFF
SQL> set timing OFF
SQL> set trimout ON
SQL> set trimspool ON
SQL> set underline "-"
SQL> set verify OFF
SQL> set wrap ON
SQL> set xmloptimizationcheck OFFSQL> alter database open;
Database altered.
SQL> select NAME,CAUSE,ERROR_NUMBER,MESSAGE from PDB_PLUG_IN_VIOLATIONS;
NAME
--------------------------------------------------------------------------------
CAUSE ERROR_NUMBER
---------------------------------------------------------------- ------------
MESSAGE
--------------------------------------------------------------------------------
PDB11G
Non-CDB to PDB 0
PDB plugged in is a non-CDB, requires noncdb_to_pdb.sql be run.PDB11G
PDB not Unicode 0
Character set mismatch: PDB character set ZHS16GBK. CDB character set AL32UTF8.PDB11G
OPTION 0
Database option DV mismatch: PDB installed version NULL. CDB installed version 1
9.0.0.0.0.PDB11G
OPTION 0
Database option OLS mismatch: PDB installed version NULL. CDB installed version
19.0.0.0.0.
4 rows selected.