How to free oracle disk space – Automate disk cleanup.

How to free oracle disk space – Automate disk cleanup.

Spread the love

In part one we explained what files Oracle Instance creates and eats our precious disk-space, This article explains how to identify and free oracle server disk space.

Reasons for the server to stop creating new files.

Servers might stop creating new files or adding new files due to multiple reasons:

1. You consumed all available disk space.

in that error, you get the message.

You can detect file system disk space usage by executing the du command with -h parameter.

2. Your disk quota reached its limit.

3. You consumed all allowed Inodes. 

An inode is a data structure used to keep information about a file on your hosting account. The number of inodes indicates the number of files and folders you have. This includes everything on your account, emails, files, folders, anything you store on the server.

 using du command with parameter -i it will show total nodes used and available Inodes for each mounted disk.

What directories need cleaning?

in that clustered environment which consists of two nodes and ASM. The script cleans the following directories

  • ASM Audit trail.
    in ASM home  “create separate ” script to be executed by grid user

  • Database Audit trails.
    in Database home

  • Database trace files.
    in Database home

ADRCI to clean your Oracle disk-space 

After identifying the biggest directories that consume your server disk space. you need three environment variables which are ORACLE_UNIQNAME, ORACLE_SID, ORACLE_BASE

Clear Audit and trace files using the Automatic Diagnostic Repository (ADR) tool. adrci located in bin under oracle home. 


Next, list available homes that have logs. 

Then, set adrci home that the purge command will work in. for example, for cdb1  

After that, purge all logs.

Finally, repeat this process with each home. in addition, if there are other oracle software installed change the adrci base, then repeat the same process. 

How to free oracle disk-space-04-adrci

Schedule cleaning script.

now you add it to cron scheduler to execute every day at 1AM. Read corn manual for more information