Bash script for copying backup files...
The former DBA killed all backups so my first order of business is to get them going with RMAN ( done ) and then copy them to another host for redundancy, and then sweep to tape.
I just need a way to get yesterdays date with bash on solaris but the man pages suggest I can only format dates and not do any date-1 or 'yesterday'.
Thu Apr 24 15:11:18 CDT 2003
oracle@oem01--/export/home/oracle>date +%a' '%b' '$X' '%H':'%M':'%S' '%Z' '%Y
Thu Apr 23 15:15:12 CDT 2003
hope this helps
Last edited by mharoon99; 04-24-2003 at 05:22 PM.
Moe M Haroon
RMAN, RMAN, RMAN, lemme see. RMAN supports operations involving sysdate, so you can do things like 'sysdate - 1.' Why are you trying to manipulate dates via the OS?
You can find files (via the find command) that have been accessed or modified (-atime and -mtime) based on +/-/exactly n days. Is that what you are looking for?
I have started rman backups into a local directories on the 3 production machines. There are no tape drives. I am writing this script to run after the backups and copy the latest set to another host, round robbin so every box will copy backups to the next one in a circle. The rman process writes to a dir where it keeps 6 sets and deletes the oldest. I just want to copy the newest per above.
Our bash on solaris looks fairly 'light' as date has no -d option so all the web examples wont work.
But I was overengineering anyway, stecal's approach of correctly using 'find' grabs the latest filenames for my array and all that is left is to SCP and I am done. I was sidetracked since date is in the filename also.
Phase II is to get the net admin to sweep all 3 2ndary locations to tape after my scripts run.
Phase III is to fix the data guard setups.
Then I begin sleeping better
Thanks for the help! Great site!
Click Here to Expand Forum to Full Width