Shell script to GG

Source: Internet
Author: User

==================================================#!/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

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.