sql*plus copy command + pl/sql 的事务问题

[复制链接]
查看11 | 回复8 | 2011-1-25 15:42:33 | 显示全部楼层 |阅读模式
现将历史数据从生产库迁移到备用库,并删除生产库的历史数据
[php]
spool log.txt;
select to_char(sysdate, 'yyyy-mm-dd HH24:MI:SS') from dual;
copy from user/pwd@product to user/pwd@history appenda using select * from a where a_datewhenever sqlerror exit
SQL> select to_char(sysdate, 'yyyy-mm-dd HH24:MI:SS') from dual;
copy from user/pwd@product to user/pwd@history appenda using select * from a where a_date
Array fetch/bind size is 15. (arraysize is 15)
Will commit when done. (copycommit is 0)
Maximum long size is 80. (long is 80)
ERROR:
ORA-12154: TNS:could not resolve service name
[/php]
try"php" instead of "code"
回复

使用道具 举报

千问 | 2011-1-25 15:42:33 | 显示全部楼层
加上'whenever sqlerror exit'后, 对copy from不起作用
回复

使用道具 举报

千问 | 2011-1-25 15:42:33 | 显示全部楼层
3年前也遇到这个问题,没有解决
回复

使用道具 举报

千问 | 2011-1-25 15:42:33 | 显示全部楼层
有没有办法在pl/sql中调用sqlplus command
回复

使用道具 举报

千问 | 2011-1-25 15:42:33 | 显示全部楼层
关注
回复

使用道具 举报

千问 | 2011-1-25 15:42:33 | 显示全部楼层
现改用database links代替copy command
回复

使用道具 举报

千问 | 2011-1-25 15:42:33 | 显示全部楼层
sqlplus 支持copycommit,在大数据量复制的性能上还是比dblink强
有利有弊啊
回复

使用道具 举报

千问 | 2011-1-25 15:42:33 | 显示全部楼层
在sqlplus中使用 wheneversqlerrorexit(放在脚本前面)就跳出sqlplus了啊
os error 就是 whenever oserrorexit
回复

使用道具 举报

千问 | 2011-1-25 15:42:33 | 显示全部楼层
最初由 biti_rainy 发布
[B]在sqlplus中使用 wheneversqlerrorexit(放在脚本前面)就跳出sqlplus了啊
os error 就是 whenever oserrorexit [/B]

whenever sqlerror exit对copy command无效

最初由 Shahand 发布
[B]sqlplus 支持copycommit[/B]

1. db_a的数据迁移到db_b
2. 删除db_a的数据
虽然copycommit=0, 出错时没有迁移数据, 但在sqlplus中会继续运行删除db_a的数据
现在用job每天晚上自动迁移数据, 所以dblink可以满足要求
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

主题

0

回帖

4882万

积分

论坛元老

Rank: 8Rank: 8

积分
48824836
热门排行