一、备库切主库升级
12c切换为19c主库的时候是由低版本到高版本所以cdb和pdb的数据字典需要进行升级才可以让数据与软件版本兼容。
1.1切换
SQL> alter database recover managed standby database finish;
Database altered.
SQL> alter database commit to switchover to primary;
Database altered.
1.2升级cdb
SQL>
SQL> shu immediate
ORA-01109: database not open
Database dismounted.
ORACLE instance shut down.
SQL> startup upgrade;
ORACLE instance started.
Total System Global Area 6174013840 bytes
Fixed Size 9148816 bytes
Variable Size 1056964608 bytes
Database Buffers 5100273664 bytes
Redo Buffers 7626752 bytes
Database mounted.
Database opened.
SQL>
[oracle@o12u19s backup]$ cd $ORACLE_HOME/bin
[oracle@o12u19s bin]$ ./dbupgrade
跑了1小时9分58秒
1.3编译失效对象
[oracle@o12u19s bin]$ sqlplus / as sysdba
SQL*Plus: Release 19.0.0.0.0 - Production on Tue Jun 18 19:44:49 2024
Version 19.3.0.0.0
Copyright (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.0
SQL> @?/rdbms/admin/utlrp.sql
1.4升级pdb1(19分51秒)
SQL> show pdbs
CON_ID CON_NAME OPEN MODE RESTRICTED
---------- ------------------------------ ---------- ----------
2 PDB$SEED READ ONLY NO
3 PDB1 MOUNTED
SQL> alter pluggable database pdb1 open upgrade;
Pluggable database altered.
SQL> show pdbs
CON_ID CON_NAME OPEN MODE RESTRICTED
---------- ------------------------------ ---------- ----------
2 PDB$SEED READ ONLY NO
3 PDB1 MIGRATE YES
SQL>
注意:环境变量要配置好否则找不到数据库会瞬间完成脚本执行需要重新执行
[oracle@o12u19s ~]$ mkdir -p upDB
[oracle@o12u19s ~]$ $ORACLE_HOME/perl/bin/perl $ORACLE_HOME/rdbms/admin/catctl.pl -d $ORACLE_HOME/rdbms/admin -c 'PDB1' -l /home/oracle/upDB catupgrd.sql
重启数据库并进行编译
SQL> shu immediate
Database closed.
Database dismounted.
ORACLE instance shut down.
SQL> startup
ORACLE instance started.
Total System Global Area 6174013840 bytes
Fixed Size 9148816 bytes
Variable Size 1174405120 bytes
Database Buffers 4982833152 bytes
Redo Buffers 7626752 bytes
Database mounted.
Database opened.
SQL> show pdbs
CON_ID CON_NAME OPEN MODE RESTRICTED
---------- ------------------------------ ---------- ----------
2 PDB$SEED READ ONLY NO
3 PDB1 MOUNTED
SQL> alter pluggable database pdb1 open;
Pluggable database altered.
SQL> show pdbs
CON_ID CON_NAME OPEN MODE RESTRICTED
---------- ------------------------------ ---------- ----------
2 PDB$SEED READ ONLY NO
3 PDB1 READ WRITE NO
SQL>
重启后状态由
变为
1.5升级pdbseed(26分48秒)
$ORACLE_HOME/perl/bin/perl $ORACLE_HOME/rdbms/admin/catctl.pl -d $ORACLE_HOME/rdbms/admin -c 'PDB$SEED' -l /home/oracle/upDB catupgrd.sql
1.6编译失效对象
cd $ORACLE_HOME/rdbms/admin
$ORACLE_HOME/perl/bin/perl catcon.pl -n 1 -e -b utlrp -d '''.''' utlrp.sql
[oracle@o12u19s ~]$ tail -f /u01/app/oracle/product/19.3.0.0/dbhome_1/rdbms/admin/utlrp*.log
1.7对pdb1temp表空间处理
SQL> show pdbs
CON_ID CON_NAME OPEN MODE RESTRICTED
---------- ------------------------------ ---------- ----------
2 PDB$SEED READ ONLY NO
3 PDB1 READ WRITE NO
SQL> alter session set container=pdb1;
Session altered.
SQL>
SQL> select tablespace_name,file_name,bytes/1024/1024file_size,autoextensible from dba_temp_files;
SQL> select status,enabled, name, bytes/1024/1024 file_size from v_$tempfile;
如果自动扩展为no需要开启自动扩展
alter database tempfile '/u01/app/oracle/oradata/orcldg/pdb1/temp012024-06-18_11-07-17-AM.dbf' autoextend on;
1.8完成后检查升级问题及组件状态
SQL> set linesize 400
col time for a40
col name for a10
col cause for a30
col message for a50
col action for a40
select * from pdb_plug_in_violations where status <> 'RESOLVED';SQL> SQL> SQL> SQL> SQL> SQL>
TIME NAME CAUSE TYPE ERROR_NUMBER LINE MESSAGE STATUS ACTION CON_ID
---------------------------------------- ---------- ------------------------------ --------- ------------ ---------- -------------------------------------------------- --------- ---------------------------------------- ----------
18-JUN-24 08.52.05.044154 PM PDB1 OPTION WARNING 0 1 Database option RAC mismatch: PDB installed version 19.0.0.0.0. CDB installed version NULL. PENDING 3
Fix the database option in the PDB or the CDB
1.9组件状态
set linesize 400
set pagesize 400
Col Comp_name Format a60
Col Status Format a12
Select Comp_name, status, Version From Dba_Registry Order by Comp_name;