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)
 Restoring .bak files with transaction backups

Author  Topic 

SJMAC
Starting Member

1 Post

Posted - 2013-03-04 : 19:41:36
Hi Guys,

First up Im new here so hello and sorry if i've commited a forum faux-pas by jumping in a posting straight off...

Anyway, I dont have much experience with sql however I need to be able to restore databases from .bak file with transaction backups. As I understand it transaction backups need to be restore with a database back up and the must be restored in chronaligical order.

Can anyone advise me if the below script should work? Here i am trying to restore POS and History databases along with transactional backups that have been generated since the POS/History backups were created

RESTORE DATABASE POS FROM DISK = 'C:\Temp2\POS.BAK'
WITH NORECOVERY

RESTORE DATABASE HISTORY FROM DISK = 'C:\Temp2\History.BAK'
WITH NORECOVERY

RESTORE LOG POS FROM DISK = 'C:\Temp2\POS_20130304_101814.TRN'
WITH NORECOVERY

RESTORE LOG POS FROM DISK = 'C:\Temp2\HISTORY_20130304_101815.TRN'
WITH NORECOVERY

RESTORE LOG POS FROM DISK = 'C:\Temp2\POS_20130304_104714.TRN'
WITH NORECOVERY

RESTORE LOG POS FROM DISK = 'C:\Temp2\HISTORY_20130304_104714.TRN'
WITH NORECOVERY

RESTORE LOG POS FROM DISK = 'C:\Temp2\POS_20130304_111613.TRN'
WITH NORECOVERY

RESTORE LOG POS FROM DISK = 'C:\Temp2\HISTORY_20130304_111614.TRN'
WITH NORECOVERY

RESTORE LOG POS FROM DISK = 'C:\Temp2\POS_20130304_111613.TRN'
WITH NORECOVERY

RESTORE LOG POS FROM DISK = 'C:\Temp2\HISTORY_20130304_111614.TRN'
WITH NORECOVERY

RESTORE DATABASE POS WITH RECOVERY

RESTORE DATABASE HISTORY WITH RECOVERY

Any help here would be much appreciated!

Thanks, SJ

robvolk
Most Valuable Yak

15732 Posts

Posted - 2013-03-04 : 20:31:28
Assuming that files named HISTORY are for the history database, just some fixes:

RESTORE DATABASE POS FROM DISK = 'C:\Temp2\POS.BAK'
WITH NORECOVERY

RESTORE DATABASE HISTORY FROM DISK = 'C:\Temp2\History.BAK'
WITH NORECOVERY

RESTORE LOG POS FROM DISK = 'C:\Temp2\POS_20130304_101814.TRN'
WITH NORECOVERY

RESTORE LOG HISTORY FROM DISK = 'C:\Temp2\HISTORY_20130304_101815.TRN'
WITH NORECOVERY

RESTORE LOG POS FROM DISK = 'C:\Temp2\POS_20130304_104714.TRN'
WITH NORECOVERY

RESTORE LOG HISTORY FROM DISK = 'C:\Temp2\HISTORY_20130304_104714.TRN'
WITH NORECOVERY

RESTORE LOG POS FROM DISK = 'C:\Temp2\POS_20130304_111613.TRN'
WITH NORECOVERY

RESTORE LOG HISTORY FROM DISK = 'C:\Temp2\HISTORY_20130304_111614.TRN'
WITH NORECOVERY

RESTORE LOG POS FROM DISK = 'C:\Temp2\POS_20130304_111613.TRN'
WITH NORECOVERY

RESTORE LOG HISTORY FROM DISK = 'C:\Temp2\HISTORY_20130304_111614.TRN'
WITH NORECOVERY

RESTORE DATABASE POS WITH RECOVERY

RESTORE DATABASE HISTORY WITH RECOVERY
Go to Top of Page
   

- Advertisement -