| Author |
Topic |
|
obinna
Starting Member
26 Posts |
Posted - 2008-01-15 : 08:52:37
|
| GuysI am currently getting the error Cannot open user default database. Login failed.Login failed for user '<user name>'. (Microsoft SQL Server, Error: 4064)I took a backup of my Production Database but when I try to restore it I get this error. I cant do anything at the moment without getting this error.Can you please help. |
|
|
spirit1
Cybernetic Yak Master
11752 Posts |
Posted - 2008-01-15 : 09:06:17
|
| it looks like your database username isn't mapped to a login_______________________________________________Causing trouble since 1980blog: http://weblogs.sqlteam.com/mladenpSSMS Add-in that does a few things: www.ssmstoolspack.com <- new version out |
 |
|
|
obinna
Starting Member
26 Posts |
Posted - 2008-01-15 : 09:11:27
|
| spirit1 How do I map it please |
 |
|
|
spirit1
Cybernetic Yak Master
11752 Posts |
|
|
obinna
Starting Member
26 Posts |
Posted - 2008-01-15 : 09:41:24
|
| spirit1Many thanks for your constant help, can you please give me an example, not too good with transact sql, do I create or amend an admin account or do I create an account from scratch for this. |
 |
|
|
jackv
Master Smack Fu Yak Hacker
2179 Posts |
Posted - 2008-01-16 : 05:24:36
|
| In the example, outlined above : --Map database user MB-Sales to login MaryB.USE AdventureWorks;GOEXEC sp_change_users_login 'Update_One', 'MB-Sales', 'MaryB';Jack Vamvas--------------------Search IT jobs from multiple sources- http://www.ITjobfeed.com |
 |
|
|
sunsanvin
Master Smack Fu Yak Hacker
1274 Posts |
Posted - 2008-01-16 : 06:44:51
|
| you got the problem because you dropped the default database which is set by you manually.the solution for this is......while connecting window asked to connect,.....there click on options.....now you can find "Connection Properties" tab. there you find connect to database option.there you can type master.now you will be able to connect.after that, you please run sp_defaultdb 'user_name','master'there username should be your connecting name to the server(like sa).that's itVinodEven you learn 1%, Learn it with 100% confidence. |
 |
|
|
obinna
Starting Member
26 Posts |
Posted - 2008-01-16 : 11:26:41
|
| SunsavinMany thanks for this, ill do it nowRegardsO. |
 |
|
|
obinna
Starting Member
26 Posts |
Posted - 2008-01-16 : 11:37:51
|
| SansavinsOrry to be a pin, ive done exactly what u told me 2 do.sp_defaultdb 'sa','master'But still getting the error.RegardsObi |
 |
|
|
spirit1
Cybernetic Yak Master
11752 Posts |
|
|
obinna
Starting Member
26 Posts |
Posted - 2008-01-16 : 12:12:23
|
| Spirit1sqlcmd –E -S InstanceName –d master - mate do u know what the instance name is. |
 |
|
|
spirit1
Cybernetic Yak Master
11752 Posts |
Posted - 2008-01-16 : 12:19:39
|
| it's the name of your sql server instance._______________________________________________Causing trouble since 1980blog: http://weblogs.sqlteam.com/mladenpSSMS Add-in that does a few things: www.ssmstoolspack.com <- new version out |
 |
|
|
sunsanvin
Master Smack Fu Yak Hacker
1274 Posts |
Posted - 2008-01-17 : 04:09:03
|
quote: Originally posted by obinna SansavinsOrry to be a pin, ive done exactly what u told me 2 do.sp_defaultdb 'sa','master'But still getting the error.RegardsObi
what is the error you are getting?VinodEven you learn 1%, Learn it with 100% confidence. |
 |
|
|
|