本文主要是介绍oracle10g_rac迁移单机,希望对大家解决编程问题提供一定的参考价值,需要的开发者们随着小编来一起学习吧!
1.创建与rac主机备份相同的目录
[root@sec1 ~]# cd /u01/backup/ [root@sec1 backup]# ll total 616112 -rw-r--r-- 1 root root 17510400 Aug 2 15:28 arch_11qdjhkm_1_1_20150802 -rw-r--r-- 1 root root 11666432 Aug 2 15:28 arch_12qdjhkm_1_1_20150802 -rw-r--r-- 1 root root 15335424 Aug 2 15:28 ctl_file_14qdjhks_1_1_20150802 -rw-r--r-- 1 root root 23183360 Aug 2 15:28 suys_lev0_0pqdjhj7_1_1_20150802 -rw-r--r-- 1 root root 8388608 Aug 2 15:28 suys_lev0_0qqdjhj7_1_1_20150802 -rw-r--r-- 1 root root 933888 Aug 2 15:28 suys_lev0_0rqdjhj8_1_1_20150802 -rw-r--r-- 1 root root 553115648 Aug 2 15:29 suys_lev0_0sqdjhj8_1_1_20150802 -rw-r--r-- 1 root root 98304 Aug 2 15:28 suys_spfile_15qdjhkv_1_1_20150802 -rw-r--r-- 1 root root 3072 Aug 2 15:28 thread_1_seq_12.259.886687571 -rw-r--r-- 1 root root 1024 Aug 2 15:28 thread_2_seq_12.276.886687573 [root@sec1 backup]# [root@sec1 backup]# chown -R oracle:oinstall * [root@sec1 backup]# [root@sec1 backup]# ll total 616112 -rw-r--r-- 1 oracle oinstall 17510400 Aug 2 15:28 arch_11qdjhkm_1_1_20150802 -rw-r--r-- 1 oracle oinstall 11666432 Aug 2 15:28 arch_12qdjhkm_1_1_20150802 -rw-r--r-- 1 oracle oinstall 15335424 Aug 2 15:28 ctl_file_14qdjhks_1_1_20150802 -rw-r--r-- 1 oracle oinstall 23183360 Aug 2 15:28 suys_lev0_0pqdjhj7_1_1_20150802 -rw-r--r-- 1 oracle oinstall 8388608 Aug 2 15:28 suys_lev0_0qqdjhj7_1_1_20150802 -rw-r--r-- 1 oracle oinstall 933888 Aug 2 15:28 suys_lev0_0rqdjhj8_1_1_20150802 -rw-r--r-- 1 oracle oinstall 553115648 Aug 2 15:29 suys_lev0_0sqdjhj8_1_1_20150802 -rw-r--r-- 1 oracle oinstall 98304 Aug 2 15:28 suys_spfile_15qdjhkv_1_1_20150802 -rw-r--r-- 1 oracle oinstall 3072 Aug 2 15:28 thread_1_seq_12.259.886687571 -rw-r--r-- 1 oracle oinstall 1024 Aug 2 15:28 thread_2_seq_12.276.886687573 [root@sec1 backup]# |
注意文件的权限问题
2.测试机上创建pfile及相关目录
*.audit_file_dest='/u01/app/oracle/admin/PROD/adump' *.background_dump_dest='/u01/app/oracle/admin/PROD/bdump' *.compatible='10.2.0.5.0' *.control_files='/u01/app/oracle/oradata/PROD/control01.ctl','/u01/app/oracle/oradata/PROD/control02.ctl','/u01/app/oracle/oradata/PROD/control03.ctl' *.core_dump_dest='/u01/app/oracle/admin/PROD/cdump' *.db_block_size=8192 *.db_domain='' *.db_file_multiblock_read_count=16 *.db_name='PROD' *.db_recovery_file_dest='/u01/app/oracle/flash_recovery_area' *.db_recovery_file_dest_size=2147483648 *.dispatchers='(PROTOCOL=TCP) (SERVICE=PRODXDB)' *.job_queue_processes=10 *.log_archive_format='%t_%s_%r.dbf' *.open_cursors=300 *.pga_aggregate_target=402653184 *.processes=150 *.remote_login_passwordfile='EXCLUSIVE' *.sga_target=1209008128 *.undo_management='AUTO' *.undo_tablespace='UNDOTBS1' *.user_dump_dest='/u01/app/oracle/admin/PROD/udump' |
创建上面的路径,用oracle用户!!!!
[root@sec1 ~]# su - oracle sec1-> sec1-> mkdir -p /u01/app/oracle/admin/PROD/adump sec1-> sec1-> mkdir -p /u01/app/oracle/admin/PROD/bdump sec1-> sec1-> mkdir -p /u01/app/oracle/admin/PROD/cdump sec1-> sec1-> mkdir -p /u01/app/oracle/admin/PROD/udump sec1-> sec1-> mkdir -p /u01/app/oracle/flash_recovery_area sec1-> sec1-> mkdir -p /u01/app/oracle/oradata/PROD sec1-> |
创建spfile文件,如果不知道路径可以
sec1-> sqlplus / as sysdba
SQL*Plus: Release 10.2.0.5.0 - Production on Sun Aug 2 15:22:15 2015
Copyright (c) 1982, 2010, Oracle. All Rights Reserved.
Connected to an idle instance.
SQL> startup nomount; ORA-01078: failure in processing system parameters LRM-00109: could not open parameter file '/u01/app/oracle/product/10.2.0/db_1/dbs/initPROD.ora' SQL> exit Disconnected sec1-> sec1-> sec1-> vi /u01/app/oracle/product/10.2.0/db_1/dbs/initPROD.ora |
数据库进入nomount状态
sec1-> sec1-> sqlplus / as sysdba
SQL*Plus: Release 10.2.0.5.0 - Production on Sun Aug 2 17:16:13 2015
Copyright (c) 1982, 2010, Oracle. All Rights Reserved.
Connected to an idle instance.
SQL> startup nomount; ORACLE instance started.
Total System Global Area 1224736768 bytes Fixed Size 2095896 bytes Variable Size 318768360 bytes Database Buffers 889192448 bytes Redo Buffers 14680064 bytes SQL> SQL> |
3.进入rman恢复控制文件
sec1-> sec1-> rman target /
Recovery Manager: Release 10.2.0.5.0 - Production on Sun Aug 2 15:31:16 2015
Copyright (c) 1982, 2007, Oracle. All rights reserved.
connected to target database: PROD (not mounted)
RMAN>
RMAN>
RMAN> restore controlfile from '/u01/backup/ctl_file_14qdjhks_1_1_20150802';
Starting restore at 02-AUG-15 using channel ORA_DISK_1
channel ORA_DISK_1: restoring control file channel ORA_DISK_1: restore complete, elapsed time: 00:00:01 output filename=/u01/app/oracle/oradata/PROD/control01.ctl output filename=/u01/app/oracle/oradata/PROD/control02.ctl output filename=/u01/app/oracle/oradata/PROD/control03.ctl Finished restore at 02-AUG-15
RMAN> exit
Recovery Manager complete. sec1-> sec1-> sec1-> cd /u01/app/oracle/oradata/PROD/ sec1-> sec1-> ll total 44844 -rw-r----- 1 oracle oinstall 15286272 Aug 2 15:33 control01.ctl -rw-r----- 1 oracle oinstall 15286272 Aug 2 15:33 control02.ctl -rw-r----- 1 oracle oinstall 15286272 Aug 2 15:33 control03.ctl sec1-> sec1-> |
4.数据库进入mount状态
sec1-> sec1-> rman target /
Recovery Manager: Release 10.2.0.5.0 - Production on Sun Aug 2 15:35:21 2015
Copyright (c) 1982, 2007, Oracle. All rights reserved.
connected to target database: PROD (not mounted)
RMAN>
RMAN> alter database mount;
using target database control file instead of recovery catalog database mounted
RMAN>
RMAN> |
其中可以查看数据文件
RMAN>
RMAN> report schema;
Starting implicit crosscheck backup at 02-AUG-15 allocated channel: ORA_DISK_1 channel ORA_DISK_1: sid=158 devtype=DISK allocated channel: ORA_DISK_2 channel ORA_DISK_2: sid=155 devtype=DISK allocated channel: ORA_DISK_3 channel ORA_DISK_3: sid=154 devtype=DISK allocated channel: ORA_DISK_4 channel ORA_DISK_4: sid=153 devtype=DISK Crosschecked 6 objects Crosschecked 14 objects Finished implicit crosscheck backup at 02-AUG-15
Starting implicit crosscheck copy at 02-AUG-15 using channel ORA_DISK_1 using channel ORA_DISK_2 using channel ORA_DISK_3 using channel ORA_DISK_4 Finished implicit crosscheck copy at 02-AUG-15
searching for all files in the recovery area cataloging files... no files cataloged
RMAN-06139: WARNING: control file is not current for REPORT SCHEMA Report of database schema
List of Permanent Datafiles =========================== File Size(MB) Tablespace RB segs Datafile Name ---- -------- -------------------- ------- ------------------------ 1 0 SYSTEM *** +DATA/prod/datafile/system.259.872516981 2 0 UNDOTBS1 *** +DATA/prod/datafile/undotbs1.260.872516997 3 0 SYSAUX *** +DATA/prod/datafile/sysaux.258.872516981 4 0 USERS *** +DATA/prod/datafile/users.264.872516981 5 0 UNDOTBS2 *** +DATA/prod/datafile/undotbs2.261.872516997 6 0 USERS *** +DATA/prod/datafile/users2.dbf 7 0 USERS *** +DATA/prod/datafile/users.269.875435395 8 0 USERS *** +DATA/prod/datafile/users.270.875435741
List of Temporary Files ======================= File Size(MB) Tablespace Maxsize(MB) Tempfile Name ---- -------- -------------------- ----------- -------------------- 2 0 TEMP 0 +DATA/prod/tempfile/temp.256.872517641
RMAN> |
查看控制文件的备份集,其中可能有已经不存在的
sec1-> sec1-> export NLS_DATE_FORMAT='yyyy-mm-dd hh24:mi:ss' sec1-> sec1-> rman target /
Recovery Manager: Release 10.2.0.5.0 - Production on Sun Aug 2 15:41:17 2015
Copyright (c) 1982, 2007, Oracle. All rights reserved.
connected to target database: PROD (DBID=284255078, not open)
RMAN> list backup summary;
using target database control file instead of recovery catalog
List of Backups =============== Key TY LV S Device Type Completion Time #Pieces #Copies Compressed Tag ------- -- -- - ----------- ------------------- ------- ------- ---------- --- 12 B 0 X DISK 2015-02-23 14:39:20 1 1 NO SUYS_LEV0 14 B 0 X DISK 2015-02-23 14:39:23 1 1 NO SUYS_LEV0 16 B 0 X DISK 2015-02-23 14:39:26 1 1 NO SUYS_LEV0 17 B A X DISK 2015-02-23 14:39:43 1 1 NO ARC_BAK 18 B A X DISK 2015-02-23 14:39:43 1 1 NO ARC_BAK 19 B A X DISK 2015-02-23 14:39:43 1 1 NO ARC_BAK 20 B A X DISK 2015-02-23 14:39:43 1 1 NO ARC_BAK 21 B F X DISK 2015-02-23 14:39:46 1 1 NO SPFILE 22 B F X DISK 2015-02-23 14:39:44 1 1 NO BAK_CTLFILE 23 B 0 A DISK 2015-08-02 14:02:18 1 1 NO SUYS_LEV0 24 B 0 A DISK 2015-08-02 14:02:18 1 1 NO SUYS_LEV0 25 B 0 A DISK 2015-08-02 14:02:18 1 1 NO SUYS_LEV0 26 B 0 X DISK 2015-08-02 14:02:44 1 1 NO SUYS_LEV0 27 B 0 X DISK 2015-08-02 14:02:45 1 1 NO SUYS_LEV0 28 B 0 A DISK 2015-08-02 14:02:45 1 1 NO SUYS_LEV0 29 B A X DISK 2015-08-02 14:03:05 1 1 NO ARC_BAK 30 B A X DISK 2015-08-02 14:03:05 1 1 NO ARC_BAK 31 B A A DISK 2015-08-02 14:03:06 1 1 NO ARC_BAK 32 B A A DISK 2015-08-02 14:03:06 1 1 NO ARC_BAK 33 B A X DISK 2015-08-02 14:03:07 1 1 NO ARC_BAK
RMAN> RMAN>
RMAN> list backup of archivelog all summary;
List of Backups =============== Key TY LV S Device Type Completion Time #Pieces #Copies Compressed Tag ------- -- -- - ----------- ------------------- ------- ------- ---------- --- 17 B A X DISK 2015-02-23 14:39:43 1 1 NO ARC_BAK 18 B A X DISK 2015-02-23 14:39:43 1 1 NO ARC_BAK 19 B A X DISK 2015-02-23 14:39:43 1 1 NO ARC_BAK 20 B A X DISK 2015-02-23 14:39:43 1 1 NO ARC_BAK 29 B A X DISK 2015-08-02 14:03:05 1 1 NO ARC_BAK 30 B A X DISK 2015-08-02 14:03:05 1 1 NO ARC_BAK 31 B A A DISK 2015-08-02 14:03:06 1 1 NO ARC_BAK 32 B A A DISK 2015-08-02 14:03:06 1 1 NO ARC_BAK 33 B A X DISK 2015-08-02 14:03:07 1 1 NO ARC_BAK
RMAN>
RMAN>
RMAN> list backup of archivelog all;
List of Backup Sets ===================
BS Key Size Device Type Elapsed Time Completion Time ------- ---------- ----------- ------------ ------------------- 17 55.00K DISK 00:00:01 2015-02-23 14:39:43 BP Key: 21 Status: EXPIRED Compressed: NO Tag: ARC_BAK Piece Name: /u01/backup/arch_0jq00hte_1_1_20150223
|
5.清理控制文件
sec1-> sec1-> export NLS_DATE_FORMAT='yyyy-mm-dd hh24:mi:ss' sec1-> sec1-> rman target /
Recovery Manager: Release 10.2.0.5.0 - Production on Sun Aug 2 15:45:15 2015
Copyright (c) 1982, 2007, Oracle. All rights reserved.
connected to target database: PROD (DBID=284255078, not open)
RMAN> list backup summary;
using target database control file instead of recovery catalog
List of Backups =============== Key TY LV S Device Type Completion Time #Pieces #Copies Compressed Tag ------- -- -- - ----------- ------------------- ------- ------- ---------- --- 12 B 0 X DISK 2015-02-23 14:39:20 1 1 NO SUYS_LEV0 14 B 0 X DISK 2015-02-23 14:39:23 1 1 NO SUYS_LEV0 16 B 0 X DISK 2015-02-23 14:39:26 1 1 NO SUYS_LEV0 17 B A X DISK 2015-02-23 14:39:43 1 1 NO ARC_BAK 18 B A X DISK 2015-02-23 14:39:43 1 1 NO ARC_BAK 19 B A X DISK 2015-02-23 14:39:43 1 1 NO ARC_BAK 20 B A X DISK 2015-02-23 14:39:43 1 1 NO ARC_BAK 21 B F X DISK 2015-02-23 14:39:46 1 1 NO SPFILE 22 B F X DISK 2015-02-23 14:39:44 1 1 NO BAK_CTLFILE 23 B 0 A DISK 2015-08-02 14:02:18 1 1 NO SUYS_LEV0 24 B 0 A DISK 2015-08-02 14:02:18 1 1 NO SUYS_LEV0 25 B 0 A DISK 2015-08-02 14:02:18 1 1 NO SUYS_LEV0 26 B 0 X DISK 2015-08-02 14:02:44 1 1 NO SUYS_LEV0 27 B 0 X DISK 2015-08-02 14:02:45 1 1 NO SUYS_LEV0 28 B 0 A DISK 2015-08-02 14:02:45 1 1 NO SUYS_LEV0 29 B A X DISK 2015-08-02 14:03:05 1 1 NO ARC_BAK 30 B A X DISK 2015-08-02 14:03:05 1 1 NO ARC_BAK 31 B A A DISK 2015-08-02 14:03:06 1 1 NO ARC_BAK 32 B A A DISK 2015-08-02 14:03:06 1 1 NO ARC_BAK 33 B A X DISK 2015-08-02 14:03:07 1 1 NO ARC_BAK
RMAN>
RMAN>
RMAN> crosscheck backup;
allocated channel: ORA_DISK_1 channel ORA_DISK_1: sid=154 devtype=DISK allocated channel: ORA_DISK_2 channel ORA_DISK_2: sid=153 devtype=DISK allocated channel: ORA_DISK_3 channel ORA_DISK_3: sid=157 devtype=DISK allocated channel: ORA_DISK_4 channel ORA_DISK_4: sid=156 devtype=DISK crosschecked backup piece: found to be 'AVAILABLE' backup piece handle=/u01/backup/suys_lev0_0qqdjhj7_1_1_20150802 recid=30 stamp=886687336 crosschecked backup piece: found to be 'AVAILABLE' backup piece handle=/u01/backup/suys_lev0_0pqdjhj7_1_1_20150802 recid=31 stamp=886687336 crosschecked backup piece: found to be 'AVAILABLE' backup piece handle=/u01/backup/suys_lev0_0rqdjhj8_1_1_20150802 recid=32 stamp=886687337 crosschecked backup piece: found to be 'AVAILABLE' backup piece handle=/u01/backup/suys_lev0_0sqdjhj8_1_1_20150802 recid=35 stamp=886687339 crosschecked backup piece: found to be 'AVAILABLE' backup piece handle=/u01/backup/arch_11qdjhkm_1_1_20150802 recid=38 stamp=886687385 crosschecked backup piece: found to be 'AVAILABLE' backup piece handle=/u01/backup/arch_12qdjhkm_1_1_20150802 recid=39 stamp=886687386 Crosschecked 6 objects
crosschecked backup piece: found to be 'EXPIRED' backup piece handle=/u01/backup/suys_lev0_0eq00hs2_1_1_20150223 recid=29 stamp=872516712 crosschecked backup piece: found to be 'EXPIRED' backup piece handle=/u01/backup/suys_lev0_0fq00hs2_1_1_20150223 recid=22 stamp=872516712 crosschecked backup piece: found to be 'EXPIRED' backup piece handle=/u01/backup/suys_lev0_0gq00hs2_1_1_20150223 recid=26 stamp=872516712 crosschecked backup piece: found to be 'EXPIRED' backup piece handle=/u01/backup/arch_0jq00hte_1_1_20150223 recid=21 stamp=872516712 crosschecked backup piece: found to be 'EXPIRED' backup piece handle=/u01/backup/arch_0kq00hte_1_1_20150223 recid=24 stamp=872516712 crosschecked backup piece: found to be 'EXPIRED' backup piece handle=/u01/backup/arch_0lq00hte_1_1_20150223 recid=28 stamp=872516712 crosschecked backup piece: found to be 'EXPIRED' backup piece handle=/u01/backup/arch_0mq00hte_1_1_20150223 recid=25 stamp=872516712 crosschecked backup piece: found to be 'EXPIRED' backup piece handle=/u01/backup/suys_spfile_0oq00hti_1_1_20150223 recid=23 stamp=872516712 crosschecked backup piece: found to be 'EXPIRED' backup piece handle=/u01/backup/ctl_file_0nq00htg_1_1_20150223 recid=27 stamp=872516712 crosschecked backup piece: found to be 'EXPIRED' backup piece handle=/u01/backup/suys_lev0_0tqdjhjd_1_1_20150802 recid=33 stamp=886687359 crosschecked backup piece: found to be 'EXPIRED' backup piece handle=/u01/backup/suys_lev0_0uqdjhk0_1_1_20150802 recid=34 stamp=886687362 crosschecked backup piece: found to be 'EXPIRED' backup piece handle=/u01/backup/arch_0vqdjhkm_1_1_20150802 recid=36 stamp=886687383 crosschecked backup piece: found to be 'EXPIRED' backup piece handle=/u01/backup/arch_10qdjhkm_1_1_20150802 recid=37 stamp=886687384 crosschecked backup piece: found to be 'EXPIRED' backup piece handle=/u01/backup/arch_13qdjhkr_1_1_20150802 recid=40 stamp=886687387 Crosschecked 14 objects
RMAN> delete noprompt expired backup;
using channel ORA_DISK_1 using channel ORA_DISK_2 using channel ORA_DISK_3 using channel ORA_DISK_4
List of Backup Pieces BP Key BS Key Pc# Cp# Status Device Type Piece Name ------- ------- --- --- ----------- ----------- ---------- 29 12 1 1 EXPIRED DISK /u01/backup/suys_lev0_0eq00hs2_1_1_20150223 22 14 1 1 EXPIRED DISK /u01/backup/suys_lev0_0fq00hs2_1_1_20150223 26 16 1 1 EXPIRED DISK /u01/backup/suys_lev0_0gq00hs2_1_1_20150223 21 17 1 1 EXPIRED DISK /u01/backup/arch_0jq00hte_1_1_20150223 24 18 1 1 EXPIRED DISK /u01/backup/arch_0kq00hte_1_1_20150223 28 19 1 1 EXPIRED DISK /u01/backup/arch_0lq00hte_1_1_20150223 25 20 1 1 EXPIRED DISK /u01/backup/arch_0mq00hte_1_1_20150223 23 21 1 1 EXPIRED DISK /u01/backup/suys_spfile_0oq00hti_1_1_20150223 27 22 1 1 EXPIRED DISK /u01/backup/ctl_file_0nq00htg_1_1_20150223 33 26 1 1 EXPIRED DISK /u01/backup/suys_lev0_0tqdjhjd_1_1_20150802 34 27 1 1 EXPIRED DISK /u01/backup/suys_lev0_0uqdjhk0_1_1_20150802 36 29 1 1 EXPIRED DISK /u01/backup/arch_0vqdjhkm_1_1_20150802 37 30 1 1 EXPIRED DISK /u01/backup/arch_10qdjhkm_1_1_20150802 40 33 1 1 EXPIRED DISK /u01/backup/arch_13qdjhkr_1_1_20150802 deleted backup piece backup piece handle=/u01/backup/suys_lev0_0eq00hs2_1_1_20150223 recid=29 stamp=872516712 deleted backup piece backup piece handle=/u01/backup/suys_lev0_0fq00hs2_1_1_20150223 recid=22 stamp=872516712 deleted backup piece backup piece handle=/u01/backup/suys_lev0_0gq00hs2_1_1_20150223 recid=26 stamp=872516712 deleted backup piece backup piece handle=/u01/backup/arch_0jq00hte_1_1_20150223 recid=21 stamp=872516712 deleted backup piece backup piece handle=/u01/backup/arch_0kq00hte_1_1_20150223 recid=24 stamp=872516712 deleted backup piece backup piece handle=/u01/backup/arch_0lq00hte_1_1_20150223 recid=28 stamp=872516712 deleted backup piece backup piece handle=/u01/backup/arch_0mq00hte_1_1_20150223 recid=25 stamp=872516712 deleted backup piece backup piece handle=/u01/backup/suys_spfile_0oq00hti_1_1_20150223 recid=23 stamp=872516712 deleted backup piece backup piece handle=/u01/backup/ctl_file_0nq00htg_1_1_20150223 recid=27 stamp=872516712 deleted backup piece backup piece handle=/u01/backup/suys_lev0_0tqdjhjd_1_1_20150802 recid=33 stamp=886687359 deleted backup piece backup piece handle=/u01/backup/suys_lev0_0uqdjhk0_1_1_20150802 recid=34 stamp=886687362 deleted backup piece backup piece handle=/u01/backup/arch_0vqdjhkm_1_1_20150802 recid=36 stamp=886687383 deleted backup piece backup piece handle=/u01/backup/arch_10qdjhkm_1_1_20150802 recid=37 stamp=886687384 deleted backup piece backup piece handle=/u01/backup/arch_13qdjhkr_1_1_20150802 recid=40 stamp=886687387 Deleted 14 EXPIRED objects
RMAN> list backup summary;
List of Backups =============== Key TY LV S Device Type Completion Time #Pieces #Copies Compressed Tag ------- -- -- - ----------- ------------------- ------- ------- ---------- --- 23 B 0 A DISK 2015-08-02 14:02:18 1 1 NO SUYS_LEV0 24 B 0 A DISK 2015-08-02 14:02:18 1 1 NO SUYS_LEV0 25 B 0 A DISK 2015-08-02 14:02:18 1 1 NO SUYS_LEV0 28 B 0 A DISK 2015-08-02 14:02:45 1 1 NO SUYS_LEV0 31 B A A DISK 2015-08-02 14:03:06 1 1 NO ARC_BAK 32 B A A DISK 2015-08-02 14:03:06 1 1 NO ARC_BAK
RMAN> |
6.注册归档文件用rman
RMAN>
RMAN> catalog start with '/u01/backup/';
searching for all files that match the pattern /u01/backup/
List of Files Unknown to the Database ===================================== File Name: /u01/backup/thread_2_seq_12.276.886687573 ##这个归档文件注册后会在v$archived_log查询到 File Name: /u01/backup/thread_1_seq_12.259.886687571 File Name: /u01/backup/suys_spfile_15qdjhkv_1_1_20150802 File Name: /u01/backup/ctl_file_14qdjhks_1_1_20150802
Do you really want to catalog the above files (enter YES or NO)? yes cataloging files... cataloging done
List of Cataloged Files ======================= File Name: /u01/backup/thread_2_seq_12.276.886687573 File Name: /u01/backup/thread_1_seq_12.259.886687571 File Name: /u01/backup/suys_spfile_15qdjhkv_1_1_20150802 File Name: /u01/backup/ctl_file_14qdjhks_1_1_20150802
RMAN>
RMAN> list backup of archivelog all;
List of Backup Sets ===================
BS Key Size Device Type Elapsed Time Completion Time ------- ---------- ----------- ------------ ------------------- 31 16.70M DISK 00:00:04 2015-08-02 14:03:06 BP Key: 38 Status: AVAILABLE Compressed: NO Tag: ARC_BAK Piece Name: /u01/backup/arch_11qdjhkm_1_1_20150802
List of Archived Logs in backup set 31 Thrd Seq Low SCN Low Time Next SCN Next Time ---- ------- ---------- ------------------- ---------- --------- 2 8 679853 2015-05-28 21:54:13 724369 2015-06-16 20:00:30 2 9 724369 2015-06-16 20:00:30 744928 2015-06-16 20:03:52 2 10 744928 2015-06-16 20:03:52 775204 2015-08-02 14:02:49 2 11 775204 2015-08-02 14:02:49 775220 2015-08-02 14:02:58
BS Key Size Device Type Elapsed Time Completion Time ------- ---------- ----------- ------------ ------------------- 32 11.13M DISK 00:00:04 2015-08-02 14:03:06 BP Key: 39 Status: AVAILABLE Compressed: NO Tag: ARC_BAK Piece Name: /u01/backup/arch_12qdjhkm_1_1_20150802
List of Archived Logs in backup set 32 Thrd Seq Low SCN Low Time Next SCN Next Time ---- ------- ---------- ------------------- ---------- --------- 1 6 589140 2015-03-27 08:47:35 634844 2015-05-23 00:18:23 1 7 634844 2015-05-23 00:18:23 679851 2015-05-28 21:54:09 1 8 679851 2015-05-28 21:54:09 703991 2015-05-28 22:12:17 1 9 703991 2015-05-28 22:12:17 764948 2015-07-15 20:33:27 1 10 764948 2015-07-15 20:33:27 775201 2015-08-02 14:02:46 1 11 775201 2015-08-02 14:02:46 775212 2015-08-02 14:02:55 2 1 410846 2015-02-24 13:59:26 432162 2015-02-24 14:04:39
RMAN> exit
Recovery Manager complete. sec1-> sec1-> sqlplus / as sysdba
SQL*Plus: Release 10.2.0.5.0 - Production on Sun Aug 2 15:58:59 2015
Copyright (c) 1982, 2010, Oracle. All Rights Reserved.
Connected to: Oracle Database 10g Enterprise Edition Release 10.2.0.5.0 - 64bit Production With the Partitioning, OLAP, Data Mining and Real Application Testing options
SQL> SQL> select NAME from v$archived_log;
NAME --------------------------------------------------------------------------------
NAME --------------------------------------------------------------------------------
NAME --------------------------------------------------------------------------------
/u01/backup/thread_2_seq_12.276.886687573 /u01/backup/thread_1_seq_12.259.886687571
28 rows selected.
SQL> |
7.恢复数据文件
sec1-> rman target /
Recovery Manager: Release 10.2.0.5.0 - Production on Sun Aug 2 16:05:15 2015
Copyright (c) 1982, 2007, Oracle. All rights reserved.
connected to target database: PROD (DBID=284255078, not open)
RMAN> run{ 2> allocate channel c1 device type disk; 3> allocate channel c2 device type disk; 4> 5> set newname for datafile 1 to '/u01/app/oracle/oradata/PROD/system.dbf'; 6> set newname for datafile 2 to '/u01/app/oracle/oradata/PROD/undotbs1.dbf'; 7> set newname for datafile 3 to '/u01/app/oracle/oradata/PROD/sysaux.dbf'; 8> set newname for datafile 4 to '/u01/app/oracle/oradata/PROD/users01.dbf'; 9> set newname for datafile 5 to '/u01/app/oracle/oradata/PROD/undotbs2.dbf'; 10> set newname for datafile 6 to '/u01/app/oracle/oradata/PROD/users02.dbf'; 11> set newname for datafile 7 to '/u01/app/oracle/oradata/PROD/users03.dbf'; 12> set newname for datafile 8 to '/u01/app/oracle/oradata/PROD/users04.dbf'; 13> 14> restore database; 15> switch datafile all; 16> release channel c1; 17> release channel c2; 18> }
using target database control file instead of recovery catalog allocated channel: c1 channel c1: sid=157 devtype=DISK
allocated channel: c2 channel c2: sid=156 devtype=DISK
executing command: SET NEWNAME
executing command: SET NEWNAME
executing command: SET NEWNAME
executing command: SET NEWNAME
executing command: SET NEWNAME
executing command: SET NEWNAME
executing command: SET NEWNAME
executing command: SET NEWNAME
Starting restore at 2015-08-02 16:05:22
channel c1: starting datafile backupset restore channel c1: specifying datafile(s) to restore from backup set restoring datafile 00005 to /u01/app/oracle/oradata/PROD/undotbs2.dbf restoring datafile 00007 to /u01/app/oracle/oradata/PROD/users03.dbf channel c1: reading from backup piece /u01/backup/suys_lev0_0qqdjhj7_1_1_20150802 channel c2: starting datafile backupset restore channel c2: specifying datafile(s) to restore from backup set restoring datafile 00002 to /u01/app/oracle/oradata/PROD/undotbs1.dbf restoring datafile 00006 to /u01/app/oracle/oradata/PROD/users02.dbf channel c2: reading from backup piece /u01/backup/suys_lev0_0pqdjhj7_1_1_20150802 channel c1: restored backup piece 1 piece handle=/u01/backup/suys_lev0_0qqdjhj7_1_1_20150802 tag=SUYS_LEV0 channel c1: restore complete, elapsed time: 00:00:37 channel c2: restored backup piece 1 piece handle=/u01/backup/suys_lev0_0pqdjhj7_1_1_20150802 tag=SUYS_LEV0 channel c2: restore complete, elapsed time: 00:00:37 channel c1: starting datafile backupset restore channel c1: specifying datafile(s) to restore from backup set restoring datafile 00004 to /u01/app/oracle/oradata/PROD/users01.dbf restoring datafile 00008 to /u01/app/oracle/oradata/PROD/users04.dbf channel c1: reading from backup piece /u01/backup/suys_lev0_0rqdjhj8_1_1_20150802 channel c2: starting datafile backupset restore channel c2: specifying datafile(s) to restore from backup set restoring datafile 00001 to /u01/app/oracle/oradata/PROD/system.dbf restoring datafile 00003 to /u01/app/oracle/oradata/PROD/sysaux.dbf channel c2: reading from backup piece /u01/backup/suys_lev0_0sqdjhj8_1_1_20150802 channel c1: restored backup piece 1 piece handle=/u01/backup/suys_lev0_0rqdjhj8_1_1_20150802 tag=SUYS_LEV0 channel c1: restore complete, elapsed time: 00:00:36 channel c2: restored backup piece 1 piece handle=/u01/backup/suys_lev0_0sqdjhj8_1_1_20150802 tag=SUYS_LEV0 channel c2: restore complete, elapsed time: 00:00:39 Finished restore at 2015-08-02 16:06:38
datafile 1 switched to datafile copy input datafile copy recid=14 stamp=886694798 filename=/u01/app/oracle/oradata/PROD/system.dbf datafile 2 switched to datafile copy input datafile copy recid=15 stamp=886694798 filename=/u01/app/oracle/oradata/PROD/undotbs1.dbf datafile 3 switched to datafile copy input datafile copy recid=16 stamp=886694798 filename=/u01/app/oracle/oradata/PROD/sysaux.dbf datafile 4 switched to datafile copy input datafile copy recid=17 stamp=886694798 filename=/u01/app/oracle/oradata/PROD/users01.dbf datafile 5 switched to datafile copy input datafile copy recid=18 stamp=886694798 filename=/u01/app/oracle/oradata/PROD/undotbs2.dbf datafile 6 switched to datafile copy input datafile copy recid=19 stamp=886694798 filename=/u01/app/oracle/oradata/PROD/users02.dbf datafile 7 switched to datafile copy input datafile copy recid=20 stamp=886694798 filename=/u01/app/oracle/oradata/PROD/users03.dbf datafile 8 switched to datafile copy input datafile copy recid=21 stamp=886694798 filename=/u01/app/oracle/oradata/PROD/users04.dbf
released channel: c1
released channel: c2
RMAN> exit
Recovery Manager complete. sec1-> sec1-> cd /u01/app/oracle/oradata/PROD sec1-> sec1-> ll total 3977876 -rw-r----- 1 oracle oinstall 15286272 Aug 2 16:06 control01.ctl -rw-r----- 1 oracle oinstall 15286272 Aug 2 16:06 control02.ctl -rw-r----- 1 oracle oinstall 15286272 Aug 2 16:06 control03.ctl -rw-r----- 1 oracle oinstall 283123712 Aug 2 16:06 sysaux.dbf -rw-r----- 1 oracle oinstall 461381632 Aug 2 16:06 system.dbf -rw-r----- 1 oracle oinstall 26222592 Aug 2 16:05 undotbs1.dbf -rw-r----- 1 oracle oinstall 26222592 Aug 2 16:05 undotbs2.dbf -rw-r----- 1 oracle oinstall 5251072 Aug 2 16:06 users01.dbf -rw-r----- 1 oracle oinstall 1073750016 Aug 2 16:05 users02.dbf -rw-r----- 1 oracle oinstall 1073750016 Aug 2 16:05 users03.dbf -rw-r----- 1 oracle oinstall 1073750016 Aug 2 16:06 users04.dbf sec1-> |
8.恢复归档文件的应用,要比较rman备份集中和数据库实际归档是否一致。
如果rman备份集中的归档文件是最新的,可以用下面方法
RMAN>
RMAN> list backup of archivelog all;
using target database control file instead of recovery catalog
List of Backup Sets ===================
BS Key Size Device Type Elapsed Time Completion Time ------- ---------- ----------- ------------ ------------------- 31 16.70M DISK 00:00:04 2015-08-02 14:03:06 BP Key: 38 Status: AVAILABLE Compressed: NO Tag: ARC_BAK Piece Name: /u01/backup/arch_11qdjhkm_1_1_20150802
List of Archived Logs in backup set 31 Thrd Seq Low SCN Low Time Next SCN Next Time ---- ------- ---------- ------------------- ---------- --------- 2 8 679853 2015-05-28 21:54:13 724369 2015-06-16 20:00:30 2 9 724369 2015-06-16 20:00:30 744928 2015-06-16 20:03:52 2 10 744928 2015-06-16 20:03:52 775204 2015-08-02 14:02:49 2 11 775204 2015-08-02 14:02:49 775220 2015-08-02 14:02:58
BS Key Size Device Type Elapsed Time Completion Time ------- ---------- ----------- ------------ ------------------- 32 11.13M DISK 00:00:04 2015-08-02 14:03:06 BP Key: 39 Status: AVAILABLE Compressed: NO Tag: ARC_BAK Piece Name: /u01/backup/arch_12qdjhkm_1_1_20150802
List of Archived Logs in backup set 32 Thrd Seq Low SCN Low Time Next SCN Next Time ---- ------- ---------- ------------------- ---------- --------- 1 6 589140 2015-03-27 08:47:35 634844 2015-05-23 00:18:23 1 7 634844 2015-05-23 00:18:23 679851 2015-05-28 21:54:09 1 8 679851 2015-05-28 21:54:09 703991 2015-05-28 22:12:17 1 9 703991 2015-05-28 22:12:17 764948 2015-07-15 20:33:27 1 10 764948 2015-07-15 20:33:27 775201 2015-08-02 14:02:46 1 11 775201 2015-08-02 14:02:46 775212 2015-08-02 14:02:55 2 1 410846 2015-02-24 13:59:26 432162 2015-02-24 14:04:39
RMAN>
RMAN>
RMAN> run{ #这个时候看 list backup of archivelog all 已经没有意义,还有没有备份的归档文件,此步骤是错误的 2> set until sequence 11 thread 2; 3> recover database; 4> }
executing command: SET until clause
Starting recover at 2015-08-02 16:11:39 allocated channel: ORA_DISK_1 channel ORA_DISK_1: sid=153 devtype=DISK allocated channel: ORA_DISK_2 channel ORA_DISK_2: sid=154 devtype=DISK allocated channel: ORA_DISK_3 channel ORA_DISK_3: sid=155 devtype=DISK allocated channel: ORA_DISK_4 channel ORA_DISK_4: sid=158 devtype=DISK
starting media recovery
archive log thread 1 sequence 12 is already on disk as file /u01/backup/thread_1_seq_12.259.886687571 archive log thread 2 sequence 12 is already on disk as file /u01/backup/thread_2_seq_12.276.886687573 channel ORA_DISK_1: starting archive log restore to default destination channel ORA_DISK_2: starting archive log restore to default destination channel ORA_DISK_1: restoring archive log archive log thread=2 sequence=10 channel ORA_DISK_1: restoring archive log archive log thread=2 sequence=11 channel ORA_DISK_1: reading from backup piece /u01/backup/arch_11qdjhkm_1_1_20150802 channel ORA_DISK_2: restoring archive log archive log thread=1 sequence=10 channel ORA_DISK_2: restoring archive log archive log thread=1 sequence=11 channel ORA_DISK_2: reading from backup piece /u01/backup/arch_12qdjhkm_1_1_20150802 channel ORA_DISK_1: restored backup piece 1 piece handle=/u01/backup/arch_11qdjhkm_1_1_20150802 tag=ARC_BAK channel ORA_DISK_1: restore complete, elapsed time: 00:00:01 channel ORA_DISK_2: restored backup piece 1 piece handle=/u01/backup/arch_12qdjhkm_1_1_20150802 tag=ARC_BAK channel ORA_DISK_2: restore complete, elapsed time: 00:00:01 archive log filename=/u01/app/oracle/flash_recovery_area/PROD/archivelog/2015_08_02/o1_mf_1_10_bvvn5xsf_.arc thread=1 sequence=10 archive log filename=/u01/app/oracle/flash_recovery_area/PROD/archivelog/2015_08_02/o1_mf_2_10_bvvn5xs9_.arc thread=2 sequence=10 channel default: deleting archive log(s) archive log filename=/u01/app/oracle/flash_recovery_area/PROD/archivelog/2015_08_02/o1_mf_1_10_bvvn5xsf_.arc recid=46 stamp=886695101 archive log filename=/u01/app/oracle/flash_recovery_area/PROD/archivelog/2015_08_02/o1_mf_1_11_bvvn5xw9_.arc thread=1 sequence=11 channel default: deleting archive log(s) archive log filename=/u01/app/oracle/flash_recovery_area/PROD/archivelog/2015_08_02/o1_mf_2_10_bvvn5xs9_.arc recid=48 stamp=886695102 archive log filename=/u01/app/oracle/flash_recovery_area/PROD/archivelog/2015_08_02/o1_mf_2_11_bvvn5xwr_.arc thread=2 sequence=11 channel default: deleting archive log(s) archive log filename=/u01/app/oracle/flash_recovery_area/PROD/archivelog/2015_08_02/o1_mf_1_11_bvvn5xw9_.arc recid=45 stamp=886695101 archive log filename=/u01/backup/thread_1_seq_12.259.886687571 thread=1 sequence=12 channel default: deleting archive log(s) archive log filename=/u01/app/oracle/flash_recovery_area/PROD/archivelog/2015_08_02/o1_mf_2_11_bvvn5xwr_.arc recid=47 stamp=886695101 archive log filename=/u01/backup/thread_2_seq_12.276.886687573 thread=2 sequence=12 unable to find archive log archive log thread=1 sequence=13 RMAN-00571: =========================================================== RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS =============== RMAN-00571: =========================================================== RMAN-03002: failure of recover command at 08/02/2015 16:11:43 RMAN-06054: media recovery requesting unknown log: thread 1 seq 13 lowscn 775352
RMAN> exit
Recovery Manager complete. sec1-> sec1-> |
注意:如果有最新归档文件没有用rman备份,恢复的时候使用
recover database using backup controlfile until cancel;
使用这个SQL里面命令前,所有归档备份集(RMAN)要放在归档路径换句话的意思就是要把备份集的归档文件提取出来。
run { allocate channel c1 type disk; set archivelog destination to '/app/bea/expdp'; restore archivelog from sequence 8776 until sequence 8780 thread 1; release channel c1; }
注意 节点1和节点2的都要提取 |
9.整理rac到单机的online redolog路径问题
SQL> col MEMBER format a80 SQL> set linesize 150 SQL> SQL> select GROUP#,member from v$logfile;
GROUP# MEMBER ---------- -------------------------------------------------------------------------------- 2 +DATA/prod/onlinelog/group_2.265.872517567 1 +DATA/prod/onlinelog/group_1.262.872517567 3 +DATA/prod/onlinelog/group_3.266.872517569 4 +DATA/prod/onlinelog/group_4.263.872517569
SQL> SQL> alter database rename file '+DATA/prod/onlinelog/group_2.265.872517567' to '/u01/app/oracle/oradata/PROD/redo02.log';
Database altered.
SQL> SQL> alter database rename file '+DATA/prod/onlinelog/group_1.262.872517567' to '/u01/app/oracle/oradata/PROD/redo01.log';
Database altered.
SQL> SQL> alter database rename file '+DATA/prod/onlinelog/group_3.266.872517569' to '/u01/app/oracle/oradata/PROD/redo03.log';
Database altered.
SQL> SQL> alter database rename file '+DATA/prod/onlinelog/group_4.263.872517569' to '/u01/app/oracle/oradata/PROD/redo04.log';
Database altered.
SQL> select GROUP#,member from v$logfile;
GROUP# MEMBER ---------- -------------------------------------------------------------------------------- 2 /u01/app/oracle/oradata/PROD/redo02.log 1 /u01/app/oracle/oradata/PROD/redo01.log 3 /u01/app/oracle/oradata/PROD/redo03.log 4 /u01/app/oracle/oradata/PROD/redo04.log
SQL> |
10.删除2号节点
SQL> alter database open resetlogs;
Database altered.
SQL> SQL> select THREAD#, STATUS, ENABLED from v$thread;
THREAD# STATUS ENABLED ---------- ------------------ ------------------------ 1 OPEN PUBLIC 2 CLOSED PUBLIC
SQL> SQL> alter database disable thread 2;
Database altered.
SQL> SQL> select THREAD#, STATUS, ENABLED from v$thread;
THREAD# STATUS ENABLED ---------- ------------------ ------------------------ 1 OPEN PUBLIC 2 CLOSED DISABLED
SQL> |
11.删除2号节点上面的online redolog
SQL> SQL> select group# from v$log where THREAD#=2;
GROUP# ---------- 3 4
SQL> SQL> SQL> alter database drop logfile group 3; alter database drop logfile group 3 * ERROR at line 1: ORA-00350: log 3 of instance PROD2 (thread 2) needs to be archived ORA-00312: online log 3 thread 2: '/u01/app/oracle/oradata/PROD/redo03.log'
SQL> alter database clear unarchived logfile group 3;
Database altered.
SQL> SQL> alter database drop logfile group 4;
Database altered.
SQL> SQL> select group# from v$log where THREAD#=2;
GROUP# ---------- 3
SQL> alter database drop logfile group 3;
Database altered.
SQL> SQL> select group# from v$log where THREAD#=2;
no rows selected
SQL> SQL> |
12.清理2号节点的undo表空间
SQL> SQL> SQL> select tablespace_name from dba_tablespaces where contents='UNDO';
TABLESPACE_NAME ------------------------------------------------------------------------------------------ UNDOTBS1 UNDOTBS2
SQL> SQL> SQL> drop tablespace UNDOTBS2 including contents and datafiles;
Tablespace dropped.
SQL> SQL> select tablespace_name from dba_tablespaces where contents='UNDO';
TABLESPACE_NAME ------------------------------------------------------------------------------------------ UNDOTBS1
SQL> |
13.清理temp表空间
SQL> SQL> SQL> select name from v$tempfile;
NAME ---------------------------------------------------------------------- +DATA/prod/tempfile/temp.256.872517641
SQL> SQL> select tablespace_name from dba_tablespaces where contents='TEMPORARY';
TABLESPACE_NAME ------------------------------------------------------------------------------------------ TEMP
SQL> create temporary tablespace TEMP1 tempfile '/u01/app/oracle/oradata/PROD/temp01.dbf' size 200M autoextend off;
Tablespace created.
SQL> alter database default temporary tablespace TEMP1;
Database altered.
SQL> SQL> drop tablespace TEMP including contents and datafiles;
Tablespace dropped.
SQL> select name from v$tempfile;
NAME ---------------------------------------------------------------------- /u01/app/oracle/oradata/PROD/temp01.dbf
SQL> SQL> |
这篇关于oracle10g_rac迁移单机的文章就介绍到这儿,希望我们推荐的文章对编程师们有所帮助!