Monday, 12 June 2017


Missing MSI & MSP

Symptoms:
SQL Server Setup has encountered the following error:
1)   When we started to do the Installation or Up gradation on the SQL Server if MSI and MSP files missing then we encountered below errors:


2)   After getting above errors, we have to check in error log using below path to identifying the exact error
“C:\Program Files\Microsoft SQL Server\100\Setup Bootstrap\Log\Summary.txt”.



 Resolution
Please follow the below steps for resolution if MSI & MSP files:

1)      Before fixing MSI and MSP files, need to run the VBS script to capture all missing MSI and MSP files
2)      Firstly, Create empty folder with Name as Missing_MSI_MSP in any drive which having enough space.
3)      After creating folder, Copy the text mentioned under FindSQLInstallsOnly.vbs Script content to a Notepad and renames the file to FindSQLInstallsOnly.vbs. Copy vbscript from below link
    ( https://support.microsoft.com/en-gb/help/969052/how-to-restore-the-missing-windows-installer-cache-files-and-resolve-problems-that-occur-during-a-sql-server-update)
4)      After creating folder, Copy the text

 


  


5)      Open a Command Prompt and browse to the location where this VBS script is located.

Go to Run < CMD run as Administrator<



Run the following command:

“Cscript FindSQLInstallsOnly.vbs %Server name%_sql_install_details.txt “


6) After running the above command and review the Output which have created as text document.               Find the find the error with Missing files and getting error as highlighted below:

MSI ERROR:
================================================================================
PRODUCT NAME   : Microsoft SQL Server 2008 R2 RsFx Driver
================================================================================
  Product Code: {D8C23BDE-4748-44D9-A9DD-8AB64EB18BE3}
  Version     : 10.51.2500.0
  Most Current Install Date: 20110804
  Target Install Location:
  Registry Path:
   HKEY_CLASSES_ROOT\Installer\Products\EDB32C8D84749D449ADDA86BE41BB83E\SourceList
     Package    : rsfx.msi
  Install Source: \x64\setup\
  LastUsedSource: n; 1; o:\6c4e8f5248900e41e6b64c80d1\x64\setup\

 !!!! rsfx.msi DOES NOT exist on the path in the path o:\6c4e8f5248900e41e6b64c80d1\x64\setup\ !!!!

 Action needed, re-establish the path to o:\6c4e8f5248900e41e6b64c80d1\x64\setup\

Installer Cache File: C:\Windows\Installer\6690cd2.msi

 !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
 !!!! C:\Windows\Installer\6690cd2.msi DOES NOT exist in the Installer cache. !!!!
 !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

     Action needed, recreate or re-establish path to the directory:

o:\6c4e8f5248900e41e6b64c80d1\x64\setup\then rerun this script to update installer cache and     results
    
The path on the line above must exist at the root location to resolve this problem with your msi/msp file not being found or corrupted, In some cases you may need to manually copy the missing file or manually
Replace the problem file overwriting it is exist:

 Copy "o:\6c4e8f5248900e41e6b64c80d1\x64\setup\rsfx.msi" C:\Windows\Installer\6690cd2.msi
 Replace the existing file if prompted to do so.

MSP ERROR:

---------------------------------------------------------------------------------
Microsoft SQL Server 2008 Full text search Patches Installed
---------------------------------------------------------------------------------
 Display Name:    Hotfix 2723 for SQL Server Database Services 2008 Full Text (64-bit) (KB971491)
 KB Article URL:  ;http://support.microsoft.com/?kbid=971491
 Install Date:    20100106
   Uninstall able:   1
 Patch Details:
   HKEY_CLASSES_ROOT\Installer\Patches\42BCD43AD9C6D1141A0F427744DCFCA9
   PackageName:   sql_fulltext.msp
    Patch LastUsedSource: n;1;C:\Windows\CUSTOM\InstallSource\microsoft\MSSQLServer\SQL2k8ENTx64_2723\Servers\CU\x64\setup\
   Installer Cache File Path:     C:\Windows\Installer\2b61c3.msp
Per SOFTWARE\Microsoft\Windows\CurrentVersion\Installer\UserData\S-1-5-18\Patches\42BCD43AD9C6D1141A0F427744DCFCA9\LocalPackage

!!!! C:\Windows\Installer\2b61c3.msp package DOES NOT exist in the Installer cache. !!!!

     Action needed, recreate or re-establish path to the directory:
       C:\Windows\CUSTOM\InstallSource\microsoft\MSSQLServer\SQL2k8ENTx64_2723\Servers\CU\x64\setup\ then rerun this script to update installer cache and results
    
The path on the line above must exist at the root location to resolve this problem with your msi/msp file not being found or corrupted, In some cases you may need to manually copy missing files or manually
Replace the problem file, Copy

"C:\Windows\CUSTOM\InstallSource\microsoft\MSSQLServer\SQL2k8ENTx64_2723\Servers\CU\x64\setup\sql_fulltext.msp" C:\Windows\Installer\2b61c3.msp

 Replace the existing file if prompted to do so.



Fixing MSI Files MSP files:

Launch media go to last used path or location of the file and then copy the file to Installer cache and rename with as shown in VBS script file (Repeat this step for all missing files).

Ex: As per above details
Go to the last used path with exists (o:\6c4e8f5248900e41e6b64c80d1\x64\setup\) or If this error message was generated for rsfx.msi, sql_fulltext.msp then you need to locate this file from the setup media under the folder structure: MSI:\x64\setup\rsfx_msi\,
                                                              MSP:CU\x64\setup\sql_fulltext.msp








Rename with rsfx.msi to 6690cd2.msi, sql_fulltext.msp to 2b61c3.msp and copy in Installer cache which as shown in VBS script file (Repeat this step for all missing files).

2) Not clustered or the cluster service is up and online. Failed




a) This issue occurs because of an invalid MSCluster namespace in Windows Management Instrumentation (WMI).
Resolution:
To resolve this issue, follow these steps:
1.At an administrative command prompt, type cd %systemroot%\system32\wbem, and then press Enter.
2.Type the following command, and press Enter:
regsvr32 cluswmi.dll
3.Type the following command, and press Enter:
mofcomp.exe ClusWMI.mof
4.Rerun the Setup of the service packs or cumulative updates on the serve




In standalone we have to skip the rules using cmd:
Path of patch executable>:\Setup /SkipRules=Cluster_IsOnlineIfClustered /action=patch

b) Some cases after running mof also we will get same error in this case we have to run wmi file .it is mostly happened in 2008 .We can get wmi file in below node


3) Attributes do not match:
To work around this problem, remove the Archive attribute from the installation folder. To do this, follow these steps:
1. Open the folder that contains the folder that has the Archive attribute.
2. Right-click the folder that you want to remove the Archive attributes from, and then click Properties.
3. On the General tab, click Advanced.
4. On the Advanced Attributes tab, click to clear the Folder is ready for archiving check box.
5. Re_run the SQL install
If the installation folder does not exist, remove the Archive attribute from the closest parent folder. For example, you install SQL Server 2008 R2 into the following folder:
C:\FolderA\FolderB\FolderC
The FolderC folder does not exist. The FolderB folder has the Archive attribute set. In this situation, you must remove the Archive attribute from the FolderB folder.






4) Element not found: Patch fails with Element not found. Check the errors are listed in the event logs what are the reasons and Check the disks are presented in the failover cluster manager or not.
Please check below sample snap I found below Server disks failed state in cluster manager it’s already decommissioned so I removed failed state disks in cluster manager, then I applied patch it was successfully completed. Keep track on the whole cluster manager all services, Nodes and disks are working or not.


6) Log OR Data directory in the registry is not valid:
Resolution:
When we check on error details it’s showing the data registry is not valid. That means below registry patch is not exists on mount point
HKLM\SOFTWARE\Microsoft\Microsoft SQL Server\MSSQL11.MSSQLSERVER\MSSQLServer
Please check below snap for server all mount points.
So I have changed registry  paths from H:\MSSQL$UTR_MAIN1_UAT\MntVol-Remote-TRANLOG01\Log   to   H:\MSSQL$UTR_MAIN1_UAT\MntVol-Remote-TRANLOG02\Log
After changed patch re_run the patch











Sunday, 26 February 2017

How to Troubleshoot MSI and MSP Files Issues:

Purpose
This TSG is aimed at providing troubleshooting steps to resolve any MSI and MSP files issues.

Background or cause

Many times while patching or installation of SQL SERVER we have come across issues of missing MSI and MSP files. 

The Windows Installer database file (http://msdn.microsoft.com/en-us/library/aa369395(VS.85).aspx) [.msi] or the Windows Installer patch file (http://msdn.microsoft.com/en-us/library/aa370596(VS.85).aspx) [.msp] is missing from the Windows Installer cache. The Windows Installer cache is present in the folder: %windir%\installer.

When a product is installed using Windows Installer, a stripped version of the original .msi file is stored in the Windows Installer cache. Every update to the product [hotfix, cumulative update or service pack setup] also stores the relevant .msp or .msi file in the Windows Installer cache.

Any future update to the product [hotfix, cumulative update or service pack setup] relies on the information present in the files stored in the Windows Installer cache. Without this information, the new patch cannot perform the required transformations.

 

 

 Symptoms

SQL Server Setup has encountered the following error:

1)   When we started to do the Installation or Up gradation on the SQL Server if MSI and MSP files missing then we encountered below errors :


 


























2)   After getting above errors , we have to check in error log using below path to identifying the exact error

“C:\Program Files\Microsoft SQL Server\100\Setup Bootstrap\Log\Summary.txt”.




Resolution

Please follow the below steps for resolution if MSI files :

1)      Before fixing MSI and MSP files , need to run the VBS script to capture all missing MSI and MSP files
2)      Firstly, Create empty folder with Name as MSI\MSP in any drive which having enough space.
3)      After creating folder, Copy the text mentioned under FindSQLInstallsOnly.vbs Script content to a Notepad and rename the file to FindSQLInstallsOnly.vbs.
4)      After creating folder, Copy the text


  


5)      Open a Command Prompt and browse to the location where this VBS script is located.

Goto Run < CMD run as Administrator<




Run the following command :

“Cscript FindSQLInstallsOnly.vbs %Server name%_sql_install_details.txt “




6)      After running the above command and review the Output which have created as text document . Find the find the error with Missing files and getting error  as highlighted below:

================================================================================
PRODUCT NAME   : Microsoft SQL Server 2008 R2 RsFx Driver
================================================================================
  Product Code: {D8C23BDE-4748-44D9-A9DD-8AB64EB18BE3}
  Version     : 10.51.2500.0
  Most Current Install Date: 20110804
  Target Install Location:
  Registry Path:
   HKEY_CLASSES_ROOT\Installer\Products\EDB32C8D84749D449ADDA86BE41BB83E\SourceList
     Package    : rsfx.msi
  Install Source: \x64\setup\
  LastUsedSource: n;1;o:\6c4e8f5248900e41e6b64c80d1\x64\setup\

 !!!! rsfx.msi DOES NOT exist on the path in the path o:\6c4e8f5248900e41e6b64c80d1\x64\setup\ !!!!

 Action needed, re-establish the path to o:\6c4e8f5248900e41e6b64c80d1\x64\setup\

Installer Cache File: C:\Windows\Installer\6690cd2.msi

 !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
 !!!! C:\Windows\Installer\6690cd2.msi DOES NOT exist in the Installer cache. !!!!
 !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

     Action needed, recreate or re-establish path to the directory:
       o:\6c4e8f5248900e41e6b64c80d1\x64\setup\then rerun this script to update installer cache and results
     The path on the line above must exist at the root location to resolve
     this problem with your msi/msp file not being found or corrupted,
     In some cases you may need to manually copy the missing file or manually
     replace the problem file overwriting it is exist:

     Copy "o:\6c4e8f5248900e41e6b64c80d1\x64\setup\rsfx.msi" C:\Windows\Installer\6690cd2.msi
 Replace the existing file if prompted to do so.

7)      Fixing MSI Files :

Launch media go to last used path or location of the file and then copy the file to Installer cache and rename with as shown in VBS script file (Repeat this step for all missing files).

Ex: As per above details
Goto the last used path with exists (o:\6c4e8f5248900e41e6b64c80d1\x64\setup\) or If this error message was generated for rsfx.msi, then you need to locate this file from the setup media under the folder structure: \x64\setup\rsfx_msi\. 



Rename with rsfx.msi to 6690cd2.msi and copy in Installer cache which as shown in VBS script file (Repeat this step for all missing files).



Fixing MSP files :

1)Get the details of all the KB article and download it.

2)Copy the text mentioned under RepairSource_v3.js Script content to a Notepad and rename the file to RepairSource_v3.js.
3)Create folder with name as  Extract folder in any drive to extract the MSP files as shown below



4)Run the below script for each of the extracted KB’s.

Cscript RepairSource_v3.js <Extraction path>

Ex :


5)Restore the files that are missing from the Windows Installer cache. The steps to do this are outlined below:
Gather the complete details about the missing file from the error message or the setup log file or registry entries maintained by the Windows Installer. In the example shown above, all the information required to resolve the issue is present in the error message itself:

Patch Name: "Hotfix 1702 for SQL Server 2008 R2 (KB981355) (64-bit)"
Original MSP file used by the Patch: sql_engine_core_inst.msp
Cached MSP file: c:\Windows\Installer\1fdb1aec.msp

If you do not have all the details, refer to the More Information section for the steps to get these details.
Go to http://support.microsoft.com (http://support.microsoft.com/) and search for the KB article associated with this patch. In this example, you will search for KB981355.
Download this patch package to your computer. Make sure to download the patch package that corresponds to the required platform. In this example, it would be SQLServer2008R2-KB981355-x64.exe.
Extract the contents of the patch package using the syntax:
C:\Temp>SQLServer2008R2-KB981355-x64.exe /x C:\Temp\SQLServer2008R2-KB981355-x64
Now locate the original msp file sql_engine_core_inst.msp. It should be present in the folder: C:\Temp\SQLServer2008R2-KB981355-x64\x64\setup\sql_engine_core_inst_msi\
Copy this original msp file to the Windows Installer cache: %windir%\installer\
Rename the original msp file sql_engine_core_inst.msp to the cached msp file 1fdb1aec.msp

You can launch the setup program for the patch that resulted in the error and resume the patch process. It is possible that you encounter this message for a missing Windows Installer cache file for another component or another patch of the same product.


6)Repeat for all the KB articles that are extracted.
The output looks like :


 
7)Rerun FindSQLInstallsOnly.vbs and no more missing MSI and MSP files.

8)Finally repair the SQL Server and proceed with installation or upgradation.



Finding msp
------------------------------------------------------------------------This is Praveen. I have completed my graduation in the stream of Bachelor of Technology at JNTU University in 2009. I have completed my Intermediate education at Shri Prathiba Junior College.
I have worked as a MS SQL DBA in Wipro. Later, I worked as a MS SQL DBA at Ensono Technologies.
My hobbies are listening music, watching television, and playing caroms.
My strengths are self motivated and being dedicated.
I can present my skill and abilities as much as possible for the growth of the organisation.-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

if( WScript.Arguments.Length < 1 )
{
    WScript.Echo( "Usage: RepairSP1Source.js \"<path to extracted SP1 files>\"" );
    WScript.Quit( 1 );
}

var filesystem = new ActiveXObject( "Scripting.FileSystemObject" );
var newSource = WScript.Arguments( 0 );

if( !filesystem.FolderExists( newSource ) )
{
    WScript.Echo( "The path to the extracted SP1 package does not exist.  Please correct the path and run the tool again." );
    WScript.Quit( 1 );
}

var installer = WScript.CreateObject( "WindowsInstaller.Installer" );

// Look for MSPs at the extracted location

EnumerateMSPs( newSource );

function EnumerateMSPs( extractedSp1PatchPath )
{
    var folder = filesystem.GetFolder( extractedSp1PatchPath );
    var fileEnum = new Enumerator( folder.Files );
    for( ; !fileEnum.atEnd(); fileEnum.moveNext() )
    {
        var nextFile = fileEnum.item();

        if( filesystem.GetExtensionName( nextFile.Name ) == "msp" )
        {
            WScript.Echo( "Found patch located at: " + nextFile.Path );
            var extractedSp1PatchSummaryInfo = installer.SummaryInformation( nextFile.Path );
            // Retrieve the PatchCode from the SummaryInformation
            var extractedSp1PatchCode = new String( extractedSp1PatchSummaryInfo.Property( 9 ) ).substring( 0, 38 );
            // Look to see if we need to repair the cached MSP for this Patch
            RepairCachedMSP( extractedSp1PatchCode, nextFile.Path );
            WScript.Echo();
        }
    }

    // Now look in subfolders for MSPs
    var folderEnum = new Enumerator( folder.SubFolders );
    for( ; !folderEnum.atEnd(); folderEnum.moveNext() )
    {
        var nextFolder = folderEnum.item();
        EnumerateMSPs( nextFolder.Path );
    }
}

function RepairCachedMSP( extractedSp1PatchCode, extractedSp1PatchPath )
{
    var sp1Patch = null;
    var cachedSp1PatchFileName = null;
    WScript.Echo( "Attempting to repair the local cache for PatchCode \"" + extractedSp1PatchCode + "\"" );
    // Enumerate all products installed on the machine to see if any have been patched by
    // this MSP
    var products = installer.ProductsEx( "", "", 4 );

    // Look for the first product that is patched with this MSP.

    for( var x = 0; (sp1Patch == null) && (x < products.Count); x++ )
    {
        var nextProduct = products.Item( x );
        var nextProductPatches = installer.PatchesEx( nextProduct.ProductCode, "", 4, 1 );

        for( var y = 0; (sp1Patch == null) && (y < nextProductPatches.Count); y++ )
        {
            var nextProductPatch = nextProductPatches.Item( y );
            var nextPatchURL = nextProductPatch.PatchProperty( "MoreInfoURL" );
            var nextPatchURLString = new String( nextPatchURL );

            // See if this patch is SP1 and if it matches the PatchCode of what the user
            // extracted to the hard drive.
            if ( extractedSp1PatchCode == nextProductPatch.PatchCode )
            {
                cachedSp1PatchFileName = nextProductPatch.PatchProperty( "LocalPackage" );
                // Only re-cache if the MSP is missing
                if( !filesystem.FileExists( cachedSp1PatchFileName ) )
                {
                    sp1Patch = nextProductPatch;
                }
            }
        }
    }

    if( !cachedSp1PatchFileName )
    {
        WScript.Echo( "No action can be taken as the patch has not been applied on the local machine." );
    }
    else
    {
        if( sp1Patch == null )
        {
            WScript.Echo( "No action will be taken since the provided SP1 patch appears to exist locally." );
        }
        else
        {
            var extractedSp1Patch = filesystem.GetFile( extractedSp1PatchPath );
            WScript.Echo( "Re-caching patch for the product code \"" + sp1Patch.ProductCode
                + "\" and patch \"" + sp1Patch.PatchCode + "\" to \"" + cachedSp1PatchFileName + "\"" );
            extractedSp1Patch.Copy( cachedSp1PatchFileName );
            var updatedSp1Patch = filesystem.GetFile( cachedSp1PatchFileName );
            var currentAttributes = updatedSp1Patch.Attributes;
         
            // If the file isn't read-only mark it as such.

           if( ( currentAttributes & 1 ) == 0 )
            {
                updatedSp1Patch.Attributes = (currentAttributes | 1 );
            }
        }
    }
}

--------------------------------------------------------------------------------------------------------------------------