Could you describe your problem it a bit more detail? Are you connecting to the express instance using "user instance=true" in the connection string?
Do logins seem to take longer if the instance is idle some particular amount of time?
Yes, I am connecting using "user instance=true". Using E-Commerce Template on Server2003 Web Edition. Everything works brilliantly except when site has been idle for some time (10 mins at a guess) at which the database server seems to shut down.
The next time a user connects, it takes up to 30 seconds to respond, occasionally returning a timeout error.
EventID 17401 shows up in the logs, source: MSSQL$SQLEXPRESS
"Server resumed execution after being idle xx seconds: user activity awakened the server. This is an informational message only. No user action is required."
After that, it continues to perform very well responding immediately to new connections until the next time it goes to sleep.
Hi Bob,
That's actually the expected behavior of User Instances. Check out the User Instance white paper for more details. In short, a user instance is a separate instance of SQL Express that is started up at runtime. As long as an application is connected to the User Instance, it runs as any other SQL service would. Once all connections have been shut down, the instance will hang around for a short time (about 10 minutes) and then shut down.
It sounds like you probably don't want User Instances, but I'll let you know ahead of time, that this will change some things about your application. If you stop using user instances, you may not want to use AttachDbFilename either, rather you'll want to attach the database to you main instance (probably <machine name>\SQLEXPRESS and then modify your connection string appropriatly to point at the database rather than attach it dynamically. Depending on what exactly you're doing you may need to modify or add some Login and User information to your server as well. User Instances have a special quality of running as the logged in user and giving them certain permissions, so they can access the database. When you move to the main instance, you have to setup security on your server.
Regards,
Mike Wachal
SQL Express team
Hi,
I had the same problem and tried solving it by stopping using User Instance mode and attaching the database to the server in the regular mode. AutoClose is disabled.
Although it doesn't enter "sleep mode" as often as it used to, I'm still receiving the 17401 event notice and it reponses slowly after being idle for some time.
Any advice?
I have re-opened this discussion because it seems that what I had accepted as the answer hasnt cut it for some people.
It begs the question:
Under what circumstances would it be acceptable for the database server to take so long to respond?
I cant think of any.
If this behaviour is by design, then one would have to question the quality of the design.
I don't think people are clear on the difference between User Instances and the main instance of SQL Express.
You will only get a User Instance if you are connecting to SQL Express using a specialized connection string that specifies two things:
The connection string would look something like this:
Data Source=.\SQLEXPRESS; Integrated Security=True;AttachDbFilename=|DataDirectory|\myDatabase.mdf;User Instance=True
This connection string will cause an initial connection to the main instance (.\SQLEXPRESS) and then instruct the main instance to spawn a new instance of SQL Server under the user's context and attach the database specified to that new User Instance. The User Instance is a completely separate running instance of SQL Server form the main instance that is unique to the user and that will be shut down when there are no longer any connections to it.
This is totally different that attaching a database to the main instance, which stays running at all times, unless you've manually shut it down. If your question is about the main instance going into an Idle state, then your question is not unique to SQL Express and you should ask this question in the Database Engine forum. I believe all Editions of SQL Server have an Idle state and the other forum would be where you can find out how to affect that behavior.
The User Instance behavior is by design and it will not be changed for SQL 2005.
Regards,
Mike Wachal
SQL Express team
Also, how can this property be set at the database level (especially if using the VS IDE)? BOL shows how this property can be set at the server level using SSEUtil, but couldnt find about setting at db level.
One more question. Select * from sys.dm_os_child_instances does not return any rows for me. I am using SSEUtil. My application is currently accessing a user interface db & I thought this would list my user instance.
Server resumed execution after being idle 1792 seconds. Reason: timer event.
Server resumed execution after being idle 1406 seconds: user activity awakened the server. This is an informational message only. No user action is required.
Please help!?!
The server being idle isn't an error, it's just a state of the server. It's not clear what problem you're trying to solve here, could you elaborate?
Mike
Not for SQL Express.
You can control whether a database is closed automatcially or not using the 'Auto Close' property (Clever name that...) but the fact that SQL Express scales back it's working set after a period of idle time is not configurable.
If you're application demands high availability in terms of never going idle, you will need to purchase one of the higher Editions of SQL Server.
Mike