January 4, 2012 at 9:05 am
Hey guys . . .
My computer was hit with a virus last week, so I had to wipe the drive and rebuild. I've ben trying to reinstall and rebuild everything that I had before.
One of them is SQL 2008. I'm trying to recreate my staging database environment locally on my machine. I went to the database server, generated a script, and tried to run it locally on my machine.
When I run the script, I get the following when I try to create users (user and schema names changed to protect the innocent):
Msg 15007, Level 16, State 1, Line 2
'UserName' is not a valid login or you do not have permission.
This line is generating the error:
CREATE USER [UserName] FOR LOGIN [UserName] WITH DEFAULT_SCHEMA=[SchemaName]
This is happening regardless of the user name I'm trying to create.
I figure it's a permissions issue somewhere, but I can't figure out where to look. BOL hasn't been very helpful (although I'm still looking).
Can one of you point me in the right direction?
Thanks, guys!
+--------------------------------------------------------------------------------------+
Check out my blog at https://pianorayk.wordpress.com/
January 4, 2012 at 9:10 am
Itβs your own system so I am asking it, Are you not using sa login for running the scripts?
January 4, 2012 at 9:13 am
What are you logged in as? SQL login or windows login? What permissions does that login have?
Does the login 'UserName' exist?
Gail Shaw
Microsoft Certified Master: SQL Server, MVP, M.Sc (Comp Sci)
SQL In The Wild: Discussions on DB performance with occasional diversions into recoverability
January 4, 2012 at 9:15 am
Dev (1/4/2012)
Itβs your own system so I am asking it, Are you not using sa login for running the scripts?
I'm using my Windows login, which should have sa permissions (or so I thought).
I'll give it another shot with the sa login.
+--------------------------------------------------------------------------------------+
Check out my blog at https://pianorayk.wordpress.com/
January 4, 2012 at 9:21 am
Well, I tried it with the sa login. No dice; I'm getting the same thing.
GilaMonster (1/4/2012)
Does the login 'UserName' exist?
No; in fact, I'm trying to create it. This is what's generating the error.
+--------------------------------------------------------------------------------------+
Check out my blog at https://pianorayk.wordpress.com/
January 4, 2012 at 9:28 am
CREATE USER [UserName]
FOR LOGIN [UserName]
WITH DEFAULT_SCHEMA=[SchemaName]
Does the login & schema exist?
January 4, 2012 at 9:33 am
When you rebuilt, and resinstalled, I assume, did you "add Current User" as an administrator? That's easy to miss.
January 4, 2012 at 9:38 am
Steve Jones - SSC Editor (1/4/2012)
When you rebuilt, and resinstalled, I assume, did you "add Current User" as an administrator? That's easy to miss.
Yeah, that I did remember to do.
Dev and Gail pretty much gave it to me -- the login didn't exist. For some reason, I was equating "login" with "user." Oops. :blush:
As always, thanks for your help, guys!
+--------------------------------------------------------------------------------------+
Check out my blog at https://pianorayk.wordpress.com/
January 4, 2012 at 9:40 am
Ray K (1/4/2012)
Well, I tried it with the sa login. No dice; I'm getting the same thing.GilaMonster (1/4/2012)
Does the login 'UserName' exist?No; in fact, I'm trying to create it. This is what's generating the error.
If the login doesn't exist, you'll first need to create it with CREATE LOGIN, then switch to the specific DB and run CREATE USER ... FOR LOGIN ...
Gail Shaw
Microsoft Certified Master: SQL Server, MVP, M.Sc (Comp Sci)
SQL In The Wild: Discussions on DB performance with occasional diversions into recoverability
January 4, 2012 at 9:42 am
Ray K (1/4/2012)
Steve Jones - SSC Editor (1/4/2012)
When you rebuilt, and resinstalled, I assume, did you "add Current User" as an administrator? That's easy to miss.Yeah, that I did remember to do.
Dev and Gail pretty much gave it to me -- the login didn't exist. For some reason, I was equating "login" with "user." Oops. :blush:
As always, thanks for your help, guys!
Sometimes, more often than not, the error message is very clear as to what the underlying issue is π
January 4, 2012 at 9:44 am
Ray K (1/4/2012)
Steve Jones - SSC Editor (1/4/2012)
When you rebuilt, and resinstalled, I assume, did you "add Current User" as an administrator? That's easy to miss.Yeah, that I did remember to do.
Dev and Gail pretty much gave it to me -- the login didn't exist. For some reason, I was equating "login" with "user." Oops. :blush:
As always, thanks for your help, guys!
Attending night calls too often? π
Good to hear that itβs sorted.
January 4, 2012 at 9:47 am
Dev (1/4/2012)
Ray K (1/4/2012)
Steve Jones - SSC Editor (1/4/2012)
When you rebuilt, and resinstalled, I assume, did you "add Current User" as an administrator? That's easy to miss.Yeah, that I did remember to do.
Dev and Gail pretty much gave it to me -- the login didn't exist. For some reason, I was equating "login" with "user." Oops. :blush:
As always, thanks for your help, guys!
Attending night calls too often? π
?????????
January 4, 2012 at 9:47 am
Guess the caffeine didn't kick in. This is one of those days when I wish coffee pots came with octane ratings. π
+--------------------------------------------------------------------------------------+
Check out my blog at https://pianorayk.wordpress.com/
January 4, 2012 at 9:49 am
Ray K (1/4/2012)
Guess the caffeine didn't kick in. This is one of those days when I wish coffee pots came with octane ratings. π
Alcool is very effective as fuel π
January 4, 2012 at 9:50 am
Ray K (1/4/2012)
Guess the caffeine didn't kick in. This is one of those days when I wish coffee pots came with octane ratings. π
LOL... Remi also need it :hehe:
Viewing 15 posts - 1 through 15 (of 23 total)
You must be logged in to reply to this topic. Login to reply