Enable_ddl_logging has been available since 11g, except that there are bugs in 11.2.0.2 and 11.1.0.7, and the bug is described as:
Bug 12938609-enable_ddl_logging does not log RENAME table statements (document ID 12938609.8)
The bug is fixed in the following version:
| The fix for 12938609 are first included in |
- 12.1.0.1 (Base Release)
- 11.2.0.4 (Server Patch Set)
|
When this parameter is set to True, the following DDL statements can be logged in the alert log, but note that only the time the DDL execution is logged, not including which client the DDL statement is executing, and so on
? Alter/create/drop/truncate CLUSTER? Alter/create/drop FUNCTION? Alter/create/drop INDEX? Alter/create/drop OUTLINE? Alter/create/drop package? Alter/create/drop Package BODY? Alter/create/drop PROCEDURE? Alter/create/drop profile? Alter/create/drop SEQUENCE? Create/drop synonym? Alter/create/drop/rename/truncate TABLE? Alter/create/drop TRIGGER? Alter/create/drop TYPE? Alter/create/drop TYPE BODY? DROP USER? Alter/create/drop VIEW
As above source: http://docs.oracle.com/cd/E11882_01/server.112/e40402/initparams085.htm#REFRN10302
Let's do the experiment.
[[email protected] ~]$ sqlplus lc0029999/aaaaaasql*plus:release 11.2.0.4.0 Production on Wed June 00:11:32 2015Cop Yright (c) 1982, Oracle. All rights reserved. Connected to:oracle Database 11g Enterprise Edition Release 11.2.0.4.0-64bit productionwith The partitioning, OLAP, Data Mining and Real application testing optionssql> show parameter Ddlname TYPE VAL UE-----------------------------------------------------------------------------ddl_lock_timeout inte GER 0enable_ddl_logging boolean falsesql> alter system set enable_ddl_logging=true; System altered. Sql> Show parameter Ddlname TYPE VALUE----------------------------------------- ------------------------------------ddl_lock_timeout Integer 0enable_ddl_logging Boolean truesql> show Useruser is "LC0029999" sql> create table T1 as SELECT * from Dba_objects where 1=2; Table created. sql> ALTER TABLE T1 rename to T11; Table altered. Sql>
As you can see, this parameter is a dynamic parameter that can be modified online.
The alert log at this time is as follows:
Wed June 01:38:35 2015ALTER SYSTEM SET enable_ddl_logging=true scope=both; Wed June 01:39:17 2015create table t1 as select * FROM Dba_objects where 1=2wed June 01:40:03 2015alter table T1 Renam E to T11
Sql> CREATE TABLE Lc0039999.t1 as SELECT * from Dba_objects where 1=2; Table created.
The alert log at this time is as follows:
Wed June 01:46:52 2015create table lc0039999.t1 as SELECT * from Dba_objects where 1=2
In other words, the DDL shown in the alert log is a complete copy of the command executed at that time, instead of adding the user information from the execution environment at that time.
About the 11g new feature enable_ddl_logging initialization parameters