dbTalk Databases Forums  

Re: Database restore problem

microsoft.public.sqlserver.dts microsoft.public.sqlserver.dts


Discuss Re: Database restore problem in the microsoft.public.sqlserver.dts forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
Allan Mitchell
 
Posts: n/a

Default Re: Database restore problem - 01-21-2004 , 08:39 AM






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

Quote:
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



Reply With Quote
  #2  
Old   
Harry G
 
Posts: n/a

Default Re: Database restore problem - 01-21-2004 , 08:48 AM






Thanks Allan,
But for the filesystemobject, do I need to create a VB
script to do loop.

Harry
Quote:
-----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


.


Reply With Quote
  #3  
Old   
Allan Mitchell
 
Posts: n/a

Default Re: Database restore problem - 01-21-2004 , 08:57 AM



Yep

similar to


How can I check if a file exists?
(http://www.sqldts.com/default.aspx?211)

Looping, Importing and Archiving
(http://www.sqldts.com/default.aspx?246)
--

----------------------------

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

Quote:
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


.




Reply With Quote
  #4  
Old   
Darren Green
 
Posts: n/a

Default Re: Database restore problem - 01-21-2004 , 10:53 AM



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

Quote:
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



Reply With Quote
  #5  
Old   
Darren Green
 
Posts: n/a

Default Re: Database restore problem - 01-21-2004 , 11:04 AM



As Allan has kindly pointed out to me we have moved on from v6.5! The tables
I mean are
msdb.dbo.backupset, msdb.dbo.backupmediafamily, msdb.dbo.backupfile which
are the 7.0/2000 equivalents! Sorry for any confusion.


--
Darren Green
http://www.sqldts.com



"Darren Green" <darren.green (AT) reply-to-newsgroup-sqldts (DOT) com> wrote

Quote:
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





Reply With Quote
Reply




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.3
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.