遭遇ORA-07445[kkdliac()+346]使用odu抢救数据

联系:手机/微信(+86 17813235971) QQ(107644445)

标题:遭遇ORA-07445[kkdliac()+346]使用odu抢救数据

作者:惜分飞©版权所有[未经本人同意,不得以任何形式转载,否则有进一步追究法律责任的权利.]

1.Oracle启动报错

-bash-2.05b$ sqlplus "/ as sysdba"
SQL*Plus: Release 9.2.0.8.0 - Production on 星期三 2月 15 10:31:53 2012
Copyright (c) 1982, 2002, Oracle Corporation.  All rights reserved.
Connected to an idle instance.
SQL> startup mount
ORACLE instance started.
Total System Global Area 1527846824 bytes
Fixed Size                   452520 bytes
Variable Size             385875968 bytes
Database Buffers         1140850688 bytes
Redo Buffers                 667648 bytes
Database mounted.
SQL> alter database open;
alter database open
*
ERROR at line 1:
ORA-03113: end-of-file on communication channel

2.alert文件

Wed Feb 15 10:32:06 2012
ALTER DATABASE   MOUNT
Wed Feb 15 10:32:10 2012
Successful mount of redo thread 1, with mount id 412256678
Wed Feb 15 10:32:10 2012
Database mounted in Exclusive Mode.
Completed: ALTER DATABASE   MOUNT
Wed Feb 15 10:33:44 2012
alter database open
Wed Feb 15 10:33:44 2012
Beginning crash recovery of 1 threads
Wed Feb 15 10:33:44 2012
Started redo scan
Wed Feb 15 10:33:44 2012
Completed redo scan
 0 redo blocks read, 0 data blocks need recovery
Wed Feb 15 10:33:44 2012
Started recovery at
 Thread 1: logseq 2, block 3, scn 2862.4075508322
Wed Feb 15 10:33:44 2012
Recovery of Online Redo Log: Thread 1 Group 1 Seq 2 Reading mem 0
  Mem# 0 errs 0: /data1z/oracle/oradata/ahcx216/redo01.log
Wed Feb 15 10:33:44 2012
Completed redo application
Wed Feb 15 10:33:44 2012
Ended recovery at
 Thread 1: logseq 2, block 3, scn 2862.4075528323
 0 data blocks read, 0 data blocks written, 0 redo blocks read
Crash recovery completed successfully
Wed Feb 15 10:33:44 2012
Thread 1 advanced to log sequence 3
Thread 1 opened at log sequence 3
  Current log# 3 seq# 3 mem# 0: /data1z/oracle/oradata/ahcx216/redo03.log
Successful open of redo thread 1
Wed Feb 15 10:33:45 2012
SMON: enabling cache recovery
Wed Feb 15 10:33:45 2012
Errors in file /data1z/oracle/admin/ahcx216/udump/ahcx216_ora_21325.trc:
ORA-07445: exception encountered: core dump [kkdliac()+346] [SIGSEGV] [Address not mapped to object] [0x43] [] []

3.trace文件

/data1z/oracle/admin/ahcx216/udump/ahcx216_ora_21325.trc
Oracle9i Enterprise Edition Release 9.2.0.8.0 - Production
With the Partitioning, OLAP and Oracle Data Mining options
JServer Release 9.2.0.8.0 - Production
ORACLE_HOME = /data1z/oracle/product/9.2
System name:	Linux
Node name:	aiserch1
Release:	2.4.21-27.ELsmp
Version:	#1 SMP Wed Dec 1 21:59:02 EST 2004
Machine:	i686
Instance name: ahcx216
Redo thread mounted by this instance: 1
Oracle process number: 12
Unix process pid: 21325, image: oracle@aiserch1 (TNS V1-V3)
*** SESSION ID:(11.13) 2012-02-15 10:33:44.739
Thread checkpoint rba:0x000002.00000002.0010 scn:0x0b2e.f2eb5261
Cache low rba is 0xffffffff.ffffffff.ffff
Use incremental checkpoint on-disk rba
Thread 1 recovery from rba:0x000002.00000003.0000 scn:0x0b2e.f2eb5262
----- Recovery Hash Table Statistics ---------
Hash table buckets = 32768
Longest hash chain = 0
Average hash chain = 0/0 = 0.0
Max compares per lookup = 0
Avg compares per lookup = 0/0 = 0.0
----------------------------------------------
*** 2012-02-15 10:33:44.766
KCRA: start recovery claims for 0 data blocks
*** 2012-02-15 10:33:44.766
KCRA: buffers claimed = 0/0, eliminated = 0
*** 2012-02-15 10:33:44.766
Recovery of Online Redo Log: Thread 1 Group 1 Seq 2 Reading mem 0
----- Recovery Hash Table Statistics ---------
Hash table buckets = 32768
Longest hash chain = 0
Average hash chain = 0/0 = 0.0
Max compares per lookup = 0
Avg compares per lookup = 0/0 = 0.0
----------------------------------------------
Exception signal: 11 (SIGSEGV), code: 1 (Address not mapped to object), addr: 0x43, PC: [0x8880c00, kkdliac()+346]
Registers:
%eax: 0xa0f6b170 %ebx: 0x00000003 %ecx: 0xa0f6b170
%edx: 0x00000001 %edi: 0x00000000 %esi: 0x00000000
%esp: 0xbfff1cb8 %ebp: 0xbfff1cd8 %eip: 0x08880c00
%efl: 0x00010286
  kkdliac()+329 (0x8880bef) jnz 0x8880f61
  kkdliac()+335 (0x8880bf5) mov %edx,%eax
  kkdliac()+337 (0x8880bf7) mov 0xc0(%eax),%edx
  kkdliac()+343 (0x8880bfd) mov %edx,0xffffffe0(%ebp)
> kkdliac()+346 (0x8880c00) movzw 0x40(%ebx),%esi
  kkdliac()+350 (0x8880c04)  mov %si,0xffffffd4(%ebp)
  kkdliac()+354 (0x8880c08) movb 0x42(%ebx),%al
  kkdliac()+357 (0x8880c0b) movb %al,0xffffffd6(%ebp)
  kkdliac()+360 (0x8880c0e) movzw 0x8(%ebx),%edx
*** 2012-02-15 10:33:45.029
ksedmp: internal or fatal error
ORA-07445: exception encountered: core dump [kkdliac()+346] [SIGSEGV] [Address not mapped to object] [0x43] [] []
Current SQL statement for this session:
create table bootstrap$ ( line#         number not null,   obj#           number not null,
sql_text   varchar2(4000) not null)   storage (initial 50K objno 56 extents (file 1 block 377))
----- Call Stack Trace -----
calling              call     entry                argument values in hex
location             type     point                (? means dubious value)
-------------------- -------- -------------------- ----------------------------
ksedmp()+274         call     ksedst()             1 ? 0 ? 0 ? 1 ? 65252838 ?
                                                   2C297862 ?
ssexhd()+1113        call     ksedmp()             3 ? 0 ? 0 ? 0 ? 0 ? 0 ?
__pthread_sighandle  call     00000000             B ? B75CEC90 ? B75CED10 ? 0 ?
r_rt()+122                                         0 ? 0 ?
kkdliac()+346        signal   00000000             B ? B75CEC90 ? B75CED10 ?
ctcdrv()+1688        call     kkdlcob()            BFFF1DC8 ? 2 ? 0 ? 38 ? 0 ?
                                                   0 ? 0 ?
opiexe()+9647        call     ctcdrv()             B749CD78 ? BFFF3258 ?
                                                   BFFF33B0 ?
opiosq0()+1170       call     opiexe()             4 ? 0 ? BFFF379C ?
opiosq()+19          call     opiosq0()            3 ? F ? BFFF4418 ? 0 ?
opiodr()+1133        call     00000000             4A ? F ? BFFF4418 ?
__PGOSF163_rpidrus(  call     opiodr()             4A ? F ? BFFF4418 ? 2 ?
)+145
skgmstack()+137      call     00000000             BFFF3ED0 ? 2 ? BFFF428C ?
                                                   BFFF3EE8 ? BFFF3ED0 ?
                                                   BFFF3EE8 ?
rpidru()+98          call     skgmstack()          BFFF3EE8 ? AF61BC0 ? F618 ?
                                                   821F376 ? BFFF3ED0 ?
rpiswu2()+315        call     00000000             BFFF428C ? 0 ? 0 ? 0 ?
                                                   BFFF3F64 ? F618 ?
rpidrv()+1087        call     rpiswu2()            9D7416FC ? 0 ? BFFF4394 ? 2 ?
                                                   BFFF43B4 ? 0 ?
rpisplu()+298        call     rpidrv()             2 ? 4A ? BFFF4418 ? 8 ?
                                                   9EA3F16C ? B749DE88 ?
rpispl()+28          call     rpisplu()            2 ? 0 ? 0 ? B749DE88 ? BC ?
                                                   0 ? 0 ?
kqlbebs()+781        call     rpispl()             2 ? 0 ? B749DE88 ? BC ? 0 ?
                                                   0 ?
kqlblfc()+106        call     kqlbebs()            0 ? BFFF5590 ?
adbdrv()+2220        call     kqlblfc()            0 ? BFFF5590 ? BFFF5590 ?
opiexe()+10319       call     adbdrv()             B74A022C ? AF5A904 ?
                                                   B74AD040 ? 1 ? 0 ? 1 ?
opiosq0()+1170       call     opiexe()             4 ? 0 ? BFFF6928 ?
kpooprx()+206        call     opiosq0()            3 ? E ? BFFF6A68 ? 24 ?
kpoal8()+599         call     kpooprx()            BFFF7604 ? BFFF7510 ? 13 ?
                                                   1 ? 0 ? 24 ?
opiodr()+1133        call     00000000             5E ? 14 ? BFFF7600 ?
ttcpip()+4250        call     00000000             5E ? 14 ? BFFF7600 ? 0 ?
opitsk()+1077        call     ttcpip()             AF5A900 ? 5E ? BFFF7600 ? 0 ?
                                                   BFFF87D8 ? BFFF87D4 ?
opiino()+1287        call     opitsk()             0 ? 0 ? AF5A900 ? CC349D8 ?
                                                   F1 ? 0 ?
opiodr()+1133        call     00000000             3C ? 4 ? BFFF9B9C ?
opidrv()+418         call     opiodr()             3C ? 4 ? BFFF9B9C ? 0 ?
sou2o()+30           call     opidrv()             3C ? 4 ? BFFF9B9C ?
main()+187           call     sou2o()              BFFF9B80 ? 3C ? 4 ?
                                                   BFFF9B9C ? 890710 ? 0 ?
__libc_start_main()  call     00000000             2 ? BFFF9C04 ? BFFF9C10 ?
+188                                               890518 ? 2 ? 82174E0 ?
--------------------- Binary Stack Dump ---------------------
从这里看出数据库是在open过程中,创建bootstrap$错误,这个错误对于现在的我来说,暂时没有办法去解决。
为了能够抢救出客户需要的其中一个用户下面的数据,我不得不采用odu来解决问题。

4.填写ontrol.txt文件

SQL> set pagesize 1000
SQL> set linesize 200
SQL> col name for a50
SQL> select file#,ts#,rfile#,name from v$datafile;
     FILE#        TS#     RFILE# NAME
---------- ---------- ---------- ----------------------------------------------
         1          0          1 /data1z/oracle/oradata/ahcx216/system01
         2          1          2 /data1z/oracle/oradata/ahcx216/undotbs01
         3          3          3 /data1z/oracle/oradata/ahcx216/CITY
         4          4          4 /data1z/oracle/oradata/ahcx216/DATATS
         5          5          5 /data1z/oracle/oradata/ahcx216/indx01
         6          6          6 /data1z/oracle/oradata/ahcx216/tools01
         7          7          7 /data1z/oracle/oradata/ahcx216/users
         8          4          8 /data1z/oracle/oradata/ahcx216/datats02
         9          4          9 /data1z/oracle/oradata/ahcx216/datats03
      ………………

5.登录odu

bash-2.05b$ ./odu
Oracle Data Unloader:Release 3.0.8
Copyright (c) 2008,2009 XiongJun. All rights reserved.
Web: http://www.laoxiong.net
Email: magic007cn@gmail.com
loading default config.......
byte_order little
block_size  8192
db_timezone -7
client_timezone 8
data_path   data
charset_name ZHS16GBK
ncharset_name AL16UTF16
output_format text
lob_storage infile
clob_byte_order little
load control file 'config.txt' successful
loading default control file ......
 ts#   fn  rfn bsize   blocks bf offset filename
---- ---- ---- ----- -------- -- ------ --------------------------------------------
   0    1    1  8192    32000 N       0 /data1z/oracle/oradata/ahcx216/system01
   1    2    2  8192   524288 N       0 /data1z/oracle/oradata/ahcx216/undotbs01
   3    3    3  8192   524288 N       0 /data1z/oracle/oradata/ahcx216/CITY
   4    4    4  8192   524288 N       0 /data1z/oracle/oradata/ahcx216/DATATS
   5    5    5  8192   524288 N       0 /data1z/oracle/oradata/ahcx216/indx01
………………
load control file 'control.txt' successful
loading dictionary data......

6.加载数据字典

ODU> unload dict
CLUSTER C_USER# file_no: 1 block_no: 89
TABLE OBJ$ file_no: 1 block_no: 121
CLUSTER C_OBJ# file_no: 1 block_no: 25
CLUSTER C_OBJ# file_no: 1 block_no: 25
found IND$'s obj# 19
found IND$'s dataobj#:2,ts#:0,file#:1,block#:25,tab#:3
found TABPART$'s obj# 230
found TABPART$'s dataobj#:230,ts#:0,file#:1,block#:1657,tab#:0
found INDPART$'s obj# 234
found INDPART$'s dataobj#:234,ts#:0,file#:1,block#:1689,tab#:0
found TABSUBPART$'s obj# 240
found TABSUBPART$'s dataobj#:240,ts#:0,file#:1,block#:1737,tab#:0
found INDSUBPART$'s obj# 245
found INDSUBPART$'s dataobj#:245,ts#:0,file#:1,block#:1777,tab#:0
found IND$'s obj# 19
found IND$'s dataobj#:2,ts#:0,file#:1,block#:25,tab#:3
found LOB$'s obj# 156
found LOB$'s dataobj#:2,ts#:0,file#:1,block#:25,tab#:6
found LOBFRAG$'s obj# 258
found LOBFRAG$'s dataobj#:258,ts#:0,file#:1,block#:1881,tab#:0

7.列出用户

ODU> list user
     USER#   USERNAME
----------   ------------------------------
       …………
        20   HS_ADMIN_ROLE
        25   MAS_ADMIN
        24   HF_CX
        21   WMSYS
        22   WM_ADMIN_ROLE
        23   CITY
        26   BB_ADMIN
        27   AQ_ADMIN
        28   WH_ADMIN
        29   LA_ADMIN
       …………

8.列出用户表

ODU> list table TL_ADMIN
      OBJ#   OBJECT_NAME
----------   ------------------------------
   2286779   WT_MX_201005
     32309   BD_DEALER_308
    126172   CDMA_FAVOUR_BAOYUE
     79675   DAISHENG_TMP
     52634   RYSJ_T_308
     25577   FEE_ID_T
    931167   A136_20080304
   1514084   WANGTONG_MOKUAI_2009
………………

10.导出用户下表

ODU> unload user TL_ADMIN
Unloading user TL_ADMIN's tables.
Unloading table: WT_MX_201005,object ID: 2286779
Unloading segment,storage(Obj#=2286779 DataObj#=2286779 TS#=3 File#=31 Block#=8571 Cluster=0)
25205 rows unloaded
Unloading table: BD_DEALER_308,object ID: 32309
Unloading segment,storage(Obj#=32309 DataObj#=32309 TS#=3 File#=31 Block#=17587 Cluster=0)
60 rows unloaded
Unloading table: CDMA_FAVOUR_BAOYUE,object ID: 126172
Unloading segment,storage(Obj#=126172 DataObj#=126172 TS#=3 File#=3 Block#=30899 Cluster=0)
31 rows unloaded
Unloading table: DAISHENG_TMP,object ID: 79675
Unloading segment,storage(Obj#=79675 DataObj#=342004 TS#=3 File#=31 Block#=19451 Cluster=0)
7504 rows unloaded
…………………………

11.查看导出来数据

-bash-2.05b$ ls -l
-rw-r--r--    1 oracle   dba           658  2月 15 08:43 TL_ADMIN_AMORTIZE.ctl
-rw-r--r--    1 oracle   dba           763  2月 15 08:43 TL_ADMIN_AMORTIZE_HM_COPY.ctl
-rw-r--r--    1 oracle   dba           683  2月 15 08:43 TL_ADMIN_AMORTIZE_HM_COPY.sql
-rw-r--r--    1 oracle   dba         45813  2月 15 08:43 TL_ADMIN_AMORTIZE_HM_COPY.txt
-rw-r--r--    1 oracle   dba           748  2月 15 08:43 TL_ADMIN_AMORTIZE_HM.ctl
-rw-r--r--    1 oracle   dba           686  2月 15 08:43 TL_ADMIN_AMORTIZE_HM.sql
-rw-r--r--    1 oracle   dba        263046  2月 15 08:43 TL_ADMIN_AMORTIZE_HM.txt
-rw-r--r--    1 oracle   dba           777  2月 15 08:43 TL_ADMIN_AMORTIZE_ID.ctl
-rw-r--r--    1 oracle   dba           696  2月 15 08:43 TL_ADMIN_AMORTIZE_ID.sql
……………………………………

12.创建表脚本

-bash-2.05b$ ls -l *.sql
-rw-r--r--    1 oracle   dba           312  2月 15 08:43 TL_ADMIN_A136_20080304.sql
-rw-r--r--    1 oracle   dba           683  2月 15 08:43 TL_ADMIN_AMORTIZE_HM_COPY.sql
-rw-r--r--    1 oracle   dba           686  2月 15 08:43 TL_ADMIN_AMORTIZE_HM.sql
-rw-r--r--    1 oracle   dba           696  2月 15 08:43 TL_ADMIN_AMORTIZE_ID.sql
-rw-r--r--    1 oracle   dba           147  2月 15 08:44 TL_ADMIN_AMORTIZE_OWE.sql
………………
复制这些文件列表,使用UltraEdit编辑文件(recover_create_tab.sql),生成如下脚本
@@TL_ADMIN_A136_20080304.sql
@@TL_ADMIN_AMORTIZE_HM_COPY.sql
@@TL_ADMIN_AMORTIZE_HM.sql
@@TL_ADMIN_AMORTIZE_ID.sql
@@TL_ADMIN_AMORTIZE_OWE.sql
@@TL_ADMIN_AMORTIZE_PAY.sql
然后使用sqlplus登录数据库,直接执行recover_create_tab.sql,创建了所有需要的表

13.加载数据脚本

-bash-2.05b$ ls -l *.ctl
-rw-r--r--    1 oracle   dba           507  2月 15 08:43 TL_ADMIN_A136_20080304.ctl
-rw-r--r--    1 oracle   dba           658  2月 15 08:43 TL_ADMIN_AMORTIZE.ctl
-rw-r--r--    1 oracle   dba           763  2月 15 08:43 TL_ADMIN_AMORTIZE_HM_COPY.ctl
-rw-r--r--    1 oracle   dba           748  2月 15 08:43 TL_ADMIN_AMORTIZE_HM.ctl
-rw-r--r--    1 oracle   dba           777  2月 15 08:43 TL_ADMIN_AMORTIZE_ID.ctl
-rw-r--r--    1 oracle   dba           344  2月 15 08:44 TL_ADMIN_AMORTIZE_OWE.ctl
-rw-r--r--    1 oracle   dba           342  2月 15 08:43 TL_ADMIN_AMORTIZE_PAY.ctl
也同样使用UltraEdit出来,生成文件(recover_load_data.sh)
sqlldr TL_ADMIN/password  control= TL_ADMIN_A136_20080304.ctl
sqlldr TL_ADMIN/password  control= TL_ADMIN_AMORTIZE.ctl
sqlldr TL_ADMIN/password  control= TL_ADMIN_AMORTIZE_HM_COPY.ctl
sqlldr TL_ADMIN/password  control= TL_ADMIN_AMORTIZE_HM.ctl
sqlldr TL_ADMIN/password  control= TL_ADMIN_AMORTIZE_ID.ctl
sqlldr TL_ADMIN/password  control= TL_ADMIN_AMORTIZE_OWE.ctl
sqlldr TL_ADMIN/password  control= TL_ADMIN_AMORTIZE_PAY.ctl
sqlldr TL_ADMIN/password  control= TL_ADMIN_BD_DEALER_308.ctl
sqlldr TL_ADMIN/password  control= TL_ADMIN_BRXZ.ctl
然后在shell中执行recover_load_data.sh脚本导入数据,至此数据恢复完成

注意:recover_create_tab.sql和recover_load_data.sh需要在当前抽取出来数据的目录中。

使用bbed解决ORA-00600[2662]

联系:手机/微信(+86 17813235971) QQ(107644445)

标题:使用bbed解决ORA-00600[2662]

作者:惜分飞©版权所有[未经本人同意,不得以任何形式转载,否则有进一步追究法律责任的权利.]

一、数据库启动报ORA-00600[2662]

[oracle@node1 ora11g]$ sqlplus / as sysdba
SQL*Plus: Release 11.2.0.3.0 Production on Thu Dec 22 14:37:00 2011
Copyright (c) 1982, 2011, Oracle.  All rights reserved.
Connected to an idle instance.
SQL> startup
ORACLE instance started.
Total System Global Area 2137886720 bytes
Fixed Size                  2230072 bytes
Variable Size            1493174472 bytes
Database Buffers          637534208 bytes
Redo Buffers                4947968 bytes
Database mounted.
ORA-01092: ORACLE instance terminated. Disconnection forced
ORA-00600: internal error code, arguments: [2662], [2], [2147510731], [2],
[2164287937], [4194432], [], [], [], [], [], []
Process ID: 16829
Session ID: 96 Serial number: 3

二.alert日志错误显示

Thu Dec 22 14:37:09 2011
ALTER DATABASE OPEN
LGWR: STARTING ARCH PROCESSES
Thu Dec 22 14:37:09 2011
ARC0 started with pid=20, OS id=16831
ARC0: Archival started
LGWR: STARTING ARCH PROCESSES COMPLETE
ARC0: STARTING ARCH PROCESSES
Thu Dec 22 14:37:10 2011
ARC1 started with pid=21, OS id=16833
Thu Dec 22 14:37:10 2011
ARC2 started with pid=22, OS id=16835
Thu Dec 22 14:37:10 2011
ARC3 started with pid=23, OS id=16837
ARC1: Archival started
ARC2: Archival started
ARC2: Becoming the 'no FAL' ARCH
ARC2: Becoming the 'no SRL' ARCH
ARC1: Becoming the heartbeat ARCH
Thread 1 opened at log sequence 17
  Current log# 2 seq# 17 mem# 0: /opt/oracle/oradata/ora11g/redo02.log
Successful open of redo thread 1
MTTR advisory is disabled because FAST_START_MTTR_TARGET is not set
SMON: enabling cache recovery
Errors in file /opt/oracle/diag/rdbms/ora11g/ora11g/trace/ora11g_ora_16829.trc  (incident=36156):
ORA-00600: internal error code, arguments: [2662], [2], [2147510731], [2], [2164287937], [4194432], [], [], [], [], [], []
Incident details in: /opt/oracle/diag/rdbms/ora11g/ora11g/incident/incdir_36156/ora11g_ora_16829_i36156.trc
ARC3: Archival started
ARC0: STARTING ARCH PROCESSES COMPLETE
Use ADRCI or Support Workbench to package the incident.
See Note 411.1 at My Oracle Support for error and packaging details.
Errors in file /opt/oracle/diag/rdbms/ora11g/ora11g/trace/ora11g_ora_16829.trc  (incident=36157):
ORA-00600: internal error code, arguments: [2662], [2], [2147510731], [2], [2164287937], [4194432], [], [], [], [], [], []
Incident details in: /opt/oracle/diag/rdbms/ora11g/ora11g/incident/incdir_36157/ora11g_ora_16829_i36157.trc
Dumping diagnostic data in directory=[cdmp_20111222143713], requested by (instance=1, osid=16829), summary=[incident=36156].
Use ADRCI or Support Workbench to package the incident.
See Note 411.1 at My Oracle Support for error and packaging details.
Undo initialization errored: err:600 serial:0 start:176607884 end:176611234 diff:3350 (33 seconds)
Errors in file /opt/oracle/diag/rdbms/ora11g/ora11g/trace/ora11g_ora_16829.trc:
ORA-00600: internal error code, arguments: [2662], [2], [2147510731], [2], [2164287937], [4194432], [], [], [], [], [], []
Errors in file /opt/oracle/diag/rdbms/ora11g/ora11g/trace/ora11g_ora_16829.trc:
ORA-00600: internal error code, arguments: [2662], [2], [2147510731], [2], [2164287937], [4194432], [], [], [], [], [], []
Error 600 happened during db open, shutting down database
USER (ospid: 16829): terminating the instance due to error 600
Instance terminated by USER, pid = 16829
ORA-1092 signalled during: ALTER DATABASE OPEN...
opiodr aborting process unknown ospid (16829) as a result of ORA-1092
Thu Dec 22 14:37:15 2011
ORA-1092 : opitsk aborting process

三.分析日志
ORA-00600[2662]主要参数说明见:ORA-00600 [2662]
这里补充说明:e表示出现异常问题的数据块的DBA,这里的4194432就是一个数据块的DBA

--通过DBA地址查询数据块和文件号
SQL> select dbms_utility.data_block_address_block(4194432) "blick",
  2    dbms_utility.data_block_address_file(4194432) "file" from dual;
     blick       file
---------- ----------
       128          1
--当前数据库SCN
SQL> select to_char(2147510731,'xxxxxxxxxxx') from dual;
TO_CHAR(2147
------------
    800069cb
--当前数据块SCN
SQL> select to_char(2164287937,'xxxxxxxxxxx') from dual;
TO_CHAR(2164
------------
    810069c1

四.bbed查看相关SCN

[oracle@node1 ora11g]$ bbed
Password:
BBED-00113: Invalid password. Please rerun utility with the correct password.
[oracle@node1 ora11g]$ bbed
Password:
BBED: Release 2.0.0.0.0 - Limited Production on Thu Dec 22 14:49:24 2011
Copyright (c) 1982, 2011, Oracle and/or its affiliates.  All rights reserved.
************* !!! For Oracle Internal Use only !!! ***************
BBED> set filename "/opt/oracle/oradata/ora11g/system01.dbf"
        FILENAME        /opt/oracle/oradata/ora11g/system01.dbf
BBED> set block 1
        BLOCK#          1
BBED> p kcvfhckp
struct kcvfhckp, 36 bytes                   @484
   struct kcvcpscn, 8 bytes                 @484
      ub4 kscnbas                           @484      0x800069c8
      ub2 kscnwrp                           @488      0x0002
   ub4 kcvcptim                             @492      0x2dedee96
   ub2 kcvcpthr                             @496      0x0001
   union u, 12 bytes                        @500
      struct kcvcprba, 12 bytes             @500
         ub4 kcrbaseq                       @500      0x00000011
         ub4 kcrbabno                       @504      0x0000210f
         ub2 kcrbabof                       @508      0x0010
   ub1 kcvcpetb[0]                          @512      0x02
   ub1 kcvcpetb[1]                          @513      0x00
   ub1 kcvcpetb[2]                          @514      0x00
   ub1 kcvcpetb[3]                          @515      0x00
   ub1 kcvcpetb[4]                          @516      0x00
   ub1 kcvcpetb[5]                          @517      0x00
   ub1 kcvcpetb[6]                          @518      0x00
   ub1 kcvcpetb[7]                          @519      0x00
BBED> set block 128
        BLOCK#          128
BBED> p bas_kcbh
ub4 bas_kcbh                                @8        0x810069c1
BBED> p wrp_kcbh
ub2 wrp_kcbh                                @12       0x0002

这里看到的SCN(16进制)和我们在alert日志中看到的有一定的出入原因是在数据库启动的时候,当前SCN增加了,但是因为数据库直接abort,没有写入到数据文件中。导致数据文件头部的SCN比alert中显示的稍微小一点(还有可能,系统当前的scn比system01.dbf的scn大一点)。通过对比数据块和数据文件头部的SCN也可以说明当数据块的SCN>数据块当前SCN导致ORA-00600[2662]

五.bbed修改数据块的SCN

BBED> set offset 8
        OFFSET          8
BBED> m /x c8690080
BBED-00215: editing not allowed in BROWSE mode
BBED> set mode edit
        MODE            Edit
BBED> m /x c8690080
BBED-00209: invalid number (c8690080)
--分开修改,曲线救国策略
BBED> m /x c869
Warning: contents of previous BIFILE will be lost. Proceed? (Y/N) y
 File: /opt/oracle/oradata/ora11g/system01.dbf (0)
 Block: 128              Offsets:    8 to  519           Dba:0x00000000
------------------------------------------------------------------------
 c8690081 02000104 2f8f0000 00000000 00000000 00000000 00000000 06000000
 2f000000 20100000 00000000 00000000 07000000 81004000 00000000 00000000
 00000000 00000000 00000000 00000000 00000000 06000000 00000000 00000000
 00000040 81004000 07000000 88004000 08000000 10024000 08000000 18024000
 08000000 20024000 08000000 28024000 08000000 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 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> set offset +2
        OFFSET          10
BBED> m /x 0080
 File: /opt/oracle/oradata/ora11g/system01.dbf (0)
 Block: 128              Offsets:   10 to  521           Dba:0x00000000
------------------------------------------------------------------------
 00800200 01042f8f 00000000 00000000 00000000 00000000 00000600 00002f00
 00002010 00000000 00000000 00000700 00008100 40000000 00000000 00000000
 00000000 00000000 00000000 00000000 00000600 00000000 00000000 00000000
 00408100 40000700 00008800 40000800 00001002 40000800 00001802 40000800
 00002002 40000800 00002802 40000800 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
 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> p tailchk
ub4 tailchk                                 @8188     0x69c10e01
BBED> set offset 8188
        OFFSET          8188
BBED> m /x 010ec869
 File: /opt/oracle/oradata/ora11g/system01.dbf (0)
 Block: 128              Offsets: 8188 to 8191           Dba:0x00000000
------------------------------------------------------------------------
 010ec869
 <32 bytes per line>
BBED> p tailchk
ub4 tailchk                                 @8188     0x69c80e01
BBED> p bas_kcbh
ub4 bas_kcbh                                @8        0x800069c8
BBED> sum apply
Check value for File 0, Block 128:
current = 0x8e2f, required = 0x8e2f
BBED> exit

六.启动数据库

[oracle@node1 ora11g]$ sqlplus / as sysdba
SQL*Plus: Release 11.2.0.3.0 Production on Thu Dec 22 14:58:10 2011
Copyright (c) 1982, 2011, Oracle.  All rights reserved.
Connected to an idle instance.
SQL> startup
ORACLE instance started.
Total System Global Area 2137886720 bytes
Fixed Size                  2230072 bytes
Variable Size            1493174472 bytes
Database Buffers          637534208 bytes
Redo Buffers                4947968 bytes
Database mounted.
Database opened.

七.补充说明
一般遇到ORA-00600[2662]都是使用alter session set events ‘10015 trace name adjust_scn level N’;方法处理,但是有时候会遇到ORA-01031错误,那就需要请bbed帮忙处理

OS Pid: 30268 executed alter session set events '10051 trace name adjust_scn level 2'
Thu Dec 22 12:04:07 2011
Errors in file /ora101/diag/rdbms/ora11/ora11/trace/ora11_ora_30268.trc:
ORA-01031: insufficient privileges
Thu Dec 22 12:04:43 2011
Errors in file /ora101/diag/rdbms/ora11/ora11/trace/ora11_ora_846.trc:
ORA-01031: insufficient privileges

ORA-00600 [ktbdchk1: bad dscn] 解决

联系:手机/微信(+86 17813235971) QQ(107644445)

标题:ORA-00600 [ktbdchk1: bad dscn] 解决

作者:惜分飞©版权所有[未经本人同意,不得以任何形式转载,否则有进一步追究法律责任的权利.]

启动数据库报错
SQL> startup
ORACLE instance started.
Total System Global Area  167772160 bytes
Fixed Size                  1260720 bytes
Variable Size             150995792 bytes
Database Buffers            8388608 bytes
Redo Buffers                7127040 bytes
Database mounted.
ORA-01092: ORACLE instance terminated. Disconnection forced
alert.log导错
Wed Aug 10 12:31:11 2011
Errors in file /u01/admin/xienfei/udump/xff_ora_8568.trc:
ORA-00600: internal error code, arguments: [ktbdchk1: bad dscn], [], [], [], [], [], [], []
xff_ora_8568.trc内容
[ktbdchk] -- readers_dsz -- bad dscn
scn: 0x0000.b1e60c00scn: 0x0000.0011fca1
*** 2011-08-10 12:31:11.998
ksedmp: internal or fatal error
ORA-00600: internal error code, arguments: [ktbdchk1: bad dscn], [], [], [], [], [], [], []
Current SQL statement for this session:
select ctime, mtime, stime from obj$ where obj# = :1
根据上面错误判断,错误的scn为b1e60c00,不是整个数据文件的scn错误
而应该是一个对象的scn错误,所以继续在xff_ora_8568.trc文件中查找b1e60c00
找到结果如下:
Block header dump:  0x0040007a
 Object id on Block? Y
 seg/obj: 0x12  csc: 0x00.b1e60c00  itc: 1  flg: -  typ: 1 - DATA
     fsl: 0  fnx: 0x0 ver: 0x01
 Itl           Xid                  Uba         Flag  Lck        Scn/Fsc
0x01   0x0008.02a.000001d9  0x00802341.01bb.04  ----    1  fsc 0x0000.0011ae7c
data_block_dump,data header at 0x20fd6044
===============
tsiz: 0x1fb8
hsiz: 0xea
pbl: 0x20fd6044
bdba: 0x0040007a
     76543210
flag=--------
ntab=1
nrow=108
frre=-1
fsbo=0xea
fseo=0x453
avsp=0x369
tosp=0x369
0xe:pti[0]      nrow=108        offs=0
根据这个提示,发现dba为:0040007a的对象异常,查找对应的file_id,block
SQL> SELECT DBMS_UTILITY.data_block_address_file (TO_NUMBER ('40007a', 'XXXXXXXX')) file_id,
  2          DBMS_UTILITY.data_block_address_block (TO_NUMBER ('40007a', 'XXXXXXXX')) block_id
  3    FROM DUAL;
   FILE_ID   BLOCK_ID
---------- ----------
         1        122
使用bbed查看file=1,block=122的scn情况
BBED> p ktbbh
struct ktbbh, 48 bytes                      @20
   ub1 ktbbhtyp                             @20       0x01 (KDDBTDATA)
   union ktbbhsid, 4 bytes                  @24
      ub4 ktbbhsg1                          @24       0x00000012
      ub4 ktbbhod1                          @24       0x00000012
   struct ktbbhcsc, 8 bytes                 @28
      ub4 kscnbas                           @28       0xb1e60c00
      ub2 kscnwrp                           @32       0x0000
   b2 ktbbhict                              @36       1
   ub1 ktbbhflg                             @38       0x02 (NONE)
   ub1 ktbbhfsl                             @39       0x00
   ub4 ktbbhfnx                             @40       0x00000000
   struct ktbbhitl[0], 24 bytes             @44
      struct ktbitxid, 8 bytes              @44
         ub2 kxidusn                        @44       0x0008
         ub2 kxidslt                        @46       0x002a
         ub4 kxidsqn                        @48       0x000001d9
      struct ktbituba, 8 bytes              @52
         ub4 kubadba                        @52       0x00802341
         ub2 kubaseq                        @56       0x01bb
         ub1 kubarec                        @58       0x04
      ub2 ktbitflg                          @60       0x0001 (NONE)
      union _ktbitun, 2 bytes               @62
         b2 _ktbitfsc                       @62       0
         ub2 _ktbitwrp                      @62       0x0000
      ub4 ktbitbas                          @64       0x0011ae7c
果然发现scn为0xb1e60c00,现在把其修改为:0x00124ac6(注意规则,一般linux下都是倒序)
BBED> set offset 28
        OFFSET          28
BBED> m /x c64a1200
BBED-00209: invalid number (c64a1200)
小技巧,一次性修改报错,尝试一次修改一点
BBED> m /x c64a
 File: /u01/oradata/xienfei/system01.dbf (0)
 Block: 122              Offsets:   28 to   43           Dba:0x00000000
------------------------------------------------------------------------
 c64ae6b1 00000000 01000200 00000000
 <32 bytes per line>
BBED> set offset +2
        OFFSET          30
BBED> m /x 1200
 File: /u01/oradata/xienfei/system01.dbf (0)
 Block: 122              Offsets:   30 to   45           Dba:0x00000000
------------------------------------------------------------------------
 12000000 00000100 02000000 00000800
 <32 bytes per line>
BBED> set offset -2
        OFFSET          28
BBED> dump
 File: /u01/oradata/xienfei/system01.dbf (0)
 Block: 122              Offsets:   28 to   43           Dba:0x00000000
------------------------------------------------------------------------
 c64a1200 00000000 01000200 00000000
 <32 bytes per line>
BBED> sum apply
Check value for File 0, Block 122:
current = 0x3a4e, required = 0x3a4e
SQL> startup
ORACLE instance started.
Total System Global Area  167772160 bytes
Fixed Size                  1260720 bytes
Variable Size             150995792 bytes
Database Buffers            8388608 bytes
Redo Buffers                7127040 bytes
Database mounted.
Database opened.

bbed 修改datafile header

联系:手机/微信(+86 17813235971) QQ(107644445)

标题:bbed 修改datafile header

作者:惜分飞©版权所有[未经本人同意,不得以任何形式转载,否则有进一步追究法律责任的权利.]

SQL> startup
ORACLE instance started.
Total System Global Area  236000356 bytes
Fixed Size                   451684 bytes
Variable Size             201326592 bytes
Database Buffers           33554432 bytes
Redo Buffers                 667648 bytes
Database mounted.
ORA-01113: file 2 needs media recovery
ORA-01110: data file 2: '/opt/oracle/oradata/xifenfei/xff01.dbf'
提示数据文件2需要恢复,首选是recover datafile 2;,如果失败,可以考虑bbed修改scn的办法
SQL> select file#,to_char(checkpoint_change#,'999999999999') from v$datafile;
     FILE# TO_CHAR(CHECK
---------- -------------
         1  107374278108
         2  107374278108
         3  107374278108
         4  107374278108
         5  107374278108
         6  107374278108
         7  107374278108
         8  107374278108
         9  107374278108
        10  107374278108
        11  107374278108
11 rows selected.
SQL> select file#,online_status,to_char(change#,'999999999999') from v$recover_file;
     FILE# ONLINE_ TO_CHAR(CHANG
---------- ------- -------------
         2 ONLINE   107374277136
[oracle@localhost tmp]$ bbed parfile=/tmp/parfile.cnf
Password:
BBED: Release 2.0.0.0.0 - Limited Production on Mon Aug 22 06:05:34 2011
Copyright (c) 1982, 2002, Oracle Corporation.  All rights reserved.
************* !!! For Oracle Internal Use only !!! ***************
BBED> info
 File#  Name                                                        Size(blks)
 -----  ----                                                        ----------
     1  /opt/oracle/oradata/xifenfei/system01.dbf                         1280
     2  /opt/oracle/oradata/xifenfei/xff01.dbf                            1280
BBED> set dba 1,1
        DBA             0x00400001 (4194305 1,1)
BBED> p kcvfhckp
struct kcvfhckp, 36 bytes                   @140
   struct kcvcpscn, 8 bytes                 @140
*    ub4 kscnbas                           @140      0x000175dc
      ub2 kscnwrp                           @144      0x0019
* ub4 kcvcptim                             @148      0x2d49fbbb
   ub2 kcvcpthr                             @152      0x0001
   union u, 12 bytes                        @156
      struct kcvcprba, 12 bytes             @156
         ub4 kcrbaseq                       @156      0x00000005
         ub4 kcrbabno                       @160      0x00008e05
         ub2 kcrbabof                       @164      0x0010
      struct kcvcptr, 12 bytes              @156
         struct kcrtrscn, 8 bytes           @156
            ub4 kscnbas                     @156      0x00000005
            ub2 kscnwrp                     @160      0x8e05
         ub4 kcrtrtim                       @164      0x09110010
   ub1 kcvcpetb[0]                          @168      0x02
   ub1 kcvcpetb[1]                          @169      0x00
   ub1 kcvcpetb[2]                          @170      0x00
   ub1 kcvcpetb[3]                          @171      0x00
   ub1 kcvcpetb[4]                          @172      0x00
   ub1 kcvcpetb[5]                          @173      0x00
   ub1 kcvcpetb[6]                          @174      0x00
   ub1 kcvcpetb[7]                          @175      0x00
BBED> p kcvfhcpc
*ub4 kcvfhcpc                                @176      0x0000007a
BBED> p kcvfhccc
*ub4 kcvfhccc                                @184      0x00000079
星号表示使用bbed修改datafile header scn需要考虑的地方
SQL> select to_char(to_number('19000175dc','xxxxxxxxxxxx'),'999999999999') from dual;
TO_CHAR(TO_NU
-------------
 107374278108
证实system01.dbf的scn为107374278108和v$datafile查询到的一致
BBED> set dba 2,1
        DBA             0x00800001 (8388609 2,1)
BBED> p kcvfhckp
struct kcvfhckp, 36 bytes                   @140
   struct kcvcpscn, 8 bytes                 @140
      ub4 kscnbas                           @140      0x00017210
      ub2 kscnwrp                           @144      0x0019
   ub4 kcvcptim                             @148      0x2d49fa27
   ub2 kcvcpthr                             @152      0x0001
   union u, 12 bytes                        @156
      struct kcvcprba, 12 bytes             @156
         ub4 kcrbaseq                       @156      0x00000005
         ub4 kcrbabno                       @160      0x00006f18
         ub2 kcrbabof                       @164      0x0010
      struct kcvcptr, 12 bytes              @156
         struct kcrtrscn, 8 bytes           @156
            ub4 kscnbas                     @156      0x00000005
            ub2 kscnwrp                     @160      0x6f18
         ub4 kcrtrtim                       @164      0x09110010
   ub1 kcvcpetb[0]                          @168      0x02
   ub1 kcvcpetb[1]                          @169      0x00
   ub1 kcvcpetb[2]                          @170      0x00
   ub1 kcvcpetb[3]                          @171      0x00
   ub1 kcvcpetb[4]                          @172      0x00
   ub1 kcvcpetb[5]                          @173      0x00
   ub1 kcvcpetb[6]                          @174      0x00
   ub1 kcvcpetb[7]                          @175      0x00
BBED> p kcvfhcpc
ub4 kcvfhcpc                                @176      0x00000034
BBED> p kcvfhccc
ub4 kcvfhccc                                @184      0x00000033
SQL> select to_char(to_number('1900017210','xxxxxxxxxxxx'),'999999999999') from dual;
TO_CHAR(TO_NU
-------------
 107374277136
和v$recover_file视图中查询出来一致
BBED> set dba 2,1 offset 140
        DBA             0x00800001 (8388609 2,1)
        OFFSET          140
BBED> show
        FILE#           2
        BLOCK#          1
        OFFSET          140
        DBA             0x00800001 (8388609 2,1)
        FILENAME        /opt/oracle/oradata/xifenfei/xff01.dbf
        BIFILE          bifile.bbd
        LISTFILE        /tmp/list
        BLOCKSIZE       8192
        MODE            Edit
        EDIT            Unrecoverable
        IBASE           Dec
        OBASE           Dec
        WIDTH           80
        COUNT           32
        LOGFILE         log.bbd
        SPOOL           No
BBED> m /x dc750100
 File: /opt/oracle/oradata/xifenfei/xff01.dbf (2)
 Block: 1                Offsets:  140 to  171           Dba:0x00800001
------------------------------------------------------------------------
 dc750100 19000000 27fa492d 01000000 05000000 186f0000 10001109 02000000
 <32 bytes per line>
BBED> m /x bbfb492d offset 158
 File: /opt/oracle/oradata/xifenfei/xff01.dbf (2)
 Block: 1                Offsets:  158 to  189           Dba:0x00800001
------------------------------------------------------------------------
 bbfb492d 00001000 11090200 00000000 00003400 00004cc0 492d3300 00000000
 <32 bytes per line>
BBED> m /x 7a000000 offset 176
 File: /opt/oracle/oradata/xifenfei/xff01.dbf (2)
 Block: 1                Offsets:  176 to  207           Dba:0x00800001
------------------------------------------------------------------------
 7a000000 4cc0492d 33000000 00000000 00000000 00000000 00000000 00000000
 <32 bytes per line>
BBED> m /x 79000000 offset 184
 File: /opt/oracle/oradata/xifenfei/xff01.dbf (2)
 Block: 1                Offsets:  184 to  215           Dba:0x00800001
------------------------------------------------------------------------
 79000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
 <32 bytes per line>
注意:p打印出来的值和m修改的值可能不是完全一致(和cpu的计算类型有关,常用的intel cpu中是倒序存储),可以选择先dump正确的相关值,然后m修改
如:p打印出来的值为:80084d1f时,m修改时要为: 1f4d0880
BBED> sum apply dba 2,1
Check value for File 2, Block 1:
current = 0x7ece, required = 0x7ece
SQL> shutdown immediate
ORA-01109: database not open
Database dismounted.
ORACLE instance shut down.
SQL> startup
ORACLE instance started.
Total System Global Area  236000356 bytes
Fixed Size                   451684 bytes
Variable Size             201326592 bytes
Database Buffers           33554432 bytes
Redo Buffers                 667648 bytes
Database mounted.
ORA-01122: database file 2 failed verification check
ORA-01110: data file 2: '/opt/oracle/oradata/xifenfei/xff01.dbf'
ORA-01207: file is more recent than controlfile - old controlfile
提示控制文件太老,需要重建控制文件
SQL> shutdown abort
ORACLE instance shut down.
SQL> STARTUP NOMOUNT
CREATE CONTROLFILE REUSE DATABASE "XIFENFEI" NORESETLOGS  ARCHIVELOG
    MAXLOGFILES 50
    MAXLOGMEMBERS 5
    MAXDATAFILES 100
    MAXINSTANCES 1
    MAXLOGHISTORY 226
LOGFILE
  GROUP 1 '/opt/oracle/oradata/xifenfei/redo01.log'  SIZE 100M,
  GROUP 2 '/opt/oracle/oradata/xifenfei/redo02.log'  SIZE 100M,
  GROUP 3 '/opt/oracle/oradata/xifenfei/redo03.log'  SIZE 100M
DATAFILE
  '/opt/oracle/oradata/xifenfei/system01.dbf',
  '/opt/oracle/oradata/xifenfei/xff01.dbf',
  '/opt/oracle/oradata/xifenfei/cwmlite01.dbf',
  '/opt/oracle/oradata/xifenfei/drsys01.dbf',
  '/opt/oracle/oradata/xifenfei/example01.dbf',
  '/opt/oracle/oradata/xifenfei/indx01.dbf',
  '/opt/oracle/oradata/xifenfei/odm01.dbf',
  '/opt/oracle/oradata/xifenfei/tools01.dbf',
  '/opt/oracle/oradata/xifenfei/users01.dbf',
  '/opt/oracle/oradata/xifenfei/xdb01.dbf',
  '/opt/oracle/oradata/xifenfei/UNDOTBS01.dbf'
CHARACTER SET ZHS16GBK
;
ORACLE instance started.
Total System Global Area  236000356 bytes
Fixed Size                   451684 bytes
Variable Size             201326592 bytes
Database Buffers           33554432 bytes
Redo Buffers                 667648 bytes
SQL>   2    3    4    5    6    7    8    9   10   11   12   13   14   15   16   17   18   19   20
Control file created.
SQL> alter database open;
Database altered.
SQL> ALTER TABLESPACE TEMP ADD TEMPFILE '/opt/oracle/oradata/xifenfei/temp01.dbf'
  2       SIZE 32505856  REUSE AUTOEXTEND ON NEXT 655360  MAXSIZE 32767M;
重建控制文件后,需要添加临时文件

补充说明:
1、datafile 的file header 存储在第一个block里
2、Oracle considers four attributes of this data structure when determining if a datafile is sync with the other data files of the database:(不同oracle版本offset可能不同)
(1)kscnbas (at offset 140) – SCN of last change to the datafile.
(2)kcvcptim (at offset 148) -Time of the last change to the datafile.
(3)kcvfhcpc (at offset 176) – Checkpoint count.
(4)kcvfhccc (at offset 184) – Unknown, but is always 1 less than thecheckpoint point count.
Oracle有4个属性来判断datafile 是否和其他的datafile 一致,如果都一致,可以正常操作,如果不一致,那么会报ORA-01113错误

通过bbed查看数据块结构

联系:手机/微信(+86 17813235971) QQ(107644445)

标题:通过bbed查看数据块结构

作者:惜分飞©版权所有[未经本人同意,不得以任何形式转载,否则有进一步追究法律责任的权利.]

BBED> map /v
 File: /opt/oracle/oradata/xifenfei/xff01.dbf (2)
 Block: 530                                   Dba:0x00800212
------------------------------------------------------------
 KTB Data Block (Table/Cluster)
 struct kcbh, 20 bytes                      @0
    ub1 type_kcbh                           @0
    ub1 frmt_kcbh                           @1
    ub1 spare1_kcbh                         @2
    ub1 spare2_kcbh                         @3
    ub4 rdba_kcbh                           @4
    ub4 bas_kcbh                            @8
    ub2 wrp_kcbh                            @12
    ub1 seq_kcbh                            @14
    ub1 flg_kcbh                            @15
    ub2 chkval_kcbh                         @16
    ub2 spare3_kcbh                         @18
 struct ktbbh, 72 bytes                     @20
    ub1 ktbbhtyp                            @20
    union ktbbhsid, 4 bytes                 @24
    struct ktbbhcsc, 8 bytes                @28
    b2 ktbbhict                             @36
    ub1 ktbbhflg                            @38
    ub1 ktbbhfsl                            @39
    ub4 ktbbhfnx                            @40
    struct ktbbhitl[2], 48 bytes            @44
 struct kdbh, 14 bytes                      @92
    ub1 kdbhflag                            @92
    b1 kdbhntab                             @93
    b2 kdbhnrow                             @94
    sb2 kdbhfrre                            @96
    sb2 kdbhfsbo                            @98
    sb2 kdbhfseo                            @100
    b2 kdbhavsp                             @102
    b2 kdbhtosp                             @104
 struct kdbt[1], 4 bytes                    @106
    b2 kdbtoffs                             @106
    b2 kdbtnrow                             @108
 sb2 kdbr[101]                              @110
 ub1 freespace[4270]                        @312
 ub1 rowdata[3606]                          @4582
 ub4 tailchk                                @8188
BBED>
////////////////////////////////////////////////////////////////////////////////////////
//////////// Block Header Structure,  20 bytes//////////////////////////////////////////
BBED> p kcbh
struct kcbh, 20 bytes                       @0
    ub1 type_kcbh                           @0    -- Block Type
                                                  -- 01 - Undo segment header
                                                  -- 02 - Undo data block
                                                  -- 03 - Save undo header
                                                  -- 04 - Save undo data block
                                                  -- 05 - Data segment header
                                                  -- 06 - Trans data, KTB managed data block(with ITL)
                                                  -- 07 - Temp table data block (no ITL)
                                                  -- 08 - Sort key
                                                  -- 09 - Sort Run
                                                  -- 10 - Segment free list block
                                                  -- 11 - Data file header
    ub1 frmt_kcbh                           @1    -- Block Format 1=Oracle7, 2=Oracle8+
    ub1 spare1_kcbh                         @2    -- Not used, filler field
    ub1 spare2_kcbh                         @3    -- Not used, filler field
    ub4 rdba_kcbh                           @4    -- RDBA (4 bytes) - Relative Data Block Address
    ub4 bas_kcbh                            @8    -- SCN Base (4 bytes)
    ub2 wrp_kcbh                            @12   -- SCN Wrap (2 bytes)
    ub1 seq_kcbh                            @14   -- Sequence Number, incremented for every change made to the block at the same SCN
    ub1 flg_kcbh                            @15   -- Flag:
                                                  -- 0x01 New Block
                                                  -- 0x02 Delayed Logging Chang advanced SCN/seq
                                                  -- 0x04 Check value saved - block XOR's to Zero
                                                  -- 0x08 Temporary block
    ub2 chkval_kcbh                         @16   -- Optional block checksum (if DB_BLOCK_CHECKSUM=TRUE)
    ub2 spare3_kcbh                         @18   -- Not used, filler field
 /////////////////////////////////////////////////////////////////////////////////////////
/////////Transaction Fixed Header Structure, 72 Bytes////////////////////////////////////
BBED> p ktbbh
 struct ktbbh, 72 bytes                     @20
    ub1 ktbbhtyp                            @20     -- Block type (1=DATA, 2=INDEX)
    union ktbbhsid, 4 bytes                 @24     -- Segment/Object ID
    struct ktbbhcsc, 8 bytes                @28     -- SCN at last block cleanout
    b2 ktbbhict                             @36     -- Number of ITL slots
    ub1 ktbbhflg                            @38     -- 0=on the freelist
    ub1 ktbbhfsl                            @39     -- ITL TX freelist slot
    ub4 ktbbhfnx                            @40     -- DBA of next block on the freelist
    struct ktbbhitl[2], 48 bytes            @44     -- ITL list index, each ITL takes up 24 bytes
//////////////////////////////////////////////////////////////////////////////////////////
///////////////Data Header Structure, 14 bytes////////////////////////////////////////////
BBED> p kdbh
 struct kdbh, 14 bytes                      @100
    ub1 kdbhflag                            @100    -- N=pctfree hit(clusters)
                                                    -- F=do not put on freelist
                                                    -- K=flushable cluster keys
    b1 kdbhntab                             @101    -- Number of tables (>1 in clusters)
    b2 kdbhnrow                             @102    -- Number of rows (2 bytes)
    sb2 kdbhfrre                            @104    -- First free row entry index; -1=you have to add one
    sb2 kdbhfsbo                            @106    -- Freespace begin offset
    sb2 kdbhfseo                            @108    -- Freespace end offset
    b2 kdbhavsp                             @110    -- Available space in the block
    b2 kdbhtosp                             @112    -- Total available space when all TXs commit
////////////////////////////////////////////////////////////////////////////////////////
/////////////////////Table Directory Entry Structure, 4 bytes///////////////////////////
BBED> p kdbt
 struct kdbt[1], 4 bytes                    @114
    b2 kdbtoffs                             @114
    b2 kdbtnrow                             @116
////////////////////////////////////////////////////////////////////////////////////////
////////////////// Row Directory ///////////////////////////////////////////////////////
BBED> p kdbr[100]
 sb2 kdbr[100]                                @310
////////////////////////////////////////////////////////////////////////////////////////
///////////////// Free Space ///////////////////////////////////////////////////////////
BBED> p freespace[4269]
 ub1 freespace[4269]                        @4581
///////////////////////////////////////////////////////////////////////////////////////
/////////////////////Row Data//////////////////////////////////////////////////////////
BBED> p rowdata[3605]
ub1 rowdata[3605]                           @8187     0x00
//////////////////////////////////////////////////////////////////////////////////////
/////////////////////Block Tail Check, 4 bytes////////////////////////////////////////
BBED> p tailchk
ub4 tailchk                                 @8188     0x24500601

说明事宜:
1、tailchk=Lower order two bytes of SCN Base(bas_kcbh) + Block Type(type_kcbh) + SCN Seq(seq_kcbh)
2、块的scn为:scn=wrp_kcbh+bas_kcbh
求scn语句:select to_char(to_number(‘scn’,’xxxxxxxxxx’),’999999999999′) from dual;
3、dba求文件号,块号为:

set serveroutput on
declare
   p_dba   VARCHAR2 (255) :='0x00800212';
   l_str   VARCHAR2 (255) DEFAULT NULL;
BEGIN
    l_str :=
         'datafile# is:'
      || DBMS_UTILITY.data_block_address_file (TO_NUMBER (LTRIM (p_dba, '0x'),'xxxxxxxx'))
      || chr(10)||'datablock is:'
      || DBMS_UTILITY.data_block_address_block (TO_NUMBER (LTRIM (p_dba, '0x'),'xxxxxxxx'));
   dbms_output.put_line(l_str);
END;

bbed恢复删除数据

联系:手机/微信(+86 17813235971) QQ(107644445)

标题:bbed恢复删除数据

作者:惜分飞©版权所有[未经本人同意,不得以任何形式转载,否则有进一步追究法律责任的权利.]

一、创建模拟环境
SQL> create table hr.xifenfei (id number,name varchar2(20)) tablespace xff;
Table created.
SQL> insert into hr.xifenfei values(1,’xifenfei’);
1 row created.
SQL> insert into hr.xifenfei values(2,’xff’);
1 row created.
SQL> commit;
Commit complete.
SQL> select * from hr.xifenfei;
ID NAME
———- ——————–
1 xifenfei
2 xff
SQL> select rowid,
2 dbms_rowid.rowid_relative_fno(rowid)rel_fno,
3 dbms_rowid.rowid_block_number(rowid)blockno,
4 dbms_rowid.rowid_row_number(rowid) rowno
5 from hr.xifenfei;
ROWID REL_FNO BLOCKNO ROWNO
—————— ———- ———- ———-
AAAHy3AACAAAAISAAA 2 530 0
AAAHy3AACAAAAISAAB 2 530 1
查询file#,block,后面恢复要用
SQL> delete from hr.xifenfei where id=2;
1 row deleted.
SQL> commit;
Commit complete.
SQL> select * from hr.xifenfei;
ID NAME
———- ——————–
1 xifenfei
SQL> shutdown immediate;
Database closed.
Database dismounted.
ORACLE instance shut down.
二、bbed恢复删除数据
[oracle@localhost ~]$ bbed parfile=/tmp/parfile.cnf
Password:
BBED: Release 2.0.0.0.0 – Limited Production on Mon Aug 22 01:52:52 2011
Copyright (c) 1982, 2002, Oracle Corporation. All rights reserved.
************* !!! For Oracle Internal Use only !!! ***************
BBED> show all
FILE# 2
BLOCK# 1
OFFSET 0
DBA 0x00800001 (8388609 2,1)
FILENAME /opt/oracle/oradata/xifenfei/xff01.dbf
BIFILE bifile.bbd
LISTFILE /tmp/list
BLOCKSIZE 8192
MODE Edit
EDIT Unrecoverable
IBASE Dec
OBASE Dec
WIDTH 80
COUNT 512
LOGFILE log.bbd
SPOOL No
BBED> set dba 2,530
DBA 0x00800212 (8389138 2,530)
BBED> find /c xff
File: /opt/oracle/oradata/xifenfei/xff01.dbf (2)
Block: 530 Offsets: 8170 to 8191 Dba:0x00800212
————————————————————————
7866662c 000202c1 02087869 66656e66 65690106 80e2
<32 bytes per line>
BBED> dump /v
File: /opt/oracle/oradata/xifenfei/xff01.dbf (2)
Block: 530 Offsets: 8170 to 8191 Dba:0x00800212
——————————————————-
7866662c 000202c1 02087869 66656e66 l xff,……xifenf
65690106 80e2 l ei….
<16 bytes per line>
BBED> dump /v offset 8160
File: /opt/oracle/oradata/xifenfei/xff01.dbf (2)
Block: 530 Offsets: 8160 to 8191 Dba:0x00800212
——————————————————-
0000003c 020202c1 03037866 662c0002 l …<......xff,.. 02c10208 78696665 6e666569 010680e2 l ....xifenfei.... <16 bytes per line>
BBED> dump /v offset 8164
File: /opt/oracle/oradata/xifenfei/xff01.dbf (2)
Block: 530 Offsets: 8164 to 8191 Dba:0x00800212
——————————————————-
020202c1 03037866 662c0002 02c10208 l ……xff,……
78696665 6e666569 010680e2 l xifenfei….
<16 bytes per line>
BBED> dump /v offset 8162
File: /opt/oracle/oradata/xifenfei/xff01.dbf (2)
Block: 530 Offsets: 8162 to 8191 Dba:0x00800212
——————————————————-
003c0202 02c10303 7866662c 000202c1 l .<......xff,.... 02087869 66656e66 65690106 80e2 l ..xifenfei.... <16 bytes per line>
BBED> dump /v offset 8163
File: /opt/oracle/oradata/xifenfei/xff01.dbf (2)
Block: 530 Offsets: 8163 to 8191 Dba:0x00800212
——————————————————-
3c020202 c1030378 66662c00 0202c102 l <......xff,..... 08786966 656e6665 69010680 e2 l .xifenfei.... <16 bytes per line>
通过尝试,推断出来3c的offset
BBED> modify /x 2c
Warning: contents of previous BIFILE will be lost. Proceed? (Y/N) y
File: /opt/oracle/oradata/xifenfei/xff01.dbf (2)
Block: 530 Offsets: 8163 to 8191 Dba:0x00800212
————————————————————————
2c020202 c1030378 66662c00 0202c102 08786966 656e6665 69010680 e2
<32 bytes per line>
修改3c为2c
BBED> sum apply
Check value for File 2, Block 530:
current = 0xb1b9, required = 0xb1b9
三、核对结果
SQL> startup
ORACLE instance started.
Total System Global Area 236000356 bytes
Fixed Size 451684 bytes
Variable Size 201326592 bytes
Database Buffers 33554432 bytes
Redo Buffers 667648 bytes
Database mounted.
Database opened.
SQL> select * from hr.xifenfei;
ID NAME
———- ——————–
1 xifenfei
2 xff
说明:
1)如果数据未删除:row flag的值为 32+8+4=44或者0x2c
2)如果数据被删除:row flag的值为 32+16+8+4=60或者0x3c

bbed修改数据内容

联系:手机/微信(+86 17813235971) QQ(107644445)

标题:bbed修改数据内容

作者:惜分飞©版权所有[未经本人同意,不得以任何形式转载,否则有进一步追究法律责任的权利.]

1、创建模拟表
SQL> create table hr.b(id number,name varchar2(100)) tablespace xff;
Table created.
SQL> insert into hr.b values(1,’aaa’);
1 row created.
Commit complete.
2、查看数据位置
QL>  select   rowid,
2   dbms_rowid.rowid_relative_fno(rowid)rel_fno,
3   dbms_rowid.rowid_block_number(rowid)blockno,
4   dbms_rowid.rowid_row_number(rowid) rowno
5   from hr.b;
ROWID                 REL_FNO    BLOCKNO      ROWNO
—————— ———- ———- ———-
AAAHytAACAAAAIKAAA          2        522          0
SQL> shutdown immediate
Database closed.
Database dismounted.
ORACLE instance shut down.
虽然bbed 可以在db open 状态来进行修改,但是建议在做任何修改操作之前先shutdown db。 这样避免checkpoint 进程重写bbed 对block 的修改。 也避免oracle 在bbed 修改完成之前读block 或者申明block 为corrupt。
[oracle@localhost ~]$ bbed parfile=/tmp/parfile.cnf(/tmp/parfile.cnf文件见bbed破坏数据文件
Password:
BBED: Release 2.0.0.0.0 – Limited Production on Sat Aug 20 17:10:24 2011
Copyright (c) 1982, 2002, Oracle Corporation.  All rights reserved.
************* !!! For Oracle Internal Use only !!! ***************
BBED> show all
FILE#           2
BLOCK#          1
OFFSET          0
DBA             0x00800001 (8388609 2,1)
FILENAME        /opt/oracle/oradata/xifenfei/xff01.dbf
BIFILE          bifile.bbd
LISTFILE        /tmp/list
BLOCKSIZE       8192
MODE            Edit
EDIT            Unrecoverable
IBASE           Dec
OBASE           Dec
WIDTH           80
COUNT           512
LOGFILE         log.bbd
SPOOL           No
3、设置dba位置
BBED> set dba 2,522
DBA             0x0080020a (8389130 2,522)
4、查询aaa位置
BBED> find /c aaa
File: /opt/oracle/oradata/xifenfei/xff01.dbf (2)
Block: 522              Offsets: 8185 to 8191           Dba:0x0080020a
————————————————————————
61616101 067735
<32 bytes per line>
5、查看该位置内容
BBED> dump /v offset 8185
File: /opt/oracle/oradata/xifenfei/xff01.dbf (2)
Block: 522     Offsets: 8185 to 8191  Dba:0x0080020a
——————————————————-
61616101 067735                     l aaa..w5
<16 bytes per line>
BBED> show all
FILE#           2
BLOCK#          522
OFFSET          8185
DBA             0x0080020a (8389130 2,522)
FILENAME        /opt/oracle/oradata/xifenfei/xff01.dbf
BIFILE          bifile.bbd
LISTFILE        /tmp/list
BLOCKSIZE       8192
MODE            Edit
EDIT            Unrecoverable
IBASE           Dec
OBASE           Dec
WIDTH           80
COUNT           512
LOGFILE         log.bbd
SPOOL           No
6、修改aaa为bbb
BBED> modify /c bbb
Warning: contents of previous BIFILE will be lost. Proceed? (Y/N) y
File: /opt/oracle/oradata/xifenfei/xff01.dbf (2)
Block: 522              Offsets: 8185 to 8191           Dba:0x0080020a
————————————————————————
62626201 067735
<32 bytes per line>
BBED> dump /v
File: /opt/oracle/oradata/xifenfei/xff01.dbf (2)
Block: 522     Offsets: 8185 to 8191  Dba:0x0080020a
——————————————————-
62626201 067735                     l bbb..w5
<16 bytes per line>
7、应用变更
BBED> sum
Check value for File 2, Block 522:
current = 0xa285, required = 0xa286
此时 current checksum 是0xa285,requiredchecksum 是0xa286
BBED> sum apply
Check value for File 2, Block 522:
current = 0xa286, required = 0xa286
加上apply参数,使checksum一致。即之前的修改生效。
8、开启数据测试
SQL> startup
ORACLE instance started.
Total System Global Area  236000356 bytes
Fixed Size                   451684 bytes
Variable Size             201326592 bytes
Database Buffers           33554432 bytes
Redo Buffers                 667648 bytes
Database mounted.
Database opened.
SQL> col name for a20
SQL> select * from hr.b;
ID NAME
———- ——————–
1 bbb

bbed破坏数据文件

联系:手机/微信(+86 17813235971) QQ(107644445)

标题:bbed破坏数据文件

作者:惜分飞©版权所有[未经本人同意,不得以任何形式转载,否则有进一步追究法律责任的权利.]

一、安装bbed
[oracle@ECP-UC-DB1 bin]$ cd $ORACLE_HOME/rdbms/lib
[oracle@ECP-UC-DB1 lib]$ ls -al *bb*
-rw-r–r– 1 oracle oinstall 1863 Mar 11 2008 sbbdpt.o
-rw-r–r– 1 oracle oinstall 1191 Mar 11 2008 ssbbded.o
[oracle@ECP-UC-DB1 lib]$ make -f ins_rdbms.mk $ORACLE_HOME/rdbms/lib/bbed
[oracle@ECP-UC-DB1 lib]$ mv bbed $ORACLE_HOME/bin
[oracle@ECP-UC-DB1 lib]$ cd ~
二、bben入门
[oracle@ECP-UC-DB1 ~]$ bbed
Password: blockedit(默认该密码)
BBED: Release 2.0.0.0.0 – Limited Production on Sun Aug 14 19:56:10 2011
Copyright (c) 1982, 2007, Oracle. All rights reserved.
************* !!! For Oracle Internal Use only !!! ***************
BBED> help all
SET DBA [ dba | file#, block# ]
SET FILENAME ‘filename’
SET FILE file#
SET BLOCK [+/-]block#
SET OFFSET [ [+/-]byte offset | symbol | *symbol ]
SET BLOCKSIZE bytes
SET LIST[FILE] ‘filename’
SET WIDTH character_count
SET COUNT bytes_to_display
SET IBASE [ HEX | OCT | DEC ]
SET OBASE [ HEX | OCT | DEC ]
SET MODE [ BROWSE | EDIT ]
SET SPOOL [ Y | N ]
SHOW [ <SET parameter> | ALL ]
INFO
MAP[/v] [ DBA | FILENAME | FILE | BLOCK ]
DUMP[/v] [ DBA | FILENAME | FILE | BLOCK | OFFSET | COUNT ]
PRINT[/x|d|u|o|c] [ DBA | FILE | FILENAME | BLOCK | OFFSET | symbol | *symbol ]
EXAMINE[/Nuf] [ DBA | FILE | FILENAME | BLOCK | OFFSET | symbol | *symbol ]
</Nuf>:
N – a number which specifies a repeat count.
u – a letter which specifies a unit size:
b – b1, ub1 (byte)
h – b2, ub2 (half-word)
w – b4, ub4(word)
r – Oracle table/index row
f – a letter which specifies a display format:
x – hexadecimal
d – decimal
u – unsigned decimal
o – octal
c – character (native)
n – Oracle number
t – Oracle date
i – Oracle rowid
FIND[/x|d|u|o|c] numeric/character string [ TOP | CURR ]
COPY [ DBA | FILE | FILENAME | BLOCK ] TO [ DBA | FILE | FILENAME | BLOCK ]
MODIFY[/x|d|u|o|c] numeric/character string
[ DBA | FILE | FILENAME | BLOCK | OFFSET | symbol | *symbol ]
ASSIGN[/x|d|u|o] <target spec>=<source spec>
<target spec> : [ DBA | FILE | FILENAME | BLOCK | OFFSET | symbol | *symbol ]
<source spec> : [ value | <target spec options> ]
SUM [ DBA | FILE | FILENAME | BLOCK ] [ APPLY ]
PUSH [ DBA | FILE | FILENAME | BLOCK | OFFSET ]
POP [ALL]
REVERT [ DBA | FILE | FILENAME | BLOCK ]
UNDO
HELP [ <bbed command> | ALL ]
VERIFY [ DBA | FILE | FILENAME | BLOCK ]
CORRUPT [ DBA | FILE | FILENAME | BLOCK ]
三、创建测试表
[oracle@ECP-UC-DB1 ~]$ sqlplus chf/xifenfei
SQL*Plus: Release 10.2.0.4.0 – Production on Sun Aug 14 19:58:46 2011
Copyright (c) 1982, 2007, Oracle. All Rights Reserved.
Connected to:
Oracle Database 10g Enterprise Edition Release 10.2.0.4.0 – 64bit Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options
SQL> create table t_bbed (id number,name varchar2(100)) tablespace xff;
Table created.
SQL> insert into t_bbed values(1,’xifenfei’);
1 row created.
SQL> insert into t_bbed values(2,’xff’);
1 row created.
SQL> insert into t_bbed values(3,’chengfei’);
1 row created.
SQL> commit;
Commit complete.
SQL> conn / as sysdba
Connected.
SQL> alter system checkpoint;
System altered.
SQL> conn chf/xifenfei
Connected.
SQL> set serveroutput on
SQL> declare
ridtype number;
objnum number;
relfno number;
blno number;
rowno number;
rid rowid;
begin
select rowid into rid from t_bbed where id=1;
dbms_rowid.rowid_info(rid,ridtype,objnum,relfno,blno,rowno,’SMALLFILE’);
dbms_output.put_line(‘Row Typ-‘||to_char(ridtype));
dbms_output.put_line(‘Obj No-‘||to_char(objnum));
dbms_output.put_line(‘RFNO-‘||to_char(relfno));
dbms_output.put_line(‘Block No-‘||to_char(blno));
dbms_output.put_line(‘Row No-‘||to_char(rowno));
end;–查看rowid对应的文件号,块号等信息
/
Row Typ-1
Obj No-52721
RFNO-6
Block No-780
Row No-1
PL/SQL procedure successfully completed.
四、bben准备工作
1、创建参数文件
[oracle@ECP-UC-DB1 ~]$ cat parfile.conf
blocksize=8192
listfile=list
mode=edit
2、创建数据文件列表
[oracle@ECP-UC-DB1 ~]$ cat list
1 /opt/oracle/oradata/test/xifenfei01.dbf 2097160192
五、修改数据块中内容
[oracle@ECP-UC-DB1 ~]$ bbed parfile=parfile.conf
Password:
BBED: Release 2.0.0.0.0 – Limited Production on Sun Aug 14 20:35:41 2011
Copyright (c) 1982, 2007, Oracle. All rights reserved.
************* !!! For Oracle Internal Use only !!! ***************
1、定位需要修改块
BBED> set dba 1,780
DBA 0x0040030c (4195084 1,780)
2、查看相关内容
BBED> find /c xifenfei
File: /opt/oracle/oradata/test/xifenfei01.dbf (1)
Block: 780 Offsets: 8180 to 8191 Dba:0x0040030c
————————————————————————
78696665 6e666569 01062bce
<32 bytes per line>
3、dump文件中内容
BBED> dump /v dba 1,780 offset 8180 count 32
File: /opt/oracle/oradata/test/xifenfei01.dbf (1)
Block: 780 Offsets: 8170 to 8191 Dba:0x0040030c
——————————————————-
7866662c 010202c1 02087869 66656e66 l xff,……xifenf
65690106 2bce l ei..+.
<16 bytes per line>
4、修改数据块内容
BBED> modify 500 dba 1,780
Warning: contents of previous BIFILE will be lost. Proceed? (Y/N) y
File: /opt/oracle/oradata/test/xifenfei01.dbf (1)
Block: 780 Offsets: 8180 to 8191 Dba:0x0040030c
————————————————————————
01f46665 6e666569 01062bce
<32 bytes per line>
BBED> find /c xienfei
BBED-00212: search string not found
BBED> exit
六、验证修改是否成功
1、dbv验证
[oracle@ECP-UC-DB1 ~]$ dbv file =/opt/oracle/oradata/test/xifenfei01.dbf
DBVERIFY: Release 10.2.0.4.0 – Production on Sun Aug 14 20:30:56 2011
Copyright (c) 1982, 2007, Oracle. All rights reserved.
DBVERIFY – Verification starting : FILE = /opt/oracle/oradata/test/xifenfei01.dbf
Page 780 is marked corrupt
Corrupt block relative dba: 0x0180030c (file 6, block 780)
Bad check value found during dbv:
Data in bad block:
type: 6 format: 2 rdba: 0x0180030c
last change scn: 0x0000.0012ce2b seq: 0x1 flg: 0x06
spare1: 0x0 spare2: 0x0 spare3: 0x0
consistency value in tail: 0xce2b0601
check value in block header: 0x6382
computed block checksum: 0x1c
DBVERIFY – Verification complete
Total Pages Examined : 1280
Total Pages Processed (Data) : 690
Total Pages Failing (Data) : 0
Total Pages Processed (Index): 0
Total Pages Failing (Index): 0
Total Pages Processed (Other): 31
Total Pages Processed (Seg) : 0
Total Pages Failing (Seg) : 0
Total Pages Empty : 558
Total Pages Marked Corrupt : 1
Total Pages Influx : 0
Highest block SCN : 1232338 (0.1232338)
2、rman验证
[oracle@ECP-UC-DB1 ~]$ $ORACLE_HOME/bin/rman target /
Recovery Manager: Release 10.2.0.4.0 – Production on Sun Aug 14 20:39:55 2011
Copyright (c) 1982, 2007, Oracle. All rights reserved.
connected to target database: TEST (DBID=2056006906)
RMAN> backup check logical validate datafile 6;
Starting backup at 2011-08-14 20:40:06
using target database control file instead of recovery catalog
allocated channel: ORA_DISK_1
channel ORA_DISK_1: sid=155 devtype=DISK
channel ORA_DISK_1: starting full datafile backupset
channel ORA_DISK_1: specifying datafile(s) in backupset
input datafile fno=00006 name=/opt/oracle/oradata/test/xifenfei01.dbf
channel ORA_DISK_1: backup set complete, elapsed time: 00:00:01
Finished backup at 2011-08-14 20:40:08
RMAN> exit
Recovery Manager complete.
3、直接查询验证
[oracle@ECP-UC-DB1 ~]$ sqlplus chf/xifenfei
SQL*Plus: Release 10.2.0.4.0 – Production on Sun Aug 14 20:40:14 2011
Copyright (c) 1982, 2007, Oracle. All Rights Reserved.
Connected to:
Oracle Database 10g Enterprise Edition Release 10.2.0.4.0 – 64bit Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options
SQL> select file#,block#,blocks from v$database_block_corruption;
FILE# BLOCK# BLOCKS
———- ———- ———-
6 780 1
SQL> conn / as sysdba
Connected.
SQL> alter system flush BUFFER_CACHE;
System altered.
SQL> select * from chf.t_bbed;
select * from chf.t_bbed
*
ERROR at line 1:
ORA-01578: ORACLE data block corrupted (file # 6, block # 780)
ORA-01110: data file 6: ‘/opt/oracle/oradata/test/xifenfei01.dbf’

使用ODU恢复数据

联系:手机/微信(+86 17813235971) QQ(107644445)

标题:使用ODU恢复数据

作者:惜分飞©版权所有[未经本人同意,不得以任何形式转载,否则有进一步追究法律责任的权利.]

1、初始化
配置odu中的control.txt文件,通过查询select file#,ts#,rfile#,name from v$datafile;得到相关数据(block_size可以不填写,因为默认就是8k)
note:system表空间文件需要放在control.txt的第一个,不然会出现
can not get bootstrap$ address from SYSTEM tablespace错误
2、数据库不能启动,但是SYSTEM表空间中的数据字典是完整的
生成数据字典:unload dict
列出用户:list user
列出用户下的所有表:list table username
恢复每张表:unload table username.tablename
也可以按用户恢复:unload user username
3、对于drop表和truncate表恢复操作
请见:http://www.xifenfei.com/2560.html
4、系统表空间损坏
扫描数据:scan extent
搜索数据:unload object all sample
从结果文件sample.txt查找需要的数据
恢复需要的表:unload object data_object_id column coltype coltype