Skip to content

Instantly share code, notes, and snippets.

@informz
Last active August 29, 2015 14:23
Show Gist options
  • Save informz/88160681d0061f1e521f to your computer and use it in GitHub Desktop.
Save informz/88160681d0061f1e521f to your computer and use it in GitHub Desktop.
GRANTS AND SYNONYMS
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