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

25 篇文章 0 订阅
导出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
原文地址:http://apps.hi.baidu.com/share/detail/32562502
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值