[aix1]:[/dsg]$ sqlplus /nolog
SQL*Plus: Release 11.2.0.1.0 Production on Mon Aug 26 15:59:31 2013
Copyright (c) 1982, 2009, Oracle. All rights reserved.
SQL> conn source/source
Connected.
SQL> SELECT ROWID FROM TBL_SQL_TEST_CASE WHERE ROWNUM<2;
ROWID
------------------
AAUv1zAAEAALwmLAAA
SQL> SELECT DBMS_ROWID.rowid_relative_fno('AAUv1zAAEAALwmLAAA') FILE_ID,
2 DBMS_ROWID.rowid_block_number('AAUv1zAAEAALwmLAAA') BLOCK_ID
3 FROM DUAL;
FILE_ID BLOCK_ID
---------- ----------
4 3082635
SQL> ALTER SYSTEM DUMP DATAFILE 4 BLOCK 3082635;
System altered.
SQL>
SQL> select c.value || '/' || d.instance_name || '_ora_' || a.spid || '.trc' trace
2 from v$process a, v$session b, v$parameter c, v$instance d
3 where a.addr = b.paddr
4 and b.audsid = userenv('sessionid')
5 and c.name = 'user_dump_dest';
TRACE
--------------------------------------------------------------------------------
/oracle11/app/oracle11/diag/rdbms/db11/db11/trace/db11_ora_319600.trc
SQL> SELECT TRACEFILE
2 FROM V$PROCESS
3 WHERE ADDR = (SELECT PADDR
4 FROM V$SESSION
5 WHERE SID = (SELECT USERENV('SID') FROM DUAL));
TRACEFILE
--------------------------------------------------------------------------------
/oracle11/app/oracle11/diag/rdbms/db11/db11/trace/db11_ora_319600.trc
SQL> SELECT VALUE FROM V$DIAG_INFO WHERE NAME='Default Trace File';
VALUE
--------------------------------------------------------------------------------
/oracle11/app/oracle11/diag/rdbms/db11/db11/trace/db11_ora_319600.trc
SQL>
也可以通过设定参数TRACEFILE_IDENTIFIER,使用特定文件名,生成的trace文件是:
SQL> ALTER SESSION SET TRACEFILE_IDENTIFIER='CXF';
Session altered.
SQL> ALTER SYSTEM DUMP DATAFILE 4 BLOCK 3082635;
System altered.
SQL> SELECT VALUE FROM V$DIAG_INFO WHERE NAME='Default Trace File';
VALUE
--------------------------------------------------------------------------------
/oracle11/app/oracle11/diag/rdbms/db11/db11/trace/db11_ora_319600_CXF.trc
SQL>
Trace文件的位置
专用服务器:USER_DUMP_DEST参数指定的目录
共享服务器:BACKGROUND_DUMP_DEST参数指定的目录