April 8, 2004 at 2:06 pm
Bear with me but this scripting thing is new to me. We use SQL LightSpeed for backups. I'm trying to automate a reload of our daily log dumps. We backup the logs every 30 minutes. Every 15 minutes after the 1/2 hour, I want to replay the log to a warm standby server. I'm trying to create a procedure to handle this as follows:
Declare @CYCLE as int
select @CYCLE = CYCLE from CC_LOG_CYCLE
if @CYCLE < 42
EXEC master.dbo.xp_restore_log
@database = 'PRODUCTION'
, @filename = '\\wdbackup\dumps\WDENT2\logs\tranw_lite.bak'
, @filenumber = @CYCLE
, @with='NORECOVERY'
update CC_LOG_CYCLE set CYCLE = CYCLE + 1
else
EXEC master.dbo.xp_restore_log
@database = 'PRODUCTION'
, @filename = '\\wdbackup\dumps\WDENT2\logs\tranw_lite.bak'
, @filenumber = @CYCLE
update CC_LOG_CYCLE set CYCLE = 1
My problem is, this will not compile. Any thoughts on what I'm doing wrong? TIA
Terry
April 9, 2004 at 5:25 am
There is a problem with your IF statement, you need to add BEGIN and END for the IF to work...try this....
Declare @CYCLE as int
select @CYCLE = CYCLE from CC_LOG_CYCLE
if @CYCLE < 42
BEGIN
EXEC master.dbo.xp_restore_log
@database = 'PRODUCTION'
, @filename = '\\wdbackup\dumps\WDENT2\logs\tranw_lite.bak'
, @filenumber = @CYCLE
, @with='NORECOVERY'
update CC_LOG_CYCLE set CYCLE = CYCLE + 1
END
else
BEGIN
EXEC master.dbo.xp_restore_log
@database = 'PRODUCTION'
, @filename = '\\wdbackup\dumps\WDENT2\logs\tranw_lite.bak'
, @filenumber = @CYCLE
update CC_LOG_CYCLE set CYCLE = 1
END
February 17, 2008 at 10:56 pm
Hi
We take a full backup of our DB everynight at 1am (database size is approx 400gb)
We then take a log backup using litesped every 4 mins for the next 23 hours.
[300+ log backups per day]
I need to write a script to restore the logs in order upto a certain point.
Anyone have somthing already written?
Apreciate your help if you have somthing.
Regards,
Brenden
Viewing 3 posts - 1 through 2 (of 2 total)
You must be logged in to reply to this topic. Login to reply