大表海量数据的转移及索引创建的记录

本文介绍了一种有效的大表数据迁移策略,通过将数据从生产环境转移到测试环境进行处理,减少了对生产库的影响。具体操作包括使用特定命令导入分区数据及创建局部索引,同时提供了实际操作的时间消耗与处理器摘要信息。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

为了减少对于生产环境的影响,我们将大表的数据分配迁移到测试机上进行处理,然后在转移回生产库。

这将极大的减少对于生产库的影响和冲击,以下是略微记录一下这些转移处理的时间。
使用如下命令来导入一个分区的数据:
nohup time imp sms/sms file=smsmg_p1.dmp fromuser=sms touser=sms buffer=500000000 commit=yes feedback=100000 indexes=no ignore=yes&

通过输出得到如下信息,在一台2CPU 8 Core的Pc Server上,导入这1.3亿左右的数据,花费了109分钟左右的时间:
Import: Release 10.2.0.2.0 - Production on Thu Sep 17 22:00:20 2009

Copyright (c) 1982, 2005, Oracle. All rights reserved.


Connected to: Oracle Database 10g Enterprise Edition Release 10.2.0.2.0 - Production
With the Partitioning, OLAP and Data Mining options

Export file created by EXPORT:V10.02.01 via conventional path

Warning: the objects were exported by SMS, not by you

import done in ZHS16GBK character set and UTF8 NCHAR character set
export server uses AL16UTF16 NCHAR character set (possible ncharset conversion)
. importing SMS's objects into SMS
. . importing partition "SMSMG":"M01"
...........................................................................
...........................................................................
...........................................................................
...........................................................................
...........................................................................
...........................................................................
...........................................................................
...........................................................................
...........................................................................
...........................................................................
...........................................................................
...........................................................................
...........................................................................
...........................................................................
...........................................................................
...........................................................................
...........................................................................
...........................................................................
.....
135587487 rows imported

IMP-00057: Warning: Dump file may not contain data of all partitions of this table
Import terminated successfully with warnings.

real 108m54.959s
user 31m4.134s
sys 3m7.302s

然后为这个表创建了一个Local的局部索引,又用去了37分钟:
SQL> set timing on
SQL> create index idx_MDN on smsmg(MDN) local nologging parallel 4;
Index created.

Elapsed: 00:37:29.64
这就是转移的好处,在生产库上,是无法创建和调整索引的,也不能使用并行,怕影响到生产的性能。
处理器摘要信息供参考:
processor : 7
vendor_id : GenuineIntel
cpu family : 15
model : 2
model name : Intel(R) Xeon(TM) MP CPU 3.00GHz
stepping : 6
cpu MHz : 2990.724
cache size : 512 KB
physical id : 3
siblings : 2
core id : 3
cpu cores : 1
fdiv_bug : no
hlt_bug : no
f00f_bug : no
coma_bug : no
fpu : yes
fpu_exception : yes
cpuid level : 2
wp : yes
flags : fpu vme de pse tsc msr pae mce cx8 apic
bogomips : 5979.92

-The End-

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值