SQL Server will not work after windows update - sql-server

My Windows 10 machine insists on doing an update every so often after which MSSQL Server will not start. When I try and start it manually from services I get the following error:
Windows could not start the SQL Server () service on Local Computer. Error 2: The System cannot find the file specified
The only way to rectify it is to undo the last update from the updates panel in windows. But every couple of days I come back to it and the update has executed again. Any ideas on how to trouble shoot the above error?

Related

SSIS Project Failing When Running As SQL Server Agent Job

I have designed a SSIS project and deployed it to SQL server and also created the job to run on daily basis but its giving me this error when executing this as job (doesnt give any error within VS):
There is this CLSid in this error message but there is no application associated to it in
--> Component Services -> Computers -> My Computer -> DCOM Config
But this CLSid is registered inside registry editor
About this particular task on which this error is occurring: This is a script task which is modifying and deleting the un-wanted rows from the excel file in which I am trying to write SQL table data.
Script task code looks like this:
I have been working for hours now trying to fix this problem but no success. Kindly guide me how can I fix this issue. If any other information is required related to this project, please let me know....
Doing Excel automation in a SQL Server agent job is totally unsupported and probably won't work.
To have even a ghost of a chance of making this work you'll need to run a real desktop session on the server and automate Excel in that. Excel expects a real user to be logged in with a full profile. And Excel has failure conditions where it displays a popup window, which you'll need to be able to access via remote desktop.
You can read and write Excel files on a server with the OpenXML SDK, without actually having to run Excel. There's also a wrapper library called ClosedXML which you may find easier to use than using OpenXML directly.
tl;dr;
You need to install Office (Excel) on the server AND ensure that you install it in a manner that mirrors the SQL Agent's expected bit-edness. Default for Agent is going to be 64bit, default for Office is still 32 :(
Error guessing
You have a script task that uses the Office interop libraries to delete some rows (2 through 11?) out of a spreadsheet.
You have Office installed on your machine and therefore you have the libraries installed. Excel still has COM based "stuff" in it, thus the interop and errors shrieking about the CLSid, registry, etc but that's likely just secondary errors because there is no base "application is not installed" exception to be thrown.
If Office is installed, then ensure your agent execution model matches the version of Office. If 32 bit Excel is already installed, don't potentially break everyone else's stuff by uninstalling and reinstalling as 64 bit, just got the Advanced section of the SQL Agent Job Step and check the 32bit box.
Once all that's done, then if you're still getting errors but new ones, then the existing comments mentioning permissions may come into play - it depends on where the Excel document actually exists (on the computer where SQL agent can access vs on the computer where it cannot vs networked drive)
Good luck in not finding people on the sanctions lists.

Error installing SQL Server 2008 R2 any version. Error code: 1605

SQL Server Setup has encountered the following error:
MsiGetProductInfo failed to retrieve ProductVersion for package with Product Code = '{DF167CE3-60E7-44EA-99EC-2507C51F37AE}'. Error code: 1605..
What I've done so far:
Had to re-install Windows 7 because I kept getting a pop up that said my windows was unregistered, which it wasn't (known bug) so I re-installed as per MS recommendation.
Un-installed SQL Server 2008 + ran Microsoft Fix It tool.
Tried to re-install.
After I got the error I deleted all the registry entries per instructions available where others have posted this same problem.
When I continued to get the error I renamed the registry directory UpgradeCodes to UpgradeCodes.old.
I've rebooted after every step and I've repeated this many times...
In all cases when I try to re-install it fails with Error code: 1605. At this point when I search the registry for the reversed key it is not found. It's gone.
Not sure what to do next.
Any suggestions would be appreciated. Thanks
I have the same problem and following method which I got it from http://www.thewindowsclub.com/ worked for me:
Method 2
This method is a little risky but should work at the first attempt. Make sure you don’t reboot the system until we complete the process. In this method we will just make the UpgradeCodes unusable until we finish the SQL install.
First setup is exit the install and shutdown all the applications
Then go toregistry and create a backup of the registry.
Now go to HKEY_Classes_Root\Installer\UpgradeCodes.
Right click on UpgradeCodes and click on Export and type in UC.reg and save it somewhere (Maybe Desktop)
Then right click again and click on rename and rename to UpgradeCodes.old
Now attempt to install SQL again. This time it should work in first try. Make sure you don’t reboot the system because sometime other application like MS Office might stop working. Once the installation is complete, close the installer and find the file you saved UC.reg and double click on it and click OK.
Now we have up the UpgradeCodes back again.

Not able to attach database in SQL Server 2008R2

I have SQL Server 2008R2 on my laptop, with a number of databases on it.
I detached one of my development databases today (I wanted to take a copy) using SSMS, and now I can't re-attach it. Whenever I try I get the following error
CREATE FILE encountered operating system error 5(failed to retrieve text for this error. Reason: 15105) while attempting to open or create the physical file
I have seen numerous similar questions on this, and they always seem to suggest the database being attached to another SQL Server instance. I have checked as to whether I have another SQL Server instance running, can't see anything even remotely like in Task manager. I even restarted the computer to clear any if they were there - no joy.
I read somewhere that if I change the Log On checkbox on the SQL Server Services properties Log On tab to Local System Account that should do it; it didn't.
I am at a complete loss as to where to go next.
Any ideas anyone?
Error 5 is Access Denied. It is a permissions issue. You do not have permissions to write to that location. You probably should be an Administrator on that machine.

SqlExpress Db Is in use by system

I have a strange problem that is reoccurring. My app is a MVC5 application using EF code first and SQLExpress. My solution uses 4 databases - 3 of which work without a problem. The fourth database is constantly 'acquired' by 'System'. Everyday for the last week when I boot up I have a problem.
When I run the app and the DatabaseInitializer runs I get this exception :
Cannot open database "databaseName" requested by the login. The login failed. Login failed for user 'Computer\UserName'.
Weird. I read some S.O. articels about changing permision, but that smells to me. This database shouldent be in someone elses domain in the first place! The other databases work fine !
So I go about deleting the database. I get this error.
Error deleting file 'database.mdf'. The process cannot access the file because it is being use by another process.
So I reboot and go to delete the database directly from the windows explorer.
The action can't be completed because the file is open in System
I was finally able to delete the file by running my PC in safe mode and deleting it there. Im not sure what the cause of this is. I am running SQL express and I don't see any SQL background services running.

SqlServer is in script upgrade mode

Vista just finished one of its many updates. After restarting my computer I try connecting to SqlServer2008 instance with Sql Server Management Studio and I get this error:
Error connecting to '...\MSSQLSERVER2008'.
Additional information:
Login failed for user '...'. Reason: Server is in script upgrade mode. Only administrator can connect at this time. (Microsoft SQL Server, Error: 18401).
Pressing help gets me to an internet page saying there's no additional information.
Thx Vista & Updates. Anyone an idea because on the internet I can't find anything about this issue.
It appears This Guy was having the same problems as you and his only suggestion was to wait a few minutes before trying to log in again.
I have yet to see any type of Microsoft documentation about this, nor have I seen any forum posts which came to any sort of resolution concerning the same problem.
Check your event viewer. I had the same problem and found that (in my case) it was looking for a directory that didn't exist to perform an upgrade script. NO hint that there was any sort of problem in the dialog, but the event viewer showed clearly what the problem was.
jim
I had the same problem. Waiting until update was done did not help. Solution was, (after checking Windows eventlog) to set the folder rights. SQL-Express had no rights on the database folder, why ever. Something has mixed up the rights during the upgrade from WinXP to Win 7. That was it.
Adding a comment to this page since this is the top Google result for "script upgrade mode". It seems that a number of things can cause a SQL Server DB to go into this mode. In our shop we've run into these two cases in the past months:
Log shipping - Can't recall at what point of the process exactly the DB went into this mode, iirc it was when bringing it back up. The solution was just to wait it out.
Hard drive full - The DB went into this mode when it ran out of space. We're currently clearing up the drive, will come back with an update if waking it up turns out to be challenging.
Update: After freeing up disk space, it was a simple matter of setting the DB "Offline" and then "Online" to bring it back up.
We had the same issue, but needed to know what was going on in the background.
The db's were put into recovery mode, hence they had to recover. To assist we went to the SQL Server error log located where the system files (normally master, model, msdb...) are located, but under the log folder. In the ERRORLOG, we did a find on the word recovery and could watch the db's percentage recovered. Everything recovered normally, but it was much longer than expected.
The Reason for this is that the system reboot happens with important\necesssary softwares loaded and does all other operation later so that the booting happens faster.
Here in your case, the sql booting is happening as the start of SQL is not needed for system to start. I hope you are aware of DAC account(Dedicated Administrator Connection, Link) who has seperate connectivity and has ability to resolve issues even the whole SQL server is not responing. The SQL server is asking you either to wait or open the SQL with DAC account and stop the SQL update.
Solutions:
1) Wait until backround update completes
2) Open SQL using DAC account and kill all running processes

Resources