oracle 卸载数据,tom的脚本,可以修改一下,做到自己想要的
--1.导出数据
[oracle@localhost ~]$ more flat.sh
#!/bin/sh
if [ "$1" = "" ]
then
cat << EOF
editor: mengl 2016-5-26
usage: flat un/pw [tables|views]
example: flat scott/tiger emp dept
description: Select over standard out all rows of table or view with
columns delimited by tabs.
EOF
exit
fi
PW=$1
shift
for X in $*
do
sqlplus -s $PW << EOF > /tmp/flat$$.sql
set wrap off
set feedback off
set pagesize 0
set verify off
prompt select
select lower(column_name)||'||chr(9)||'
from user_tab_columns
where table_name = upper('$X') and
column_id != (select max(column_id) from user_tab_columns where
table_name = upper('$X'))
order by column_id
/
select lower(column_name)
from user_tab_columns
where table_name = upper('$X') and
column_id = (select max(column_id) from user_tab_columns where
table_name = upper('$X'))
order by column_id
/
prompt from $X
prompt /
prompt exit
exit
EOF
sqlplus -s $PW << EOF
set wrap off
set feedback off
set pagesize 0
set verify off
set trimspool on
set linesize 5000
start /tmp/flat$$.sql
exit
EOF
#rm /tmp/flat$$.sql
done
[oracle@localhost ~]$
--导出数据样例
[oracle@localhost ~]$ ./flat.sh unicomidmp/broadtech ml_2 >1.txt
[oracle@localhost ~]$ more 1.txt
10310305GD-WL-SG-XFX-C类-新丰沙田网格-190236113.88307324.0542671
[oracle@localhost ~]$ --这样,就可以导出文本文件1.txt, 共sqlldr加载。