首页 > 应用开发 > IT综合 > shell脚本的一则简单运用案例
因一现网问题需将特定日期内的表日志数据导出供分析,我协助提供了如下的shell脚本:
[@more@]#!/usr/bin/sh
cd /oracle
#create user
sqlplus -s /nolog <
connect portal/portal
drop table op_log_syh;
create table op_log_syh as select * from op_log
where to_char(op_date,'yyyymmdd') in ('20071008','20071009','20071010','20071011');
exit;
EOF
echo 'Geted the need data from table OP_LOG.'
$ORACLE_HOME/bin/exp portal/portal file=/oracle/op_log_syh.dmp tables=op_log_syh consistent=y buffer=50000000 triggers=n statistics=none grants=n log=/oracle/op_log_syh.log
echo 'Completed the export.'
sqlplus -s /nolog <
connect portal/portal
drop table op_log_syh;
exit;
EOF
来自 “ ITPUB博客 ” ,链接:https://blog.itpub.net/38542/viewspace-975984/ ,如需转载,请注明出处,否则将追究法律责任。