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


moving a database with differentials


moving a database with differentials

Author
Message
jjturner
jjturner
SSC-Addicted
SSC-Addicted (434 reputation)SSC-Addicted (434 reputation)SSC-Addicted (434 reputation)SSC-Addicted (434 reputation)SSC-Addicted (434 reputation)SSC-Addicted (434 reputation)SSC-Addicted (434 reputation)SSC-Addicted (434 reputation)

Group: General Forum Members
Points: 434 Visits: 588
Is it possible to RESTORE WITH MOVE and subsequently RESTORE the remaining backup chain (DIFF's and LOG's) to the new location?

I'm getting this error when I try to RESTORE the DIFF after RESTORE WITH MOVE on the FULL:

Msg 3136, Level 16, State 1, Line 2
This differential backup cannot be restored because the database has not been restored to the correct earlier state.

Lincoln Burrows
Lincoln Burrows
SSChampion
SSChampion (10K reputation)SSChampion (10K reputation)SSChampion (10K reputation)SSChampion (10K reputation)SSChampion (10K reputation)SSChampion (10K reputation)SSChampion (10K reputation)SSChampion (10K reputation)

Group: General Forum Members
Points: 10769 Visits: 1230
Make sure your database not in use while taking backups. Please follow following steps sequentially:

At first restore the full backup

Restore Database file from DISK ='d: \file.bak' With NoRecovery

Then restore the differential backup file from DISK ='d: \file_differential.bak' With Recovery
Beatrix Kiddo
Beatrix Kiddo
SSCoach
SSCoach (16K reputation)SSCoach (16K reputation)SSCoach (16K reputation)SSCoach (16K reputation)SSCoach (16K reputation)SSCoach (16K reputation)SSCoach (16K reputation)SSCoach (16K reputation)

Group: General Forum Members
Points: 16433 Visits: 5675
Yes, you have to restore the full backup first or you won't be able to restore that differential.
John Mitchell-245523
John Mitchell-245523
SSC Guru
SSC Guru (80K reputation)SSC Guru (80K reputation)SSC Guru (80K reputation)SSC Guru (80K reputation)SSC Guru (80K reputation)SSC Guru (80K reputation)SSC Guru (80K reputation)SSC Guru (80K reputation)

Group: General Forum Members
Points: 80868 Visits: 17941
jjturner (8/5/2014)
Is it possible to RESTORE WITH MOVE and subsequently RESTORE the remaining backup chain (DIFF's and LOG's) to the new location?

I'm getting this error when I try to RESTORE the DIFF after RESTORE WITH MOVE on the FULL:

Msg 3136, Level 16, State 1, Line 2
This differential backup cannot be restored because the database has not been restored to the correct earlier state.

From what you say, it sounds as if you didn't use the WITH NORECOVERY clause in your original RESTORE statement. Please post your RESTORE statements if that isn't the case.

You don't need to make sure the database is not in use when backing up - SQL Server handles open transactions during recovery.

John
jjturner
jjturner
SSC-Addicted
SSC-Addicted (434 reputation)SSC-Addicted (434 reputation)SSC-Addicted (434 reputation)SSC-Addicted (434 reputation)SSC-Addicted (434 reputation)SSC-Addicted (434 reputation)SSC-Addicted (434 reputation)SSC-Addicted (434 reputation)

Group: General Forum Members
Points: 434 Visits: 588
use master;
go
restore database new_loc_testdb
from disk = '\\backup_dir\full\prod_full_20140803_233000.bak'
with
--replace
checksum
,move 'prod01' to 'e:\temp_restore\data01.mdf'
,move 'prod02' to 'e:\temp_restore\data02.ndf'
,move 'prod03' to 'e:\temp_restore\data03.ndf'
,move 'prod04' to 'e:\temp_restore\data04.ndf'
,move 'prod_log' to 'e:\temp_restore\testlog.ldf'
,norecovery
go

restore database new_loc_testdb
from disk = '\\backup_dir\diff\prod_diff_20140806_233000.bak'
with
checksum
,move 'prod01' to 'e:\temp_restore\data01.mdf'
,move 'prod02' to 'e:\temp_restore\data02.ndf'
,move 'prod03' to 'e:\temp_restore\data03.ndf'
,move 'prod04' to 'e:\temp_restore\data04.ndf'
,move 'prod_log' to 'e:\temp_restore\testlog.ldf'
,recovery;



Processed 177488 pages for database 'new_loc_testdb', file 'prod01' on file 1.
Processed 39448 pages for database 'new_loc_testdb', file 'prod02' on file 1.
Processed 41664 pages for database 'new_loc_testdb', file 'prod03' on file 1.
Processed 26144 pages for database 'new_loc_testdb', file 'prod04' on file 1.
Processed 3 pages for database 'new_loc_testdb', file 'prod_log' on file 1.
RESTORE DATABASE successfully processed 284747 pages in 13.255 seconds (167.829 MB/sec).
Msg 3136, Level 16, State 1, Line 13
This differential backup cannot be restored because the database has not been restored to the correct earlier state.
Msg 3013, Level 16, State 1, Line 13
RESTORE DATABASE is terminating abnormally.

anthony.green
anthony.green
SSC Guru
SSC Guru (63K reputation)SSC Guru (63K reputation)SSC Guru (63K reputation)SSC Guru (63K reputation)SSC Guru (63K reputation)SSC Guru (63K reputation)SSC Guru (63K reputation)SSC Guru (63K reputation)

Group: General Forum Members
Points: 63338 Visits: 8598
The full backup isn't a copy only backup is it?

Can you check the server where the backup was done from, in its msdb.dbo.backupset there is a is_copy_only column, if its 1 then that might be a reason for the error



How to post data/code for the best help - Jeff Moden
Need a string splitter, try this - Jeff Moden
How to post performance problems - Gail Shaw
Managing Transaction Logs - Gail Shaw
Troubleshooting SQL Server: A Guide for the Accidental DBA - Jonathan Kehayias and Ted Krueger


John Mitchell-245523
John Mitchell-245523
SSC Guru
SSC Guru (80K reputation)SSC Guru (80K reputation)SSC Guru (80K reputation)SSC Guru (80K reputation)SSC Guru (80K reputation)SSC Guru (80K reputation)SSC Guru (80K reputation)SSC Guru (80K reputation)

Group: General Forum Members
Points: 80868 Visits: 17941
Yes, or maybe another full backup was taking between the two backups you're working from? Again, check in msdb.dbo.backupset.

By the way, you don't need the MOVE clauses when you're restoring a differential.

John
Lincoln Burrows
Lincoln Burrows
SSChampion
SSChampion (10K reputation)SSChampion (10K reputation)SSChampion (10K reputation)SSChampion (10K reputation)SSChampion (10K reputation)SSChampion (10K reputation)SSChampion (10K reputation)SSChampion (10K reputation)

Group: General Forum Members
Points: 10769 Visits: 1230
Please check your differential backup databases and log file before recovery that they are created properly or not.
jjturner
jjturner
SSC-Addicted
SSC-Addicted (434 reputation)SSC-Addicted (434 reputation)SSC-Addicted (434 reputation)SSC-Addicted (434 reputation)SSC-Addicted (434 reputation)SSC-Addicted (434 reputation)SSC-Addicted (434 reputation)SSC-Addicted (434 reputation)

Group: General Forum Members
Points: 434 Visits: 588
Thanks folks for looking into this for me -

I'm using Ola Hallengren's backup scripts and the @CopyOnly switch has not been altered from its default of 'N':
sqlcmd -E -S $(ESCAPE_SQUOTE(SRVR)) -d master -Q "EXECUTE [dbo].[DatabaseBackup] @Databases = 'USER_DATABASES', @Directory = N'\\backup_dir', @BackupType = 'FULL', @Verify = 'Y', @Compress = 'Y', @CleanupTime = 337, @CheckSum = 'Y', @LogToTable = 'Y'" -b



And 20140803 was definitely the last FULL backup on this database taken via that job.

But speaking of intervening FULL backups...
I do see something odd with msdb..backupset -
I have a unique service account running for my SQL Server services, but NT AUTHORITY\SYSTEM is still producing backups... Alien
My backup script job takes a FULL once per week, but some process using NT AUTHORITY\SYSTEM is taking a FULL backup every night... where is this coming from and where are those backups going???
John Mitchell-245523
John Mitchell-245523
SSC Guru
SSC Guru (80K reputation)SSC Guru (80K reputation)SSC Guru (80K reputation)SSC Guru (80K reputation)SSC Guru (80K reputation)SSC Guru (80K reputation)SSC Guru (80K reputation)SSC Guru (80K reputation)

Group: General Forum Members
Points: 80868 Visits: 17941
That'll be the SQL Server VSS Writer service. You should switch it off if you have a complete database backup regime in place (which, of course, you should).

John
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