My top 10 Oracle 11g New Features Part 5: DDL-logging in the alert log in 11g

This week I deliver for Oracle Belgium in Brussels.
It is an 11g New Features for Administrators course.
I have shown some nice features this afternoon
which are not really documented yet
and want to share some of it here.

As of Oracle database 11g we can have loggin information for DDL operations in the alert log files. I say files in plural because we have two different alert log files now in 11g:
one is the traditional alert_<sid>.log as we had it ever since,
the other one is an log.xml file which is located in the diagnostic directory in the alert folder. The xml file gives you a lot more information than the traditional alert log file.

The diagnostic directory is specified by the parameter DIAGNOSTIC_DEST  in 11g which depricates all the *_DUMP_DEST parameters from older releases. It defaults to $ORACLE_BASE/diag/

This feature can be very handy because it shows a logging entry for every DDL statement with a timestamp in the two alert log files. You will like it if you must find out when the wrong table was dropped or truncated ecactly in order to flash it back.

It is not enabled by default and you must change the parameter to TRUE first in 11gR1. 

Here is a little demo:

ALTER SYSTEM SET enable_ddl_logging=TRUE SCOPE=BOTH; SYS AS SYSDBA @ orcl SQL> show parameter ddlNAME                                 TYPE        VALUE
———————————— ———– ——————————
ddl_lock_timeout                     integer     0
enable_ddl_logging                   boolean     TRUE  

[oracle@edw2r8p0 ~]$ tail -f /u01/app/oracle/diag/rdbms/orcl/orcl/alert/log.xml


<txt>drop table hr.tt 
</txt>
</msg>
<msg time=’2007-10-16T15:29:58.343+02:00′ org_id=’oracle’ comp_id=’rdbms’ msg_id=’opiexe:3933:4222364190′ client_id=” type=’NOTIFICATION’ group=‘schema_ddl’ level=’16′ module=’SQL*Plus’ pid=’27158′> <txt>drop table t
 </txt>
</msg> 
Here is the same tail for the traditional alert_<sid>.log: Tue Oct 16 15:29:58 2007drop table tNice one, eh?
=;-) 

About these ads

7 Responses to My top 10 Oracle 11g New Features Part 5: DDL-logging in the alert log in 11g

  1. Yadu says:

    Hello Lutz,

    Thanks for sharing..

    Regards,
    yadu

  2. Hi Yadu,
    I am not sure why tehy do not document it yet. BUt it is a nice feature, no?

    Sorry that I let you waitz on the chat the other day, I simply was too busy.
    Since I am travelling at the moment I am not online too often right now. But I will be after two weeks. Now I am only available rarely on the chat.
    But if you see me online, do not hesitat to chat with me.
    =;-)

  3. Marco Patzwahl says:

    the bump is a dump, or? :-)

  4. Hi Marco,
    right, the BUMP_DESTINATION is the DUMP_DESTINATION.
    I’ll fix it.
    Thanks for pointing it out!
    =;-)

  5. Giridhar Kodakalla says:

    Hi Lutz,
    Thanks for the useful information.
    I tried to reproduce the same whatever you mentioned.
    Will it be possible to find out WHICH USER dropped/created the table? I could not find that information in the alert log files. If we can find out which oracle user id performed this action, i think it would be more useful. Thanks.
    Giridhar Kodakalla

  6. Giridhar Kodakalla says:

    Mostly we should not be creating tables every day. we do only once a month when we have a production move. can we find out if there is any impact on performance if we enable this feature?

    Thanks,
    Giridhar Kodakalla

  7. Julian Dontcheff says:

    The use of the following init.ora parameter is licensed under Oracle Change Management Pack:

    ENABLE_DDL_LOGGING: when set to TRUE (default: FALSE)

    julian.dontcheff@nokia.com

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Connecting to %s

Follow

Get every new post delivered to your Inbox.

%d bloggers like this: