Oracle数据库备份与恢复(2):SQL*Loader(3)
exit 0
fi
##准备工作
echo "set heading off " >/tmp/$1.col
echo "set pagesize 0" >>/tmp/$1.col
echo "set linesize 800 " >>/tmp/$1.col
echo "set feedback off " >>/tmp/$1.col
echo "set tab off " >>/tmp/$1.col
echo "select column_name||, from user_tab_columns where lower(table_name)=$1 order by
column_id; " >> /tmp/$1.col
##产生 select 语句
echo "set heading off " >/tmp/$1.sel
echo "set pagesize 0" >>/tmp/$1.sel
echo "set linesize 800 " >>/tmp/$1.sel
echo "set feedback off " >>/tmp/$1.sel
echo "set tab off " >>/tmp/$1.sel
echo "select " >>/tmp/$1.sel
echo `sqlplus -s $2/$3 < /tmp/$1.col` |sed "s/,/|||||/g" |sed "s/||$//g"|sed "s/date/"date"/g"
>>/tmp/$1.sel
##生成 dat文件
#echo "from $1; /" >>/tmp/$1.sel 由于 / 导致多执行一次 select
echo "from $1; " >>/tmp/$1.sel
sqlplus -s $2/$3 < /tmp/$1.sel >$1_tmp.dat
#awk {if(FNR!=1) print $0} $1_tmp.dat >$1.dat
相关新闻>>
- 发表评论
-
- 最新评论 更多>>