Altiris Database Backup with Date/Time Stamp in File Name
A couple of weeks ago I was looking at the backup options on our SQL servers and noticed that we didn't have very good backups of our Altiris database. I wanted to have a backup taken multiple times throught out the day with the date and timestamp in the filename so I had an easy way to know where to go back to.
I started playing with scripting this and came up with something that works well. Basically, I am just defining a variable and having that variable be the location where I want the backup to be written, plus have it concatenate the date/time stamp on the end of the filename. Then I just have it backup the Altiris database to that variable location.
Here is what the script looks like:
declare @Filename varchar(100) set @Filename = 'c:\database\Altiris_' + convert(varchar(20),getdate(),110) + '.bak' print @Filename backup database Altiris to disk = @Filename with init

IMO use a SQL Maint. Plan
I use a standard SQL Maint. Plan to backup all the DB's on the server on a daily basis. SQL automatically names the backup file with a .bak extension and stamps it with the DB name and a time/date stamp.
If you setup the plan for daily frequency you can also adjust how many time a day the backup runs and how many hours in between runs.
This would be much easier in my opinion than running a script to perform the same tasks.
This way you can also backup your transaction logs at the same time to recover to a point in time in case there were any pending transactions that did not get processed if and when the DB crashes.
Benjamin Z. Palmer
Architect | Workspace Design | The Hartford | Simsbury, CT 06082
Yea I know now
Thanks for the comment. I do know about the SQL Maintence plan now, although when I was playing with this script I did not. I agree it does work well and is easier to use. I thought wanted to share my script with others.
Thanks
Curt
Oh I C...
I got it now. Doesn't that always seem to happen though, you get something working that solve a problem and something comes around that gets built right into the product.
Benjamin Z. Palmer
Architect | Workspace Design | The Hartford | Simsbury, CT 06082
Would you like to reply?
Login or Register to post your comment.