2026-03-12 20:23:15
This commit is contained in:
31
timhall/security/grant_delete.sql
Normal file
31
timhall/security/grant_delete.sql
Normal file
@@ -0,0 +1,31 @@
|
||||
-- -----------------------------------------------------------------------------------
|
||||
-- File Name : https://oracle-base.com/dba/security/grant_delete.sql
|
||||
-- Author : Tim Hall
|
||||
-- Description : Grants delete on current schemas tables to the specified user/role.
|
||||
-- Call Syntax : @grant_delete (schema-name)
|
||||
-- Last Modified: 28/01/2001
|
||||
-- -----------------------------------------------------------------------------------
|
||||
SET PAGESIZE 0
|
||||
SET FEEDBACK OFF
|
||||
SET VERIFY OFF
|
||||
|
||||
SPOOL temp.sql
|
||||
|
||||
SELECT 'GRANT DELETE ON "' || u.table_name || '" TO &1;'
|
||||
FROM user_tables u
|
||||
WHERE NOT EXISTS (SELECT '1'
|
||||
FROM all_tab_privs a
|
||||
WHERE a.grantee = UPPER('&1')
|
||||
AND a.privilege = 'DELETE'
|
||||
AND a.table_name = u.table_name);
|
||||
|
||||
SPOOL OFF
|
||||
|
||||
@temp.sql
|
||||
|
||||
-- Comment out following line to prevent immediate run
|
||||
@temp.sql
|
||||
|
||||
SET PAGESIZE 14
|
||||
SET FEEDBACK ON
|
||||
SET VERIFY ON
|
||||
30
timhall/security/grant_execute.sql
Normal file
30
timhall/security/grant_execute.sql
Normal file
@@ -0,0 +1,30 @@
|
||||
-- -----------------------------------------------------------------------------------
|
||||
-- File Name : https://oracle-base.com/dba/security/grant_execute.sql
|
||||
-- Author : Tim Hall
|
||||
-- Description : Grants execute on current schemas code objects to the specified user/role.
|
||||
-- Call Syntax : @grant_execute (schema-name)
|
||||
-- Last Modified: 28/01/2001
|
||||
-- -----------------------------------------------------------------------------------
|
||||
SET PAGESIZE 0
|
||||
SET FEEDBACK OFF
|
||||
SET VERIFY OFF
|
||||
|
||||
SPOOL temp.sql
|
||||
|
||||
SELECT 'GRANT EXECUTE ON "' || u.object_name || '" TO &1;'
|
||||
FROM user_objects u
|
||||
WHERE u.object_type IN ('PACKAGE','PROCEDURE','FUNCTION')
|
||||
AND NOT EXISTS (SELECT '1'
|
||||
FROM all_tab_privs a
|
||||
WHERE a.grantee = UPPER('&1')
|
||||
AND a.privilege = 'EXECUTE'
|
||||
AND a.table_name = u.object_name);
|
||||
|
||||
SPOOL OFF
|
||||
|
||||
-- Comment out following line to prevent immediate run
|
||||
@temp.sql
|
||||
|
||||
SET PAGESIZE 14
|
||||
SET FEEDBACK ON
|
||||
SET VERIFY ON
|
||||
29
timhall/security/grant_insert.sql
Normal file
29
timhall/security/grant_insert.sql
Normal file
@@ -0,0 +1,29 @@
|
||||
-- -----------------------------------------------------------------------------------
|
||||
-- File Name : https://oracle-base.com/dba/security/grant_insert.sql
|
||||
-- Author : Tim Hall
|
||||
-- Description : Grants insert on current schemas tables to the specified user/role.
|
||||
-- Call Syntax : @grant_insert (schema-name)
|
||||
-- Last Modified: 28/01/2001
|
||||
-- -----------------------------------------------------------------------------------
|
||||
SET PAGESIZE 0
|
||||
SET FEEDBACK OFF
|
||||
SET VERIFY OFF
|
||||
|
||||
SPOOL temp.sql
|
||||
|
||||
SELECT 'GRANT INSERT ON "' || u.table_name || '" TO &1;'
|
||||
FROM user_tables u
|
||||
WHERE NOT EXISTS (SELECT '1'
|
||||
FROM all_tab_privs a
|
||||
WHERE a.grantee = UPPER('&1')
|
||||
AND a.privilege = 'INSERT'
|
||||
AND a.table_name = u.table_name);
|
||||
|
||||
SPOOL OFF
|
||||
|
||||
-- Comment out following line to prevent immediate run
|
||||
@temp.sql
|
||||
|
||||
SET PAGESIZE 14
|
||||
SET FEEDBACK ON
|
||||
SET VERIFY ON
|
||||
30
timhall/security/grant_select.sql
Normal file
30
timhall/security/grant_select.sql
Normal file
@@ -0,0 +1,30 @@
|
||||
-- -----------------------------------------------------------------------------------
|
||||
-- File Name : https://oracle-base.com/dba/security/grant_select.sql
|
||||
-- Author : Tim Hall
|
||||
-- Description : Grants select on current schemas tables, views & sequences to the specified user/role.
|
||||
-- Call Syntax : @grant_select (schema-name)
|
||||
-- Last Modified: 28/01/2001
|
||||
-- -----------------------------------------------------------------------------------
|
||||
SET PAGESIZE 0
|
||||
SET FEEDBACK OFF
|
||||
SET VERIFY OFF
|
||||
|
||||
SPOOL temp.sql
|
||||
|
||||
SELECT 'GRANT SELECT ON "' || u.object_name || '" TO &1;'
|
||||
FROM user_objects u
|
||||
WHERE u.object_type IN ('TABLE','VIEW','SEQUENCE')
|
||||
AND NOT EXISTS (SELECT '1'
|
||||
FROM all_tab_privs a
|
||||
WHERE a.grantee = UPPER('&1')
|
||||
AND a.privilege = 'SELECT'
|
||||
AND a.table_name = u.object_name);
|
||||
|
||||
SPOOL OFF
|
||||
|
||||
-- Comment out following line to prevent immediate run
|
||||
@temp.sql
|
||||
|
||||
SET PAGESIZE 14
|
||||
SET FEEDBACK ON
|
||||
SET VERIFY ON
|
||||
29
timhall/security/grant_update.sql
Normal file
29
timhall/security/grant_update.sql
Normal file
@@ -0,0 +1,29 @@
|
||||
-- -----------------------------------------------------------------------------------
|
||||
-- File Name : https://oracle-base.com/dba/security/grant_update.sql
|
||||
-- Author : Tim Hall
|
||||
-- Description : Grants update on current schemas tables to the specified user/role.
|
||||
-- Call Syntax : @grant_update (schema-name)
|
||||
-- Last Modified: 28/01/2001
|
||||
-- -----------------------------------------------------------------------------------
|
||||
SET PAGESIZE 0
|
||||
SET FEEDBACK OFF
|
||||
SET VERIFY OFF
|
||||
|
||||
SPOOL temp.sql
|
||||
|
||||
SELECT 'GRANT UPDATE ON "' || u.table_name || '" TO &1;'
|
||||
FROM user_tables u
|
||||
WHERE NOT EXISTS (SELECT '1'
|
||||
FROM all_tab_privs a
|
||||
WHERE a.grantee = UPPER('&1')
|
||||
AND a.privilege = 'UPDATE'
|
||||
AND a.table_name = u.table_name);
|
||||
|
||||
SPOOL OFF
|
||||
|
||||
-- Comment out following line to prevent immediate run
|
||||
@temp.sql
|
||||
|
||||
SET PAGESIZE 14
|
||||
SET FEEDBACK ON
|
||||
SET VERIFY ON
|
||||
31
timhall/security/package_synonyms.sql
Normal file
31
timhall/security/package_synonyms.sql
Normal file
@@ -0,0 +1,31 @@
|
||||
-- -----------------------------------------------------------------------------------
|
||||
-- File Name : https://oracle-base.com/dba/security/package_synonyms.sql
|
||||
-- Author : Tim Hall
|
||||
-- Description : Creates synonyms in the current schema for all code objects in the specified schema.
|
||||
-- Call Syntax : @package_synonyms (schema-name)
|
||||
-- Last Modified: 28/01/2001
|
||||
-- -----------------------------------------------------------------------------------
|
||||
SET PAGESIZE 0
|
||||
SET FEEDBACK OFF
|
||||
SET VERIFY OFF
|
||||
|
||||
SPOOL temp.sql
|
||||
|
||||
SELECT 'CREATE SYNONYM "' || a.object_name || '" FOR "' || a.owner || '"."' || a.object_name || '";'
|
||||
FROM all_objects a
|
||||
WHERE a.object_type IN ('PACKAGE','PROCEDURE','FUNCTION')
|
||||
AND a.owner = UPPER('&1')
|
||||
AND NOT EXISTS (SELECT '1'
|
||||
FROM user_synonyms u
|
||||
WHERE u.synonym_name = a.object_name
|
||||
AND u.table_owner = UPPER('&1'));
|
||||
|
||||
|
||||
SPOOL OFF
|
||||
|
||||
-- Comment out following line to prevent immediate run
|
||||
@temp.sql
|
||||
|
||||
SET PAGESIZE 14
|
||||
SET FEEDBACK ON
|
||||
SET VERIFY ON
|
||||
35
timhall/security/schema_write_access.sql
Normal file
35
timhall/security/schema_write_access.sql
Normal file
@@ -0,0 +1,35 @@
|
||||
-- -----------------------------------------------------------------------------------
|
||||
-- File Name : https://oracle-base.com/dba/security/schema_write_access.sql
|
||||
-- Author : Tim Hall
|
||||
-- Description : Displays the users with write access to a specified schema.
|
||||
-- Requirements : Access to the DBA views.
|
||||
-- Call Syntax : @schema_write_access.sql (schema-name)
|
||||
-- Last Modified: 05-MAY-2012
|
||||
-- -----------------------------------------------------------------------------------
|
||||
|
||||
set verify off
|
||||
|
||||
-- Direct grants
|
||||
select distinct grantee
|
||||
from dba_tab_privs
|
||||
where privilege in ('INSERT', 'UPDATE', 'DELETE')
|
||||
and owner = upper('&1')
|
||||
union
|
||||
-- Grants via a role
|
||||
select distinct grantee
|
||||
from dba_role_privs
|
||||
join dba_users on grantee = username
|
||||
where granted_role IN (select distinct role
|
||||
from role_tab_privs
|
||||
where privilege in ('INSERT', 'UPDATE', 'DELETE')
|
||||
and owner = upper('&1')
|
||||
union
|
||||
select distinct role
|
||||
from role_sys_privs
|
||||
where privilege in ('INSERT ANY TABLE', 'UPDATE ANY TABLE', 'DELETE ANY TABLE'))
|
||||
union
|
||||
-- Access via ANY sys privileges
|
||||
select distinct grantee
|
||||
from dba_sys_privs
|
||||
join dba_users on grantee = username
|
||||
where privilege in ('INSERT ANY TABLE', 'UPDATE ANY TABLE', 'DELETE ANY TABLE');
|
||||
31
timhall/security/sequence_synonyms.sql
Normal file
31
timhall/security/sequence_synonyms.sql
Normal file
@@ -0,0 +1,31 @@
|
||||
-- -----------------------------------------------------------------------------------
|
||||
-- File Name : https://oracle-base.com/dba/security/sequence_synonyms.sql
|
||||
-- Author : Tim Hall
|
||||
-- Description : Creates synonyms in the current schema for all sequences in the specified schema.
|
||||
-- Call Syntax : @sequence_synonyms (schema-name)
|
||||
-- Last Modified: 28/01/2001
|
||||
-- -----------------------------------------------------------------------------------
|
||||
SET PAGESIZE 0
|
||||
SET FEEDBACK OFF
|
||||
SET VERIFY OFF
|
||||
|
||||
SPOOL temp.sql
|
||||
|
||||
SELECT 'CREATE SYNONYM "' || a.object_name || '" FOR "' || a.owner || '"."' || a.object_name || '";'
|
||||
FROM all_objects a
|
||||
WHERE a.object_type = 'SEQUENCE'
|
||||
AND a.owner = UPPER('&1')
|
||||
AND NOT EXISTS (SELECT '1'
|
||||
FROM user_synonyms a1
|
||||
WHERE a1.synonym_name = a.object_name
|
||||
AND a1.table_owner = UPPER('&1'));
|
||||
|
||||
|
||||
SPOOL OFF
|
||||
|
||||
-- Comment out following line to prevent immediate run
|
||||
@temp.sql
|
||||
|
||||
SET PAGESIZE 14
|
||||
SET FEEDBACK ON
|
||||
SET VERIFY ON
|
||||
29
timhall/security/table_synonyms.sql
Normal file
29
timhall/security/table_synonyms.sql
Normal file
@@ -0,0 +1,29 @@
|
||||
-- -----------------------------------------------------------------------------------
|
||||
-- File Name : https://oracle-base.com/dba/security/table_synonyms.sql
|
||||
-- Author : Tim Hall
|
||||
-- Description : Creates synonyms in the current schema for all tables in the specified schema.
|
||||
-- Call Syntax : @table_synonyms (schema-name)
|
||||
-- Last Modified: 28/01/2001
|
||||
-- -----------------------------------------------------------------------------------
|
||||
SET PAGESIZE 0
|
||||
SET FEEDBACK OFF
|
||||
SET VERIFY OFF
|
||||
|
||||
SPOOL temp.sql
|
||||
|
||||
SELECT 'CREATE SYNONYM "' || a.table_name || '" FOR "' || a.owner || '"."' || a.table_name || '";'
|
||||
FROM all_tables a
|
||||
WHERE NOT EXISTS (SELECT '1'
|
||||
FROM user_synonyms u
|
||||
WHERE u.synonym_name = a.table_name
|
||||
AND u.table_owner = UPPER('&1'))
|
||||
AND a.owner = UPPER('&1');
|
||||
|
||||
SPOOL OFF
|
||||
|
||||
-- Comment out following line to prevent immediate run
|
||||
@temp.sql
|
||||
|
||||
SET PAGESIZE 14
|
||||
SET FEEDBACK ON
|
||||
SET VERIFY ON
|
||||
29
timhall/security/view_synonyms.sql
Normal file
29
timhall/security/view_synonyms.sql
Normal file
@@ -0,0 +1,29 @@
|
||||
-- -----------------------------------------------------------------------------------
|
||||
-- File Name : https://oracle-base.com/dba/security/view_synonyms.sql
|
||||
-- Author : Tim Hall
|
||||
-- Description : Creates synonyms in the current schema for all views in the specified schema.
|
||||
-- Call Syntax : @view_synonyms (schema-name)
|
||||
-- Last Modified: 28/01/2001
|
||||
-- -----------------------------------------------------------------------------------
|
||||
SET PAGESIZE 0
|
||||
SET FEEDBACK OFF
|
||||
SET VERIFY OFF
|
||||
|
||||
SPOOL temp.sql
|
||||
|
||||
SELECT 'CREATE SYNONYM "' || a.view_name || '" FOR "' || a.owner || '"."' || a.view_name || '";'
|
||||
FROM all_views a
|
||||
WHERE a.owner = UPPER('&1')
|
||||
AND NOT EXISTS (SELECT '1'
|
||||
FROM user_synonyms u
|
||||
WHERE u.synonym_name = a.view_name
|
||||
AND u.table_owner = UPPER('&1'));
|
||||
|
||||
SPOOL OFF
|
||||
|
||||
-- Comment out following line to prevent immediate run
|
||||
@temp.sql
|
||||
|
||||
SET PAGESIZE 14
|
||||
SET FEEDBACK ON
|
||||
SET VERIFY ON
|
||||
Reference in New Issue
Block a user