xifenfei 发表于 2018-7-12 12:28:06

记录特定用户操作触发器

CREATE OR REPLACE TRIGGER sys.record_sql
AFTER LOGON ON DATABASE
DECLARE

BEGIN
    IF (UPPER(sys_context('USERENV', 'MODULE')) LIKE 'SQLPLUS%' AND UPPER(sys_context('USERENV', 'HOST')) IN('WORKGROUP\XIFENFEI-PC') AND UPPER(sys_context('USERENV', 'SESSION_USER')) IN('CHF1'))
   THEN
      EXECUTE IMMEDIATE 'alter session set tracefile_identifier=''get_sql''';
      EXECUTE IMMEDIATE 'alter session set max_dump_file_size=UNLIMITED';
      EXECUTE IMMEDIATE 'alter session set events ''10046 trace name context forever, level 1''';
   END IF;
EXCEPTION
WHEN OTHERS THEN
    null;
END;
/


页: [1]
查看完整版本: 记录特定用户操作触发器