Getting error while restoring a database

  • Hello people, I am new in SQL Server world. learning database administration and using SQL Server 2008. First, I created Sales database.  Then I took the backup of that database. But now when I am trying to restore this Sales database I get an error. The problem is that whenever I am trying to restore a database I get an error: Restore failed for server <server name> (Microsoft.SQLServer.SmoExtended). I googled about it, read few links but it confused me. Please help

  • Is there any additional information after the error message? It might be bacause your database currently in use. If so you will need to close all existing connections to the database. You can do this through the GUI or in the restore script by setting the database to be single user with rollback immediate.
    ALTER DATABASE {Database_Name}
    SET SINGLE_USER WITH ROLLBACK IMMEDIATE
    Run restore script.

    Thanks

  • Hello Sir,
                        I am getting this message for all the other databases also. I closed all the existing connections but still getting an error.
    Restore failed for Server 'DESKTOP-U6L7VBS'. (Microsoft.SqlServer.SmoExtended)

    For help, click: http://go.microsoft.com/fwlink?ProdName=Microsoft+SQL+Server&ProdVer=10.50.1600.1+((KJ_RTM).100402-1539+)&EvtSrc=Microsoft.SqlServer.Management.Smo.ExceptionTemplates.FailedOperationExceptionText&EvtID=Restore+Server&LinkId=20476
    ------------------------------
    ADDITIONAL INFORMATION:
    System.Data.SqlClient.SqlError: The tail of the log for the database "Sales" 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. (Microsoft.SqlServer.Smo)

  • praspras42 - Wednesday, May 3, 2017 4:09 AM

    Hello Sir,
                        I am getting this message for all the other databases also. I closed all the existing connections but still getting an error.
    Restore failed for Server 'DESKTOP-U6L7VBS'. (Microsoft.SqlServer.SmoExtended)

    For help, click: http://go.microsoft.com/fwlink?ProdName=Microsoft+SQL+Server&ProdVer=10.50.1600.1+((KJ_RTM).100402-1539+)&EvtSrc=Microsoft.SqlServer.Management.Smo.ExceptionTemplates.FailedOperationExceptionText&EvtID=Restore+Server&LinkId=20476
    ------------------------------
    ADDITIONAL INFORMATION:
    System.Data.SqlClient.SqlError: The tail of the log for the database "Sales" 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. (Microsoft.SqlServer.Smo)

    The error message gives you what's wrong.

    You need to take a tail log backup before you can restore.
    If you don't care about the database your overwriting use the WITH REPLACE option of the RESTORE statement.

  • anthony.green - Wednesday, May 3, 2017 4:23 AM

    praspras42 - Wednesday, May 3, 2017 4:09 AM

    Hello Sir,
                        I am getting this message for all the other databases also. I closed all the existing connections but still getting an error.
    Restore failed for Server 'DESKTOP-U6L7VBS'. (Microsoft.SqlServer.SmoExtended)

    For help, click: http://go.microsoft.com/fwlink?ProdName=Microsoft+SQL+Server&ProdVer=10.50.1600.1+((KJ_RTM).100402-1539+)&EvtSrc=Microsoft.SqlServer.Management.Smo.ExceptionTemplates.FailedOperationExceptionText&EvtID=Restore+Server&LinkId=20476
    ------------------------------
    ADDITIONAL INFORMATION:
    System.Data.SqlClient.SqlError: The tail of the log for the database "Sales" 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. (Microsoft.SqlServer.Smo)

    The error message gives you what's wrong.

    You need to take a tail log backup before you can restore.
    If you don't care about the database your overwriting use the WITH REPLACE option of the RESTORE statement.

    Thank you very much all for the replies. I restored it.

  • This was removed by the editor as SPAM

  • JasonClark - Monday, July 10, 2017 5:38 AM

    Either the data file with same names may be already present in the target folder where the database is being restored or it might be opened somewhere . Use a different file name to restore

    Based on the error message that the OP posted, neither of those were the case.

    Gail Shaw
    Microsoft Certified Master: SQL Server, MVP, M.Sc (Comp Sci)
    SQL In The Wild: Discussions on DB performance with occasional diversions into recoverability

    We walk in the dark places no others will enter
    We stand on the bridge and no one may pass

Viewing 7 posts - 1 through 6 (of 6 total)

You must be logged in to reply to this topic. Login to reply