Turn off/on Oracle's audit function

1. Basic environment

      Operating system: Windows or Linux

      Database version: Oracle Database 11.2.0.1.0 and above

Second, solve the problem

After Oracle 11g is installed, the database audit function is turned on by default, and the log is stored in the SYSTEM tablespace. As a result, the SYSTEM space is getting bigger and bigger. When the table space is full, it will cause the database to be unable to connect. It is recommended that this function be turned off after the database installation is completed, and then turned on when needed.

Three, parameter description

The audit function is controlled by the parameter audit_trail. The value range and meaning are as follows:

Parameter value Description
DB (Default) Turn on the audit function.
THE Write audit records to a file in the operating system
TRUE Turn on the audit function.
FALSE Turn off the audit function.
NONE Turn off the audit function.

Four, operation steps

1. Check whether the audit function is enabled.

a) Log in to SQL plus as a DBA, all the following commands are executed in this mode;

sqlplus / as sysdba

b) View the value of audit_trail

SHOW PARAMETER AUDIT

c) Query results:

NAME                                 TYPE        VALUE
------------------------------------ ----------- ------------------------------
audit_file_dest                      string      D:\PROGRAMFILES\ORACLE\ADMIN\O
                                                 RCL\ADUMP
audit_sys_operations                 boolean     FALSE
audit_trail                          string      DB

d) According to the query result, the database audit function has been turned on.

2. Turn off the database audit function.

a) Execute the following statement to close the database audit function.

ALTER SYSTEM SET AUDIT_TRAIL='NONE' SCOPE=SPFILE;

b) Restart the database, the following command is equivalent to shutdown abort + startup

STARTUP FORCE

c) Re-execute steps 1-c) to check the value of audit_trail.

3. Turn on the database audit function.

a) Execute the following statement to enable the database audit function.

ALTER SYSTEM SET AUDIT_TRAIL='DB' SCOPE=SPFILE;

b) Restart the database, the following command is equivalent to shutdown abort + startup

STARTUP FORCE

c) Re-execute steps 1-c) to check the value of audit_trail.

d) After opening the database audit function, the database audit log is saved in aud$. We need to empty it regularly. Execute the following command to clear the table aud

TRUNCATE TABLE SYS.AUD$;

e) All operations have been completed.

Reference materials:

1、http://blog.chinaunix.net/uid-7445427-id-5553029.html

2、https://blog.csdn.net/mittee/article/details/3870109

Guess you like

Origin blog.csdn.net/u011046671/article/details/103170398