Prerequisites to roll back from a failed upgrade
- Try to upgrade only those supported Microsoft CRM 1.2 environments that are operating without problems. If you are experiencing problems in Microsoft CRM 1.2, contact a Microsoft support professional by submitting a support request. This procedure is described in the "References" section. The support professional will help you determine whether the problems must be resolved before you try to upgrade to Microsoft CRM 3.0.
- Perform the upgrade at a prearranged time to avoid unforeseen production outages.
- Create Microsoft SQL Server database backups for the following databases immediately before the upgrade:
- Adventure_Works_Cycle_CRMCRYSTAL
- Adventure_Works_Cycle_METABASE
- Adventure_Works_Cycle_MSCRM
- Review Chapter 20 of the Microsoft CRM 3.0 Implementation Guide for detailed information about the upgrade backups and about additional requirements. To obtain this guide, visit the following Microsoft Web site:
Note We recommend that you test a Microsoft CRM upgrade in a disconnected test environment by using the data from a Microsoft CRM 1.2 production environment. To do this, use the Microsoft CRM 1.2 Redeployment Tools. To obtain these tools, visit the following Microsoft Web site:
How to verify that the upgrade has failed
The upgrade has failed if one of the following conditions is true:
- You receive a message that states that the upgrade "Failed."
- You receive multiple error messages. The final error message does not have a restart requirement check box.
- You receive multiple error messages. The final error message contains a Finish button.
To verify the upgrade failure, examine the Crm30svrsetup.log file for failure messages. To do this, follow these steps:
- On the Microsoft CRM 3.0 server, start Windows Explorer. In the %userprofile%\Application data\Microsoft\MSCRM\Logs folder, locate the Crm30svrsetup.log file.
- Open the Crm30svrsetup.log file in Notepad.
- If the log file contains one of the following entries, the upgrade has failed:
- Info| Microsoft CRM 3.0 Server Setup Failed
- Info| Microsoft CRM 3.0 Server Setup Setup did not complete successfully
After you verify that the upgrade has failed, follow the steps that are listed in the next three sections.
How to uninstall the Microsoft CRM 3.0 binary components
- On the Microsoft CRM 3.0 server, click Control Panel.
- Double-click Add or Remove Programs, click Microsoft CRM Server, and then click Click here for support information to verify that the build is version 3.0.5300.0 or a later version.
- After you verify the build version, click Change/Remove to open the Microsoft CRM Server Maintenance window.
- Click the Uninstall option, and then click Uninstall to remove the Microsoft CRM 3.0 binary components.
How to roll back the Microsoft CRM databases to Microsoft CRM 1.2
First, restore the following three databases by using Microsoft CRM 1.2 database backups that were created before the failed upgrade:
- Adventure_Works_Cycle_METABASE
- Adventure_Works_Cycle_MSCRM
- Adventure_Works_Cycle_CRMCRYSTAL
Note The CRMCRYSTAL database will not be listed as a Microsoft CRM 1.2 database. Restore CRMCRYSTAL as a new database.
For more information about how to restore databases, review the following topics in
SQL Server Books Online:
- Using File Backups
- Files and Filegroups
- Backing up and Restoring Databases
After you restore the databases, you must roll back the databases. To do this, follow these steps:
- Remove any components that have been created by replication and that are still in the databases. To do this, follow these steps:
- On the computer that is running SQL Server, click Start, point to All Programs, point to Microsoft SQL Server, and then click Query Analyzer.
- In the Connect to SQL Server dialog box, connect to the SQL Server installation that contains the Microsoft CRM databases that were restored. Make sure that you log on as a SQL Server administrator.
- On the toolbar drop-down list, click Adventure_Works_Cycle_METABASE.
- In the Command box, type the following statement:
SP_RemoveDBReplication 'Adventure_Works_Cycle_METABASE'
- Press F5 to run the statement, and then make sure that the statement runs successfully.
- In the Command box, delete the previous statement. Replace the statement in step 1d with the CleanupRepl.sql script that is included in the "More Information" section, and then press F5.
- Repeat steps 1c through 1f for the Adventure_Works_Cycle_MSCRM database.
- Verify that all the databases are restored. To do this, follow these steps:
- Click Start, point to All Programs, point to Microsoft SQL Server, and then click Enterprise Manager.
- Expand the selections to locate the SQL Server installation that contains the Microsoft CRM databases.
- Make sure that the following three databases are listed in this SQL Server installation:
- Adventure_Works_Cycle_CRMCRYSTAL
- Adventure_Works_Cycle_METABASE
- Adventure_Works_Cycle_MSCRM
- If these databases are not listed, contact a Microsoft support professional by submitting a support request.
How to try the upgrade again or how to reinstall to existing databases
To try the upgrade again, follow these steps:
- Start Microsoft CRM 3.0, and then specify the organization name and the SQL Server installation.
- Click Existing databases. The installation code recognizes the earlier version, and then starts the upgrade.
- If you continue to experience upgrade problems, contact a Microsoft support professional.
To reinstall Microsoft CRM 1.2 to existing databases, follow these steps:
- Start Microsoft CRM 1.2, click Use Existing Databases, and then specify the existing organization�s database.
- Select a Web server in the domain. The Microsoft CRM Web server must be in the same domain because Microsoft CRM 1.2 does not support the use of SQL Server installations and Web servers across domains.
- Restore the Crystal Reports filestore folder. To do this, follow these steps:
- Click Start, point to Programs, point to Crystal Enterprise, and then click Crystal Configuration Manager.
- Start all services.
Important If you reinstall to existing databases, do not delete the Microsoft CRM organizational unit from the Active Directory directory service. If you do this, you use the procedures that are listed in this article. To recover a deleted organizational unit, you must restore a system state backup on the domain controller.
The CleanupRepl.sql script
--BEGIN SCRIPT--
if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[ASReplicationObjects]') and OBJECTPROPERTY(id, N'IsUserTable') = 1)
drop table [dbo].[ASReplicationObjects]
GO
CREATE TABLE ASReplicationObjects
(
name sysname,
type char(2),
crdate datetime
)
DECLARE @objectName sysname
DECLARE @objectType sysname
DECLARE @sqlStatement nvarchar(1024)
DECLARE @sqlStatementBegin sysname
DECLARE @sqlStatementAndType sysname
DECLARE @sqlStatementDropTrigger sysname
DECLARE @sqlStatementDropProcedure sysname
DECLARE @sqlStatementDropView sysname
DECLARE @sqlStatementDropTable sysname
SET @sqlStatementBegin = N'IF EXISTS (SELECT name FROM sysobjects WHERE name = N'''
SET @sqlStatementAndType = N''' AND type=N'''
SET @sqlStatementDropTrigger = N''') DROP TRIGGER '
SET @sqlStatementDropProcedure = N''') DROP PROCEDURE '
SET @sqlStatementDropView = N''') DROP VIEW '
SET @sqlStatementDropTable = N''') DROP TABLE '
-- Delete triggers
SET @objectType = N'TR'
insert into ASReplicationObjects
select name, type, crdate from sysobjects where (type=@objectType) and
(name like N'del_%' or name like N'ins_%' or name like N'upd_%' )
order by name
select count(*) from ASReplicationObjects as CountTriggers -- debug
DECLARE trigger_cursor CURSOR FOR
SELECT name FROM ASReplicationObjects WHERE type = @objectType
OPEN trigger_cursor
FETCH NEXT FROM trigger_cursor INTO @objectName
WHILE @@FETCH_STATUS = 0
BEGIN
SET @sqlStatement = @sqlStatementBegin + @objectName + @sqlStatementAndType +@objectType + @sqlStatementDropTrigger + @objectName
PRINT @sqlStatement
EXEC sp_executesql @stmt = @sqlStatement
FETCH NEXT FROM trigger_cursor INTO @objectName
END
CLOSE trigger_cursor
DEALLOCATE trigger_cursor
DELETE ASReplicationObjects
-- Delete stored procedures
SET @objectType = N'P'
insert into ASReplicationObjects
select name, type, crdate from sysobjects where (type =@objectType) and
(name like N'sp_cft_%' or name like N'sp_ins_%' or name like N'sp_sel_%' or name like N'sp_upd_%' or name like N'sel_%')
order by name
select count(*) from ASReplicationObjects as CountStoredProcedures_cft_ins_sel_upd -- debug
DECLARE storproc_cursor CURSOR FOR
SELECT name FROM ASReplicationObjects WHERE type = @objectType
OPEN storproc_cursor
FETCH NEXT FROM storproc_cursor INTO @objectName
WHILE @@FETCH_STATUS = 0
BEGIN
SET @sqlStatement = @sqlStatementBegin + @objectName + @sqlStatementAndType +@objectType + @sqlStatementDropProcedure + @objectName
PRINT @sqlStatement
EXEC sp_executesql @stmt = @sqlStatement
FETCH NEXT FROM storproc_cursor INTO @objectName
END
CLOSE storproc_cursor
DEALLOCATE storproc_cursor
DELETE ASReplicationObjects
-- delete sp like %xpand_% . 53 sp for each Replication setup. - Done below
SET @objectType = N'P'
insert into ASReplicationObjects
select name, type, crdate from sysobjects where (type =@objectType) and
(name like N'%xpand_%' or name like N'%p_cft_%')
order by name
select count(*) from ASReplicationObjects as CountStoredProceduresLikeExpand -- debug
DECLARE storproc_cursor2 CURSOR FOR
SELECT name FROM ASReplicationObjects WHERE type = @objectType
OPEN storproc_cursor2
FETCH NEXT FROM storproc_cursor2 INTO @objectName
WHILE @@FETCH_STATUS = 0
BEGIN
SET @sqlStatement = @sqlStatementBegin + @objectName + @sqlStatementAndType +@objectType + @sqlStatementDropProcedure + @objectName
PRINT @sqlStatement
EXEC sp_executesql @stmt = @sqlStatement
FETCH NEXT FROM storproc_cursor2 INTO @objectName
END
CLOSE storproc_cursor2
DEALLOCATE storproc_cursor2
DELETE ASReplicationObjects
-- Delete views
SET @objectType = N'V'
insert into ASReplicationObjects
select name, type, crdate from sysobjects where (type='V') and
(name like N'ctsv_%' or name like N'tsvw_%' )
order by name
select count(*) from ASReplicationObjects as CountViews -- debug
DECLARE view_cursor CURSOR FOR
SELECT name FROM ASReplicationObjects WHERE type = @objectType
OPEN view_cursor
FETCH NEXT FROM view_cursor INTO @objectName
WHILE @@FETCH_STATUS = 0
BEGIN
SET @sqlStatement = @sqlStatementBegin + @objectName + @sqlStatementAndType +@objectType + @sqlStatementDropView + @objectName
PRINT @sqlStatement
EXEC sp_executesql @stmt = @sqlStatement
FETCH NEXT FROM view_cursor INTO @objectName
END
CLOSE view_cursor
DEALLOCATE view_cursor
DELETE ASReplicationObjects
-- Delete tables
SET @objectType = N'U'
insert into ASReplicationObjects
select name, type, crdate from sysobjects where (type='U') and
(name like N'%onflict_%' )
order by name
select count(*) from ASReplicationObjects as CountTables -- debug
DECLARE table_cursor CURSOR FOR
SELECT name FROM ASReplicationObjects WHERE type = @objectType
OPEN table_cursor
FETCH NEXT FROM table_cursor INTO @objectName
WHILE @@FETCH_STATUS = 0
BEGIN
-- "-" in table name has a syntax problem, therefore, add [] around table name
SET @sqlStatement = @sqlStatementBegin + @objectName + @sqlStatementAndType +@objectType + @sqlStatementDropTable + N'['+@objectName + N']'
PRINT @sqlStatement
EXEC sp_executesql @stmt = @sqlStatement
FETCH NEXT FROM table_cursor INTO @objectName
END
CLOSE table_cursor
DEALLOCATE table_cursor
DELETE ASReplicationObjects
DROP TABLE ASReplicationObjects
--END SCRIPT--