Skip to Main Content

Database Software

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

DB_ROLE_CHANGE trigger

infraredJul 19 2010 — edited Jul 20 2010
hello, I'm creating my first trigger. I want to execute an external shell script. Right now the script simply echo's the date to a file.

I perform a switchover in DGMGRL, yet I don't believe the script gets run. Can someone verify my trigger is correct to do something like this?

Thanks

create or replace trigger update_nat after DB_ROLE_CHANGE on database
declare role varchar(100);
BEGIN
select database_role into role from v$database;
IF role='PRIMARY' then
dbms_scheduler.create_job(
job_name=>'update_nat',
job_type=>'executable',
job_action=>'/home/oracle/update-nat.sh',
enabled=>TRUE
);
END IF;
END;
/
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Aug 17 2010
Added on Jul 19 2010
1 comment
2,193 views