Monday, March 26, 2012

Failed to generate a user instance of SQL Server due to a failure in starting the process for th

No wonder Microsoft is giving it away for free. It’s not worth anything. I am very disappointed in this version of SQL server. I decided to start learning VB so I downloaded and installed VB 2005 express edition and SQL 2005 express. I tried to build a personal website using the starter kit. I kept getting the following error message, for which I have seen numerous postings on this forum.

“Failed to generate a user instance of SQL Server due to a failure in starting the process for the user instance. The connection will be closed.”

I went out and bought the Standard version of VS 2005 thinking there may be a feature that the free express version is lacking. I uninstalled the express version, cleaned the registry, deleted all the folders it created and installed the Standard edition. Then I tried to create a personal web using the starter kit and it does the same thing again.

I can not create a database file, connect to a database file. I can not create or attach a database on the SQL 2005 express from VS 2005. The SQL server Express seems to be working OK since I can attach to it using Microsoft SQL Server Management Studio Express. There is something about the way VS tries to connect to the database server that is not working. VB does recognize the local computer as a SQL server but can not connect to it.

SQL server is set to accept Shared memory, TCP/IP and named pipes for local clients.

What is causing this?

This is some information on the system I am using:

MS XP (SP2)

Microsoft Visual Studio 2005

Version 8.0.50727.42(RTM.050727-4200)

Microsoft .NET Framework

Version 2.0.50727

Installed Edition: Standard

Microsoft SQL Server Management Studio Express9.00.1399.00

Microsoft Data Access Components (MDAC)2000.085.1117.00 (xpsp_sp2_rtm.040803-2158)

Microsoft MSXML2.6 3.0 4.0 5.0 6.0

Microsoft Internet Explorer6.0.2900.2180

Microsoft .NET Framework2.0.50727.42

Operating System5.1.2600

I am now to programming but nor computer illiterate. I have been working with MS SQL servers since version 6.5 and have MCSE, Network+, A+ and Security plus certifications. Installing and using VS should not be this problematic. What is wrong with Microsoft?

I got this very frustating message everytime I was trying to create a new SQL Express database from VB Express. All forums seem to point to 2 possible resolutions, NONE of which worked for me:

A) Known bug with Windows XP SP2 when using SQL via RDP (Remote Desktop).

B) Delete C:\Documents and Settings\USERNAME\Local Settings\Application Data\Microsoft\Microsoft SQL Server Data\SQLEXPRESS.

The clue for me was all forums relating to solution B seemed to talk about possible authentication problems which gave me a clue. My solution was therefore:

Solution: Modify the SQL Server (SQLExpress) service to use your local or system account and restart the service. This worked for me first time. I'm not sure if this will cause any problems in the future but hey, at least I can now create a database!!

Hope this helps!!

|||

As far as the "Failed to generate a user instances..." error, check out the error log for the user instance, it will likely give you more information about what is happening. You will fine the error log at C:\Documents and Settings\<user name>\Local Settings\Application Data\Microsoft\Microsoft SQL Server Data\SQLEXPRESS.

User Instances are a new feature in SQL Express that have some special characteristics. You may want to read the white paper that discusses them to get some background. Creating a database from within VS is actually different that creating one in SSMSE because you're working against different instances of SQL Express. VS uses User Instances by default, where SSMSE works against the main instance of Express.

Regards,

Mike Wachal
SQL Express team

-
Check out my tips for getting your answer faster and how to ask a good question: http://forums.microsoft.com/MSDN/ShowPost.aspx?PostID=307712&SiteID=1

|||

This error is often caused because the parent instance (for whatever reason) can't copy the system databases to the users local isolated storage folders. Sometimes it is because of a previous install of SQL Express has left files in that directory which is why Reen's suggestion sometimes works

Delete C:\Documents and Settings\USERNAME\Local Settings\Application Data\Microsoft\Microsoft SQL Server Data\SQLEXPRESS.

the only trick is knowing the USERNAME, if your writing a web app, the user is usually ASPNET which is usually found in

C:\Documents and Settings\COMPUTERNAME\USERNAME\Local Settings\Application Data\Microsoft\Microsoft SQL Server Data\SQLEXPRESS

Other times it is a permissions issue which can be solved by giving the SQL service account the necessary permissions.

One thing to remember is that although user instances is the default when working with Visual Studio, it is not mandatory to use them, it is quite possible to attach to databases in the traditional way from SQL Express, to do this you just need to edit the connection string and delete the "user Instance=true". User Instances just make it easier (when it does work) to work with databases as though they were files.

|||

This error is simply ridiculous! Not so much because it occurs a lot but that there is insufficient official documentation about this problem. Worst still you will run into this error if you try and copy the official online VS Express tutorial I found. Worse again, when Microsoft ran a seminar at my University this error occurred and they didn’t even know how to deal with it!

This forum thread right here is by far the best documentation of the problem that I have found so far and it’s not very easy to find or thorough.

|||
There seem to be so many things that cause this user instance error. Currently I think the following explains why I'm getting it today. Next they will tell us that it only works when there is a full moon!

(Note the mention of SSEUtil not working... I think that's quite interesting)

http://forums.microsoft.com/MSDN/ShowPost.aspx?PostID=58741&SiteID=1

I think I found the problem, I was not the first one to use the computer the days with the problem. Even SSEUtil gives the same error. When I switched users to the one that signed on first, SSEUtil worked. I tried signing off of the other computer users and restarting the SQL Server. SSEUtil still could not get the server to respond.

It looks like bottom line....If you need to use a sqldatabase with visual basic 2005 express, make sure you signed on the computer first or reboot before you start or return to your database project.

Mike

|||

The post you reference is from before the final release of SQL, so it's hard to say if the information still applies. Why do you think the above explains your situation? What troubleshooting have you done to check this? Have you checked the error logs for both the main instance and the User Instance?

I'd really like to see actual information about this problem as that is the only way to really understand what is happening.

Regards,

Mike Wachal
SQL Express team

|||

Fair enough.

I am 90% sure that when another account has been logged in before mine this error occurs. I will try generating this error when I have time.

When I checked the error log briefly there did not seem to be any relevant information. Additionally when I generated this error the error log did not update. Implying that this error was not logged or maybe I was looking in the wrong place (not both instances)... again I will have to look into this further when I have more time.

I am using VS2005 (not express edition - thanks to my university) and the version of SQL Server that comes with it (Express).

If you browse the web you will find many different "solutions" to this error... I am happy to help where I can

|||

When I ran into this problem the first time, I uninstalled the SQLExpress and reinstalled it. I could then access the database via the Visual C# 2005 Express Edition.Later, after I used the SQL management console to open and explore the SQL Express, the problem reoccurred.I uninstalled and reinstalled the SQL Express again, and it works again.

I don’t profess to understand why it works this way, but it did.

|||

Apparently you have to be logged in as jking. And you have to have a D: drive.

SQL Express guys, know who that is?

I cannot get the start kits or time tracker kit going. The start kit does not have an aspnet.mdf. The personal.mdf will not attach or allow a login.

I changed the service to login from the local system account, no change.

I opened Personal.mdf in sql management studio and got:

Directory lookup for the file "D:\Documents and Settings\jking\My Documents\Visual Studio 2005\WebSites\WebSite1\App_Data\Personal_log.LDF" failed with the operating system error 21(the device is not ready)... error 5133

Teach me to use jking's code.

|||Login Order Problem Confirmed
Opened VS2005, can refresh database (I am the 1st and only user to log in)… reset computer…

Logged in as user A then switched to user B, opened VS2005, tried to refresh a database…
Timeout Error!
Try again and…
Failed to generate a user instance of SQL Server due to a failure in starting the process for the user instance. The connection will be closed.

Below is the error log. Note that when I generate this error the error log does not get updated so I expect the following to be useless.

Where would I find the ‘main instance’ error log? There is nothing in All Users… not sure where else to look

Anything else?


C:\Documents and Settings\Kevin\Local Settings\Application Data\Microsoft\Microsoft SQL Server Data\SQLEXPRESS\error.log

2006-04-11 15:30:23.40 Server Microsoft SQL Server 2005 - 9.00.1399.06 (Intel X86)
Oct 14 2005 00:33:37
Copyright (c) 1988-2005 Microsoft Corporation
Express Edition on Windows NT 5.1 (Build 2600: Service Pack 2)

2006-04-11 15:30:23.40 Server (c) 2005 Microsoft Corporation.
2006-04-11 15:30:23.40 Server All rights reserved.
2006-04-11 15:30:23.40 Server Server process ID is 2912.
2006-04-11 15:30:23.40 Server Logging SQL Server messages in file 'C:\Documents and Settings\Kevin\Local Settings\Application Data\Microsoft\Microsoft SQL Server Data\SQLEXPRESS\error.log'.
2006-04-11 15:30:23.40 Server Registry startup parameters:
2006-04-11 15:30:23.40 Server -d c:\Program Files\Microsoft SQL Server\MSSQL.1\MSSQL\DATA\master.mdf
2006-04-11 15:30:23.40 Server -e c:\Program Files\Microsoft SQL Server\MSSQL.1\MSSQL\LOG\ERRORLOG
2006-04-11 15:30:23.40 Server -l c:\Program Files\Microsoft SQL Server\MSSQL.1\MSSQL\DATA\mastlog.ldf
2006-04-11 15:30:23.40 Server Command Line Startup Parameters:
2006-04-11 15:30:23.40 Server -d C:\Documents and Settings\Kevin\Local Settings\Application Data\Microsoft\Microsoft SQL Server Data\SQLEXPRESS\master.mdf
2006-04-11 15:30:23.40 Server -l C:\Documents and Settings\Kevin\Local Settings\Application Data\Microsoft\Microsoft SQL Server Data\SQLEXPRESS\mastlog.ldf
2006-04-11 15:30:23.40 Server -e C:\Documents and Settings\Kevin\Local Settings\Application Data\Microsoft\Microsoft SQL Server Data\SQLEXPRESS\error.log
2006-04-11 15:30:23.40 Server -c
2006-04-11 15:30:23.40 Server -S SQLEXPRESS
2006-04-11 15:30:23.40 Server -s AE669D1F-CC06-41
2006-04-11 15:30:23.40 Server -w 60
2006-04-11 15:30:23.42 Server SQL Server is starting at normal priority base (=7). This is an informational message only. No user action is required.
2006-04-11 15:30:23.42 Server Detected 2 CPUs. This is an informational message; no user action is required.
2006-04-11 15:30:23.87 Server Using dynamic lock allocation. Initial allocation of 2500 Lock blocks and 5000 Lock Owner blocks per node. This is an informational message only. No user action is required.
2006-04-11 15:30:23.89 Server Database Mirroring Transport is disabled in the endpoint configuration.
2006-04-11 15:30:23.89 spid4s Starting up database 'master'.
2006-04-11 15:30:23.95 spid4s Recovery is writing a checkpoint in database 'master' (1). This is an informational message only. No user action is required.
2006-04-11 15:30:24.00 spid4s SQL Trace ID 1 was started by login "sa".
2006-04-11 15:30:24.03 spid4s Starting up database 'mssqlsystemresource'.
2006-04-11 15:30:24.20 spid7s Starting up database 'model'.
2006-04-11 15:30:24.20 Server Server local connection provider is ready to accept connection on [ \\.\pipe\AE669D1F-CC06-41\tsql\query ].
2006-04-11 15:30:24.20 Server Dedicated administrator connection support was not started because it is not available on this edition of SQL Server. This is an informational message only. No user action is required.
2006-04-11 15:30:24.21 Server SQL Server is now ready for client connections. This is an informational message; no user action is required.
2006-04-11 15:30:24.21 spid4s Server name is 'KEVINS\AE669D1F-CC06-41'. This is an informational message only. No user action is required.
2006-04-11 15:30:24.29 spid4s Starting up database 'msdb'.
2006-04-11 15:30:24.42 spid7s Clearing tempdb database.
2006-04-11 15:30:24.85 spid7s Starting up database 'tempdb'.
2006-04-11 15:30:24.92 spid4s Recovery is complete. This is an informational message only. No user action is required.
2006-04-11 15:30:24.93 spid10s The Service Broker protocol transport is disabled or not configured.
2006-04-11 15:30:24.93 spid10s The Database Mirroring protocol transport is disabled or not configured.
2006-04-11 15:30:24.95 spid10s Service Broker manager has started.

|||

I just wrote this post on Community Starter Kit personal.mdf, commercedb.mdf and aspnetdb.mdf.

ASP.Net 2.0 Community Starter Kit SQL Express Conversion to SQL 2005

Hope it helps

- Caroline

http://bogartcomputing.com

|||

Make user instance as false. It solves the problem...

Data Source=.\SQLEXPRESS;AttachDbFilename=D:\Test\App_Data\test.mdf;Integrated Security=True;User Instance=false

Hope it helps,

Thanks,

Manoj.

|||

saggimanoj wrote:

Make user instance as false. It solves the problem...

Data Source=.\SQLEXPRESS;AttachDbFilename=D:\Test\App_Data\test.mdf;Integrated Security=True;User Instance=false

Hope it helps,

Thanks,

Manoj.


Doing that caused other problems for me.
|||

Hi all,
I'd like to say I was able to reproduce this behavior, but I cannot - at least not 100%... My error(s) seems to alternate between "Failed to generate..." and "Timeout expired. The timeout period elapsed prior to the completion of the operation or the server is not responding."
However, this all seems to happen when another user has or establishes a local session on the computer. I am running WinXP Pro SP2 w/most recent patches and have Fast User Switching enabled so that my wife and I can still use the machine when the other is not around.
So here's an example. My wife wakes before me and logs onto the machine and checks the weather. She leaves, eats breakfast and heads out the door. 20 minutes later, her session is "suspended" and Windows returns to the Welcome Screen.
After dinner, I log onto the machine to do some coding, keeping her session suspended so that she doesn't loose any work. I fire up VS2k5 and create a new project. I try and create a new database and, depeneding on the type of project (WinForms or Web Site), I either receive one of the "Timeout" or "Failed to generate..." errors. I log off out of frustration.
Right before my wife goes to bed, she checks the weather again and then logs off and closes her session.
I return, just before bed, I log in and try once more to create my database...And it works.
I have a handful of error log files if and 2 screen shots if this information would assist anyone.
Thanks,

No comments:

Post a Comment