Query to view who has privilige on the table.
SELECT *
FROM sys.all_tab_privs
WHERE table_name ='EMP';
Query to view role priviliges.
select * from ROLE_SYS_PRIVS
where role='ADMIN_SROLE';
select * from dba_ROLE_PRIVS
where granted_role='ADMIN_SROLE';
SELECT * FROM role_role_privs
WHERE ROLE='ADMIN_SROLE';
---GET PACKAGE TEXT
SELECT TEXT
FROM ALL_SOURCE
WHERE name ='PACK_USER_MGMT'
AND TYPE='PACKAGE BODY';
select owner, name, type
from dba_dependencies
where referenced_name = 'PACK_USER_MGMT' and referenced_type = 'SYNONYM';
SELECT synonym_name, table_owner, table_name FROM all_synonyms
where table_name='PACK_USER_MGMT';
---------------------------------------------------------
--2--- ---- TO VIEW REFERENCE TABLES AND COLUMS
----------------------------------------------------------
SELECT uc.constraint_name constraint_source,ucc1.TABLE_NAME||'.'||ucc1.column_name constraint_source_TABLE_COL
, 'REFERENCES'||CHR(10)
|| '('||UCC2.TABLE_NAME||'.'||UCC2.COLUMN_NAME||')' REFERENCES_COLUMN
FROM dba_constraints uc
, DBA_CONS_COLUMNS UCC1
, dba_cons_columns ucc2
WHERE uc.constraint_name = ucc1.constraint_name
AND UC.R_CONSTRAINT_NAME = UCC2.CONSTRAINT_NAME
--AND uc.constraint_type = 'R'
AND uc.constraint_name = UPPER('FK_RESERVOIR_SK_3');
------------------------------------------
--2--- ---- TO VIEW REFERENCE TABLES AND COLUMS
-----------------------------------------
select b.owner child_own, b.table_name child_tab, b.column_name CHILDCOL,
B.POSITION,
c.owner parent_own,c.table_name parent_tab, c.column_name PARENTCOL,
a.constraint_name,
a.delete_rule,
b.table_name bt,
b.owner bo
from all_cons_columns b,
all_cons_columns c,
all_constraints a
where b.constraint_name = a.constraint_name
and a.owner = b.owner
and b.position = c.position
and c.constraint_name = a.r_constraint_name
and c.owner = a.r_owner
AND A.CONSTRAINT_TYPE = 'R'
--and c.owner like case when upper('&OWNER_NAME') is null then '%' else upper('&OWNER_NAME') end
--and c.table_name like case when upper('CURVE_MNEMONIC_GROUP_MEMBER') is null then '%' else upper('CURVE_MNEMONIC_GROUP_MEMBER') end--parent table
AND B.TABLE_NAME LIKE CASE WHEN UPPER('CURVE_MNEMONIC_GROUP_MEMBER') IS NULL THEN '%' ELSE UPPER('CURVE_MNEMONIC_GROUP_MEMBER') END--child table
ORDER BY 7,6,4,2;
No comments:
Post a Comment