Database Administration (MOSC)

MOSC Banner

Trigger before shutdown on Database with alter system command

edited Feb 3, 2017 4:00AM in Database Administration (MOSC) 10 commentsAnswered

Hi,

I'm trying to create a trigger "before shutdown on database" that gets the user who is sending the shutdown command and before the shutdown ends the Oracle does a checkpoint and a backup of controlfile. The informations about the user are save in the table, however, the Oracle does not wait the "execute immediate" to finish and kills the session that is executing the "execute immediate"

CREATE OR REPLACE TRIGGER BSHUT2

BEFORE SHUTDOWN ON DATABASE

BEGIN

  insert into shutdowns values (dbms_standard.login_user, dbms_standard.client_ip_address, SYS_CONTEXT('USERENV','IP_ADDRESS'), SYS_CONTEXT('USERENV', 'HOST'), SYS_CONTEXT('USERENV', 'AUTHENTICATION_METHOD'), SYS_CONTEXT('USERENV', 'CLIENT_IDENTIFIER'), SYS_CONTEXT('USERENV', 'CLIENT_INFO'), SYS_CONTEXT('USERENV', 'CURRENT_SQL'), SYS_CONTEXT('USERENV', 'INSTANCE'), SYS_CONTEXT('USERENV', 'MODULE'), SYS_CONTEXT('USERENV', 'OS_USER'), SYS_CONTEXT('USERENV', 'TERMINAL'), SYSDATE);

Howdy, Stranger!

Log In

To view full details, sign in to My Oracle Support Community.

Register

Don't have a My Oracle Support Community account? Click here to get started.

Category Leaderboard

Top contributors this month

New to My Oracle Support Community? Visit our Welcome Center

MOSC Help Center