谁能说说EXPDP的FLASHBACK_SCN恢复与FLASHBACK TABLE恢复

[复制链接]
查看11 | 回复1 | 2006-4-16 22:44:45 | 显示全部楼层 |阅读模式
今天测试EXPDP 的FLASHBACK_SCN发现也是读取的UNDO SEGMENT
通过ORA-ROWSCN知道当时行变化对应的SCN:
SQL> select ora_rowscn,ename from hr.emp2 where rownum select count(*) from hr.emp2;
COUNT(*)
----------
57344
表里总共有57344行.

SQL> select * from dba_directories
OWNER DIRECTORY_NAME
DIRECTORY_PATH
----- ------------------------------ ---------------------------------------------------------------
SYS CURRLOGDIR
D:\ORACLE\PRODUCT\10.2.0\ORADATA\DEVDB\
SYS LOGDIR
+DISK_GROUP1/devdb/logfile
SYS SUBDIR
D:\oracle\product\10.2.0\db_1\demo\schema\order_entry\/2002/Sep
SYS XMLDIR
D:\oracle\product\10.2.0\db_1\demo\schema\order_entry\
SYS MEDIA_DIR
D:\oracle\product\10.2.0\db_1\demo\schema\product_media\
SYS LOG_FILE_DIR
D:\oracle\product\10.2.0\db_1\demo\schema\log\
SYS WORK_DIR
C:\ADE\aime_10.2_nt_push\oracle/work
SYS DATA_FILE_DIR
D:\oracle\product\10.2.0\db_1\demo\schema\sales_history\
SYS DATA_PUMP_DIR
D:\oracle\product\10.2.0\admin\devdb\dpdump\
SYS ADMIN_DIR
C:\ADE\aime_10.2_nt_push\oracle/md/admin
已选择10行。
查询目前的目录

C:\Documents and Settings\oracle>expdp hr/hr dumpfile=expdp_hr.dmp directory=cur
rlogfir schemas=hr include=table:EMP2 flashback_scn=255051640 logfile=expdp.log
Export: Release 10.2.0.1.0 - Production on 星期二, 26 2月, 2008 10:37:02
Copyright (c) 2003, 2005, Oracle.All rights reserved.
连接到: Oracle Database 10g Enterprise Edition Release 10.2.0.1.0 - Production
With the Partitioning, OLAP and Data Mining options
ORA-39002: 操作无效
ORA-39070: 无法打开日志文件。
ORA-39087: 目录名 CURRLOGFIR 无效
SQL> GRANT ALL ON DIRECTORY CURRLOGDIR TO HR;
授权成功。

C:\Documents and Settings\oracle>expdp hr/hr dumpfile=expdp_hr.dmp directory=cur
rlogdir schemas=hr include=table:\"in (\'EMP2\')\" flashback_scn=255051640 conte
nt=data_only logfile=expdp.log
Export: Release 10.2.0.1.0 - Production on 星期二, 26 2月, 2008 10:44:04
Copyright (c) 2003, 2005, Oracle.All rights reserved.
连接到: Oracle Database 10g Enterprise Edition Release 10.2.0.1.0 - Production
With the Partitioning, OLAP and Data Mining options
自动启用 FLASHBACK 以保持数据库完整性。
启动 "HR"."SYS_EXPORT_SCHEMA_01":hr/******** dumpfile=expdp_hr.dmp directory=c
urrlogdir schemas=hr include=table:"in (\'EMP2\')" flashback_scn=255051640 conte
nt=data_only logfile=expdp.log
正在使用 BLOCKS 方法进行估计...
处理对象类型 SCHEMA_EXPORT/TABLE/TABLE_DATA
使用 BLOCKS 方法的总估计: 2.812 MB
ORA-31693: 表数据对象 "HR"."EMP2" 无法加载/卸载并且被跳过, 错误如下:
ORA-02354: 导出/导入数据时出错
ORA-01466: 无法读取数据 - 表定义已更改
已成功加载/卸载了主表 "HR"."SYS_EXPORT_SCHEMA_01"
******************************************************************************
HR.SYS_EXPORT_SCHEMA_01 的转储文件集为:
D:\ORACLE\PRODUCT\10.2.0\ORADATA\DEVDB\EXPDP_HR.DMP
作业 "HR"."SYS_EXPORT_SCHEMA_01" 已经完成, 但是有 1 个错误 (于 10:44:28 完成)
回复

使用道具 举报

千问 | 2006-4-16 22:44:45 | 显示全部楼层
$ oerr ora 1466
01466, 00000, "unable to read data - table definition has changed"
// *Cause: Query parsed after tbl (or index) change, and executed
// w/old snapshot
// *Action: commit (or rollback) transaction, and re-execute

SQL> commit;
提交完成。
SQL> flashback table emp2 to scn 255051640;
flashback table emp2 to scn 255051640

*
第 1 行出现错误:
ORA-00604: 递归 SQL 级别 1 出现错误
ORA-12801: 并行查询服务器 P000 中发出错误信号
ORA-01555: 快照过旧: 回退段号 9 (名称为 "_SYSSMU9$") 过小
看来在UNDO_RETENTION和UNDO_TABLESPACE合适的情况下,这两者才适合恢复
既然flashback table 可以做到恢复指定SCN
为什么EXPDP也要这么做呢,难道是为了迁移?
如果要有能直接读取日志来做SCN恢复就好了
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

主题

0

回帖

4882万

积分

论坛元老

Rank: 8Rank: 8

积分
48824836
热门排行