How to rebuild your master database in MSDE when it became corrupted?

How to rebuild your master database in MSDE when it became corrupted?

  • Comments 1

Let's imagine that your instance of MSDE cannot be brought online because of any reason, like when your master database became corrupted or the their files are unavailable. Under such circumstances, if you try to rebuild the master database with a command line similar to this one

setup INSTANCENAME="MYINSTANCE" SAPWD="mySAPWd" REINSTALL=ALL REINSTALLMODE=a /I Setup\SqlRun01.msi /L*v c:\FailingAttempt.log

 

the setup it will appear to be hung for a while, you will notice that the ERRORLOG files for that instance cycles twice and that it shows some sort of severe error which prevented the SQL Server service to come online:

 

2008-01-16 14:26:34.53 server    Microsoft SQL Server  2000 - 8.00.760 (Intel X86)
    Dec 17 2002 14:22:05
    Copyright (c) 1988-2003 Microsoft Corporation
    Desktop Engine on Windows NT 5.2 (Build 3790: Service Pack 2)

2008-01-16 14:26:34.55 server    Copyright (C) 1988-2002 Microsoft Corporation.
2008-01-16 14:26:34.55 server    All rights reserved.
2008-01-16 14:26:34.55 server    Server Process ID is 900.
2008-01-16 14:26:34.55 server    Logging SQL Server messages in file 'C:\Program Files\Microsoft SQL Server\MSSQL$MYINSTANCE\LOG\ERRORLOG'.
2008-01-16 14:26:34.55 server    initconfig: Error 2(The system cannot find the file specified.) opening 'C:\Program Files\Microsoft SQL Server\MSSQL$MYINSTANCE\Data\master.mdf' for configuration information.

 

If, after the installation finally fails, you open the Windows Installer log (c:\FailingAttempt.log) you specified in the previous command line you wanted to obtain, you will notice that setup tried to run one Windows Installer Custom Action called UpgDetectBlankSaLogin and it failed to connect because SQL service wasn't running (see the information marked in red below):

 

=== Verbose logging started: 1/16/2008  14:26:18  Build type: SHIP UNICODE 3.01.4000.4042  Calling process: C:\WINDOWS\system32\msiexec.exe ===
MSI (c) (5C:F4) [14:26:18:785]: Resetting cached policy values
MSI (c) (5C:F4) [14:26:18:785]: Machine policy value 'Debug' is 0
MSI (c) (5C:F4) [14:26:18:785]: ******* RunEngine:
           ******* Product: Setup\SqlRun01.msi
           ******* Action:
           ******* CommandLine: **********
MSI (c) (5C:F4) [14:26:18:815]: Machine policy value 'DisableUserInstalls' is 0
MSI (c) (5C:F4) [14:26:18:875]: Cloaking enabled.
MSI (c) (5C:F4) [14:26:18:875]: Attempting to enable all disabled priveleges before calling Install on Server
MSI (c) (5C:F4) [14:26:18:875]: End dialog not enabled
MSI (c) (5C:F4) [14:26:18:875]: Original package ==> D:\MSDERelA\Setup\SqlRun01.msi
MSI (c) (5C:F4) [14:26:18:875]: Package we're running from ==> C:\WINDOWS\Installer\7ee98.msi
MSI (c) (5C:F4) [14:26:18:885]: APPCOMPAT: looking for appcompat database entry with ProductCode '{E09B48B5-E141-427A-AB0C-D3605127224A}'.
MSI (c) (5C:F4) [14:26:18:885]: APPCOMPAT: no matching ProductCode found in database.
MSI (c) (5C:F4) [14:26:18:895]: MSCOREE not loaded loading copy from system32
MSI (c) (5C:F4) [14:26:18:925]: Note: 1: 2205 2:  3: MsiFileHash
MSI (c) (5C:F4) [14:26:18:925]: Machine policy value 'DisablePatch' is 0
MSI (c) (5C:F4) [14:26:18:925]: Machine policy value 'AllowLockdownPatch' is 0
MSI (c) (5C:F4) [14:26:18:925]: Machine policy value 'DisableLUAPatching' is 0
MSI (c) (5C:F4) [14:26:18:925]: Machine policy value 'DisableFlyWeightPatching' is 0
MSI (c) (5C:F4) [14:26:18:925]: APPCOMPAT: looking for appcompat database entry with ProductCode '{E09B48B5-E141-427A-AB0C-D3605127224A}'.
MSI (c) (5C:F4) [14:26:18:925]: APPCOMPAT: no matching ProductCode found in database.
MSI (c) (5C:F4) [14:26:18:925]: Transforms are not secure.
MSI (c) (5C:F4) [14:26:18:925]: Note: 1: 2262 2: Control 3: -2147287038
MSI (c) (5C:F4) [14:26:18:925]: Command Line: INSTANCENAME=MYINSTANCE SA...
MSI (c) (5C:F4) [14:26:18:925]: PROPERTY CHANGE: Adding PackageCode property. Its value is '{D29DCF7A-8199-4373-BA0D-2F3635EC940C}'.
MSI (c) (5C:F4) [14:26:18:925]: Product Code passed to Engine.Initialize:           '{E09B48B5-E141-427A-AB0C-D3605127224A}'
MSI (c) (5C:F4) [14:26:18:925]: Product Code from property table before transforms: '{E09B48B5-E141-427A-AB0C-D3605127224A}'
MSI (c) (5C:F4) [14:26:18:925]: Product Code from property table after transforms:  '{E09B48B5-E141-427A-AB0C-D3605127224A}'
MSI (c) (5C:F4) [14:26:18:925]: Product registered: entering maintenance mode
MSI (c) (5C:F4) [14:26:18:925]: PROPERTY CHANGE: Adding ProductState property. Its value is '5'.
MSI (c) (5C:F4) [14:26:18:925]: PROPERTY CHANGE: Adding ProductToBeRegistered property. Its value is '1'.
.
.
.
Starting custom action UpgDetectBlankSaLogin()
Entering Function MyMsiEvaluateCondition
MsiEvaluateCondition for VersionNT returned TRUE
End Function MyMsiEvaluateCondition
Unable to connect as the SQL service is not running.
.
.
.

 

It happens that since SP3, the MSDE setup incorporated that custom action which would try to detect if the password for the SA login was blank and if that would be the case, then it would fail straight away. So, in order to rebuild your system database setup had to detect if the password for SA was blank, and to be able to complete such check the service had to be healthy enough as to come online. Then, how could you leave this endless loop?

Well, it happens that another Windows Installer property was also implemented to make this possible. Its external name is BLANKSAPWD and you must set it to 1 if you want that detection to be skipped. Therefore, the following command line would allow you to successfully rebuild the system database when it was corrupted or unavailable:

setup BlankSAPwd=1 INSTANCENAME="MYINSTANCE" SAPWD="mySAPWd" REINSTALL=ALL REINSTALLMODE=a /I Setup\SqlRun01.msi /L*v c:\WorkingAttempt.log

 

And the newly generated Windows Installer log would show this new information in it:

 

=== Verbose logging started: 1/16/2008  14:38:53  Build type: SHIP UNICODE 3.01.4000.4042  Calling process: C:\WINDOWS\system32\msiexec.exe ===
MSI (c) (90:D0) [14:38:53:971]: Resetting cached policy values
MSI (c) (90:D0) [14:38:53:971]: Machine policy value 'Debug' is 0
MSI (c) (90:D0) [14:38:53:971]: ******* RunEngine:
           ******* Product: Setup\SqlRun01.msi
           ******* Action:
           ******* CommandLine: **********
MSI (c) (90:D0) [14:38:54:001]: Machine policy value 'DisableUserInstalls' is 0
MSI (c) (90:D0) [14:38:54:011]: Cloaking enabled.
MSI (c) (90:D0) [14:38:54:011]: Attempting to enable all disabled priveleges before calling Install on Server
MSI (c) (90:D0) [14:38:54:021]: End dialog not enabled
MSI (c) (90:D0) [14:38:54:021]: Original package ==> D:\MSDERelA\Setup\SqlRun01.msi
MSI (c) (90:D0) [14:38:54:021]: Package we're running from ==> C:\WINDOWS\Installer\7ee98.msi
MSI (c) (90:D0) [14:38:54:041]: APPCOMPAT: looking for appcompat database entry with ProductCode '{E09B48B5-E141-427A-AB0C-D3605127224A}'.
MSI (c) (90:D0) [14:38:54:041]: APPCOMPAT: no matching ProductCode found in database.
MSI (c) (90:D0) [14:38:54:051]: MSCOREE not loaded loading copy from system32
MSI (c) (90:D0) [14:38:54:081]: Note: 1: 2205 2:  3: MsiFileHash
MSI (c) (90:D0) [14:38:54:081]: Machine policy value 'DisablePatch' is 0
MSI (c) (90:D0) [14:38:54:081]: Machine policy value 'AllowLockdownPatch' is 0
MSI (c) (90:D0) [14:38:54:081]: Machine policy value 'DisableLUAPatching' is 0
MSI (c) (90:D0) [14:38:54:081]: Machine policy value 'DisableFlyWeightPatching' is 0
MSI (c) (90:D0) [14:38:54:081]: APPCOMPAT: looking for appcompat database entry with ProductCode '{E09B48B5-E141-427A-AB0C-D3605127224A}'.
MSI (c) (90:D0) [14:38:54:081]: APPCOMPAT: no matching ProductCode found in database.
MSI (c) (90:D0) [14:38:54:081]: Transforms are not secure.
MSI (c) (90:D0) [14:38:54:081]: Note: 1: 2262 2: Control 3: -2147287038
MSI (c) (90:D0) [14:38:54:081]: Command Line: BlankSA...
MSI (c) (90:D0) [14:38:54:081]: PROPERTY CHANGE: Adding PackageCode property. Its value is '{D29DCF7A-8199-4373-BA0D-2F3635EC940C}'.
MSI (c) (90:D0) [14:38:54:081]: Product Code passed to Engine.Initialize:           '{E09B48B5-E141-427A-AB0C-D3605127224A}'
MSI (c) (90:D0) [14:38:54:081]: Product Code from property table before transforms: '{E09B48B5-E141-427A-AB0C-D3605127224A}'
MSI (c) (90:D0) [14:38:54:081]: Product Code from property table after transforms:  '{E09B48B5-E141-427A-AB0C-D3605127224A}'
MSI (c) (90:D0) [14:38:54:081]: Product registered: entering maintenance mode
MSI (c) (90:D0) [14:38:54:081]: PROPERTY CHANGE: Adding ProductState property. Its value is '5'.
MSI (c) (90:D0) [14:38:54:081]: PROPERTY CHANGE: Adding ProductToBeRegistered property. Its value is '1'.
.
.
.
MSI (s) (44:10) [14:40:21:306]: Skipping action: UpgDetectBlankSaLogin.2D02443E_7002_4C0B_ABC9_EAB2C064397B (condition is false)
.
.
.
=== Logging stopped: 1/16/2008  14:41:02 ===
MSI (c) (90:D0) [14:41:02:776]: Note: 1: 1728
MSI (c) (90:D0) [14:41:02:796]: Product: Microsoft SQL Server Desktop Engine -- Configuration completed successfully.

MSI (c) (90:D0) [14:41:02:806]: Grabbed execution mutex.
MSI (c) (90:D0) [14:41:02:806]: Cleaning up uninstalled install packages, if any exist
MSI (c) (90:D0) [14:41:02:806]: MainEngineThread is returning 0
=== Verbose logging stopped: 1/16/2008  14:41:02 ===

 

And that's all about it. Hope it's useful for somebody.

Leave a Comment
  • Please add 2 and 2 and type the answer here:
  • Post
  • error is coming while moving master database

    error is the request failed or the service did not respond in a timely fashon.consult the

    event log or other applicable error logs for details.

Page 1 of 1 (1 items)