SQL Clone
SQLServerCentral is supported by Redgate
 
Log in  ::  Register  ::  Not logged in
 
 
 


sp_DatabaseRestore


sp_DatabaseRestore

Author
Message
Mike Scalise
Mike Scalise
Hall of Fame
Hall of Fame (3.5K reputation)Hall of Fame (3.5K reputation)Hall of Fame (3.5K reputation)Hall of Fame (3.5K reputation)Hall of Fame (3.5K reputation)Hall of Fame (3.5K reputation)Hall of Fame (3.5K reputation)Hall of Fame (3.5K reputation)

Group: General Forum Members
Points: 3537 Visits: 1023
Hi,

I'm just curious if others use sp_DatabaseRestore from Brent Ozar's First Responder's Kit. If so, are you having any issues restoring differentials?

Here's some context. I use Ola's scripts for our full, diff, and t-log backups. It has served us well. I wanted an easy way to restore just the full, the full + diff, or full + t-log (point in time) if I needed to. I've found that I can successfully do the first and third (just the full and full + t-log). However, if I simply try to restore a full and a differential, I only ever end up with the full. Now I haven't dug into the code a ton. I actually plan to, but before I spend hours trying to figure out what's happening, I thought I'd at least check with all of you to see if you notice anything dumb that I'm just missing. Here's an example of a command I'd use to attempt to restore the full and diff.

EXEC DBA_Utils.dbo.sp_DatabaseRestore 
@Database = 'production',
@RestoreDatabaseName = 'test',
@BackupPathFull = 'E:\temporary\FULL\',
@BackupPathDiff = 'E:\temporary\DIFF\',
@RestoreDiff = 1,
@ContinueLogs = 0,
@RunRecovery = 1,
@TestRestore = 0,
@Debug = 1;


I should also note that the debug does not print commands that indicate that a diff restore is happening, so it seems to not even get to the correct block of code. Before I go digging, does anyone see anything inherently wrong with my stored procedure call?

Thanks in advance,

Mike

Mike Scalise, PMP
https://www.michaelscalise.com
AlexSQLForums
AlexSQLForums
SSCrazy Eights
SSCrazy Eights (8.7K reputation)SSCrazy Eights (8.7K reputation)SSCrazy Eights (8.7K reputation)SSCrazy Eights (8.7K reputation)SSCrazy Eights (8.7K reputation)SSCrazy Eights (8.7K reputation)SSCrazy Eights (8.7K reputation)SSCrazy Eights (8.7K reputation)

Group: General Forum Members
Points: 8677 Visits: 2543
Can you post your full and diff backup script?

Alex S
Mike Scalise
Mike Scalise
Hall of Fame
Hall of Fame (3.5K reputation)Hall of Fame (3.5K reputation)Hall of Fame (3.5K reputation)Hall of Fame (3.5K reputation)Hall of Fame (3.5K reputation)Hall of Fame (3.5K reputation)Hall of Fame (3.5K reputation)Hall of Fame (3.5K reputation)

Group: General Forum Members
Points: 3537 Visits: 1023
AlexSQLForums - Wednesday, February 7, 2018 2:57 PM
Can you post your full and diff backup script?

Hi Alex,

I'm not exactly sure what you mean. I use Ola Hallengren's backup scripts. What exactly are you looking for?

I should also note that I was able to restore the full and the diff using the RESTORE DATABASE command, so I know there's not an issue with the backup files themselves (at least, I think that proves that there isn't...)

Thanks,

Mike

Mike Scalise, PMP
https://www.michaelscalise.com
AlexSQLForums
AlexSQLForums
SSCrazy Eights
SSCrazy Eights (8.7K reputation)SSCrazy Eights (8.7K reputation)SSCrazy Eights (8.7K reputation)SSCrazy Eights (8.7K reputation)SSCrazy Eights (8.7K reputation)SSCrazy Eights (8.7K reputation)SSCrazy Eights (8.7K reputation)SSCrazy Eights (8.7K reputation)

Group: General Forum Members
Points: 8677 Visits: 2543
Hi Mike
I think you have to specify log directory as well

EXEC dbo.sp_DatabaseRestore 
@Database = 'TEST1',
@BackupPathFull = '\\PATHTOFILE\FULL\',
@BackupPathDiff = '\\PATHTOFILE\DIFF\',
@BackupPathLog = '\\PATHTOFILE\LOG\',
@RestoreDiff = 1,
@ContinueLogs = 0,
@RunRecovery = 1;


Alex S
Mike Scalise
Mike Scalise
Hall of Fame
Hall of Fame (3.5K reputation)Hall of Fame (3.5K reputation)Hall of Fame (3.5K reputation)Hall of Fame (3.5K reputation)Hall of Fame (3.5K reputation)Hall of Fame (3.5K reputation)Hall of Fame (3.5K reputation)Hall of Fame (3.5K reputation)

Group: General Forum Members
Points: 3537 Visits: 1023
AlexSQLForums - Wednesday, February 7, 2018 5:48 PM
Hi Mike
I think you have to specify log directory as well

EXEC dbo.sp_DatabaseRestore 
@Database = 'TEST1',
@BackupPathFull = '\\PATHTOFILE\FULL\',
@BackupPathDiff = '\\PATHTOFILE\DIFF\',
@BackupPathLog = '\\PATHTOFILE\LOG\',
@RestoreDiff = 1,
@ContinueLogs = 0,
@RunRecovery = 1;

Alex,

Thank you for the suggestion. Even though I don't think specifying a log path should be a requirement for diffs, I gave it a try. Unfortunately, it still didn't restore the diff. Now, to be fair, I didn't actually put any log files in the directory--I only specified a path in the call. Also, as you can see, for simplicity, all of my paths are the same. I'm not sure if either of these two things (not putting actual log files in the directory and using the same directory for everything) had anything to do with the diff not getting picked up, but I'll keep digging...

EXEC DBA_Utils.dbo.sp_DatabaseRestore
@TestRestore = 0,
@Database = 'production',
@RestoreDatabaseName = 'production_restored',
@MoveFiles = 1,
@MoveDataDrive = 'E:\temporary\',
@MoveLogDrive = 'E:\temporary\',
@BackupPathFull = 'E:\temporary\',
@BackupPathDiff = 'E:\temporary\',
@BackupPathLog = 'E:\temporary\',
@RestoreDiff = 1,
@ContinueLogs = 0,
@RunRecovery = 1,
@Debug = 1;


Again, thanks for your help with this.

Mike


Mike Scalise, PMP
https://www.michaelscalise.com
AlexSQLForums
AlexSQLForums
SSCrazy Eights
SSCrazy Eights (8.7K reputation)SSCrazy Eights (8.7K reputation)SSCrazy Eights (8.7K reputation)SSCrazy Eights (8.7K reputation)SSCrazy Eights (8.7K reputation)SSCrazy Eights (8.7K reputation)SSCrazy Eights (8.7K reputation)SSCrazy Eights (8.7K reputation)

Group: General Forum Members
Points: 8677 Visits: 2543
Mike
Can you post Ola's backup script which you are using?

Alex S
Mike Scalise
Mike Scalise
Hall of Fame
Hall of Fame (3.5K reputation)Hall of Fame (3.5K reputation)Hall of Fame (3.5K reputation)Hall of Fame (3.5K reputation)Hall of Fame (3.5K reputation)Hall of Fame (3.5K reputation)Hall of Fame (3.5K reputation)Hall of Fame (3.5K reputation)

Group: General Forum Members
Points: 3537 Visits: 1023
AlexSQLForums - Monday, February 12, 2018 2:11 PM
Mike
Can you post Ola's backup script which you are using?

Sure. This is the command I'm using. Do you need more detail than this?

sqlcmd -E -S $(ESCAPE_SQUOTE(SRVR)) -d DBA_Utils -Q "EXECUTE [dbo].[DatabaseBackup] @Databases = 'USER_DATABASES', @Directory = N'F:\SQLBackups', @BackupType = 'DIFF', @Verify = 'Y', @CleanupTime = 360, @CheckSum = 'Y', @LogToTable = 'Y'" -b


Mike Scalise, PMP
https://www.michaelscalise.com
Go


Permissions

You can't post new topics.
You can't post topic replies.
You can't post new polls.
You can't post replies to polls.
You can't edit your own topics.
You can't delete your own topics.
You can't edit other topics.
You can't delete other topics.
You can't edit your own posts.
You can't edit other posts.
You can't delete your own posts.
You can't delete other posts.
You can't post events.
You can't edit your own events.
You can't edit other events.
You can't delete your own events.
You can't delete other events.
You can't send private messages.
You can't send emails.
You can read topics.
You can't vote in polls.
You can't upload attachments.
You can download attachments.
You can't post HTML code.
You can't edit HTML code.
You can't post IFCode.
You can't post JavaScript.
You can post emoticons.
You can't post or upload images.

Select a forum








































































































































































SQLServerCentral


Search