I'm trying to get the log shipping to work using the code from mrdenny's FAQ.
2 things
on the primary server the step 2 command fails saying the secondary server is not found or failed to authenticate.
second thing
the restore log code generates errors:
Server: Msg 4305, Level 16, State 1, Line 1
The log in this backup set begins at LSN 1873000000019800001, which is too late to apply to the database. An earlier log backup that includes LSN 1822000000032500001 can be restored.
Server: Msg 3013, Level 16, State 1, Line 1
RESTORE LOG is terminating abnormally.
ERROR MESSAGES WHEN RUNNING THE RESTORE OF THE LOG FILE:
/*This first part of the code ensures that no one is using the database that we are about to restore. If we don't do this then the restore will fail.*/
declare @spid as varchar(10)
declare @CMD as varchar(1000)
declare cur CURSOR for select spid from master.dbo.sysprocesses where dbid =
(select dbid from sysdatabases where name = 'DOWWEST')
open cur
fetch next from cur into @spid
while @@FETCH_STATUS = 0
BEGIN
set @CMD = 'kill ' + @spid
exec (@CMD)
fetch next from cur into @spid
END
close cur
deallocate cur
go
exec xp_CMDShell 'del b:\BACKUPFOLDER\DOWWEST.2.log', no_output /*This removed the last file we processed.*/
exec xp_CMDShell 'move b:\BACKUPFOLDER\DOWWEST.log b:\BACKUPFOLDER\DOWWEST.2.log', no_output /*This moves the current file into place for processing.*/
declare @i int
declare @j int
set @j = 1
set @i = 0
restore headeronly from disk='b:\BACKUPFOLDER\DOWWEST.2.log' /*This tells us how many transaction log backups there are in the file that we need to restore.*/
set @i = @@ROWCOUNT
while @i+1 > (@j) /*This loop runs us through the file restoring the logs in order.*/
BEGIN
restore log DOWWEST from disk='b:\BACKUPFOLDER\DOWWEST.2.log'
WITH FILE = @j,
STANDBY = 'C:\Program Files\Microsoft SQL Server\MSSQL$OFFLINE\BACKUP\DOWWEST.sby' /*This keeps the database in standby mode ready for more restores.*/
set @j = @j + 1
END
Any suggestions?
Or does this only work with Enterprise edition (i've got standard edition)
Other than that the rest of the process is working.