设置内部事件使exp跳过坏块

来源:互联网 发布:电动螺丝刀 知乎 编辑:程序博客网 时间:2024/05/17 01:27


一、创建环境

[oracle@lucky archivelog]$ sqlplus / as sysdba



SQL*Plus: Release 11.2.0.1.0 Production on Thu Oct 2 14:35:13 2014


Copyright (c) 1982, 2009, Oracle.  All rights reserved.


Connected to:
Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - 64bit Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options


SQL> select name from v$datafile;


NAME
--------------------------------------------------------------------------------
/u01/app/oracle/oradata/orcl/system.dbf
/u01/app/oracle/oradata/orcl/sysaux.dbf
/u01/app/oracle/oradata/orcl/undotbs1.dbf
/u01/app/oracle/oradata/orcl/users.dbf
/u01/app/oracle/oradata/orcl/undotbs2.dbf


SQL> create tablespace eisoo datafile '/u01/eisoo.dbf' size 3M;


Tablespace created.


SQL> create user eisoo identified by eisoo default tablespace eisoo;


User created.


SQL> grant connect,resource to eisoo;


Grant succeeded.


SQL> conn eisoo/eisoo;
Connected.
SQL> create table eisoo tablespace eisoo as select * from all_tables;


Table created.


SQL> insert into eisoo select * from eisoo;


99 rows created.


SQL> /


198 rows created.


SQL> /


396 rows created.


SQL> /


792 rows created.


SQL> /


1584 rows created.



二、dbv验证(前)


[oracle@lucky orcl]$ dbv file='/u01/eisoo.dbf'


DBVERIFY: Release 11.2.0.1.0 - Production on Thu Oct 2 15:59:17 2014


Copyright (c) 1982, 2009, Oracle and/or its affiliates.  All rights reserved.


DBVERIFY - Verification starting : FILE = /u01/eisoo.dbf




DBVERIFY - Verification complete


Total Pages Examined         : 384
Total Pages Processed (Data) : 4
Total Pages Failing   (Data) : 0
Total Pages Processed (Index): 0
Total Pages Failing   (Index): 0
Total Pages Processed (Other): 127
Total Pages Processed (Seg)  : 0
Total Pages Failing   (Seg)  : 0
Total Pages Empty            : 253
Total Pages Marked Corrupt   : 0
Total Pages Influx           : 0
Total Pages Encrypted        : 0
Highest block SCN            : 56584840 (0.56584840)


三、UltraEdit编辑,制造坏块





四、dbv验证(后)

[oracle@lucky ~]$ dbv file='/u01/eisoo.dbf'


DBVERIFY: Release 11.2.0.1.0 - Production on Thu Oct 2 16:08:24 2014


Copyright (c) 1982, 2009, Oracle and/or its affiliates.  All rights reserved.


DBVERIFY - Verification starting : FILE = /u01/eisoo.dbf
Page 148 is marked corrupt
Corrupt block relative dba: 0x01800094 (file 6, block 148)
Bad check value found during dbv: 
Data in bad block:
 type: 6 format: 2 rdba: 0x01800094
 last change scn: 0x0000.035f6b23 seq: 0x1 flg: 0x06
 spare1: 0x0 spare2: 0x0 spare3: 0x0
 consistency value in tail: 0x6b230601
 check value in block header: 0x8a1e
 computed block checksum: 0x300






DBVERIFY - Verification complete


Total Pages Examined         : 384
Total Pages Processed (Data) : 109
Total Pages Failing   (Data) : 0
Total Pages Processed (Index): 0
Total Pages Failing   (Index): 0
Total Pages Processed (Other): 137
Total Pages Processed (Seg)  : 0
Total Pages Failing   (Seg)  : 0
Total Pages Empty            : 137
Total Pages Marked Corrupt   : 1
Total Pages Influx           : 0
Total Pages Encrypted        : 0
Highest block SCN            : 56584995 (0.56584995)







五、查看表,exp报错

SQL> select count(*) from eisoo;
select count(*) from eisoo
                     *
ERROR at line 1:
ORA-01578: ORACLE data block corrupted (file # 6, block # 148)
ORA-01110: data file 6: '/u01/eisoo.dbf'



[oracle@lucky ~]$ exp eisoo/eisoo file=eisoo.dmp tables=eisoo


Export: Release 11.2.0.1.0 - Production on Thu Oct 2 16:11:15 2014


Copyright (c) 1982, 2009, Oracle and/or its affiliates.  All rights reserved.




Connected to: Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - 64bit Production
With the Partitioning, OLAP, Data Mining and Real Application Testing 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                          EISOO
EXP-00056: ORACLE error 1578 encountered
ORA-01578: ORACLE data block corrupted (file # 6, block # 148)
ORA-01110: data file 6: '/u01/eisoo.dbf'
Export terminated successfully with warnings.


六、定位坏块类型

[oracle@lucky ~]$ sqlplus / as sysdba


SQL*Plus: Release 11.2.0.1.0 Production on Thu Oct 2 15:14:30 2014


Copyright (c) 1982, 2009, Oracle.  All rights reserved.




Connected to:
Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - 64bit Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options


SQL> SELECT tablespace_name, segment_type, owner, segment_name FROM dba_extents WHERE file_id = 6 and 138 between block_id AND block_id + blocks-1;


TABLESPACE_NAME                SEGMENT_TYPE       OWNER
------------------------------ ------------------ ------------------------------
SEGMENT_NAME
--------------------------------------------------------------------------------
EISOO                          TABLE              EISOO
EISOO



七、启动内部事件



SQL> ALTER SYSTEM SET EVENTS='10231 trace name context forever,level 10';


System altered.






八、导出表

[oracle@lucky ~]$ exp eisoo/eisoo file=eisoo.dmp tables=eisoo


Export: Release 11.2.0.1.0 - Production on Thu Oct 2 16:13:45 2014


Copyright (c) 1982, 2009, Oracle and/or its affiliates.  All rights reserved.




Connected to: Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - 64bit Production
With the Partitioning, OLAP, Data Mining and Real Application Testing 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                          EISOO       3139 rows exported
Export terminated successfully without warnings.



九、删除表
[oracle@lucky ~]$ sqlplus / as sysdba


SQL*Plus: Release 11.2.0.1.0 Production on Thu Oct 2 15:16:23 2014


Copyright (c) 1982, 2009, Oracle.  All rights reserved.




Connected to:
Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - 64bit Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options


SQL> conn eisoo/eisoo;
Connected.
SQL> drop table eisoo;


Table dropped.


SQL> exit
Disconnected from Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - 64bit Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options




十、导入表

[oracle@lucky ~]$ imp eisoo/eisoo file=eisoo.dmp tables=eisoo


Import: Release 11.2.0.1.0 - Production on Thu Oct 2 16:14:49 2014


Copyright (c) 1982, 2009, Oracle and/or its affiliates.  All rights reserved.




Connected to: Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - 64bit Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options


Export file created by EXPORT:V11.02.00 via conventional path
import done in US7ASCII character set and AL16UTF16 NCHAR character set
import server uses ZHS16GBK character set (possible charset conversion)
. importing EISOO's objects into EISOO
. importing EISOO's objects into EISOO
. . importing table                        "EISOO"       3139 rows imported
Import terminated successfully without warnings.



十一、查看表、dbv验证


[oracle@lucky ~]$ sqlplus / as sysdba


SQL*Plus: Release 11.2.0.1.0 Production on Thu Oct 2 16:15:18 2014


Copyright (c) 1982, 2009, Oracle.  All rights reserved.




Connected to:
Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - 64bit Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options


SQL> conn eisoo/eisoo;
Connected.
SQL> select count(*) from eisoo;


  COUNT(*)
----------
      3139
 
 
 
[oracle@lucky ~]$ dbv file='/u01/eisoo.dbf'


DBVERIFY: Release 11.2.0.1.0 - Production on Thu Oct 2 16:15:11 2014


Copyright (c) 1982, 2009, Oracle and/or its affiliates.  All rights reserved.


DBVERIFY - Verification starting : FILE = /u01/eisoo.dbf
Page 148 is marked corrupt
Corrupt block relative dba: 0x01800094 (file 6, block 148)
Bad check value found during dbv: 
Data in bad block:
 type: 6 format: 2 rdba: 0x01800094
 last change scn: 0x0000.035f6b23 seq: 0x1 flg: 0x06
 spare1: 0x0 spare2: 0x0 spare3: 0x0
 consistency value in tail: 0x6b230601
 check value in block header: 0x8a1e
 computed block checksum: 0x300






DBVERIFY - Verification complete


Total Pages Examined         : 384
Total Pages Processed (Data) : 109
Total Pages Failing   (Data) : 0
Total Pages Processed (Index): 0
Total Pages Failing   (Index): 0
Total Pages Processed (Other): 137
Total Pages Processed (Seg)  : 0
Total Pages Failing   (Seg)  : 0
Total Pages Empty            : 137
Total Pages Marked Corrupt   : 1
Total Pages Influx           : 0
Total Pages Encrypted        : 0

Highest block SCN            : 56584995 (0.56584995)


十二、关闭内部事件


SQL> alter system set events='10231 trace name context off';


System altered.

 
 









0 0
原创粉丝点击