12-21-2019 06:24 PM
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
12-23-2019 12:15 AM - edited 12-23-2019 12:31 AM
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
01-13-2020 03:45 AM
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
01-13-2020 07:34 AM
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
01-17-2020 07:10 AM - edited 01-17-2020 07:11 AM
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;
}