Friday, February 17, 2012

Error 21776:

I'm doing the following:
use master
exec sp_grantlogin 'DOMAIN\ug_ITSec_SQL'
exec sp_addsrvrolemember 'DOMAIN\ug_ITSec_SQL', 'securityadmin'
Then after, trying to grant that new login db_owner permissions, for
example, by running the following:
use master
go
exec sp_grantdbaccess 'DOMAIN\ug_ITSec_SQL', 'ug_ITSec_SQL'
exec sp_addrolemember 'db_owner','ug_ITSec_SQL'
However, when I then click on the Login and check out the database access, I
get the following strange error:
"Error 21776: [SQL-DMO] The name 'ug_ITSec_SQL' was not found in the Use
rs
collection. If the name is a qualified name use [] to seprate the vario
us
parts of the name, then try again."
However, once I go to the individual database - master in this case, and
click on the User, view it, close it, and go back to the Login... it is all
cleared up. As if clicking and viewing the User in the database cleared
something up?
Anyone ever see this sort of behavior?I think we can forget it - some information is getting cached somewhere,
somehow, but closing and re-launching Enterprise Manager seems to clear it
up.
Now that I've spent a half day scouring the Internet and newsgroups, I can
continue with my script that was working! It was just bothersome that I
couldn't immediately check the properties of the login without getting that
error.
"A McGuire" <allen.mcguire@.gmail.com.invalid> wrote in message
news:uwaWqeatGHA.1888@.TK2MSFTNGP03.phx.gbl...
> I'm doing the following:
> use master
> exec sp_grantlogin 'DOMAIN\ug_ITSec_SQL'
> exec sp_addsrvrolemember 'DOMAIN\ug_ITSec_SQL', 'securityadmin'
> Then after, trying to grant that new login db_owner permissions, for
> example, by running the following:
> use master
> go
> exec sp_grantdbaccess 'DOMAIN\ug_ITSec_SQL', 'ug_ITSec_SQL'
> exec sp_addrolemember 'db_owner','ug_ITSec_SQL'
>
> However, when I then click on the Login and check out the database access,
> I get the following strange error:
> "Error 21776: [SQL-DMO] The name 'ug_ITSec_SQL' was not found in the U
sers
> collection. If the name is a qualified name use [] to seprate the var
ious
> parts of the name, then try again."
> However, once I go to the individual database - master in this case, and
> click on the User, view it, close it, and go back to the Login... it is
> all cleared up. As if clicking and viewing the User in the database
> cleared something up?
> Anyone ever see this sort of behavior?
>|||> Anyone ever see this sort of behavior?
Yes, this is normal. The GUI object browser caches data for performance
reasons. When changes are made externally, you need to manually refresh the
tree by right-clicking and selecting refresh.
Hope this helps.
Dan Guzman
SQL Server MVP
"A McGuire" <allen.mcguire@.gmail.com.invalid> wrote in message
news:uwaWqeatGHA.1888@.TK2MSFTNGP03.phx.gbl...
> I'm doing the following:
> use master
> exec sp_grantlogin 'DOMAIN\ug_ITSec_SQL'
> exec sp_addsrvrolemember 'DOMAIN\ug_ITSec_SQL', 'securityadmin'
> Then after, trying to grant that new login db_owner permissions, for
> example, by running the following:
> use master
> go
> exec sp_grantdbaccess 'DOMAIN\ug_ITSec_SQL', 'ug_ITSec_SQL'
> exec sp_addrolemember 'db_owner','ug_ITSec_SQL'
>
> However, when I then click on the Login and check out the database access,
> I get the following strange error:
> "Error 21776: [SQL-DMO] The name 'ug_ITSec_SQL' was not found in the U
sers
> collection. If the name is a qualified name use [] to seprate the var
ious
> parts of the name, then try again."
> However, once I go to the individual database - master in this case, and
> click on the User, view it, close it, and go back to the Login... it is
> all cleared up. As if clicking and viewing the User in the database
> cleared something up?
> Anyone ever see this sort of behavior?
>

No comments:

Post a Comment