Hi All,
                Recently I wrote a msi package using wix to deploy a 
database(for example, the name is CoreDB). But I found that when I want to 
uninstall CoreDB, if I just opened a query form for CoreDB in SQL SERVER 
Management Studio, of course, I would get failed. It’s expected to roll back to 
the status just before I run the uninstall process, However, I found it didn’t 
do what I want. Looking at the log file, there are many sql strings in the 
uninstall process. I guess that it read all the sql string into 
ExecuteSqlStrings property and then regard it as a whole transaction to be run. 
But in fact, it seems that  ExecuteSqlStrings is cut into some fragments to be 
run by steps which you can see it as following:
                MSI (s) (14:70) [16:48:29:917]: Executing op: 
ActionStart(Name=ExecuteSqlStrings,Description=Executing SQL Strings,)
MSI (s) (14:70) [16:48:29:918]: Executing op: 
CustomActionSchedule(Action=ExecuteSqlStrings,ActionType=25601,Source=BinaryData,Target=**********,CustomActionData=**********)
MSI (s) (14:08) [16:48:29:925]: Invoking remote custom action. DLL: 
C:\Windows\Installer\MSI9CA9.tmp, Entrypoint: ExecuteSqlStrings
ExecuteSqlStrings:  CustomActionData: 
MasterDBOnDistributor€V-LEZHOZORN€MAA€master€-2147483648€1€€€ConfigureDropDistributor€2€USE
 €ConfigureDropDistributor€2€SET NOCOUNT ON;

                 DECLARE @dist table
                (
                installed INT,
                distribution_server SYSNAME NULL,
                distribution_db_installed INT NULL,
                is_distribution_publisher INT NULL,
                 has_remote_distribution_publisher INT NULL
                );

                DECLARE @installed INT;
 DECLARE @return_value INT

 INSERT INTO @dist EXEC  sp_get_distributor
                SELECT @installed = installed FROM @dist;

 IF (@installed = 1)
                EXEC @return_value = sp_dropdistributor @no_checks = 1
                IF @return_value <> 0 RAISERROR (N'Error: sp_dropdistributor: 
Distributor is not installed', 10, 0);
ExecuteSqlStrings:  Executing SQL string: USE
ExecuteSqlStrings:  Executing SQL string: SET NOCOUNT ON;

                DECLARE @dist table
                (
                installed INT,
                distribution_server SYSNAME NULL,
                distribution_db_installed INT NULL,
                is_distribution_publisher INT NULL,
                 has_remote_distribution_publisher INT NULL
                );

                DECLARE @installed INT;
                DECLARE @return_value INT

                INSERT INTO @dist EXEC  sp_get_distributor
                SELECT @installed = installed FROM @dist;

 IF (@installed = 1)
                EXEC @return_value = sp_dropdistributor @no_checks = 1
                IF @return_value <> 0 RAISERROR (N'Error: sp_dropdistributor: 
Distributor is not installed', 10, 0);
MSI (s) (14:70) [16:48:33:472]: Executing op: 
ActionStart(Name=ExecuteSqlStrings,Description=Executing SQL Strings,)
MSI (s) (14:70) [16:48:33:473]: Executing op: 
CustomActionSchedule(Action=ExecuteSqlStrings,ActionType=25601,Source=BinaryData,Target=**********,CustomActionData=**********)
MSI (s) (14:38) [16:48:33:480]: Invoking remote custom action. DLL: 
C:\Windows\Installer\MSIAA8F.tmp, Entrypoint: ExecuteSqlStrings
ExecuteSqlStrings:  CustomActionData: 
ReferenceDBOnSubsciber€V-LEZHOZORN€MAA€CoreDBReplica€-2147483648€1€€€DropReplicaSubscriber€2€EXEC
 sp_subscription_cleanup 
N'V-LEZHOZORN\MAA',N'CoreDB',N'CoreDBPub'€UNCOREDBSQLScriptCustomGrantCoreQWSModifyRoleMember€2€EXEC
 usp_ModifyRoleMember "Network 
Service","MAA_CoreQueryWebService",0€UNCOREDBSQLScriptCustomGrantCoreQWSUser€2€EXEC
 usp_GrantAccessToUser "Network 
Service",0€UNCOREDBSQLScriptCustomGrantCoreQWSRole€2€EXEC usp_GrantAccessToRole 
"MAA_CoreQueryWebService",0,2€RemoveUserOnSubsciber€2€EXEC 
dbo.usp_GrantPermissionToUser "EMPTY",0
ExecuteSqlStrings:  Executing SQL string: EXEC sp_subscription_cleanup 
N'V-LEZHOZORN\MAA',N'CoreDB',N'CoreDBPub'
ExecuteSqlStrings:  Executing SQL string: EXEC usp_ModifyRoleMember "Network 
Service","MAA_CoreQueryWebService",0
ExecuteSqlStrings:  Executing SQL string: EXEC usp_GrantAccessToUser "Network 
Service",0
ExecuteSqlStrings:  Executing SQL string: EXEC usp_GrantAccessToRole 
"MAA_CoreQueryWebService",0,2
ExecuteSqlStrings:  Executing SQL string: EXEC dbo.usp_GrantPermissionToUser 
"EMPTY",0
MSI (s) (14:70) [16:48:33:744]: Executing op: 
ActionStart(Name=ExecuteSqlStrings,Description=Executing SQL Strings,)
MSI (s) (14:70) [16:48:33:745]: Executing op: 
CustomActionSchedule(Action=ExecuteSqlStrings,ActionType=25601,Source=BinaryData,Target=**********,CustomActionData=**********)
MSI (s) (14:9C) [16:48:33:753]: Invoking remote custom action. DLL: 
C:\Windows\Installer\MSIABA8.tmp, Entrypoint: ExecuteSqlStrings
ExecuteSqlStrings:  CustomActionData: 
CoreSqlDatabase€V-LEZHOZORN\MAA€€CoreDB€3€1€€€RemoveUserOnPublish€2€EXEC 
dbo.usp_GrantPermissionToUser "EMPTY",0€CORECONFIGBROKERUN€2€EXEC 
MAA.usp_ssbStopCoreBroker€UNCOREDBSQLScriptCustomGrantCoreServiceModifyRoleMember€2€EXEC
 usp_ModifyRoleMember "Network 
Service","MAA_CoreService",0€UNCOREDBSQLScriptCustomGrantCoreServiceUser€2€EXEC 
usp_GrantAccessToUser "Network 
Service",0€UNCOREDBSQLScriptCustomGrantCoreServiceRole€2€EXEC 
usp_GrantAccessToRole "MAA_CoreService",0,1
ExecuteSqlStrings:  Executing SQL string: EXEC dbo.usp_GrantPermissionToUser 
"EMPTY",0
ExecuteSqlStrings:  Executing SQL string: EXEC MAA.usp_ssbStopCoreBroker
ExecuteSqlStrings:  Executing SQL string: EXEC usp_ModifyRoleMember "Network 
Service","MAA_CoreService",0
ExecuteSqlStrings:  Executing SQL string: EXEC usp_GrantAccessToUser "Network 
Service",0
ExecuteSqlStrings:  Executing SQL string: EXEC usp_GrantAccessToRole 
"MAA_CoreService",0,1
MSI (s) (14:70) [16:48:34:002]: Executing op: 
ActionStart(Name=DropDatabase,Description=Dropping Databases,)
MSI (s) (14:70) [16:48:34:003]: Executing op: 
CustomActionSchedule(Action=DropDatabase,ActionType=25601,Source=BinaryData,Target=**********,CustomActionData=**********)
MSI (s) (14:94) [16:48:34:010]: Invoking remote custom action. DLL: 
C:\Windows\Installer\MSIACA3.tmp, Entrypoint: DropDatabase
DropDatabase:  CustomActionData: CoreSqlDatabase€V-LEZHOZORN\MAA€€CoreDB€3€1€€
DropDatabase:  Error 0x80040e14: failed to drop to database: 'CoreDB', error: 
Cannot drop database "CoreDB" because it is currently in use.
MSI (s) (14!2C) [16:49:31:644]: Product: MAA - Core Database -- Error 26202. 
Error -2147217900: failed to drop SQL database: CoreDB, error detail: Cannot 
drop database "CoreDB" because it is currently in use..

You can see that because I open a query form for CoreDB in SQL SERVER 
Management studio, the uninstall process failed. BUT the rollback process just 
rolled back the ExecuteSqlStrings whose value is the last evaluated(its value 
is the blue light line) not the whole sql string. Why did Installer do it like 
this? How can I design my code to make it should roll back completely?

Thanks
Meizhong Wang

------------------------------------------------------------------------------
This SF.net email is sponsored by:
High Quality Requirements in a Collaborative Environment.
Download a free trial of Rational Requirements Composer Now!
http://p.sf.net/sfu/www-ibm-com
_______________________________________________
WiX-users mailing list
WiX-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/wix-users

Reply via email to