Oracle 12C R2-新特性-新增兩個試圖-方便檢視trace檔案和內容
在12.2中,Oracle新增了兩個V$DIAG_TRACE_FILE and V$DIAG_TRACE_FILE_CONTENTS檢視,使檢視trace檔案路徑及其內容變得非常簡單。不用大把拼接sql去查了。
如:
---檢視con_id為3的產生的trace檔案路徑及名稱
SQL> SELECT ADR_HOME,TRACE_FILENAME,CON_ID FROM v$diag_trace_file WHERE con_id = 3; ADR_HOME TRACE_FILENAME CON_ID ---------------------------------------------------------------------- ------------------------------ ---------- /u01/app/oracle/diag/rdbms/orcl/orcl orcl_mmon_2309.trc 1 /u01/app/oracle/diag/rdbms/orcl/orcl orcl_ora_5757.trc 1 /u01/app/oracle/diag/rdbms/orcl/orcl orcl_lgwr_2289.trc 1 /u01/app/oracle/diag/rdbms/orcl/orcl orcl_dia0_6296.trc 1 /u01/app/oracle/diag/rdbms/orcl/orcl orcl_ofsd_6282_6286.trc 1 /u01/app/oracle/diag/rdbms/orcl/orcl orcl_dia0_6171_base_1.trc 1 /u01/app/oracle/diag/rdbms/orcl/orcl orcl_svcb_5836.trc 1 /u01/app/oracle/diag/rdbms/orcl/orcl orcl_ora_2231.trc 1
---檢視對應trace檔案內容
SQL> SELECT payload FROM v$diag_trace_file_contents WHERE trace_filename = 'orcl_mmon_2309.trc' ORDER BY line_number; ....內容太多。。。 *** 2017-02-16T21:04:34.754390+08:00 (CDB$ROOT(1)) AUTO SGA: kmgs_parameter_update_timeout gen0 0 mmon alive 1 PAYLOAD -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- *** 2017-02-16T21:04:37.755725+08:00 (CDB$ROOT(1)) AUTO SGA: kmgs_parameter_update_timeout gen0 0 mmon alive 1 *** 2017-02-16T21:04:40.756642+08:00 (CDB$ROOT(1)) AUTO SGA: kmgs_parameter_update_timeout gen0 0 mmon alive 1 1179 rows selected.