Sunday, June 08, 2014

EHCC Analysis

-- http://docs.oracle.com/cd/E11882_01/appdev.112/e40758/d_compress.htm#BEICEJED
-- Script analyse the EHCC benefit 

set serverout on verify off feed off
SET PAGESIZE 50000
ACCEPT myScrTbs CHAR DEFAULT 'EHCCSCRATCHPAD' PROMPT 'ScratchPad Tablespace [EHCCSCRATCHPAD] : ';
ACCEPT myCntTbls NUMBER DEFAULT 10 PROMPT 'Number of Top Tables to be Analysed  [10] : ';
create directory ehcc_estimate_dir as '/tmp';
grant read, write on directory ehcc_estimate_dir to sys

declare 
dyn_stmt varchar2(500); 
oradata varchar2(10); 
tbs_num number; 
v_blkcnt_cmp     pls_integer;
v_blkcnt_uncmp   pls_integer;
v_row_cmp        pls_integer;
v_row_uncmp      pls_integer;
v_cmp_ratio      number;
v_comptype_str   varchar2(60);
fileHandler UTL_FILE.FILE_TYPE;

begin
fileHandler := UTL_FILE.FOPEN('EHCC_ESTIMATE_DIR', 'EHCC_ESTIMATE_DATA.txt', 'W');
UTL_FILE.PUTF(fileHandler, 'Copy this Data to an Xls file for better analysis');
UTL_FILE.FCLOSE(fileHandler);

if '&myScrTbs' is not null and &myCntTbls is not null
then
dbms_output.put_line('');
dbms_output.put_line('#################');
dbms_output.put_line('Tablespace is  : &myScrTbs');
dbms_output.put_line('Count of tables  is : &myCntTbls' );
dbms_output.put_line('#################');
select count(1) into tbs_num from dba_tablespaces where tablespace_name='&myScrTbs'; 
IF  tbs_num > 0  then 
dbms_output.put_line('Tablespace  &myScrTbs already exisits'); 
 else 
select value into oradata from v$parameter2 where name ='db_create_file_dest';
dbms_output.put_line('Creating Tablespace &myScrTbs with files in '|| oradata);
EXECUTE IMMEDIATE 'create tablespace &myScrTbs';  
EXECUTE IMMEDIATE 'alter tablespace &myScrTbs add datafile'; 
end if; 
-- Find Object Names 
FOR tbls IN (SELECT OWNER, SEGMENT_NAME , SIZE_GB
FROM (SELECT OWNER, SEGMENT_NAME, BYTES/1024/1024/1024 SIZE_GB 
     FROM DBA_SEGMENTS 
     WHERE SEGMENT_TYPE = 'TABLE'
     ORDER BY     BYTES/1024/1024/1024  DESC )
WHERE ROWNUM <= &myCntTbls
order by SIZE_GB DESC)
LOOP
  DBMS_OUTPUT.PUT_LINE ('Owner = ' || tbls.OWNER || ', Table = ' || tbls.SEGMENT_NAME || ', Size is  = ' ||tbls.SIZE_GB );
  dyn_stmt := 'alter user '||tbls.OWNER||'  QUOTA UNLIMITED ON  &myScrTbs '; 
  EXECUTE IMMEDIATE dyn_stmt ; 
  
  dbms_compression.get_compression_ratio(
scratchtbsname   => upper('&myScrTbs'),      
ownname          => tbls.OWNER,           
tabname          => upper(tbls.SEGMENT_NAME),   
partname         => NULL,           
comptype         => dbms_compression.comp_for_query_high,    
blkcnt_cmp       => v_blkcnt_cmp,    
blkcnt_uncmp     => v_blkcnt_uncmp,  
row_cmp          => v_row_cmp,    
row_uncmp        => v_row_uncmp,  
cmp_ratio        => v_cmp_ratio,  
comptype_str     => v_comptype_str);
-- dbms_output.put_line('Estimated Compression Ratio: '||to_char(v_cmp_ratio));
-- dbms_output.put_line('Blocks used by compressed sample: '||to_char(v_blkcnt_cmp));
-- dbms_output.put_line('Blocks used by uncompressed sample: '||to_char(v_blkcnt_uncmp));
dbms_output.put_line( tbls.OWNER||','|| tbls.SEGMENT_NAME||','|| to_char(v_cmp_ratio)||','||to_char(v_blkcnt_uncmp)||','||to_char(v_blkcnt_cmp)) ;
fileHandler := UTL_FILE.FOPEN('EHCC_ESTIMATE_DIR', 'EHCC_ESTIMATE_DATA.txt', 'A');
UTL_FILE.PUTF(fileHandler, tbls.OWNER||','|| tbls.SEGMENT_NAME||','|| to_char(v_cmp_ratio)||','||to_char(v_blkcnt_uncmp)||','||to_char(v_blkcnt_cmp));
UTL_FILE.FCLOSE(fileHandler);
END LOOP;
dbms_output.put_line('Dropping Tablespace &myScrTbs');
EXECUTE IMMEDIATE 'drop  tablespace &myScrTbs'; 
EXECUTE IMMEDIATE 'drop DIRECTORY ehcc_estimate_dir';
else
dbms_output.put_line('#################');
dbms_output.put_line('#################');
dbms_output.put_line('ERR : at least one of the variables is null ! Cannot proceed ');
dbms_output.put_line('#################');
dbms_output.put_line('#################');
end if;
dbms_output.put_line('Check file /tmp/EHCC_ESTIMATE_DATA.txt for data');
end;
/
exit; 








Saturday, August 24, 2013

Oracle 12c RDBMS Software installation


Start from a VNC or X Client


Prepare your file system for Oracle Home


Provide the MOS credentials if you would like to register for OCM ,
else skip the OCM options by unchecking the check box , (it never worked for me)


Check for any release updates if you would like to be on greatest and latest ,
I mostly don't use this option, as I decided which patches to go in at a later stage.


Do you want o create a started DB / seeded DB, I guess not, most of the cases you want to upgrade the existing DB ,
Or otherwise explore the dbca options , I would go for install software only



chose install software only


Select RAC or Single Node


Select language options


Select which edition, (refer your Licenses document for info about what you can select)


Select ORACLE_BASE and ORACLE_HOME


Select the various groups


runInstaller checks for a pre-requisites



If there are issues it will provide a fix up script

as root run the fixup  script to fix various pre-requisites and click ok


I have to ignore the swap space , (doesn't have abundant availability of space)


Here is a summary of installation.


Watch the progress.


Asks you to run root .sh


Once root.sh is complete click ok.


You are done with the Oracle 12c RDBMS Software.
Starting DBCA and DB creation to follow.



-->

My VM server Oracle VM Server release 3.2.2 - On an IBM x3850

My VM server

Oracle VM Server Oracle VM server release 3.2.2 - On an IBM x3850
Oracle VM Manager Version: 3.2.2.520 - on a Custom Made Desktop
(more on this, coming soon !)





Sunday, August 18, 2013

Extending partitions on a Linux virtual machine hosted in Oracle VM Server

Here is how I did it , 
I use 
Oracle VM Server Oracle VM server release 3.2.2
Oracle VM Manager Version: 3.2.2.520

VMs on OEL  - Oracle Linux Server release 5.9
On an IBM x3850

Shutdown the VM
Navigate to VM Machines Oracle VM Home > Servers and VMs > Server Pools > > Stop
Edit VM  
Navigate to VM Machines Oracle VM Home > Servers and VMs > Server Pools > > Edit 

On the Disk Tab - Select the hard disk you would like to extend 
Update the required size,  Click OK
Start  the VM
ssh to vm and Log in as root
Use frisk to find out the info   At the command prompt type fdisk -l
[root@vmgdbwlnchs01 ~]# fdisk -l 

Disk /dev/hda: 69.7 GB, 69793218560 bytes
255 heads, 63 sectors/track, 8485 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes

  Device Boot      Start         End      Blocks   Id  System
/dev/hda1   *           1          13      104391   83  Linux
/dev/hda2              14        6527    52323705   8e  Linux LVM

Disk /dev/dm-0: 47.3 GB, 47311749120 bytes
255 heads, 63 sectors/track, 5751 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes

Disk /dev/dm-0 doesn't contain a valid partition table

Disk /dev/dm-1: 6241 MB, 6241124352 bytes
255 heads, 63 sectors/track, 758 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes

Disk /dev/dm-1 doesn't contain a valid partition table

The response should say something like Disk /dev/hda: 69.7 GB, 69793218560 bytes

At the command prompt type fdisk /dev/hda. 
Type p to print the partition table and press Enter 
Type n to add a new partition
Type p again to make it a primary partition
Now you'll be prompted to pick the first cylinder which will most likely come at the end of your last partition 
Type w to save these changes
[root@vmgdbwlnchs01 ~]# fdisk /dev/hda

The number of cylinders for this disk is set to 8485.
There is nothing wrong with that, but this is larger than 1024,
and could in certain setups cause problems with:
1) software that runs at boot time (e.g., old versions of LILO)
2) booting and partitioning software from other OSs
  (e.g., DOS FDISK, OS/2 FDISK)

Command (m for help): p

Disk /dev/hda: 69.7 GB, 69793218560 bytes
255 heads, 63 sectors/track, 8485 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes

  Device Boot      Start         End      Blocks   Id  System
/dev/hda1   *           1          13      104391   83  Linux
/dev/hda2              14        6527    52323705   8e  Linux LVM

Command (m for help): n
Command action
  e   extended
  p   primary partition (1-4)
p
Partition number (1-4): 3
First cylinder (6528-8485, default 6528): 
Using default value 6528
Last cylinder or +size or +sizeM or +sizeK (6528-8485, default 8485): 
Using default value 8485

Command (m for help): w
The partition table has been altered!

Calling ioctl() to re-read partition table.

WARNING: Re-reading the partition table failed with error 16: Device or resource busy.
The kernel still uses the old table.
The new table will be used at the next reboot.
Syncing disks.

Restart the VM - Must 
Log back in as root

At the command prompt type fdisk -l. You'll notice another partition is present.  initialize this new partition as a physical volume using pvcreate 
[root@vmgdbwlnchs01 ~]# fdisk -l 

Disk /dev/hda: 69.7 GB, 69793218560 bytes
255 heads, 63 sectors/track, 8485 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes

  Device Boot      Start         End      Blocks   Id  System
/dev/hda1   *           1          13      104391   83  Linux
/dev/hda2              14        6527    52323705   8e  Linux LVM
/dev/hda3            6528        8485    15727635   83  Linux

Disk /dev/dm-0: 47.3 GB, 47311749120 bytes
255 heads, 63 sectors/track, 5751 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes

Disk /dev/dm-0 doesn't contain a valid partition table

Disk /dev/dm-1: 6241 MB, 6241124352 bytes
255 heads, 63 sectors/track, 758 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes

Disk /dev/dm-1 doesn't contain a valid partition table

[root@vmgdbwlnchs01 ~]# pvcreate /dev/hda3
 Writing physical volume data to disk "/dev/hda3"
 Physical volume "/dev/hda3" successfully created
  
Add the physical volume to the existing volume group using the vgextend command. use  df -h to find the name of the volume group.  
[root@vmgdbwlnchs01 ~]# df -hP
Filesystem            Size  Used Avail Use% Mounted on
/dev/mapper/VolGroup00-LogVol00   43G   34G  7.4G  82% /
/dev/hda1              99M   49M   46M  52% /boot
tmpfs                 3.8G     0  3.8G   0% /dev/shm
192.168.1.101:/u01/software  643G  328G  282G  54% /u01/software

[root@vmgdbwlnchs01 ~]# vgextend VolGroup00 /dev/hda3 
 Volume group "VolGroup00" successfully extended


Get the free space available on the physical volume type vgdisplay [volume group]  and use pvdisplay to check if everything is fine or not . 
[root@vmgdbwlnchs01 ~]# vgdisplay VolGroup00 
 --- Volume group ---
 VG Name               VolGroup00
 System ID             
 Format                lvm2
 Metadata Areas        2
 Metadata Sequence No  4
 VG Access             read/write
 VG Status             resizable
 MAX LV                0
 Cur LV                2
 Open LV               2
 Max PV                0
 Cur PV                2
 Act PV                2
 VG Size               64.84 GB
 PE Size               32.00 MB
 Total PE              2075
 Alloc PE / Size       1596 / 49.88 GB
 Free  PE / Size       479 / 14.97 GB
 VG UUID               vwAxOp-LL9a-xkvk-BYbt-OmLd-intU-kNpjW2
   
[root@vmgdbwlnchs01 ~]# pvdisplay 
 --- Physical volume ---
 PV Name               /dev/hda2
 VG Name               VolGroup00
 PV Size               49.90 GB / not usable 25.37 MB
 Allocatable           yes (but full)
 PE Size (KByte)       32768
 Total PE              1596
 Free PE               0
 Allocated PE          1596
 PV UUID               0djEdP-G0t9-1BOH-L4rN-wwa8-XM5L-RqtJBz
  
 --- Physical volume ---
 PV Name               /dev/hda3
 VG Name               VolGroup00
 PV Size               15.00 GB / not usable 31.02 MB
 Allocatable           yes 
 PE Size (KByte)       32768
 Total PE              479
 Free PE               479
 Allocated PE          0
 PV UUID               GbbNYH-Ii2B-dh4P-A2nt-zoo2-uRCQ-xtM3MR
   


Extend the logical volume by the amount of free space (on the command line use a digit less, else you might see Insufficient free space Here i am using 14.95, though it shows me 14.97 above)) 
[root@vmgdbwlnchs01 ~]# lvextend -L+14.95G /dev/VolGroup00/LogVol00
 Rounding up size to full physical extent 14.97 GB
 Extending logical volume LogVol00 to 59.03 GB
 Logical volume LogVol00 successfully resized

Expand the  file system in the logical volume using resize2fs 
[root@vmgdbwlnchs01 ~]# resize2fs /dev/VolGroup00/LogVol00
resize2fs 1.39 (29-May-2006)
Filesystem at /dev/VolGroup00/LogVol00 is mounted on /; on-line resizing required
Performing an on-line resize of /dev/VolGroup00/LogVol00 to 15474688 (4k) blocks.
The filesystem on /dev/VolGroup00/LogVol00 is now 15474688 blocks long.



Check the space using df -hP 
[root@vmgdbwlnchs01 ~]# df -hP
Filesystem             Size  Used Avail Use% Mounted on
/dev/mapper/VolGroup00-LogVol00   58G   34G   22G  62% /
/dev/hda1               99M   49M   46M  52% /boot
tmpfs                  3.8G     0  3.8G   0% /dev/shm
192.168.1.101:/u01/software   643G  328G  282G  54% /u01/software
none                   3.8G  104K  3.8G   1% /var/lib/xenstored


This machine ill use to install 12c DB, will update soon. 


Monday, April 30, 2012

Using Distributed AD for 12.1.1 upgrade


Using Distributed AD for 12.1.1 upgrade

200 Workers, 40 per node  for 5 node

adpatch options=nocopyportion,nogenerateportion logfile=u6678700.log driver=u6678700.drv workers=200 localworkers=40

node 2
adctrl distributed=y
enter answeres for prompts.
Enter the worker range: 41-80

node 3
adctrl distributed=y
enter answeres for prompts.
Enter the worker range: 81-120

node 4
adctrl distributed=y
enter answeres for prompts.
Enter the worker range: 121-160

node 5
adctrl distributed=y
enter answeres for prompts.
Enter the worker range: 161-200

You don't have to restart adctrl on other nodes even if you restart the patch, from node 1, unless you have bounced the DB.  Number for workers depends on the capacity of your servers.

Friday, April 27, 2012

How to move Audit and FGA Log Tables in 11g R2 +



The DBMS_AUDIT_MGMT package is installed by default in Oracle 11.2, and in patch sets 10.2.0.5 and 11.1.0.7 but has also been made available as a separately install-able patch for other versions.




Move AUD$ and FGA_LOG to TOOLS 




SQL>; BEGIN
DBMS_AUDIT_MGMT.set_audit_trail_location(
audit_trail_type => DBMS_AUDIT_MGMT.AUDIT_TRAIL_AUD_STD,
audit_trail_location_value => 'TOOLS');
END;
/


-- Previous verions use DBMS_AUDIT_MGMT.AUDIT_TRAIL_DB_STD, to avoid some internal  issues. 


SQL>; BEGIN

DBMS_AUDIT_MGMT.set_audit_trail_location(
audit_trail_type => DBMS_AUDIT_MGMT.AUDIT_TRAIL_FGA_STD,
audit_trail_location_value => 'TOOLS');
END;
/

Ensure the index are valid after this 
And Grant
GRANT DELETE ON SYS.AUD$ TO DELETE_CATALOG_ROLE;

GRANT SELECT ON SYS.AUD$ TO SYSTEM;



More if you are interested.... 



Auditing Features by DBMS_AUDIT_MGMT in Oracle Database 11g Release 2
Oracle 11g R2  eases the pain of  audit trail using the DBMS_AUDIT_MGMT package.


Following are noteworthy 
Moving the DB Audit Trail to a Non System Tablespace
Controlling the Size and Age of the OS Audit Trail data 
Purging Audit Trails data 
Timestamp Management
Manual and Automated Purge
 This package is  also provided versions down to 10g Release 2. 
See Oracle Support Note 731908.1.




The SET_AUDIT_TRAIL_LOCATION procedure is to alter the location of the standard and/or fine-grained database audit trail.
IAlteration of the OS audit trail is not curretnly possible. 
The procedure accepts two parameters.


AUDIT_TRAIL_TYPE: The type of audit trail DB/FGA/or btoh 
AUDIT_TRAIL_LOCATION_VALUE: Target Tablespace 


The AUDIT_TRAIL_TYPE parameter takes following values .


DBMS_AUDIT_MGMT.AUDIT_TRAIL_AUD_STD: Standard audit trail (AUD$).
DBMS_AUDIT_MGMT.AUDIT_TRAIL_FGA_STD: Fine-grained audit trail (FGA_LOG$).
DBMS_AUDIT_MGMT.AUDIT_TRAIL_DB_STD: Both standard and fine-grained audit trails.




See it in work :- 


CONN / AS SYSDBA


SELECT table_name, tablespace_name
FROM   dba_tables
WHERE  table_name IN ('AUD$', 'FGA_LOG$')
ORDER BY table_name;


TABLE_NAME                     TABLESPACE_NAME
------------------------------ ------------------------------
AUD$                           SYSTEM
FGA_LOG$                       SYSTEM


SQL>


Now Move that to Tools 


BEGIN
  DBMS_AUDIT_MGMT.set_audit_trail_location(
    audit_trail_type           => DBMS_AUDIT_MGMT.AUDIT_TRAIL_AUD_STD,
    audit_trail_location_value => 'TOOLS');
END;
/


PL/SQL procedure successfully completed.


SQL>


-->  Check now 


SELECT table_name, tablespace_name
FROM   dba_tables
WHERE  table_name IN ('AUD$', 'FGA_LOG$')
ORDER BY table_name;


TABLE_NAME                     TABLESPACE_NAME
------------------------------ ------------------------------
AUD$                           TOOLS
FGA_LOG$                       SYSTEM


SQL>


Next try  the fine-grained audit trail.


BEGIN
  DBMS_AUDIT_MGMT.set_audit_trail_location(
    audit_trail_type           => DBMS_AUDIT_MGMT.AUDIT_TRAIL_FGA_STD,
    audit_trail_location_value => 'TOOLS');
END;
/


PL/SQL procedure successfully completed.


SQL>


-- Check locations.
SELECT table_name, tablespace_name
FROM   dba_tables
WHERE  table_name IN ('AUD$', 'FGA_LOG$')
ORDER BY table_name;


TABLE_NAME                     TABLESPACE_NAME
------------------------------ ------------------------------
AUD$                           TOOLS
FGA_LOG$                       TOOLS


SQL>


Next step do all it in one step 


BEGIN
  DBMS_AUDIT_MGMT.set_audit_trail_location(
    audit_trail_type           => DBMS_AUDIT_MGMT.AUDIT_TRAIL_DB_STD,
    audit_trail_location_value => 'SYSAUX');
END;
/


PL/SQL procedure successfully completed.


SQL>


Check now . 


SELECT table_name, tablespace_name
FROM   dba_tables
WHERE  table_name IN ('AUD$', 'FGA_LOG$')
ORDER BY table_name;


TABLE_NAME                     TABLESPACE_NAME
------------------------------ ------------------------------
AUD$                           SYSAUX
FGA_LOG$                       SYSAUX


SQL>


The time taken is directly propotional to the size of data currently in the audit trail tables,
and the resources available on your system.


The Size and Age of the OS Audit Trail


The SET_AUDIT_TRAIL_PROPERTY procedure allows you to set the maximum size and/or age of the OS audit trail files. 


The procedure accepts three parameters.


AUDIT_TRAIL_TYPE: The type of audit trail to be modified (AUDIT_TRAIL_OS, AUDIT_TRAIL_XML or AUDIT_TRAIL_FILES).
AUDIT_TRAIL_PROPERTY: The name of the property to be set (OS_FILE_MAX_SIZE or OS_FILE_MAX_AGE).
AUDIT_TRAIL_PROPERTY_VALUE: The required value for the property.
To check the current settings query the DBA_AUDIT_MGMT_CONFIG_PARAMS view.


COLUMN parameter_name FORMAT A30
COLUMN parameter_value FORMAT A20
COLUMN audit_trail FORMAT A20


SELECT *
FROM   dba_audit_mgmt_config_params
WHERE  parameter_name LIKE 'AUDIT FILE MAX%';


PARAMETER_NAME                 PARAMETER_VALUE      AUDIT_TRAIL
------------------------------ -------------------- --------------------
AUDIT FILE MAX SIZE            10000                OS AUDIT TRAIL
AUDIT FILE MAX SIZE            10000                XML AUDIT TRAIL
AUDIT FILE MAX AGE             5                    OS AUDIT TRAIL
AUDIT FILE MAX AGE             5                    XML AUDIT TRAIL




Defaluts setting are set for files will grow to a maximum of 102400 kilobytes, or files older than 5 days,  at which point a new file will be created. 
How to change ti to maximum size of OS audit files to 15,000b.
BEGIN
  DBMS_AUDIT_MGMT.set_audit_trail_property(
    audit_trail_type           => DBMS_AUDIT_MGMT.AUDIT_TRAIL_OS,
    audit_trail_property       => DBMS_AUDIT_MGMT.OS_FILE_MAX_SIZE,
    audit_trail_property_value => 15000);
END;
/


(Better leave it at default, for readability :)  bigger the file , you will have trouble opening , considering various OS in the organization. ) 




SELECT * FROM   dba_audit_mgmt_config_params
WHERE  parameter_name LIKE 'AUDIT FILE MAX%';


PARAMETER_NAME                 PARAMETER_VALUE      AUDIT_TRAIL
------------------------------ -------------------- --------------------
AUDIT FILE MAX SIZE            15000                OS AUDIT TRAIL
AUDIT FILE MAX SIZE            10000                XML AUDIT TRAIL
AUDIT FILE MAX AGE             5                    OS AUDIT TRAIL
AUDIT FILE MAX AGE             5                    XML AUDIT TRAIL


SQL>




Now change the age to the Maximum age of XML audit files to 10 days.
BEGIN
  DBMS_AUDIT_MGMT.set_audit_trail_property(
    audit_trail_type           => DBMS_AUDIT_MGMT.AUDIT_TRAIL_XML,
    audit_trail_property       => DBMS_AUDIT_MGMT.OS_FILE_MAX_AGE,
    audit_trail_property_value => 10);
END;
/


SELECT *  FROM   dba_audit_mgmt_config_params
WHERE  parameter_name LIKE 'AUDIT FILE MAX%';


PARAMETER_NAME                 PARAMETER_VALUE      AUDIT_TRAIL
------------------------------ -------------------- --------------------
AUDIT FILE MAX SIZE            15000                OS AUDIT TRAIL
AUDIT FILE MAX SIZE            10000                XML AUDIT TRAIL
AUDIT FILE MAX AGE             5                    OS AUDIT TRAIL
AUDIT FILE MAX AGE             10                   XML AUDIT TRAIL


SQL>


The CLEAR_AUDIT_TRAIL_PROPERTY procedure can be used to reset them to the default values
or remove all restrictions  the USE_DEFAULT_VALUES parameter value to FALSE removes the restrictions  (lethal size ) 
so better use TRUE,  setting it to TRUE for factory reset. 


BEGIN
  DBMS_AUDIT_MGMT.clear_audit_trail_property(
   audit_trail_type     => DBMS_AUDIT_MGMT.AUDIT_TRAIL_FILES,
   audit_trail_property => DBMS_AUDIT_MGMT.OS_FILE_MAX_SIZE,
   use_default_values   => TRUE );
END;
/


SELECT *
FROM   dba_audit_mgmt_config_params
WHERE  parameter_name LIKE 'AUDIT FILE MAX%';


PARAMETER_NAME                 PARAMETER_VALUE      AUDIT_TRAIL
------------------------------ -------------------- --------------------
AUDIT FILE MAX SIZE            10000                OS AUDIT TRAIL
AUDIT FILE MAX SIZE            10000                XML AUDIT TRAIL
AUDIT FILE MAX AGE             5                    OS AUDIT TRAIL
AUDIT FILE MAX AGE             10                   XML AUDIT TRAIL


SQL>


Max age restriction is ok to do so that you dotn have too many files.  


BEGIN
  DBMS_AUDIT_MGMT.clear_audit_trail_property(
   audit_trail_type     => DBMS_AUDIT_MGMT.AUDIT_TRAIL_FILES,
   audit_trail_property => DBMS_AUDIT_MGMT.OS_FILE_MAX_AGE,
   use_default_values   => FALSE );
END;
/


SELECT *
FROM   dba_audit_mgmt_config_params
WHERE  parameter_name LIKE 'AUDIT FILE MAX%';


PARAMETER_NAME                 PARAMETER_VALUE      AUDIT_TRAIL
------------------------------ -------------------- --------------------
AUDIT FILE MAX SIZE            10000                OS AUDIT TRAIL
AUDIT FILE MAX SIZE            10000                XML AUDIT TRAIL
AUDIT FILE MAX AGE             NOT SET              OS AUDIT TRAIL
AUDIT FILE MAX AGE             NOT SET              XML AUDIT TRAIL


SQL>




SQL>


Clean up or Purging Audit Trail Records
You can manually delete records from the AUD$ and FGA_LOG$ tables and manually delete OS audit files from the file system, always  
With DBMS_AUDIT_MGMT package comes with  safer features for this purpose 


If  Oracle Audit Vault is used ,  then that should be used  manage your audit trail. 




To be continued .....