TIP T302 –Automating backups with SQL 2005 Express
Cisco TMS Versions
Cisco TMS 11.0 or newer
SQL 2005 Express can be managed with the SQL Management Studio Express (SMSE) which makes it
easy to perform tasks - including backups.
Cisco TMS ships with a DB Management Utility that was originally created because MSDE did not have
any GUI tools making it difficult for customers to maintain their databases. With the availability of SMSE,
Cisco TMS DB Management Tool is of limited value. Customers looking to add maintenance for their
databases should be looking at SMSE as a way to manage their databases.
One omission from SMSE is the lack of a scheduler agent. This means while you can back up the
database easily, you cannot automate this process from within SMSE.
There are several ways to accomplish this depending on your needs. The basic premise is simply to
create a SQL script or BAT file to execute the SQL commands to do the backup, and have the Windows
Scheduler task run the script. The problem with this method is it does not provide for functionality such
as rotating backup files.
An open source method to achieve automation in backups and file rotation is described here
http://www.sqldbatips.com/showarticle.asp?ID=27
stand-alone utility to perform the task. This site is referenced by Microsoft for alternatives to automating
backups.
The code for the procedure and application are maintained in the open source site Codeplex at
http://www.codeplex.com/ExpressMaint
Below is an example that would be used with a default Cisco TMS installation with steps to keep things
as simple as possible. Administrators should read the documentation and follow the supplied examples if
they wish to customize this or are using a non-default installation.
Perform the following on the Cisco TMS server while logged in as a Windows Administrator. These steps
are to backup the database daily, and keep the last three backups.
1. Create a directory on the Cisco TMS server to use for backups - c:\sqlbackups
2. Create a reports directory under the backup directory - c:\sqlbackups\reports
3. Get the expressmaint console app from the
directory c:\sqlbackups
4. Open a command prompt using the Start Menu, and navigate to the backups directory - cd
c:\sqlbackups
5. Test backup utility by entering:
expressmaint -S localhost\sqltms -D tmsng -T DB -R c:\sqlbackups\reports -RU
DAYS -RV 3 -B c:\sqlbackups -BU DAYS -BV 3 –V
6. After the backup successfully runs, we need to automate it using the Scheduler Task. Under Control
Panel -> Scheduled Tasks, Double-click Add Scheduled Task to start the Scheduled Task Wizard.
Click Next in the first dialog box
7. Click Browse, browse to c:\sqlbackups\Expressmaint.exe and then click Open
8. Type a name for the task e.g. DAILY FULL BACKUP and then choose Daily from the scheduling
options and click Next
9. Specify the time and frequency to run the backup. Example: 04:00, every day, starting with today's
date. Click Next
10. Type the name and password of the account that will execute this task. Enter administrator and the
password to the Windows Administrator account.
11. Click Next, select the checkbox to Open the Advanced Properties for this task and then click Finish
12. In the Run text box, enter
c:\sqlbackups\expressmaint.exe -S localhost\sqltms -D tmsng -T DB -R
c:\sqlbackups\reports -RU DAYS -RV 3 -B c:\sqlbackups -BU DAYS -BV 3 –V
Cisco TMS Database Knowledge Tips
SQL Server Versions
SQL 2005 – All Versions
SQL 2005 Express – All Versions
. This includes a stored procedure method and a
Codeplex website
. Save the exe file to the backup
Tips category – Maintaining/Upkeep
Page 25 of 35
Need help?
Do you have a question about the TMS SQL DATABASE and is the answer not in the manual?
Questions and answers