有朋友在MSN上问我----"mount状态下如何dump一个block?"
我说你自己先去google上搜一下吧,能搜到答案的就别过来问我了。
他回答说搜不到。
既然搜不到,那我就说一说吧。
其实在mount状态下dump block的方法不止一种,最常规的就是如下这样。
比如现在我要在mount状态下dump system回滚段的段头,这么做是不行的:
SQL_testdb>startup mount pfile=/dras20/testdb/inittestdb.ora
ORACLE instance started.
Total System Global Area 505382744 bytes
Fixed Size 743256 bytes
Variable Size 285212672 bytes
Database Buffers 218103808 bytes
Redo Buffers 1323008 bytes
Database mounted.
SQL_testdb>oradebug setmypid
Statement processed.
SQL_testdb>alter system dump datafile 1 block 9;
System altered.
SQL_testdb>oradebug tracefile_name
/cadrasu01/app/oracle/admin/testdb/udump/testdb_ora_9576500.trc
[P550_04_LA:oracle@:/cadrasu01/app/oracle/admin/testdb/udump]#cat /cadrasu01/app/oracle/admin/testdb/udump/testdb_ora_9576500.trc
/cadrasu01/app/oracle/admin/testdb/udump/testdb_ora_9576500.trc
Oracle9i Enterprise Edition Release
With the Partitioning, OLAP and Oracle Data Mining options
JServer Release
ORACLE_HOME = /cadrasu01/app/oracle/product/
System name: AIX
Node name: P550_04_LA
Release: 3
Version: 5
Machine: 0001D085D600
Instance name: testdb
Redo thread mounted by this instance: 1
Oracle process number: 12
Unix process pid: 9576500, image: oracle@P550_04_LA (TNS V1-V3)
*** 2010-04-15 10:14:00.317
*** SESSION ID:(9.3) 2010-04-15 10:14:00.307
alter system dump datafile/tempfile: file 1 not readable
怎么办?我们这么做就可以了:
SQL_testdb>oradebug setmypid
Statement processed.
SQL_testdb>alter system dump datafile '/dras20/testdb/system01.dbf' block 9;
System altered.
SQL_testdb>oradebug tracefile_name
/cadrasu01/app/oracle/admin/testdb/udump/testdb_ora_8454328.trc
[P550_04_LA:oracle@:/cadrasu01/app/oracle/admin/testdb/udump]#cat /cadrasu01/app/oracle/admin/testdb/udump/testdb_ora_8454328.trc
/cadrasu01/app/oracle/admin/testdb/udump/testdb_ora_8454328.trc
Oracle9i Enterprise Edition Release
With the Partitioning, OLAP and Oracle Data Mining options
JServer Release
ORACLE_HOME = /cadrasu01/app/oracle/product/
System name: AIX
Node name: P550_04_LA
Release: 3
Version: 5
Machine: 0001D085D600
Instance name: testdb
Redo thread mounted by this instance: 1
Oracle process number: 12
Unix process pid: 8454328, image: oracle@P550_04_LA (TNS V1-V3)
*** 2010-04-15 10:18:13.941
*** SESSION ID:(9.5) 2010-04-15 10:18:13.934
Start dump data block from file /dras20/testdb/system01.dbf minblk 9 maxblk 9
FILE HEADER:
Software vsn=153092096=0x9200000, Compatibility Vsn=134217728=0x8000000
Db ID=2489685178=0x946594ba, Db Name='TESTDB'
Activation ID=0=0x0
Control Seq=537=0x219, File size=51200=0xc800
File Number=1, Blksiz=8192, File Type=3 DATA
Dump all the blocks in range:
buffer rdba: 0x00400009 (1/9)
scn: 0x0000.000853ee seq: 0x01 flg: 0x04 tail: 0x53ee0e01
frmt: 0x02 chkval: 0xebe6 type: 0x0e=KTU UNDO HEADER W/UNLIMITED EXTENTS
Extent Control Header
-----------------------------------------------------------------
Extent Header:: spare1: 0 spare2: 0 #extents: 6 #blocks: 47
last map 0x00000000 #maps: 0 offset: 4128
Highwater:: 0x
#blocks in seg. hdr's freelists: 0
#blocks below: 0
mapblk 0x00000000 offset: 0
Unlocked
Map Header:: next 0x00000000 #extents: 6 obj#: 0 flag: 0x40000000
Extent Map
-----------------------------------------------------------------
0x
0x00400011 length: 8
0x00400181 length: 8
0x00400189 length: 8
0x00400191 length: 8
0x00400199 length: 8
TRN CTL:: seq: 0x0036 chd: 0x0014 ctl: 0x
mgc: 0x8002 xts: 0x0068 flg: 0x0001 opt: 2147483646 (0x7ffffffe)
uba: 0x
Version: 0x01
FREE BLOCK POOL::
uba: 0x0000
uba: 0x0000
uba: 0x
uba: 0x0000
uba: 0x0000
TRN TBL::
index state cflags wrap# uel scn dba parent-xid nub stmt_num
------------------------------------------------------------------------------------------------
0x00 9 0x00 0x002e 0x0028 0x0000.00080292 0x
......省略显示部分内容
0x61 9 0x00 0x002e 0x005d 0x
End dump data block from file /dras20/testdb/system01.dbf minblk 9 maxblk 9
我觉得你应该写的文章是怎样搜到“mount状态下如何dump一个block”。。。
不是kamus,我是听他说在google上搜不到我这才有兴趣研究一下,事实上,这个我在google上也没搜到。
啊,这样子,原来我一直这么dump数据块的,后来见pub有人说,可能会导致系统崩溃,才不用了。。。
你要注意这是在mount状态下,专用于库起不来的时候分析用的,不是“可能会导致系统崩溃”,是已经崩溃了。