Directory Objects
Create
CREATE OR REPLACE DIRECTORY <DirectoryObjectName> AS '<PathToDirectory>';
CREATE OR REPLACE DIRECTORY datapump AS '/u02/exports'; GRANT read,write ON DIRECTORY datapump TO system; GRANT read,write,execute ON DIRECTORY reports TO scott;
It is routine when creating a Directory Object to grant privileges to it at that time.
Display
COL owner FORMAT a15 COL directory_name FORMAT a20 COL directory_path FORMAT a60 COL origin_con_id FORMAT 999 SELECT * FROM dba_directories;
Drop
DROP DIRECTORY <DirectoryObjectName>;
DROP DIRECTORY datapump;
Example Sessions
-- RAC Node to Samba Example linux> mkdir /mnt/winsmb01_apps linux> mount -t cifs -o username=oraclesvc,password=MyStrongPW!,domain=MyCompany, uid=oracle,gid=asmadmin //winsmb01/apps/ /mnt/winsmb01_apps/ 🠊 Above done on all RAC nodes. SQLPLUS> CREATE OR REPLACE DIRECTORY winsmb01 AS '/mnt/winsmb01_apps'; SQLPLUS> GRANT read,write ON DIRECTORY winsmb01 TO system; SQLPLUS> GRANT read,write,execute ON DIRECTORY winsmb01 TO scott; -- NFS Example linux> mkdir /u03 linux> sNfsSrv_IP="10.4.0.15"; linux> sNfsSrv_ExpStr="$sNfsSrv_IP:/u01"; linux> sNfsOptions="-o rw,bg,hard,nointr,rsize=32768,wsize=32768,tcp,actimeo=0, vers=3,timeo=600"; linux> sLocalDir="/u03"; linux> mount -t nfs $sNfsOptions $sNfsSrv_ExpStr $sLocalDir SQLPLUS> CREATE OR REPLACE DIRECTORY lnxsrv01_u03 AS '/u03'; SQLPLUS> GRANT read,write ON DIRECTORY lnxsrv01_u03 TO system; SQLPLUS> GRANT read,write,execute ON DIRECTORY lnxsrv01_u03 TO scott; 🠊 The IP is used instead of the hostname (lnxsrv01) when mounting as that tends to be more stable with NFS.