sqlplus与shell结合--shell中执行sql脚本。
su - oracle使用oracle 用户执行
[oracle@dba ~]$ cat a.sh
#!/bin/bash
TAB=emp
sqlplus -s scott/tiger << EOF | awk 'NR != 1 && $2 ~ /S.*T/{print $2,$6}'
set head off
set feed off
select * from $TAB;
select * from dept;
exit;
EOF
[oracle@dba ~]$ ./a.sh
SMITH 800
SCOTT 3000
[oracle@dba ~]$