如何连接数据库

时间:2015-06-17 06:58:46

标签: oracle shell unix

我想使用Unix shell script连接数据库,但我无法连接

下面提到代码

DB

export ORACLE_HOME="oracle"
value=`/oracle/bin/sqlplus -S user/pwd@SHM4EQ << EOF

SET LINESIZE 300
SET PAGESIZE 300
SET HEADING OFF

SELECT  * form dual

EOF`

1 个答案:

答案 0 :(得分:0)

尝试这样...

#!/bin/bash

LogDirectory='/var/tmp/logs'
DataDirectory='/var/tmp/data'

DBUSER='scott'
DBUSERPASSWORD='tiger'
DBSID='oracle'

sqlplus -s ${DBUSER}/${DBUSERPASSWORD}@${DBSID} <<EOF
set linesize 32767
set feedback off
set heading off

select * from dual;

EOF