Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2005 Forums
 SQL Server Administration (2005)
 to read TRN file names from a folder

Author  Topic 

deal11deal1
Starting Member

34 Posts

Posted - 2008-09-11 : 22:13:32
Hello every one.

we are in the process of restoring a database with 1 full backup and about 38 trans log backups. the problem is we have about 180

databases so the process can be very tedious. My manager want's me to come up with either a t-script or batch script so it can just

read the names of the trn files from a folder and plug it in the restore script , he doesnt want me to do it one by one as for 180 databases will take

alot of time. iIknow how to back up and restore but have no idea how to go about make it read it from a file.

i hope every 1 out there will understand by problem . the trn files are sitting in a folder , from there they will be restored.

Thanx

bobby

khtan
In (Som, Ni, Yak)

17689 Posts

Posted - 2008-09-11 : 22:15:05
one way is to use xp_cmdshell DIR the folder to get the filename


KH
[spoiler]Time is always against us[/spoiler]

Go to Top of Page

sodeep
Master Smack Fu Yak Hacker

7174 Posts

Posted - 2008-09-12 : 09:09:50
One thought if you have disk space:
Why can't you take differential backup so that you don't have to restore all TRN log backup?
Go to Top of Page

deal11deal1
Starting Member

34 Posts

Posted - 2008-09-12 : 11:09:08
we tried to get them to get us diff backups but its too late and they have already send in the trn files which we have here on our location. about the xp.cmdshell . can any please explain it to me more how to use it , sry i am totally new in this kind of scripting. any help will be so lifesaving .
Thanks
Bobby
Go to Top of Page
   

- Advertisement -