i try to backup and restore database using sql-server 2008 and got error.
to backup i done this: BACKUP DATABASE MyDB TO DISK='d:\MyDB.BAK'
(and its work fine)
to restore i done this: USE MASTER RESTORE DATABASE MyDB FROM DISK='d:\MyDB.BAK
and got this error:
Msg 3159, Level 16, State 1, Line 7
The tail of the log for the database "MyDB " has not been backed up. Use BACKUP LOG WITH NORECOVERY to backup the log if it contains work you do not want to lose. Use the WITH REPLACE or WITH STOPAT clause of the RESTORE statement to just overwrite the contents of the log.
Msg 3013, Level 16, State 1, Line 7
RESTORE DATABASE is terminating abnormally.
Where I'm wrong ? what is missing ?
开发者_StackOverflow中文版thank's in advance
If your MyDB database is in "Full" recovery mode you'll need to do exactly as the message says and back up the log serperately or replace it.
So change your restore command to
RESTORE DATABASE MyDB FROM DISK='d:\MyDB.BAK' WITH REPLACE
If you don't need to be in "Full" recovery mode change to "Simple" and avoid dealing with logs
精彩评论