标签云
asm恢复 bbed bootstrap$ dul kcbzib_kcrsds_1 kccpb_sanity_check_2 kcratr_nab_less_than_odr MySQL恢复 obet ORA-00312 ORA-00704 ORA-00742 ORA-01110 ORA-01200 ORA-01555 ORA-01578 ORA-01595 ORA-600 2662 ORA-600 2663 ORA-600 3020 ORA-600 4000 ORA-600 4137 ORA-600 4193 ORA-600 4194 ORA-600 16703 ORA-600 kcbzib_kcrsds_1 ORA-600 KCLCHKBLK_4 ORA-600 kcratr_nab_less_than_odr ORA-15042 ORA-15196 ORACLE 12C oracle dul ORACLE PATCH Oracle Recovery Tools oracle加密恢复 oracle勒索 oracle勒索恢复 oracle异常恢复 ORACLE恢复 Oracle 恢复 ORACLE数据库恢复 oracle碎片 OSD-04016 YOUR FILES ARE ENCRYPTED 比特币加密文章分类
- MongoDB (1)
- MongoDB恢复 (1)
- Others (2)
- 中间件 (2)
- WebLogic (2)
- 操作系统 (112)
- 数据库 (1,884)
- DB2 (22)
- MySQL (82)
- Oracle (1,709)
- Data Guard (53)
- EXADATA (8)
- GoldenGate (24)
- ORA-xxxxx (168)
- ORACLE 12C (72)
- ORACLE 18C (6)
- ORACLE 19C (15)
- ORACLE 21C (3)
- Oracle 23ai (8)
- Oracle ASM (73)
- Oracle Bug (8)
- Oracle RAC (56)
- Oracle 安全 (6)
- Oracle 开发 (28)
- Oracle 监听 (29)
- Oracle备份恢复 (662)
- Oracle安装升级 (108)
- Oracle性能优化 (62)
- 专题索引 (5)
- 勒索恢复 (91)
- PostgreSQL (37)
- pdu工具 (7)
- PostgreSQL恢复 (13)
- SQL Server (34)
- SQL Server恢复 (14)
- TimesTen (7)
- 达梦数据库 (5)
- 达梦恢复 (3)
- 生活娱乐 (2)
- 至理名言 (11)
- 虚拟化 (2)
- VMware (2)
- 软件开发 (51)
- Asp.Net (9)
- JavaScript (12)
- PHP (2)
- 小工具 (34)
- MongoDB (1)
-
最近发表
- 记录19c ASM磁盘掉线触发ORA-59048故障处理
- aix平台Oracle数据库由于断电无法启动故障处理
- 断电引起ORA-600 3005故障处理
- 记录一次云存储资源到期之后引起的数据库恢复
- Firebird 损坏数据库数据抢救工具—firebirdext
- Oracle 19c 202610补丁(RUs+OJVM)-19.33
- 由于con$.con#值达到极限,触发数据库增加约束报ORA-600 12807错误
- MongoDB 离线提取工具—mongoext
- .bres勒索病毒加密数据库dmp文件可恢复
- ORA-600 krsm_mrp_rebuild_lf_list.lno_mismatch
- 记录一次0丢失的ORA-00354: 损坏重做日志块标头故障恢复
- 不当数据库恢复操作导致一个月数据丢失
- obet快速修复oracle 位图损坏块
- 不太常见的10.2.0.1的oracle redo损坏恢复
- obet forcecopy功能抢救硬件故障中的数据文件
- kcratr_nab_less_than_odr和system坏块故障处理
- 通过obet 恢复system坏块,打开数据库
- obet dbv功能完整说明
- 分享一例运行在aix上的sap系统数据库恢复过程
- OBET-Oracle Block Editor Tool使用说明
月归档:六月 2012
动态修改PGA_AGGREGATE_TARGET 导致ORA-600[723]
在以前分析过ORA-600[729](SGA内存泄露),这次遇到ORA-600[723](PGA内存泄露)
操作系统数据库信息
ORACLE V9.2.0.3.0 - Production vsnsta=0 vsnsql=12 vsnxtr=3 Windows 2000 Version 5.2 Service Pack 2, CPU type 586 Oracle9i Enterprise Edition Release 9.2.0.3.0 - Production With the Partitioning, OLAP and Oracle Data Mining options JServer Release 9.2.0.3.0 - Production Windows 2000 Version 5.2 Service Pack 2, CPU type 586 Instance name: dsdata
alert报错ORA-600[723]
Tue Jun 05 12:16:35 2012 Shutting down instance: further logons disabled Shutting down instance (immediate) License high water mark = 274 Tue Jun 05 12:16:40 2012 alter database close normal Tue Jun 05 12:16:40 2012 SMON: disabling tx recovery SMON: disabling cache recovery Tue Jun 05 12:16:40 2012 Shutting down archive processes Archiving is disabled Tue Jun 05 12:16:40 2012 ARCH shutting down Tue Jun 05 12:16:40 2012 ARCH shutting down ARC1: Archival stopped Tue Jun 05 12:16:40 2012 ARC0: Archival stopped Tue Jun 05 12:16:40 2012 Thread 1 closed at log sequence 406 Successful close of redo thread 1. Tue Jun 05 12:16:41 2012 Completed: alter database close normal Tue Jun 05 12:16:41 2012 alter database dismount Completed: alter database dismount ARCH: Archiving is disabled Shutting down archive processes Archiving is disabled Archive process shutdown avoided: 0 active ARCH: Archiving is disabled Shutting down archive processes Archiving is disabled Archive process shutdown avoided: 0 active Tue Jun 05 12:16:43 2012 Errors in file d:\oracle\admin\dsdata\udump\dsdata_ora_504.trc: ORA-00600: internal error code, arguments: [723], [20664], [20664], [memory leak], [], [], [], []
通过alert日志可以知道,数据库shutdown immediate的时候报ORA-600[723]
分析trace文件
…………
EXTENT 147 addr=062ACCBC
Chunk 62accc4 sz= 1252 free " "
Chunk 62ad1a8 sz= 2060 freeable "qesmmaLogInitia"
Chunk 62ad9b4 sz= 2060 freeable "qesmmaLogInitia"
Chunk 62ae1c0 sz= 2060 freeable "qesmmaLogInitia"
Chunk 62ae9cc sz= 2060 freeable "qesmmaLogInitia"
…………
EXTENT 153 addr=04232414
Chunk 423241c sz= 4476 perm "perm " alo=2868
Chunk 4233598 sz= 18516 free " "
Chunk 4237dec sz= 2060 freeable "qesmmaLogInitia"
Chunk 42385f8 sz= 2060 freeable "qesmmaLogInitia"
Chunk 4238e04 sz= 2060 freeable "qesmmaLogInitia"
Chunk 4239610 sz= 2060 freeable "qesmmaLogInitia"
Chunk 4239e1c sz= 2060 freeable "qesmmaLogInitia"
…………
--查询发现没有释放的内容都是在qesmmaLogInitia部分
*** 2012-06-05 12:16:43.000
ksedmp: internal or fatal error
ORA-00600: internal error code, arguments: [723], [20664], [20664], [memory leak], [], [], [], []
Current SQL information unavailable - no SGA.
----- Call Stack Trace -----
calling call entry argument values in hex
location type point (? means dubious value)
-------------------- -------- -------------------- ----------------------------
_ksedmp+147 CALLrel _ksedst+0
_ksfdmp.108+e CALLrel _ksedmp+0 3
_kgeriv+89 CALLreg 00000000 217190 3
_kgesiv+4e CALLrel _kgeriv+0 217190 0 2D3 3 418FC2C
_ksesic3+3b CALLrel _kgesiv+0 217190 0 2D3 3 418FC2C 2D3 3
418FC2C
__VInfreq__ksmdpg+e CALLrel _ksesic3+0 2D3 0 50B8 0 50B8 1 B 26A3F28
f
_opidcl+1db CALLrel _ksmdpg+0
_opidrv+3bf CALLrel _opidcl+0 21D328 0
_sou2o+19 CALLrel _opidrv+0
_opimai+150 CALLrel _sou2o+0 418FE20 32 0 0
_BackgroundThreadSt CALLrel _opimai+0
art@4+164
77E6482C CALLreg 00000000
--------------------- Binary Stack Dump ---------------------
通过查询MOS发现[ID 242260.1]上的Stack Trace比较匹配.上面说到通过sql来直接修改pga_aggregate_target导致,查找alert日志,果然发现:
Mon May 21 15:18:33 2012 ALTER SYSTEM SET pga_aggregate_target='1048576000' SCOPE=MEMORY; Mon May 21 15:18:33 2012 ALTER SYSTEM SET pga_aggregate_target='1048576000' SCOPE=SPFILE;
现在基本上可以确定引起整个ORA-600[723]的原因是:用户直接修改pga_aggregate_target参数,然后关闭数据库引起Bug:2975617导致
处理建议
Don’t alter the pga_aggregate_target dynamically Change it in init.ora file
针对本库,再次开启数据库应该处于正常状态(spfile已经修改),无需继续关注该问题.
找出dbv相关dba值在数据文件中对应位置
一个朋友数据库因异常断电,数据库不能正常启动,使用dbv检测错误如下:
C:\Users\XIFENFEI\Downloads>dbv file=users01.dbf end=5 DBVERIFY: Release 11.2.0.3.0 - Production on 星期二 6月 5 18:17:27 2012 Copyright (c) 1982, 2011, Oracle and/or its affiliates. All rights reserved. DBVERIFY - 开始验证: FILE = C:\USERS\XIFENFEI\DOWNLOADS\USERS01.DBF 页 1 标记为损坏 Corrupt block relative dba: 0x00000001 (file 0, block 1) Bad header found during dbv: Data in bad block: type: 11 format: 2 rdba: 0x00000000 last change scn: 0x0000.00000000 seq: 0x1 flg: 0x04 spare1: 0x0 spare2: 0x0 spare3: 0x0 consistency value in tail: 0x00000b01 check value in block header: 0x2f1f computed block checksum: 0x0 页 2 标记为损坏 Corrupt block relative dba: 0x00000002 (file 0, block 2) Bad header found during dbv: Data in bad block: type: 29 format: 2 rdba: 0x01000002 last change scn: 0x0000.0018c7fa seq: 0x2 flg: 0x04 spare1: 0x0 spare2: 0x0 spare3: 0x0 consistency value in tail: 0xc7fa1d02 check value in block header: 0x82ca computed block checksum: 0x0 页 3 标记为损坏 Corrupt block relative dba: 0x00000003 (file 0, block 3) Bad header found during dbv: Data in bad block: type: 30 format: 2 rdba: 0x01000003 last change scn: 0x0000.0018c7fa seq: 0x1 flg: 0x04 spare1: 0x0 spare2: 0x0 spare3: 0x0 consistency value in tail: 0xc7fa1e01 check value in block header: 0x32c9 computed block checksum: 0x0 页 4 标记为损坏 Corrupt block relative dba: 0x00000004 (file 0, block 4) Bad header found during dbv: Data in bad block: type: 30 format: 2 rdba: 0x01000004 last change scn: 0x0000.00004adc seq: 0x1 flg: 0x04 spare1: 0x0 spare2: 0x0 spare3: 0x0 consistency value in tail: 0x4adc1e01 check value in block header: 0x8199 computed block checksum: 0x0 页 5 标记为损坏 Corrupt block relative dba: 0x00000005 (file 0, block 5) Bad header found during dbv: Data in bad block: type: 30 format: 2 rdba: 0x01000005 last change scn: 0x0000.00004ade seq: 0x1 flg: 0x04 spare1: 0x0 spare2: 0x0 spare3: 0x0 consistency value in tail: 0x4ade1e01 check value in block header: 0xc190 computed block checksum: 0x0 DBVERIFY - 验证完成 检查的页总数: 5 处理的页总数 (数据): 0 失败的页总数 (数据): 0 处理的页总数 (索引): 0 失败的页总数 (索引): 0 处理的页总数 (其他): 0 处理的总页数 (段) : 0 失败的总页数 (段) : 0 空的页总数: 0 标记为损坏的总页数: 5 流入的页总数: 0 加密的总页数 : 0 最高块 SCN : 0 (0.0)
对于这样的错误,特别是Corrupt block relative dba出现奇怪的提示(file 0),我第一反应就是数据文件header出现了问题.在eygle的耐心帮忙和提示下,使用bbed重现了该错误,并且找出了dbv中两个dba(Corrupt block relative dba和rdba)和bbed中相对应的值.通过实验重现相关结果.
dbv检查无坏块
[oracle@xifenfei tmp]$ dbv file=/u01/oracle/oradata/ora11g/xifenfei02.dbf blocksize=8192
DBVERIFY: Release 11.2.0.3.0 - Production on Fri Jun 1 03:34:46 2012
Copyright (c) 1982, 2011, Oracle and/or its affiliates. All rights reserved.
DBVERIFY - Verification starting : FILE = /u01/oracle/oradata/ora11g/xifenfei02.dbf
Block Checking: DBA = 25179275, Block Type = KTB-managed data block
data header at 0xb526707c
kdbchk: row locked by non-existent transaction
table=0 slot=0
lockid=2 ktbbhitc=3
Page 13451 failed with check code 6101
Block Checking: DBA = 25179287, Block Type = KTB-managed data block
data header at 0xb527f064
kdbchk: row locked by non-existent transaction
table=0 slot=0
lockid=2 ktbbhitc=2
Page 13463 failed with check code 6101
DBVERIFY - Verification complete
Total Pages Examined : 15360
Total Pages Processed (Data) : 12932
Total Pages Failing (Data) : 2
Total Pages Processed (Index): 0
Total Pages Failing (Index): 0
Total Pages Processed (Other): 291
Total Pages Processed (Seg) : 0
Total Pages Failing (Seg) : 0
Total Pages Empty : 2137
Total Pages Marked Corrupt : 0
Total Pages Influx : 0
Total Pages Encrypted : 0
Highest block SCN : 1551567 (0.1551567)
修改数据块rdba_kcbh
BBED> set block 150
BLOCK# 150
BBED> map
File: /u01/oracle/oradata/ora11g/xifenfei02.dbf (1)
Block: 150 Dba:0x00400096
------------------------------------------------------------
KTB Data Block (Table/Cluster)
struct kcbh, 20 bytes @0
struct ktbbh, 96 bytes @20
struct kdbh, 14 bytes @124
struct kdbt[1], 4 bytes @138
sb2 kdbr[71] @142
ub1 freespace[910] @284
ub1 rowdata[6994] @1194
ub4 tailchk @8188
BBED> p kcbh
struct kcbh, 20 bytes @0
ub1 type_kcbh @0 0x06
ub1 frmt_kcbh @1 0xa2
ub1 spare1_kcbh @2 0x00
ub1 spare2_kcbh @3 0x00
ub4 rdba_kcbh @4 0x01800096
ub4 bas_kcbh @8 0x00131e6f
ub2 wrp_kcbh @12 0x0000
ub1 seq_kcbh @14 0x01
ub1 flg_kcbh @15 0x04 (KCBHFCKV)
ub2 chkval_kcbh @16 0x4aae
ub2 spare3_kcbh @18 0x0000
BBED> m /x 00000000 offset 4
File: /u01/oracle/oradata/ora11g/xifenfei02.dbf (1)
Block: 150 Offsets: 4 to 515 Dba:0x00400096
------------------------------------------------------------------------
00000000 6f1e1300 00000104 ae4a0000 01000000 01280100 6f1e1300 00000000
03003200 90008001 ffff0000 00000000 00000000 00000000 00800000 6c781200
09001d00 05030000 8c02c000 b4000500 00800000 b0191300 02000900 fc020000
b011c000 0b011400 00800000 6c1e1300 00000000 00000000 00014700 ffffa000
2e048e03 8e030000 4700e90b 540cb30c 120d710d d00d2f0e 8e0eed0e 4c0fab0f
0a106910 c8102711 8611e711 4812aa12 0c136713 c2131f14 7c14df14 4115a015
ff156416 c9162517 8117de17 3b18a118 07196119 bb19191a 771ad61a 351b941b
f31b521c b11c101d 6f1dd71d 3f1eaa1e 151f2e04 99040405 6f05da05 4506b006
1b078607 f1075c08 c7082c09 9109f609 5b0ac00a 250b870b 48004900 4a004b00
4c004d00 4e004f00 5000ffff 00000000 00000000 00000000 00000000 00000000
00000000 00000000 00000000 00000000 2c000e03 53595308 565f245f 4c4f434b
ff03c20f 5eff0456 49455707 786f0912 12230407 786f0912 12230413 32303131
2d30392d 31383a31 373a3334 3a303305 56414c49 44014e01 4e014e02 c1022c00
0e065055 424c4943 0756245f 4c4f434b ff03c20f 5fff0753 594e4f4e 594d0778
6f091212 23040778 6f091212 23041332 3031312d 30392d31 383a3137 3a33343a
30330556 414c4944 014e014e 014e02c1 022c000e 03535953 07565f24 4c4f434b
<32 bytes per line>
BBED> sum apply
Check value for File 1, Block 150:
current = 0x4bb8, required = 0x4bb8
dbv检测数据文件
发现提示坏块文件的rdba就是我们刚刚修改的rdba_kcbh值
[oracle@xifenfei tmp]$ dbv file=/u01/oracle/oradata/ora11g/xifenfei02.dbf blocksize=8192
DBVERIFY: Release 11.2.0.3.0 - Production on Fri Jun 1 03:40:44 2012
Copyright (c) 1982, 2011, Oracle and/or its affiliates. All rights reserved.
DBVERIFY - Verification starting : FILE = /u01/oracle/oradata/ora11g/xifenfei02.dbf
Page 150 is marked corrupt
Corrupt block relative dba: 0x01800096 (file 6, block 150)
Bad header found during dbv:
Data in bad block:
type: 6 format: 2 rdba: 0x00000000
last change scn: 0x0000.00131e6f seq: 0x1 flg: 0x04
spare1: 0x0 spare2: 0x0 spare3: 0x0
consistency value in tail: 0x1e6f0601
check value in block header: 0x4bb8
computed block checksum: 0x0
Block Checking: DBA = 25179275, Block Type = KTB-managed data block
data header at 0xb52a807c
kdbchk: row locked by non-existent transaction
table=0 slot=0
lockid=2 ktbbhitc=3
Page 13451 failed with check code 6101
Block Checking: DBA = 25179287, Block Type = KTB-managed data block
data header at 0xb52c0064
kdbchk: row locked by non-existent transaction
table=0 slot=0
lockid=2 ktbbhitc=2
Page 13463 failed with check code 6101
DBVERIFY - Verification complete
Total Pages Examined : 15360
Total Pages Processed (Data) : 12931
Total Pages Failing (Data) : 2
Total Pages Processed (Index): 0
Total Pages Failing (Index): 0
Total Pages Processed (Other): 291
Total Pages Processed (Seg) : 0
Total Pages Failing (Seg) : 0
Total Pages Empty : 2137
Total Pages Marked Corrupt : 1
Total Pages Influx : 0
Total Pages Encrypted : 0
Highest block SCN : 1551567 (0.1551567)
修改datafile header的kcvfhrfn值
BBED> set block 1
BLOCK# 1
BBED> map
File: /u01/oracle/oradata/ora11g/xifenfei02.dbf (1)
Block: 1 Dba:0x00400001
------------------------------------------------------------
Data File Header
struct kcvfh, 860 bytes @0
ub4 tailchk @8188
BBED> p kcvfhrfn
ub4 kcvfhrfn @368 0x00000006
BBED> m /x 00000000
Warning: contents of previous BIFILE will be lost. Proceed? (Y/N) y
File: /u01/oracle/oradata/ora11g/xifenfei02.dbf (1)
Block: 1 Offsets: 368 to 879 Dba:0x00400001
------------------------------------------------------------------------
00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
00000000 00000000 00000000 00000000 e3b38c2e 04a91100 00000000 00000000
00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
00000000 00000000 00000000 00000000 00000000 797c1900 00000000 3e3bba2e
01000000 11000000 b40e0000 1000ba8a 02000000 00000000 00000000 00000000
00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
00000000 00000000 00000000 00000000 00000000 0a000a00 0a000100 00000000
00000000 00000000 02008001 bb050c00 00000000 00000000 00000000 00000000
00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
<32 bytes per line>
BBED> sum apply
Check value for File 1, Block 1:
current = 0x1daf, required = 0x1daf
dbv验证数据文件
这里如果验证所有数据文件快,会发现所有类此Corrupt block relative dba: 0×00000001 (file 0, block 1)提示.这里证明datafile header 的kcvfhrfn 影响dbv检查数据文件坏块的一个标准之一
[oracle@xifenfei tmp]$ dbv file=/u01/oracle/oradata/ora11g/xifenfei02.dbf blocksize=8192 start=1 end=4 DBVERIFY: Release 11.2.0.3.0 - Production on Fri Jun 1 03:43:27 2012 Copyright (c) 1982, 2011, Oracle and/or its affiliates. All rights reserved. DBVERIFY - Verification starting : FILE = /u01/oracle/oradata/ora11g/xifenfei02.dbf Page 1 is marked corrupt Corrupt block relative dba: 0x00000001 (file 0, block 1) Bad header found during dbv: Data in bad block: type: 11 format: 2 rdba: 0x01800001 last change scn: 0x0000.00000000 seq: 0x1 flg: 0x04 spare1: 0x0 spare2: 0x0 spare3: 0x0 consistency value in tail: 0x00000b01 check value in block header: 0x1daf computed block checksum: 0x0 Page 2 is marked corrupt Corrupt block relative dba: 0x00000002 (file 0, block 2) Bad header found during dbv: Data in bad block: type: 29 format: 2 rdba: 0x01800002 last change scn: 0x0000.0017accf seq: 0x1 flg: 0x04 spare1: 0x0 spare2: 0x0 spare3: 0x0 consistency value in tail: 0xaccf1d01 check value in block header: 0x2626 computed block checksum: 0x0 Page 3 is marked corrupt Corrupt block relative dba: 0x00000003 (file 0, block 3) Bad header found during dbv: Data in bad block: type: 30 format: 2 rdba: 0x01800003 last change scn: 0x0000.0017accf seq: 0x1 flg: 0x04 spare1: 0x0 spare2: 0x0 spare3: 0x0 consistency value in tail: 0xaccf1e01 check value in block header: 0x4ef4 computed block checksum: 0x0 Page 4 is marked corrupt Corrupt block relative dba: 0x00000004 (file 0, block 4) Bad header found during dbv: Data in bad block: type: 30 format: 2 rdba: 0x01800004 last change scn: 0x0000.00119bf4 seq: 0x1 flg: 0x04 spare1: 0x0 spare2: 0x0 spare3: 0x0 consistency value in tail: 0x9bf41e01 check value in block header: 0x810a computed block checksum: 0x0 DBVERIFY - Verification complete Total Pages Examined : 4 Total Pages Processed (Data) : 0 Total Pages Failing (Data) : 0 Total Pages Processed (Index): 0 Total Pages Failing (Index): 0 Total Pages Processed (Other): 0 Total Pages Processed (Seg) : 0 Total Pages Failing (Seg) : 0 Total Pages Empty : 0 Total Pages Marked Corrupt : 4 Total Pages Influx : 0 Total Pages Encrypted : 0 Highest block SCN : 0 (0.0)
总结说明
1.dbv检测数据文件坏块的时候会读取数据文件头的kcvfhrfn值,如果这个值出现问题,可能导致数据文件中的所有数据块都异常,具体表现就是Corrupt block relative dba项异常
2.dbv检查数据文件坏块中显示的rdba对应于数据块的rdba_kcbh值
发表在 Oracle
评论关闭
忘记执行end backup命令数据库恢复
遇到两次begin backup忘记end backup导致的悲剧.虽然不是自己亲身经历,但是感触很深,这里做了一个小实验,说明在begin backup后忘记end backup,而又丢失了备份归档日志,且数据库异常重启的事故恢复(这里为了加大实验难道,并且使用begin backup命令后的热备文件恢复)
模拟begin end
SQL> archive log list; Database log mode Archive Mode Automatic archival Enabled Archive destination /u01/oracle/oradata/xifenfei/archive Oldest online log sequence 37 Next log sequence to archive 39 Current log sequence 39 SQL> alter tablespace bbed begin backup; Tablespace altered. SQL> archive log list; Database log mode Archive Mode Automatic archival Enabled Archive destination /u01/oracle/oradata/xifenfei/archive Oldest online log sequence 37 Next log sequence to archive 39 Current log sequence 39 SQL> drop table chf.t_xff; Table dropped. SQL> create table chf.t_xff 2 as 3 select * from dba_objects; Table created. SQL> alter system switch logfile; System altered. SQL> delete from chf.t_XFF; 30811 rows deleted. SQL> commit; Commit complete. SQL> alter system switch logfile; System altered. SQL> / System altered. SQL> archive log list; Database log mode Archive Mode Automatic archival Enabled Archive destination /u01/oracle/oradata/xifenfei/archive Oldest online log sequence 40 Next log sequence to archive 42 Current log sequence 42
cp备份文件
[oracle@xifenfei xifenfei]$ cp bbed01.dbf bbed01.dbf_05 [oracle@xifenfei xifenfei]$ cp bbed02.dbf bbed02.dbf_05
继续操作数据库
SQL> alter system switch logfile; System altered. SQL> insert into chf.t_xff 2 select * from dba_objects; 30811 rows created. SQL> commit; Commit complete. SQL> archive log list; Database log mode Archive Mode Automatic archival Enabled Archive destination /u01/oracle/oradata/xifenfei/archive Oldest online log sequence 41 Next log sequence to archive 43 Current log sequence 43 SQL> alter system switch logfile; System altered.
模拟异常关闭数据库
SQL> shutdown immediate; ORA-01149: cannot shutdown - file 11 has online backup set ORA-01110: data file 11: '/u01/oracle/oradata/xifenfei/bbed01.dbf' SQL> shutdown abort; ORACLE instance shut down.
删除部分归档日志(模拟归档日志丢失)
[oracle@xifenfei archive]$ mv 1_39.dbf 1_39.dbf_bak [oracle@xifenfei archive]$ mv 1_40.dbf 1_40.dbf_bak
启动数据库
[oracle@xifenfei xifenfei]$ sqlplus "/ as sysdba" SQL*Plus: Release 9.2.0.4.0 - Production on Tue Jun 5 03:02:56 2012 Copyright (c) 1982, 2002, Oracle Corporation. All rights reserved. Connected to an idle instance. SQL> startup ORACLE instance started. Total System Global Area 353441008 bytes Fixed Size 451824 bytes Variable Size 184549376 bytes Database Buffers 167772160 bytes Redo Buffers 667648 bytes Database mounted. ORA-01113: file 11 needs media recovery ORA-01110: data file 11: '/u01/oracle/oradata/xifenfei/bbed01.dbf'
分析相关SCN
SQL> select file#,online_status "STATUS",to_char(change#,'9999999999999999') "SCN",
2 To_char(time,'yyyy-mm-dd hh24:mi:ss')"TIME" from v$recover_file;
FILE# STATUS SCN TIME
---------- ------- ----------------- -------------------
11 ONLINE 12286828683164 2012-06-05 02:55:43
12 ONLINE 12286828683164 2012-06-05 02:55:43
SQL> select file#,to_char(checkpoint_change#,'999999999999999') "SCN",
2 to_char(last_change#,'999999999999999')"STOP_SCN" from v$datafile;
FILE# SCN STOP_SCN
---------- ---------------- ----------------
1 12286828684636
2 12286828684636
3 12286828684636
4 12286828684636
5 12286828684636
6 12286828684636
7 12286828684636
8 12286828684636
9 12286828684636
10 12286828684636
11 12286828683164
12 12286828683164
12 rows selected.
SQL> select file#,to_char(checkpoint_change#,'9999999999999999') "SCN",
2 to_char(RESETLOGS_CHANGE#,'9999999999999999') "RESETLOGS SCN"
3 from v$datafile_header;
FILE# SCN RESETLOGS SCN
---------- ----------------- -----------------
1 12286828684636 174968
2 12286828684636 174968
3 12286828684636 174968
4 12286828684636 174968
5 12286828684636 174968
6 12286828684636 174968
7 12286828684636 174968
8 12286828684636 174968
9 12286828684636 174968
10 12286828684636 174968
11 12286828683164 174968
12 12286828683164 174968
12 rows selected.
SQL> select file#,to_char(CHANGE#,'9999999999999999') "SCN",
2 to_char(TIME,'yyyy-mm-dd hh24:mi:ss') "TIME" from v$backup;
FILE# SCN TIME
---------- ----------------- -------------------
1 0
2 0
3 0
4 0
5 0
6 0
7 0
8 0
9 0
10 0
11 12286828683164 2012-06-05 02:55:43
12 12286828683164 2012-06-05 02:55:43
12 rows selected.
发现数据库未end backup
Tue Jun 5 02:55:43 2012 alter tablespace bbed begin backup Tue Jun 5 02:55:43 2012 Completed: alter tablespace bbed begin backup
尝试end backup
出现这个错误是正常的,因为我替换回来的bbed表空间数据文件的版本信息可能和控制文件的不一致,解决方法是重建控制文件
SQL> alter tablespace bbed end backup; alter tablespace bbed end backup * ERROR at line 1: ORA-01235: END BACKUP failed for 2 file(s) and succeeded for 0 ORA-01122: database file 12 failed verification check ORA-01110: data file 12: '/u01/oracle/oradata/xifenfei/bbed02.dbf' ORA-01208: data file is an old version - not accessing current version ORA-01122: database file 11 failed verification check ORA-01110: data file 11: '/u01/oracle/oradata/xifenfei/bbed01.dbf' ORA-01208: data file is an old version - not accessing current version
重建控制文件
SQL> shutdown abort; ORACLE instance shut down. SQL> STARTUP NOMOUNT Total System Global Area 353441008 bytes Fixed Size 451824 bytes Variable Size 184549376 bytes Database Buffers 167772160 bytes Redo Buffers 667648 bytes SQL>@ctl.sql Control file created.
尝试恢复数据库
SQL> recover database;
ORA-00279: change 12286828683164 generated at 06/05/2012 02:55:43 needed for
thread 1
ORA-00289: suggestion : /u01/oracle/oradata/xifenfei/archive/1_39.dbf
ORA-00280: change 12286828683164 for thread 1 is in sequence #39
Specify log: {<RET>=suggested | filename | AUTO | CANCEL}
auto
ORA-00308: cannot open archived log
'/u01/oracle/oradata/xifenfei/archive/1_39.dbf'
ORA-27037: unable to obtain file status
Linux Error: 2: No such file or directory
Additional information: 3
ORA-00308: cannot open archived log
'/u01/oracle/oradata/xifenfei/archive/1_39.dbf'
ORA-27037: unable to obtain file status
Linux Error: 2: No such file or directory
Additional information: 3
执行end backup
SQL> alter tablespace bbed end backup; Tablespace altered.
再次查看相关SCN
可以发现end backup之后,datafile header 的scn发生了改变,说明begin backup主要是冻住了datafile header scn
SQL> select file#,online_status "STATUS",to_char(change#,'9999999999999999') "SCN",
2 To_char(time,'yyyy-mm-dd hh24:mi:ss')"TIME" from v$recover_file;
FILE# STATUS SCN TIME
---------- ------- ----------------- -------------------
1 ONLINE 12286828684636 2012-06-05 03:00:46
2 ONLINE 12286828684636 2012-06-05 03:00:46
3 ONLINE 12286828684636 2012-06-05 03:00:46
4 ONLINE 12286828684636 2012-06-05 03:00:46
5 ONLINE 12286828684636 2012-06-05 03:00:46
6 ONLINE 12286828684636 2012-06-05 03:00:46
7 ONLINE 12286828684636 2012-06-05 03:00:46
8 ONLINE 12286828684636 2012-06-05 03:00:46
9 ONLINE 12286828684636 2012-06-05 03:00:46
10 ONLINE 12286828684636 2012-06-05 03:00:46
11 ONLINE 12286828683821 2012-06-05 02:56:26
12 ONLINE 12286828683821 2012-06-05 02:56:26
12 rows selected.
SQL> select file#,to_char(checkpoint_change#,'999999999999999') "SCN",
2 to_char(last_change#,'999999999999999')"STOP_SCN" from v$datafile;
FILE# SCN STOP_SCN
---------- ---------------- ----------------
1 12286828684636
2 12286828684636
3 12286828684636
4 12286828684636
5 12286828684636
6 12286828684636
7 12286828684636
8 12286828684636
9 12286828684636
10 12286828684636
11 12286828684636
12 12286828684636
12 rows selected.
SQL> select file#,to_char(checkpoint_change#,'9999999999999999') "SCN",
2 to_char(RESETLOGS_CHANGE#,'9999999999999999') "RESETLOGS SCN"
3 from v$datafile_header;
FILE# SCN RESETLOGS SCN
---------- ----------------- -----------------
1 12286828684636 174968
2 12286828684636 174968
3 12286828684636 174968
4 12286828684636 174968
5 12286828684636 174968
6 12286828684636 174968
7 12286828684636 174968
8 12286828684636 174968
9 12286828684636 174968
10 12286828684636 174968
11 12286828683821 174968
12 12286828683821 174968
12 rows selected.
再次尝试恢复数据库
SQL> recover database;
ORA-00279: change 12286828683821 generated at 06/05/2012 02:56:26 needed for
thread 1
ORA-00289: suggestion : /u01/oracle/oradata/xifenfei/archive/1_41.dbf
ORA-00280: change 12286828683821 for thread 1 is in sequence #41
Specify log: {<RET>=suggested | filename | AUTO | CANCEL}
auto
Log applied.
Media recovery complete.
SQL> alter database open;
Database altered.
总结说明
在数据库忘记end backup,而又被异常重启数据库时候,会提示你需要恢复.这个时候如果你有所有的归档日志,那没有任何问题,直接recover就可以了.如果因为begin backup命令执行比较久,部分归档日志丢失,这个时候不能直接recover,可以先尝试end backup,然后在recover.如果在这个时候还发现有部分日志不存在,那只能考虑bbed修改datafile header的scn.
温馨提醒:各位dba在执行begin backup之后一定要记得end backup
发表在 Oracle备份恢复
评论关闭

加我微信(17813235971)
加我QQ(107644445)

