title: Writing a file to a custom created directory on Oracle Amazon-RDS
body: <p>I can connect to the database via sqlplus </p>
  
  <pre><code>sqlplus stepdba/&lt;password&gt;@steprds.&lt;rds-hash-here&gt;.&lt;region&gt;.rds.amazonaws.com:1521/STEP
  </code></pre>
  
  <p>and I am trying to write to a file.</p>
  
  <p>According to <a href="http://docs.aws.amazon.com/AmazonRDS/latest/UserGuide/Appendix.Oracle.CommonDBATasks.html" rel="nofollow">AmazonRDS documentation regarding Oracle</a>, create directory must be done with <code>rdsadmin.rdsadmin_util.create_directory('MY_DIR');</code> which I have done.</p>
  
  <p>To write to a file, I do the following:</p>
  
  <pre><code>DECLARE
      fileHandler UTL_FILE.FILE_TYPE;
  BEGIN
     fileHandler := UTL_FILE.FOPEN('MY_DIR', 'test.txt', 'W');
     UTL_FILE.PUTF(fileHandler, 'Writing TO a file\n');
     UTL_FILE.FCLOSE(fileHandler);
  END;
  /
  </code></pre>
  
  <p>Which result in an error:</p>
  
  <pre><code>ERROR at line 1:
  ORA-29283: invalid file operation
  ORA-06512: at "SYS.UTL_FILE", line 536
  ORA-29283: invalid file operation
  ORA-06512: at line 4
  </code></pre>
  
  <p>If I try to write to an Oracle provided directory <code>DATA_PUMP_DIR</code>, the above snippet executes correctly and the file is written.</p>
  
  <p>The privileges to the two directories are the same</p>
  
  <pre><code>select grantee, privilege from dba_tab_privs where table_name='DATA_PUMP_DIR' and grantee = 'STEPDBA';
  select grantee, privilege from dba_tab_privs where table_name='MY_DIR' and grantee = 'STEPDBA';
  </code></pre>
  
  <p>In the Amazon-RDS case, we can not manipulate the file/directory permissions on the OS level.</p>
  
  <p>I seem to be missing something, any hint would be appreciated.</p>