Skip to Main Content
  • Questions
  • How to keep track of changes made to procedures/packages/triggers

Breadcrumb

Question and Answer

Tom Kyte

Thanks for the question.

Asked: August 17, 2006 - 4:32 pm UTC

Last updated: August 19, 2006 - 1:54 pm UTC

Version: 10.1.2

Viewed 1000+ times

You Asked

Hi Tom,
Thanks for taking my question and your help in the past.
Is there any way we can keep track of all the changes made to procedures/packages/triggers automatically in a database table ?
Like an audit trail for a table, who modified, code before, code after etc.
Also is there any way I can stop DBA's from editing or dropping procedures?

Thanks in advance

and Tom said...

Unless and until you control the privileges given to your "dba's" - no, they are pretty powerful. Most places unfortunately give dba's the SYSDBA role even meaning all security for them is pretty much moot (SYSOPER, the must underused role of them all - most dba's do not need sysdba, shouldn't have sysdba).


see
</code> http://asktom.oracle.com/pls/asktom/f?p=100:11:::::P11_QUESTION_ID:6020239969856 <code>
for a technique.

Rating

  (4 ratings)

Is this answer out of date? If it is, please let us know via a Comment

Comments

It's great

A reader, August 18, 2006 - 1:35 pm UTC

Thanks Tom, that was great. I'm sorry to bother you, I couldn't find it before the post.
One last thing, can I tweak that code to track edits too .. I've just edited a procedure with raptor and it doesn't log it in to the table.

Thank you.

Tom Kyte
August 18, 2006 - 4:25 pm UTC

they should just be doing a create or replace, I hope they are not doing a drop+create....

Can you do me a favor and see if they are doing a drop? make the trigger before create or drop...

Ahemm, EDIT??

A reader, August 18, 2006 - 4:18 pm UTC

Edit??

Please define Edit. There is no way you can edit procedures/packages/triggers. And if you edit them and then apply the changes it does a Create or Replace...

And if you cancel the changes then how will it track that??



What for SYSDBA?

Robert, August 19, 2006 - 12:03 pm UTC

Tom,

Who then should have the SYSDBA role?

Thanks,

Robert.

Tom Kyte
August 19, 2006 - 1:54 pm UTC

almost no one.

Describe what you use SYSDBA for. for most people the answer is:

I use it to startup, I use it to shutdown.

(well, they might silently add - I use it because I have it and with it, I never need to worry about being "denied access" to anything).


If that DBA needs to

a) do DBA stuff
b) startup
c) shutdown

give them DBA and sysoper

If that DBA needs to

a) do DBA stuff

give them DBA

If that DBA needs to

a) do a limited set of maintenance operations

then by all means, do not be afraid to create your own DBA roles "DBA1, DBA2, ..." and use them instead.



You hit the nail on the head!

Robert, August 19, 2006 - 1:59 pm UTC

Tom,

You hit the nail on the head! :)

<quote>
(well, they might silently add - I use it because I have it and with it, I never need to worry about being "denied access" to anything).
<quote>

Thanks,

Robert.


More to Explore

PL/SQL demos

Check out more PL/SQL tutorials on our LiveSQL tool.

PL/SQL docs

PL/SQL reference manual from the Oracle documentation library