Wednesday 13 October 2021

What is directory objects in oracle? How to create a directory object in it.

This document describes about the directory objects, why are we using directory objects, what is the use of directory creation in oracle database and how to create directory in the oracle database.

 

What are directory objects? What is the use of directory objects?

A DIRECTORY object describes a logical alias name for a physical directory which lies on the database server file system under which the files to be accessed are located. We can access the files which are under physical directory by using logical directory if we have privileges. Depends on the privilege(Ex: select, read,write etc...) we can restrict the users to access the objects which are under directory.

We require logical directory to export or import the data in oracle database.

How to create a directory in oracle database?

we can create directory using create directory command. 

Create one physical directory in the system wherever we want.

[oracle@server1 u02]$ mkdir EXPDP_DATA


[oracle@server1 u02]$ cd EXPDP_DATA/


[oracle@server1 EXPDP_DATA]$ pwd
/u02/EXPDP_DATA

Connect as sysdba to the database and create logical directory by using below command.

 

SQL> create directory EXPDP as '/u02/EXPDP_DATA';

Directory created.

SQL>

How to find the information about existing directories in the database?

We can use dba_directories view to find the existing directories in the database.

Ex:

SQL> col OWNER for a10
SQL> col DIRECTORY_NAME for a15
SQL> col DIRECTORY_PATH for a30
SQL> set lines 200
SQL> select OWNER,DIRECTORY_NAME,DIRECTORY_PATH from dba_directories;

SQL> select OWNER,DIRECTORY_NAME,DIRECTORY_PATH from dba_directories where directory_name='EXPDP';

OWNER       DIRECTORY_NAME    DIRECTORY_PATH
----------         ---------------                    ------------------------------
SYS                EXPDP                          /u02/EXPDP_DATA
 
SQL>


 


 

Thanks for going through the post.........



No comments:

Post a Comment