Thursday, December 24, 2009

How to change permissions of Unix directory using SQL*Plus


  1. Under /oracle/scripts/general directory create chmod_exp.sh script:

    #!/bin/csh
    chmod -fR 777 /gibuy/export
    exit;


    And give it execute privileges:

    oracle@ayevenunxdev1:/oracle/scripts/general>chmod +x chmod_exp.sh

    This script changes permissions to all the directories and files under/gibuy/export directory.

  2. Go to SQL*Plus, connect to utils schema and build a scheduler job:

    utils@PINKY> 
     BEGIN
       DBMS_SCHEDULER.CREATE_JOB(  
          job_name            => ‘CHANGE_PERMISSION2EXP’,  
          job_type            => ‘EXECUTABLE’,  
          job_action          => ‘/oracle/scripts/general/chmod_exp.sh’,         
          enabled             => TRUE,
          auto_drop           => FALSE
       );
     END;

  3. That is all. In order to change the permission, run the following line in SQL*Plus:

    utils@PINKY> exec DBMS_SCHEDULER.run_job( ‘CHANGE_PERMISSION2EXP’ );

     

No comments: