2026-03-12 20:23:15

This commit is contained in:
root
2026-03-12 21:23:47 +01:00
parent eab4b36eca
commit 93039b8489
3332 changed files with 699614 additions and 0 deletions

View 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

View 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

View 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

View 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

View 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

View 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

View 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');

View 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

View 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

View 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