分享

Oracle数据库导出大字段(CLOB)数据

 168一路发 2011-05-04

导出CLOB的几个SQL语句:

1.导出含有大字段数据的M条记录

exp user/passwd statistics=none compress=n consistent=y file=/oradata/info/backup/exp_article.dmp log=/oradata/info/backup/exp_article.log tables=fsm_right_article query=\"where rownum\<=10\"

2. 导出指定记录记录

exp user/passwd statistics=none compress=n consistent=y file=/oradata/info/backup/exp_article.dmp log=/oradata/info/backup/exp_article.log tables=fsm_right_article query=\"where recordid=n\"

3。 先将表按主键字段排序,然后取第1行到第2400行的记录

exp user/passwd statistics=none compress=n file=/oradata/info/backup/article/article_$i.dmp log=/oradata/info/backup/article/article_$i.log consistent=y tables=fsm_right_article query=\"where articleid in \(select articleid from \(select rownum as r_n\, article\.articleid from \(select articleid from fsm_right_article order by articleid desc\) article where rownum \<= 2400\) where r_n \> 0\)\"

 

编写一个shell脚本,循环执行导出2400条记录的命令,导出表的全部记录


 

vi /oradata/info/backup/scrips/exp_article.sh

 


 

#!/bin/bash

export ORACLE_BASE=/oracle/app/oracle

export ORACLE_HOME=/oracle/app/oracle/product/10.2.0/db_1

export NLS_LANG=AMERICAN_AMERICA.ZHS16GBK

export ORACLE_SID=info

export PATH=/oracle/app/oracle/product/10.2.0/db_1/bin:$PATH:$HOME/bin

 

count=220979

i=0

step=2400

 

while [ $i -le $count ]

do

 

exp user/passwd statistics=none compress=n file=/oradata/info/backup/article/article_$i.dmp log=/oradata/info/backup/article/article_$i.log consistent=y tables=fsm_right_article query=\"where articleid in \(select articleid from \(select rownum as r_n\, article\.articleid from \(select articleid from couser\.fsm_right_article order by articleid desc\) article where rownum \<= $i+$step\) where r_n \> $i\)\"

 

i=`expr $i + $step`

file=`expr $file + 1`

 

done

    本站是提供个人知识管理的网络存储空间,所有内容均由用户发布,不代表本站观点。请注意甄别内容中的联系方式、诱导购买等信息,谨防诈骗。如发现有害或侵权内容,请点击一键举报。
    转藏 分享 献花(0

    0条评论

    发表

    请遵守用户 评论公约

    类似文章 更多