To migrate the TMCM database via command line:
Refer to Microsoft article Move a Database Using Detach and Attach (Transact-SQL) for additional information on how to attach/detach/move a Database.
These steps should be done with the assistance of a SQL Database Administrator, if available:
- Log off from the TMCM console and then shut down these TMCM services:
- Trend Micro Control Manager
- Trend Micro Management Infrastructure
- Trend Micro Common CGI
It may take a while (5-10 minutes) to terminate all connections. If you do not want to wait that long, you can restart the SQL server service instance.
- On the SQL server where the original TMCM service is installed, execute the following via command line:
hese commands may also be executed via SQL Query Analyzer.
- Type “c:\osql” –E then press ENTER.
- Type “exec sp_detach_db 'db_controlmanager', 'true';” then press ENTER.
- Type “go” then press ENTER.
If a message similar to the one below appears, then some processes may still be using the TMCM database when you terminated the connection:
Cannot detach the database 'db_controlmanager' because it is currently in use.
Make sure that all services are stopped, or you can restart the SQL Server service/instance.
- Run the command again. You will get the following message once the database has been detached:
The database 'db_controlmanager' does not exist. Use sp_helpdb to show available databases.
- Copy the db_controlmanager.mdf and db_controlmanager_log.ldf files of the SQL 2005 server to the directory of your choice.
For example:
C:\Program Files\Microsoft SQL Server\MSSQL.1\MSSQL\Data
The default installation for the database if you have MSDE installed is C:\Program Files\TrendMicro\MSDE2000\DataMSSQL\Data. If you were running SQL 2000 Server, then it would be where your data directories are.
- Execute the following command on the SQL 2005 server:
These commands can also be executed via an SQL Query Analyzer.
- c:\ osql –E
- USE master;
- GO
- CREATE DATABASE db_controlmanager ON (FILENAME = 'C:\path\to\db_controlmanager.mdf'), (FILENAME = 'C:\path\to\db_controlmanager_Log.ldf') FOR ATTACH;
- GO
The SQL Server engine will automatically upgrade the database from 2000 to 2005. Attaching database from a lower to a higher version is fine, but attaching database from a higher to a lower version is not possible.
- Launch the Microsoft SQL Server Management Studio. The db_controlmanager database should be visible. This is with the assumption that you have the 'tmcm' SQL username login already created. Otherwise, create one at this point.
- When you expand the Databases > db_controlmanager > Tables node, you will notice that all the schema of the tables are [dbo]. If not, take note of the schema and then make the appropriate value adjustment for step 4 (on the assignment of the default schema).
- Go to Databases > db_controlmanager > Security > Users and then do the following:
- Add 'tmcm' user and map it to the 'tmcm' log in. If the you wanted to use another username, then use that name
Use the same user name in both SQL servers.
- Set the default schema to [dbo].
- Set the database role membership to db_owner.
- Add 'tmcm' user and map it to the 'tmcm' log in. If the you wanted to use another username, then use that name
- As an option, you can go to Security > Logins > tmcm and set the Default Database option to db_controlmanager under the General page.
- On the TMCM server, go to Administrative Tools > Data Sources (ODBC) > System DSN.
- Modify the ControlManager_Database DSN and change the SQL server location to the appropriate settings of the following:
- If you are using an instance:
[hostname/IP address of the server]\instance - If you are not using an instance:
[hostname/IP address of the server]
Use SQL server authentication and on the Test Data Source the following should occur:
Test Completed Successfully.
Note the following changes:
- Make sure that you selected the SQL server location, indicating the instance name if needed.
- After selecting the SQL server location, click Next. There will be a Client Configuration button.
- Click on the Client Configuration button, and change the Network Libraries option from TCP/IP to Other.
- Server Alias must be equal to [hostname/ipaddress of the server ]\instance name, if you are using an instance or [hostname/ipaddress of the server] if you are not.
- File name must be uqual to dbmssocn, parameters = [hostname/ipaddress of the server]\instance name, if you are using an instance, or [hostname/ipaddress of the server] if you are not.
- If you are using an instance:
- On the TMCM server, run DBConfig tool. Open the Command Prompt and go to this directory:
<drive:>\Program Files\Trend Micro\Control Manager\DBConfig
Refer to KB article Changing the Control Manager (TMCM) 5.0/5.5 database configuration settings about the details on how to use the DBConfig tool.
- Execute this sample command:
DBConfig -DBName="db" -DBAccount="sqlAct" -DBPassword="sqlPwd" -Mode="SQL" -DBHost="10.10.1.5"
Notes:
- Default Mode is the SQL authentication mode used. Mode="WA" is necessary when configuring Windows authentication.
- The Windows account must belong to the Administrators group.