1.转储指定的块:需要两个信息:文件号和块号
BYS@bys1>alter system dump datafile 1 block 100;
System altered.
2.定位找出user tracefile的位置:
BYS@bys1>show parameter user_dump_dest;
NAME TYPE VALUE
------------------------------------ ----------- ------------------------------
user_dump_dest string /u01/diag/rdbms/bys1/bys1/trac
就是用使用dump命令时,文件转储的位置:
3.进一步定位是哪个文件
由于trace文件的名字和OS的进程有很大的关联,所以必须得找出
OS的进程号:关联3个视图(V$process,v$mystat,v$session)
select spid from v$process
where addr=(select paddr from v$session
where sid=(select distinct sid from v$mystat));
4.定位到文件
[oracle@bys001 ~]$ cd /u01/diag/rdbms/bys1/bys1/trace/
[oracle@bys001 trace]$ ls *4641*
bys1_ora_4641.trc bys1_ora_4641.trm
[oracle@bys001 trace]$ ls -al bys1_ora_4641*
-rw-r----- 1 oracle oinstall 18859 Oct 10 15:49 bys1_ora_4641.trc
-rw-r----- 1 oracle oinstall 120 Oct 10 15:49 bys1_ora_4641.trm
[oracle@bys001 trace]$ date
Thu Oct 10 15:52:59 CST 2013
5.查看文件--只截取前三十行
[oracle@bys001 trace]$ head -n 30 bys1_ora_4641.trc
Trace file /u01/diag/rdbms/bys1/bys1/trace/bys1_ora_4641.trc
Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options
ORACLE_HOME = /u01/app/oracle/product/11.2.0/dbhome_1
System name: Linux
Node name: bys001.oel.com
Release: 2.6.32-200.13.1.el5uek
Version: #1 SMP Wed Jul 27 20:21:26 EDT 2011
Machine: i686
Instance name: bys1
Redo thread mounted by this instance: 1
Oracle process number: 31
Unix process pid: 4641, image: oracle@bys001.oel.com (TNS V1-V3)
*** 2013-10-10 15:49:50.862
*** SESSION ID:(37.3002) 2013-10-10 15:49:50.862
*** CLIENT ID:() 2013-10-10 15:49:50.862
*** SERVICE NAME:(SYS$USERS) 2013-10-10 15:49:50.862
*** MODULE NAME:(SQL*Plus) 2013-10-10 15:49:50.862
*** ACTION NAME:() 2013-10-10 15:49:50.862
Start dump data blocks tsn: 0 file#:1 minblk 100 maxblk 100
Block dump from cache:
Dump of buffer cache at level 4 for tsn=0, rdba=4194404
Block dump from disk:
buffer tsn: 0 rdba: 0x00400064 (1/100)
scn: 0x0000.000000cd seq: 0x01 flg: 0x04 tail: 0x00cd1e01
frmt: 0x02 chkval: 0x8254 type: 0x1e=KTFB Bitmapped File Space Bitmap
Hex dump of block: st=0, typ_found=1