==================================================#!/bin/bashsqlplus=sqlplus64username=$1psswd=$2filedir=$3[[$ Filedir] | | Filedir= "/sandbox/edf_api_repo_dir" [[-D $filedir]] | | {echo "mkdir $filedir"; mkdir $filedir; chmod 777 $filedir;} [-D $filedir] | | {echo "Cannot create Oracle directory"; exit 1;} [[$username] | | {echo "Where is user name?"; exit 1;} [[$PSSWD] | | Psswd= $username echo "Create user $username identified by $psswd"; Sqlcode= "Connect Sys/[email protected]:1522/xe as SYSDBA; \nset serveroutput on; \ncreate user $username identified by $PSSWD; \ngrant all privileges to $username; \ngrant execute on utl_http to $username; \ngrant execute on Utl_file to $username; \ngrant execute on UTL_SMTP to $username; \ncreate OR REPLACE DIRECTORY edf_api_repo_dir as ' $filedir '; \ndeclare \ Uzer varchar2 (+): = ' $username '; \nbegin\n Uzer: = Upper (Uzer); \ n begin \ Dbms_network_acl_admin.drop_acl (\ n ' utl_http.xml ' \ n); \ n Exception when others then Dbms_output.put_line (SQLERRM); End Dbms_network_acl_admin.create_acl (\ n acl = ' utl_http.xml ', \ n Description = ' http Access ', \ n prin Cipal = Uzer, \ is_grant = true,\n privilege = ' Connect ' \ n); \ n Dbms_network_acl_admin.add_pri Vilege (\ n acl = ' utl_http.xml ', \ n principal = Uzer, \ n is_grant = true,\n privilege = ' resolve ' \ n \ n dbms_network_acl_admin.assign_acl (\ n acl = ' utl_http.xml ', \ n \ host = \ \ n); \ n Dbms_output.put_line (' ACL created '); \nend; \n/\nshow errors; " ECHO-E $sqlcode | $sqlplus/nolog
Shell script to GG