set echo off
--
-- showobject_privs.sql
--
-- Privileges - Show all privileges for a specific object:
-- 1. Roles granted
-- 2. System privileges granted
-- 3. Object privileges granted
-- Usage: @Showobject_privs object_name
-- @a\Showobject_privs employee
--
set echo on
set pagesize 30
--
define lsize=200
set linesize &&lsize
--
-- roles granted
--select * from DBA_ROLE_PRIVS where grantee = upper('&&1');
-- system privileges granted
--select * from DBA_SYS_PRIVS where grantee = upper('&&1');
-- object privileges granted
select 'grant '||privilege||' on '||owner||'.'||table_name||' to '||grantee||';'
from DBA_TAB_PRIVS
where table_name = upper('&&1');
select 'grant '||privilege||'('||column_name||') on '||owner||'.'||table_name||' to '||grantee||';'
from DBA_COL_PRIVS
where table_name = upper('&&1');
select *
from DBA_TAB_PRIVS
where table_name = upper('&&1');
select *
from DBA_COL_PRIVS
where table_name = upper('&&1');
select *
from user_TAB_PRIVS_made
where table_name = upper('&&1');
select *
from user_col_PRIVS_made
where table_name = upper('&&1');
/*
desc DBA_ROLE_PRIVS
desc DBA_SYS_PRIVS
desc DBA_TAB_PRIVS
------------------------------- -------- ----
GRANTEE NOT NULL VARCHAR2(30)
OWNER NOT NULL VARCHAR2(30)
TABLE_NAME NOT NULL VARCHAR2(30)
GRANTOR NOT NULL VARCHAR2(30)
PRIVILEGE NOT NULL VARCHAR2(40)
GRANTABLE VARCHAR2(3)
SQL>
SQL> select * from dba_tab_privs where owner = 'xxx' and table_name like '%SEQ%';
*/
|