Failed to generate user instance in SQL Server 2012 - sql

I am using .mdf file for connectivity, when I select it it generates error:
Failed to generate user instance in SQL Server due to failure in starting the process for the user instance
I have attached image to make it clear to you.
http://i.stack.imgur.com/B1ae2.png
Can anyone answer my question.
Thank you!!

Try following steps :
Stop all user instance processes of SQL Server running under your local account (open up task manager and look for sqlsrv.exe process and end it)
Delete all files in the %LOCALAPPDATA%\Microsoft\Microsoft SQL Server Data\SQLEXPRESS folder
F5 again
The problem is known issue. SQL Server Express cannot create a user instance using the set of engine files in your local app data folder, deleting them should allow SQL Server to recreate them with the correct credentials for you to F5 successfully.

Related

SQL server : mapping network drive - Insufficient system resources exist to complete the requested service

Hello I am trying to create a new plan on SQL server to backup all my database.
My goal is to backup them to a network drive thus if I do have some trouble with my server, I will be able to restore databases to other server thanks to backup present in the network drive.
When my plan is executed, I do have some error so I try to execute manually the relative query.
After some investigation, it seems even net use command doesn't work (whereas it is working and I do it from cmd)
EXEC XP_CMDSHELL 'net use Z: \\ServerName\loggin/user:loggin password'
error is
System error 1450 has occurred. Insufficient system resources exist to complete the requested service.
Beside, I do have another server where it is working so I suppose some configuration missing but can't find them
as my network drive is also accessible via FTP, I chose this way to make the job : create a batch file that run winscp and use this batch file in a SQL agent job . I need to add right to batch file to SQL Server agent account. I also need to define a credential and a proxy to be used in the job.

creation name SSIS.Replacement task is not registered with your computer

When i tried to run the .dtsx file i got the following error
The task with the name "some task" and the creation name
"SSIS.ReplacementTask" is not registered for use on this computer
I change the logon to network serivce of Sql Integeration service fron SQL server configuration but still m getting this error please help
Try this.
When you use username and password to log on to your computer, sql server need to verify the user who authorized to use the sql server service.. But sometimes sql server cannot redirect to the account, so we need to configure the user.
Here's the step :
1. open sql server configuration mangager
2. choose sql server 2005 services
3. right click sql server integration services, choose properties
4. choose log on tab, select this account, enter your username and password which is used to log on your computer.
5. reopen the business intelligence studio. There you are, the task component can work properly again.
It also might be that this is a custom component which is not installed at your global assembly cache (in case you are not running it at the server to which it was originally deployed).

SQL Server Database is not getting attached again

I tried to detach my SQL Server 2008 R2 database for creating a duplicate of it, meanwhile connections to that database were active from Visual Studio (2010). So SQL Server denied to detach. After closing Visual Studio, I tried again and my database was successfully detached.
After detaching my database I tried to copy both files (.mdf and .ldf) to another folder as a duplicate copy, but I could not do so because I was getting error that says
You require permission from the computer administrator to make changes to this file
I am using Windows 7 and my account is Administrator. I also tried to attach my database again to SQL Server (running it with administrator permission) but I got the following error:
Failed to retrieve data for this request. (Microsoft.SqlServer.Management.Sdk.Sfc)
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 phyical file'C:/Mywor/MyDataBase.mdf'.
(Microsoft SQL Server, Error: 5123)
Please help me if someone know how to handle this problem.
Here are couple things you can try:
Stop SQL Server service and see if you can copy files (to stop SQL service go to SQL Server Configuration manager)
Try to copy some other database files in that directory and see if that works (make sure permissions for both files are exactly the same)
Try to copy .mdf and .ldf files in original SQL Server data directory (you can find it in SSMS -> Instance properties ->Database Settings
If you’re not using windows explorer for copying files make sure you run it as admin (right click -> Run as administrator)
This is a permissions issue on the database files directory, or the files themselves. Just because you're logged on as an administrator doesn't mean that Windows 7 allows you to do anything you want without whinging at you first. Also, the SQL Server service account may not have the appropriate permissions on the file/folder.

Cannot start LocalDB

Cannot start LocalDB instance, I have installed and re-installed over and over.
Keep getting this error :
Start of LocalDB instance "v11.0" failed because of the following error:
Error occurred during LocalDB instance startup: SQL Server process failed to start.
Anyone any advice ? ?
Microsoft SQL Server 2012, i have ensured the FULL installation options, stopped all services SQL related and tried restarting .
sqllocaldb info
gives me :
Projects
v11.0
when i try
sqllocaldb start v11.0
I get the above error.
When all else fails and you don't care about data loss, delete and recreate your LocalDB\v11.0 database! At the command prompt
sqllocaldb delete v11.0
sqllocaldb create v11.0
(Sqllocaldb is in your PATH right? It was for me.)
I was getting a similar error, but when running
sqllocaldb start
The local db started successfully. Also when checking the event log I saw an error along the lines of
Windows API call WaitForMultipleObjects returned error code: 575
What fixed it for me:
In IIS, configure the app pool to run under an account with permissions to the DB on the server (advanced options of the app pool)
In the advanced option of the app pool, set Load User Profile to true
Reference: http://blogs.msdn.com/b/sqlexpress/archive/2011/12/09/using-localdb-with-full-iis-part-1-user-profile.aspx
It worths looking at LocalDB log files too, it is more detailed than event log:
%LocalAppData%\Microsoft\Microsoft SQL Server Local DB\Instances\ProjectsV12\error.log
Besides recreating the instance I had to delete the content of this folder:
%LocalAppData%\Microsoft\VisualStudio\SSDT\
This is where I have the mdf and ldf files.
My solution:
Go to: %LocalAppData%\Microsoft\Microsoft SQL Server Local DB\ and allow total control of the folder "Instances" to everyone group.
I know this is not OK but it solved my problem and i don't really care about the data of that folder as this is a developing and testing computer.
Same problem here. Here's how I fixed it using bits of the other solutions posted here.
I had dozens of these errors in the application event log:
Windows API call WaitForMultipleObjects returned error code: 575. Windows system error message is: {Application Error}
The application was unable to start correctly (0x%lx). Click OK to close the application.
Reported at line: 3730.
I realized that I had SQL Server Management Studio installed on my development machine, but no other SQL components. I installed the database engine, shared components, and localdb from SQL Express
https://www.microsoft.com/en-us/cloud-platform/sql-server-editions-express
After installing, I still get the same error in event log :(
Found this article:
Cannot start LocalDB
Run the following in cmd to get the localdb instance name:
C:> sqllocaldb info
In my install, I had:
MSSQLLocalDB
ProjectsV13
I ran the following to delete the instances:
sqllocaldb delete MSSQLLocalDB
sqllocaldb delete ProjectsV13
I ran into issues trying to delete/create these (sqllocaldb delete MSSQLLocalDB). I ended up deleting all of the folders and files under '%LocalAppData%\Microsoft\Microsoft SQL Server Local DB\Instances*' (You need to stop SQL Server and kill all sqlserver processes)
Then running 'sqllocaldb create' created and started the default instance and all files.
Had this issue suddenly too but saw nothing weird in logs. Was able to get it running by running the following in an administrator command prompt:
sqllocaldb start
I had this issue. I was trying to use Windows Authentication through an application, but the IIS App Pool credentials were wrong. I was using my Windows user name (ie: NETWORK\name) as my identity, but I changed it to the built-in "LocalSystem" and it worked.
You should check the Event Log for additional information.
Product Name
SQL Server
Product Version
11.0
Product Build Number
Event ID
266
Event Source
SQL Server Local Database Runtime 11.0
Component
Local Database Runtime API
Message Text
Error occurred during Local Database instance startup: SQL Server
process failed to start.
Explanation
A SQL Server process is started but SQL Server startup failed.
User Action
See the event log for details.
Source: http://msdn.microsoft.com/en-us/library/hh256140.aspx
What worked for me was the local IIS application pool I was using was the ApplicationPoolIdentity and that did not have permission to login to MSSQLLocalDB. As soon as a I changed the app pool identity to my windows login account - I was able to connect ok.
Had this issue on Windows 10 when our application was run with compatibility for Windows 8 enabled. Turning off the compatibility setting fixed it.
Before you try something drastic:
After waiting for about 5 minutes it "healed" itself.
(May be this is what this log message is pointing at: "The RANU instance is terminating in response to its internal time out")
I can not yet comment posts here but I really want to give a hint for the in my case extremely helpful post https://stackoverflow.com/a/30298863/8015089 above:
If your LocalDB instance is run by the Windows SYSTEM user (as in my case) the path to error.log is this (MS SQL Server 2012 Express LocalDB on Win11): C:\Windows\System32\config\systemprofile\AppData\Local\Microsoft\Microsoft SQL Server Local DB\Instances\<InstanceName> (enter this path subfolder by subfolder to avoid access problems!)

SQL Server Express unable to attach or delete mdf file

My database file Whist.mdf was attached to a SQL Server Express through Management Studio, but it stopped working in that sense that NHibernate in my asp.net solution fired some connection exceptions. I just detached it from Management Studio because I couldn't open the database in there either.
But when I try to reattach it I get this error:
Attach database failed for Server 'MyPCName\SQLECPRESS'. (Microsoft.SqlServer.Smo) Unable to open the physical file "C:\Program
Files\Microsoft SQL Server\MSSQL10.SQLEXPRESS\MSSQL\DATA\Whist.mdf".
Operating system error 32: "32(process cannot access the file because
it is being used by another process)". (Microsoft SQL Server, Error:
5120)
I have googled it but can't find a solution that works for me. E.g.:
http://www.byteblocks.com/post/2010/01/06/Unable-to-open-the-physical-file-Microsoft-SQL-Server.aspx
"Cannot open user default database. Login failed." after installing SQL Server Management Studio Express
There is something about User Instance but I cant figure out if it have anything to do with that:
http://blogs.msdn.com/b/sqlexpress/archive/2006/11/22/connecting-to-sql-express-user-instances-in-management-studio.aspx
I have tried to delete the mdf file in windows but I can't do that either:
The action can't be completed because the file is open in system
I have tried stopping the SQL Server process, closing explore and delete from cmd and rebooting...
Hope someone can help - I guess it is just a simple thing..
I think you are on the right track. The error messages you are getting indicate that some SQL Server process is keeping the database file open. And SQL Server is designed to only allow the database file to be open by a single SQL Server process at a time.
You are also probably right to suspect User Instance of SQL Server Express to be the guilty process here. User Instance is a special SQL Server process that doesn't run as a service and instead is started and owned by the application that tries to connect to it. In your case there are two User Instances that can be the problem, one owned by the ASP.NET application you mentioned and one owned by you and started by Visual Studio. If you are using IIS Express or you configured the IIS App Pool for the ASP.NET application to run as your account then we only have one User Instance to worry about.
My recommendation is that you don't use User Instances and don't try to connect directly to the database file. Go over your connection strings and remove User Instance=true from all of them. You want to remove AttachDBFilename=... property as well.
If the database file is added to any of your Visual Studio solutions remove it (just be careful not to delete the file itself). The last step is to remove any connections to the database file from your Data Connections node in the Server Explorer.
Then restart the machine to make sure any User Instances that were running in the background were shutdown. After the machine starts again you should be able to attach the database file back to your main SQL Server Express using SQL Server Management studio. Let's name the database Whist
To connect to your database use the following connection string:
Data Source=.\SQLExpress;Integrated Security=true;Initial Catalog=Whist
When you connect from the ASP.NET application, make sure that you have created an account in your SQL Server Express for the application.
Turned out to be an issue with Daemon tools for me as well associating the .mdf file as an image.
If you want to copy your .mdf and .ldf file from your database, you can set your database file to 'offline' first . Please follow this steps:
Open your SQL Server 2008(suppose you are using SQL Server 2008 ).
Select your Database that you want to copy then left click.
Go to Tasks -> Take Offline.
Right click.
Then you can copy this database file to any folders.