![]() | |
![]() |
| | Thread Tools | Display Modes |
#1
| |||
| |||
|
|
In one folder, we keep two fresh backup files for one database. Their name like D20040120630.bak and D20040121644.bak. The name base on date and time of the backup file created. Our question is how to create a job to automatically chose the newest backup file to restore database daily. Can anybody give me a hand, thanks in advance... Harry |
#2
| |||
| |||
|
|
-----Original Message----- Don't use the filename use the file date (property of the file) use the filesystemobject to loop through the directory comparing file create dates. Pick up the name and build the script. -- ---------------------------- Allan Mitchell MCSE,MCDBA, (Microsoft SQL Server MVP) www.allisonmitchell.com - Expert SQL Server Consultancy. www.SQLDTS.com - The site for all your DTS needs. I support PASS - the definitive, global community for SQL Server professionals - http://www.sqlpass.org "Harry G" <anonymous (AT) discussions (DOT) microsoft.com> wrote in message news:1bf701c3e02b$78421c80$a501280a (AT) phx (DOT) gbl... In one folder, we keep two fresh backup files for one database. Their name like D20040120630.bak and D20040121644.bak. The name base on date and time of the backup file created. Our question is how to create a job to automatically chose the newest backup file to restore database daily. Can anybody give me a hand, thanks in advance... Harry . |
#3
| |||
| |||
|
|
Thanks Allan, But for the filesystemobject, do I need to create a VB script to do loop. Harry -----Original Message----- Don't use the filename use the file date (property of the file) use the filesystemobject to loop through the directory comparing file create dates. Pick up the name and build the script. -- ---------------------------- Allan Mitchell MCSE,MCDBA, (Microsoft SQL Server MVP) www.allisonmitchell.com - Expert SQL Server Consultancy. www.SQLDTS.com - The site for all your DTS needs. I support PASS - the definitive, global community for SQL Server professionals - http://www.sqlpass.org "Harry G" <anonymous (AT) discussions (DOT) microsoft.com> wrote in message news:1bf701c3e02b$78421c80$a501280a (AT) phx (DOT) gbl... In one folder, we keep two fresh backup files for one database. Their name like D20040120630.bak and D20040121644.bak. The name base on date and time of the backup file created. Our question is how to create a job to automatically chose the newest backup file to restore database daily. Can anybody give me a hand, thanks in advance... Harry . |
#4
| |||
| |||
|
|
In one folder, we keep two fresh backup files for one database. Their name like D20040120630.bak and D20040121644.bak. The name base on date and time of the backup file created. Our question is how to create a job to automatically chose the newest backup file to restore database daily. Can anybody give me a hand, thanks in advance... Harry |
#5
| |||
| |||
|
|
I would use the msdb tables such as sysbackuphistory. Using this approach I have created a process that will query for the most recent full backup of a name DB, and also any subsequent log or diff backups, then generate the restore script and run it. -- Darren Green http://www.sqldts.com "Harry G" <anonymous (AT) discussions (DOT) microsoft.com> wrote in message news:1bf701c3e02b$78421c80$a501280a (AT) phx (DOT) gbl... In one folder, we keep two fresh backup files for one database. Their name like D20040120630.bak and D20040121644.bak. The name base on date and time of the backup file created. Our question is how to create a job to automatically chose the newest backup file to restore database daily. Can anybody give me a hand, thanks in advance... Harry |
![]() |
| Thread Tools | |
| Display Modes | |
| |