Use rsync on Unix to backup your archive logs

Rsync is a useful Unix tool for keeping directories in synch between two server.  I use it to copy Oracle archive logs from a production server to a test server.

This command runs on my test server from the oracle user's crontab every 5 minutes.  It copies the files via SSH.  New files from the source directory are copied to the test backup directory.  If a file is deleted from the source directory, it is NOT removed from the target directory.  I have it setup this way because I want to control that manually.  I have a separate cronjob that purges archive log files over 3 days old.

rsync -rave "ssh -l oracle" sourceServer:/u06/oradata/PROD/arch  /u06/oradata/prodArchBkp

Rsync also preserves the timestamp of the source file in the target directory.

You can also use rsync to delete files in the target directory that do not exist in the source directory.

rsync -rave "ssh -l oracle" --delete sourceServer:/u06/oradata/PROD/arch  /u06/oradata/prodArchBkp

Comments

Popular posts from this blog

Auditing user logon and logoff in Oracle

RMAN Restore vs. Recovery - what's the difference?