Thursday, October 17, 2019

Create Directory in Oracle

Create directory path using unix terminal

[oracle@ODIGettingStarted ~]$ pwd
/home/oracle
[oracle@ODIGettingStarted ~]$ su
Password:
[root@ODIGettingStarted oracle]# pwd
/home/oracle
[root@ODIGettingStarted oracle]# cd /
[root@ODIGettingStarted /]# pwd
/
[root@ODIGettingStarted /]# ls
bin  boot  cgroup  dev  etc  home  lib  lib64  lost+found  media  misc  mnt  net  ODIshared  opt  proc  root  sbin  selinux  srv  sys  tmp  u01  usr  var
[root@ODIGettingStarted /]# mkdir u05
[root@ODIGettingStarted /]# cd u05
[root@ODIGettingStarted u05]# mkdir ftp
[root@ODIGettingStarted u05]# cd ftp
[root@ODIGettingStarted ftp]# mkdir ouappprd
[root@ODIGettingStarted ftp]# cd ouappprd
[root@ODIGettingStarted ouappprd]# mkdir ocp
[root@ODIGettingStarted ouappprd]# cd ocp
[root@ODIGettingStarted ocp]# mkdir dat_cdd
[root@ODIGettingStarted ocp]# cd dat_cdd
[root@ODIGettingStarted dat_cdd]# pwd
/u05/ftp/ouappprd/ocp/dat_cdd
[root@ODIGettingStarted dat_cdd]# cd ..
[root@ODIGettingStarted ocp]# ls -ltr
total 16
drwxr-xr-x. 2 root root 4096 Oct 17 07:07 dat_cdd
[root@ODIGettingStarted ocp]# chmod 777 dat_cdd
[root@ODIGettingStarted ocp]# ls -ltr
total 16
drwxrwxrwx. 2 root root 4096 Oct 17 07:07 dat_cdd
[root@ODIGettingStarted ocp]#


Create a Oracle directory and giving read/write permissions to scott user:

[oracle@ODIGettingStarted ocp]$ sqlplus sys as sysdba

SQL*Plus: Release 11.2.0.4.0 Production on Thu Oct 17 06:45:41 2019

Copyright (c) 1982, 2013, Oracle.  All rights reserved.

Enter password:

Connected to:
Oracle Database 11g Enterprise Edition Release 11.2.0.4.0 - 64bit Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options

SQL> CREATE OR REPLACE DIRECTORY DIR_CDD AS '/u05/ftp/ouappprd/ocp/dat_cdd';

Directory created.

SQL> GRANT READ,WRITE ON DIRECTORY DIR_CDD TO SCOTT;

Grant succeeded.

SQL> SET LINES 150
SQL> COLUMN OWNER FORMAT A20
SQL> COLUMN DIRECTORY_NAME FORMAT A20
SQL> COLUMN DIRECTORY_PATH FORMAT A50
SQL> SELECT * FROM DBA_DIRECTORIES WHERE DIRECTORY_NAME='DIR_CDD';

OWNER      DIRECTORY_NAME   DIRECTORY_PATH
-------------------- -------------------- --------------------------------------------------
SYS      DIR_CDD   /u05/ftp/ouappprd/ocp/dat_cdd

SQL>


Verifying Directory Details from scott user:

[oracle@ODIGettingStarted ~]$ sqlplus scott/tiger

SQL*Plus: Release 11.2.0.4.0 Production on Thu Oct 17 06:46:13 2019

Copyright (c) 1982, 2013, Oracle.  All rights reserved.


Connected to:
Oracle Database 11g Enterprise Edition Release 11.2.0.4.0 - 64bit Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options

SQL> SET LINES 150
SQL> COLUMN OWNER FORMAT A20
SQL> COLUMN DIRECTORY_NAME FORMAT A20
SQL> COLUMN DIRECTORY_PATH FORMAT A50
SQL> SELECT * FROM ALL_DIRECTORIES WHERE DIRECTORY_NAME='DIR_CDD';

OWNER      DIRECTORY_NAME   DIRECTORY_PATH
-------------------- -------------------- --------------------------------------------------
SYS      DIR_CDD   /u05/ftp/ouappprd/ocp/dat_cdd

SQL>

No comments:

Post a Comment

Delete Row Button to all records of Interactive Report in Oracle Apex

 1. add 'Delete' Del column to Report Query 2. Set the Following Properties for the DEL Column Type: Link Heading: Delete Targ...