cancel
Showing results for 
Search instead for 
Did you mean: 

Oracle RMAN scripts editing

alainken3
Level 4

Hi,

Good day! 

Need some inputs on something maybe someone can point me to the right direction.

We are trying to automate some jobs which covers backup of the database and then once verified complete,

we will incorporate in the script some commands to cleanup a certain filesystem. 

Is this possible in RMAN scripts?

Or maybe as another approach, we'll create a cleanup script and put the name of the script on the Backup Selection directly?

thanks in advance! 

- alain

4 REPLIES 4

Nicolai
Moderator
Moderator
Partner    VIP   

Hi @alainken3 

First of all I strongly recommend using Netbackup Intelligent Policies (OIP) for backup of Oracle. It is easy to use and remove a lot of the manual work using a script based approch.

RMAN is used to protect the Oracle database and archives files, so that limit the scope of what it can do.

What clean-up operation do you want to do ?

Documentation Link to Netbackup OIP:

https://www.veritas.com/content/support/en_US/doc/16226115-126559565-0/v79369797-126559565

Hi Nicolai,

Thanks for your reply.

We are looking into inserting a cleanup script/command that will remove old archives

after the database backup completes.

Say we have a filesystem /archive, we want to leave at least 20 archives files in there, and everything else gets deleted 

after backup completion.

The deletion of archives is performed manually by our operations team, by incorporating a cleanup script, we can somehow "automate" this process.

 

Thanks! 

alain 

 

Michal_Mikulik1
Moderator
Moderator
Partner    VIP    Accredited Certified

Hello,

on one hand you can do anything in RMAN script, it is like any other script running under root. But on the other hand, it is not its purpose and can have some consequences. For example, backup will be running fine, but deletion will fail, thus job in Activity monitor also will fail. So I dont recommend it.

Also - what do you mean with "archives"? If you mean Oracle archive redo logs, their deletion should be managed by RMAN commands, too.

Regards

Michal

 

Genericus
Moderator
Moderator
   VIP   

I have rman backups, scripted.  ( These are generic scripts provided by NetBackup, edited )

The Full backup is ran "HOT" so archive logs generate during the backup.

The RMAN Archive log policy automatically removes archive logs after running.

Policy selection is /oracle/rman/arch.sh

defines ORACLE_HOME, ORACLE_SID, ORACLE_USER, calls rcv file CMDFILE=${NB_ORA_SCRIPTS}/arch.rcv

rcv file essentially runs this:

run {
# Hot database level 0 whole backup
allocate channel t1 type 'SBT_TAPE';
allocate channel t2 type 'SBT_TAPE';
send 'NB_ORA_CLASS=RMAN.ARCH.PROD';
send 'NB_ORA_CLIENT=db-backup';
backup
incremental level 0
skip inaccessible
tag ARCHIVE
filesperset 1
# recommended format
format 'bk_%s_%p_%t'
archivelog all delete input;  ------ I think this deletes the archive logs afterwards

# Backup current control file
backup format 'cf_%d_%s_%p_%t' current controlfile;

}

NetBackup 9.1.0.1 on Solaris 11, writing to Data Domain 9800 7.7.4.0
duplicating via SLP to LTO5 & LTO8 in SL8500 via ACSLS