I have a database in full recovery model. This database's transaction log backups (scheduled via a Maintenance Plan) fail nightly.
Here is the database's CREATE statement, etc:
USE [master]
GO
/****** Object: Database [Gatekeeper] Script Date: 05/18/2009 15:31:26 ******/
CREATE DATABASE [Gatekeeper] ON PRIMARY
( NAME = N'Gatekeeper_dat', FILENAME = N'F:\Program Files\Microsoft SQL Server\MSSQL.1\MSSQL\DATA\Gatekeeper.mdf' , SIZE = 20480KB , MAXSIZE = UNLIMITED, FILEGROWTH = 1024KB )
LOG ON
( NAME = N'Gatekeeper_log', FILENAME = N'E:\Program Files\Microsoft SQL Server\MSSQL.1\MSSQL\DATA\Gatekeeper.ldf' , SIZE = 10240KB , MAXSIZE = 2048GB , FILEGROWTH = 10%)
COLLATE SQL_Latin1_General_CP1_CI_AS
GO
EXEC dbo.sp_dbcmptlevel @dbname=N'Gatekeeper', @new_cmptlevel=90
GO
IF (1 = FULLTEXTSERVICEPROPERTY('IsFullTextInstalled'))
begin
EXEC [Gatekeeper].[dbo].[sp_fulltext_database] @action = 'enable'
end
GO
ALTER DATABASE [Gatekeeper] SET ANSI_NULL_DEFAULT OFF
GO
ALTER DATABASE [Gatekeeper] SET ANSI_NULLS OFF
GO
ALTER DATABASE [Gatekeeper] SET ANSI_PADDING OFF
GO
ALTER DATABASE [Gatekeeper] SET ANSI_WARNINGS OFF
GO
ALTER DATABASE [Gatekeeper] SET ARITHABORT OFF
GO
ALTER DATABASE [Gatekeeper] SET AUTO_CLOSE OFF
GO
ALTER DATABASE [Gatekeeper] SET AUTO_CREATE_STATISTICS ON
GO
ALTER DATABASE [Gatekeeper] SET AUTO_SHRINK OFF
GO
ALTER DATABASE [Gatekeeper] SET AUTO_UPDATE_STATISTICS ON
GO
ALTER DATABASE [Gatekeeper] SET CURSOR_CLOSE_ON_COMMIT OFF
GO
ALTER DATABASE [Gatekeeper] SET CURSOR_DEFAULT GLOBAL
GO
ALTER DATABASE [Gatekeeper] SET CONCAT_NULL_YIELDS_NULL OFF
GO
ALTER DATABASE [Gatekeeper] SET NUMERIC_ROUNDABORT OFF
GO
ALTER DATABASE [Gatekeeper] SET QUOTED_IDENTIFIER OFF
GO
ALTER DATABASE [Gatekeeper] SET RECURSIVE_TRIGGERS OFF
GO
ALTER DATABASE [Gatekeeper] SET DISABLE_BROKER
GO
ALTER DATABASE [Gatekeeper] SET AUTO_UPDATE_STATISTICS_ASYNC OFF
GO
ALTER DATABASE [Gatekeeper] SET DATE_CORRELATION_OPTIMIZATION OFF
GO
ALTER DATABASE [Gatekeeper] SET TRUSTWORTHY OFF
GO
ALTER DATABASE [Gatekeeper] SET ALLOW_SNAPSHOT_ISOLATION OFF
GO
ALTER DATABASE [Gatekeeper] SET PARAMETERIZATION SIMPLE
GO
ALTER DATABASE [Gatekeeper] SET READ_WRITE
GO
ALTER DATABASE [Gatekeeper] SET RECOVERY FULL
GO
ALTER DATABASE [Gatekeeper] SET MULTI_USER
GO
ALTER DATABASE [Gatekeeper] SET PAGE_VERIFY CHECKSUM
GO
ALTER DATABASE [Gatekeeper] SET DB_CHAINING OFF
Here is the error message from the maintenace plan:
Executing the query "BACKUP LOG [Gatekeeper] TO DISK = N'C:\\Program Files\\Microsoft SQL Server\\MSSQL.1\\MSSQL\\Backup\\Gatekeeper\\Gatekeeper_backup_200905180100.trn' WITH NOFORMAT, NOINIT, NAME = N'Gatekeeper_backup_20090518010003', SKIP, REWIND, NOUNLOAD, STATS = 10
" failed with the following error: "BACKUP LOG cannot be performed because there is no current database backup.
BACKUP LOG is terminating abnormally.". Possible failure reasons: Problems with the query, "ResultSet" property not set correctly, parameters not set correctly, or connection not established correctly.
Here's the relevant code from the maintenance plan:
EXECUTE master.dbo.xp_create_subdir N'C:\Program Files\Microsoft SQL Server\MSSQL.1\MSSQL\Backup\Gatekeeper'
GO
declare @backupSetId as int
select @backupSetId = position from msdb..backupset where database_name=N'Gatekeeper' and backup_set_id=(select max(backup_set_id) from msdb..backupset where database_name=N'Gatekeeper' )
if @backupSetId is null begin raiserror(N'Verify failed. Backup information for database ''Gatekeeper'' not found.', 16, 1) end
RESTORE VERIFYONLY FROM DISK = N'C:\Program Files\Microsoft SQL Server\MSSQL.1\MSSQL\Backup\Gatekeeper\Gatekeeper_backup_200905190812.trn' WITH FILE = @backupSetId, NOUNLOAD, NOREWIND
GO