Search This Blog

Tuesday, June 23, 2015

Logshipping Errors



Error 1:
Logshipping backup job fails at the primary server with the error message below:

Message
2014-10-31 14:36:18.44    *** Error: Backup failed for Server ‘<Server Name>’. (Microsoft.SqlServer.SmoExtended) ***
2014-10-31 14:36:18.45    *** Error: An exception occurred while executing a Transact-SQL statement or batch.(Microsoft.SqlServer.ConnectionInfo) ***
2014-10-31 14:36:18.45    *** Error: BACKUP LOG cannot be performed because there is no current database backup.
BACKUP LOG is terminating abnormally.(.Net SqlClient Data Provider) ***
2014-10-31 14:36:18.50    —– END OF TRANSACTION LOG BACKUP   —–

Solution
This message is thrown because the database is never backed up fully before. Do a full backup of the primary database to solve this issue.

Error 2:

Restore database job at the secondary server failed with the error message below:
Error: The restore operation cannot proceed because the secondary database ‘<Database Name>’ is not in NORECOVERY/STANDBY mode.(Microsoft.SqlServer.Management.LogShipping)
Solution :
Restore the secondary database with the full backup of the primary database with NORECOVERY and REPLACE option. An example is given below:
USE [master]
RESTORE DATABASE [TestLST] FROM  DISK = N'G:\Temp\TestLS.bak' WITH  FILE = 1,
MOVE N'TestLS' TO N'E:\SQLData\TestLS.mdf',
MOVE N'TestLS_log' TO N'H:\SQLLog\TestLS_log.ldf',
NORECOVERY,  NOUNLOAD,  REPLACE,  STATS = 5
GO

Error 3:
After some disk issues at the production server the logshipping continually failed. So I tried a full back up the primary database and restored the secondary database with this full  backup and started the log shipping again. And the logshipping backup of the primary database failed with the error message below:
Message
2014-10-31 13:34:00.33    *** Error: Backup failed for Server ‘<Server Name>’. (Microsoft.SqlServer.SmoExtended) ***
2014-10-31 13:34:00.33    *** Error: An exception occurred while executing a Transact-SQL statement or batch.(Microsoft.SqlServer.ConnectionInfo) ***
2014-10-31 13:34:00.33    *** Error: BACKUP detected corruption in the database log. Check the errorlog for more information.
BACKUP LOG is terminating abnormally.
10 percent processed.
20 percent processed.
30 percent processed.
40 percent processed.
50 percent processed.
60 percent processed.
70 percent processed.
80 percent processed.
Processed 8 pages for database ‘<Database Name>’, file ‘<Database Name>_Data’ on file 1.
Processed 2013584 pages for database ‘<Database Name>’, file ‘<Database Name>_1_Data’ on file 1.
Processed 1380536 pages for database ‘<Database Name>’, file ‘<Database Name>_2_Data’ on file 1.
Processed 1671736 pages for database ‘<Database Name>’, file ‘<Database Name>_3_Data’ on file 1.
90 percent processed.(.Net SqlClient Data Provider) ***
2014-10-31 13:34:00.37    —– END OF TRANSACTION LOG BACKUP   —–
Exit Status: 1 (Error)

Solution:
One of the solutions is to configure the log shipping all over again so the logshipping job will initialize the secondary database.
The other solution is to follow the steps below: (Ref: http://www.sqlskills.com/blogs/paul/how-can-a-log-backup-fail-but-a-full-backup-succeed/)
  1. Stop all user activity in the primary database
  2. Switch to the SIMPLE recovery model (breaking the log backup chain and removing the requirement that the damaged portion of log must be backed up)
  3. Switch to the FULL recovery model
  4. Take a full database backup (thus starting a new log backup chain)
  5. Start the logshipping job
Error 4
Logshipping primary database backup job failed with the following error:
Message
2014-11-03 14:53:02.80    *** Error: Backup failed for Server ‘<Server>’. (Microsoft.SqlServer.SmoExtended) ***
2014-11-03 14:53:02.85    *** Error: An exception occurred while executing a Transact-SQL statement or batch.(Microsoft.SqlServer.ConnectionInfo) ***
2014-11-03 14:53:02.85    *** Error: Cannot open backup device ‘\\<Server>\LogShippingBackups\DatabaseName\DatabaseName_20141103145302.trn’. Operating system error 5(failed to retrieve text for this error. Reason: 15105).
BACKUP LOG is terminating abnormally.(.Net SqlClient Data Provider) ***

Solution
SQL Server agent does not have appropriate permission to access the shared folder. Granting access solves this problem.

No comments:

Post a Comment