Oracle-36-问题诊断

这里我们介绍11G引入的ADRCI来解决问题诊断

模拟性能问题

新建表空间,新建表

SYS@ orcl>create tablespace tbs1 datafile '/home/oracle/tbs01.dbf' size 1m;

Tablespace created.

Elapsed: 00:00:00.33
SYS@ orcl>create table scott.t01 tablespace tbs1 as select * from scott.emp;

Table created.

Elapsed: 00:00:00.20

增加数据

SYS@ orcl>insert into scott.t01 select * from scott.t01;

14 rows created.

Elapsed: 00:00:00.02
SYS@ orcl>/

28 rows created.

Elapsed: 00:00:00.00
SYS@ orcl>/

56 rows created.

Elapsed: 00:00:00.00
SYS@ orcl>/

112 rows created.

Elapsed: 00:00:00.00
SYS@ orcl>/

224 rows created.

Elapsed: 00:00:00.00
SYS@ orcl>/

448 rows created.

Elapsed: 00:00:00.01
SYS@ orcl>/

896 rows created.

Elapsed: 00:00:00.00
SYS@ orcl>/

1792 rows created.

Elapsed: 00:00:00.00
SYS@ orcl>/

3584 rows created.

Elapsed: 00:00:00.01
SYS@ orcl>/

7168 rows created.

Elapsed: 00:00:00.01
SYS@ orcl>/
insert into scott.t01 select * from scott.t01
*
ERROR at line 1:
ORA-01653: unable to extend table SCOTT.T01 by 8 in tablespace TBS1


Elapsed: 00:00:00.08

提交数据

SYS@ orcl>commit;

Commit complete.

Elapsed: 00:00:00.00

插入数据到不能插入为止

SYS@ orcl>/
insert into scott.t01 select * from scott.t01 where rownum=1
*
ERROR at line 1:
ORA-01653: unable to extend table SCOTT.T01 by 8 in tablespace TBS1


Elapsed: 00:00:00.02

提交数据

SYS@ orcl>commit;

Commit complete.

Elapsed: 00:00:00.00

产生检查点

SYS@ orcl>alter system checkpoint;

System altered.

Elapsed: 00:00:00.12

进入RMAN对表空间进行备份

首先将之前的备份删掉

RMAN> delete backup;

allocated channel: ORA_DISK_1
channel ORA_DISK_1: SID=33 device type=DISK

List of Backup Pieces
BP Key  BS Key  Pc# Cp# Status      Device Type Piece Name
------- ------- --- --- ----------- ----------- ----------
35      27      1   1   AVAILABLE   DISK        +FLASH/orcl/backupset/2018_07_28/nnndf0_tag20180728t120418_0.297.982670659
36      28      1   1   AVAILABLE   DISK        +FLASH/orcl/backupset/2018_07_28/ncsnf0_tag20180728t120418_0.296.982670685
37      29      1   1   AVAILABLE   DISK        +FLASH/orcl/backupset/2018_07_28/nnndn0_tag20180728t121320_0.303.982671201

Do you really want to delete the above objects (enter YES or NO)? yes
deleted backup piece
backup piece handle=+FLASH/orcl/backupset/2018_07_28/nnndf0_tag20180728t120418_0.297.982670659 RECID=35 STAMP=982670659
deleted backup piece
backup piece handle=+FLASH/orcl/backupset/2018_07_28/ncsnf0_tag20180728t120418_0.296.982670685 RECID=36 STAMP=982670685
deleted backup piece
backup piece handle=+FLASH/orcl/backupset/2018_07_28/nnndn0_tag20180728t121320_0.303.982671201 RECID=37 STAMP=982671200
Deleted 3 objects
RMAN> delete copy;

released channel: ORA_DISK_1
allocated channel: ORA_DISK_1
channel ORA_DISK_1: SID=33 device type=DISK
specification does not match any datafile copy in the repository
RMAN-08138: WARNING: archived log not deleted - must create more backups
archived log file name=+FLASH/orcl/archivelog/2018_07_26/thread_1_seq_25.299.982495253 thread=1 sequence=25
RMAN-08138: WARNING: archived log not deleted - must create more backups
archived log file name=+FLASH/orcl/archivelog/2018_07_26/thread_1_seq_26.300.982495253 thread=1 sequence=26
RMAN-08138: WARNING: archived log not deleted - must create more backups
archived log file name=+FLASH/orcl/archivelog/2018_07_26/thread_1_seq_27.301.982495255 thread=1 sequence=27
RMAN-08138: WARNING: archived log not deleted - must create more backups
archived log file name=+FLASH/orcl/archivelog/2018_07_26/thread_1_seq_28.302.982495255 thread=1 sequence=28
RMAN-08138: WARNING: archived log not deleted - must create more backups
archived log file name=+FLASH/orcl/archivelog/2018_07_26/thread_1_seq_1.304.982535837 thread=1 sequence=1
RMAN-08138: WARNING: archived log not deleted - must create more backups
archived log file name=+FLASH/orcl/archivelog/2018_07_26/thread_1_seq_2.305.982535837 thread=1 sequence=2
RMAN-08138: WARNING: archived log not deleted - must create more backups
archived log file name=+FLASH/orcl/archivelog/2018_07_26/thread_1_seq_3.306.982535839 thread=1 sequence=3
RMAN-08138: WARNING: archived log not deleted - must create more backups
archived log file name=+FLASH/orcl/archivelog/2018_07_26/thread_1_seq_4.307.982535839 thread=1 sequence=4
RMAN-08138: WARNING: archived log not deleted - must create more backups
archived log file name=+FLASH/orcl/archivelog/2018_07_26/thread_1_seq_5.309.982536121 thread=1 sequence=5
RMAN-08138: WARNING: archived log not deleted - must create more backups
archived log file name=+FLASH/orcl/archivelog/2018_07_26/thread_1_seq_6.310.982536123 thread=1 sequence=6
RMAN-08138: WARNING: archived log not deleted - must create more backups
archived log file name=+FLASH/orcl/archivelog/2018_07_26/thread_1_seq_7.311.982536123 thread=1 sequence=7
RMAN-08138: WARNING: archived log not deleted - must create more backups
archived log file name=+FLASH/orcl/archivelog/2018_07_26/thread_1_seq_8.312.982536125 thread=1 sequence=8
RMAN-08138: WARNING: archived log not deleted - must create more backups
archived log file name=+FLASH/orcl/archivelog/2018_07_26/thread_1_seq_9.314.982536301 thread=1 sequence=9
RMAN-08138: WARNING: archived log not deleted - must create more backups
archived log file name=+FLASH/orcl/archivelog/2018_07_26/thread_1_seq_10.315.982536303 thread=1 sequence=10
RMAN-08138: WARNING: archived log not deleted - must create more backups
archived log file name=+FLASH/orcl/archivelog/2018_07_26/thread_1_seq_11.316.982536305 thread=1 sequence=11
RMAN-08138: WARNING: archived log not deleted - must create more backups
archived log file name=+FLASH/orcl/archivelog/2018_07_26/thread_1_seq_12.317.982536307 thread=1 sequence=12
RMAN-08138: WARNING: archived log not deleted - must create more backups
archived log file name=+FLASH/orcl/archivelog/2018_07_26/thread_1_seq_13.318.982536395 thread=1 sequence=13
RMAN-08138: WARNING: archived log not deleted - must create more backups
archived log file name=+FLASH/orcl/archivelog/2018_07_26/thread_1_seq_14.319.982536397 thread=1 sequence=14
RMAN-08138: WARNING: archived log not deleted - must create more backups
archived log file name=+FLASH/orcl/archivelog/2018_07_26/thread_1_seq_15.320.982536397 thread=1 sequence=15
RMAN-08138: WARNING: archived log not deleted - must create more backups
archived log file name=+FLASH/orcl/archivelog/2018_07_26/thread_1_seq_16.321.982536397 thread=1 sequence=16
RMAN-08138: WARNING: archived log not deleted - must create more backups
archived log file name=+FLASH/orcl/archivelog/2018_07_30/thread_1_seq_17.295.982861405 thread=1 sequence=17
RMAN-08138: WARNING: archived log not deleted - must create more backups
archived log file name=+FLASH/orcl/archivelog/2018_07_30/thread_1_seq_17.295.982861405 thread=1 sequence=17
RMAN-08138: WARNING: archived log not deleted - must create more backups
archived log file name=+FLASH/orcl/archivelog/2018_07_30/thread_1_seq_18.293.982861405 thread=1 sequence=18
RMAN-08138: WARNING: archived log not deleted - must create more backups
archived log file name=+FLASH/orcl/archivelog/2018_07_30/thread_1_seq_18.293.982861405 thread=1 sequence=18
RMAN-08138: WARNING: archived log not deleted - must create more backups
archived log file name=+FLASH/orcl/archivelog/2018_07_30/thread_1_seq_19.294.982861405 thread=1 sequence=19
List of Control File Copies
===========================

Key     S Completion Time Ckp SCN    Ckp Time       
------- - --------------- ---------- ---------------
11      A 27-JUL-18       1238400    27-JUL-18      
        Name: /u01/app/oracle/product/11.2.0/db_1/dbs/snapcf_orcl.f
        Tag: TAG20180727T170911


Do you really want to delete the above objects (enter YES or NO)? yes

RMAN-06207: WARNING: 1 objects could not be deleted for DISK channel(s) due
RMAN-06208:          to mismatched status.  Use CROSSCHECK command to fix status
RMAN-06210: List of Mismatched objects
RMAN-06211: ==========================
RMAN-06212:   Object Type   Filename/Handle
RMAN-06213: --------------- ---------------------------------------------------
RMAN-06214: Datafile Copy   /u01/app/oracle/product/11.2.0/db_1/dbs/snapcf_orcl.f
RMAN> list backup;

specification does not match any backup in the repository

RMAN> list copy;

specification does not match any datafile copy in the repository
specification does not match any control file copy in the repository
specification does not match any archived log in the repository

RMAN> list archivelog all;

specification does not match any archived log in the repository

查看用户下的对象

RMAN> report schema;

Report of database schema for database with db_unique_name ORCL

List of Permanent Datafiles
===========================
File Size(MB) Tablespace           RB segs Datafile Name
---- -------- -------------------- ------- ------------------------
1    740      SYSTEM               ***     +DATA/orcl/datafile/system.262.982496287
2    490      SYSAUX               ***     +DATA/orcl/datafile/sysaux.261.982496287
3    45       UNDOTBS1             ***     +DATA/orcl/datafile/undotbs1.268.982496287
4    1024     USERS                ***     +DATA/orcl/datafile/users.263.982496287
5    100      EXAMPLE              ***     +DATA/orcl/datafile/example.260.982496287
6    0        TEST                 ***     +DATA/orcl/datafile/test.265.982496287
7    0        TEST                 ***     +DATA/orcl/datafile/test.267.982496287
8    1        TBS1                 ***     /home/oracle/tbs01.dbf

List of Temporary Files
=======================
File Size(MB) Tablespace           Maxsize(MB) Tempfile Name
---- -------- -------------------- ----------- --------------------
1    20       TEMP                 32767       +DATA/orcl/tempfile/temp.256.982496437

备份8号数据文件

RMAN> backup datafile 8;

Starting backup at 30-JUL-18
using channel ORA_DISK_1
channel ORA_DISK_1: starting full datafile backup set
channel ORA_DISK_1: specifying datafile(s) in backup set
input datafile file number=00008 name=/home/oracle/tbs01.dbf
channel ORA_DISK_1: starting piece 1 at 30-JUL-18
channel ORA_DISK_1: finished piece 1 at 30-JUL-18
piece handle=+FLASH/orcl/backupset/2018_07_30/nnndf0_tag20180730t231035_0.294.982883435 tag=TAG20180730T231035 comment=NONE
channel ORA_DISK_1: backup set complete, elapsed time: 00:00:01
Finished backup at 30-JUL-18

切换日志

SYS@ orcl>alter system switch logfile;

System altered.

Elapsed: 00:00:00.04
SYS@ orcl>/

System altered.

Elapsed: 00:00:00.05
SYS@ orcl>/

System altered.

Elapsed: 00:00:00.97
SYS@ orcl>/

System altered.

Elapsed: 00:00:00.44

模拟坏块

SYS@ orcl>select name from v$datafile;

NAME
------------------------------------------------------------
+DATA/orcl/datafile/system.262.982496287
+DATA/orcl/datafile/sysaux.261.982496287
+DATA/orcl/datafile/undotbs1.268.982496287
+DATA/orcl/datafile/users.263.982496287
+DATA/orcl/datafile/example.260.982496287
+DATA/orcl/datafile/test.265.982496287
+DATA/orcl/datafile/test.267.982496287
/home/oracle/tbs01.dbf

8 rows selected.

Elapsed: 00:00:00.08
SYS@ orcl>alter tablespace tbs1 offline;

Tablespace altered.

Elapsed: 00:00:00.10

用VI编辑器编辑数据文件,更改里面部分字符

然后将表空间重新online

SYS@ orcl>alter tablespace tbs1 online;

Tablespace altered.

Elapsed: 00:00:00.07

再次查询表的数据

SYS@ orcl>select count(1) from scott.t01;
select count(1) from scott.t01
                           *
ERROR at line 1:
ORA-01578: ORACLE data block corrupted (file # 8, block # 20)
ORA-01110: data file 8: '/home/oracle/tbs01.dbf'


Elapsed: 00:00:02.92

提示数据块损坏

使用ADR查看问题

[oracle@RHEL6 ~]$ adrci

ADRCI: Release 11.2.0.1.0 - Production on Mon Jul 30 23:20:38 2018

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

ADR base = "/u01/app/oracle"

查看所有产品目录

adrci> show homes;
ADR Homes: 
diag/rdbms/dummy/orcl
diag/rdbms/orcl/orcl

设置目录

adrci> set home diag/rdbms/orcl/orcl

查看告警信息

adrci> show alert -tail 20
2018-07-30 23:18:56.672000 +08:00
 type: 6 format: 2 rdba: 0x02000014
 last change scn: 0x0000.0013300b seq: 0x1 flg: 0x06
 spare1: 0x0 spare2: 0x0 spare3: 0x0
 consistency value in tail: 0x300b0601
 check value in block header: 0x5dff
 computed block checksum: 0x4e1d
Reread of blocknum=20, file=/home/oracle/tbs01.dbf. found same corrupt data
Reread of blocknum=20, file=/home/oracle/tbs01.dbf. found same corrupt data
Reread of blocknum=20, file=/home/oracle/tbs01.dbf. found same corrupt data
Reread of blocknum=20, file=/home/oracle/tbs01.dbf. found same corrupt data
Reread of blocknum=20, file=/home/oracle/tbs01.dbf. found same corrupt data
Errors in file /u01/app/oracle/diag/rdbms/orcl/orcl/trace/orcl_ora_2720.trc  (incident=52986):
ORA-01578: ORACLE data block corrupted (file # 8, block # 20)
ORA-01110: data file 8: '/home/oracle/tbs01.dbf'
Incident details in: /u01/app/oracle/diag/rdbms/orcl/orcl/incident/incdir_52986/orcl_ora_2720_i52986.trc
Trace dumping is performing id=[cdmp_20180730231856]
2018-07-30 23:18:58.177000 +08:00
Checker run found 1 new persistent data failures
Trace dumping is performing id=[cdmp_20180730231858]
2018-07-30 23:19:58.428000 +08:00
Sweep [inc][52986]: completed
Sweep [inc2][52986]: completed

我们只查看报错信息

adrci> show alert -p "MESSAGE_TEXT like 'ORA-%'"

ADR Home = /u01/app/oracle/diag/rdbms/orcl/orcl:
*************************************************************************
Output the results to file: /tmp/alert_3141_14067_orcl_1.ado

2018-07-22 13:32:23.259000 +08:00
ORA-1109 signalled during: ALTER DATABASE CLOSE NORMAL...
2018-07-22 13:47:41.519000 +08:00
ORA-1119 signalled during: CREATE TABLESPACE DATA DATAFILE '/u01/app/oradata/sundb/sundb1.dbf' SIZE 800M AUTOEXTEND ON EXTENT MANAGEMENT LOCAL SEGMENT SPACE MANAGEMENT AUTO...
2018-07-22 13:52:37.062000 +08:00
ORA-1119 signalled during: CREATE TABLESPACE DATA DATAFILE '/u01/app/oradata/orcl/orcl.dbf' SIZE 800M AUTOEXTEND ON EXTENT MANAGEMENT LOCAL SEGMENT SPACE MANAGEMENT AUTO...
2018-07-22 14:29:09.882000 +08:00
ORA-1516 signalled during: alter database datafile '+DATA/sundb/datafile/data01.275.975123385' resize 20m...
2018-07-22 18:51:21.995000 +08:00
ORA-15000: command disallowed by current instance type
2018-07-22 22:30:35.847000 +08:00
ORA-1092 : opitsk aborting process
2018-07-25 15:39:14.568000 +08:00
ORA-1507 signalled during: ALTER DATABASE CLOSE NORMAL...
2018-07-25 17:03:48.373000 +08:00
ORA-00210: ???????????
ORA-00202: ????: ''+FLASH/orcl/controlfile/current.256.982157551''
ORA-17503: ksfdopn: 2 ?????? +FLASH/orcl/controlfile/current.256.982157551
ORA-15012: ASM file '+FLASH/orcl/controlfile/current.256.982157551' does not exist
ORA-00210: ???????????
ORA-00202: ????: ''+DATA/orcl/controlfile/current.260.982157551''
ORA-17503: ksfdopn: 2 ?????? +DATA/orcl/controlfile/current.260.982157551
ORA-15012: ASM file '+DATA/orcl/controlfile/current.260.982157551' does not exist
ORA-205 signalled during: ALTER DATABASE   MOUNT...
2018-07-25 17:16:14.541000 +08:00
ORA-1589 signalled during: alter database open...

查看严重错误信息

adrci> show incident

ADR Home = /u01/app/oracle/diag/rdbms/orcl/orcl:
*************************************************************************
INCIDENT_ID          PROBLEM_KEY                                                 CREATE_TIME                              
-------------------- ----------------------------------------------------------- ---------------------------------------- 
52985                ORA 1578                                                    2018-07-30 23:18:55.370000 +08:00       
52986                ORA 1578                                                    2018-07-30 23:18:56.672000 +08:00       
2 rows fetched
adrci> show problem

ADR Home = /u01/app/oracle/diag/rdbms/orcl/orcl:
*************************************************************************
PROBLEM_ID           PROBLEM_KEY                                                 LAST_INCIDENT        LASTINC_TIME                             
-------------------- ----------------------------------------------------------- -------------------- ---------------------------------------- 
1                    ORA 1578                                                    52986                2018-07-30 23:18:56.672000 +08:00       
1 rows fetched

查看问题的跟踪文件

adrci> ips pack incident 52985

Generated package 1 in file /home/oracle/ORA1578_20180730233120_COM_1.zip, mode complete
adrci> 

查看文件内容

创建目录并解压缩

[oracle@RHEL6 ~]$ mkdir error
adrci> ips unpack file /home/oracle/ORA1578_20180730233120_COM_1.zip /home/oracle/error
Unpacking file /home/oracle/ORA1578_20180730233120_COM_1.zip into target /home/oracle/error

之后可以将zip文件上传给Oracle技术支持

发现数据库有坏块,我们用RMAN进行恢复

查看错误

RMAN> list failure;

using target database control file instead of recovery catalog
List of Database Failures
=========================

Failure ID Priority Status    Time Detected Summary
---------- -------- --------- ------------- -------
1476       HIGH     OPEN      30-JUL-18     Datafile 8: '/home/oracle/tbs01.dbf' contains one or more corrupt blocks
1208       HIGH     OPEN      28-JUL-18     Tablespace 8: 'TEST' is offline
1196       HIGH     OPEN      28-JUL-18     One or more non-system datafiles are offline
RMAN> advise failure;

List of Database Failures
=========================

Failure ID Priority Status    Time Detected Summary
---------- -------- --------- ------------- -------
1476       HIGH     OPEN      30-JUL-18     Datafile 8: '/home/oracle/tbs01.dbf' contains one or more corrupt blocks
1208       HIGH     OPEN      28-JUL-18     Tablespace 8: 'TEST' is offline
1196       HIGH     OPEN      28-JUL-18     One or more non-system datafiles are offline

analyzing automatic repair options; this may take some time
allocated channel: ORA_DISK_1
channel ORA_DISK_1: SID=37 device type=DISK
analyzing automatic repair options complete

Mandatory Manual Actions
========================
no manual actions available

Optional Manual Actions
=======================
no manual actions available

Automated Repair Options
========================
Option Repair Description
------ ------------------
1      Perform block media recovery of block 20 in file 8; Online tablespace TEST 
  Strategy: The repair includes complete media recovery with no data loss
  Repair script: /u01/app/oracle/diag/rdbms/orcl/orcl/hm/reco_3000371532.hm

查看建议

[oracle@RHEL6 orcl]$ more /u01/app/oracle/diag/rdbms/orcl/orcl/hm/reco_3000371532.hm
   # block media recovery
   recover datafile 8 block 20;
   # online a offline tablespace
   sql "begin sys.dbms_ir.execsqlscript(filename => ''/u01/app/oracle/diag/rdbms/orcl/orcl/hm/reco_332738037
.hm'' ); end;";

修复

RMAN> repair failure;

Strategy: The repair includes complete media recovery with no data loss
Repair script: /u01/app/oracle/diag/rdbms/orcl/orcl/hm/reco_3000371532.hm

contents of repair script:
   # block media recovery
   recover datafile 8 block 20;
   # online a offline tablespace
   sql "begin sys.dbms_ir.execsqlscript(filename => ''/u01/app/oracle/diag/rdbms/orcl/orcl/hm/reco_332738037.hm'' ); end;";

Do you really want to execute the above repair (enter YES or NO)? yes
executing repair script

Starting recover at 30-JUL-18
using channel ORA_DISK_1
searching flashback logs for block images until SCN 1259459
finished flashback log search, restored 0 blocks

channel ORA_DISK_1: restoring block(s)
channel ORA_DISK_1: specifying block(s) to restore from backup set
restoring blocks of datafile 00008
channel ORA_DISK_1: reading from backup piece +FLASH/orcl/backupset/2018_07_30/nnndf0_tag20180730t231035_0.294.982883435
channel ORA_DISK_1: piece handle=+FLASH/orcl/backupset/2018_07_30/nnndf0_tag20180730t231035_0.294.982883435 tag=TAG20180730T231035
channel ORA_DISK_1: restored block(s) from backup piece 1
channel ORA_DISK_1: block restore complete, elapsed time: 00:00:01

starting media recovery

archived log for thread 1 with sequence 1 is already on disk as file +FLASH/orcl/archivelog/2018_07_30/thread_1_seq_1.308.982883483
archived log for thread 1 with sequence 2 is already on disk as file +FLASH/orcl/archivelog/2018_07_30/thread_1_seq_2.293.982883485
archived log for thread 1 with sequence 3 is already on disk as file +FLASH/orcl/archivelog/2018_07_30/thread_1_seq_3.313.982883487
archived log for thread 1 with sequence 4 is already on disk as file +FLASH/orcl/archivelog/2018_07_30/thread_1_seq_4.295.982883489
some blocks not recovered: See trace file for details
media recovery complete, elapsed time: 00:00:02
Finished recover at 30-JUL-18

sql statement: begin sys.dbms_ir.execsqlscript(filename => ''/u01/app/oracle/diag/rdbms/orcl/orcl/hm/reco_332738037.hm'' ); end;
repair failure complete

查看坏块信息

SYS@ orcl>select * from v$database_block_corruption;

     FILE#     BLOCK#     BLOCKS CORRUPTION_CHANGE# CORRUPTIO
---------- ---------- ---------- ------------------ ---------
         8         20          1                  0 CHECKSUM

Elapsed: 00:00:00.07

发现并没有修复

我们重启数据库到mount状态

SYS@ orcl>shut immediate
Database closed.
Database dismounted.
ORACLE instance shut down.
SYS@ orcl>startup mount;
ORACLE instance started.

Total System Global Area  784998400 bytes
Fixed Size                  2217464 bytes
Variable Size             528484872 bytes
Database Buffers          251658240 bytes
Redo Buffers                2637824 bytes
Database mounted.

进入RMAN再次修复

[oracle@RHEL6 ~]$ rman target /

Recovery Manager: Release 11.2.0.1.0 - Production on Mon Jul 30 23:52:39 2018

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

connected to target database: ORCL (DBID=1509938286, not open)

RMAN> restore datafile 8;

Starting restore at 30-JUL-18
using target database control file instead of recovery catalog
allocated channel: ORA_DISK_1
channel ORA_DISK_1: SID=26 device type=DISK

channel ORA_DISK_1: starting datafile backup set restore
channel ORA_DISK_1: specifying datafile(s) to restore from backup set
channel ORA_DISK_1: restoring datafile 00008 to /home/oracle/tbs01.dbf
channel ORA_DISK_1: reading from backup piece +FLASH/orcl/backupset/2018_07_30/nnndf0_tag20180730t231035_0.294.982883435
channel ORA_DISK_1: piece handle=+FLASH/orcl/backupset/2018_07_30/nnndf0_tag20180730t231035_0.294.982883435 tag=TAG20180730T231035
channel ORA_DISK_1: restored backup piece 1
channel ORA_DISK_1: restore complete, elapsed time: 00:00:01
Finished restore at 30-JUL-18

RMAN> recover datafile 8;

Starting recover at 30-JUL-18
using channel ORA_DISK_1

starting media recovery

archived log for thread 1 with sequence 1 is already on disk as file +FLASH/orcl/archivelog/2018_07_30/thread_1_seq_1.308.982883483
archived log for thread 1 with sequence 2 is already on disk as file +FLASH/orcl/archivelog/2018_07_30/thread_1_seq_2.293.982883485
archived log for thread 1 with sequence 3 is already on disk as file +FLASH/orcl/archivelog/2018_07_30/thread_1_seq_3.313.982883487
archived log for thread 1 with sequence 4 is already on disk as file +FLASH/orcl/archivelog/2018_07_30/thread_1_seq_4.295.982883489
archived log file name=+FLASH/orcl/archivelog/2018_07_30/thread_1_seq_1.308.982883483 thread=1 sequence=1
archived log file name=+FLASH/orcl/archivelog/2018_07_30/thread_1_seq_2.293.982883485 thread=1 sequence=2
media recovery complete, elapsed time: 00:00:00
Finished recover at 30-JUL-18

打开数据库

SYS@ orcl>alter database open;

Database altered.

Elapsed: 00:00:02.51
SYS@ orcl>

检查表是否已修复

SYS@ orcl>select count(1) from scott.t01;

  COUNT(1)
----------
     18567

Elapsed: 00:00:00.01

猜你喜欢

转载自blog.csdn.net/Paul_George/article/details/81293565