Examine the following command:
ALTER SYSTEM SET enable_ddl_logging=FALSE;
Which statement is true?
A. None of the data definition language (DDL) statements are logged in the trace file.
B. Only DDL commands that resulted in errors are logged in the alert log file.
C. A new log.xml file that contains the DDL statements is created, and the DDL command
details are removed from the alert log file.
D. Only DDL commands that resulted in the creation of new database files are logged.
正确答案:A
官方文档的位置:
http://docs.oracle.com/cd/E11882_01/server.112/e40402/initparams085.htm#REFRN10302
生产环境经常遇到DROP、TRUNCATE、DELETE等误操作,
其中大部分影响较大的是DDL,11.2 设置ENABLE_DDL_LOGGING为true后,alert中会记录DDL操作的语句,但是没有详细信息:
alter system set enable_ddl_logging = TRUE sid='*' scope=spfile;
12C中的开启ENABLE_DDL_LOGGING后,会专门有一个日志文件记录详细的信息。
ALTER SYSTEM SET enable_ddl_logging=FALSE;
Which statement is true?
A. None of the data definition language (DDL) statements are logged in the trace file.
B. Only DDL commands that resulted in errors are logged in the alert log file.
C. A new log.xml file that contains the DDL statements is created, and the DDL command
details are removed from the alert log file.
D. Only DDL commands that resulted in the creation of new database files are logged.
正确答案:A
官方文档的位置:
http://docs.oracle.com/cd/E11882_01/server.112/e40402/initparams085.htm#REFRN10302
生产环境经常遇到DROP、TRUNCATE、DELETE等误操作,
其中大部分影响较大的是DDL,11.2 设置ENABLE_DDL_LOGGING为true后,alert中会记录DDL操作的语句,但是没有详细信息:
alter system set enable_ddl_logging = TRUE sid='*' scope=spfile;
12C中的开启ENABLE_DDL_LOGGING后,会专门有一个日志文件记录详细的信息。
SQL> select * from v$version;
BANNER CON_ID
-------------------------------------------------------------------------------- ----------
Oracle Database 12c Enterprise Edition Release 12.1.0.1.0 - 64bit Production 0
--默认没有开启
SQL> show parameter enable_ddl_logging
NAME TYPE VALUE
------------------------------------ ----------- ------------------------------
enable_ddl_logging boolean FALSE
SQL> alter system set enable_ddl_logging=true;
System altered.
SQL> show parameter enable_ddl_logging
NAME TYPE VALUE
------------------------------------ ----------- ------------------------------
enable_ddl_logging boolean TRUE
SQL> create table goolen as select * from dba_objects;
Table created.
SQL> create index ind_oid on goolen(object_id);
Index created.
SQL> alter table goolen modify(object_id not null);
Table altered.
SQL> truncate table goolen;
Table truncated.
SQL> drop table goolen purge;
Table dropped.
$ adrci
ADR base = "/opt/app/oracle"
adrci> show log
Choose the home from which to view diagnostic logs:
1: diag/tnslsnr/release-mysql/listener
2: diag/rdbms/ora12c/ora12c
Q: to quit
$ cd /opt/app/oracle/diag/rdbms/ora12c/ora12c/log
$ ls
ddl ddl_ora12c.log debug test
$ cat ddl_ora12c.log
diag_adl:create table goolen as select * from dba_objects
diag_adl:create index ind_oid on goolen(object_id)
diag_adl:alter table goolen modify(object_id not null)
diag_adl:truncate table goolen
diag_adl:drop table goolen purge
$ cat ddl/log.xml
msg_id='opiexe:4181:2946163730' type='UNKNOWN' group='diag_adl'
level='16' host_id='release' host_addr='192.168.100.92'
version='1'>
create table goolen as select * from dba_objects
msg_id='opiexe:4181:2946163730' type='UNKNOWN' group='diag_adl'
level='16' host_id='release' host_addr='192.168.100.92'>
create index ind_oid on goolen(object_id)
msg_id='opiexe:4181:2946163730' type='UNKNOWN' group='diag_adl'
level='16' host_id='release' host_addr='192.168.100.92'>
alter table goolen modify(object_id not null)
msg_id='opiexe:4181:2946163730' type='UNKNOWN' group='diag_adl'
level='16' host_id='release' host_addr='192.168.100.92'>
truncate table goolen
msg_id='opiexe:4181:2946163730' type='UNKNOWN' group='diag_adl'
level='16' host_id='release' host_addr='192.168.100.92'>
drop table goolen purge