有朋友在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 9.2.0.6.0 - 64bit Production
With the Partitioning, OLAP and Oracle Data Mining options
JServer Release 9.2.0.6.0 - Production
ORACLE_HOME = /cadrasu01/app/oracle/product/9.2.0
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 9.2.0.6.0 - 64bit Production
With the Partitioning, OLAP and Oracle Data Mining options
JServer Release 9.2.0.6.0 - Production
ORACLE_HOME = /cadrasu01/app/oracle/product/9.2.0
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:: 0x0040000f ext#: 0 blk#: 5 ext size: 7
#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
-----------------------------------------------------------------
0x0040000a length: 7
0x00400011 length: 8
0x00400181 length: 8
0x00400189 length: 8
0x00400191 length: 8
0x00400199 length: 8
TRN CTL:: seq: 0x0036 chd: 0x0014 ctl: 0x005c inc: 0x00000000 nfb: 0x0000
mgc: 0x8002 xts: 0x0068 flg: 0x0001 opt: 2147483646 (0x7ffffffe)
uba: 0x0040000f.0036.1c scn: 0x0000.0008028e
Version: 0x01
FREE BLOCK POOL::
uba: 0x00000000.0036.1b ext: 0x0 spc: 0x8ac
uba: 0x00000000.0032.13 ext: 0x2 spc: 0x18e4
uba: 0x00000000.002f.41 ext: 0x5 spc: 0x33c
uba: 0x00000000.0000.00 ext: 0x0 spc: 0x0
uba: 0x00000000.0000.00 ext: 0x0 spc: 0x0
TRN TBL::
index state cflags wrap# uel scn dba parent-xid nub stmt_num
------------------------------------------------------------------------------------------------
0x00 9 0x00 0x002e 0x0028 0x0000.00080292 0x0040000c 0x0000.000.00000000 0x00000002 0x00000000
......省略显示部分内容
0x61 9 0x00 0x002e 0x005d 0x0000.0008536a 0x0040000f 0x0000.000.00000000 0x00000001 0x00000000
End dump data block from file /dras20/testdb/system01.dbf minblk 9 maxblk 9
Recent Comments