Database is Inaccessible

This is a discussion on Database is Inaccessible within the sqlserver-programming forums in Microsoft SQL Server category; Using SQL Express 2005 SP2. The call “Database.Size” (using SQL Server Manager Objects - SMO) is called approximately every 15 seconds which worked fine. After computer sits for a few days eventually will get message: “Database 'MyDatabaseName' cannot be opened due to inaccessible files or insufficient memory or disk space. See the SQL Server errorlog for details.” Error# 945 Looked at the server log and found nothing that helped. The .mdf and .ldf related files were on the hard drive. All of the SQL permissions were fine. Using SQL Server Manager Studio Express the database name appears in the tree ...

Go Back   Database Forum > Microsoft SQL Server > sqlserver-programming

Database Forums

Register FAQ Calendar Search Today's Posts Mark Forums Read
  #1  
Old 08-27-2008, 04:37 PM
Default Database is Inaccessible

Using SQL Express 2005 SP2.
The call “Database.Size” (using SQL Server Manager Objects - SMO) is called
approximately every 15 seconds which worked fine.

After computer sits for a few days eventually will get message:
“Database 'MyDatabaseName' cannot be opened due to inaccessible files or
insufficient memory or disk space. See the SQL Server errorlog for details.”
Error# 945

Looked at the server log and found nothing that helped.
The .mdf and .ldf related files were on the hard drive.
All of the SQL permissions were fine.
Using SQL Server Manager Studio Express the database name appears in the
tree view however there was no expansion plus sign next to it and no other
icons next to it. Right clicking on the database caused the above error to
appear.

Does anyone know what would cause this error to occur?

Reply With Quote
  #2  
Old 08-27-2008, 04:39 PM
Default Re: Database is Inaccessible

It could be that the autoclose option has been set for this Database. Try turning
it off and see if the problem persists.

--
Tom

----------------------------------------------------
Thomas A. Moreau, BSc, PhD, MCSE, MCDBA, MCITP, MCTS
SQL Server MVP
Toronto, ON Canada
https://mvp.support.microsoft.com/profile/Tom.Moreau


"Scott" wrote in message
news:BE2E1891-99E3-4C48-9236-D11318E6D691-at-microsoft.com...
Using SQL Express 2005 SP2.
The call “Database.Size” (using SQL Server Manager Objects - SMO) is called
approximately every 15 seconds which worked fine.

After computer sits for a few days eventually will get message:
“Database 'MyDatabaseName' cannot be opened due to inaccessible files or
insufficient memory or disk space. See the SQL Server errorlog for
details.”
Error# 945

Looked at the server log and found nothing that helped.
The .mdf and .ldf related files were on the hard drive.
All of the SQL permissions were fine.
Using SQL Server Manager Studio Express the database name appears in the
tree view however there was no expansion plus sign next to it and no other
icons next to it. Right clicking on the database caused the above error to
appear.

Does anyone know what would cause this error to occur?

Reply With Quote
  #3  
Old 08-28-2008, 09:43 AM
Default Re: Database is Inaccessible

Thanks for the response.
I haven't yet implemented disabling the auto close. I am waiting for the
problem to occur again and to then use an application that will read the
status of the database to see what mode it is in.

More information:
Noticed that other databases which were also idle were not in the same state
as the one that appeared to be "locked up".
Also after either re-starting the sql server service or re-booting the
computer the database would then be accessible.

"Tom Moreau" wrote:

> It could be that the autoclose option has been set for this Database. Try turning
> it off and see if the problem persists.
>
> --
> Tom

Reply With Quote
  #4  
Old 09-08-2008, 10:06 AM
Default Re: Database is Inaccessible

Hi Tom,

The Inaccessible error has re-surfaced.
I did not set the Database AutoClose option.
However the database status was: "RecoveryPending, Shutdown"
At this point I had an application that set thet database to online (see
code snippet below):
Server srv = new Server("localhost\SQLExpress");
Database Database = srv.Databases["MyDatabaseName"];
Database.SetOnline();

After running the above the database returned and was accessible.
Is this still due to the AutoClose option or is there something else that is
causing the to occur?
Note that other databases were not in the state of "RecoveryPending".

"Tom Moreau" wrote:

> It could be that the autoclose option has been set for this Database. Try turning
> it off and see if the problem persists.
>
> --
> Tom
>
> ----------------------------------------------------
> Thomas A. Moreau, BSc, PhD, MCSE, MCDBA, MCITP, MCTS
> SQL Server MVP
> Toronto, ON Canada
> https://mvp.support.microsoft.com/profile/Tom.Moreau
>
>

Reply With Quote
  #5  
Old 09-11-2008, 06:24 PM
Default Re: Database is Inaccessible

Can you run:

sp_helpdb 'MyDatabaseName'

I'd like to see if the AutoClose option has been set for that Database. By
running your script, that would bring it back online. If the AutoClose
option is on, then we need to turn it off. If it is already on, then there
must be some process that is simply taking it offline for whatever reason.

--
Tom

----------------------------------------------------
Thomas A. Moreau, BSc, PhD, MCSE, MCDBA, MCITP, MCTS
SQL Server MVP
Toronto, ON Canada
https://mvp.support.microsoft.com/profile/Tom.Moreau


"Scott" wrote in message
news:C1C0EDDC-F99A-413A-9D86-CA9433697638-at-microsoft.com...
Hi Tom,

The Inaccessible error has re-surfaced.
I did not set the Database AutoClose option.
However the database status was: "RecoveryPending, Shutdown"
At this point I had an application that set thet database to online (see
code snippet below):
Server srv = new Server("localhost\SQLExpress");
Database Database = srv.Databases["MyDatabaseName"];
Database.SetOnline();

After running the above the database returned and was accessible.
Is this still due to the AutoClose option or is there something else that is
causing the to occur?
Note that other databases were not in the state of "RecoveryPending".

"Tom Moreau" wrote:

> It could be that the autoclose option has been set for this Database. Try
> turning
> it off and see if the problem persists.
>
> --
> Tom
>
> ----------------------------------------------------
> Thomas A. Moreau, BSc, PhD, MCSE, MCDBA, MCITP, MCTS
> SQL Server MVP
> Toronto, ON Canada
> https://mvp.support.microsoft.com/profile/Tom.Moreau
>
>


Reply With Quote
Reply


Thread Tools
Display Modes



All times are GMT -4. The time now is 07:35 PM.


Powered by vBulletin® Version 3.6.8
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Integrated by bbpixel2008 :: jvbPlugin R1013.368.1

Search Engine Friendly URLs by vBSEO 3.1.0
vB Ad Management by =RedTyger=
In an effort to better serve ads to our visitors, cookies are used on Mydatabasesupport.com. For more information, check out our Privacy Policy.