Friday, January 28, 2011

sql Database Restore

Hi I want restore database from backup file so i have used the following command

restore database myTestDbName from disk ='C:\temp\mybackuo.bak'

while executing the command I got following error

"The tail of the log for the database "myTestDbName" 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. RESTORE DATABASE is terminating abnormally."

To get the back up of data base i used following command

backup database myTestDbName to disk ='c:\temp\mybackuo.bak' with init,stats=10

Please reply me as soon as possible.

Thanks

Munish

  • This is really a question for ServerFault, but the documentation is quite clear about what the error means and what action you need to take:

    http://msdn.microsoft.com/en-us/library/bb283410.aspx

    See also here:

    http://msdn.microsoft.com/en-us/library/ms179314.aspx

    In your case, if you really do want to overwrite the existing database, you need to specify WITH REPLACE.

    From Pondlife
  • You have the solution to your problem in your question. :-

    The problem is that you have an existing database log that you need to backup before you restore the database.

    You can either do the command Backup Log with NoRecovery, then you will be able to restore your DB

    Or..

    If you want to overwrite this log you can use the with backup log with replace or with stopat clauses.

    From Wes Price

0 comments:

Post a Comment