cancel
Showing results for 
Search instead for 
Did you mean: 

SQL query Server: Msg 4064, Level 16 State 1 .....

Former Member
0 Kudos

Dear All.

I deatached the EBW database four days back and tried to attach the Prd server database, Now

When I try to connect my sql Query receive a below error message

Unable to connect to server ... Server: Msg 4064, Level 16 State 1 .....

I tried to connect the server

C:\>osql -E 
Cannot open user default database. Login failed.

But I was able to connect via

C:\>isql -E
Msg 4062, Level 11, State 1, Server OPKVG03W, Line 0
Cannot open user default database. Using master database instead.

Please let me know how to fix this issue.

Thanks

Malai

Accepted Solutions (1)

Accepted Solutions (1)

clas_hortien
Active Contributor
0 Kudos

Hi,

once you are connected eg. via

osql -E -dmaster

you have to change the default database of the windows login you are using (eg. ebwadm) with

exec sp_defaultdb 'domain\ebwadm','master'

go

Then you can login via the Management Studio again.

Best regards

Clas

Former Member
0 Kudos

Dear Clas,

Thank you very much. now able to connect the Database . when i Login Windows server via ebwadm user.

Sql vertion is : SQL2000./ Windows 2003 server

C:\>osql -E -d master

1> exec sp_defaultdb 'Domain\ebwadm','master'

2> go

Default database changed.

1>

Please let me know is there anything i have to do to connect the DB via administrator user..

Thanks

Elumalai

clas_hortien
Active Contributor
0 Kudos

Hi,

if you have the same problem with the administrator login, you can do the same for it (changing default db).

Run

osql -E -d master

exec sp_defaultdb 'Domain\administrator','master'

go

If the administrator login is not created or the BUILTIN\Administrators group was delete, you have to recreate it, using the SQL Management Studio. What exactly is the error when you try to login with the administrator ?

Best regards

Clas

Former Member
0 Kudos

Dear Clas,

I ran the above for administrator Too below. Now I am able to connect administrator user too.

C:\>osql -E -d master

1> exec sp_defaultdb 'domain\Administrator','master'

2> go

Default database changed.

1>

I will give you the full point..

My Sql verition is sql 2000. I donot have SQL Management Studio.

Please let me why this problem occurrd for me. This is rehearsal I am doing currently. My company curious abour go live.

Thanks

Malai

Former Member
0 Kudos

You can't simply attach database from other server and work with it in SAP.

Try to read many notes and System copy guides for your release ....

Note 151603 - Copying an SQL Server database

Note 683447 - SAP Tools for MS SQL Server

Note 1420452 - FAQ: Restore and recovery with MS SQL Server

Regards.

clas_hortien
Active Contributor
0 Kudos

Hello,

every login has a default database, were it is going connected to when it logs on.

The problem occurs if this database is no longer existing / accessible. As you detached

the EWP database the database was no longer there. By changing the default database to

master, you were able to logon again. The default database of the ewpadm or administrator

will not affect the SAP system. This problem occurs quite often on customer systems (even I

forget from time to time to change the default database before detaching).

Best regards

Clas

Answers (0)