Sqlplus里如何调用Shell脚本?待整理

来源:互联网 发布:最专业的网络推广价格 编辑:程序博客网 时间:2024/06/06 07:21

自己封装的一个shell脚本,关键是如何调用呢?求助!

#!/bin/sh function createOracleInstance(){    tableSpace=$1    tempTableSpace=${tableSpace}"_temp"    dataTableSpace=${tableSpace}"_data"    user=$2    pwd=$3    #临时表空间    create temporary tablespace ${tempTableSpace}    tempfile '/u01/datas/${tempTableSpace}.dbf'    size 50m    autoextend on    next 50m maxsize 20480m    extent management local;    #创建数据表空间    create tablespace ${dataTableSpace}    logging    datafile '/u01/datas/${dataTableSpace}.dbf'    size 50m    autoextend on    next 50m maxsize 20480m    extent management local;    #创建用户    create user ${user}      identified by "${pwd}"      default tablespace ${dataTableSpace}      temporary tablespace ${tempTableSpace}      profile DEFAULT;    grant connect to ${user};    grant dba to ${user};    grant exp_full_database to ${user};    grant imp_full_database to ${user};    grant resource to ${user};    grant unlimited tablespace to ${user};    echo "临时表空间名为${tempTableSpace},数据表空间为 ${dataTableSpace},用户名:${user},密码:${pwd}"}sqlplus / as sysdbacreateOracleInstance $1 $2 $3

因为有sqlplus / as sysdba等命令,后面调用语句被中断了,是不是有新窗口进入导致的,如果去掉sqlplus / as sysdba,手工执行该命令后进入sql命令行,又该如何调用Shell脚本呢?