Log database logon to a table : Database Trigger « Trigger « Oracle PL / SQL






Log database logon to a table

  
SQL>
SQL> CREATE TABLE MyTable (
  2    num_col    NUMBER,
  3    char_col   VARCHAR2(60)
  4    );

Table created.

SQL>
SQL>
SQL> CREATE OR REPLACE TRIGGER LogAllConnects
  2    AFTER LOGON ON DATABASE
  3  BEGIN
  4    INSERT INTO MyTable
  5      VALUES (3, 'LogAllConnects fired!');
  6  END LogAllConnects;
  7  /

Trigger created.

SQL>
SQL> SELECT * FROM MyTable;

no rows selected

SQL> drop table MyTable;

Table dropped.

SQL>

   
  








Related examples in the same category

1.Trigger for database startup event
2.Trigger to log the database shutdown
3.Logon trigger
4.After logon database trigger
5.Log a server error to a table
6.Log a server error with information on time, user name, database name
7.A system trigger(AFTER CREATE ON DATABASE) .
8.creating a logon/logoff auditing system using system-level triggers:
9.Save information about all errors in an after-servererror on database
10.Submit a job for altering user in an after-create-database trigger