I'm getting an error, says "Could not load the DLL xpstar.dll... Reason: 5(Access is denied)" right after logging into SQL Server Management Studio . Even though I can browse through the database schemas but I can't perform any action.
`My current configuration:
SQL Server Enterprise 2016
SQL Server 2016 Management Studio
Authentication mode: mixed mode`
SQL Server services
Binn folder permissions
What I've tried to figure out the cause:
Check Sql server services and they are all running.
Try connecting and performing some actions with SQLCMD (list tables, list db schemas...). It's all good.
Run SSMS as administrator.
Check permissions of BINN folder.
Disable Kaspersky Endpoint Security.
None of above steps can resolve the issue. So please kindly help me to fix it.
It turns out the folder ownership is the root cause. MSSQL and its subfolders were owned by SYSTEM. Even though Administrators group were assigned full control but They couldn't access to the folder. Probably, Kaspersky is involved. I'm not sure about that.
Solutions:
Change ownership of folder MSSQL (Drive:\Program Files\Microsoft SQL Server\MSSQLXX.MSSQLSERVER\MSSQL) from SYSTEM to Administrator.
Run SSMS as Administrator and problem is solved.
Related
I upgrade the SQL 2014 Express to a Standard edition without changing the instance name. There was a success and it seems to be working fine, except the SQL AGENT.
Error message from configuration manager:
The request failed or the service did not respond in a timely fashion.
Consult the event log or other applicable error logs details.
Trying with the server administrator user. Built in account/Local service also don't work.
Event log doesn't show anything except that it's turned on and then off.
This is what I see in DETAILS. doesn't tell me anything:
Provider
[ Name] SQLAgent$SQLEXPRESS
EventID 102
[ Qualifiers] 16384
Level 4
Task 2
Keywords 0x80000000000000
Trying to run it from CMD with admin rights:
StartServiceCtrlDispatcher failed (error 0).
Read somewhere to try to turn off VIA protocol. I don't have any protocol called VIA.
Any ideas?
Thanks
Just after I posted I checked the security and found out that the BUILTIN\USERS didn't have sysadmin permission..
After adding it, it was resolved!
I had a similar issue when I upgraded the SQL Server 2017 from Express to Standard. The SQL Server Agent would not start even after the upgrade.
I an error message in the SQLAgent Log
(C:\Program Files\Microsoft SQL Server\MSSQL14.SQL2017EXPRESS\MSSQL\Log)
2017-12-18 16:21:06 - ! [298] SQLServer Error: 229, The EXECUTE permission was denied on the object 'sp_sqlagent_update_agent_xps', database 'msdb', schema 'dbo'. [SQLSTATE 42000] (DisableAgentXPs)
Changing the SQL agent service Log On account to "Local System" does not work (as you described).
Ultimately what worked for me is changed the Log On account to "NT Service\MSSQL$SQL2017EXPRESS" works.
This user was created when I named the SQL Server "SQL2017EXPRESS" during installation. If you open up SSMS, connect to your database instance, and open up Security->Logins, you should able find a list of database NT Service users that have access the system database (msdb). Try using one of those users as your Log On user for the SQL Agent Service.
I think you install Standard edition, it would create a user call NT Service\MSSQLAgent$2014.
During research, I tried in the instruction in this article. It appears using Sql Server Configuration Manager to change the Log On user didn't work for me. Instead, changing the Log On user from Administrator->View Local Services works.
I know this is late, but I hope it helps someone in the future; a fix that has worked for me after an upgrade from Express to Standard was to run the Repair option (see image) from the Maintenance node of the SQL Server Installation Center. Once the repair completes & restart finishes, Agent works as expected.
Use Repair option from the Maintenance page of the SQL Server Installation Center
I had this same issue with SQL 2019 after upgrading from express to standard. Doing the Repair from the installation maintenance section fixed the agent for me.
I had a new machine which windows crashed and I had to do a Windows reset which reinstalled Windows. Afterwards I deleted the old app user accounts in the C:\Users folder since the reinstall didn't delete it, these included SQL Server MSSQLServer and .net accounts because I was going to install all the apps from scratch I decided to clear it up and delete it.
I then ran SQL Server 2014 SP1 setup selecting database engine, client connectivity and Management Studio on default instance MSSQLServer
using mixed mode authentication and added my own sa password and my current windows user.
At the end of my installation I notice the installer takes a very long time at the following step
SqlEngineDBStartConfigAction_install_configrc_Cpu64
I then get an error
The following error occurred:
Could not find the Database Engine startup handle.
Logs
Feature: Database Engine Services
Status: Failed: see logs for details
Reason for failure: An error occurred during the setup process of the feature.
Next Step: Use the following information to resolve the error, uninstall this feature, and then run the setup process again.
Component name: SQL Server Database Engine Services Instance Features
Component error code: 0x851A0019
Error description: Could not find the Database Engine startup handle.
Error help link: http://go.microsoft.com/fwlink?LinkId=20476&ProdName=Microsoft+SQL+Server&EvtSrc=setup.rll&EvtID=50000&ProdVer=12.0.4100.1&EvtType=0xD15B4EB2%400x4BDAF9BA%401306%4025&EvtType=0xD15B4EB2%400x4BDAF9BA%401306%4025
I open SQL Server configuration manager Services and noticed my MSSQLServer doesn't start up because it runs as NT Service\MSSQLSERVER user. I change that to local system account and start the service and the service runs.
However when I open SQL Server Management Studio and try to connect to the database engine I can't connect with neither my windows user I added during the SQL Server setup nor the sa user with password I specified.
Cannot connect to PCName. Login failed for user PCName\User. Microsoft SQL Server Error 18456
When I uninstall SQL Server and reinstall it I get the same issue. Even when I delete the program files directory C:\Program Files\Microsoft SQL Server\MSSQL12.MSSQLSERVER
How do I get it to work?
Why does a new SQL Server 2014 SP1 installation not create the MSSQLServer user?
How to I create the MSSQLServer user manually and what permissions and groups do I assign to it?
I tried everything to resolve it. Delete all the SQL Server folders. Remove registry entries as mentioned in other stackoverlow answers. Installed SQL Server 2014 SP1 again and the problem still occurs.
Even when I installed SQL Server 2012 SP1 on the default instance I would still get the error.
The only workaround I could get it to work was to install SQL Server as a separate instance and not the default instance.
This made me thinking if the issue is only related to the default instance.
I looked at my C:\Users folder and the default instance MSSQL user folder was not there meaning the installer never created it. The problem must have occurred that I previously deleted the User folder to clean up the machine where I should have deleted the windows users from Control Panel Admin Tools instead.
Solution: Use regedit.exe
The problem entry should be the corresponding S Folder in.
HKEY_LOCAL_MACHINE - SOFTWARE - Microsoft -Windows NT -CurrentVersion -ProfileList
Delete this user
Reinstall and verify in the C:\Users if the MSSQL user gets created.
I tried to be safe and deleted all references to the MSSQL user in the registry user after uninstalling all SQL Server references in Add/Remove Programs and clearing up the Program Files folders the one registry item is probably the cause.
This solution helped me to fix the issue.
I had deleted MSSQLServer and SQLAgent account while cleanup of SQLServer2016, but then MSSQLServer 2016 installer wasn't getting re-installed, reason being it could not create the service account, and my application is limited to support "only default SQL instance"
I have followed this and deleted the REG entries and this helped me to reinstall SQL Server smoothly.
Thank you so much .
Solution: Use regedit.exe
The problem entry should be the corresponding S Folder in.
HKEY_LOCAL_MACHINE - SOFTWARE - Microsoft -Windows NT -CurrentVersion -ProfileList
I backed up a database from a SQL Server 2005 using my SSMS Task and called it datalab_auth.bak.
I then tried to restore it to my SQL Server 2012 but keep getting the following error:
System.Data.SqlClient.SqlError: The operating system returned the error '5(Access is denied.)' while attempting 'RestoreContainer::ValidateTargetForCreation' on 'C:\Program Files\Microsoft SQL Server\MSSQL11.MSSQL11\MSSQL\datalab_auth.mdf'. (Microsoft.SqlServer.SmoExtended)
I tried to set the path in the above error to have permissions of Everyone to Full. Which it is currently set to.
What am I missing?
When you are performing a restore, make sure you set the option to "Overwrite the existing database" in the restore wizard.
Check what account you are using to run the SQL service through the SQL Configuration Manager and assign permissions to the account on the file and folder.
This post might help:
mssql '5(Access is denied.)' error during restoring database
The OS error 5 is about to permissions issue on the files and folder paths, I have check my account on config manager to fix this issue.
The fix steps on my case:
open SqlServer Configuration Manager as administration
Click SqlServer Service
Right click on you sql server instance, click properties
Choose Log On tab
Account name: input your administrator account and password.
Then backup database successfully.
The environment is that, the OS is Win7 and the version of sql server is MS Sqlserver 2012
This worked for me. After you select your database to restore, select file option and check realocate all files to folder
I'm trying to restore a backup from a .bak file to a local database server and keep getting the error message.
An exception occurred while executing a Transact-SQL statement or batch.(Microsoft.SqlServer.ConnectionInfo)
Cannot open backup device 'C:\Clients\SQLitis\jMKZ.bak'. Operating system error 5(Access is denied.).
RESTORE HEADERONLY is terminating abnormally. (Microsoft SQL Server, Error: 3201)
No idea where to even start troubleshooting this. I'm on an administrator account and have full privileges so there shouldn't be anything to deny me doing this but I'm still getting the error message.
Sounds like the service account that SQL Server runs under does not have permission to folder C:\Clients\SQLitis.
When SQL Server was installed, it hopefully was set up to use a domain user account (the "service account") that is NOT an administrator on the machine. As such, the SQL Server installer only grants permissions to the folders the SQL Server setup creates.
You need to give permission to that folder to the user account that SQL Server acts as. In my case it was NT Service\MSSQLSERVER
You can find/change the SQL Server user in SQL Server Configuration Manager. Here's a link that shows how:
http://www.bidn.com/blogs/ShawnHarrison/ssis/2134/access-denied-during-database-backup
Maybe a little hacky, but I solved the issue by copying the .bak file into the designated backup folder. That way I didn't have to change any permissions.
I have publish my website in IIS7. It is running in DefaultAppPool. The Identity of this app-pool is set to LocalSystem. The IIS is running and I can run the application from IIS without any problem.
Now I want to attach the database placed in inetpub's application folder:
C:\inetpub\wwwroot\EMSApplication\App_Data\ASPNETDB.mdf
I have added new logins in the SSMS which are: NT AUTHORITY\NETWORK SERVICE and IIS APPPOOL\DefaultAppPool.
But when I am trying to attach that database in the SSMS I am getting follwoing error:
TITLE: Microsoft SQL Server Management Studio
Failed to retrieve data for this request.
(Microsoft.SqlServer.Management.Sdk.Sfc)
For help, click:
http://go.microsoft.com/fwlink?ProdName=Microsoft+SQL+Server&LinkId=20476
------------------------------ ADDITIONAL INFORMATION:
An exception occurred while executing a Transact-SQL statement or
batch. (Microsoft.SqlServer.ConnectionInfo)
CREATE FILE encountered operating system error 5(Access is denied.)
while attempting to open or create the physical file
'C:\inetpub\wwwroot\EMSApplication\App_Data\ASPNETDB.MDF'. (Microsoft
SQL Server, Error: 5123)
For help, click:
http://go.microsoft.com/fwlink?ProdName=Microsoft+SQL+Server&ProdVer=10.00.5500&EvtSrc=MSSQLServer&EvtID=5123&LinkId=20476
------------------------------ BUTTONS:
OK
By default Microsoft SQL Server Management Studio works against a Parent Instance of SQL Express, not your User Instance. A user instance is a separate instance of the SQL Server Express Database Engine that is generated by a parent instance. User instances allow users who are not administrators on their local computers to attach and connect to SQL Server Express databases. Each instance runs under the security context of the individual user, on a one-instance-per-user basis. Here is a manual from msdn How to connect to a User Instance.
I was able to do that running Management Studio As Administrator.
I had same problem.your .mdf and .ldf files don't have necessary permission.
you should add your windows account in both .mdf and .ldf files and give it full control permission.
Now you can attach your database successfully.