- Microsoft Dynamics CRM 2011 Cookbook
- Dipankar Bhattacharya
- 692字
- 2025-02-26 01:33:17
Recovering from a Dynamics CRM 2011 Database Server failure
In the case of a Dynamics CRM 2011 Database Server failure, the database must be restored from the backup and reassociated with Dynamics CRM 2011.
How to do it…
Perform the following steps to recover from a SQL Server failure:
- In the case of a Full Server machine crash or failure, we might need to reinstall the operating environment of the server machine. Hence, we have to install the Windows Server version and make sure that the machine is joined to the same domain where Microsoft CRM Server is joined. Thereafter, we have to install the SQL Server version.
Note
We have to use the same database name and disk structure. If we changed the database name, additional steps would be needed to associate it back with Dynamics CRM 2011 Server.
- Log in to SQL Server Management Studio using Windows Authentication with a user credential, having CREATE DATABASE permissions on the instance of the SQL Server.
- On the recovery path, the first step would be to recover the
master
database, provided we have a backup of this database. To recover any system database, the database has to be started in single user mode.More information about starting a SQL Server instance in single user mode can be found at the following link:
http://msdn.microsoft.com/en-IN/library/ms188236.aspx
Then to restore the full backup of the
master
database, type the following T-SQL statement:RESTORE DATABASE master FROM <backup_device> WITH REPLACE
Replace
<backup_device>
with the file location in a backup device, for example,T:\MS_CRM_Master_DB_Backup\master.bak
.Note
If changes are made after the database has been backed up, these changes will be lost once the backup is restored. After the
master
database is restored, the instance of SQL Server may stop automatically. Please restart the SQL Server instance if required. - Post the
master
database restoration, themsdb
database has to be restored. Before restoringmsdb
, stop the SQL Server Agent instance. Then, use the following T-SQL command to restore themsdb
database:RESTORE DATABASE msdb FROM <backup_device> WITH REPLACE
Replace
<backup_device>
with the file location in a backup device, for example,T:\MS_CRM_Master_DB_Backup\msdb.bak
.Note
It is necessary to restore
msdb
once themaster
database has been restored. Themsdb
database contains scheduling and other data used by the system. Ifmsdb
is not restored, and is not accessible, SQL Server Agent cannot access or initiate any previously scheduled tasks. - Next, restore the
MSCRM_CONFIG
database and then all the organization databases. Execute the following T-SQL command to restore these databases:RESTORE DATABASE MSCRM_CONFIG FROM <backup_device> WITH REPLACE RESTORE DATABASE <Organization_MSCRM> FROM <backup_device> WITH REPLACE
Replace
<backup_device>
with the file location in a backup device, for example,T:\MS_CRM_Master_DB_Backup\MSCRM_CONFIG.bak
. - In case SQL Server Reporting Services and Microsoft Dynamics CRM 2011 Connector for Microsoft SQL Server Reporting Services are also installed on the same machine,
ReportingServer
andReportingServertempDB
are also required to be restored using theRESTORE DATABASE
command as shown in the following T-SQL commands:RESTORE DATABASE ReportingServer FROM <backup_device> WITH REPLACE RESTORE DATABASE ReportingServertempDB FROM <backup_device> WITH REPLACE
Replace
<backup_device>
with the file location in a backup device, for example,T:\MS_CRM_Master_DB_Backup\ReportingServer.bak
. - Finally, we need to run the Microsoft Dynamics CRM 2011 Server setup as stated in the Installing Dynamics CRM Server recipe of Chapter 1, Installing Dynamics CRM 2011. But in this case, in the Specify Deployment Options page, we have to select the Connect to existing databases option.
Note
This step should only be tried in case the
MSCRM_CONFIG
database has been restored. If this database has not been restored (because it was not required), then we can reconnect to this database using the deployment manager. Please follow the Editing the organization's details recipe as stated in Chapter 1, Installing Dynamics CRM 2011, and change the SQL Server value.
How it works…
In this recipe, we have recovered all the databases required to make Dynamics CRM 2011 function step by step. The discussed scenario was a case of a Full Server failure. In case of a partial failure, we might need to restore a specific database. If the MSCRM_CONFIG
database is not restored, it has only to be reconnected to Dynamics CRM 2011 Server as stated in step 7 of this recipe.