Linux 脚本直接执行Oracle Sqlplus Sql 命令
LINUX下使用脚本直接执行SQLPLUS命令
#!/bin/bash
su - oracle -c "sqlplus -s / as sysdba <<EOF
select * from tab;
exit
EOF" >> 111.txt 2>&1
测试:
在oracle用户下
sqlplus -s scott/tiger@oracle <<EOF
SELECT TABLESPACE_NAME,
TABLESPACE_SIZE/1024/1024/1024 as "TABLESPACE_SIZE(G)",
ALLOCATED_SPACE/1024/1024/1024 as "ALLOCATED_SPACE (G)",
FREE_SPACE/1024/1024/1024 as "FREE_SPACE(G)"
from DBA_TEMP_FREE_SPACE
exit
EOF>> /home/oracle/TEMP_FREE_SPACE_CHECK.txt
目录 返回
首页