{"id":4123,"date":"2025-06-08T09:06:45","date_gmt":"2025-06-08T09:06:45","guid":{"rendered":"https:\/\/w3buddy.com\/?post_type=cposts&#038;p=4123"},"modified":"2025-06-08T09:09:45","modified_gmt":"2025-06-08T09:09:45","slug":"create-directory","status":"publish","type":"cposts","link":"https:\/\/w3buddy.com\/blog\/notes\/oracle-dba-d2d-tasks\/create-directory\/","title":{"rendered":"Create Directory"},"content":{"rendered":"\n<p class=\"wp-block-paragraph\">Directory objects in Oracle map to physical server paths and are required for file operations like <code>expdp<\/code> \/ <code>impdp<\/code>.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">1. Create Physical Directory on Server<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">Run on: <strong>DB server as oracle user<\/strong><br>Use case: Create a location to store dump\/log files.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code><code># Create physical path\nmkdir -p \/u01\/dpump_dir\n\n# Set proper ownership and permissions\nchown oracle:oinstall \/u01\/dpump_dir\nchmod 755 \/u01\/dpump_dir<\/code><\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">Note: <code>-p<\/code> = create parent directories automatically if they don&#8217;t exist.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">2. Create Directory Object in Database<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">Run in: <strong>SQL*Plus as SYSDBA or privileged user<\/strong><br>Use case: Map DB object to OS directory for Data Pump.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code><code>-- Create DB directory object\nCREATE DIRECTORY DPUMP_DIR AS '\/u01\/dpump_dir';<\/code><\/code><\/pre>\n\n\n\n<h3 class=\"wp-block-heading\">3. Grant Permissions to User<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">Run in: <strong>SQL*Plus<\/strong><br>Use case: Allow user to access directory during export\/import.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code><code>-- Grant directory access to Data Pump user\nGRANT READ, WRITE ON DIRECTORY DPUMP_DIR TO hr;<\/code><\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">You can also grant to multiple users:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code><code>GRANT READ, WRITE ON DIRECTORY DPUMP_DIR TO SYS, PUBLIC;<\/code><\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">\ud83d\udccc <strong>Notes:<\/strong><\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Directory names in Oracle are <strong>case-insensitive<\/strong>, but by convention, keep them <strong>UPPERCASE<\/strong> for clarity.<\/li>\n\n\n\n<li>The <strong>directory path<\/strong> must be on the <strong>database server<\/strong>, not on the client machine.<\/li>\n\n\n\n<li>Users need <strong>two types of permissions<\/strong> to use a directory object successfully:<br>\u2022 <strong>Database permission<\/strong> to access the directory object<br>\u2022 <strong>OS-level read\/write permission<\/strong> on the actual filesystem directory<\/li>\n\n\n\n<li>Common naming conventions: use names like <code>DPDIR<\/code>, <code>EXP_DIR<\/code>, or <code>DPUMP_LOGS<\/code> to keep directory objects consistent and recognizable.<\/li>\n<\/ul>\n","protected":false},"excerpt":{"rendered":"<p>Directory objects in Oracle map to physical server paths and are required for file operations like expdp \/ impdp. 1. Create Physical Directory on Server Run on: DB server as oracle userUse case: Create a location to store dump\/log files. Note: -p = create parent directories automatically if they don&#8217;t exist. 2. Create Directory Object [&hellip;]<\/p>\n","protected":false},"template":"","meta":{"googlesitekit_rrm_CAowu461DA:productID":""},"categories":[952,984],"class_list":["post-4123","cposts","type-cposts","status-publish","hentry","category-notes","category-oracle-dba-d2d-tasks"],"_links":{"self":[{"href":"https:\/\/w3buddy.com\/blog\/wp-json\/wp\/v2\/cposts\/4123","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/w3buddy.com\/blog\/wp-json\/wp\/v2\/cposts"}],"about":[{"href":"https:\/\/w3buddy.com\/blog\/wp-json\/wp\/v2\/types\/cposts"}],"wp:attachment":[{"href":"https:\/\/w3buddy.com\/blog\/wp-json\/wp\/v2\/media?parent=4123"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/w3buddy.com\/blog\/wp-json\/wp\/v2\/categories?post=4123"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}