如何在shell中调SQLPLUS 执行SQL语句

如题所述

第1个回答  2017-10-17
1、实例1,获取TABLESPACE_NAME列表
#!/bin/sh
. ~/.bash_profile
sqlplus -s 'user/234256' <<EOF
spool v.txt
set linesize 200
col TABLESPACE_NAME format a50
col file_name format a50
select distinct(TABLESPACE_NAME) from dba_data_files order by TABLESPACE_NAME;
spool off
EOF
2、一句
echo -e "drop table test_BAK purge;"|sqlplus -s 'user/123499'
3、执行sql文件实例
#!/bin/bash
. ~/.bash_profile
sqlplus -s 'user/234256' @~/remove_old_data.sql本回答被提问者采纳

相关了解……

你可能感兴趣的内容

本站内容来自于网友发表,不代表本站立场,仅表示其个人看法,不对其真实性、正确性、有效性作任何的担保
相关事宜请发邮件给我们
© 非常风气网