某天一台数据库测试机出现
ORA-01578,虽说这是测试机但是这是客户用的,随便处理也不行,仔细研究一下。
ORA-01578: ORACLE data block corrupted (file # 2, block # 69449)
ORA-01110: data file 2: '/oracle/app/oradata/BOSS/sysaux01.dbf'
看看是在什么对象上
SELECT SEGMENT_TYPE,OWNER||'.'||SEGMENT_NAME FROM DBA_EXTENTS WHERE file_id = 2 AND 69450 BETWEEN BLOCK_ID AND BLOCK_ID+BLOCKS -1;
用dbv看看能不能看到什么情况
dbv file =/oracle/app/oradata/BOSS/sysaux01.dbf
[14:26:30 oracle@SXWG]/home/oracle>dbv file =/oracle/app/oradata/BOSS/sysaux01.dbf
DBVERIFY: Release 11.2.0.3.0 - Production on Wed Nov 6 14:26:35 2013
Copyright (c) 1982, 2011, Oracle and/or its affiliates. All rights reserved.
DBVERIFY - Verification starting : FILE = /oracle/app/oradata/BOSS/sysaux01.dbf
DBV-00200: Block, DBA 8458057, already marked corrupt
DBVERIFY - Verification complete
Total Pages Examined : 256000
Total Pages Processed (Data) : 36210
Total Pages Failing (Data) : 0
Total Pages Processed (Index): 36703
Total Pages Failing (Index): 0
Total Pages Processed (Lob) : 9340
Total Pages Failing (Lob) : 0
Total Pages Processed (Other): 26128
Total Pages Processed (Seg) : 0
Total Pages Failing (Seg) : 0
Total Pages Empty : 147619
Total Pages Marked Corrupt : 1
Total Pages Influx : 0
Total Pages Encrypted : 0
Highest block SCN : 55800797 (0.55800797)
尼玛看不到什么问题
看看可以直接rebulit不
14:33:18 sys@BOSS> alter index SYSMAN.MGMT_METRICS_RAW_PK REBUILD tablespace system online nologging;
alter index SYSMAN.MGMT_METRICS_RAW_PK REBUILD tablespace system online nologging
*
ERROR at line 1:
ORA-28650: Primary index on an IOT cannot be rebuilt
用下面这句也看不到什么情况
dbv file=/oracle/app/oradata/BOSS/sysaux01.dbf blocksize=8192
用这个检查,也不知道什么
RMAN> BACKUP CHECK LOGICAL VALIDATE DATAFILE 2;
Starting backup at 06-NOV-13
using target database control file instead of recovery catalog
allocated channel: ORA_DISK_1
channel ORA_DISK_1: SID=575 device type=DISK
channel ORA_DISK_1: starting full datafile backup set
channel ORA_DISK_1: specifying datafile(s) in backup set
input datafile file number=00002 name=/oracle/app/oradata/BOSS/sysaux01.dbf
channel ORA_DISK_1: backup set complete, elapsed time: 00:00:03
List of Datafiles
=================
File Status Marked Corrupt Empty Blocks Blocks Examined High SCN
---- ------ -------------- ------------ --------------- ----------
2 OK 1 147619 256017 55833984
File Name: /oracle/app/oradata/BOSS/sysaux01.dbf
Block Type Blocks Failing Blocks Processed
---------- -------------- ----------------
Data 0 36210
Index 0 36703
Other 0 35468
想移表再重建索引,好像也不行
alter table SYSMAN.MGMT_METRICS_RAW move tablespace system;
alter table SYSMAN.MGMT_METRICS_RAW move tablespace system
*
ERROR at line 1:
ORA-01578: ORACLE data block corrupted (file # 2, block # 69449)
ORA-01110: data file 2: '/oracle/app/oradata/BOSS/sysaux01.dbf'
看看在哪个列上
select table_name,COLUMN_NAME from dba_ind_columns where index_name='MGMT_METRICS_RAW_PK';
打算把它drop掉再建,先看看创建语句先。
select dbms_metadata.get_ddl('INDEX','MGMT_METRICS_RAW_PK','SYSMAN') from dual;
CREATE UNIQUE INDEX "SYSMAN"."MGMT_METRICS_RAW_PK" ON "SYSMAN"."MGMT_METRICS_RAW" ("TARGET_GUID", "METRIC_GUID", "KEY_VALUE", "COLLECTION_TIMESTAMP")
PCTFREE 0 INITRANS 4 MAXTRANS 255 COMPUTE STATISTICS COMPRESS 3
STORAGE(INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645
PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1
BUFFER_POOL DEFAULT FLASH_CACHE DEFAULT CELL_FLASH_CACHE DEFAULT)
TABLESPACE "SYSAUX"
drop index SYSMAN.MGMT_METRICS_RAW_PK ;
尼玛发现drop不了,主键约束
看看能不能把约束先drop了
select CONSTRAINT_NAME,CONSTRAINT_type from dba_constraints where table_name='MGMT_METRICS_RAW';
尼玛又不能drop
alter table sysman.MGMT_METRICS_RAW drop constraint MGMT_METRICS_RAW_PK;
16:25:14 sys@BOSS> alter table sysman.MGMT_METRICS_RAW drop constraint MGMT_METRICS_RAW_PK;
alter table sysman.MGMT_METRICS_RAW drop constraint MGMT_METRICS_RAW_PK
*
ERROR at line 1:
ORA-25188: cannot drop/disable/defer the primary key constraint for index-organized tables or sorted hash cluster
想试试能不能把数据导出,再把用户清了重导
nohup exp sysman/oracle buffer=48000000 file=/data/backup/sysman.dmp log=/data/backup/sysman.log &
nohup exp sysman/oracle buffer=48000000 file=/data/backup/sysman2.dmp log=/data/backup/sysman2.log tables=MGMT_METRICS_RAW &
事实证明这个也不行。。。
打算拷一个表的数据
create table SYSMAN.MGMT_METRICS_RAW_COPY as select * from SYSMAN.MGMT_METRICS_RAW;
create table SYSMAN.MGMT_METRICS_RAW_COPY tablespace system as select * from SYSMAN.MGMT_METRICS_RAW;
16:48:04 sys@BOSS> create table SYSMAN.MGMT_METRICS_RAW_COPY tablespace system as select * from SYSMAN.MGMT_METRICS_RAW;
create table SYSMAN.MGMT_METRICS_RAW_COPY tablespace system as select * from SYSMAN.MGMT_METRICS_RAW
*
ERROR at line 1:
ORA-01578: ORACLE data block corrupted (file # 2, block # 69449)
ORA-01110: data file 2: '/oracle/app/oradata/BOSS/sysaux01.dbf'
尼玛这都不行。。。
最后放个大招解决了
emca -deconfig dbcontrol db -repos drop
emca -config dbcontrol db -repos create