| Author |
Topic |
|
Sitka
Aged Yak Warrior
571 Posts |
Posted - 2003-11-10 : 14:57:20
|
| Can this be done? I'm thinking of a zillion ways maybe to set this up but just need a push in the right direction.Production Server Maintenance plan causes....Full Backup every night.Transaction log backup every hour.Log shipDatabase Backup Full every nightTransaction log every half hour.Now how do the two interact?Can I ship the TRN's generated by the mainenance plan to the standby server.Can I create the Maintenance plan such that it backs up to device so the logship backup uses the same file. The general idea here is that the Maintenance plan in full recovery covers for database corruption while the log shipped server covers for the hardware failure.I'd like to set it up so the Maintenance plan remains intact so our IT leader has a single point of administration. The Maintenance plan. |
|
|
tkizer
Almighty SQL Goddess
38200 Posts |
Posted - 2003-11-10 : 14:59:41
|
| I am not understanding. In a log shipping environment, you have two servers. The source server is your production server. It has a log shipping maintenance plan (if you are going to use the built-in log shipping in Ent. Edition) that does a full backup periodically and transaction log backups frequently. The plan copies the log files to the destination. The destination server is a standby server. It can only be used for read-only purposes (if you have it setup for this, otherwise it can't be used at all). Given this information, what is your question?Tara |
 |
|
|
Sitka
Aged Yak Warrior
571 Posts |
Posted - 2003-11-10 : 15:24:50
|
| Sorry, I was thinking SQL7.0 roll your own, I swear I typed it (SQL7.0)SQL 7.0, so I can't see how I can maintain the unique file names.See the little demo's I've seen show the BACKUP DATABASE and BACKUP LOG commands going to devices with INIT.(overwrite). So there exists only one of each at any given time. If I went to apply those out of EM it would work ok.In the DB maintenance plan the automatic scripting of it accounts for the unique names of each .BAK or .TRN.(with dates)but there is no option to go to device. So with log shipping you don't get a little tree (sequential transaction log backups. Because it is not needed but you are calling BACKUP LOG on the same databases as the Maintenance plan so they got to be stepping on each other.... more to come.... I'm really confused.I just got to bust it up into smaller parts I think and attack each one individually. If this maintenance plan thing wasn't here it would make sense. So what is my question?If I make jobs to handle the full backup and transaction log backup with the intent of using them for log shipping how can I present them to someone in a maintenance plan?Yeah that is it for sure cause the log shipping job1.)Truncates the Transaction log. Which really doesn't happen here but will happen right after the next step...2.)Backup database.(only one .BAK file allowed though can't leave yesterdays or four days worth on the server hanging around like in a maintenance plan)3.)Each Tlog backup is performed without a truncate so the log remains complete until after the full backup(can this continuous log be applied to the last full backup? Like with a BACKUP LOG switch that says ignore last ten backups because they were lost so I need all that you have)Just thinking out loud here. |
 |
|
|
tkizer
Almighty SQL Goddess
38200 Posts |
Posted - 2003-11-10 : 16:20:45
|
quote: Originally posted by Sitka So what is my question?If I make jobs to handle the full backup and transaction log backup with the intent of using them for log shipping how can I present them to someone in a maintenance plan?
You don't create a maintenance plan on the destination server. You have to create custom jobs that will perform the restores of the transaction log. Your job would figure out which file needs to be applied then apply it. Here is some good info:[url]http://www.sql-server-performance.com/sql_server_log_shipping.asp[/url]Tara |
 |
|
|
Sitka
Aged Yak Warrior
571 Posts |
Posted - 2003-11-10 : 16:52:33
|
That is the link I used to set this up.quote: You don't create a maintenance plan on the destination server.
no, I never did. I have no maintenance plan on the standby server. Just a couple procs that restore databases and logs.The idea here is each time the backup log job runs on the live server it BACKUP's LOG with over write. So the maintenace plan does it's own BACKUP LOGDo these remain totally exclusive of each other? I can't see how that can be. Because we are calling BACKUP LOG log on the same database.So given the Maintenance plan and Log shipping job are working?The log shipping job creates a Tlog backup to a device , overwrites a single file many times throughout the day...and the maintenance plan makes for example 10 sequential transaction log backups, that remain available and are queued up in the restoredatabase wizard until a full backup is taken. MAYBE.... look at it a different way.What if I set my logshipping to full backup every hour, tlog backup every 2 minutes? What is the impact on a live server maintenance plan that goes full backup night, tlog every half hour. AND more importantly the recovery of that live server? Remember both are working the same database.This isn't a nuts way of looking at it when you realize the DBMaintenance plan protects the Wizard bound Admin in case of media failure or foobar database. Whereas the standby server is at the ready in case of hardware failure, like a fried mobo or a whole in the roof. So the DBMaintenance plan should remain intact. I just can'r see the pieces of the puzzle that make that so. Because when you call backup or restore you are affecting what you are acting on.Like Carlsberg's Principal the act of measuring changes that which is measured. |
 |
|
|
tkizer
Almighty SQL Goddess
38200 Posts |
Posted - 2003-11-10 : 17:01:09
|
| Why do you want it to overwrite each time? Your log shipping could get out of sync. Take this for example:Transaction backup at 2:00pmCopy at 2:10 pm, but copy failsTransaction backup at 2:30pmCopy at 2:40pm, copy succeedsYour destination server didn't get the 2pm log file, and it has been overwritten already. Your log shipping plan is now broken and you'll have to start with a full backup.No the backups do not get queued up unless you are doing WITH NOINIT. Then you'll have multiple backups inside one file. Eventually, you'd need to do WITH INIT or your file would get huge.Also, you should not have any other maintenance plans or jobs that are doing BACKUP LOG command. All logs need to be backed up by log shipping plan.Tara |
 |
|
|
Sitka
Aged Yak Warrior
571 Posts |
Posted - 2003-11-10 : 17:16:52
|
| The steps/script in the job goes like this 1.)BACKUP LOG dbx TO dbx_log_backup_device WITH INIT, NO_TRUNCATEWAITFOR DELAY '00:00:05'2.)xcopy F:\MSSQL7\BACKUP\logshipping\dbx\dbx_log_backup_device.BAK \\admin1s2x\F$\MSSQL7\BACKUP\logshipping\dbx /c3.)EXEC admin1s2x.master.dbo.restore_dbx_log_backupwhereCREATE PROCEDURE restore_dbx_log_backup AS RESTORE LOG dbxFROM DISK = 'F:\MSSQL7\BACKUP\logshipping\dbx\dbx_log_backup_device.BAK'WITH DBO_ONLY,STANDBY = 'F:\MSSQL7\BACKUP\logshipping\dbx\undo_dbx_logship.ldf'WAITFOR DELAY '00:00:05'EXEC sp_dboption 'dbx', 'single user', trueThe way I see that is that the log goes to the device and the device is a single file.DOES that single file contain an assortment of TLog backups?. I wasn't aware? WITH INIT is there so I figured I was shipping a single transaction log backup. But yeah I don't know about your example where someone pulls the plug and you miss one. |
 |
|
|
tkizer
Almighty SQL Goddess
38200 Posts |
Posted - 2003-11-10 : 17:20:56
|
| Yes the device has a single file. The file does not contain an assortment of TLog backups because it is using WITH INIT. You should change the extensions of your files. Full backups should be BAK. TLogs should be LDF. Standby files should be DAT. If ever your copy command fails, your log shipping will be out of sync. Why the use of a backup device in the first place though? Do people use these anymore? I haven't used them since 6.5.Tara |
 |
|
|
Sitka
Aged Yak Warrior
571 Posts |
Posted - 2003-11-10 : 17:28:05
|
This one deserves it's own boxquote: Also, you should not have any other maintenance plans or jobs that are doing BACKUP LOG command. All logs need to be backed up by log shipping plan.
exactly, SOooooo ... A DBMAITENENCE plan creates an automated script that makes use of the named Tlog(xxx.TRN)backup files. You could shipthese too I guess If you could automate the naming but that isn't what the rest of the world recommends so I didn't do it.Why would you want to?Because just like I thought... then you said....then I quoted!!!!!You are running BACKUP LOG in two different contexts.How can the SERIALIZATION be maintained, when a DBMAINTENANCE PLAN is required as well as log shipping?Feel free to answer that last one with "IT NEVER HAS TO BE!" just provide a little reason why. |
 |
|
|
tkizer
Almighty SQL Goddess
38200 Posts |
Posted - 2003-11-10 : 17:32:16
|
| Actually you should have different names for the transaction logs that way they aren't overwritten. By overwriting them, you could cause log shipping to break if ever the copy fails. A database maintenance plan is not required for log shipping. It just makes it easier to configure. You could do all of the work in jobs instead which is how Nigel and Brett have it in their environments. I don't know what you mean by serialization be maintained. If you mean the order, then that's my point. The order could be wrong if the copy ever fails. You won't be able to recover from a failed copy because you've already overwritten the transaction log.Tara |
 |
|
|
Sitka
Aged Yak Warrior
571 Posts |
Posted - 2003-11-10 : 17:37:18
|
| It's not that hard to see really, just picture it.A nice shiny tower with a fancy wizard configuredmaintenance plan.Then some dirty little jobs passing files to a dirtylittle server over in the corner.Well things get messed up and the guy walks over to the shiny tower. Goes to EM and opens some tables and sees no records for all of 2002Apparently this happened about an hour ago. OK get on the phone, and restore via right click with the little EM check boxes all except the last one. FixedNext week a fire breathing dragon comes in and desides to take the shinny tower and donate it to the methadone clinic.Glad he left the other one. Just rename the Standby and at least we can buy a little time, until some new hardware is bought. |
 |
|
|
Sitka
Aged Yak Warrior
571 Posts |
Posted - 2003-11-10 : 17:44:43
|
quote: Actually you should have different names for the transaction logs that way they aren't overwritten. By overwriting them, you could cause log shipping to break if ever the copy fails.
I agree but can't really figure out how to do that.quote: A database maintenance plan is not required for log shipping
Exactly but in this case it is needed for the other ADMIN.I'm saying wrt to serialization that two independent activities are going on.The maintenance plan is doing backups as is the logshipping jobs on the same database in the same time span.To me this looks broken......And further you mentioned the order could be wrong if the copy ever fails. Well I Submit it is broken even if the copy never fails. Bbecause even though the order is correct the contents are wrong because the Tlog was backed up without the timing structure of the logshipping jobs by the DBMAINTENANCE PLAN or vice versa. How to fix?Things that make you go Hmmmm. |
 |
|
|
tkizer
Almighty SQL Goddess
38200 Posts |
Posted - 2003-11-10 : 17:52:11
|
| I understand what you mean about serialization. No it isn't broken. Log shipping doesn't use full backups. An initial database is restored using a full backup. After that, the maintenance plan takes over and only uses transaction log backups. For the different names, you could put the system date and time in the file name. That is what others have done and that is what log shipping in SQL Server 2000 Ent. Edition does.Tara |
 |
|
|
Sitka
Aged Yak Warrior
571 Posts |
Posted - 2003-11-10 : 18:00:16
|
quote: After that, the maintenance plan takes over and only uses transaction log backups.
The log shipping part runs now without a maintenanece plan. And if that is all that I needed to accomplish I could see an end.But realise I need to maitain a working Maintenance plan on the live server. And like you saidAlso, you should not have any other maintenance plans or jobs that are doing BACKUP LOG command. All logs need to be backed up by log shipping plan.Thanks for this Tara. I'm just about to really break something, I better go |
 |
|
|
tkizer
Almighty SQL Goddess
38200 Posts |
Posted - 2003-11-10 : 18:03:17
|
| When I said maintenance plan, it could mean maintenance plan or a job that does copy and restore, which is what you have. A maintenance plan is just a series of T-SQL commands that get executed.Tara |
 |
|
|
Sitka
Aged Yak Warrior
571 Posts |
Posted - 2003-11-10 : 18:44:20
|
| Yep, qut confusingf mi. For all who read this the maintnence plan was/shall be the one generated via the EM wizard.nr will chime in here 'cause there has to be a reason he hates M(capital EM)aintenance plans. |
 |
|
|
tkizer
Almighty SQL Goddess
38200 Posts |
Posted - 2003-11-10 : 19:03:55
|
| Reasons why not to use maintenance plans:Because when they fail, the errors aren't helpful.You don't know what they are doing behind the scenes.Because they are created through wizards and wizards are for newbies...Tara |
 |
|
|
Sitka
Aged Yak Warrior
571 Posts |
Posted - 2003-11-15 : 12:18:12
|
| UPDATE;Call me Tenacious OI wouldn't give up, I convinced "them" to run one of our installs MSSQLSERVER and ...AGENT under a domain account. My Log shipping task just got a whole lot easier, along with a whole bunch of other things.You got to fight, for the right, To PAAARRRR "T" Tenacious O |
 |
|
|
Sitka
Aged Yak Warrior
571 Posts |
Posted - 2003-11-17 : 11:50:13
|
Here is what I have figured out formy SQL 7.0 log shipping. Boy did this get easyonce the SQL SERVICES were running underDomain account. This handles a databasecalled userlist. All procs are master.dbo.I was going to create this set for each database I needfailover on (probably will do all) then have a job torun the full backups every night and the tran backupsevery half hour. A couple of the databases arepretty large (2 gig)Figure once I get each set builtI can put all the Full Backups in asingle job with each step callingls_<database name>_backupRun that nightly at 20:00 (tape kicks in at 00:00:01)Second job will have a step for eachdatabase callingls_<database name>_tlogrunning every half hour 06:00 -> 18:00Questions1)I'm a little unsure if I'm callingDBO_ONLYSTANDBYsp_dboption exactly as I should bebut it seems to work, they behave differentlyon 2000 and 72)does a person ship the master database?LIVE SERVER - > @@servername = FREDALTER PROCEDURE ls_userlist_backupAS SET NOCOUNT ONBACKUP LOG userlist WITH TRUNCATE_ONLYWAITFOR DELAY '00:00:05'DECLARE @localdirectoryname nvarchar(128)DECLARE @filename nvarchar(128)DECLARE @fulllocalpath nvarchar(128)SELECT @localdirectoryname = 'F:\LSBackup\'SELECT @filename = 'userlist_' + CONVERT(CHAR(10),GETDATE(),110) + '_' + REPLACE(CONVERT(VARCHAR(5),GETDATE(),108), ':','') + '.bak'SELECT @fulllocalpath = @localdirectoryname + @filenameBACKUP DATABASE userlist TO DISK = @fulllocalpath WITH INITWAITFOR DELAY '00:00:05'DECLARE @cmd nvarchar(128)SET @cmd = 'copy ' + @fulllocalpath + ' \\WILMA\F$\LSBackup'EXEC master..xp_cmdshell @cmd , NO_OUTPUTWAITFOR DELAY '00:00:05'DECLARE @sourcefilenameout nvarchar(128)SELECT @sourcefilenameout = @filenameEXEC WILMA.master.dbo.ls_userlist_backup_restore @sourcefilename = @sourcefilenameoutALTER PROCEDURE ls_userlist_backup_tlogAS SET NOCOUNT ONDECLARE @localdirectoryname nvarchar(128)DECLARE @filename nvarchar(128)DECLARE @fulllocalpath nvarchar(128)SELECT @localdirectoryname = 'F:\LSBackup\'SELECT @filename = 'userlist_' + CONVERT(CHAR(10),GETDATE(),110) + '_' + REPLACE(CONVERT(VARCHAR(5),GETDATE(),108), ':','') + '.trn'SELECT @fulllocalpath = @localdirectoryname + @filenameBACKUP LOG userlist TO DISK = @fulllocalpath WITH NO_TRUNCATEWAITFOR DELAY '00:00:05'DECLARE @cmd nvarchar(128)SET @cmd = 'copy ' + @fulllocalpath + ' \\WILMA\F$\LSBackup'EXEC master..xp_cmdshell @cmd , NO_OUTPUTWAITFOR DELAY '00:00:05'DECLARE @sourcefilenameout nvarchar(128)SELECT @sourcefilenameout = @filenameEXEC WILMA.master.dbo.ls_userlist_backup_tlog_restore @sourcefilename = @sourcefilenameoutSTANDBY SERVER - > @@servername = WILMAALTER PROCEDURE ls_userlist_backup_restore (@sourcefilename nvarchar(128))AS SET NOCOUNT ONDECLARE @fulllocalpath nvarchar(128)SELECT @fulllocalpath = 'F:\LSBackup\' + @sourcefilenameRESTORE DATABASE userlist FROM DISK = @fulllocalpathWITHDBO_ONLY,REPLACE,STANDBY = 'F:\LSBackup\undo_userlist_logship.ldf',MOVE 'UserList_Data' TO 'F:\MSSQL7\data\UserList_data.mdf', MOVE 'UserList_Log' TO 'D:\SQL-Logs\UserList_log.ldf'WAITFOR DELAY '00:00:05'EXEC sp_dboption 'userlist', 'single user', trueALTER PROCEDURE ls_userlist_backup_tlog_restore (@sourcefilename nvarchar(128)) AS SET NOCOUNT ON DECLARE @fulllocalpath nvarchar(128)SELECT @fulllocalpath = 'F:\LSBackup\' + @sourcefilenameRESTORE LOG userlistFROM DISK = @fulllocalpathWITH DBO_ONLY,STANDBY = 'F:\LSBackup\undo_userlist_logship.ldf'WAITFOR DELAY '00:00:05'EXEC sp_dboption 'userlist', 'single user', trueCREATE PROCEDURE ls_userlist_recovery ASRESTORE DATABASE userlist WITH RECOVERYEXEC SP_DBOPTION 'userlist', 'read only', 'false'EXEC SP_DBOPTION 'userlist', 'dbo use only', 'false' Tenacious O |
 |
|
|
|