在使用10g后的Oracle data pump导出数据时,我们可以使用flashback_scn参数指定导出的时间点,这时 oracle会使用flashback query查询导出scn时的数据,flashback query使用undo,无需打开flashback database功能。 也就是说,只要undo信息不被覆盖,即使数据库被重启,仍然可以进行基于flashback_scn的导出动作。 --以scott用户做测试 oracle@wang:/home/oracle$sqlplus scott/tiger; SQL*Plus: Release 11.2.0.4.0 Production on Fri Mar 15 07:43:24 2019 Copyright (c) 1982, 2013, Oracle. All rights reserved. Connected to: Oracle Database 11g Enterprise Edition Release 11.2.0.4.0 - 64bit Production With the Partitioning, OLAP, Data Mining and Real Application Testing options SQL> show user; USER is "SCOTT" SQL> select current_scn from v$database; CURRENT_SCN ----------- 21870773 (记为1号时间点) SQL> create table t (num number); Table created. SQL> insert into t values(1); 1 row created. SQL> commit; Commit complete. SQL> select current_scn from v$database; CURRENT_SCN ----------- 21870796 (记为2号时间点) SQL> insert into t values(2); 1 row created. SQL> commit; Commit complete. SQL> select current_scn from v$database; CURRENT_SCN ----------- 21870805 SQL> conn / as sysdba Connected. SQL> shutdown immediate; Database closed. Database dismounted. ORACLE instance shut down. SQL> startup ORACLE instance started. Total System Global Area 835104768 bytes Fixed Size 2257840 bytes Variable Size 549456976 bytes Database Buffers 281018368 bytes Redo Buffers 2371584 bytes Database mounted. Database opened. SQL> select current_scn from v$database; CURRENT_SCN ----------- 21871307 (记为3号时间点) SQL> conn scott/tiger; Connected. SQL> insert into t values(3); 1 row created. SQL> commit; Commit complete. SQL> select current_scn from v$database; CURRENT_SCN ----------- 21871340 (记为4号时间点) SQL> select * from t; NUM ---------- 1 2 3 --现在开始做expdp导出 (1号时间点) expdp scott/tiger directory=DATA_PUMP_DIR dumpfile=t1.dmp tables=t flashback_scn=21870773 (2号时间点) expdp scott/tiger directory=DATA_PUMP_DIR dumpfile=t2.dmp tables=t flashback_scn=21870796 (3号时间点) expdp scott/tiger directory=DATA_PUMP_DIR dumpfile=t3.dmp tables=t flashback_scn=21871307 (4号时间点) expdp scott/tiger directory=DATA_PUMP_DIR dumpfile=t4.dmp tables=t flashback_scn=21871340 oracle@wang:/home/oracle$ expdp scott/tiger directory=DATA_PUMP_DIR dumpfile=t1.dmp tables=t flashback_scn=21870773 Export: Release 11.2.0.4.0 - Production on Fri Mar 15 07:52:18 2019 Copyright (c) 1982, 2011, Oracle and/or its affiliates. All rights reserved. Connected to: Oracle Database 11g Enterprise Edition Release 11.2.0.4.0 - 64bit Production With the Partitioning, OLAP, Data Mining and Real Application Testing options Starting "SCOTT"."SYS_EXPORT_TABLE_01": scott/******** directory=DATA_PUMP_DIR dumpfile=t1.dmp tables=t flashback_scn=21870773 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 "SCOTT"."T" 4.984 KB 0 rows Master table "SCOTT"."SYS_EXPORT_TABLE_01" successfully loaded/unloaded ****************************************************************************** Dump file set for SCOTT.SYS_EXPORT_TABLE_01 is: /u01/app/oracle/admin/DBdb/dpdump/t1.dmp Job "SCOTT"."SYS_EXPORT_TABLE_01" successfully completed at Fri Mar 15 07:52:28 2019 elapsed 0 00:00:08 oracle@wang:/home/oracle$ expdp scott/tiger directory=DATA_PUMP_DIR dumpfile=t2.dmp tables=t flashback_scn=21870796 Export: Release 11.2.0.4.0 - Production on Fri Mar 15 07:52:34 2019 Copyright (c) 1982, 2011, Oracle and/or its affiliates. All rights reserved. Connected to: Oracle Database 11g Enterprise Edition Release 11.2.0.4.0 - 64bit Production With the Partitioning, OLAP, Data Mining and Real Application Testing options Starting "SCOTT"."SYS_EXPORT_TABLE_01": scott/******** directory=DATA_PUMP_DIR dumpfile=t2.dmp tables=t flashback_scn=21870796 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 "SCOTT"."T" 5 KB 1 rows Master table "SCOTT"."SYS_EXPORT_TABLE_01" successfully loaded/unloaded ****************************************************************************** Dump file set for SCOTT.SYS_EXPORT_TABLE_01 is: /u01/app/oracle/admin/DBdb/dpdump/t2.dmp Job "SCOTT"."SYS_EXPORT_TABLE_01" successfully completed at Fri Mar 15 07:52:44 2019 elapsed 0 00:00:07 oracle@wang:/home/oracle$ expdp scott/tiger directory=DATA_PUMP_DIR dumpfile=t3.dmp tables=t flashback_scn=21871307 Export: Release 11.2.0.4.0 - Production on Fri Mar 15 07:52:54 2019 Copyright (c) 1982, 2011, Oracle and/or its affiliates. All rights reserved. Connected to: Oracle Database 11g Enterprise Edition Release 11.2.0.4.0 - 64bit Production With the Partitioning, OLAP, Data Mining and Real Application Testing options Starting "SCOTT"."SYS_EXPORT_TABLE_01": scott/******** directory=DATA_PUMP_DIR dumpfile=t3.dmp tables=t flashback_scn=21871307 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 "SCOTT"."T" 5.007 KB 2 rows Master table "SCOTT"."SYS_EXPORT_TABLE_01" successfully loaded/unloaded ****************************************************************************** Dump file set for SCOTT.SYS_EXPORT_TABLE_01 is: /u01/app/oracle/admin/DBdb/dpdump/t3.dmp Job "SCOTT"."SYS_EXPORT_TABLE_01" successfully completed at Fri Mar 15 07:53:03 2019 elapsed 0 00:00:07 oracle@wang:/home/oracle$ expdp scott/tiger directory=DATA_PUMP_DIR dumpfile=t4.dmp tables=t flashback_scn=21871340 Export: Release 11.2.0.4.0 - Production on Fri Mar 15 07:53:12 2019 Copyright (c) 1982, 2011, Oracle and/or its affiliates. All rights reserved. Connected to: Oracle Database 11g Enterprise Edition Release 11.2.0.4.0 - 64bit Production With the Partitioning, OLAP, Data Mining and Real Application Testing options Starting "SCOTT"."SYS_EXPORT_TABLE_01": scott/******** directory=DATA_PUMP_DIR dumpfile=t4.dmp tables=t flashback_scn=21871340 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 "SCOTT"."T" 5.015 KB 3 rows Master table "SCOTT"."SYS_EXPORT_TABLE_01" successfully loaded/unloaded ****************************************************************************** Dump file set for SCOTT.SYS_EXPORT_TABLE_01 is: /u01/app/oracle/admin/DBdb/dpdump/t4.dmp Job "SCOTT"."SYS_EXPORT_TABLE_01" successfully completed at Fri Mar 15 07:53:22 2019 elapsed 0 00:00:07 oracle@wang:/home/oracle$ --现在开始做impdp导出 (1号时间点) drop table t purge; impdp scott/tiger directory=DATA_PUMP_DIR dumpfile=t1.dmp (2号时间点) drop table t purge; impdp scott/tiger directory=DATA_PUMP_DIR dumpfile=t2.dmp (3号时间点) drop table t purge; impdp scott/tiger directory=DATA_PUMP_DIR dumpfile=t3.dmp (4号时间点) drop table t purge; impdp scott/tiger directory=DATA_PUMP_DIR dumpfile=t4.dmp
基于flashback_scn的expdp导出
来源:这里教程网
时间:2026-03-03 13:13:59
作者:
编辑推荐:
下一篇:
相关推荐
-
雷神推出 MIX PRO II 迷你主机:基于 Ultra 200H,玻璃上盖 + ARGB 灯效
2 月 9 日消息,雷神 (THUNDEROBOT) 现已宣布推出基于英
-
制造商 Musnap 推出彩色墨水屏电纸书 Ocean C:支持手写笔、第三方安卓应用
2 月 10 日消息,制造商 Musnap 现已在海外推出一款 Oce
热文推荐
- 关于多租户架构
关于多租户架构
26-03-03 - oracle数据库备份之exp增量备份
oracle数据库备份之exp增量备份
26-03-03 - 在Oracle DG Standby库上启用flashback database功能
- Oracle切换undo表空间操作步骤
Oracle切换undo表空间操作步骤
26-03-03 - Oracle EBS 企业税改方案(一)-业务需求整理及基础设置篇
Oracle EBS 企业税改方案(一)-业务需求整理及基础设置篇
26-03-03 - Oracle EBS 企业税改方案(二)-未结销售订单
Oracle EBS 企业税改方案(二)-未结销售订单
26-03-03 - Oracle EBS 企业税改方案(三)-未结采购单据及部分AP Invoices税率调整
- 《三国杀》开发商游卡新作《元夜十二谈》公布,号称“新志怪民俗策略 RPG”
- 6-oracle_表关联
6-oracle_表关联
26-03-03 - 微星 RTX 5070《魔兽世界:至暗之夜》虚空限定版 OC 显卡上市,5999 元
