Tips category – Maintaining/Upkeep
Cisco TMS Database Knowledge Tips Page 27 of 35
TIP T303 –Detaching and reattaching databases
Cisco TMS Versions SQL Server Versions
All
SQL 2000 – All Versions
MSDE 2000 – All Versions
SQL 2005 – All Versions
SQL 2005 Express – All Versions
A set of database files can be detached from a SQL server, which frees up the files and later attached to
the same SQL server or another. Detaching and reattaching is another way to move a database between
servers. There cannot be any active connections to the database to detach it from a SQL server
To detach the Cisco TMS database using osql
osql –E –S servername –Q “sp_detach_db ‘tmsng’”
Once detached, the database files, tmsng.mdf and tmsng_log.ldf are now free to be copied, moved, etc.
To attach the Cisco TMS database using osql.
Put the tmsng.mdf file in the data directory of the SQL server, e.g. C:\Program Files\Microsoft SQL
Server\MSSQL\Data\MSSQL.1\MSSQL\Data\tmsng.mdf
osql –E –S servername –Q “sp_attach_db database ‘tmsng’, ‘C:\Program
Files\Microsoft SQL Server\MSSQL\Data\MSSQL.1\MSSQL\Data\tmsng.mdf'”
Extra reference links
How to manage the SQL Server Desktop Engine (MSDE 2000) or SQL Server 2005 Express Edition by
using the osql utility