Oracle数据库数据恢复、性能优化

找回密码
注册
搜索
热搜: 活动 交友 discuz
发新帖

8

积分

0

好友

0

主题
1#
发表于 2011-12-12 16:01:11 | 查看: 7850| 回复: 7
做了跨越resetlogs的试验http://www.xifenfei.com/2129.html
其中发现一个问题:
  1. RMAN> recover database;

  2. Starting recover at 2011-12-12 13:49:36
  3. using channel ORA_DISK_1

  4. starting media recovery

  5. archived log for thread 1 with sequence 1 is already on disk as file /opt/oracle/fast_recovery_area/ORA11G/archivelog/2011_12_12/o1_mf_1_1_7gc3ojqw_.arc
  6. archived log for thread 1 with sequence 2 is already on disk as file /opt/oracle/fast_recovery_area/ORA11G/archivelog/2011_12_12/o1_mf_1_2_7gc3okx8_.arc
  7. archived log for thread 1 with sequence 3 is already on disk as file /opt/oracle/fast_recovery_area/ORA11G/archivelog/2011_12_12/o1_mf_1_3_7gc3onnq_.arc
  8. archived log for thread 1 with sequence 4 is already on disk as file /opt/oracle/fast_recovery_area/ORA11G/archivelog/2011_12_12/o1_mf_1_4_7gc3wnvf_.arc
  9. archived log for thread 1 with sequence 5 is already on disk as file /opt/oracle/fast_recovery_area/ORA11G/archivelog/2011_12_12/o1_mf_1_5_7gc3wt48_.arc
  10. archived log file name=/opt/oracle/fast_recovery_area/ORA11G/archivelog/2011_12_12/o1_mf_1_1_7gc3ojqw_.arc thread=1 sequence=1
  11. archived log file name=/opt/oracle/fast_recovery_area/ORA11G/archivelog/2011_12_12/o1_mf_1_2_7gc3okx8_.arc thread=1 sequence=2
  12. archived log file name=/opt/oracle/fast_recovery_area/ORA11G/archivelog/2011_12_12/o1_mf_1_3_7gc3onnq_.arc thread=1 sequence=3
  13. archived log file name=/opt/oracle/fast_recovery_area/ORA11G/archivelog/2011_12_12/o1_mf_1_4_7gc3wnvf_.arc thread=1 sequence=4
  14. archived log file name=/opt/oracle/fast_recovery_area/ORA11G/archivelog/2011_12_12/o1_mf_1_5_7gc3wt48_.arc thread=1 sequence=5
  15. unable to find archived log
  16. archived log thread=1 sequence=6
  17. RMAN-00571: ===========================================================
  18. RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ===============
  19. RMAN-00571: ===========================================================
  20. RMAN-03002: failure of recover command at 12/12/2011 13:49:39
  21. RMAN-06054: media recovery requesting unknown archived log for thread 1 with sequence 6 and starting SCN of 12882851
复制代码


通过这里看出来
sequence=5的归档日志已经应用

然后resetlogs打开数据库
  1. RMAN> alter database open resetlogs;

  2. RMAN-00571: ===========================================================
  3. RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ===============
  4. RMAN-00571: ===========================================================
  5. RMAN-03002: failure of alter db command at 12/12/2011 14:06:04
  6. ORA-01092: ORACLE instance terminated. Disconnection forced
  7. ORA-00600: internal error code, arguments: [2898], [5], [12], [], [], [], [], [], [], [], [], []
  8. Process ID: 26406
  9. Session ID: 96 Serial number: 7
  10. RMAN-00571: ===========================================================
  11. RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ===============
  12. RMAN-00571: ===========================================================
  13. ORA-03114: not connected to ORACLE
  14. RMAN-00571: ===========================================================
  15. RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ===============
  16. RMAN-00571: ===========================================================
  17. RMAN-03002: failure of alter db command at 12/12/2011 14:06:04
  18. ORA-01092: ORACLE instance terminated. Disconnection forced
  19. ORA-00600: internal error code, arguments: [2898], [5], [12], [], [], [], [], [], [], [], [], []
  20. Process ID: 26406
  21. Session ID: 96 Serial number: 7
复制代码


查看日志文件
  1. Mon Dec 12 14:05:59 2011
  2. SMON: enabling cache recovery
  3. [26406] Successfully onlined Undo Tablespace 2.
  4. Undo initialization finished serial:0 start:1208679594 end:1208679684 diff:90 (0 seconds)
  5. Dictionary check beginning
  6. File #5 is offline, but is part of an online tablespace.
  7. data file 5: '/opt/oracle/oradata/ora11g/example01.dbf'
  8. Errors in file /opt/oracle/diag/rdbms/ora11g/ora11g/trace/ora11g_ora_26406.trc  (incident=4953):
  9. ORA-00600: internal error code, arguments: [2898], [5], [12], [], [], [], [], [], [], [], [], []
  10. Incident details in: /opt/oracle/diag/rdbms/ora11g/ora11g/incident/incdir_4953/ora11g_ora_26406_i4953.trc
  11. Mon Dec 12 14:06:02 2011
  12. Dumping diagnostic data in directory=[cdmp_20111212140602], requested by (instance=1, osid=26406), summary=[incident=4953].
  13. Use ADRCI or Support Workbench to package the incident.
  14. See Note 411.1 at My Oracle Support for error and packaging details.
  15. Errors in file /opt/oracle/diag/rdbms/ora11g/ora11g/trace/ora11g_ora_26406.trc:
  16. ORA-00600: internal error code, arguments: [2898], [5], [12], [], [], [], [], [], [], [], [], []
  17. Errors in file /opt/oracle/diag/rdbms/ora11g/ora11g/trace/ora11g_ora_26406.trc:
  18. ORA-00600: internal error code, arguments: [2898], [5], [12], [], [], [], [], [], [], [], [], []
  19. Error 600 happened during db open, shutting down database
  20. USER (ospid: 26406): terminating the instance due to error 600
  21. Mon Dec 12 14:06:03 2011
  22. Instance terminated by USER, pid = 26406
  23. ORA-1092 signalled during: alter database open resetlogs...
  24. opiodr aborting process unknown ospid (26406) as a result of ORA-1092
  25. Mon Dec 12 14:06:04 2011
  26. ORA-1092 : opitsk aborting process
复制代码



打开数据库,数据库open,但是还报错,其中一个trace文件
  1. *** 2011-12-12 14:17:46.627
  2. Started Serial Media Recovery
  3. Datafile 5 belongs to incarnation with resetlogs SCN : 12881971, timestamp: 2de0acea
  4. Media Recovery apply resetlogs offline range for datafile 5, incarnation : 1
  5. Datafile 5 belongs to incarnation with resetlogs SCN : 12881971, timestamp: 2de0acea
  6. Dumping database incarnation table:
  7. Resetlogs 0 scn and time: 0x0000.00c493a4 12/12/2011 14:05:53
  8. Resetlogs 1 scn and time: 0x0000.00c49033 12/12/2011 13:17:30
  9. Recovery target incarnation = 4, activation ID = 0
  10. Influx buffer limit = 37449 min(50% x 74898, 100000)
  11. Start recovery at thread 1 ckpt scn 12881971 logseq 1 block 2
  12. Initial buffer sizes: read 1024K, overflow 832K, change 805K

  13. *** 2011-12-12 14:17:46.725
  14. Media Recovery add redo thread 1

  15. *** 2011-12-12 14:18:47.348
  16. Media Recovery Log 2011_12_12/o1_mf_1_1_7gc3ojqw_.arc

  17. *** 2011-12-12 14:19:00.198
  18. Media Recovery Log /opt/oracle/fast_recovery_area/ORA11G/archivelog/2011_12_12/o1_mf_1_1_7gc3ojqw_.arc
  19. Log read is SYNCHRONOUS though disk_asynch_io is enabled!
  20. Datafile 5 belongs to incarnation with resetlogs SCN : 12881971, timestamp: 2de0acea

  21. *** 2011-12-12 14:19:15.911
  22. Media Recovery Log /opt/oracle/fast_recovery_area/ORA11G/archivelog/2011_12_12/o1_mf_1_2_7gc3okx8_.arc
  23. Log read is SYNCHRONOUS though disk_asynch_io is enabled!

  24. *** 2011-12-12 14:19:22.638
  25. Media Recovery Log /opt/oracle/fast_recovery_area/ORA11G/archivelog/2011_12_12/o1_mf_1_3_7gc3onnq_.arc
  26. Log read is SYNCHRONOUS though disk_asynch_io is enabled!

  27. *** 2011-12-12 14:19:31.007
  28. Media Recovery Log /opt/oracle/fast_recovery_area/ORA11G/archivelog/2011_12_12/o1_mf_1_4_7gc3wnvf_.arc
  29. Log read is SYNCHRONOUS though disk_asynch_io is enabled!
  30. Datafile 5 belongs to incarnation with resetlogs SCN : 12881971, timestamp: 2de0acea

  31. *** 2011-12-12 14:19:37.116
  32. Media Recovery Log /opt/oracle/fast_recovery_area/ORA11G/archivelog/2011_12_12/o1_mf_1_5_7gc3wt48_.arc
  33. Log read is SYNCHRONOUS though disk_asynch_io is enabled!
  34. Initial buffer sizes: read 1024K, overflow 832K, change 805K
  35. Thread 1 initialized for new incarnation 1 at scn 12882852
  36. Media Recovery current incarnation depth : 0
  37. File 5 (stop scn 12882852) completed recovery at checkpoint scn 12882852
复制代码


查询相关视图
  1. SQL> select file#,online_status,to_char(change#,'999999999999') from v$recover_file;

  2.      FILE# ONLINE_ TO_CHAR(CHANG
  3. ---------- ------- -------------
  4.          5 OFFLINE      12881970

  5. SQL> select file#,to_char(checkpoint_change#,'999999999999') from v$datafile;

  6.      FILE# TO_CHAR(CHECK
  7. ---------- -------------
  8.          1      12902896
  9.          2      12902896
  10.          3      12902896
  11.          4      12902896
  12.          5             0

  13. SQL> select FILE#,to_char(checkpoint_change#,'999999999999') from v$datafile_header;

  14.      FILE# TO_CHAR(CHECK
  15. ---------- -------------
  16.          1      12902896
  17.          2      12902896
  18.          3      12902896
  19.          4      12902896
  20.          5      12881970
复制代码


通过这些证明datafile 5没有应用sequence=5


然后我手工应用 redo log 5 to   datafile 5,问题解决,datafile 5 正常online






问题:为什么在rman 做recover时候,提示已经应用了req 5,而最后resetlogs时候,有出现datafile 5没有应用该日志,需要人工去引用
2#
发表于 2011-12-12 18:41:37

回复 1# 的帖子

看下 DATAFILE 5是何时开始OFFLINE的?

可以用 scn_to_timestamp 转换12881970 得到。

回复 只看该作者 道具 举报

3#
发表于 2011-12-12 18:48:33
跑一下这个post里的 SQL 脚本 , 上传结果 http://www.oracledatabase12g.com ... BF%A1%E6%81%AF.html

回复 只看该作者 道具 举报

4#
发表于 2011-12-12 21:12:47
TABLESPACE_NAME                            TS#                                  -------------------------------- -------------                                  FILENAME                                                                        --------------------------------------------------------------------------------        FILE# STATUS  ENABLED    CREATION_CHANGE# CREATION_TIME                 ------------- ------- ---------- ---------------- -----------------------       CHECKPOINT_CHANG CHECKPOINT_TIME         OFFLINE_CHANGE#  ONLINE_CHANGE#        ---------------- ----------------------- ---------------- ----------------      ONLINE_TIME             ONLINE_CHANGE#   ONLINE_TIME                            ----------------------- ---------------- -----------------------                BYTES                 BLOCK_SIZE                                                ------------------ -------------                                                #SYSTEM#                                     0                                  #/opt/oracle/oradata/ora11g/system01.dbf#                                                   1 SYSTEM  READ WRITE                7 17-SEP-2011 09:46:08                  12930137 12-DEC-2011 16:52:50            12882851         12882852      12-DEC-2011 14:27:18                   0                                               765,460,480          8192                                                #EXAMPLE#                                    6                                  #/opt/oracle/oradata/ora11g/example01.dbf#                                                  5 OFFLINE READ WRITE          1026256 31-OCT-2011 16:06:10
这里出现datafile 5 offline,是我今天下午第二次恢复的时候
Mon Dec 12 15:29:29 2011
ALTER DATABASE RECOVER  datafile 5  
Media Recovery Start
Serial Media Recovery started
Media Recovery Complete (ora11g)
Completed: ALTER DATABASE RECOVER  datafile 5  
Mon Dec 12 15:29:42 2011
alter database datafile 5 offline
Completed: alter database datafile 5 offline

本来是online,我敲打成了offline,然后刚刚跑这个命令后,我改成online成功了

[ 本帖最后由 xifenfei 于 2011-12-12 21:26 编辑 ]

results01.rar

11.5 KB, 下载次数: 1494

回复 只看该作者 道具 举报

5#
发表于 2011-12-12 21:19:31
说明:
现在的库是的第二次恢复的结果,第一次恢复结果就是如同blog中记录,因为第一次库恢复成功的库,已经被是删除,很难找回那个时间点的现场了

回复 只看该作者 道具 举报

6#
发表于 2011-12-12 21:37:33
我觉得 没有recover datafile 5 和 当时 其状态有关系

回复 只看该作者 道具 举报

7#
发表于 2011-12-12 21:41:48
我两次测试,都是datafile 5没有被完全恢复和其他文件同一个scn(第一次比较明显,正好相差了一个日志文件)

无论数据文件5是什么状态的,也不可能恢复的时候应用了部分日志文件,而部分没有应该(因为在恢复过程中需要的那几个归档日志,都是我特意切换日志的,这个过程中,不存在让datafile 5的状态发生改变)

回复 只看该作者 道具 举报

8#
发表于 2011-12-14 10:27:08
这实验是dbitr呢,还是正常全部恢复?

回复 只看该作者 道具 举报

您需要登录后才可以回帖 登录 | 注册

QQ|手机版|Archiver|Oracle数据库数据恢复、性能优化

GMT+8, 2024-12-23 19:57 , Processed in 0.051233 second(s), 25 queries .

Powered by Discuz! X2.5

© 2001-2012 Comsenz Inc.

回顶部
TEL/電話+86 13764045638
Email service@parnassusdata.com
QQ 47079569