Search This Blog

Total Pageviews

Friday 18 November 2016

Oracle datapump Dir & grant Info ....

Oracle datapump Dir & grant Info ....




set heading on linesize 200 pagesize 100 termout on trimout on trimspool on 
col owner            format a10   heading 'Owner'
col directory_name   format a30   heading 'Directory name'
col directory_path   format a90   heading 'Directory path'
select
    owner
  , directory_name
  , directory_path
from  dba_directories
order by owner,directory_name;
clear columns  breaks  computes


create or replace directory data_pump_dir as '<operating_system_path>';

grant read on directory <directory_name> to <schema_name> ;

revoke write on directory <directory_name> from <schema_name> ;


set linesize 200 pagesize 200 
col owner for a10
col privilege for a10
col directory_path for a50
col grantee         for a20 
col directory_name  for a30 
select d.owner, d.directory_name, p.grantee, p.privilege, d.directory_path from dba_directories d, dba_tab_privs p
where d.owner = p.owner
and d.directory_name = p.table_name
order by d.owner, d.directory_name;


col grantor for a20
col grantee for a20
col table_schema for a20
col table_name for a20
col privilege for a10
select grantor, grantee, table_schema, table_name, privilege from all_tab_privs where table_name = 'EMP';



set lines 200
col privilege for a12
col grantee for a25
col owner for a25
select p.grantee, p.privilege, p.owner, d.directory_name from dba_tab_privs p, dba_directories d
WHERE p.table_name=d.directory_name
  and (grantee IN ('TEST', 'PUBLIC')  OR grantee IN (select granted_role from dba_role_privs  where grantee IN ('TEST', 'PUBLIC')))
ORDER BY 4,3,2;



set lines 80  
col privilege for a40  
SELECT grantee, granted_role, default_role  FROM dba_role_privs  
WHERE granted_role IN ('DBA', 'EXP_FULL_DATABASE', 'IMP_FULL_DATABASE')  
ORDER BY 1,2; 


4 comments:

Anuj Singh said...

To drop datapump dir

SQL> drop directory DUMP_DIR;

Directory dropped.

Anuj Singh said...



set pages 2000 linesize 200
column grantee format A25
column owner format A10
column directory_name format A30
column directory_path format A70
column privilege format A11
select grantee, 'N' owner, directory_name, directory_path, privilege
from dba_tab_privs a, dba_directories b
where privilege in ('READ', 'WRITE') and directory_name = table_name
union
select owner grantee, 'Y' owner, directory_name,directory_path, 'READ/WRITE' privilege
from dba_directories;

Anuj Singh said...



select 'df -k '||substr(DIRECTORY_PATH,0,instr(DIRECTORY_PATH,'/',1,2)-1) MTPOINT from dba_directories;

$ df -k | grep -E '/u01|/u02|/utldir|/opt'

Anuj Singh said...


ORIGIN_CON_ID with


set linesize 300 pagesize 300
col OWNER for a30
col DIRECTORY_NAME for a30
col DIRECTORY_PATH for a70
select d.* from dba_directories d
order by 1,2;
col OWNER clear
col DIRECTORY_NAME clear
col DIRECTORY_PATH clear

Oracle DBA

anuj blog Archive