0% found this document useful (0 votes)
6 views3 pages

Scheduling Archive Deletion and Database Full Backup 1738134436

The document outlines an automated process for database maintenance using RMAN, focusing on scheduling archive log deletions and daily full database backups. It details the setup, scripts, and cron jobs implemented to optimize storage and ensure reliable recovery strategies with minimal manual intervention. Key benefits include improved storage management and consistent backup processes, along with a recommendation to monitor logs regularly.

Uploaded by

Pavan k
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
6 views3 pages

Scheduling Archive Deletion and Database Full Backup 1738134436

The document outlines an automated process for database maintenance using RMAN, focusing on scheduling archive log deletions and daily full database backups. It details the setup, scripts, and cron jobs implemented to optimize storage and ensure reliable recovery strategies with minimal manual intervention. Key benefits include improved storage management and consistent backup processes, along with a recommendation to monitor logs regularly.

Uploaded by

Pavan k
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 3

🚀 Optimizing Database Maintenance with RMAN 🚀

Scheduling Archive deletion and Database Full back-up using RMAN: -

As a database administrator, keeping the database optimized and ensuring backup strategies are robust is a critical part of
our daily operations. Recently, I have implemented an automated process using RMAN (Recovery Manager) to schedule
archive log deletion and full database backups, ensuring smooth operations and sufficient storage.

Here's a quick overview of the approach:

Test SETUP:-
/u001/scripts << Scripts Directory
/u001/scripts/logs << logfiles Directory
/u001/scripts/RMAN_BKP_FULL << Backup Directory
oemrepo << Database Name
oracle << OS User
/home/oracle << Oracle user Home Directory

================ =====================================
1⃣ Automated Archive Deletion:
To manage storage effectively, I scheduled a script to crosscheck and delete archived redo logs older than 3 days. This
ensures that the logs are no longer occupying valuable disk space after being backed up.

++1] oemrepo db archive delete through RMAN : -

cat /u001/scripts/oemrepo_archive_delete.sh
ORACLE_SID=oemrepo
ORACLE_HOME=/u001/app/oracle/product/19.3/dbhome_1
export ORACLE_HOME
PATH=$PATH:$ORACLE_HOME/bin
export PATH
export ORACLE_SID
d=`date '+%d%m%y'`
rman target / cmdfile=/u001/scripts/oemrepo_archive_delete_rman.rmn
log=/u001/scripts/logs/oemrepo_archive_delete_rman_$d.log

============================= ===========================
++2] archive delettion script: -
cat /u001/scripts/oemrepo_archive_delete_rman.rmn
run
{
crosscheck archivelog all;
delete force noprompt archivelog all completed before 'sysdate-3';
}
================ ===============================================
2⃣ Daily Full Database Backups:
Scheduling a daily RMAN full backup helps maintain a strong disaster recovery plan. These backups are critical for
ensuring the availability of the database, even in the event of unexpected failures.
The process is fully automated using cron jobs, running during off-peak hours to avoid impacting performance:

++3] RMAN bkp run command : -

cat /u001/scripts/oemrepo_Rman_fullbkp.sh
ORACLE_SID=oemrepo
ORACLE_HOME==/u001/app/oracle/product/19.3/dbhome_1;export ORACLE_HOME
export ORACLE_HOME
PATH=$PATH:$ORACLE_HOME/bin
export PATH
export ORACLE_SID
d=`date '+%d%m%y'`
rman target / cmdfile=/u001/scripts/oemrepo_full.rmn log=/u001/scripts/logs/oemrepo_full_$d.log

============================ =============================================
++4] RMAN FULL backup Script : -
cat /u001/scripts/oemrepo_full.rmn
run
{
backup as copy current controlfile format '/u001/scripts/RMAN_BKP_FULL/control_before_backup_%T.ctl';
crosscheck backup;
delete backup completed before 'SYSDATE-1';
allocate channel c1 type disk;
allocate channel c2 type disk;
allocate channel c3 type disk;
allocate channel c4 type disk;
allocate channel c5 type disk;
delete backup completed before 'SYSDATE';
crosscheck backup;
backup as compressed backupset database format '/u001/scripts/RMAN_BKP_FULL/DBFULLBKP_%d_%s_%T_%p';
backup as copy current controlfile format '/u001/scripts/RMAN_BKP_FULL/control_after_backup_%T.ctl';
backup as compressed backupset archivelog ALL NOT BACKED UP 1 TIMES format
'/u001/scripts/RMAN_BKP_FULL/%d_%s_%T_%p_archive';
release channel c1;
release channel c2;
release channel c3;
release channel c4;
release channel c5;
}
=============== CRONTAB >> Set Cron here: - ========

crontab -l
#>>>>>> oemrepo archive delete through RMAN <<<<<<<<<

40 23 * * * sh /u001/scripts/oemrepo_archive_delete.sh >> /u001/scripts/logs/oemrepo_archive_delete_log.log 2>&1

#>>>>>>>>> FULL DB RMAN bkp <<<<<<<<<<<<<<<<<<<<

07 00 * * * sh /u001/scripts/oemrepo_Rman_fullbkp.sh >> /u001/scripts/logs/oemrepo_rman_bkp_log.log 2>&1

########################################

Archive Deletion Script:


Runs every day at 11:40 PM (23:40).

Full RMAN Backup Script:


Runs every day at 12:07 AM. (00:07). (mid-night)

Benefits:
Optimized storage usage with regular archive log cleanups.
Reliable recovery strategy with consistent full database backups.
Zero manual intervention through automation.

Pro Tip: Always monitor logs and verify backups regularly to ensure the process is working as intended.
Implement log rotation to keep backup logs manageable...!

Have you implemented similar strategies for database maintenance...?


I'd love to hear how you handle backups and storage management in your environments.....!

======================== ===================================================
www.linkedin.com/in/dbarashid2
--------------------------------------------- -----------------------------------------------------------------------------

You might also like