sql - Backup stored procedure for full, differential and log backup -
I have written a simple stored procedure to support full, differential and LOG backups. This is my stored procedure:
Order Process Backup DB (@base location as Varchar (1024), @ Backup Type varchar (32)) @Debanem varchar (255) = db_name () Announce @phrankname Varchar ( 256) Announce @DateTimeDate = GateTit () Set Type @ Backup = UPPER (@ Backup Type) @philname = @DNA + '_' + Right ('00 '+ cast (in the form of month (date) varchar (2)), 2) + +' _ '+ cast (in the form of the year (@date) varchar (4) '_' + True ('00' + cast (in the form of day (date varchar (2)), 2) + Varchar (2)), 2) + '_' + right ('00 '+ cast ('_' + Wright ('00' + Cast (Date of Date (H.H., Date @) varchar (2)), 2) + '_' + Writ ('00' + Cast (as dated (date, date, date) varchar (2)), 2) + '_' + right ('000' + cast (dated date) (MS, @ date) varchar (3 ), 3) + '_' + UPPER (back) Type "Type" Backup type "Complete" or "Backup Type", then type 'BAC' other 'TRN'), declare @ flowerpath form (1280) = "If Is correct (@besolution, 1) & lt; & Gt; Type '\' Set @ Base Location = @ Base Location + '\' End Set @ FullPath = @ Base Location + @ Filename Print @ FullPath @ Backup Type 'Full' Backup Database To Debnize Disc = @ FullPath Type A backup @ Backup = 'interface' backup databases by dbnmmed disk = @ fullpath interceptor end if the backup LOG @ DBName to disk = @ fullpath end and live I ran My stored procedure and it passed Fully working to specifications. Now the next step is to create a SQL job for this. However, before doing this, I should know that this is the right process? I have read many articles and they all point out to a line "test backup strategy".
I now weekly, daily and weekly full backup, daily differential and log backup every 5 minutes.
Do you think this stored procedure is written incorrectly or do you think it should be fine for my scenario?
It looks good for me, if it's a programming exercise, then it's okay. (You need to make error trapping and reporting included). However, if you do not want to use SQL Express, as per the above, a maintenance plan will be done with all this error reporting. If you are using SQL Express, then there is a good program for free SQLBackupAndFTP which I've used and recommended over the years. It has excellent error reporting which I have recently experienced, when MSDB was corrupted. This will also back up an Amazon S3 account (paid version but not more) Here's the full story:
Comments
Post a Comment