Home » Topic » Getting SQL Error 3159

Getting SQL Error 3159

Stephen West ~ Modified: July 29th, 2015 ~ ~ 1 Minute Reading

Home Forums Getting SQL Error 3159

Viewing 6 posts - 1 through 6 (of 6 total)
  • Author
    Posts
  • #385 Score: 0
    Stephen West
    Moderator
    4 pts

    I tried to restore my database and exceptionally I got this error Msg:

    Msg 3159, Level 16, State 1, Line 1
    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.

    I am not a DBA & have limited database knowledge.

    Any Idea ?

    #391 Score: 0
    Lincoln Burrows
    Moderator
    16 pts

    Which SQL Server Version you are using right now?

    #392 Score: 0
    Stephen West
    Moderator
    4 pts

    I am using SQL Server 2012 version please provide any solution for this error

    #393 Score: 0
    Lincoln Burrows
    Moderator
    16 pts

    Try this query:
    RESTORE DATABASE mydb
    FROM DISK = ‘C:\Backupmydb.bak’
    WITH MOVE ‘mydb_Data’ TO ‘C:\Data’,
    MOVE ‘mydb_Log’ TO ‘C:\Data’

    May this works perfectly with SQL Server 2012.

    #1701 Score: 0
    Andrew Jackson
    Moderator
    1 pt

    The reason of error is self explained means that the error reason is explained in error message.
    Use BACKUP LOG WITH NORECOVERY to backup the log if it contains work you do not want to lose.
    You need to restore the database from full backup using WITH REPLACE clause something like this:

    RESTORE DATABASE DATABASE_NAME FROM DISK = 'C:\database.BAK'
    WITH REPLACE
    GO
    #1710 Score: 0
    Lincoln Burrows
    Moderator
    16 pts

    To know more how to fix the Microsoft SQL Server Error 3159, please go this nicely written article. http://www.sqlserverlogexplorer.com/resolve-sql-server-error-3159/

Viewing 6 posts - 1 through 6 (of 6 total)
  • You must be logged in to reply to this topic.