SQL Server : login success but “The database [dbName] just isn’t available. (ObjectExplorer)”

I will be utilizing windows 8.1 and SQL Server 2012.

An OS was being used by me account “Manoj” for accessing SQL SERVER with windows verification. Not long ago I have actually deleted my individual account “Manoj” of OS and created a account that is new exact same title “Manoj”.

Nevertheless the system took the brand new account as “Manoj_2”. This change keeps me out of accessing the databases that are old We have produced.

The database [dbName] is certainly not available. (ObjectExplorer)

I have created whenever I try to access any of the previous DBs.

We utilized to generate brand new login in SQL Server for “Manoj_2”, with default DB as “master”. But nonetheless the nagging issue continues.

We cannot in a position to detach the DBs. I will be struggling to expand the DBs.

Note: In OS, we have admin liberties for the “Manoj” account.

Please anyone let me know, what direction to go? either with OS or with SQL Server

20 Responses 20

Because of this situation you must hook up to database in Single-User mode.

Beginning SQL Server in single-user mode allows any person in the computer’s neighborhood Administrators team for connecting to your example of SQL Server as a part of this sysadmin fixed host part.

Right here you’ll find step by step instruction to work on this.

In a nutshell the sqlserver must be started by you instance with parameters -m, after begin Sql Server Management Studio with windows verification.

So now you are a sysadmin, assign the sysadmin part to your individual, exit and take away the -m parameter and restart sql server.

The issue is that the consumer when you look at the database is an “orphan”. Which means that there is absolutely no login id or password linked to the individual. It is real even though there was a login id that fits the consumer, while there is a GUID (called a SID in Microsoft-speak) that features to match also.

This was once a pain to correct, but currently (SQL Server 2000, SP3) there is a retained procedure that does the heavy-lifting.

Each one of these guidelines is done as a database admin, aided by the database that is restored.

MaturesForFuck match

First, make sure here is the issue. This may lists the orphaned users:

In the event that you currently have a login id and password with this user, correct it by doing:

Should you want to produce a brand new login id and password with this user, repair it by doing:

Really stupid solution but we’ll include it right here in the event anybody gets right here from a Bing search.

We’d simply restarted the SQL solution and had been getting this mistake as well as in my instance, simply waiting ten minutes ended up being sufficient plus it had been fine once again. Tends this is actually the mistake you will get if it is simply setting up.

It’s this that led us to this issue and just how I fixed it:

Restored my database to a different SQL host example from a .bak file, including a user that is preexisting.

Tried to access the restored database from my application as always with the connection that is same but updated host example.

Deleted individual because the DBowner, then readded with exact credentials that are same mappings, login, etc.

Surely could login whilst the individual after readding the consumer following the restore.

This is certainly triggered if the individual’s standard database is scheduled to a database they do not have permissions or its offline .

Just you will need to re include a look is had by the user.Pleae right here too.

This fixed it in my situation:

If you work with Sql Management Studio, simply begin it as Administrator.

Right click->Run since Administrator

We experienced a problem that is similar operating several jobs of bulk insert through a Python script on a different device and an independent individual through the one I am signing directly into SSMS.

It would appear that in the event that Python kernel (or maybe any kind of connection) is interrupted in the center of a bulk insert task without correctly ‘cleaning up’ the mess, some sort of hanging linked to individual qualifications and hair can happen from the SQL Server part. Neither restarting the service nor the machine that is whole for me personally.

The answer within my situation would be to take the DB offline and on the web. When you look at the SQL Server Management Studio, that is a right simply click on DB > tasks > take offline after which right click DB > tasks > bring on the web.