Showing posts with label management. Show all posts
Showing posts with label management. Show all posts

Monday, March 19, 2012

Drop login error

Hi
I am trying to drop a windows login via Management Studio (CTP June) but it comes up with
'Login domain\user' has granted one or more permissions. Revoke the permission before dropping the login (Microsoft SQL Server, Error: 15173)
I cannot see of any permissions that this user has granted. Is there a system view in SQL 2005 which shows permissions this user has granted?
Thanks,
Priyanga

You need to look at the "Security Catalog Views" topic in Books Online. Specifically, take a look at sys.server_permissions and sys.server_principals views to map principal_id of the login you are looking at to the permissions. You can do that at database level as well.

Something along these lines (use this as an idea):

select * from sys.server_permissions
where grantee_principal_id =
(select principal_id from sys.server_principals where name = N'DOMAIN\user')

Alternatively, in Object explorer, you can select Security->Logins->DOMAIN/user, Properties of the login, go Securables and add objects (e.g. server(s)) and this will show you explicit permissions of this login on the object(s). You can revoke there explicit permissions as well.

Then you can also go to the properties of the server in Object Explorer, Permissions and click on the login and click on Effective Permissions. This will show all the permissions for this user based on its role membership and explicitly granted permissions.

HTH,
Boris.

|||

Thanks Boris.

What was causing the issue was that the principal_id (nation\pk0159_a) was linked to grantor_principal_id in the sys.server_permissions as apposed to the grantee_principal_id. The object responsible for this issue was an endpoint. When i dropped the endpoint, i was allowed to drop nation\pk0159_a.

This explains why no objects were showing as being granted permissions by nation\pk0159_a in object explorer in SQL Management Studio.

Cheers,
Priyanga

Friday, March 9, 2012

Drop Database failed as already in use - how do I close existing connections as per Management S

I have some code to delete a database. This allows a user to enum the databases and select one to delete. It the determines the filename, so it can remove the physical files, drops the database and deletes the files. However, it frequently fails saying the database is currently in use....

I noticed the same bahaviour when deleting a database via Management Studio, however checking the box to close active connections does the trick and the db is successfully deleted.

Question: how do I close the active connection in smo ?

Thanks, Nick

Hi,

http://www.sqlserver2005.de/sqlserver2005/MyBlog/tabid/56/EntryID/9/Default.aspx

HTH, Jens K. Suessmeyer.

http://www.sqlserver2005.de

|||Thanks Jens this is really helpful

Wednesday, March 7, 2012

drop and create in the same script in management studio

In SQL 2000, we could generate the drop and create statements for an object
in the same script. I have not been able to do this in management studio. Am
I missing something?
No you aren't missing something the tool is<g>. It was somehow left out but
I suspect we will see it in the next service pack. As of now you can only
choose one or the other but not both.
Andrew J. Kelly SQL MVP
"Quinn" <dellsql@.newsgroups.nospam> wrote in message
news:u4l9AgqLGHA.3104@.TK2MSFTNGP11.phx.gbl...
> In SQL 2000, we could generate the drop and create statements for an
> object in the same script. I have not been able to do this in management
> studio. Am I missing something?
>
|||Quinn wrote:
> In SQL 2000, we could generate the drop and create statements for an
> object in the same script. I have not been able to do this in
> management studio. Am I missing something?
Seems to be a bug as the docs indicate you can do a drop, create, or
drop and create.
David Gugick - SQL Server MVP
Quest Software