how to resolve sql server error 3159

11
How to Resolve SQL Server Error 3159 Msg 3159, Level 16, State 1, Line 1 The tail of the log for the database “DATBASE_NAME” has not been backed up.

Upload: jasonclark03

Post on 20-Jan-2017

232 views

Category:

Technology


0 download

TRANSCRIPT

Page 1: How to Resolve SQL Server Error 3159

How to Resolve SQL Server Error 3159

Msg 3159, Level 16, State 1, Line 1The tail of the log for the database “DATBASE_NAME” has not been backed up.

Page 2: How to Resolve SQL Server Error 3159

Index

1. Intro to Error 31592. The Error Message3. Reasons of Error 31594. How to Fix the Issue 3159

a. Using T-SQLb. Using SSMS

5. Conclusion6. Read More

Page 3: How to Resolve SQL Server Error 3159

Intro to Error 3159

The backup failed because tail log backup is not available. The error 3159 is self defined error because the error message shows that how can we resolve the error using overwrite or using WITH REPLACE/STOPAT option.

Page 4: How to Resolve SQL Server Error 3159

The Error Message

Msg: 3159, Level 16, State 1, Line 1The tail of the log for the database “DATABASE_NAME” has not been backed up.Use BACKUP LOG WITH NORECOVERY to backup the log if it contains work you do not want to lose.

Page 5: How to Resolve SQL Server Error 3159

Reasons of Error 3159

 The below mentioned reasons are responsible for this error:1. Media failure2. Read & write failure3. Tail of Data has not Backed up correctly

Page 6: How to Resolve SQL Server Error 3159

How to Fix the Issue 3159

 There are two methods to fix the SQL Server database restore and overwrite error 3159.

1. Using T-SQL 2. Using SSMS

Page 7: How to Resolve SQL Server Error 3159

To fix the issue 3159 need to run the query stated below:Example:

ALTER DATABASE Database_NameSET SINGLE_USER WITHROLLBACK IMMEDIATERESTORE DATABASE Database_NameFROM DISK = 'C\:BackupDatabase_Name.bak'WITH MOVE ' Database_Name _Data' TO 'C:\Data\

datafile.mdf',MOVE ' Database_Name _Log' TO 'C:\Data\logfile.ldf',REPLACE

1. Using T-SQL

Page 8: How to Resolve SQL Server Error 3159

2. Using SSMS

The copy database wizard allows you to export or transfer the database objects and data from one SQL Server instance to another with no downtime issues.

Continue..

Page 9: How to Resolve SQL Server Error 3159

To restore using SSMS do the following, on the options page for the restore select "Overwrite the existing database".

Page 10: How to Resolve SQL Server Error 3159

Conclusion

The present tutorial is all about the error 3159. In this tutorial I have tried to explain why the error 3159 occurs and what are the methods are that can be used to fix the issue 3159.

Page 11: How to Resolve SQL Server Error 3159

To know more about the SQL Server error 3159 please go this.http://www.sqlserverlogexplorer.com/resolve-sql-server-error-3159/

Read More..