How to do a Daily or Weekly Restart a TM1 Model

Its generally a good idea to restart TM1 Servers regularly. Typically we recommend restarting the instance weekly but if your TM1 Server is over 16GB in memory you should try for nightly TM1 restarts. This is because TM1’s memory consumption grows as TM1 is used and TM1 will not release memory once consumed until the application is restarted.

There are two methods to restart a TM1 server:

  1. When the model IS run as a service,
  2. When the model IS NOT run as a service.

This post covers how to restart a TM1 model when it is run as a service.

How to Restart TM1 Model when run as a Windows Service

When a TM1 model is run as a service, the ideal solution is:

  1. Create a TI Process that will create a .bat file.
  2. Schedule that TI process into a Chore.
  3. Optionally back up your TM1 model.

1. Create TI Process that creates a .bat file

Here we want to create a TI process that in turn creates and executes a .bat file in Windows.

Here we want the following on the Prolog tab:

SaveDataAll;

sLF = char(13) | char(10);
sOutputCharacterSet = 'TM1CS_UTF16ESC';
sBatchFile = '..\Scripts\Restart.bat';
sBatchCommand = sLF | 'net stop "IBM Cognos TM1 Server - servicename" > nul' | sLF |
'ping 1.1.1.1 -n 1 -w 10000 > nul' | sLF |
'net start "IBM Cognos TM1 Server - servicename" > nul' | sLF;
SetOutputCharacterSet(sbatchfile,sOutputCharacterSet);
textoutput(sBatchFile,sBatchCommand);

Then on the Epilog tab:

ExecuteCommand(sBatchFile,0);

A version of the TI process is available for you to download here zInfocube.RestartModel.pro.

Note in the code for the TI above, you will need to change the sBatchFile line to refer to a location where you want the .bat file to be saved. You will also need to get the service name for your TM1 model from the properties on the service.

2. Schedule the new TI process to a Chore

After creating this process you will need to save and schedule it to run in the early hours of the morning – before you update the model!

3. Backup the TM1 Data Directory

We have a great post on how to backup your TM1 system on a Daily, Weekly and Monthly schedule. Please see this post for more detail on it, then just add it into your new TI.

Note that you cannot use ServerShutDown in a TI to shut down a TM1 model when it is run as a windows service. Please use the method above if it is run as a service.

How to get the Correct TM1 Service Name

Be sure to replace “servicename” with your server’s NT Service name. The double quotes are only necessary if your Windows TM1 Service name has a space in it. To find your servers Service Name open Services under Administrative Tools and double click on the Service for your TM1 Server. The highlighted text below shows the name.

Both service name and display name will work.

If you like this post, please spread the love…

One comment on “How to do a Daily or Weekly Restart a TM1 Model

This site uses Akismet to reduce spam. Learn how your comment data is processed.