ITPub博客

首页 > 数据库 > Oracle > RMAN异机异目录完全恢复

RMAN异机异目录完全恢复

原创 Oracle 作者:liupzmin 时间:2015-09-23 12:40:48 0 删除 编辑

RMAN异机异目录完全恢复

   


    
先说一下为什么要写这个异机完全恢复的blog,作为一个年轻的DBA,相信大多数都是备份长做而恢复不常做,我会经常担心我的生产库的服务器挂了怎么办,我的备份完好,但我们又没有容灾,我能否保证我的数据不丢失呢,所以就要rman利用备份重建,而如果此时我能找到完好无损的在线日志,我是不是可以完全恢复了呢,理论上大家都说可以,确从未在网上见到过完全恢复的事例(完全其实很简单,只是网上阐述了太多的不完全恢复,会让我觉得set until time等等是必备的其中一步),甚至oracle的官方网文档上也使用了“SET UNTIL SCN 123456;” 的案例,有鉴于此,我做了这个实验,并记录下来,跟大家分享,不见得这篇原创有多高深的技术和见解O(∩_∩)O
环境:
    源库:
        os:redhat 6.3 x64 
        db: 11gr2 11.2.0.4
        存储方式:ASM
    目标库:
        os:redhat 6.5 x64 
        db: 11gr2 11.2.0.4
        存储方式:文件系统




  1. 首先,源库进行rman备份
        




点击(此处)折叠或打开

  1. --手动0级全库备份
  2. run {
  3.     CONFIGURE RETENTION POLICY TO RECOVERY WINDOW OF 7 DAYS;
  4.     CONFIGURE BACKUP OPTIMIZATION ON;
  5.     CONFIGURE CONTROLFILE AUTOBACKUP ON;
  6.     CONFIGURE DEVICE TYPE DISK PARALLELISM 4 BACKUP TYPE TO BACKUPSET;
  7.     CONFIGURE CONTROLFILE AUTOBACKUP FORMAT FOR DEVICE TYPE DISK TO '+DATA/backup/ctl_atuo_%F';
  8.     ALLOCATE CHANNEL c1 TYPE DISK;
  9.     ALLOCATE CHANNEL c2 TYPE DISK;
  10.     CROSSCHECK ARCHIVELOG ALL;
  11.     BACKUP INCREMENTAL LEVEL 0
  12.     DATABASE FORMAT '+DATA/backup/db_%U' TAG 'db_rman';
  13.     SQL 'ALTER SYSTEM ARCHIVE LOG CURRENT';
  14.     BACKUP ARCHIVELOG ALL FORMAT '+DATA/backup/arc_%U' TAG 'ARC_rman'
  15.     DELETE INPUT;
  16.     DELETE NOPROMPT OBSOLETE; 
  17.     RELEASE CHANNEL c1;
  18.     RELEASE CHANNEL c2;
  19. }

观察备份的文件,此处是ASM分别用asmcmd和rman查看,

点击(此处)折叠或打开

  1. ASMCMD> ls
  2. arc_0cqhdnqq_1_1
  3. arc_0dqhdnqq_1_1
  4. ctl_atuo_c-2496627597-20150917-00
  5. ctl_atuo_c-2496627597-20150917-01
  6. db_09qhdno6_1_1
  7. db_0aqhdno6_1_1
  8. ASMCMD> pwd
  9. +Data/backup
  10. ASMCMD>
  11. RMAN> list backup summary;
  12. List of Backups
  13. ===============
  14. Key TY LV S Device Type Completion Time #Pieces #Copies Compressed Tag
  15. ------- -- -- - ----------- --------------- ------- ------- ---------- ---
  16. 9 B 0 A DISK 17-SEP-15 1 1 NO DB_RMAN
  17. 10 B 0 A DISK 17-SEP-15 1 1 NO DB_RMAN
  18. 11 B F A DISK 17-SEP-15 1 1 NO TAG20150917T221650
  19. 12 B A A DISK 17-SEP-15 1 1 NO ARC_RMAN
  20. 13 B A A DISK 17-SEP-15 1 1 NO ARC_RMAN
  21. 14 B F A DISK 17-SEP-15 1 1 NO TAG20150917T221703

为了试验restore之后recover应用归档日志的情况,我在0级备份之后再生成一些归档日志,脚本如下:

点击(此处)折叠或打开

  1. declare 
  2.   i integer;
  3. begin
  4.   for i in 1..3000000 loop
  5.     insert into t values(i,'aaaaaaaaaaaaaaaaaaaaa');
  6.     end loop;
  7. end;

向测试表T中插入200万行数据,看归档的日志:

点击(此处)折叠或打开

  1. ASMCMD> ls
  2. 1_22_854775184.dbf
  3. 1_23_854775184.dbf
  4. 1_24_854775184.dbf
  5. 1_25_854775184.dbf
  6. 1_26_854775184.dbf
  7. 1_27_854775184.dbf
  8. 1_28_854775184.dbf
  9. 1_29_854775184.dbf
  10. 1_30_854775184.dbf
  11. 1_31_854775184.dbf
  12. 1_32_854775184.dbf
  13. 1_33_854775184.dbf
  14. 1_34_854775184.dbf
  15. 1_35_854775184.dbf
  16. 1_36_854775184.dbf
  17. 1_37_854775184.dbf
  18. 1_38_854775184.dbf
  19. 1_39_854775184.dbf

查看T表的行数

点击(此处)折叠或打开

  1. SQL> select count(1) from t;

  2.   COUNT(1)
  3. ----------
  4.    3000000


2. 现在要把rman备份,备份之后的归档,源库关闭之后的在线redo文件拷贝到备库,这里稍微麻烦一点,涉及到从asm中拷贝文件,我这里使用2中方法,rman的backup as cpoy以及asmcmd的cp命令,如下所示:

点击(此处)折叠或打开

  1. --这里是copy 0级备份
  2. backup as copy backupset 9 format '/u01/backupset/db2.rman';
  3. backup as copy backupset 10 format '/u01/backupset/db2.rman';
  4. backup as copy backupset 11 format '/u01/backupset/ctl1.rman';
  5. backup as copy backupset 12 format '/u01/backupset/arc1.rman';
  6. backup as copy backupset 13 format '/u01/backupset/arc2.rman';
  7. backup as copy backupset 14 format '/u01/backupset/ctl2.rman';
  8. --生成的归档日志
  9. ASMCMD> ls
  10. 1_22_854775184.dbf
  11. 1_23_854775184.dbf
  12. 1_24_854775184.dbf
  13. 1_25_854775184.dbf
  14. 1_26_854775184.dbf
  15. 1_27_854775184.dbf
  16. 1_28_854775184.dbf
  17. 1_29_854775184.dbf
  18. 1_30_854775184.dbf
  19. 1_31_854775184.dbf
  20. 1_32_854775184.dbf
  21. 1_33_854775184.dbf
  22. 1_34_854775184.dbf
  23. 1_35_854775184.dbf
  24. 1_36_854775184.dbf
  25. 1_37_854775184.dbf
  26. 1_38_854775184.dbf
  27. 1_39_854775184.dbf
--copy走,无法使用通配符是一件很痛苦的事情
  1. ASMCMD> cp 1_23_854775184.dbf /u02/backupset
  2. copying +Data/archive_log/1_23_854775184.dbf -> /u02/backupset/1_23_854775184.dbf
  3. ASMCMD> cp 1_24_854775184.dbf /u02/backupset
  4. copying +Data/archive_log/1_24_854775184.dbf -> /u02/backupset/1_24_854775184.dbf
  5. ASMCMD> cp 1_25_854775184.dbf /u02/backupset
  6. copying +Data/archive_log/1_25_854775184.dbf -> /u02/backupset/1_25_854775184.dbf
  7. ASMCMD> cp 1_26_854775184.dbf /u02/backupset
  8. copying +Data/archive_log/1_26_854775184.dbf -> /u02/backupset/1_26_854775184.dbf
  9. ASMCMD> cp 1_27_854775184.dbf /u02/backupset
  10. copying +Data/archive_log/1_27_854775184.dbf -> /u02/backupset/1_27_854775184.dbf
  11. ASMCMD> cp 1_28_854775184.dbf /u02/backupset
  12. copying +Data/archive_log/1_28_854775184.dbf -> /u02/backupset/1_28_854775184.dbf
  13. ASMCMD> cp 1_29_854775184.dbf /u02/backupset
  14. copying +Data/archive_log/1_29_854775184.dbf -> /u02/backupset/1_29_854775184.dbf
  15. ASMCMD> cp 1_3* /u02/backupset
  16. copying +Data/archive_log/1_30_854775184.dbf -> /u02/backupset/1_30_854775184.dbf
  17. ASMCMD> cp 1_31_854775184.dbf /u02/backupset
  18. copying +Data/archive_log/1_31_854775184.dbf -> /u02/backupset/1_31_854775184.dbf
  19. ASMCMD> cp 1_32_854775184.dbf /u02/backupset
  20. copying +Data/archive_log/1_32_854775184.dbf -> /u02/backupset/1_32_854775184.dbf
  21. ASMCMD> cp 1_33_854775184.dbf /u02/backupset
  22. copying +Data/archive_log/1_33_854775184.dbf -> /u02/backupset/1_33_854775184.dbf
  23. ASMCMD> cp 1_34_854775184.dbf /u02/backupset
  24. copying +Data/archive_log/1_34_854775184.dbf -> /u02/backupset/1_34_854775184.dbf
  25. ASMCMD> cp 1_35_854775184.dbf /u02/backupset
  26. copying +Data/archive_log/1_35_854775184.dbf -> /u02/backupset/1_35_854775184.dbf
  27. ASMCMD> cp 1_36_854775184.dbf /u02/backupset
  28. copying +Data/archive_log/1_36_854775184.dbf -> /u02/backupset/1_36_854775184.dbf
  29. ASMCMD> cp 1_37_854775184.dbf /u02/backupset
  30. copying +Data/archive_log/1_37_854775184.dbf -> /u02/backupset/1_37_854775184.dbf
  31. ASMCMD> cp 1_38_854775184.dbf /u02/backupset
  32. copying +Data/archive_log/1_38_854775184.dbf -> /u02/backupset/1_38_854775184.dbf
  33. ASMCMD> cp 1_39_854775184.dbf /u02/backupset
  34. copying +Data/archive_log/1_39_854775184.dbf -> /u02/backupset/1_39_854775184.dbf
  35. --查看当前的redo状态,记住当前redo的seq号
  36. SQL> select group#,SEQUENCE# ,MEMBERS,ARCHIVED,STATUS from v$log;
  37. GROUP# SEQUENCE# MEMBERS ARC STATUS
  38. ---------- ---------- ---------- --- ----------------
  39. 1 40 2 NO CURRENT
  40. 2 38 2 YES INACTIVE
  41. 3 39 2 YES INACTIVE

       --查看redo文件
  1. SQL> select GROUP#,STATUS,MEMBER from v$logfile;
  2. GROUP# STATUS MEMBER
  3. ---------- ------- --------------------------------------------------------------------------------
  4. 3 +DATA/min/onlinelog/group_3.266.854775193
  5. 3 +DATA/min/onlinelog/group_3.267.854775195
  6. 2 +DATA/min/onlinelog/group_2.264.854775189
  7. 2 +DATA/min/onlinelog/group_2.265.854775191
  8. 1 +DATA/min/onlinelog/group_1.262.854775185
  9. 1 +DATA/min/onlinelog/group_1.263.854775187
  10. --使用asmcmd拷贝并改名,这个时候我已经关闭了源库
  11. ASMCMD> cd onlinelog
  12. ASMCMD>
  13. ASMCMD> ls
  14. group_1.262.854775185
  15. group_1.263.854775187
  16. group_2.264.854775189
  17. group_2.265.854775191
  18. group_3.266.854775193
  19. group_3.267.854775195

  20. ASMCMD> cp group_1.262.854775185 /u02/backupset/redo1a.log
  21. copying +Data/min/onlinelog/group_1.262.854775185 -> /u02/backupset/redo1a.log
  22. ASMCMD> cp group_1.263.854775187 /u02/backupset/redo1b.log
  23. copying +Data/min/onlinelog/group_1.263.854775187 -> /u02/backupset/redo1b.log
  24. ASMCMD> cp group_2.264.854775189 /u02/backupset/redo2a.log
  25. copying +Data/min/onlinelog/group_2.264.854775189 -> /u02/backupset/redo2a.log
  26. ASMCMD> cp group_2.265.854775191 /u02/backupset/redo2b.log
  27. copying +Data/min/onlinelog/group_2.265.854775191 -> /u02/backupset/redo2b.log
  28. ASMCMD> cp group_3.266.854775193 /u02/backupset/redo3a.log
  29. copying +Data/min/onlinelog/group_3.266.854775193 -> /u02/backupset/redo3a.log
  30. ASMCMD> cp group_3.267.854775195 /u02/backupset/redo3b.log
  31. copying +Data/min/onlinelog/group_3.267.854775195 -> /u02/backupset/redo3b.log

3.  目标机器恢复
    这一步之前已经在目标主机安装好oracle软件,安装过程不再赘述,直接记录恢复过程
    这里直接从备份中恢复pfile(比较懒,不想手动准备),无参数文件,rman会启动一个傻瓜实例,供我们恢复参数文件

点击(此处)折叠或打开

  1. RMAN> startup nomount
  2. startup failed: ORA-01078: failure in processing system parameters
  3. LRM-00109: could not open parameter file '/home/oracle/app/oracle/product/11.2.0/dbhome_1/dbs/initmin.ora'
  4. starting Oracle instance without parameter file for retrieval of spfile
  5. Oracle instance started
  6. Total System Global Area 1068937216 bytes
  7. Fixed Size 2260088 bytes
  8. Variable Size 281019272 bytes
  9. Database Buffers 780140544 bytes
  10. Redo Buffers 5517312 bytes
  11. RMAN> restore spfile to pfile '/home/oracle/app/oracle/product/11.2.0/dbhome_1/dbs/initmin.ora' from '/u01/rmanbackup/ctl2.rman';
  12. Starting restore at 18-SEP-15
  13. using target database control file instead of recovery catalog
  14. allocated channel: ORA_DISK_1
  15. channel ORA_DISK_1: SID=171 device type=DISK
  16. channel ORA_DISK_1: restoring spfile from AUTOBACKUP /u01/rmanbackup/ctl2.rman
  17. channel ORA_DISK_1: SPFILE restore from AUTOBACKUP complete
  18. Finished restore at 18-SEP-15
  19. RMAN> shutdown abort
  20. Oracle instance shut down
  21. RMAN>

创建目录,修改参数文件

点击(此处)折叠或打开

  1. [oracle@rman_newhost u01]$ mkdir -p /u01/app/oracle/admin/min/adump
  2. [oracle@rman_newhost u01]$ mkdir -p /u01/app/oracle/fast_recovery_area
  3. [oracle@rman_newhost u01]$ mkdir -p /u01/app/oracle/archived_log
  4. [oracle@rman_newhost u01]$ mkdir -p /u01/app/oracle/oradata/min
  5. *.audit_file_dest='/u01/app/oracle/admin/min/adump'
  6. *.audit_trail='db'
  7. *.compatible='11.2.0.4.0'
  8. *.control_files='/u01/app/oracle/fast_recovery_area/control01.ctl','/u01/app/oracle/oradata/min/control02.ctl'
  9. *.db_block_size=8192
  10. *.db_domain=''
  11. *.db_name='min'
  12. *.db_recovery_file_dest='/u01/app/oracle/fast_recovery_area'
  13. *.db_recovery_file_dest_size=4385144832
  14. *.diagnostic_dest='/u01/app/oracle'
  15. *.dispatchers='(PROTOCOL=TCP) (SERVICE=minXDB)'
  16. *.log_archive_dest_1='location=/u01/app/oracle/archived_log'
  17. *.log_checkpoints_to_alert=TRUE
  18. *.memory_target=1394606080
  19. *.open_cursors=300
  20. *.processes=1500
  21. *.remote_login_passwordfile='EXCLUSIVE'
  22. *.sessions=1655
  23. *.undo_tablespace='UNDOTBS1'

启动到nomount状态,恢复控制文件

点击(此处)折叠或打开

  1. RMAN> startup nomount
  2. connected to target database (not started)
  3. Oracle instance started
  4. Total System Global Area 1402982400 bytes
  5. Fixed Size 2253184 bytes
  6. Variable Size 1275072128 bytes
  7. Database Buffers 117440512 bytes
  8. Redo Buffers 8216576 bytes
  9. RMAN> restore controlfile from '/u01/rmanbackup/ctl2.rman';
  10. Starting restore at 18-SEP-15
  11. allocated channel: ORA_DISK_1
  12. channel ORA_DISK_1: SID=1146 device type=DISK
  13. channel ORA_DISK_1: restoring control file
  14. channel ORA_DISK_1: restore complete, elapsed time: 00:00:01
  15. output file name=/u01/app/oracle/fast_recovery_area/control01.ctl
  16. output file name=/u01/app/oracle/oradata/min/control02.ctl
  17. Finished restore at 18-SEP-15
  18. RMAN> alter database mount;
  19. database mounted
  20. released channel: ORA_DISK_1


     将redo文件和归档日志移动到对应目录下

点击(此处)折叠或打开

  1. [oracle@rman_newhost rmanbackup]$ mv redo* /u01/app/oracle/oradata/min
  2. [oracle@rman_newhost rmanbackup]$ ll /u01/app/oracle/oradata/min
  3. 总用量 316744
  4. -rw-r-----. 1 oracle oinstall 9748480 9月 18 00:34 control02.ctl
  5. -rw-r--r--. 1 oracle oinstall 52429312 9月 17 23:00 redo1a.log
  6. -rw-r--r--. 1 oracle oinstall 52429312 9月 17 23:01 redo1b.log
  7. -rw-r--r--. 1 oracle oinstall 52429312 9月 17 23:01 redo2a.log
  8. -rw-r--r--. 1 oracle oinstall 52429312 9月 17 23:01 redo2b.log
  9. -rw-r--r--. 1 oracle oinstall 52429312 9月 17 23:02 redo3a.log
  10. -rw-r--r--. 1 oracle oinstall 52429312 9月 17 23:02 redo3b.log
  11. [oracle@rman_newhost rmanbackup]$ mv 1_* /u01/app/oracle/archived_log
  12. [oracle@rman_newhost rmanbackup]$ ll /u01/app/oracle/archived_log
  13. 总用量 809056
  14. -rw-r--r--. 1 oracle oinstall 46381568 9月 17 22:48 1_22_854775184.dbf
  15. -rw-r--r--. 1 oracle oinstall 39179776 9月 17 22:49 1_23_854775184.dbf
  16. -rw-r--r--. 1 oracle oinstall 46381568 9月 17 22:49 1_24_854775184.dbf
  17. -rw-r--r--. 1 oracle oinstall 46381568 9月 17 22:50 1_25_854775184.dbf
  18. -rw-r--r--. 1 oracle oinstall 46381568 9月 17 22:50 1_26_854775184.dbf
  19. -rw-r--r--. 1 oracle oinstall 48581120 9月 17 22:50 1_27_854775184.dbf
  20. -rw-r--r--. 1 oracle oinstall 46381568 9月 17 22:51 1_28_854775184.dbf
  21. -rw-r--r--. 1 oracle oinstall 42950144 9月 17 22:51 1_29_854775184.dbf
  22. -rw-r--r--. 1 oracle oinstall 46381568 9月 17 22:51 1_30_854775184.dbf
  23. -rw-r--r--. 1 oracle oinstall 50134016 9月 17 22:53 1_31_854775184.dbf
  24. -rw-r--r--. 1 oracle oinstall 46381568 9月 17 22:53 1_32_854775184.dbf
  25. -rw-r--r--. 1 oracle oinstall 46714368 9月 17 22:53 1_33_854775184.dbf
  26. -rw-r--r--. 1 oracle oinstall 44308480 9月 17 22:54 1_34_854775184.dbf
  27. -rw-r--r--. 1 oracle oinstall 46381568 9月 17 22:54 1_35_854775184.dbf
  28. -rw-r--r--. 1 oracle oinstall 46381568 9月 17 22:54 1_36_854775184.dbf
  29. -rw-r--r--. 1 oracle oinstall 46381568 9月 17 22:54 1_37_854775184.dbf
  30. -rw-r--r--. 1 oracle oinstall 46381568 9月 17 22:55 1_38_854775184.dbf
  31. -rw-r--r--. 1 oracle oinstall 46381568 9月 17 22:55 1_39_854775184.dbf

下面一步的操作是删掉控制文件中对备份的记录信息,因为这是源库备份恢复过来的,我们要删掉老的备份信息,将备份重新注册,不删也没关系,crosscheck以后你会发现,原来的备份状态都是expired的

点击(此处)折叠或打开

  1. RMAN> list backup summary;


  2. List of Backups
  3. ===============
  4. Key TY LV S Device Type Completion Time #Pieces #Copies Compressed Tag
  5. ------- -- -- - ----------- --------------- ------- ------- ---------- ---
  6. 9 B 0 A DISK 17-SEP-15 1 1 NO DB_RMAN
  7. 10 B 0 A DISK 17-SEP-15 1 1 NO DB_RMAN
  8. 11 B F A DISK 17-SEP-15 1 1 NO TAG20150917T221650
  9. 12 B A A DISK 17-SEP-15 1 1 NO ARC_RMAN
  10. 13 B A A DISK 17-SEP-15 1 1 NO ARC_RMAN

  11. RMAN> crosscheck backup;

  12. Starting implicit crosscheck backup at 18-SEP-15
  13. allocated channel: ORA_DISK_1
  14. channel ORA_DISK_1: SID=1146 device type=DISK
  15. allocated channel: ORA_DISK_2
  16. channel ORA_DISK_2: SID=10 device type=DISK
  17. allocated channel: ORA_DISK_3
  18. channel ORA_DISK_3: SID=1147 device type=DISK
  19. allocated channel: ORA_DISK_4
  20. channel ORA_DISK_4: SID=11 device type=DISK
  21. Crosschecked 5 objects
  22. Finished implicit crosscheck backup at 18-SEP-15

  23. Starting implicit crosscheck copy at 18-SEP-15
  24. using channel ORA_DISK_1
  25. using channel ORA_DISK_2
  26. using channel ORA_DISK_3
  27. using channel ORA_DISK_4
  28. Finished implicit crosscheck copy at 18-SEP-15

  29. searching for all files in the recovery area
  30. cataloging files...
  31. no files cataloged

  32. using channel ORA_DISK_1
  33. using channel ORA_DISK_2
  34. using channel ORA_DISK_3
  35. using channel ORA_DISK_4
  36. crosschecked backup piece: found to be 'EXPIRED'
  37. backup piece handle=+DATA/backup/db_0aqhdno6_1_1 RECID=9 STAMP=890691334
  38. crosschecked backup piece: found to be 'EXPIRED'
  39. backup piece handle=+DATA/backup/db_09qhdno6_1_1 RECID=10 STAMP=890691334
  40. crosschecked backup piece: found to be 'EXPIRED'
  41. backup piece handle=+DATA/backup/ctl_atuo_c-2496627597-20150917-00 RECID=11 STAMP=890691411
  42. crosschecked backup piece: found to be 'EXPIRED'
  43. backup piece handle=+DATA/backup/arc_0dqhdnqq_1_1 RECID=12 STAMP=890691418
  44. crosschecked backup piece: found to be 'EXPIRED'
  45. backup piece handle=+DATA/backup/arc_0cqhdnqq_1_1 RECID=13 STAMP=890691418
  46. Crosschecked 5 objects


  47. RMAN> list backup;


  48. List of Backup Sets
  49. ===================


  50. BS Key Type LV Size Device Type Elapsed Time Completion Time
  51. ------- ---- -- ---------- ----------- ------------ ---------------
  52. 9 Incr 0 433.65M DISK 00:01:10 17-SEP-15 
  53.         BP Key: 9 Status: EXPIRED Compressed: NO Tag: DB_RMAN
  54.         Piece Name: +DATA/backup/db_0aqhdno6_1_1
  55.   List of Datafiles in backup set 9
  56.   File LV Type Ckp SCN Ckp Time Name
  57.   ---- -- ---- ---------- --------- ----
  58.   2 0 Incr 1138043 17-SEP-15 +DATA/min/datafile/sysaux.257.854775097
  59.   3 0 Incr 1138043 17-SEP-15 +DATA/min/datafile/undotbs1.258.854775097

  60. BS Key Type LV Size Device Type Elapsed Time Completion Time
  61. ------- ---- -- ---------- ----------- ------------ ---------------
  62. 10 Incr 0 638.84M DISK 00:01:10 17-SEP-15 
  63.         BP Key: 10 Status: EXPIRED Compressed: NO Tag: DB_RMAN
  64.         Piece Name: +DATA/backup/db_09qhdno6_1_1
  65.   List of Datafiles in backup set 10
  66.   File LV Type Ckp SCN Ckp Time Name
  67.   ---- -- ---- ---------- --------- ----
  68.   1 0 Incr 1138042 17-SEP-15 +DATA/min/datafile/system.256.854775095
  69.   4 0 Incr 1138042 17-SEP-15 +DATA/min/datafile/users.259.854775097

  70. BS Key Type LV Size Device Type Elapsed Time Completion Time
  71. ------- ---- -- ---------- ----------- ------------ ---------------
  72. 11 Full 9.36M DISK 00:00:01 17-SEP-15 
  73.         BP Key: 11 Status: EXPIRED Compressed: NO Tag: TAG20150917T221650
  74.         Piece Name: +DATA/backup/ctl_atuo_c-2496627597-20150917-00
  75.   SPFILE Included: Modification time: 17-SEP-15
  76.   SPFILE db_unique_name: MIN
  77.   Control File Included: Ckp SCN: 1138347 Ckp time: 17-SEP-15

  78. BS Key Size Device Type Elapsed Time Completion Time
  79. ------- ---------- ----------- ------------ ---------------
  80. 12 2.00K DISK 00:00:00 17-SEP-15 
  81.         BP Key: 12 Status: EXPIRED Compressed: NO Tag: ARC_RMAN
  82.         Piece Name: +DATA/backup/arc_0dqhdnqq_1_1

  83.   List of Archived Logs in backup set 12
  84.   Thrd Seq Low SCN Low Time Next SCN Next Time
  85.   ---- ------- ---------- --------- ---------- ---------
  86.   1 21 1138364 17-SEP-15 1138372 17-SEP-15

  87. BS Key Size Device Type Elapsed Time Completion Time
  88. ------- ---------- ----------- ------------ ---------------
  89. 13 30.99M DISK 00:00:02 17-SEP-15 
  90.         BP Key: 13 Status: EXPIRED Compressed: NO Tag: ARC_RMAN
  91.         Piece Name: +DATA/backup/arc_0cqhdnqq_1_1

  92.   List of Archived Logs in backup set 13
  93.   Thrd Seq Low SCN Low Time Next SCN Next Time
  94.   ---- ------- ---------- --------- ---------- ---------
  95.   1 20 1127220 17-SEP-15 1138364 17-SEP-15

  96. RMAN> list archivelog all;

  97. specification does not match any archived log in the repository


  98. RMAN> report obsolete;

  99. RMAN retention policy will be applied to the command
  100. RMAN retention policy is set to recovery window of 7 days
  101. no obsolete backups found

  102. RMAN> list expired backup;


  103. List of Backup Sets
  104. ===================


  105. BS Key Type LV Size Device Type Elapsed Time Completion Time
  106. ------- ---- -- ---------- ----------- ------------ ---------------
  107. 9 Incr 0 433.65M DISK 00:01:10 17-SEP-15 
  108.         BP Key: 9 Status: EXPIRED Compressed: NO Tag: DB_RMAN
  109.         Piece Name: +DATA/backup/db_0aqhdno6_1_1
  110.   List of Datafiles in backup set 9
  111.   File LV Type Ckp SCN Ckp Time Name
  112.   ---- -- ---- ---------- --------- ----
  113.   2 0 Incr 1138043 17-SEP-15 +DATA/min/datafile/sysaux.257.854775097
  114.   3 0 Incr 1138043 17-SEP-15 +DATA/min/datafile/undotbs1.258.854775097

  115. BS Key Type LV Size Device Type Elapsed Time Completion Time
  116. ------- ---- -- ---------- ----------- ------------ ---------------
  117. 10 Incr 0 638.84M DISK 00:01:10 17-SEP-15 
  118.         BP Key: 10 Status: EXPIRED Compressed: NO Tag: DB_RMAN
  119.         Piece Name: +DATA/backup/db_09qhdno6_1_1
  120.   List of Datafiles in backup set 10
  121.   File LV Type Ckp SCN Ckp Time Name
  122.   ---- -- ---- ---------- --------- ----
  123.   1 0 Incr 1138042 17-SEP-15 +DATA/min/datafile/system.256.854775095
  124.   4 0 Incr 1138042 17-SEP-15 +DATA/min/datafile/users.259.854775097

  125. BS Key Type LV Size Device Type Elapsed Time Completion Time
  126. ------- ---- -- ---------- ----------- ------------ ---------------
  127. 11 Full 9.36M DISK 00:00:01 17-SEP-15 
  128.         BP Key: 11 Status: EXPIRED Compressed: NO Tag: TAG20150917T221650
  129.         Piece Name: +DATA/backup/ctl_atuo_c-2496627597-20150917-00
  130.   SPFILE Included: Modification time: 17-SEP-15
  131.   SPFILE db_unique_name: MIN
  132.   Control File Included: Ckp SCN: 1138347 Ckp time: 17-SEP-15

  133. BS Key Size Device Type Elapsed Time Completion Time
  134. ------- ---------- ----------- ------------ ---------------
  135. 12 2.00K DISK 00:00:00 17-SEP-15 
  136.         BP Key: 12 Status: EXPIRED Compressed: NO Tag: ARC_RMAN
  137.         Piece Name: +DATA/backup/arc_0dqhdnqq_1_1

  138.   List of Archived Logs in backup set 12
  139.   Thrd Seq Low SCN Low Time Next SCN Next Time
  140.   ---- ------- ---------- --------- ---------- ---------
  141.   1 21 1138364 17-SEP-15 1138372 17-SEP-15

  142. BS Key Size Device Type Elapsed Time Completion Time
  143. ------- ---------- ----------- ------------ ---------------
  144. 13 30.99M DISK 00:00:02 17-SEP-15 
  145.         BP Key: 13 Status: EXPIRED Compressed: NO Tag: ARC_RMAN
  146.         Piece Name: +DATA/backup/arc_0cqhdnqq_1_1

  147.   List of Archived Logs in backup set 13
  148.   Thrd Seq Low SCN Low Time Next SCN Next Time
  149.   ---- ------- ---------- --------- ---------- ---------
  150.   1 20 1127220 17-SEP-15 1138364 17-SEP-15

  151. RMAN> delete noprompt expired backup;

  152. using channel ORA_DISK_1
  153. using channel ORA_DISK_2
  154. using channel ORA_DISK_3
  155. using channel ORA_DISK_4

  156. List of Backup Pieces
  157. BP Key BS Key Pc# Cp# Status Device Type Piece Name
  158. ------- ------- --- --- ----------- ----------- ----------
  159. 9 9 1 1 EXPIRED DISK +DATA/backup/db_0aqhdno6_1_1
  160. 10 10 1 1 EXPIRED DISK +DATA/backup/db_09qhdno6_1_1
  161. 11 11 1 1 EXPIRED DISK +DATA/backup/ctl_atuo_c-2496627597-20150917-00
  162. 12 12 1 1 EXPIRED DISK +DATA/backup/arc_0dqhdnqq_1_1
  163. 13 13 1 1 EXPIRED DISK +DATA/backup/arc_0cqhdnqq_1_1
  164. deleted backup piece
  165. backup piece handle=+DATA/backup/db_0aqhdno6_1_1 RECID=9 STAMP=890691334
  166. deleted backup piece
  167. backup piece handle=+DATA/backup/db_09qhdno6_1_1 RECID=10 STAMP=890691334
  168. deleted backup piece
  169. backup piece handle=+DATA/backup/ctl_atuo_c-2496627597-20150917-00 RECID=11 STAMP=890691411
  170. deleted backup piece
  171. backup piece handle=+DATA/backup/arc_0dqhdnqq_1_1 RECID=12 STAMP=890691418
  172. deleted backup piece
  173. backup piece handle=+DATA/backup/arc_0cqhdnqq_1_1 RECID=13 STAMP=890691418
  174. Deleted 5 EXPIRED objects


  175. RMAN> list backup;

  176. specification does not match any backup in the repository


重新注册备份,并观察控制文件中的备份信息,和数据库结构的信息

点击(此处)折叠或打开

  1. RMAN> catalog start with '/u01/rmanbackup';

  2. searching for all files that match the pattern /u01/rmanbackup

  3. List of Files Unknown to the Database
  4. =====================================
  5. File Name: /u01/rmanbackup/arc1.rman
  6. File Name: /u01/rmanbackup/db1.rman
  7. File Name: /u01/rmanbackup/ctl2.rman
  8. File Name: /u01/rmanbackup/ctl1.rman
  9. File Name: /u01/rmanbackup/db2.rman
  10. File Name: /u01/rmanbackup/arc2.rman

  11. Do you really want to catalog the above files (enter YES or NO)? yes
  12. cataloging files...
  13. cataloging done

  14. List of Cataloged Files
  15. =======================
  16. File Name: /u01/rmanbackup/arc1.rman
  17. File Name: /u01/rmanbackup/db1.rman
  18. File Name: /u01/rmanbackup/ctl2.rman
  19. File Name: /u01/rmanbackup/ctl1.rman
  20. File Name: /u01/rmanbackup/db2.rman
  21. File Name: /u01/rmanbackup/arc2.rman

  22. RMAN> list backup summary;


  23. List of Backups
  24. ===============
  25. Key TY LV S Device Type Completion Time #Pieces #Copies Compressed Tag
  26. ------- -- -- - ----------- --------------- ------- ------- ---------- ---
  27. 14 B A A DISK 17-SEP-15 1 1 NO ARC_RMAN
  28. 15 B 0 A DISK 17-SEP-15 1 1 NO DB_RMAN
  29. 16 B 0 A DISK 17-SEP-15 1 1 NO DB_RMAN
  30. 17 B A A DISK 17-SEP-15 1 1 NO ARC_RMAN

--数据文件、临时文件的记录还是源库的信息,一会儿恢复的时候要setnewname

  1. RMAN> report schema;

  2. RMAN-06139: WARNING: control file is not current for REPORT SCHEMA
  3. Report of database schema for database with db_unique_name MIN

  4. List of Permanent Datafiles
  5. ===========================
  6. File Size(MB) Tablespace RB segs Datafile Name
  7. ---- -------- -------------------- ------- ------------------------
  8. 1 0 SYSTEM *** +DATA/min/datafile/system.256.854775095
  9. 2 0 SYSAUX *** +DATA/min/datafile/sysaux.257.854775097
  10. 3 0 UNDOTBS1 *** +DATA/min/datafile/undotbs1.258.854775097
  11. 4 0 USERS *** +DATA/min/datafile/users.259.854775097

  12. List of Temporary Files
  13. =======================
  14. File Size(MB) Tablespace Maxsize(MB) Tempfile Name
  15. ---- -------- -------------------- ----------- --------------------
  16. 1 20 TEMP 32767 +DATA/min/tempfile/temp.268.854775211



--你会发现这是老的控制文件,是我们0级备份里的,其中关于redo的状态记录,当前redo还停留在序列号22


  1. SQL> select GROUP#,SEQUENCE# ,STATUS,ARCHIVED from v$log;

  2.     GROUP# SEQUENCE# STATUS ARC
  3. ---------- ---------- ---------------- ---
  4.          1 22 CURRENT NO
  5.          3 21 ACTIVE YES
  6.          2 20 ACTIVE YES

  7. SQL> desc v$logfile;
  8.  Name Null? Type
  9.  ----------------------------------------- -------- ----------------------------
  10.  GROUP# NUMBER
  11.  STATUS VARCHAR2(7)
  12.  TYPE VARCHAR2(7)
  13.  MEMBER VARCHAR2(513)
  14.  IS_RECOVERY_DEST_FILE VARCHAR2(3)

--redo的记录还是源库的信息,一会儿恢复的时候要setnewname

  1. SQL> col member for a80
  2. SQL> set line 200
  3. SQL> select GROUP#,STATUS,MEMBER from v$logfile;

  4.     GROUP# STATUS MEMBER
  5. ---------- ------- --------------------------------------------------------------------------------
  6.          3 +DATA/min/onlinelog/group_3.266.854775193
  7.          3 +DATA/min/onlinelog/group_3.267.854775195
  8.          2 +DATA/min/onlinelog/group_2.264.854775189
  9.          2 +DATA/min/onlinelog/group_2.265.854775191
  10.          1 +DATA/min/onlinelog/group_1.262.854775185
  11.          1 +DATA/min/onlinelog/group_1.263.854775187

  12. 6 rows selected.


     还原数据库

点击(此处)折叠或打开

  1. RMAN> RUN
  2. 2> {
  3. 3> ALLOCATE CHANNEL c1 DEVICE TYPE DISK;
  4. 4> ALLOCATE CHANNEL c2 DEVICE TYPE DISK;
  5. 5> set archivelog destination to "/u01/app/oracle/archived_log";
  6. 6> set newname for datafile 1 to "/u01/app/oracle/oradata/min/system01.dbf";
  7. 7> set newname for datafile 2 to "/u01/app/oracle/oradata/min/sysaux01.dbf";
  8. 8> set newname for datafile 3 to "/u01/app/oracle/oradata/min/undotbs01.dbf";
  9. 9> set newname for datafile 4 to "/u01/app/oracle/oradata/min/users01.dbf";
  10. 10> set newname for tempfile 1 to "/u01/app/oracle/oradata/min/temp01.dbf";
  11. 11> SQL "ALTER DATABASE RENAME FILE ''+DATA/min/onlinelog/group_1.262.854775185'' to ''/u01/app/oracle/oradata/min/redo1a.log'' ";
  12. 12> SQL "ALTER DATABASE RENAME FILE ''+DATA/min/onlinelog/group_1.263.854775187'' to ''/u01/app/oracle/oradata/min/redo1b.log'' ";
  13. 13> SQL "ALTER DATABASE RENAME FILE ''+DATA/min/onlinelog/group_2.264.854775189'' to ''/u01/app/oracle/oradata/min/redo2a.log'' ";
  14. 14> SQL "ALTER DATABASE RENAME FILE ''+DATA/min/onlinelog/group_2.265.854775191'' to ''/u01/app/oracle/oradata/min/redo2b.log'' ";
  15. 15> SQL "ALTER DATABASE RENAME FILE ''+DATA/min/onlinelog/group_3.266.854775193'' to ''/u01/app/oracle/oradata/min/redo3a.log'' ";
  16. 16> SQL "ALTER DATABASE RENAME FILE ''+DATA/min/onlinelog/group_3.267.854775195'' to ''/u01/app/oracle/oradata/min/redo3b.log'' ";
  17. 17> RESTORE DATABASE;
  18. 18> SWITCH DATAFILE ALL;
  19. 19> switch tempfile all;
  20. 20> }
  21. released channel: ORA_DISK_1
  22. released channel: ORA_DISK_2
  23. released channel: ORA_DISK_3
  24. released channel: ORA_DISK_4
  25. allocated channel: c1
  26. channel c1: SID=1146 device type=DISK
  27. allocated channel: c2
  28. channel c2: SID=11 device type=DISK
  29. executing command: SET ARCHIVELOG DESTINATION
  30. executing command: SET NEWNAME
  31. executing command: SET NEWNAME
  32. executing command: SET NEWNAME
  33. executing command: SET NEWNAME
  34. executing command: SET NEWNAME
  35. sql statement: ALTER DATABASE RENAME FILE ''+DATA/min/onlinelog/group_1.262.854775185'' to ''/u01/app/oracle/oradata/min/redo1a.log''
  36. sql statement: ALTER DATABASE RENAME FILE ''+DATA/min/onlinelog/group_1.263.854775187'' to ''/u01/app/oracle/oradata/min/redo1b.log''
  37. sql statement: ALTER DATABASE RENAME FILE ''+DATA/min/onlinelog/group_2.264.854775189'' to ''/u01/app/oracle/oradata/min/redo2a.log''
  38. sql statement: ALTER DATABASE RENAME FILE ''+DATA/min/onlinelog/group_2.265.854775191'' to ''/u01/app/oracle/oradata/min/redo2b.log''
  39. sql statement: ALTER DATABASE RENAME FILE ''+DATA/min/onlinelog/group_3.266.854775193'' to ''/u01/app/oracle/oradata/min/redo3a.log''
  40. sql statement: ALTER DATABASE RENAME FILE ''+DATA/min/onlinelog/group_3.267.854775195'' to ''/u01/app/oracle/oradata/min/redo3b.log''
  41. Starting restore at 18-SEP-15
  42. skipping datafile 2; already restored to file /u01/app/oracle/oradata/min/sysaux01.dbf
  43. channel c1: starting datafile backup set restore
  44. channel c1: specifying datafile(s) to restore from backup set
  45. channel c1: restoring datafile 00001 to /u01/app/oracle/oradata/min/system01.dbf
  46. channel c1: restoring datafile 00004 to /u01/app/oracle/oradata/min/users01.dbf
  47. channel c1: reading from backup piece /u01/rmanbackup/db2.rman
  48. channel c2: starting datafile backup set restore
  49. channel c2: specifying datafile(s) to restore from backup set
  50. channel c2: restoring datafile 00003 to /u01/app/oracle/oradata/min/undotbs01.dbf
  51. channel c2: reading from backup piece /u01/rmanbackup/db1.rman
  52. channel c2: piece handle=/u01/rmanbackup/db1.rman tag=DB_RMAN
  53. channel c2: restored backup piece 1
  54. channel c2: restore complete, elapsed time: 00:00:08
  55. channel c1: piece handle=/u01/rmanbackup/db2.rman tag=DB_RMAN
  56. channel c1: restored backup piece 1
  57. channel c1: restore complete, elapsed time: 00:00:36
  58. Finished restore at 18-SEP-15
  59. datafile 1 switched to datafile copy
  60. input datafile copy RECID=5 STAMP=890701322 file name=/u01/app/oracle/oradata/min/system01.dbf
  61. datafile 2 switched to datafile copy
  62. input datafile copy RECID=6 STAMP=890701322 file name=/u01/app/oracle/oradata/min/sysaux01.dbf
  63. datafile 3 switched to datafile copy
  64. input datafile copy RECID=7 STAMP=890701322 file name=/u01/app/oracle/oradata/min/undotbs01.dbf
  65. datafile 4 switched to datafile copy
  66. input datafile copy RECID=8 STAMP=890701322 file name=/u01/app/oracle/oradata/min/users01.dbf
  67. renamed tempfile 1 to /u01/app/oracle/oradata/min/temp01.dbf in control file
  68. released channel: c1
  69. released channel: c2


    restore完毕,我们再来看一下控制文件中的信息

点击(此处)折叠或打开

  1. RMAN> report schema;
  2. RMAN-06139: WARNING: control file is not current for REPORT SCHEMA
  3. Report of database schema for database with db_unique_name MIN
  4. List of Permanent Datafiles
  5. ===========================
  6. File Size(MB) Tablespace RB segs Datafile Name
  7. ---- -------- -------------------- ------- ------------------------
  8. 1 750 SYSTEM *** /u01/app/oracle/oradata/min/system01.dbf
  9. 2 560 SYSAUX *** /u01/app/oracle/oradata/min/sysaux01.dbf
  10. 3 100 UNDOTBS1 *** /u01/app/oracle/oradata/min/undotbs01.dbf
  11. 4 5 USERS *** /u01/app/oracle/oradata/min/users01.dbf
  12. List of Temporary Files
  13. =======================
  14. File Size(MB) Tablespace Maxsize(MB) Tempfile Name
  15. ---- -------- -------------------- ----------- --------------------
  16. 1 20 TEMP 32767 /u01/app/oracle/oradata/min/temp01.dbf


    完全恢复数据库

点击(此处)折叠或打开

  1. RMAN> recover database;
  2. Starting recover at 18-SEP-15
  3. allocated channel: ORA_DISK_1
  4. channel ORA_DISK_1: SID=1146 device type=DISK
  5. allocated channel: ORA_DISK_2
  6. channel ORA_DISK_2: SID=11 device type=DISK
  7. allocated channel: ORA_DISK_3
  8. channel ORA_DISK_3: SID=1137 device type=DISK
  9. allocated channel: ORA_DISK_4
  10. channel ORA_DISK_4: SID=10 device type=DISK
  11. starting media recovery
  12. archived log for thread 1 with sequence 38 is already on disk as file /u01/app/oracle/oradata/min/redo2a.log
  13. archived log for thread 1 with sequence 39 is already on disk as file /u01/app/oracle/oradata/min/redo3a.log
  14. archived log for thread 1 with sequence 40 is already on disk as file /u01/app/oracle/oradata/min/redo1a.log
  15. channel ORA_DISK_1: starting archived log restore to default destination
  16. channel ORA_DISK_1: restoring archived log
  17. archived log thread=1 sequence=20
  18. channel ORA_DISK_1: reading from backup piece /u01/rmanbackup/arc2.rman
  19. channel ORA_DISK_2: starting archived log restore to default destination
  20. channel ORA_DISK_2: restoring archived log
  21. archived log thread=1 sequence=21
  22. channel ORA_DISK_2: reading from backup piece /u01/rmanbackup/arc1.rman
  23. channel ORA_DISK_2: piece handle=/u01/rmanbackup/arc1.rman tag=ARC_RMAN
  24. channel ORA_DISK_2: restored backup piece 1
  25. channel ORA_DISK_2: restore complete, elapsed time: 00:00:01
  26. channel ORA_DISK_1: piece handle=/u01/rmanbackup/arc2.rman tag=ARC_RMAN
  27. channel ORA_DISK_1: restored backup piece 1
  28. channel ORA_DISK_1: restore complete, elapsed time: 00:00:03
  29. archived log file name=/u01/app/oracle/archived_log/1_20_854775184.dbf thread=1 sequence=20
  30. archived log file name=/u01/app/oracle/archived_log/1_21_854775184.dbf thread=1 sequence=21
  31. archived log file name=/u01/app/oracle/archived_log/1_22_854775184.dbf thread=1 sequence=22
  32. archived log file name=/u01/app/oracle/archived_log/1_23_854775184.dbf thread=1 sequence=23
  33. archived log file name=/u01/app/oracle/archived_log/1_24_854775184.dbf thread=1 sequence=24
  34. archived log file name=/u01/app/oracle/archived_log/1_25_854775184.dbf thread=1 sequence=25
  35. archived log file name=/u01/app/oracle/archived_log/1_26_854775184.dbf thread=1 sequence=26
  36. archived log file name=/u01/app/oracle/archived_log/1_27_854775184.dbf thread=1 sequence=27
  37. archived log file name=/u01/app/oracle/archived_log/1_28_854775184.dbf thread=1 sequence=28
  38. archived log file name=/u01/app/oracle/archived_log/1_29_854775184.dbf thread=1 sequence=29
  39. archived log file name=/u01/app/oracle/archived_log/1_30_854775184.dbf thread=1 sequence=30
  40. archived log file name=/u01/app/oracle/archived_log/1_31_854775184.dbf thread=1 sequence=31
  41. archived log file name=/u01/app/oracle/archived_log/1_32_854775184.dbf thread=1 sequence=32
  42. archived log file name=/u01/app/oracle/archived_log/1_33_854775184.dbf thread=1 sequence=33
  43. archived log file name=/u01/app/oracle/archived_log/1_34_854775184.dbf thread=1 sequence=34
  44. archived log file name=/u01/app/oracle/archived_log/1_35_854775184.dbf thread=1 sequence=35
  45. archived log file name=/u01/app/oracle/archived_log/1_36_854775184.dbf thread=1 sequence=36
  46. archived log file name=/u01/app/oracle/archived_log/1_37_854775184.dbf thread=1 sequence=37
  47. archived log file name=/u01/app/oracle/oradata/min/redo2a.log thread=1 sequence=38
  48. archived log file name=/u01/app/oracle/oradata/min/redo3a.log thread=1 sequence=39
  49. archived log file name=/u01/app/oracle/oradata/min/redo1a.log thread=1 sequence=40
  50. media recovery complete, elapsed time: 00:00:43
  51. Finished recover at 18-SEP-15

    从恢复的日志可以看出,oracle会绕过38、39号的归档直接利用在线日志做恢复,oracle的聪明之处可见一斑!
    试着正常方式打开数据库,会发现报错:

点击(此处)折叠或打开

  1. RMAN> alter database open;
  2. RMAN-00571: ===========================================================
  3. RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ===============
  4. RMAN-00571: ===========================================================
  5. RMAN-03002: failure of alter db command at 09/18/2015 01:04:41
  6. ORA-01589: must use RESETLOGS or NORESETLOGS option for database open

      --看一下此时控制文件中的日志序列号,会发现没有前推,必须用resetlogs打开数据库

      SQL>  select group#,status,sequence# from v$log;


      GROUP# STATUS            SEQUENCE#
    ---------- ---------------- ----------
         1 CURRENT                  22
         3 ACTIVE                   21
         2 ACTIVE                   20

  1. RMAN> alter database open resetlogs;
  2. database opened


    使用resetlog的原因是recover命令只能修复控制文件中数据物理结构信息,而无法修改控制文件中的当前重做日志的序列号的信息,recover命令结束后,控制文件中的当前日志序列号还是陈旧的,若按常规方式打开数据库,将报错,为了抹去控制文件这个固执的念头,oracle采用重设日志的功能,日志序列号从1开始。此处虽然使用了resetlogs,但是因为“recover database”命令执行成功,所有提交的事务不会丢失,resetlogs仅仅是为了照顾还原的控制文件,与不完全恢复的resetlogs是不同的,至此恢复结束。

点击(此处)折叠或打开

  1. SQL> conn test/test
  2. Connected.
  3. SQL> select count(1) from t;
  4. COUNT(1)
  5. ----------
  6. 3000000

来自 “ ITPUB博客 ” ,链接:http://blog.itpub.net/26838672/viewspace-1807094/,如需转载,请注明出处,否则将追究法律责任。

上一篇: 没有了~
请登录后发表评论 登录
全部评论

注册时间:2014-05-17

  • 博文量
    29
  • 访问量
    104467