Take the 2-minute tour ×
Database Administrators Stack Exchange is a question and answer site for database professionals who wish to improve their database skills and learn from others in the community. It's 100% free, no registration required.

Trying to connect to SQL Server (SQL Server 2008 R2) installed on Windows Server 2008 R2 results in the following error message (according to ERROLOG):

Error: 18456, Severity: 14, State: 38.

Does anybody have an idea what could be the problem?

share|improve this question
add comment

1 Answer

up vote 1 down vote accepted

This typically means that the database specified in the connection string, in the SSMS dialog's options tab, or the user's default database is offline or otherwise not accessible (it could be restoring, single_user mode, offline, autoclose, etc).

What database are you trying to connect to? Check its status in sys.databases:

SELECT state_desc, user_access_desc, is_auto_close_on, is_in_standby
  FROM sys.databases 
  WHERE name = N'database_name';

If you are not specifying a database, then check the default database for the login:

SELECT default_database_name 
  FROM sys.server_principals
  WHERE name = N'login_name';
share|improve this answer
    
I'm trying to connect to a new database I've created. –  msh Oct 18 '12 at 14:40
    
@msh that's great, you can still check the status of a database, even if it's brand new. Are you connecting as the same user that created the database? If not, have you added permissions so that the other login is allowed to access your new database? Users don't get granted access to new databases by default. –  Aaron Bertrand Oct 18 '12 at 14:43
    
Yes, as the same user, sa user should have all the permissions. –  msh Oct 18 '12 at 14:44
    
@msh so what was the issue? –  Aaron Bertrand Oct 18 '12 at 14:46
    
SSRP were running. After they were stopped, it works. –  msh Oct 18 '12 at 14:48
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.