Separating the contact management database
When using contact management on high‑traffic websites, the system needs to store a very large volume of data in order to keep records of all contacts, their activities and other related information. This may complicate database administration and make it difficult to perform regular backups. For these reasons, Kentico provides a way to move all tables and database objects associated with contact management to a separate database (including the currently stored data). Doing so allows easier management of the application's main database, without the need to deal with the contact data.
There can only be one separated contact management database for the entire system, even when hosting multiple websites. It is not possible to create a different database for each site.
The separation procedure affects the following database tables:
Refer to the database information in the Custom development chapter for details about specific tables.
Running the database separation
Use the following steps to separate the system's contact management data into a different database.
- It is strongly recommended to backup your database before starting the separation.
- The database will be unavailable while the separation is being carried out, so you should run the process at a time when no visitors or editors are accessing the websites in the system.
- You cannot perform database separation if you use Integrated Windows authentication on your SQL Server
If your database is hosted on Windows Azure, you need to manually perform some parts of the procedure:
- Create a new database before you launch the separation. The process cannot automatically create the separated database.
- Move data to the separated database. The process does not move the data, it only creates the database structure.
- Delete the separated tables from the original database.
- Open the System application.
- Select the DB separation tab and click Separate contact management database.
- This starts the database separation wizard.
Specify the SQL server to which you wish to transfer the contact management database and enter the connection credentials.
You can identify the server through its name or IP address.
It is possible to use a different server than the one containing the main database.
The separated database may be hosted on all server types supported by Kentico.
Continue by clicking Next.
In Step 2, choose to either:
Create a new database for the contact management DB objects and data
Import the DB objects and data into an existing database on the server specified in the previous step. When using an existing database, make sure it does not contain any of the tables that are included in the separation.
Type the name of the target database into the appropriate field.
Click Disable tasks.
You need to prevent all scheduled tasks in the system from running, because the database will be unavailable during the separation process. If a task is currently being executed when you click the button, the disabling action waits until the task is finished. The tasks will automatically be enabled again when the separation is completed.
Click Next to begin the separation.
The wizard displays a log while the database operations are being performed.
During this stage, all websites in the system are temporarily switched to Off-line mode.
Any regular visitors who arrive at this time see a message informing that the site is down due to maintenance. For users with the Global administrator privilege level, the system shows the current state of the separation wizard.
When the process is completed, all contact management data is transferred to the new database. If you view your application's web.config file, you can notice that an additional connection string for the new contact management database is now present in the <connectionStrings> section:
<add name="CMSOMConnectionString" connectionString="..." />
Click Finish in the final step of the wizard.
The on-line marketing data is removed from the application's main database (including the database table structure and other related objects).
The system brings all websites back on-line and enables the inactive scheduled tasks.
If your application is running on multiple servers in a Web farm environment, you need to manually copy the CMSOMConnectionstring key into the web.config files of all other servers, otherwise they will not be functional.
If your application is running in a medium trust environment, the system cannot enable the scheduled tasks and return the off-line sites back on-line. To manually perform these tasks:
- Open the System application and enable the Scheduled tasks enabled setting.
- In the Sites, edit your websites on the Off-line mode tab.
- Click Bring the site on-line.
- Repeat the same for each site.
The new database status is reflected on the General tab of the System application, in the Database information section.
All functionality of the website and administration interface remains the same as before the separation.
If you wish to reverse the process and return everything back to a single database, follow the instructions in Rejoining the contact management database.