|
|
|
SSC Rookie
      
Group: General Forum Members
Last Login: Today @ 10:35 AM
Points: 29,
Visits: 176
|
|
Hi, the script is working fine, it doesn't display any errors, but I'd like to know if there are some parts of the current code that could be improved. I'd also like to add something to evaluate which are the most recent backup files, and take those for restoring, since I have backup files from several weeks in a single folder. I currently added a code to delete the backups from cmdshell table that weren't made the current day:
SET @DATE = (CONVERT(VARCHAR,DATEPART(DAY,GETDATE()))) + '/' +(CONVERT(VARCHAR,DATEPART(MONTH,GETDATE()))) --Gets the current day and month -- I added this part to eliminate the backups that were not made the current day DELETE FROM cmdshell WHERE FEntry NOT LIKE @DATE + '%'
but there are sometimes on which the most recent backups are from 1, 2, or more days ago, and I'd like to dynamically get them from cmdshell table, do you have any suggestions??
Thank you very much for your time
|
|
|
|
|
Old Hand
      
Group: General Forum Members
Last Login: Wednesday, June 05, 2013 9:36 PM
Points: 398,
Visits: 2,407
|
|
So what you want is to restore the latest backup? regardless if the backup is 1 or 2 days ago as long as it is the current one? are you restoring...
only 1 backup? 1 diff and 1 full? 1 full?
1. you can retain (in the cmdshell table) the max date from your script 2. you can look per filename (which is your format) or per system date (the first 20 chars of the result in cmdshell table)
"-=Still Learning=-"
Lester Policarpio
|
|
|
|