当前位置:操作系统 > Unix/Linux >>

自动杀执行时间超过1小时的会话

自动杀执行时间超过1小时的会话
 
--CREATE LOG TABLE 
CREATE TABLE KILL_SESS_HIST AS SELECT S.*,T.START_TIME
                                FROM V$TRANSACTION T,V$SESSION S 
                                WHERE S.TADDR=T.ADDR AND T.START_TIME<TO_CHAR((SYSDATE-1/24),'YY/HH/DD HH24:MI:SS')
                                
alter table KILL_SESS_HIST    add (kill_time date default sysdate);

desc KILL_SESS_HIST

 SADDR                                                                                                                      RAW(8)
 SID                                                                                                                        NUMBER
 SERIAL#                                                                                                                    NUMBER
 AUDSID                                                                                                                     NUMBER
 PADDR                                                                                                                      RAW(8)
 USER#                                                                                                                      NUMBER
 USERNAME                                                                                                                   VARCHAR2(30)
 COMMAND                                                                                                                    NUMBER
 OWNERID                                                                                                                    NUMBER
 TADDR                                                                                                                      VARCHAR2(16)
 LOCKWAIT                                                                                                                   VARCHAR2(16)
 STATUS                                                                                                                     VARCHAR2(8)
 SERVER                                                                                                                     VARCHAR2(9)
 SCHEMA#                                                                                                                    NUMBER
 SCHEMANAME                                                                                                                 VARCHAR2(30)
 OSUSER                                                                                                                     VARCHAR2(30)
 PROCESS                                                                                                                    VARCHAR2(24)
 MACHINE                                                                                                                    VARCHAR2(64)
 PORT                                                                                                                       NUMBER
 TERMINAL                                                                                                                   VARCHAR2(30)
 PROGRAM                                                                                                                    VARCHAR2(48)
 TYPE                                                                                                                       VARCHAR2(10)
 SQL_ADDRESS                                                                                                                RAW(8)
 SQL_HASH_VALUE                                                                                                             NUMBER
 SQL_ID                                                                                                                     VARCHAR2(13)
 SQL_CHILD_NUMBER                                                                                                           NUMBER
 SQL_EXEC_START                                                                                                             DATE
 SQL_EXEC_ID                                                                                                                NUMBER
 PREV_SQL_ADDR                                                                                                              RAW(8)
 PREV_HASH_VALUE                                                                                                            NUMBER
 PREV_SQL_ID                                                                                                                VARCHAR2(13)
 PREV_CHILD_NUMBER                                                                                                          NUMBER
 PREV_EXEC_START                                                                                                            DATE
 PREV_EXEC_ID                                                                                                               NUMBER
 PLSQL_ENTRY_OBJECT_ID                                                                                                      NUMBER
 PLSQL_ENTRY_SUBPROGRAM_ID                                                                                                  NUMBER
 PLSQL_OBJECT_ID                                                                                                            NUMBER
 PLSQL_SUBPROGRAM_ID                                                                                                        NUMBER
 MODULE                                                                                                                     VARCHAR2(64)
 MODULE_HASH                                                                                                                NUMBER
 ACTION                                                                                                                     VARCHAR2(64)
 ACTION_HASH                                                                                                                NUMBER
 CLIENT_INFO                                                                                                                VARCHAR2(64)
 FIXED_TABLE_SEQUENCE                                                                                                       NUMBER
 ROW_WAIT_OBJ#                                                                                                              NUMBER
 ROW_WAIT_FILE#                                                                                                             NUMBER
 ROW_WAIT_BLOCK#                                                                                                            NUMBER
 ROW_WAIT_ROW#                                                                                                              NUMBER
 TOP_LEVEL_CALL#                                                                                                            NUMBER
 LOGON_TIME                                                                                                                 DATE
 LAST_CALL_ET                                                                                                               NUMBER
 PDML_ENABLED                                                                                                               VARCHAR2(3)
 FAILOVER_TYPE                                                                                                              VARCHAR2(13)
 FAILOVER_METHOD                                                                                                            VARCHAR2(10)
 FAILED_OVER                                                                                                                VARCHAR2(3)
 RESOURCE_CONSUMER_GROUP                                                                                                    VARCHAR2(32)
 PDML_STATUS
CopyRight © 2022 站长资源库 编程知识问答 zzzyk.com All Rights Reserved
部分文章来自网络,