Tuesday 8 July 2014

oracle trigger permissions

Wow, this is a frustrating area.  Now, if you are a CNC person and perhaps not an ex DBA, there might be something to learn here.  Oracle triggers are amazing, DBA’s hate them because they run code that they cannot trace and follow.

You can do some really cool things with triggers and they can be triggered on more than the old, before update, after insert.

One thing that you need to understand though, it how permissions work with a trigger.

If you create trigger TESTDTA.MyFirstTrigger, it’ll run using TESTDTA permissions – not the user that fires off the trigger!  How about that.  So if you trigger is doing selects, calling procedures – you need to ensure that the owner / schema has permissions to do all of the stuff that you want the trigger to do.

So, my scenario was that I had a non public database link.  I needed to create the link as TESTDTA, so that I could use the link in the trigger body.

So, a fairly simple post.

I’ve got some cool triggers that tell you when there are too many waiting jobs.  The database will email you all the details of the waiting and processing jobs so that you may be able to perform some maintenance!

No comments: