通過關閉trace再次產生日誌檔案

psufnxk2000發表於2013-09-09
當日志檔案因為某些原因沒有時,可以通過下面的方式再次生成日誌檔案:
oradebug close_trace;


SQL> conn /as sysdba
Connected.
SQL> 
SQL> 
SQL> 
SQL> oradebug setmypid
Statement processed.
SQL> oradebug tracefile_name
/u01/apppp/diag/rdbms/ogg1/ogg1/trace/ogg1_ora_8698.trc
SQL> ! ls -al /u01/apppp/diag/rdbms/ogg1/ogg1/trace/ogg1_ora_8698.trc
-rw-r----- 1 oracle oinstall 1203 Sep  9 19:28 /u01/apppp/diag/rdbms/ogg1/ogg1/trace/ogg1_ora_8698.trc   --存在日誌檔案

SQL> ! rm /u01/apppp/diag/rdbms/ogg1/ogg1/trace/ogg1_ora_8698.trc   --刪掉

SQL>  ! ls -al /u01/apppp/diag/rdbms/ogg1/ogg1/trace/ogg1_ora_8698.trc   --沒有了
ls: /u01/apppp/diag/rdbms/ogg1/ogg1/trace/ogg1_ora_8698.trc: No such file or directory

SQL> alter session set sql_trace=true;

Session altered.

SQL> select count(*) from song.t;

  COUNT(*)
----------
         1

SQL> alter session set sql_trace=false;

Session altered.

SQL> oradebug tracefile_name
/u01/apppp/diag/rdbms/ogg1/ogg1/trace/ogg1_ora_8698.trc
SQL> ! ls -al /u01/apppp/diag/rdbms/ogg1/ogg1/trace/ogg1_ora_8698.trc       --根蹤之後還是沒有
ls: /u01/apppp/diag/rdbms/ogg1/ogg1/trace/ogg1_ora_8698.trc: No such file or directory

SQL> oradebug close_trace;         --關閉之後 重新生成
Statement processed.
SQL> ! ls -al /u01/apppp/diag/rdbms/ogg1/ogg1/trace/ogg1_ora_8698.trc
-rw-r----- 1 oracle oinstall 979 Sep  9 19:30 /u01/apppp/diag/rdbms/ogg1/ogg1/trace/ogg1_ora_8698.trc
by song

來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/25099483/viewspace-772441/,如需轉載,請註明出處,否則將追究法律責任。

相關文章