EXP&EXPDP导出数据同步问题
2013-03-19 09:59
92 查看
在itpub论坛上看到一个问题:如果库正在被写,exp是不是导出的数据就是不同步的了? http://www.itpub.net/forum.php?mod=viewthread&tid=1772882&page=1#pid21172716
按照推理逻辑,exp导出的数据应该不是同步的,也不可能同步,除非exp能智能判断数据库是否正在写操作,而且一直等到写操作结束为止。显然这些假设都不合理。下面我们来做个实验,验证一下exp导出数据是否同步。
新建一个测试表TEST, 我们写一个循环,往表里面插入1000条记录,而且每插入插入一条记录,停顿0.5秒。这样来模拟数据库处于写状态。
执行上面脚本,然后我们执行导出表TEST的exp命令,如下所示:
[oracle@DB-Server ~]$ exp userid=etl/***@BIWG tables=test file=test.dmp buffer=4096000 feedback=10000 log=test.log
Export: Release 10.2.0.1.0 - Production on Mon Mar 18 17:48:39 2013
Copyright (c) 1982, 2005, Oracle. All rights reserved.
Connected to: Oracle Database 10g Enterprise Edition Release 10.2.0.1.0 - Production
With the Partitioning, OLAP and Data Mining options
Export done in US7ASCII character set and AL16UTF16 NCHAR character set
server uses ZHS16GBK character set (possible charset conversion)
About to export specified tables via Conventional Path ...
. . exporting table TEST 11 rows exported
Export terminated successfully without warnings.
[oracle@DB-Server ~]$ exp userid=etl/***@BIWG tables=test file=test.dmp buffer=4096000 feedback=10000 log=test.log
Export: Release 10.2.0.1.0 - Production on Mon Mar 18 17:48:49 2013
Copyright (c) 1982, 2005, Oracle. All rights reserved.
Connected to: Oracle Database 10g Enterprise Edition Release 10.2.0.1.0 - Production
With the Partitioning, OLAP and Data Mining options
Export done in US7ASCII character set and AL16UTF16 NCHAR character set
server uses ZHS16GBK character set (possible charset conversion)
About to export specified tables via Conventional Path ...
. . exporting table TEST 30 rows exported
Export terminated successfully without warnings.
[oracle@DB-Server ~]$ exp userid=etl/***@BIWG tables=test file=test.dmp buffer=4096000 feedback=10000 log=test.log
Export: Release 10.2.0.1.0 - Production on Mon Mar 18 17:48:59 2013
Copyright (c) 1982, 2005, Oracle. All rights reserved.
Connected to: Oracle Database 10g Enterprise Edition Release 10.2.0.1.0 - Production
With the Partitioning, OLAP and Data Mining options
Export done in US7ASCII character set and AL16UTF16 NCHAR character set
server uses ZHS16GBK character set (possible charset conversion)
About to export specified tables via Conventional Path ...
. . exporting table TEST 50 rows exported
Export terminated successfully without warnings.
显然从上面实验来看,可以验证我们的想法:exp导出数据应该是某个时间点的数据,数据是不同步的。
下面我们先截断表TEST的数据,然后重新执行上面SQL脚本,然后来验证一下expdp导出数据是否同步:
[oracle@DB-Server ~]$ expdp userid=etl/***@BIWG directory=DUMP_DIR dumpfile=test1.dmp tables=test logfile=test.log
Export: Release 10.2.0.1.0 - 64bit Production on Monday, 18 March, 2013 18:17:44
Copyright (c) 2003, 2005, Oracle. All rights reserved.
Connected to: Oracle Database 10g Enterprise Edition Release 10.2.0.1.0 - Production
With the Partitioning, OLAP and Data Mining options
Starting "ETL"."SYS_EXPORT_TABLE_01": userid=etl/********@BIWG directory=DUMP_DIR dumpfile=test1.dmp tables=test logfile=test.log
Estimate in progress using BLOCKS method...
Processing object type TABLE_EXPORT/TABLE/TABLE_DATA
Total estimation using BLOCKS method: 64 KB
Processing object type TABLE_EXPORT/TABLE/TABLE
. . exported "ETL"."TEST" 8.039 KB 187 rows
Master table "ETL"."SYS_EXPORT_TABLE_01" successfully loaded/unloaded
******************************************************************************
Dump file set for ETL.SYS_EXPORT_TABLE_01 is:
H:\DATAPUMP\TEST1.DMP
Job "ETL"."SYS_EXPORT_TABLE_01" successfully completed at 18:29:40
[oracle@DB-Server ~]$ expdp userid=etl/***@BIWG directory=DUMP_DIR dumpfile=test2.dmp tables=test logfile=test.log
Export: Release 10.2.0.1.0 - 64bit Production on Monday, 18 March, 2013 18:20:07
Copyright (c) 2003, 2005, Oracle. All rights reserved.
Connected to: Oracle Database 10g Enterprise Edition Release 10.2.0.1.0 - Production
With the Partitioning, OLAP and Data Mining options
Starting "ETL"."SYS_EXPORT_TABLE_01": userid=etl/********@BIWG directory=DUMP_DIR dumpfile=test2.dmp tables=test logfile=test.log
Estimate in progress using BLOCKS method...
Processing object type TABLE_EXPORT/TABLE/TABLE_DATA
Total estimation using BLOCKS method: 64 KB
Processing object type TABLE_EXPORT/TABLE/TABLE
. . exported "ETL"."TEST" 17.14 KB 770 rows
Master table "ETL"."SYS_EXPORT_TABLE_01" successfully loaded/unloaded
******************************************************************************
Dump file set for ETL.SYS_EXPORT_TABLE_01 is:
H:\DATAPUMP\TEST2.DMP
Job "ETL"."SYS_EXPORT_TABLE_01" successfully completed at 18:33:46
显然通过上面实验测试,发现expdp导出数据也是不同步的。
按照推理逻辑,exp导出的数据应该不是同步的,也不可能同步,除非exp能智能判断数据库是否正在写操作,而且一直等到写操作结束为止。显然这些假设都不合理。下面我们来做个实验,验证一下exp导出数据是否同步。
新建一个测试表TEST, 我们写一个循环,往表里面插入1000条记录,而且每插入插入一条记录,停顿0.5秒。这样来模拟数据库处于写状态。
CREATE TABLE TEST ( ID NUMBER , UPDATE_DATE DATE ) BEGIN FOR V_INDEX IN 1 .. 1000 LOOP INSERT INTO TEST VALUES(V_INDEX, SYSDATE); COMMIT; DBMS_LOCK.SLEEP(0.5); END LOOP; END;
执行上面脚本,然后我们执行导出表TEST的exp命令,如下所示:
[oracle@DB-Server ~]$ exp userid=etl/***@BIWG tables=test file=test.dmp buffer=4096000 feedback=10000 log=test.log
Export: Release 10.2.0.1.0 - Production on Mon Mar 18 17:48:39 2013
Copyright (c) 1982, 2005, Oracle. All rights reserved.
Connected to: Oracle Database 10g Enterprise Edition Release 10.2.0.1.0 - Production
With the Partitioning, OLAP and Data Mining options
Export done in US7ASCII character set and AL16UTF16 NCHAR character set
server uses ZHS16GBK character set (possible charset conversion)
About to export specified tables via Conventional Path ...
. . exporting table TEST 11 rows exported
Export terminated successfully without warnings.
[oracle@DB-Server ~]$ exp userid=etl/***@BIWG tables=test file=test.dmp buffer=4096000 feedback=10000 log=test.log
Export: Release 10.2.0.1.0 - Production on Mon Mar 18 17:48:49 2013
Copyright (c) 1982, 2005, Oracle. All rights reserved.
Connected to: Oracle Database 10g Enterprise Edition Release 10.2.0.1.0 - Production
With the Partitioning, OLAP and Data Mining options
Export done in US7ASCII character set and AL16UTF16 NCHAR character set
server uses ZHS16GBK character set (possible charset conversion)
About to export specified tables via Conventional Path ...
. . exporting table TEST 30 rows exported
Export terminated successfully without warnings.
[oracle@DB-Server ~]$ exp userid=etl/***@BIWG tables=test file=test.dmp buffer=4096000 feedback=10000 log=test.log
Export: Release 10.2.0.1.0 - Production on Mon Mar 18 17:48:59 2013
Copyright (c) 1982, 2005, Oracle. All rights reserved.
Connected to: Oracle Database 10g Enterprise Edition Release 10.2.0.1.0 - Production
With the Partitioning, OLAP and Data Mining options
Export done in US7ASCII character set and AL16UTF16 NCHAR character set
server uses ZHS16GBK character set (possible charset conversion)
About to export specified tables via Conventional Path ...
. . exporting table TEST 50 rows exported
Export terminated successfully without warnings.
显然从上面实验来看,可以验证我们的想法:exp导出数据应该是某个时间点的数据,数据是不同步的。
下面我们先截断表TEST的数据,然后重新执行上面SQL脚本,然后来验证一下expdp导出数据是否同步:
[oracle@DB-Server ~]$ expdp userid=etl/***@BIWG directory=DUMP_DIR dumpfile=test1.dmp tables=test logfile=test.log
Export: Release 10.2.0.1.0 - 64bit Production on Monday, 18 March, 2013 18:17:44
Copyright (c) 2003, 2005, Oracle. All rights reserved.
Connected to: Oracle Database 10g Enterprise Edition Release 10.2.0.1.0 - Production
With the Partitioning, OLAP and Data Mining options
Starting "ETL"."SYS_EXPORT_TABLE_01": userid=etl/********@BIWG directory=DUMP_DIR dumpfile=test1.dmp tables=test logfile=test.log
Estimate in progress using BLOCKS method...
Processing object type TABLE_EXPORT/TABLE/TABLE_DATA
Total estimation using BLOCKS method: 64 KB
Processing object type TABLE_EXPORT/TABLE/TABLE
. . exported "ETL"."TEST" 8.039 KB 187 rows
Master table "ETL"."SYS_EXPORT_TABLE_01" successfully loaded/unloaded
******************************************************************************
Dump file set for ETL.SYS_EXPORT_TABLE_01 is:
H:\DATAPUMP\TEST1.DMP
Job "ETL"."SYS_EXPORT_TABLE_01" successfully completed at 18:29:40
[oracle@DB-Server ~]$ expdp userid=etl/***@BIWG directory=DUMP_DIR dumpfile=test2.dmp tables=test logfile=test.log
Export: Release 10.2.0.1.0 - 64bit Production on Monday, 18 March, 2013 18:20:07
Copyright (c) 2003, 2005, Oracle. All rights reserved.
Connected to: Oracle Database 10g Enterprise Edition Release 10.2.0.1.0 - Production
With the Partitioning, OLAP and Data Mining options
Starting "ETL"."SYS_EXPORT_TABLE_01": userid=etl/********@BIWG directory=DUMP_DIR dumpfile=test2.dmp tables=test logfile=test.log
Estimate in progress using BLOCKS method...
Processing object type TABLE_EXPORT/TABLE/TABLE_DATA
Total estimation using BLOCKS method: 64 KB
Processing object type TABLE_EXPORT/TABLE/TABLE
. . exported "ETL"."TEST" 17.14 KB 770 rows
Master table "ETL"."SYS_EXPORT_TABLE_01" successfully loaded/unloaded
******************************************************************************
Dump file set for ETL.SYS_EXPORT_TABLE_01 is:
H:\DATAPUMP\TEST2.DMP
Job "ETL"."SYS_EXPORT_TABLE_01" successfully completed at 18:33:46
显然通过上面实验测试,发现expdp导出数据也是不同步的。
相关文章推荐
- EXP-00079: 表 "***" 中的数据是被保护的。常规路径只能导出部分表的解决办法
- Oracle数据导入导出imp/exp命令 10g以上expdp/impdp命令
- 20120327_psdi.mbo.SYNONYMDomainInfoFactory.load 数据库导出问题所致 ORA-00942: 表或视图不存在&关于imp exp
- Oracle数据导入导出imp/exp命令 10g以上expdp/impdp命令
- exp imp用法 导入导出一个表结构和数据问题
- Oracle数据导入导出imp/exp sp2-0734:未知的命令开头'imp 忽略了剩余行默认分类 解决办法
- 2003下从网页中把数据导出到excel时,碰到"Automation 服务器不能创建对象"的问题
- 关于EXP-00056: 遇到 ORACLE 错误 1455 ORA-01455: 转换列溢出整数数据类型 EXP-00000: 导出终止失败 的问题解决方法整理
- 【EXPDP/IMPDP】数据泵导入导出遇到目录没有权限问题
- Oracle数据导入导出imp/exp命令 10g以上expdp/impdp命令
- Oracle 导入导出数据 imp/exp impdp/expdp
- shopnc 导出Excel数据问题实例 && ajax 获取当前值并传递
- 解决 Oracle exp导出表数据时空表不能导出的问题
- Oracle数据导入导出imp/exp命令 10g以上expdp/impdp命令
- Oracle数据导入导出imp/exp命令 10g以上expdp/impdp命令
- Oracle数据导入导出imp/exp命令 10g以上expdp/impdp命令
- Oracle数据导入导出imp/exp命令 10g以上expdp/impdp命令
- ORACLE数据泵导入导出案例(expdp & impdp)
- Oracle数据导入导出imp/exp命令 10g以上expdp/impdp命令 详细的
- Oracle数据导入导出imp/exp命令 10g以上expdp/impdp命令