Home Forums SQL Server 7,2000 Backups Backup Log cannot be performed because there is no current database backup RE: Backup Log cannot be performed because there is no current database backup

  • That's what every forum I've seen has said. As near as I can tell, It hasn't been changed from simple back to full, but just to make sure I ran a full back up and it is still giving me that error. I looked to see if anything is truncating the log file, but I was not able to find anything similar to that.

    Here is the script:

    declare @sql varchar(2000),

    @dbname varchar(255),

    @servername varchar(255),

    @datestr varchar(50)

    -- you must add entry for this variable

    if (select serverproperty('instancename')) is null

    begin

    set @servername = (select @@SERVERNAME)

    end

    if (select serverproperty('instancename')) is not null

    begin

    set @servername = (select convert(varchar(200),serverproperty('instancename')))

    end

    declare @date datetime

    set @date = GETDATE()

    set @datestr = CONVERT(char(4),datepart(YEAR,@date)) + right(N'0' + convert(nvarchar(2), month(@date)), 2) + right(N'0' + datename(d, @date), 2) + right(N'0' + datename(HOUR, @date), 2) + '0000'

    declare c_1 cursor for select name from master.sys.databases where state_desc = 'online' and recovery_model_desc = 'full' order by name

    open c_1

    fetch next from c_1 into @dbname

    while @@FETCH_STATUS <> -1

    begin

    set @sql = 'backup log ['+@dbname+'] to disk = ''\\svratlbackup01\sqlbackups011\'+@servername+'\'+@dbname+'_'+@datestr+'.trn'' with init'

    exec(@sql)

    fetch next from c_1 into @dbname

    end

    close c_1

    deallocate c_1

    go