标签云
asm恢复 bbed bootstrap$ dul In Memory kcbzib_kcrsds_1 kccpb_sanity_check_2 kfed MySQL恢复 ORA-00312 ORA-00607 ORA-00704 ORA-01110 ORA-01555 ORA-01578 ORA-08103 ORA-600 2131 ORA-600 2662 ORA-600 2663 ORA-600 3020 ORA-600 4000 ORA-600 4137 ORA-600 4193 ORA-600 4194 ORA-600 16703 ORA-600 kcbzib_kcrsds_1 ORA-600 KCLCHKBLK_4 ORA-15042 ORA-15196 ORACLE 12C oracle dul ORACLE PATCH Oracle Recovery Tools oracle加密恢复 oracle勒索 oracle勒索恢复 oracle异常恢复 Oracle 恢复 ORACLE恢复 ORACLE数据库恢复 oracle 比特币 OSD-04016 YOUR FILES ARE ENCRYPTED 勒索恢复 比特币加密文章分类
- Others (2)
- 中间件 (2)
- WebLogic (2)
- 操作系统 (102)
- 数据库 (1,655)
- DB2 (22)
- MySQL (71)
- Oracle (1,519)
- Data Guard (51)
- EXADATA (8)
- GoldenGate (21)
- ORA-xxxxx (158)
- ORACLE 12C (72)
- ORACLE 18C (6)
- ORACLE 19C (14)
- ORACLE 21C (3)
- Oracle 23ai (7)
- Oracle ASM (65)
- Oracle Bug (8)
- Oracle RAC (52)
- Oracle 安全 (6)
- Oracle 开发 (28)
- Oracle 监听 (28)
- Oracle备份恢复 (553)
- Oracle安装升级 (90)
- Oracle性能优化 (62)
- 专题索引 (5)
- 勒索恢复 (76)
- PostgreSQL (18)
- PostgreSQL恢复 (6)
- SQL Server (27)
- SQL Server恢复 (8)
- TimesTen (7)
- 达梦数据库 (2)
- 生活娱乐 (2)
- 至理名言 (11)
- 虚拟化 (2)
- VMware (2)
- 软件开发 (37)
- Asp.Net (9)
- JavaScript (12)
- PHP (2)
- 小工具 (20)
-
最近发表
- RAC默认服务配置优先节点
- Oracle 19c RAC 替换私网操作
- 监听报TNS-12541 TNS-12560 TNS-00511错误
- drop tablespace xxx including contents恢复
- Linux 8 修改网卡名称
- 如何修改集群的公网信息(包括 VIP) (Doc ID 1674442.1)
- 如何在 oracle 集群环境下修改私网信息 (Doc ID 2103317.1)
- ORA-600 [kcvfdb_pdb_set_clean_scn: cleanckpt] 相关bug
- ORA-600 krhpfh_03-1210故障处理
- 19c库启动报ORA-600 kcbzib_kcrsds_1
- DBMS_SESSION.set_context提示ORA-01031问题解决
- redo写丢失导致ORA-600 kcrf_resilver_log_1故障
- 硬件故障导致ORA-01242 ORA-01122等错误
- 200T 数据库非归档无备份恢复
- 利用flashback快速恢复failover 的备库
- [comingback2022@cock.li].eking和[tsai.shen@mailfence.com].faust扩展名勒索病毒数据库可以完美恢复
- opatch auto 出现unable to get oracle owner for 错误
- Oracle 23ai 表和视图的列最多支持到4096个
- 断电引起redo和数据文件不一致故障恢复
- ORA-03113: 通信通道的文件结尾
标签归档:exp损坏
exp dmp文件损坏恢复
在有些时候,exp的dmp文件因为某种原因损坏(比如磁盘异常,exp过程损坏等),导致imp导入无法继续,下面的处理方法(直接读取dmp文件)来对dmp文件进行抢救性恢复,最大程度减少数据丢失损失
创建exp dmp文件并使用dd破坏
SQL> create table t_xifenfei as select * from dba_objects; Table created. SQL> select count(*) from t_xifenfei; COUNT(*) ---------- 90915 [oracle@localhost ~]$ exp chf/xifenfei@pdb1 file=/tmp/t_xifenfei.dmp tables=t_xifenfei Export: Release 12.1.0.2.0 on Sun Apr 27 21:39:26 2014 Copyright (c) 1982, 2014, Oracle and/or its affiliates. All rights reserved. Connected to: Oracle Database 12c Enterprise Edition Release 12.1.0.1.0 - 64bit With the Partitioning, OLAP, Advanced Analytics and Real Application Testing options Export done in US7ASCII character set and AL16UTF16 NCHAR character set server uses WE8MSWIN1252 character set (possible charset conversion) About to export specified tables via Conventional Path ... . . exporting table T_XIFENFEI 90915 rows exported EXP-00091: Exporting questionable statistics. Export terminated successfully with warnings. [oracle@localhost ~]$ od -x /tmp/t_xifenfei.dmp |head -10 0000000 0003 4501 5058 524f 3a54 3156 2e32 3130 0000020 302e 0a30 4344 4648 520a 4154 4c42 5345 0000040 380a 3931 0a32 0a30 3237 300a 000a 0001 0000060 07b2 00d0 0001 0000 0000 0000 0000 0013 0000100 2020 2020 2020 2020 2020 2020 2020 2020 * 0000140 2020 2020 2020 2020 7553 206e 7041 2072 0000160 3732 3220 3a31 3933 323a 2036 3032 3431 0000200 742f 706d 742f 785f 6669 6e65 6566 2e69 0000220 6d64 0070 0000 0000 0000 0000 0000 0000 --strings命令看dmp文件 [oracle@localhost ~]$ strings /tmp/t_xifenfei.dmp |head -50 EXPORT:V12.01.00 DCHF RTABLES 8192 Tue Apr 29 0:39:49 2014/tmp/t_xifenfei.dmp #G#G #G#G +08:00 BYTE UNUSED INTERPRETED DISABLE:ALL METRICST TABLE "T_XIFENFEI" CREATE TABLE "T_XIFENFEI" ("OWNER" VARCHAR2(128), "OBJECT_NAME" VARCHAR2(128), "SUBOBJECT_NAME" VARCHAR2(128), "OBJECT_ID" NUMBER, "DATA_OBJECT_ID" NUMBER, "OBJECT_TYPE" VARCHAR2(23), "CREATED" DATE, "LAST_DDL_TIME" DATE, "TIMESTAMP" VARCHAR2(19), "STATUS" VARCHAR2(7), "TEMPORARY" VARCHAR2(1), "GENERATED" VARCHAR2(1), "SECONDARY" VARCHAR2(1), "NAMESPACE" NUMBER, "EDITION_NAME" VARCHAR2(128), "SHARING" VARCHAR2(13), "EDITIONABLE" VARCHAR2(1), "ORACLE_MAINTAINED" VARCHAR2(1)) PCTFREE 10 PCTUSED 40 INITRANS 1 MAXTRANS 255 STORAGE(INITIAL 13631488 NEXT 1048576 MINEXTENTS 1 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT) TABLESPACE "USERS" LOGGING NOCOMPRESS INSERT INTO "T_XIFENFEI" ("OWNER", "OBJECT_NAME", "SUBOBJECT_NAME", "OBJECT_ID", "DATA_OBJECT_ID", "OBJECT_TYPE", "CREATED", "LAST_DDL_TIME", "TIMESTAMP", "STATUS", "TEMPORARY", "GENERATED", "SECONDARY", "NAMESPACE", "EDITION_NAME", "SHARING", "EDITIONABLE", "ORACLE_MAINTAINED") VALUES (:1, :2, :3, :4, :5, :6, :7, :8, :9, :10, :11, :12, :13, :14, :15, :16, :17, :18) PUBLIC V$DATAGUARD_CONFIG SYNONYM 2014-04-22:17:51:05 VALID METADATA LINK V_$DATAGUARD_STATS VIEW 2014-04-22:17:51:05 --破坏exp dmp文件 [oracle@localhost ~]$ dd if=/dev/zero of=/tmp/t_xifenfei.dmp bs=1024 count=1 conv=notrunc 1+0 records in 1+0 records out 1024 bytes (1.0 kB) copied, 6.0291e-05 seconds, 17.0 MB/s [oracle@localhost ~]$ od -x /tmp/t_xifenfei.dmp |head -10 0000000 0000 0000 0000 0000 0000 0000 0000 0000 * 0020000 0064 0000 6000 2401 050f 0c0b 0c03 050c 0020020 0504 060d 0709 0508 0505 0505 050f 0505 0020040 0505 050a 0505 0505 0504 0706 0808 4723 0020060 4723 1108 0823 4111 47b0 8300 b200 d007 0020100 0003 0000 0000 0000 0000 0000 0000 0000 0020120 0000 0000 0000 0000 0000 0000 0000 0000 0020140 0000 0000 0000 0064 0000 6000 2401 050f 0020160 0c0b 0c03 050c 0504 060d 0709 0508 0505 --损坏后的dmp文件使用strings命令看 [oracle@localhost ~]$ strings /tmp/t_xifenfei.dmp |head -50 #G#G #G#G +08:00 BYTE UNUSED INTERPRETED DISABLE:ALL METRICST TABLE "T_XIFENFEI" CREATE TABLE "T_XIFENFEI" ("OWNER" VARCHAR2(128), "OBJECT_NAME" VARCHAR2(128), "SUBOBJECT_NAME" VARCHAR2(128), "OBJECT_ID" NUMBER, "DATA_OBJECT_ID" NUMBER, "OBJECT_TYPE" VARCHAR2(23), "CREATED" DATE, "LAST_DDL_TIME" DATE, "TIMESTAMP" VARCHAR2(19), "STATUS" VARCHAR2(7), "TEMPORARY" VARCHAR2(1), "GENERATED" VARCHAR2(1), "SECONDARY" VARCHAR2(1), "NAMESPACE" NUMBER, "EDITION_NAME" VARCHAR2(128), "SHARING" VARCHAR2(13), "EDITIONABLE" VARCHAR2(1), "ORACLE_MAINTAINED" VARCHAR2(1)) PCTFREE 10 PCTUSED 40 INITRANS 1 MAXTRANS 255 STORAGE(INITIAL 13631488 NEXT 1048576 MINEXTENTS 1 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT) TABLESPACE "USERS" LOGGING NOCOMPRESS INSERT INTO "T_XIFENFEI" ("OWNER", "OBJECT_NAME", "SUBOBJECT_NAME", "OBJECT_ID", "DATA_OBJECT_ID", "OBJECT_TYPE", "CREATED", "LAST_DDL_TIME", "TIMESTAMP", "STATUS", "TEMPORARY", "GENERATED", "SECONDARY", "NAMESPACE", "EDITION_NAME", "SHARING", "EDITIONABLE", "ORACLE_MAINTAINED") VALUES (:1, :2, :3, :4, :5, :6, :7, :8, :9, :10, :11, :12, :13, :14, :15, :16, :17, :18) PUBLIC V$DATAGUARD_CONFIG SYNONYM 2014-04-22:17:51:05 VALID METADATA LINK V_$DATAGUARD_STATS --imp 导入dmp文件失败 [oracle@localhost ~]$ imp chf/xifenfei@pdb1 file=/tmp/t_xifenfei.dmp full=y Import: Release 12.1.0.2.0 - on Sun Apr 27 22:02:40 2014 Copyright (c) 1982, 2014, Oracle and/or its affiliates. All rights reserved. Connected to: Oracle Database 12c Enterprise Edition Release 12.1.0.1.0 - 64bit With the Partitioning, OLAP, Advanced Analytics and Real Application Testing options IMP-00037: Character set marker unknown IMP-00000: Import terminated unsuccessfully
这里通过分析可以知道,exp dmp文件虽然损坏了一点,但是通过strings命令看,相关记录依然存在,因此可以通过工具去读exp dmp文件,然后分析得出相关数据
恢复损坏exp dmp文件数据
CPFL> SEARCH TABLE T_XIFENFEI FROM EXPFILE /tmp/t_xifenfei.dmp 8461: TABLE "T_XIFENFEI" 8480: CREATE TABLE "T_XIFENFEI" ("OWNER" VARCHAR2(128), "OBJECT_NAME" VARCHAR2(128), "SUBOBJECT_NAME" VARCHAR2(128), "OBJECT_ID" NUMBER, "DATA_OBJECT_ID" NUMBER, "OBJECT_TYPE" VARCHAR2(23), "CREATED" DATE, "LAST_DDL_TIME" DATE, "TIMESTAMP" VARCHAR2(19), "STATUS" VARCHAR2(7), "TEMPORARY" VARCHAR2(1), "GENERATED" VARCHAR2(1), "SECONDARY" VARCHAR2(1), "NAMESPACE" NUMBER, "EDITION_NAME" VARCHAR2(128), "SHARING" VARCHAR2(13), "EDITIONABLE" VARCHAR2(1), "ORACLE_MAINTAINED" VARCHAR2(1)) PCTFREE 10 PCTUSED 40 INITRANS 1 MAXTRANS 255 STORAGE(INITIAL 8388608 NEXT 1048576 MINEXTENTS 1 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT) TABLESPACE "USERS" LOGGING NOCOMPRESS 9145: INSERT INTO "T_XIFENFEI" ("OWNER", "OBJECT_NAME", "SUBOBJECT_NAME", "OBJECT_ID", "DATA_OBJECT_ID", "OBJECT_TYPE", "CREATED", "LAST_DDL_TIME", "TIMESTAMP", "STATUS", "TEMPORARY", "GENERATED", "SECONDARY", "NAMESPACE", "EDITION_NAME", "SHARING", "EDITIONABLE", "ORACLE_MAINTAINED") VALUES (:1, :2, :3, :4, :5, :6, :7, :8, :9, :10, :11, :12, :13, :14, :15, :16, :17, :18) Conventional export 9644: start of table data 12331252: TABLE "T_XIFENFEI" 12331349: ENDTABLE CPFL> UNLOAD TABLE "T_XIFENFEI" ("OWNER" VARCHAR2(128), "OBJECT_NAME" VARCHAR2(128), "SUBOBJECT_NAME" VARCHAR2(128), "OBJECT_ID" NUMBER, "DATA_OBJECT_ID" NUMBER, "OBJECT_TYPE" VARCHAR2(23), "CREATED" DATE, "LAST_DDL_TIME" DATE, "TIMESTAMP" VARCHAR2(19), "STATUS" VARCHAR2(7), "TEMPORARY" VARCHAR2(1), "GENERATED" VARCHAR2(1), "SECONDARY" VARCHAR2(1), "NAMESPACE" NUMBER, "EDITION_NAME" VARCHAR2(128), "SHARING" VARCHAR2(13), "EDITIONABLE" VARCHAR2(1), "ORACLE_MAINTAINED" VARCHAR2(1)) expfile /tmp/t_xifenfei.dmp from 8480 until 12331349 --因为exp dmp文件损坏记录 CPFL: Error: column 1 length 21059 exceeds max bind size 128 0000000000 45415445 20544142 4c452022 545f5849 EATE TAB LE " T_XI 0000000016 46454e46 45492220 28224f57 4e455222 FENF EI" ("OW NER" 0000000032 20564152 43484152 VAR CHAR 8480: column 1 type VARCHAR2 size 21059 failed 8480: row 1 failed row conversion failure, retrying from offset 8481 CPFL: Error: Zero (illegal) length column number 2 ………… CPFL: Error: Zero (illegal) length column number 1 9644: succesful conversion 1164 bytes skipped due to conversion problems 131877: row 1000 ok 253310: row 2000 ok ………… 12200617: row 90000 ok Unloaded 90915 rows, end of table marker at 12322835 [oracle@localhost CPFL]$ ls -ltr T_XIFENFEI.* -rw-r--r-- 1 oracle oinstall 17230747 Apr 27 22:12 T_XIFENFEI.dat -rw-r--r-- 1 oracle oinstall 1489 Apr 27 22:17 T_XIFENFEI.ctl
导入数据并对比
SQL> create table t_xifenfei_exp as select * from t_xifenfei where 1=0; Table created. [oracle@localhost CPFL]$ more T_XIFENFEI.ctl load data CHARACTERSET UTF8 infile 'T_XIFENFEI.dat' insert into table "T_XIFENFEI_EXP" ---修改为T_XIFENFEI_EXP表 fields terminated by whitespace ( "OWNER" CHAR(128) enclosed by X'7C' ,"OBJECT_NAME" CHAR(128) enclosed by X'7C' ,"SUBOBJECT_NAME" CHAR(29) enclosed by X'7C' ,"OBJECT_ID" CHAR(5) enclosed by X'7C' ,"DATA_OBJECT_ID" CHAR(5) enclosed by X'7C' ,"OBJECT_TYPE" CHAR(20) enclosed by X'7C' ,"CREATED" DATE "DD-MON-YYYY AD HH24:MI:SS" enclosed by X'7C' ,"LAST_DDL_TIME" DATE "DD-MON-YYYY AD HH24:MI:SS" enclosed by X'7C' ,"TIMESTAMP" CHAR(19) enclosed by X'7C' ,"STATUS" CHAR(5) enclosed by X'7C' ,"TEMPORARY" CHAR(1) enclosed by X'7C' ,"GENERATED" CHAR(1) enclosed by X'7C' ,"SECONDARY" CHAR(1) enclosed by X'7C' ,"NAMESPACE" CHAR(2) enclosed by X'7C' ,"EDITION_NAME" CHAR(1) enclosed by X'7C' ,"SHARING" CHAR(13) enclosed by X'7C' ,"EDITIONABLE" CHAR(1) enclosed by X'7C' ,"ORACLE_MAINTAINED" CHAR(1) enclosed by X'7C' ,"UNEXP_STATUS" FILLER CHAR(3) enclosed by X'7C' ) [oracle@localhost CPFL]$ sqlldr chf/xifenfei@pdb1 control=T_XIFENFEI.ctl SQL*Loader: Release 12.1.0.1.0 on Sun Apr 27 22:17:54 2014 Copyright (c) 1982, 2014, Oracle and/or its affiliates. All rights reserved. Path used: Conventional Commit point reached - logical record count 64 Commit point reached - logical record count 128 Commit point reached - logical record count 192 ………… Commit point reached - logical record count 90887 Commit point reached - logical record count 90915 Table "T_XIFENFEI_EXP": 90915 Rows successfully loaded. Check the log file: T_XIFENFEI.log for more information about the load. [oracle@localhost CPFL]$ sqlplus chf/xifenfei@pdb1 SQL*Plus: Release 12.1.0.2.0 Beta on Sun Apr 27 22:18:08 2014 Copyright (c) 1982, 2014, Oracle. All rights reserved. Last Successful login time: Sun Apr 27 2014 22:17:54 +08:00 Connected to: Oracle Database 12c Enterprise Edition Release 12.1.0.1.0 - 64bit With the Partitioning, OLAP, Advanced Analytics and Real Application Testing options SQL> select count(*) from t_xifenfei_exp; COUNT(*) ---------- 90915 SQL> select * from t_xifenfei 2 minus 3 select * from t_xifenfei_exp; no rows selected
通过这里可以看出来,在exp dmp文件有部分损坏的情况下,还是可以通过直接读取dmp文件的方式恢复全部或者部分exp dmp文件中内容(具体恢复量取决于dmp文件损坏程度)
如果你在使用这些思路进行恢复遇到突发情况不能自行解决,请联系我们(ORACLE数据库恢复技术支持),将为您提供专业数据库技术支持:
Phone:17813235971 Q Q:107644445 E-Mail:dba@xifenfei.com