Error 1311.Source file not found: C:\Program Files\Microsoft SQL Server\110\Setup Bootstrap\Update Cache\KB4018073\ServicePack\redist\VisualStudioShell\VC10SP1\vc_red.msi. Verify that the file exists and that you can access it.

-> I was applying SQL Server 2012 Service Pack 4 on a database server. It failed with below error,

Instance MSSQLSERVER overall summary:
Final result: The patch installer has failed to update the shared features. To determine the reason for failure, review the log files.
Exit code (Decimal): -2068709375
Exit facility code: 1202
Exit error code: 1
Exit message: The required MSI package ‘C:\Program Files\Microsoft SQL Server\110\Setup Bootstrap\Update Cache\KB4018073\ServicePack\redist\VisualStudioShell\VC10SP1\vc_red.msi’ doesn’t exist.
Start time: 2018-02-20 09:54:47
End time: 2018-02-20 09:57:19
Requested action: Patch
Exception help link: http://go.microsoft.com/fwlink?LinkId=20476&ProdName=Microsoft+SQL+Server&EvtSrc=setup.rll&EvtID=50000&ProdVer=11.0.7001.0&
EvtType=0xB34122F7%400xF762992B%401202%401&EvtType=0xB34122F7%400xF762992B%401202%401
Feature: Database Engine Services
Status: Failed: see logs for details
Reason for failure: An error occurred for a dependency of the feature causing the setup process for the feature to fail.
Next Step: Use the following information to resolve the error, and then try the setup process again.
Component name: Microsoft Visual Studio 2010 Redistributables
Component error code: 1311
Component log file: C:\Program Files\Microsoft SQL Server\110\Setup Bootstrap\Log\20180220_103719\MSSQLSERVER\VC10Redist_Cpu64_1.log
Error description: Error 1311.Source file not found: C:\Program Files\Microsoft SQL Server\110\Setup Bootstrap\Update Cache\KB4018073\ServicePack\redist\VisualStudioShell\VC10SP1\vc_red.msi. Verify that the file exists and that you can access it.
Error help link: http://go.microsoft.com/fwlink?LinkId=20476&ProdName=Microsoft+SQL+Server&EvtSrc=setup.rll&EvtID=50000&ProdVer=11.0.7001.0&
EvtType=vc_red.msi%40InstallFiles%401311

-> There were no missing MSI/MSP file. I extracted SQL Server 2014 Service Pack 4 KB4018073 to C:\temp\SP4 and searched for vc_red.msi file.

-> I placed the files vc_red.msi and vc_red.cab from C:\temp\SP4\redist\visualstudioshell\vc10sp1\x64 to C:\Program Files\Microsoft SQL Server\110\Setup Bootstrap\Update Cache\KB4018073\ServicePack\redist\VisualStudioShell\VC10SP1\.

-> Started the patch and it failed with below error,

Feature: Database Engine Services
Status: Failed: see logs for details
Reason for failure: An error occurred for a dependency of the feature causing the setup process for the feature to fail.
Next Step: Use the following information to resolve the error, and then try the setup process again.
Component name: Microsoft Visual Studio 2010 Redistributables
Component error code: 1642
Component log file: C:\Program Files\Microsoft SQL Server\110\Setup Bootstrap\Log\20180220_104714\MSSQLSERVER\VC10Redist_Cpu32_1.log
Error help link: http://go.microsoft.com/fwlink?LinkId=20476&ProdName=Microsoft+SQL+Server&EvtSrc=setup.rll&EvtID=50000&
ProdVer=11.0.7001.0&EvtType=vc_red.msi%400x162A16FE%400×1642

-> Replaced the files vc_red.msi and vc_red.cab from C:\temp\SP4\redist\visualstudioshell\vc10sp1\x86 to C:\Program Files\Microsoft SQL Server\110\Setup Bootstrap\Update Cache\KB4018073\ServicePack\redist\VisualStudioShell\VC10SP1\.

-> Started the patching again and it completed fine without any issues.

Thank You,
Vivek Janakiraman

Disclaimer:
The views expressed on this blog are mine alone and do not reflect the views of my company or anyone else. All postings on this blog are provided “AS IS” with no warranties, and confers no rights.

Advertisements

SQL services fails after applying service pack

-> I applied service pack on one of the SQL instance in a 2 node cluster. After applying the service pack, SQL services failed to come online.

-> I applied service pack on passive node first and then on the active node. The install went fine without any issues. But after the service pack upgrade SQL server did not start.

-> Checked the SQL server error log and found that the SQL server fails during script upgrade mode with below error.

2016-12-08 23:57:25.43 spid8s      DBCC execution completed. If DBCC printed error messages, contact your system administrator.
2016-12-08 23:57:25.43 spid8s      Error: 537, Severity: 16, State: 3.
2016-12-08 23:57:25.43 spid8s      Invalid length parameter passed to the LEFT or SUBSTRING function.
2016-12-08 23:57:25.43 spid8s      Error: 912, Severity: 21, State: 2.
2016-12-08 23:57:25.43 spid8s      Script level upgrade for database ‘master’ failed because upgrade step ‘sqlagent100_msdb_upgrade.sql’encountered error 537, state 3, severity 16. This is a serious error condition which might interfere with regular operation and the database will be taken offline. If the error happened during upgrade of the ‘master’ database, it will prevent the entire SQL Server instance from starting. Examine the previous errorlog entries for errors, take the appropriate corrective actions and re-start the database so that the script upgrade steps run to completion.
2016-12-08 23:57:25.43 spid8s      Error: 3417, Severity: 21, State: 3.
2016-12-08 23:57:25.43 spid8s      Cannot recover the master database. SQL Server is unable to run. Restore master from a full backup, repair it, or rebuild it. For more information about how to rebuild the master database, see SQL Server Books Online.
2016-12-08 23:57:25.43 spid8s      SQL Trace was stopped due to server shutdown. Trace ID = ‘1’. This is an informational message only; no user action is required.
2016-12-08 23:57:25.46 Logon       Error: 18401, Severity: 14, State: 1.
2016-12-08 23:57:25.46 Logon       Login failed for user ‘iuser_SitefinityFrontier’. Reason: Server is in script upgrade mode. Only administrator can connect at this time. [CLIENT: 66.133.172.174]

-> Added -T902 to stop script upgrade mode. Started the SQL services, it started without issues. Checked the owner for MSDB and Master. Both were having SA as owner.

902 Bypasses execution of database upgrade script when installing a Cumulative Update or Service Pack.

-> Searched for sqlagent100_msdb_upgrade.sql file and opened it.

-> The script upgrade mode was failing on below set of statement in file sqlagent100_msdb_upgrade.sql,

SELECT @device_directory = SUBSTRING(filename, 1, CHARINDEX(N’master.mdf’, LOWER(filename)) – 1)  FROM master.dbo.sysaltfiles
WHERE (name = N’master’)

-> The SQL server instance did have more than one database with logical name “master”.

-> Query “”SELECT db_name(dbid) FROM master.dbo.sysaltfiles WHERE (name = N’master’)”” returned 3 databases including master database in my SQL server instance.

-> Variable @device_directory can contain only one value. But in our case 3 values were returned and thats the reason we got this error.

-> I detached the 2 databases.

-> Ran Query “”SELECT db_name(dbid) FROM master.dbo.sysaltfiles WHERE (name = N’master’)”” and it returned just master database.

-> Removed the startup parameter -T902 and started the SQL service from cluadmin.msc.

-> SQL server started this time without issues. Script upgrade mode completed fine without any issues and the version changed to appropriate value.

-> Failed over the SQL instance to other node and it came online without issues.

Thank You,
Vivek Janakiraman

Disclaimer:
The views expressed on this blog are mine alone and do not reflect the views of my company or anyone else. All postings on this blog are provided “AS IS” with no warranties, and confers no rights.

The database owner SID recorded in the master database differs from the database owner SID recorded in database ‘msdb’. You should correct this situation by resetting the owner of database ‘msdb’ using the ALTER AUTHORIZATION statement.

-> We were working on an upgrade project. We were performing an upgrade of a standalone SQL server 2005 to SQL server 2012. The upgrade failed with the error “The database owner SID recorded in the master database differs from the database owner SID recorded in database ‘msdb’. You should correct this situation by resetting the owner of database ‘msdb’ using the ALTER AUTHORIZATION statement.”.

-> The SQL server version changed to SQL server 2012. We tried a repair and it failed.

-> We tried starting the SQL services and got the below error in the errorlog.

.
.
2016-01-05 20:35:00.25 spid5s      Error: 33009, Severity: 16, State: 2.
2016-01-05 20:35:00.25 spid5s      The database owner SID recorded in the master database differs from the database owner SID recorded in database ‘msdb’. You should correct this situation by resetting the owner of database ‘msdb’ using the ALTER AUTHORIZATION statement.
2016-01-05 20:35:00.25 spid5s      The failed batch of t-sql statements :
2016-01-05 20:35:00.25 spid5s      Error: 912, Severity: 21, State: 2.
2016-01-05 20:35:00.25 spid5s      Script level upgrade for database ‘master’ failed because upgrade step ‘sqlagent100_msdb_upgrade.sql’ encountered error 33009, state 2, severity 16. This is a serious error condition which might interfere with regular operation and the database will be taken offline. If the error happened during upgrade of the ‘master’ database, it will prevent the entire SQL Server instance from starting. Examine the previous errorlog entries for errors, take the appropriate corrective actions and re-start the database so that the script upgrade steps run to completion.
2016-01-05 20:35:00.26 spid5s      Error: 3417, Severity: 21, State: 3.
2016-01-05 20:35:00.26 spid5s      Cannot recover the master database. SQL Server is unable to run. Restore master from a full backup, repair it, or rebuild it. For more information about how to rebuild the master database, see SQL Server Books Online.
2016-01-05 20:35:00.26 spid5s      SQL Trace was stopped due to server shutdown. Trace ID = ‘1’. This is an informational message only; no user action is required.

-> I added trace flag -T902 in the SQL server startup parameter and started the SQL services to see if it starts, it started without any issues.

902 Bypasses execution of database upgrade script when installing a Cumulative Update or Service Pack.

-> Went into SQL server management studio and ran the below query. “select * from sys.databases”.

-> The owner for master database was SA -> sid: 0x01. But MSDB was something else. Executed the below command and changed the owner of MSDB to SA.

use msdb
go
sp_changeobjectowner ‘sa’
go

-> Once this was done, I removed the trace flag -T902 from the SQL server startup parameter and started the SQL services and it started fine without any issues.

->  Please note that you cannot change the owner of system databases (Master, Model and tempdb) as per link http://technet.microsoft.com/en-us/library/ms190909(v=SQL.105).aspx.

Thank You,
Vivek Janakiraman

Disclaimer:
The views expressed on this blog are mine alone and do not reflect the views of my company or anyone else. All postings on this blog are provided “AS IS” with no warranties, and confers no rights.