Site icon IT Tutorial

How to Move Audit Trail tables to New Tablespaces in Oracle

Hi,

I will explain how to move audit tables ( SYS.aud$ and SYS.fga_log$ ) to new tablespaces in Oracle

 

 

Audit trail tables called SYS.aud$ and SYS.fga_log$ keeps all Audit records in the Oracle database and these tables are owned by SYS and system tablespace is default tablespace for them. System tablespace grows day by day because of these Audit trail records.

To solve this problem, you need to change default tablespace of these tables.

 

You can check these tables and their tablespaces like following.

SQL> Select table_name, tablespace_name from dba_tables where table_name in ('AUD$', 'FGA_LOG$');

TABLE_NAME                            TABLESPACE_NAME
------------------------------------------------------------------------

AUD$                                            SYSTEM
FGA_LOG$                                   SYSTEM

 

You can change default tablespace of Audit trail tables bu using DBMS_AUDIT_MGMT package like following.

 

 SQL> BEGIN
 DBMS_AUDIT_MGMT.set_audit_trail_location(
 audit_trail_type => DBMS_AUDIT_MGMT.AUDIT_TRAIL_AUD_STD,
 audit_trail_location_value => 'NEW_TABLESPACE_NAME');
END;
/
SQL> BEGIN
 DBMS_AUDIT_MGMT.set_audit_trail_location(
 audit_trail_type => DBMS_AUDIT_MGMT.AUDIT_TRAIL_FGA_STD,
 audit_trail_location_value => 'NEW_TABLESPACE_NAME');
END;
/
After execute above commands, you can check these tables and their tablespaces like following.
SQL> Select table_name, tablespace_name from dba_tables where table_name in ('AUD$', 'FGA_LOG$');

TABLE_NAME                            TABLESPACE_NAME
------------------------------------------------------------------------

AUD$                                           NEW_TABLESPACE_NAME
FGA_LOG$                                 NEW_TABLESPACE_NAME

 

Do you want to learn Oracle Database for Beginners, then read the following articles.

https://ittutorial.org/oracle-database-19c-tutorials-for-beginners/

Exit mobile version