业务部门提示:
更新被延迟,请等待
ST22问题报错信息:
Database error text: "SQL message: ORA-01578: ORACLE data block corrupted
(file # 186, block # 1638069)#ORA-01110: data file 186:
'/oracle/PRD/sapdata2/sr3_151/sr3.data152'"
解决方案:
1.在linux 下切换到oracle账号
su - oraprd
2.运行sqlplus
sqlplus / as sysdba
3.运行查询数据文件查询语句
select name from v$datafile;
4.切换到root账号,运行dbv,校验所有的数据文件。
例如:
dbv file=/oracle/PRD/sapdata2/sr3_112/sr3.data113 blocksize=8192
dbv file=/oracle/PRD/sapdata2/sr3_113/sr3.data114 blocksize=8192
dbv file=/oracle/PRD/sapdata2/sr3_114/sr3.data115 blocksize=8192
dbv file=/oracle/PRD/sapdata2/sr3_115/sr3.data116 blocksize=8192
dbv file=/oracle/PRD/sapdata2/sr3_116/sr3.data117 blocksize=8192
dbv file=/oracle/PRD/sapdata2/sr3_117/sr3.data118 blocksize=8192
dbv file=/oracle/PRD/sapdata2/sr3_118/sr3.data119 blocksize=8192
dbv file=/oracle/PRD/sapdata2/sr3_119/sr3.data120 blocksize=8192
dbv file=/oracle/PRD/sapdata2/sr3_120/sr3.data121 blocksize=8192
dbv file=/oracle/PRD/sapdata2/sr3_121/sr3.data122 blocksize=8192
dbv file=/oracle/PRD/sapdata2/sr3_122/sr3.data123 blocksize=8192
dbv file=/oracle/PRD/sapdata2/sr3_123/sr3.data124 blocksize=8192
dbv file=/oracle/PRD/sapdata2/sr3_124/sr3.data125 blocksize=8192
5.再次切换到oracle账号,运行sqlplus
su - oraprd
sqlplus / as sysdba
6.运行SELECT * FROM V$DATABASE_BLOCK_CORRUPTION;
此语句会查询到所有的坏块文件
7.切换到RMAN运行修复命令(官方给的修复命令:RECOVER CORRUPTION LIST;)
RMAN> run{
2> ALLOCATE CHANNEL ch0 TYPE 'SBT_TAPE';
3> blockrecover corruption list;
4> release channel ch0;
5> }
显示如下:
released channel: ORA_DISK_1
allocated channel: ch0
channel ch0: SID=604 device type=SBT_TAPE
channel ch0: Symantec/BackupExec/1.1.0
Starting recover at 07-MAR-18
channel ch0: restoring block(s)
channel ch0: specifying block(s) to restore from backup set
restoring blocks of datafile 00186
channel ch0: reading from backup piece BE_bhssu7ad_1_1
channel ch0: piece handle=BE_bhssu7ad_1_1 tag=TAG20180304T051101
channel ch0: restored block(s) from backup piece 1
channel ch0: block restore complete, elapsed time: 01:38:25
failover to previous backup
channel ch0: restoring block(s)
channel ch0: specifying block(s) to restore from backup set
restoring blocks of datafile 00186
channel ch0: reading from backup piece BE_avssr3ic_1_1
channel ch0: piece handle=BE_avssr3ic_1_1 tag=TAG20180303T010236
channel ch0: restored block(s) from backup piece 1
channel ch0: block restore complete, elapsed time: 01:12:25
failover to previous backup
channel ch0: restoring block(s)
channel ch0: specifying block(s) to restore from backup set
restoring blocks of datafile 00186
channel ch0: reading from backup piece BE_8gss3g86_1_1
channel ch0: piece handle=BE_8gss3g86_1_1 tag=TAG20180225T050035
channel ch0: restored block(s) from backup piece 1
channel ch0: block restore complete, elapsed time: 01:09:16
starting media recovery
media recovery complete, elapsed time: 00:07:35
Finished recover at 07-MAR-18
released channel: ch0
RMAN>
此方案完结
————
能用但是不能根除问题的方案如下:
RMAN> run{
ALLOCATE CHANNEL ch0 TYPE 'SBT_TAPE';
SEND 'BSA_SERVICE_HOST=BE2015,NBBSA_TOTAL_STREAMS=1,NBBSA_JOB_COOKIE={C0C0EF66-87CE-43F3-9E09-5786605E09CC},NBBSA_DB_DEVICE_NAME=Oracle-Linux::\bvprddb.byvin.com\PRD';
restore datafile 197,198;
release channel ch0;
}2> 3> 4> 5> 6>
using target database control file instead of recovery catalog
allocated channel: ch0
channel ch0: SID=625 device type=SBT_TAPE
channel ch0: Symantec/BackupExec/1.1.0
sent command to channel: ch0
Starting restore at 02-MAR-18
channel ch0: starting datafile backup set restore
channel ch0: specifying datafile(s) to restore from backup set
channel ch0: restoring datafile 00197 to /oracle/PRD/sapdata2/sr3_162/sr3.data163
channel ch0: reading from backup piece BE_8fss3b7l_1_1
channel ch0: piece handle=BE_8fss3b7l_1_1 tag=TAG20180225T050035
channel ch0: restored backup piece 1
channel ch0: restore complete, elapsed time: 01:07:26
channel ch0: starting datafile backup set restore
channel ch0: specifying datafile(s) to restore from backup set
channel ch0: restoring datafile 00198 to /oracle/PRD/sapdata2/sr3_163/sr3.data164
channel ch0: reading from backup piece BE_8gss3g86_1_1
channel ch0: piece handle=BE_8gss3g86_1_1 tag=TAG20180225T050035
channel ch0: restored backup piece 1
channel ch0: restore complete, elapsed time: 01:08:36
Finished restore at 03-MAR-18
released channel: ch0
退出rman
进入sqlplus
运行 recover datafile 197 198
模式选择AUTO