This topic describes how to enable security audit and set the storage location for the 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
OceanBase Database supports security audit only in Oracle mode.
Procedure
Log on to an Oracle tenant as the
sysuser and unlock theORAAUDITORuser.obclient> ALTER USER ORAAUDITOR ACCOUNT UNLOCK;Note:
The
ORAAUDITORuser is created in OceanBase Database by default. By default, this user is locked. You must unlock this user 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 the audit records.
You can set the
audit_trailparameter to enable security audit. After it is set, the configuration immediately takes effect. Valid values of this parameter are:NONE: disables security audit. This is the default value.OS: writes audit records into a local disk file.DB: writes audit records into an internal table.DB,EXTENDED / DB_EXTENDED: writes audit records and executed SQL statements into an internal table.
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 the
< installation directory >/audit/directory in asynchronous write mode. The default installation directory 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: