5. RAMN备份与恢复

一. rman简介

  RMAN(Recovery Manager)是一种用于备份(backup)、还原(restore)和恢复(recover)数据库的 Oracle 工具。RMAN只能用于ORACLE8或更高的版本中。它能够备份整个数据库或数据库部件,如表空间、数据文件、控制文件、归档文件以及Spfile参数文件。RMAN也允许您进行增量数据块级别的备份,增量RMAN备份是时间和空间有效的,因为他们只备份自上次备份以来有变化的那些数据块。而且,通过RMAN提供的接口,第三方的备份与恢复软件如veritas将提供更强大的备份与恢复的管理功能。通过RMAN,也提供了其它更多功能,如数据库的克隆、采用RMAN建立备用数据库、利用RMAN备份与移动裸设备(RAW)上的文件等工作将变得更方便简单。9i的RMAN通过增强的自动配置与管理功能,以及特有的块级别的恢复,将使备份与恢复工作变得更加快捷与完美。

  RMAN可以用来备份和还原数据库文件、归档日志和控制文件。它也可以用来执行完全或不完全的数据库恢复。与传统工具相比,RMAN具有独特的优势:跳过未使用的数据块。当备份一个RMAN备份集时,RMAN不会备份从未被写入的数据块,而传统的方式无法获知那些是未被使用的数据块。

  本文讲解rman以下内容:

    • rman的备份;包括整个数据库或者表空间、数据文件、控制文件、参数文件、归档文件的示例
    • rman的增量备份
    • rman的备份脚本
    • rman的还原和恢复

本文涉及到是日常工作能涉及到的内容:若要深入学习rman;还请您去撸一撸官方文档或者相关书籍。如数据库的克隆、采用RMAN建立备用数据库这部分内容留在后面章节学习。

在学习之前;先了解下rman如何连接数据库

[oracle@oracle235 ~]$ rman target /

Recovery Manager: Release 11.2.0.4.0 - Production on Wed Aug 8 18:07:35 2018

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

connected to target database: ORA235 (DBID=2047494122)

RMAN>

二. rman备份

2.1 备份整个数据库

eg: backup database format '/data/backup/db_full_%U';

RMAN> backup database format '/data/backup/db_full_%U';

Starting backup at 08-AUG-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=00005 name=/data/oracle/data/lottu01.dbf
input datafile file number=00001 name=/u01/app/oradata/ora235/system01.dbf
input datafile file number=00002 name=/u01/app/oradata/ora235/sysaux01.dbf
input datafile file number=00003 name=/u01/app/oradata/ora235/undotbs01.dbf
input datafile file number=00004 name=/u01/app/oradata/ora235/users01.dbf
channel ORA_DISK_1: starting piece 1 at 08-AUG-18
channel ORA_DISK_1: finished piece 1 at 08-AUG-18
piece handle=/data/backup/db_full_03ta2cqc_1_1 tag=TAG20180808T180916 comment=NONE
channel ORA_DISK_1: backup set complete, elapsed time: 00:00:45
channel ORA_DISK_1: starting full datafile backup set
channel ORA_DISK_1: specifying datafile(s) in backup set
including current control file in backup set
including current SPFILE in backup set
channel ORA_DISK_1: starting piece 1 at 08-AUG-18
channel ORA_DISK_1: finished piece 1 at 08-AUG-18
piece handle=/data/backup/db_full_04ta2crp_1_1 tag=TAG20180808T180916 comment=NONE
channel ORA_DISK_1: backup set complete, elapsed time: 00:00:01
Finished backup at 08-AUG-18

2.2 备份表空间

eg: backup tablespace lottu format '/data/backup/tsp_lottu_%U';

RMAN>  backup tablespace lottu format '/data/backup/tsp_lottu_%U';

Starting backup at 08-AUG-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=00005 name=/data/oracle/data/lottu01.dbf
channel ORA_DISK_1: starting piece 1 at 08-AUG-18
channel ORA_DISK_1: finished piece 1 at 08-AUG-18
piece handle=/data/backup/tsp_lottu_05ta2e01_1_1 tag=TAG20180808T182921 comment=NONE
channel ORA_DISK_1: backup set complete, elapsed time: 00:00:01
Finished backup at 08-AUG-18

2.3 备份数据文件

eg: backup datafile 5 format '/data/backup/df_5_%U';

RMAN> backup datafile 5 format '/data/backup/df_5_%U';

Starting backup at 08-AUG-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=00005 name=/data/oracle/data/lottu01.dbf
channel ORA_DISK_1: starting piece 1 at 08-AUG-18
channel ORA_DISK_1: finished piece 1 at 08-AUG-18
piece handle=/data/backup/df_5_06ta2e6k_1_1 tag=TAG20180808T183252 comment=NONE
channel ORA_DISK_1: backup set complete, elapsed time: 00:00:01
Finished backup at 08-AUG-18

  在rman中备份数据文件有两种形式;backup datafile file_idbackup datafile file_name。根据SQL‘select file_id,file_name from dba_data_files’可得:

SQL> select file_id,file_name from dba_data_files;

   FILE_ID FILE_NAME
---------- ----------------------------------------
  1 /u01/app/oradata/ora235/system01.dbf
  2 /u01/app/oradata/ora235/sysaux01.dbf
  3 /u01/app/oradata/ora235/undotbs01.dbf
  4 /u01/app/oradata/ora235/users01.dbf
  5 /data/oracle/data/lottu01.dbf

  上面等同于:backup datafile '/data/oracle/data/lottu01.dbf' ;

RMAN> backup datafile '/data/oracle/data/lottu01.dbf' format '/data/backup/dfname_5_%U';

Starting backup at 08-AUG-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=00005 name=/data/oracle/data/lottu01.dbf
channel ORA_DISK_1: starting piece 1 at 08-AUG-18
channel ORA_DISK_1: finished piece 1 at 08-AUG-18
piece handle=/data/backup/dfname_5_07ta2ei5_1_1 tag=TAG20180808T183901 comment=NONE
channel ORA_DISK_1: backup set complete, elapsed time: 00:00:01
Finished backup at 08-AUG-18

2.4 备份控制文件

rman对控制文件备份有特殊保护;一般不需要单独备份控制文件。在备份系统表空间system或者备份数据库。都会自动备份控制文件。在前面备份数据库时;我们可以看到这样的信息

including current control file in backup set
including current SPFILE in backup set
channel ORA_DISK_1: starting piece 1 at 08-AUG-18
channel ORA_DISK_1: finished piece 1 at 08-AUG-18
piece handle=/data/backup/db_full_04ta2crp_1_1 tag=TAG20180808T180916 comment=NONE
channel ORA_DISK_1: backup set complete, elapsed time: 00:00:01
Finished backup at 08-AUG-18

  在查看控制文件的备份集;我们可以看到:说明对控制文件已经有备份了。

RMAN> list backup of controlfile;


List of Backup Sets
===================


BS Key  Type LV Size       Device Type Elapsed Time Completion Time
------- ---- -- ---------- ----------- ------------ ---------------
2       Full    9.36M      DISK        00:00:01     08-AUG-18      
        BP Key: 2   Status: AVAILABLE  Compressed: NO  Tag: TAG20180808T180916
        Piece Name: /data/backup/db_full_04ta2crp_1_1
  Control File Included: Ckp SCN: 915985       Ckp time: 08-AUG-18

  eg: backup current controlfile format '/data/backup/ct_%U';

RMAN> backup current controlfile format '/data/backup/ct_%U';

Starting backup at 08-AUG-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
including current control file in backup set
channel ORA_DISK_1: starting piece 1 at 08-AUG-18
channel ORA_DISK_1: finished piece 1 at 08-AUG-18
piece handle=/data/backup/ct_08ta2f97_1_1 tag=TAG20180808T185119 comment=NONE
channel ORA_DISK_1: backup set complete, elapsed time: 00:00:01
Finished backup at 08-AUG-18

2.5 备份归档日志

rman对备份归档日志有两种形式:backup archivelog plus archivelog

  • eg: backup archivelog all format '/data/backup/arch_%U';
  • eg: backup current controlfile format '/data/backup/ct_%U' plus archivelog;
RMAN> backup current controlfile format '/data/backup/ct_%U' plus archivelog;

Starting backup at 08-AUG-18
current log archived
using channel ORA_DISK_1
channel ORA_DISK_1: starting archived log backup set
channel ORA_DISK_1: specifying archived log(s) in backup set
input archived log thread=1 sequence=56 RECID=1 STAMP=983577870
input archived log thread=1 sequence=57 RECID=2 STAMP=983579059
channel ORA_DISK_1: starting piece 1 at 08-AUG-18
channel ORA_DISK_1: finished piece 1 at 08-AUG-18
piece handle=/u01/app/oracle/dbs/09ta2grj_1_1 tag=TAG20180808T191811 comment=NONE
channel ORA_DISK_1: backup set complete, elapsed time: 00:00:01
channel ORA_DISK_1: starting archived log backup set
channel ORA_DISK_1: specifying archived log(s) in backup set
input archived log thread=1 sequence=1 RECID=3 STAMP=983641357
input archived log thread=1 sequence=2 RECID=4 STAMP=983647091
channel ORA_DISK_1: starting piece 1 at 08-AUG-18
channel ORA_DISK_1: finished piece 1 at 08-AUG-18
piece handle=/u01/app/oracle/dbs/0ata2grk_1_1 tag=TAG20180808T191811 comment=NONE
channel ORA_DISK_1: backup set complete, elapsed time: 00:00:01
Finished backup at 08-AUG-18

Starting backup at 08-AUG-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
including current control file in backup set
channel ORA_DISK_1: starting piece 1 at 08-AUG-18
channel ORA_DISK_1: finished piece 1 at 08-AUG-18
piece handle=/data/backup/ct_0bta2grl_1_1 tag=TAG20180808T191813 comment=NONE
channel ORA_DISK_1: backup set complete, elapsed time: 00:00:01
Finished backup at 08-AUG-18

Starting backup at 08-AUG-18
current log archived
using channel ORA_DISK_1
channel ORA_DISK_1: starting archived log backup set
channel ORA_DISK_1: specifying archived log(s) in backup set
input archived log thread=1 sequence=3 RECID=5 STAMP=983647095
channel ORA_DISK_1: starting piece 1 at 08-AUG-18
channel ORA_DISK_1: finished piece 1 at 08-AUG-18
piece handle=/u01/app/oracle/dbs/0cta2grn_1_1 tag=TAG20180808T191815 comment=NONE
channel ORA_DISK_1: backup set complete, elapsed time: 00:00:01
Finished backup at 08-AUG-18
View Code

使用plus archivelog时备份数据库完成的动作(backup database plus archivelog)

  1. 首先执行alter system archive log current 命令(对当前日志归档)
  2. 执行backup archivelog all 命令(对所有归档日志进行备份)
  3. 执行backup database命令中指定的数据文件、表空间等
  4. 再次执行alter system archive log current
  5. 备份在备份操作期间产生的新的归档日志

2.6 备份参数文件

eg:backup spfile format 'spfile_%U';

RMAN> backup spfile format 'spfile_%U';

Starting backup at 08-AUG-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
including current SPFILE in backup set
channel ORA_DISK_1: starting piece 1 at 08-AUG-18
channel ORA_DISK_1: finished piece 1 at 08-AUG-18
piece handle=/u01/app/oracle/dbs/spfile_0dta2h1h_1_1 tag=TAG20180808T192121 comment=NONE
channel ORA_DISK_1: backup set complete, elapsed time: 00:00:01
Finished backup at 08-AUG-18

三. rman增量备份

  rman增量备份就是包含从最近一次备份以来被修改或添加的数据块;rman提供了两种增量备份类型分为差异增量备份(DIFFERENTIAL)累计增量备份(CUMULATIVE)

  • 差异增量备份仅仅包含n级或n级以下被修改过的数据块。备份数据量小,恢复时间长。

  • 累计增量备份仅仅包含n-1级或n-1级以下被修改过的数据块。备份数据量大,恢复时间短。

  0级增量备份相当于一个完整备份,该备份包含所有已用的数据块文件,与完整备份的差异是完整备份不能用作级增量备份的基础。

四. rman恢复

4.1 rman完全恢复

  场景当前数据库仅所有归档日志文件和重做日志文件是完整的;参数文件、控制文件、数据文件都丢失。不过幸运的是;丢失之前对整个库都有备份。

  • 备份整个数据库
[oracle@oracle235 ~]$ rman target / 

Recovery Manager: Release 11.2.0.4.0 - Production on Wed Aug 8 21:39:40 2018

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

connected to target database: ORA235 (DBID=2047494122)

RMAN> backup database format '/data/backup/db_full_%U';

Starting backup at 08-AUG-18
using target database control file instead of recovery catalog
allocated channel: ORA_DISK_1
channel ORA_DISK_1: SID=34 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=00005 name=/data/oracle/data/lottu01.dbf
input datafile file number=00001 name=/u01/app/oradata/ora235/system01.dbf
input datafile file number=00002 name=/u01/app/oradata/ora235/sysaux01.dbf
input datafile file number=00003 name=/u01/app/oradata/ora235/undotbs01.dbf
input datafile file number=00004 name=/u01/app/oradata/ora235/users01.dbf
channel ORA_DISK_1: starting piece 1 at 08-AUG-18
channel ORA_DISK_1: finished piece 1 at 08-AUG-18
piece handle=/data/backup/db_full_0gta2p56_1_1 tag=TAG20180808T213950 comment=NONE
channel ORA_DISK_1: backup set complete, elapsed time: 00:00:45
channel ORA_DISK_1: starting full datafile backup set
channel ORA_DISK_1: specifying datafile(s) in backup set
including current control file in backup set
including current SPFILE in backup set
channel ORA_DISK_1: starting piece 1 at 08-AUG-18
channel ORA_DISK_1: finished piece 1 at 08-AUG-18
piece handle=/data/backup/db_full_0hta2p6j_1_1 tag=TAG20180808T213950 comment=NONE
channel ORA_DISK_1: backup set complete, elapsed time: 00:00:01
Finished backup at 08-AUG-18
  • 模拟故障;将参数文件、控制文件、数据文件都丢失;
[oracle@oracle235 ora235]$ rm *.dbf
[oracle@oracle235 ora235]$ rm *.ctl
[oracle@oracle235 ora235]$ rm /data/oracle/data/lottu01.dbf
[oracle@oracle235 dbs]$ rm spfile_0dta2h1h_1_1 spfileora235.ora  orapwora235  init.ora

  我们现在开始进行数据库恢复:

1. 恢复参数文件;没有参数文件;我们是无法启动数据库的第一步。

[oracle@oracle235 ~]$ rlwrap rman target /

Recovery Manager: Release 11.2.0.4.0 - Production on Wed Aug 8 21:48:32 2018

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

connected to target database (not started)

RMAN> set DBID=2047494122;

executing command: SET DBID

RMAN> startup nomount;

startup failed: ORA-01078: failure in processing system parameters
LRM-00109: could not open parameter file '/u01/app/oracle/dbs/initora235.ora'

starting Oracle instance without parameter file for retrieval of spfile
Oracle instance started

Total System Global Area    1068937216 bytes

Fixed Size                     2260088 bytes
Variable Size                281019272 bytes
Database Buffers             780140544 bytes
Redo Buffers                   5517312 bytes

RMAN> restore spfile from autobackup;

Starting restore at 08-AUG-18
using target database control file instead of recovery catalog
allocated channel: ORA_DISK_1
channel ORA_DISK_1: SID=19 device type=DISK

channel ORA_DISK_1: looking for AUTOBACKUP on day: 20180808
channel ORA_DISK_1: looking for AUTOBACKUP on day: 20180807
channel ORA_DISK_1: looking for AUTOBACKUP on day: 20180806
channel ORA_DISK_1: looking for AUTOBACKUP on day: 20180805
channel ORA_DISK_1: looking for AUTOBACKUP on day: 20180804
channel ORA_DISK_1: looking for AUTOBACKUP on day: 20180803
channel ORA_DISK_1: looking for AUTOBACKUP on day: 20180802
channel ORA_DISK_1: no AUTOBACKUP in 7 days found
RMAN-00571: ===========================================================
RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ===============
RMAN-00571: ===========================================================
RMAN-03002: failure of restore command at 08/08/2018 21:51:16
RMAN-06172: no AUTOBACKUP found or specified handle is not a valid copy or piece

RMAN> restore spfile from '/data/backup/db_full_0hta2p6j_1_1';

Starting restore at 08-AUG-18
using channel ORA_DISK_1

channel ORA_DISK_1: restoring spfile from AUTOBACKUP /data/backup/db_full_0hta2p6j_1_1
channel ORA_DISK_1: SPFILE restore from AUTOBACKUP complete
Finished restore at 08-AUG-18

其中的DBID为2047494122;是从rman备份日志查到的。这样参数文件恢复Ok。

[oracle@oracle235 dbs]$ ll spfileora235.ora 
-rw-r-----. 1 oracle oinstall 2560 Aug  8 21:52 spfileora235.ora

2. 恢复控制文件

RMAN> shutdown immediate;

Oracle instance shut down

RMAN> startup nomount;

connected to target database (not started)
Oracle instance started

Total System Global Area     780824576 bytes

Fixed Size                     2257312 bytes
Variable Size                511708768 bytes
Database Buffers             264241152 bytes
Redo Buffers                   2617344 bytes

RMAN> restore controlfile to '/u01/app/oradata/ora235/control01.ctl' from '/data/backup/db_full_0hta2p6j_1_1';

Starting restore at 08-AUG-18
allocated channel: ORA_DISK_1
channel ORA_DISK_1: SID=19 device type=DISK

channel ORA_DISK_1: restoring control file
channel ORA_DISK_1: restore complete, elapsed time: 00:00:01
Finished restore at 08-AUG-18

RMAN> restore controlfile to '/u01/app/oradata/ora235/control02.ctl' from '/data/backup/db_full_0hta2p6j_1_1';

Starting restore at 08-AUG-18
using channel ORA_DISK_1

channel ORA_DISK_1: restoring control file
channel ORA_DISK_1: restore complete, elapsed time: 00:00:01
Finished restore at 08-AUG-18

  这样控制文件也恢复OK;

3. 恢复数据文件;控制文件恢复成功;现在数据库可以启动到加载状态

RMAN> alter database mount;

database mounted
released channel: ORA_DISK_1

RMAN> restore database;

Starting restore at 08-AUG-18
allocated channel: ORA_DISK_1
channel ORA_DISK_1: SID=19 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 00001 to /u01/app/oradata/ora235/system01.dbf
channel ORA_DISK_1: restoring datafile 00002 to /u01/app/oradata/ora235/sysaux01.dbf
channel ORA_DISK_1: restoring datafile 00003 to /u01/app/oradata/ora235/undotbs01.dbf
channel ORA_DISK_1: restoring datafile 00004 to /u01/app/oradata/ora235/users01.dbf
channel ORA_DISK_1: restoring datafile 00005 to /data/oracle/data/lottu01.dbf
channel ORA_DISK_1: reading from backup piece /data/backup/db_full_0gta2p56_1_1
channel ORA_DISK_1: piece handle=/data/backup/db_full_0gta2p56_1_1 tag=TAG20180808T213950
channel ORA_DISK_1: restored backup piece 1
channel ORA_DISK_1: restore complete, elapsed time: 00:01:26
Finished restore at 08-AUG-18

RMAN> recover database;

Starting recover at 08-AUG-18
using channel ORA_DISK_1

starting media recovery

archived log for thread 1 with sequence 4 is already on disk as file /u01/app/oradata/ora235/redo01.log
archived log file name=/u01/app/oradata/ora235/redo01.log thread=1 sequence=4
media recovery complete, elapsed time: 00:00:00
Finished recover at 08-AUG-18

RMAN> alter database open;

RMAN-00571: ===========================================================
RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ===============
RMAN-00571: ===========================================================
RMAN-03002: failure of alter db command at 08/08/2018 22:06:08
ORA-01589: must use RESETLOGS or NORESETLOGS option for database open

RMAN> alter database open resetlogs;

database opened

  到了这步数据库算是成功恢复;再重启数据库。

4.2 rman不完全恢复

场景出现归档日志文件和重做日志文件不完整或者用户误操作;需要进行不完全恢复。

  不完全恢复有三种方式:

# a、基于TIME 参数不完全恢复
run { 
      shutdown immediate;
      startup mount;
      set until time "to_date('20180805 10:09:53','yyyymmdd hh24:mi:ss')";
      restore database;
      recover database;
      alter database open resetlogs;
}

# b、基于SCN 参数不完全恢复
run { 
      shutdown immediate;
      startup mount;
      set until scn 3400; 
      restore database;
      recover database;
      alter database open resetlogs;
}
 
# c、基于SEQUENCE 参数不完全恢复:
run { 
      shutdown immediate;
      startup mount;
      set until sequence 12903;
      restore database;
      recover database;
      alter database open resetlogs;
}

  按照《4. Oracle数据库用户管理备份与恢复》中的不完全恢复来演示:

  • 误删表t_lottu01

 

SQL> conn lottu/li0924
Connected.
SQL> create table t_lottu01 as select level id from dual connect by level <= 5;

Table created.

SQL> select to_char(sysdate,'yyyy-mm-dd hh24:mi:ss') from dual;

TO_CHAR(SYSDATE,'YY
-------------------
2018-08-08 23:00:22

SQL> drop table t_lottu01;

Table dropped.

SQL> conn system/Oracle235
Connected.
SQL> alter system switch logfile;     

System altered.

SQL> alter system switch logfile;     

System altered.

 

  • rman执行不完全恢复
[oracle@oracle235 ~]$ rlwrap rman target /

Recovery Manager: Release 11.2.0.4.0 - Production on Wed Aug 8 23:01:26 2018

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

connected to target database: ORA235 (DBID=2047494122)

run { 
2>       shutdown immediate;
      startup mount;
      set until time "to_date('20180808 23:00:22','yyyymmdd hh24:mi:ss')";
      restore database;
      recover database;
      alter database open resetlogs;
8> };

using target database control file instead of recovery catalog
database closed
database dismounted
Oracle instance shut down

connected to target database (not started)
Oracle instance started
database mounted

Total System Global Area     780824576 bytes

Fixed Size                     2257312 bytes
Variable Size                511708768 bytes
Database Buffers             264241152 bytes
Redo Buffers                   2617344 bytes

executing command: SET until clause

Starting restore at 08-AUG-18
allocated channel: ORA_DISK_1
channel ORA_DISK_1: SID=18 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 00001 to /u01/app/oradata/ora235/system01.dbf
channel ORA_DISK_1: restoring datafile 00002 to /u01/app/oradata/ora235/sysaux01.dbf
channel ORA_DISK_1: restoring datafile 00003 to /u01/app/oradata/ora235/undotbs01.dbf
channel ORA_DISK_1: restoring datafile 00004 to /u01/app/oradata/ora235/users01.dbf
channel ORA_DISK_1: restoring datafile 00005 to /data/oracle/data/lottu01.dbf
channel ORA_DISK_1: reading from backup piece /data/backup/db_full_0gta2p56_1_1
channel ORA_DISK_1: piece handle=/data/backup/db_full_0gta2p56_1_1 tag=TAG20180808T213950
channel ORA_DISK_1: restored backup piece 1
channel ORA_DISK_1: restore complete, elapsed time: 00:01:05
Finished restore at 08-AUG-18

Starting recover at 08-AUG-18
using channel ORA_DISK_1

starting media recovery

archived log for thread 1 with sequence 4 is already on disk as file /data/arch/1_4_983579059.dbf
archived log for thread 1 with sequence 1 is already on disk as file /data/arch/1_1_983657183.dbf
archived log file name=/data/arch/1_4_983579059.dbf thread=1 sequence=4
archived log file name=/data/arch/1_1_983657183.dbf thread=1 sequence=1
media recovery complete, elapsed time: 00:00:02
Finished recover at 08-AUG-18

database opene

五. 总结

本文只是简单介绍rman的使用。像rman的命令,rman备份集的保留策略,使用Recovery Catalog,备份加密,以及相关视图都未涉及。

 

原文地址:https://www.cnblogs.com/lottu/p/9530520.html