exp 导出时 可以添加 consistent 参数,在10g、11g expdp也可以添加这个参数来导出数据。
[oracle@bmsdb ~]$ expdp abc/abc schemas=abc directory=EXPDPIMPDPDIR dumpfile=abc_%U.dmp parallel=2 job_name=abcexpdpimpdpconsistent=y
Export: Release 11.2.0.3.0 - Production on Tue Mar 22 08:22:06 2016
Copyright (c) 1982, 2011, Oracle and/or its affiliates. All rights reserved.
Connected to: Oracle Database 11g Enterprise Edition Release 11.2.0.3.0 - 64bit Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options
Legacy Mode Active due to the following parameters:
Legacy Mode Parameter: "consistent=TRUE" Location: Command Line, Replaced with: "flashback_time=TO_TIMESTAMP('2016-03-22 08:22:06', 'YYYY-MM-DD HH24:MI:SS')"
Legacy Modehas set reuse_dumpfiles=true parameter.
Starting "ABC"."USRAEXPDPIMPDP": ABC/******** schemas=ABC directory=EXPDPIMPDPDIR dumpfile=abc_%U.dmp parallel=2 job_name=abcexpdpimpdp flashback_time=TO_TIMESTAMP('2016-03-22 08:22:06', 'YYYY-MM-DD HH24:MI:SS') reuse_dumpfiles=true
Estimate in progress using BLOCKS method...
可以看到Oracle检测到传统参数 consistent=y 会转换为 flashback_time=TO_TIMESTAMP('2016-03-22 08:22:06', 'YYYY-MM-DD HH24:MI:SS')
使用的是 flashback query 技术,如果 undo_retention 设置过小或者 没有 retention guarantee ,会报ORA-01555错误,
如下
ORA-31693: Table data object "ABC"."XXXX" failed to load/unload and is being skipped due to error:
ORA-02354: error in exporting/importing data
ORA-01555: snapshot too old: rollback segment number 42 with name "_SYSSMU42$" too small
ORA-00604: error occurred at recursive SQL level 3
ORA-08180: no snapshot found based on specified time
ORA-06512: at "SYS.TIMESTAMP_TO_SCN", line 1
相同效果的还有 flashback_scn= ,对应的数值从 dbms_flashback.get_system_change_number() 获取
select dbms_flashback.get_system_change_number()
from dual;
--------------------
备注:
consistent =
flashback_time=
flashback_scn=