数据迁移_老RAC_新RAC
Posted zhouwanchun
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了数据迁移_老RAC_新RAC相关的知识,希望对你有一定的参考价值。
数据迁移_老RAC_新RAC
作者:Eric 微信:loveoracle11g 1、把老集群RAC备份的数据远程拷贝到新集群RAC [[email protected] ~]# cd /backup/rman/orcl [[email protected] orcl]# ls -l *1119* [[email protected] orcl]# scp *1119* [email protected]:/backup/rman/orcl 密码:oracle [[email protected] ~]# su - oracle [[email protected] ~]$ cd /backup/rman/orcl [[email protected] orcl]$ ll total 7357616 -rw-r----- 1 oracle asmadmin 242676224 Nov 16 02:55 arch_5dtiajdc_1_1_20181115.bak -rw-r----- 1 oracle asmadmin 241586176 Nov 16 02:55 arch_5etiajdc_1_1_20181115.bak -rw-r----- 1 oracle asmadmin 203652096 Nov 16 02:55 arch_5ftiajdg_1_1_20181115.bak -rw-r----- 1 oracle asmadmin 19202048 Nov 16 02:55 ctl_file_5gtiajdi_1_1_20181115.bak -rw-r----- 1 oracle asmadmin 5939224576 Nov 16 02:56 data_level0_59tiajbk_1_1_20181115.bak -rw-r----- 1 oracle asmadmin 868433920 Nov 16 02:56 data_level0_5atiajbk_1_1_20181115.bak -rw-r----- 1 oracle asmadmin 19202048 Nov 16 02:56 data_level0_5btiajbr_1_1_20181115.bak -rw-r----- 1 oracle asmadmin 98304 Nov 16 02:56 data_level0_5ctiajbu_1_1_20181115.bak -rw-r----- 1 oracle asmadmin 98304 Nov 16 02:56 orcl_spfile_5htiajdl_1_1_20181115.bak [[email protected] orcl]$ pwd /backup/rman/orcl 2、新集群要恢复的数据库,要开启归档 # su - grid # srvctl stop database -d orcl ---------------------------------------->node1 # su - oracle # export ORACLE_SID=orcl1 # sqlplus / as sysdba SQL> startup mount ; SQL> alter database archivelog ; ---------------------------------------->node2 # su - oracle # export ORACLE_SID=orcl2 # sqlplus / as sysdba SQL> startup mount ; SQL> alter database archivelog ; ---------------------------------------->node1 SQL> alter database open ; ---------------------------------------->node2 SQL> alter database open ; 3、停掉要恢复的数据库orcl 直接停掉# srvctl stop database -d orcl 查看# su - grid # crs_stat -t -v # crsctl stat res -t [[email protected] ~]$ export ORACLE_SID=orcl1 [[email protected] ~]$ sqlplus / as sysdba SQL> shutdown immediate ; [[email protected] ~]$ export ORACLE_SID=orcl2 [[email protected] ~]$ sqlplus / as sysdba SQL> shutdown immediate ; [[email protected] orcl]$ rman target / RMAN> shutdown immediate ; RMAN> startup mount ; 4、恢复参数文件spfile RMAN> restore spfile to ‘+DATA/spfileorcl.ora‘ from ‘/backup/rman/orcl/orcl_spfile_5htiajdl_1_1_20181115.bak‘; RMAN> shutdown immediate ; RMAN> exit ; [[email protected] orcl]$ sqlplus / as sysdba SQL> startup force nomount ; ALTER SYSTEM SET DB_CREATE_FILE_DEST=‘+DATA‘ SID=‘*‘; ALTER SYSTEM SET DB_RECOVERY_FILE_DEST_SIZE=100G SID=‘*‘; ALTER SYSTEM SET DB_RECOVERY_FILE_DEST=‘+FRA‘ SID=‘*‘; ALTER SYSTEM SET CONTROL_FILES=‘+DATA‘,‘+FRA‘ SCOPE=SPFILE SID=‘*‘; 5、恢复控制文件controlfile [[email protected] orcl]$ rman target / RMAN> startup force nomount ; RMAN> restore controlfile from ‘/backup/rman/orcl/ctl_file_5gtiajdi_1_1_20181115.bak‘ ; RMAN> alter database mount ; 6、恢复数据文件datafile RMAN> catalog start with ‘/backup/rman/orcl/‘ ; 输入:yes run { allocate channel c1 device type DISK; allocate channel c2 device type DISK; allocate channel c3 device type DISK; allocate channel c4 device type DISK; restore database; switch datafile all; switch tempfile all; recover database delete archivelog; release channel c1; release channel c2; release channel c3; release channel c4; } RMAN-00571: =========================================================== RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS =============== RMAN-00571: =========================================================== RMAN-03002: failure of recover command at 11/23/2018 04:04:48 RMAN-06054: media recovery requesting unknown archived log for thread 2 with sequence 1939 and starting SCN of 105650523 run { allocate channel c1 device type DISK; allocate channel c2 device type DISK; allocate channel c3 device type DISK; allocate channel c4 device type DISK; set until sequence 1939 thread 2; # 问题在这 restore database; switch datafile all; switch tempfile all; recover database delete archivelog; release channel c1; release channel c2; release channel c3; release channel c4; } 7、重命名redolog文件 SQL> set linesize 200 ; SQL> select ‘alter database rename file ‘‘‘||MEMBER||‘‘‘ to ‘‘‘||‘+data/orcl/onlinelog/‘||regexp_substr(MEMBER,‘[^/]+‘,1,4)||‘‘‘;‘ from v$logfile; ‘ALTERDATABASERENAMEFILE‘‘‘||MEMBER||‘‘‘TO‘‘‘||‘+DATA/orcl/ONLINELOG/‘||REGEXP_SUBSTR(MEMBER,‘[^/]+‘,1,4)||‘‘‘;‘ -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- alter database rename file ‘+DATADG/orcl/onlinelog/group_1.261.967309327‘ to ‘+data/orcl/onlinelog/group_1.261.967309327‘; alter database rename file ‘+FRADG/orcl/onlinelog/group_1.257.967309327‘ to ‘+data/orcl/onlinelog/group_1.257.967309327‘; alter database rename file ‘+DATADG/orcl/onlinelog/group_2.265.967309327‘ to ‘+data/orcl/onlinelog/group_2.265.967309327‘; alter database rename file ‘+FRADG/orcl/onlinelog/group_2.259.967309329‘ to ‘+data/orcl/onlinelog/group_2.259.967309329‘; alter database rename file ‘+DATADG/orcl/onlinelog/group_3.262.967309409‘ to ‘+data/orcl/onlinelog/group_3.262.967309409‘; alter database rename file ‘+FRADG/orcl/onlinelog/group_3.258.967309409‘ to ‘+data/orcl/onlinelog/group_3.258.967309409‘; alter database rename file ‘+DATADG/orcl/onlinelog/group_4.266.967310049‘ to ‘+data/orcl/onlinelog/group_4.266.967310049‘; alter database rename file ‘+FRADG/orcl/onlinelog/group_4.260.967310049‘ to ‘+data/orcl/onlinelog/group_4.260.967310049‘; alter database rename file ‘+DATADG/orcl/onlinelog/group_5.268.967308939‘ to ‘+data/orcl/onlinelog/group_5.268.967308939‘; alter database rename file ‘+FRADG/orcl/onlinelog/group_5.261.967308939‘ to ‘+data/orcl/onlinelog/group_5.261.967308939‘; alter database rename file ‘+DATADG/orcl/onlinelog/group_6.269.967308939‘ to ‘+data/orcl/onlinelog/group_6.269.967308939‘; ‘ALTERDATABASERENAMEFILE‘‘‘||MEMBER||‘‘‘TO‘‘‘||‘+DATA/orcl/ONLINELOG/‘||REGEXP_SUBSTR(MEMBER,‘[^/]+‘,1,4)||‘‘‘;‘ -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- alter database rename file ‘+FRADG/orcl/onlinelog/group_6.262.967308939‘ to ‘+data/orcl/onlinelog/group_6.262.967308939‘; alter database rename file ‘+DATADG/orcl/onlinelog/group_7.270.967308941‘ to ‘+data/orcl/onlinelog/group_7.270.967308941‘; alter database rename file ‘+FRADG/orcl/onlinelog/group_7.263.967308941‘ to ‘+data/orcl/onlinelog/group_7.263.967308941‘; alter database rename file ‘+DATADG/orcl/onlinelog/group_8.271.967309023‘ to ‘+data/orcl/onlinelog/group_8.271.967309023‘; alter database rename file ‘+FRADG/orcl/onlinelog/group_8.264.967309023‘ to ‘+data/orcl/onlinelog/group_8.264.967309023‘; alter database rename file ‘+DATADG/orcl/onlinelog/group_9.272.967309023‘ to ‘+data/orcl/onlinelog/group_9.272.967309023‘; alter database rename file ‘+FRADG/orcl/onlinelog/group_9.265.967309025‘ to ‘+data/orcl/onlinelog/group_9.265.967309025‘; alter database rename file ‘+DATADG/orcl/onlinelog/group_10.273.967309025‘ to ‘+data/orcl/onlinelog/group_10.273.967309025‘; alter database rename file ‘+FRADG/orcl/onlinelog/group_10.266.967309025‘ to ‘+data/orcl/onlinelog/group_10.266.967309025‘; 20 rows selected. 执行上面的输出sql alter database clear logfile group 1; alter database clear logfile group 2; alter database clear logfile group 3; alter database clear logfile group 4; alter database clear logfile group 5; alter database clear logfile group 6; alter database clear logfile group 7; alter database clear logfile group 8; alter database clear logfile group 9; alter database clear logfile group 10; SQL> ALTER DATABASE DISABLE BLOCK CHANGE TRACKING ; # 报错不管它 8、打开数据库 SQL> alter database open resetlogs ; 重启数据库 startup force ; 9、检查 检查参数文件spfile SQL> show parameter spfile ; 检查控制文件controlfile SQL> select NAME from v$controlfile ; 检查数据文件datafile SQL> select NAME from v$datafile ; 检查日志文件logfile SQL> select MEMBER from v$logfile ; 查看字符集 select userenv(‘LANGUAGE‘) FROM DUAL ; 集群实例状态 select instance_name ,status from gv$instance ; 检查集群状态 直接停掉# srvctl status database -d orcl # srvctl status instance -d orcl -i orcl1 # srvctl status instance -d orcl -i orcl2 # srvctl start database -d orcl # srvctl status database -d orcl 查看# su - grid # crs_stat -t -v # crsctl stat res -t
以上是关于数据迁移_老RAC_新RAC的主要内容,如果未能解决你的问题,请参考以下文章
oracle组建了rac双节点,单独的asm存储,现在因业务需求,需要将其中一个服务器换成新的,怎么实施迁移?