This topic describes how to enable security audit and set the storage location for audit records.
You can perform audit operations in OceanBase Database as the ORAAUDITOR user. The password and privileges of this user are specified by the SYS user.
Limitations
Currently, only the Oracle mode of OceanBase Database supports the security audit feature.
Procedure
Log on to an Oracle tenant as the
sysuser and unlock theORAAUDITORuser.obclient> ALTER USER ORAAUDITOR ACCOUNT UNLOCK;Note
OceanBase Database automatically creates the
ORAAUDITORuser. This user is locked by default and needs to be unlocked before you enable security audit.Change the logon password of the
ORAAUDITORuser.For security purposes, the password of the
ORAAUDITORuser is specified by thesysuser. You can change the password based on your business needs.obclient> ALTER USER ORAAUDITOR IDENTIFIED BY ******;Grant privileges to the
ORAAUDITORuser.By default, the
ORAAUDITORuser is not granted any privileges. You must execute theGRANTstatement to grant theCREATE SESSIONprivilege to theORAAUDITORuser before you can perform audit operations. If you allow theORAAUDITORuser to view audit records, grant theSELECT ANY DICTIONARYprivilege to the user.obclient> GRANT CREATE SESSION, SELECT ANY DICTIONARY TO ORAAUDITOR;Enable security audit and set the storage location for audit records.
The security audit feature is controlled by the
audit_trailparameter. The configuration takes effect immediately after this parameter is set. The valid values of this parameter are as follows:NONE: disables security audit. This is the default value.OS: writes audit records to local disk files.DB: writes audit records to internal tables.DB,EXTENDED / DB_EXTENDED: writes audit records (including executed SQL statements) to internal tables.
Here is an example:
obclient> ALTER SYSTEM SET audit_trail = 'DB,EXTENDED';For more information about the
audit_trailparameter, see audit_trail.Note
You can choose an internal table or a local disk file to store the audit records.
- If you choose to write audit records into a local disk file, the audit records are written into
/audit/under the installation directory in asynchronous write mode. The default path of the file is/home/admin/oceanbase/audit/observer_xx_xxxxxx.aud. - If you choose to write audit records into an internal table, OceanBase Database automatically writes audit records into the system table. The internal table
__all_tenant_security_audit_recordstores the audit records. The internal table__all_virtual_audit_operationor__all_virtual_audit_actionstores mappings ofIDsandnamesrelated to the audit.
What to do next
You can set audit rules after you enable security audit. For more information about how to set audit rules, see Set and view audit rules.
Note
Auditing starts only after the ORAAUDITOR user sets audit rules.
References
For more information about audit operations, see the following topics: