11g数据库使用DBUA升级Exadata数据库至12c
DB Name: GRP
Source DB: 11.2.0.3
Target DB: 12.1.0.2
11g数据库使用DBUA升级Exadata数据库至12c前提条件:
0.需要11g源数据库full + archivelog backup 备份 本例中备份集放在以下目录。
[oracle@dm08db01 backup]$ pwd
/home/oracle/lyon/backup
备份脚本:backup_grp.txt
run {
allocate channel c1 type disk;
allocate channel c2 type disk;
allocate channel c3 type disk;
backup AS COMPRESSED BACKUPSET incremental level 0 format '/u01/app/oracle/backup/inc0_%d_%U_%Y%M%D.bak' tag hot_db_bk_level0 database;
release channel c1;
release channel c2;
release channel c3;
sql 'alter system archive log current';
allocate channel c1 type disk;
allocate channel c2 type disk;
backup AS COMPRESSED BACKUPSET format '/u01/app/oracle/backup/arc0_%d_%U_%Y%M%D.bak' archivelog all not backed up 1 times;
release channel c1;
release channel c2;
backup current controlfile format '/u01/app/oracle/backup/ctl_%d_%U_%Y%M%D.bak';
}
1. 源端11g/目标端12c 的Oracle Home需要提前安装且打好所需补丁.
2. 11g OH需要追加打Patch#21150904 确保源端数据库可以注册到12C的CRS.
(Bug 13460353 - Registration of 11.2 database fails against 12.1 CRS stack (required fix for 11g DB with 12c GI))
3. 目标端ASM磁盘组兼容性问题. 需要将12C ASM磁盘组Database compatibility降级至11.2.0.0.0
4. 源端11g OH需要relink rds_ipc
cd $ORACLE_HOME/rdbms/lib
make -f ins_rdbms.mk ipc_rds ioracle
5. 源端初始化参数需要设置cluster_interconnects
GRP1.cluster_interconnects=192.168.18.1,192.168.18.2
GRP2.cluster_interconnects=192.168.18.3,192.168.18.4
6. 升级过程一定要注意环境变量的设置
GRP_11G_env 为11g Oracle Home 环境变量
GRP_env 为12C Oracle Home 环境变量
下面开始升级过程.
Upgrade 11g Oracle database GRP to 12C.
0. Edit source database pfile and create target pfile&spfile&passwordFile.
0.1 Edit source pfile esp. init parameters like cluster_database/local_listener/remote_listener.
. GRP_11G_env
$ORACLE_HOME/dbs/initGRP1.ora
GRP1.__oracle_base='/u01/app/oracle'#ORACLE_BASE set from environment
GRP2.__oracle_base='/u01/app/oracle'#ORACLE_BASE set from environment
GRP1.cluster_interconnects=192.168.18.1,192.168.18.2
GRP2.cluster_interconnects=192.168.18.3,192.168.18.4
*._B_TREE_BITMAP_PLANS=FALSE
*._IN_MEMORY_UNDO=FALSE
*._INDEX_JOIN_ENABLED=FALSE
*._OPTIM_PEEK_USER_BINDS=FALSE
*._OPTIMIZER_MJC_ENABLED=FALSE
*._SORT_ELIMINATION_COST_RATIO=10
*._TABLE_LOOKUP_PREFETCH_SIZE=0
*.audit_file_dest='/u01/app/oracle/admin/GRP/adump'
*.cluster_database_instances=2
*.cluster_database=false
*.compatible='11.2.0.3.0'
*.control_file_record_keep_time=30
*.control_files='+DATA_DM08/GRP/controlfile/current'#Restore Controlfile
*.db_block_size=8192
*.db_cache_size=18269444505
*.db_name='GRP'
*.db_unique_name='GRP'
*.diagnostic_dest='/u01/app/oracle'
*.FILESYSTEMIO_OPTIONS='setall'
GRP1.instance_name='GRP1'
GRP2.instance_name='GRP2'
GRP1.instance_number=1
GRP2.instance_number=2
GRP1.local_listener='(DESCRIPTION=(ADDRESS_LIST=(ADDRESS=(PROTOCOL=TCP)(HOST=dm08db01-vip.sh217.com)(PORT=1527))))'
GRP2.local_listener='(DESCRIPTION=(ADDRESS_LIST=(ADDRESS=(PROTOCOL=TCP)(HOST=dm08db02-vip.sh217.com)(PORT=1527))))'
*.log_archive_config='NODG_CONFIG'
*.log_archive_dest_1='LOCATION=+RECO_DM08 VALID_FOR=(ALL_LOGFILES,ALL_ROLES) DB_UNIQUE_NAME=GRP'
*.log_archive_dest_2=''
*.log_archive_dest_state_1='ENABLE'
*.log_archive_dest_state_2='ENABLE'
*.log_archive_format='%t_%s_%r.dbf'
*.log_archive_max_processes=30
*.log_checkpoints_to_alert=true
*.max_dump_file_size='20000'
*.open_cursors=2000
*.parallel_execution_message_size=16384
*.parallel_threads_per_cpu=1
*.pga_aggregate_target=24359259340
*.processes=270
*.query_rewrite_enabled='false'
*.recyclebin='off'
*.remote_login_passwordfile='exclusive'
*.remote_os_authent=false
*.replication_dependency_tracking=false
*.service_names='GRP'
*.sessions=540
*.shared_pool_size=18269444505
*.standby_file_management='AUTO'
*.star_transformation_enabled='true'
remote_listener='dm08-scan:1527'
GRP1.thread=1
GRP2.thread=2
GRP1.undo_tablespace='PSAPUNDO'
GRP2.undo_tablespace='PSAPUNDO2'
0.1 create target spfile.
. GRP_11G_env
sqlplus "/ as sysdba"
startup nomount pfile='initGRP1.ora';
create spfile='+DATA_DM08' from pfile='initGRP1.ora';
exit;
0.2
. grid.env
asmcmd
ASMCMD> pwd
+DATA_DM08/GRP/PARAMETERFILE
mkalias '+DATA_DM08/GRP/PARAMETERFILE/spfile.303.938004267' '+DATA_DM08/GRP/spfileGRP'
0.3 edit target pfile to use spfile.
[oracle@dm08db01 dbs]$ cat initGRP1.ora
spfile='+DATA_DM08/GRP/spfileGRP'
0.4 shutdown the DB and nomount it.
[oracle@dm08db01 dbs]$ . GRP_11G_env
shutdown immediate;
startup nomount;
show parameter spfile;
1. restore target controlfile
rman target /
restore controlfile from '/home/oracle/lyon/backup/ctl_GRP_tfru5il9_1_1_20170302.bak';
2. mount DB.
SQL> alter database mount;
Database altered.
SQL>
3. catalog backup files.
RMAN> catalog start with '/home/oracle/lyon/backup';
list backup set.
RMAN> list backup of database completed after 'sysdate-2';
4. Prepare the restore&recovery script
select 'set newname for datafile '||FILE#||' to '''||replace(NAME,substr(NAME,0,instr(NAME,'/',-1)),'+DATA_DM08/GRP/') ||''';'
from v$datafile;
Edit the script restore_GRP.txt
run
{
sql 'alter session set NLS_DATE_FORMAT="YYYY-MM-DD HH24:MI:SS"';
set until time "to_date('03/02/17 23:10:00','mm/dd/yy hh24:mi:ss')";
ALLOCATE CHANNEL ch01 TYPE disk;
ALLOCATE CHANNEL ch02 TYPE disk;
ALLOCATE CHANNEL ch03 TYPE disk;
set newname for datafile 1 to '+DATA_DM08/GRP/system.data1';
set newname for datafile 2 to '+DATA_DM08/GRP/sysaux.data1';
set newname for datafile 3 to '+DATA_DM08/GRP/undo.data1';
set newname for datafile 4 to '+DATA_DM08/GRP/sr3.data1';
set newname for datafile 5 to '+DATA_DM08/GRP/sr3.data2';
set newname for datafile 6 to '+DATA_DM08/GRP/sr3.data3';
set newname for datafile 7 to '+DATA_DM08/GRP/sr3.data4';
set newname for datafile 8 to '+DATA_DM08/GRP/sr3.data5';
set newname for datafile 9 to '+DATA_DM08/GRP/sr3.data6';
set newname for datafile 10 to '+DATA_DM08/GRP/sr3740.data1';
set newname for datafile 11 to '+DATA_DM08/GRP/sr3740.data2';
set newname for datafile 12 to '+DATA_DM08/GRP/sr3740.data3';
set newname for datafile 13 to '+DATA_DM08/GRP/sr3740.data4';
set newname for datafile 14 to '+DATA_DM08/GRP/sr3740.data5';
set newname for datafile 15 to '+DATA_DM08/GRP/sr3usr.data1';
set newname for datafile 16 to '+DATA_DM08/GRP/psapundo2.300.929276573';
set newname for datafile 17 to '+DATA_DM08/GRP/psapsr3.490.923928705';
restore database;
switch datafile all;
recover database;
}
5.
restore&recover DB.
nohup /u01/app/oracle/product/11.2.0/dbhome_1/bin/rman target / cmdfile=/home/oracle/lyon/backup/restore_GRP.txt &
monitoring:
[oracle@dm08db01 backup]$ tail -f nohup.out
6. rename logfile.
select 'alter database rename file '||''''||member||''''||' to '||''''||replace(member,substr(member,0,instr(member,'/',-1)),'+DATA_DM08/GRP/') ||''';'
from v$logfile order by GROUP#;
alter database rename file '+DATA_DM04/grpstdby/log_g11m1.dbf' to '+DATA_DM08/GRP/log_g11m1.dbf';
alter database rename file '+DATA_DM04/grpstdby/log_g12m1.dbf' to '+DATA_DM08/GRP/log_g12m1.dbf';
alter database rename file '+DATA_DM04/grpstdby/log_g13m1.dbf' to '+DATA_DM08/GRP/log_g13m1.dbf';
alter database rename file '+DATA_DM04/grpstdby/log_g14m1.dbf' to '+DATA_DM08/GRP/log_g14m1.dbf';
alter database rename file '+DATA_DM04/grpstdby/onlinelog/group_5.588.929287435' to '+DATA_DM08/GRP/group_5.588.929287435';
alter database rename file '+DATA_DM04/grpstdby/onlinelog/group_6.587.929287435' to '+DATA_DM08/GRP/group_6.587.929287435';
alter database rename file '+DATA_DM04/grpstdby/onlinelog/group_7.586.929287435' to '+DATA_DM08/GRP/group_7.586.929287435';
alter database rename file '+DATA_DM04/grpstdby/onlinelog/group_8.585.929287435' to '+DATA_DM08/GRP/group_8.585.929287435';
7. open upgrade resetlogs the database.
alter database open resetlogs upgrade;
8. CRS registration to 12C CRS.
srvctl add database -d GRP -o /u01/app/oracle/product/11.2.0/dbhome_1
srvctl add instance -d GRP -i GRP1 -n dm08db01
srvctl add instance -d GRP -i GRP2 -n dm08db02
srvctl modify database -d GRP -p '+DATA_DM08/GRP/spfilegrp'
srvctl config database -d GRP -a
srvctl modify database -d GRP -a DATA_DM08,DBFS_DG,RECO_DM08
9.Add the DB to /etc/oratab
9.
alter system reset remote_os_authent scope=spfile;
alter system set cluster_database=true scope=spfile;
10. Test a DB restart.
srvctl stop database -d GRP
srvctl start database -d GRP
11. Upgrade the DB using DBUA. 注意这里要使用12c的oracle home.
[oracle@dm08db01 env]$ . GRP_env
[oracle@dm08db01 env]$ export DISPLAY=10.129.61.157:0.0
[oracle@dm08db01 env]$ dbua
12. 参见DBUA过程。
11gTo12CByDBUA.docx
Reference:
Complete Checklist for Upgrading to Oracle Database 12c Release 1 using DBUA (Doc ID 1516557.1)
Script to Collect DB Upgrade/Migrate Diagnostic Information (dbupgdiag.sql) (Doc ID 556610.1)
Complete Checklist for Manual Upgrades to Oracle Database 12c Release 1 (12.1) (Doc ID 1503653.1)