database/oracle

Database Event Trigger

labj 2012. 3. 22. 00:18


- 사용자의 Logon, Logoff 추적하는 Trigger
CREATE OR REPLACE TRIGGER log_logon
AFTER LOGON ON DATABASE
WHEN (USER='SCOTT' OR USER LIKE 'SYSTEM%')
BEGIN
 INSERT INTO trigger_log VALUES ('LOGON ' || USER, sysdate);
 COMMIT;
END;


CREATE OR REPLACE TRIGGER log_logoff
 BEFORE LOGOFF ON DATABASE
 WHEN (USER='SCOTT' OR USER LIKE 'SYSTEM%')
BEGIN
 INSERT INTO trigger_log VALUES ('LOGOFF ' || USER, sysdate);
 COMMIT;
END

'database > oracle' 카테고리의 다른 글

Procedure, Function, Package  (0) 2012.03.22
Procedure, Function & Package 개념  (0) 2012.03.22
DDL Trigger  (0) 2012.03.22
INSTEAD OF Trigger  (0) 2012.03.22
Synonym  (0) 2012.03.22