Oracle 将 blob 数据从一个表复制到另一个表
我有一个带有 blob 列的表(超过 1.000.000 行和 60GB 数据)。我想将表的大部分行(不是所有行)移动到另一个表。我尝试 insert into X select from y
命令,但速度太慢。
最快的方法是什么?
我有 Oracle 10 或 11。
I have a table (over 1.000.000 rows and 60GB data) with a blob column. I want to move most of the rows (not all rows) of the table to another table. I tried insert into X select from y
command but it is too slow.
What is the fastest way?
I have Oracle 10 or 11.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
使用 /*+ 追加 */ 提示来传递归档日志
当您使用提示 oracle dosent 创建归档日志时
use /*+ append */ hint to pass archive log
when you use the hint oracle dosent create arcive logs
现在提出建议已经太晚了,但它可能对上述解决方案有所帮助,如果您的新(目标)表具有约束或索引或触发器,那么首先尝试删除/禁用它们,然后加载大量数据,最后创建/启用您的约束、索引和触发器返回并分析您的表索引。仅当您只需复制批量数据一次时,才建议使用这种节省时间的解决方案。因为在表中插入新记录时,DBMS 确保了约束、检查和索引,从而降低了速度
its too late to suggest something, but it may help with above solutions, if your new(target) table has constraints or indexes or triggers, then try to remove/disable them first, then load your bulk of data and finally create/enable your constraints, indexes and triggers back and analyze your table indexes. this time saving solution is only suggested when you only have to replicate your bulk data once. as while inserting new records in table DBMS ensures the constraints, checks and indexes which reduces the speed
好的,我们不了解您的系统,因此很难告诉您太多信息。你的问题实际上取决于你的环境。无论如何,这里有一些测试来显示使用您的方法与其他方法相比所需的时间和资源:
假设您的方法是方法 1,另一个方法是方法 2。
好的,所以我们关心我们测试的两种方法,即
我们得到了自动跟踪答案,而
我们没有得到自动跟踪。
幸运的是,我还运行了 sql_trace,并获得了 TKprof 的统计数据。
这就是我得到的:
对于“insert into t (select * from u);”:
对于“create table t as (select * from u)”,我们得到:
那么这告诉我们什么?
出色地:
-方法 2 比方法 1 花费的总时间大约减少 65%(对于 100 万行,减少了整整 5 秒)
-方法 2 总体上比方法 1 花费的 CPU 时间少了约 48%
- 方法 2 比方法 1 解析的磁盘略多
- 方法 2 检索到的缓冲区比方法 1 少很多,
希望这对您有帮助:)
Ok, so we don't know your system so it's hard to tell you much. Your question really depends on your environment. Regardless, here are some tests anyways to show the time and resources it takes to use your method versus another method:
Let's say your method is method 1 and the other method is method 2.
Ok, so we care about the two methods we tested i.e.
which we get an autotrace answer for and
which we do not get an autotrace for.
Fortunately I also ran sql_trace and I picked up a TKprof of stats.
This is what I get:
for "insert into t (select * from u);":
and for "create table t as (select * from u)" we get:
So what does this tell us?
well:
-Method 2 took about 65% less overall time than method 1 (a whole 5 seconds less for 1 million rows)
-Method 2 took about 48% less CPU time overall than method 1
-Slightly more disk was parsed with method 2 than method 1
-a lot less buffers were retrieved for method 2 than for method 1
hope this helps you :)