HiveBrain v1.2.0
Get Started
← Back to all entries
debugsqlMinor

Cannot grant, deny, or revoke permissions to sa, dbo, entity owner, information_schema, sys, or yourself

Submitted by: @import:stackexchange-dba··
0
Viewed 0 times
cannotownerpermissionsyourselfgrantinformation_schemarevokedenydbosys

Problem

I encounter the following error:

Cannot grant, deny, or revoke permissions to sa, dbo, entity owner, information_schema, sys, or yourself.


when I was trying these commands

USE ASPState
GO

GRANT EXECUTE ON CreateTempTables TO [R2Server\AAOUser]
GO
GRANT EXECUTE ON DeleteExpiredSessions TO [R2Server\AAOUser]
GO
GRANT EXECUTE ON GetMajorVersion TO [R2Server\AAOUser]
GO
GRANT EXECUTE ON GetHashCode TO [R2Server\AAOUser]
GO
GRANT EXECUTE ON TempGetAppID TO [R2Server\AAOUser]
GO
GRANT EXECUTE ON TempGetStateItem TO [R2Server\AAOUser]
GO
GRANT EXECUTE ON TempGetStateItem2 TO [R2Server\AAOUser]
GO
GRANT EXECUTE ON TempGetStateItem3 TO [R2Server\AAOUser]
GO
GRANT EXECUTE ON TempGetStateItemExclusive TO [R2Server\AAOUser]
GO
GRANT EXECUTE ON TempGetStateItemExclusive2 TO [R2Server\AAOUser]
GO
GRANT EXECUTE ON TempGetStateItemExclusive3 TO [R2Server\AAOUser]
GO
GRANT EXECUTE ON TempGetVersion TO [R2Server\AAOUser]
GO
GRANT EXECUTE ON TempInsertStateItemLong TO [R2Server\AAOUser]
GO
GRANT EXECUTE ON TempInsertStateItemShort TO [R2Server\AAOUser]
GO
GRANT EXECUTE ON TempInsertUninitializedItem TO [R2Server\AAOUser]
GO
GRANT EXECUTE ON TempReleaseStateItemExclusive TO [R2Server\AAOUser]
GO
GRANT EXECUTE ON TempRemoveStateItem TO [R2Server\AAOUser]
GO
GRANT EXECUTE ON TempResetTimeout TO [R2Server\AAOUser]
GO
GRANT EXECUTE ON TempUpdateStateItemLong TO [R2Server\AAOUser]
GO
GRANT EXECUTE ON TempUpdateStateItemLongNullShort TO [R2Server\AAOUser]
GO
GRANT EXECUTE ON TempUpdateStateItemShort TO [R2Server\AAOUser]
GO
GRANT EXECUTE ON TempUpdateStateItemShortNullLong TO [R2Server\AAOUser]
GO


So, how do I know what type of permissions my account R2Server\AAOUser have for the database ASPState? and what are the ways to solve the error (so that I can grant these permissions to my account)?

Solution

As per the comments, if you're already the db owner of that database, than you don't need to grant any permission for the db.

Now, in order to find out what specific permissions you have, you can use the following queries:

-
find permissions on specific db:

USE AdventureWorks2008R2;
SELECT * FROM fn_my_permissions (NULL, 'DATABASE');
GO


-
find permissions on all the server:

SELECT * FROM fn_my_permissions(NULL, 'SERVER');
GO


See some other info here: Find out SQL Server Logins and associated Server Roles, on MSDN forum.

Code Snippets

USE AdventureWorks2008R2;
SELECT * FROM fn_my_permissions (NULL, 'DATABASE');
GO
SELECT * FROM fn_my_permissions(NULL, 'SERVER');
GO

Context

StackExchange Database Administrators Q#35224, answer score: 9

Revisions (0)

No revisions yet.