11g sqlplus errorlog

安佰勝發表於2011-11-17
 
11g sqlplus errorlog
 
=====================
11g新增的對sqlplus中錯誤記錄日誌
一旦sqlplus中發生錯誤會被記錄到表中
------------------

--版本
SQL> select * from v$version;
BANNER
--------------------------------------------------------------------------------
Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - Production
PL/SQL Release 11.2.0.1.0 - Production
CORE    11.2.0.1.0      Production
TNS for Linux: Version 11.2.0.1.0 - Production
NLSRTL Version 11.2.0.1.0 - Production


--檢視是否開啟
SQL> show errorlog
errorlogging is OFF

--開啟方法
SQL> set errorlog on

--再次檢視開啟情況
--如果開啟會給出記錄的表
SQL> show errorlog
errorlogging is ON TABLE AN.SPERRORLOG
SQL>

--剛剛開啟之後表中沒有資料
SQL> select * from sperrorlog;
no rows selected
 
--模擬錯誤
SQL> create table atest as select * from atest;
create table atest as select * from atest
             *
ERROR at line 1:
ORA-00955: name is already used by an existing object

--再次檢視,其中會記錄詳細的錯誤資訊
SQL> set wrap off
SQL> col username for a10
SQL> set linesize 300
SQL> col statement for a50
SQL> select * from sperrorlog;
USERNAME   STATEMENT                                          MESSAGE
---------- -------------------------------------------------- --------------------------------------------------------------------------------
AN         create table atest as select * from atest          ORA-00955: name is already used by an existing object
 

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

相關文章