Tuesday, October 25, 2016

View what grants exist on a table in Oracle

Here's a simple SQL to easily find the grants that are given to a table or view in Oracle with a little extra to grant them again (maybe in other environments or after the need to drop and recreate)

SELECT 'GRANT SELECT ON ' || TABLE_NAME || ' TO ' || GRANTEE || ';', A.*
FROM TABLE_PRIVILEGES A
WHERE TABLE_NAME IN ('PS_PERSONAL_DATA_VW','PS_JOB_VW');

:-)

No comments:

Post a Comment