Friday, February 10, 2012

Can not open user default database.

I deattached my default DB and crashed on reattaching it. I now get the abo
ve error. I am using MS SQL 2000
Any suggestions or advice?
Thanks
ScottHi,
Can you please check whether the database is accessible.
1. Login as SA in query analyzer
2. execute the command
use dbname (replace database name with actual)
3. If you can open the database then no issues, otherwise send the error
you are getting after executing the command.
Thanks
Hari
MCDBA
"Scott Sheen" <anonymous@.discussions.microsoft.com> wrote in message
news:DA63BEEE-BF15-411E-89D1-654B42263897@.microsoft.com...
quote:

> I deattached my default DB and crashed on reattaching it. I now get the

above error. I am using MS SQL 2000
quote:

> Any suggestions or advice?
> Thanks
> Scott
|||I can not login to query analyzer.
Unable to connect to server ...
Server: Msg 4064, Level 16 State 1
Cannot open user default database. Login failed.
This is similiar and related to the error I am getting in enterprise manager
.
A connection could not be established to ...
Reason: Cannot open user default database. login failed..
...
I was coping over a DB file and when I started up the manage I had this erro
r.
I forgot the log file. I restored to my original version of that DB file.
I
then detached that db and tried to reattach the new version of the db (from
a
different PC) which failed and logged me out of the server. I figured that
was
because that DB was my default DB.
Thanks for your help.
Scott
"Hari" <hari_prasad_k@.hotmail.com> wrote:
quote:

>Hi,
>Can you please check whether the database is accessible.
>1. Login as SA in query analyzer
>2. execute the command
> use dbname (replace database name with actual)
>3. If you can open the database then no issues, otherwise send the error
>you are getting after executing the command.
>Thanks
>Hari
>MCDBA
>"Scott Sheen" <anonymous@.discussions.microsoft.com> wrote in message
>news:DA63BEEE-BF15-411E-89D1-654B42263897@.microsoft.com...
>above error. I am using MS SQL 2000
>
|||I do not recommend changing the default database for sysadmins of the very r
eason you see now. The
default database for the user you are logging in as doesn't exist (for some
reason), which mean that
you cannot login! Actually ISQL.EXE and I think OSQL.EXE will let you in, so
use any of these tools
to login and then use sp_defaultdb to change the default database. Or, login
as another login which
work and let that login change the default database for you (that login need
to be sysadmin).
Tibor Karaszi, SQL Server MVP
Archive at: http://groups.google.com/groups?oi=...ls
erver
"Scott Sheen" <sasheen@.oanet.com> wrote in message news:OCbFYSu6DHA.3008@.TK2MSFTNGP09.phx.gbl...[Q
UOTE]
> I can not login to query analyzer.
> Unable to connect to server ...
> Server: Msg 4064, Level 16 State 1
> Cannot open user default database. Login failed.
> This is similiar and related to the error I am getting in enterprise manag
er.
> A connection could not be established to ...
> Reason: Cannot open user default database. login failed..
> ...
> I was coping over a DB file and when I started up the manage I had this er
ror.
> I forgot the log file. I restored to my original version of that DB file.
I
> then detached that db and tried to reattach the new version of the db (fro
m a
> different PC) which failed and logged me out of the server. I figured tha
t was
> because that DB was my default DB.
> Thanks for your help.
> Scott
> "Hari" <hari_prasad_k@.hotmail.com> wrote:
>[/QUOTE]|||Scott
Try give permissions to the def database by using
sp_grantdbaccess [@.loginame =] 'login'
[,[@.name_in_db =] 'name_in_db' [OUTPUT]]
OR
Drop the login and by using sp_addlogin create a new one with default
database access.
For more details please refer to BOL
"Scott Sheen" <sasheen@.oanet.com> wrote in message
news:OCbFYSu6DHA.3008@.TK2MSFTNGP09.phx.gbl...
quote:

> I can not login to query analyzer.
> Unable to connect to server ...
> Server: Msg 4064, Level 16 State 1
> Cannot open user default database. Login failed.
> This is similiar and related to the error I am getting in enterprise

manager.
quote:

> A connection could not be established to ...
> Reason: Cannot open user default database. login failed..
> ...
> I was coping over a DB file and when I started up the manage I had this

error.
quote:

> I forgot the log file. I restored to my original version of that DB file.

I
quote:

> then detached that db and tried to reattach the new version of the db

(from a
quote:

> different PC) which failed and logged me out of the server. I figured

that was
quote:

> because that DB was my default DB.
> Thanks for your help.
> Scott
> "Hari" <hari_prasad_k@.hotmail.com> wrote:
the[QUOTE]
>
|||ok, none of these suggestions are working, as I can not log on to isql or os
ql
either.
I can not seem to recreate a new server and DB either as I get the same erro
r.
Anymore suggestions?
Best Regards,
Scott S.
"Uri Dimant" <urid@.iscar.co.il> wrote:
quote:

>Scott
>Try give permissions to the def database by using
>sp_grantdbaccess [@.loginame =] 'login'
> [,[@.name_in_db =] 'name_in_db' [OUTPUT]]
>OR
> Drop the login and by using sp_addlogin create a new one with default
>database access.
>For more details please refer to BOL
>
>"Scott Sheen" <sasheen@.oanet.com> wrote in message
>news:OCbFYSu6DHA.3008@.TK2MSFTNGP09.phx.gbl...
>manager.
>error.
>I
>(from a
>that was
>the
>
|||Some partial good news.
isql -E
will get me into iSQL. sp_defaultdb ' ...', 'master' will change the defa
ult
DB.
However, in my confusion late night I removed all the dbs under the server t
o
start over.
"Tibor Karaszi" <tibor_please.no.email_karaszi@.hotmail.nomail.com> wrote:
quote:

>I do not recommend changing the default database for sysadmins of the very
>reason you see now. The
>default database for the user you are logging in as doesn't exist (for some
>reason), which mean that
>you cannot login! Actually ISQL.EXE and I think OSQL.EXE will let you in, s
o
>use any of these tools
>to login and then use sp_defaultdb to change the default database. Or, logi
n
>as another login which
>work and let that login change the default database for you (that login nee
d
>to be sysadmin).
>--
>Tibor Karaszi, SQL Server MVP
>Archive at:
>http://groups.google.com/groups?oi=...ublic.sqlserver
>
>"Scott Sheen" <sasheen@.oanet.com> wrote in message
>news:OCbFYSu6DHA.3008@.TK2MSFTNGP09.phx.gbl...
>
|||I fixed the problem. I started isql via isql -E. That logged me on. I the
n
created a new DB, made that the default and all was good.
Scott
quote:

>I deattached my default DB and crashed on reattaching it. I now get the ab
ove
>error. I am using MS SQL 2000
>Any suggestions or advice?
>Thanks
>Scott

No comments:

Post a Comment