Last active
August 29, 2015 14:23
-
-
Save informz/88160681d0061f1e521f to your computer and use it in GitHub Desktop.
GRANTS AND SYNONYMS
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
SELECT 'REVOKE ' | |
|| privilege | |
|| ' ON "' | |
|| table_name | |
|| '" TO ' | |
|| grantee | |
|| CASE | |
WHEN grantable = 'YES' | |
THEN ' WITH GRANT OPTION;' | |
ELSE ';' | |
END | |
FROM user_tab_privs | |
WHERE table_name IN ( | |
SELECT object_name | |
FROM all_objects | |
where owner = 'RMIXDBO' | |
and created > to_date( '2015-05-26','YYYY-MM-DD') | |
); | |
SELECT 'GRANT ' | |
|| privilege | |
|| ' ON "' | |
|| table_name | |
|| '" TO ' | |
|| grantee | |
|| CASE | |
WHEN grantable = 'YES' | |
THEN ' WITH GRANT OPTION;' | |
ELSE ';' | |
END | |
FROM user_tab_privs | |
WHERE table_name IN ( | |
SELECT object_name | |
FROM all_objects | |
where owner = 'RMIXDBO' | |
and created > to_date( '2015-05-26','YYYY-MM-DD') | |
); | |
SELECT 'CREATE OR REPLACE SYNONYM ' | |
|| 'RMIX_GUSER.' || object_name | |
|| ' FOR ' | |
|| owner || '.' || object_name || ';' | |
END | |
FROM all_objects | |
where owner = 'RMIXDBO' | |
and created > to_date( '2015-05-26','YYYY-MM-DD') | |
; | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment