在使用RMAN恢复数据库的时候,报了如下错误:

RMAN> run
2> {allocate channel c1 type disk;
3> allocate channel c2 type disk;
4> allocate channel c3 type disk;
5> allocate channel c4 type disk;
6> restore database;
7> release channel c1;
8> release channel c2;
9> release channel c3;
10> release channel c4;}

released channel: ORA_DISK_1
allocated channel: c1
channel c1: SID=137 device type=DISK

allocated channel: c2
channel c2: SID=12 device type=DISK

allocated channel: c3
channel c3: SID=138 device type=DISK

allocated channel: c4
channel c4: SID=15 device type=DISK

Starting restore at 2019/12/26 09:06:18
Starting implicit crosscheck backup at 2019/12/26 09:06:18
Crosschecked 6 objects
Finished implicit crosscheck backup at 2019/12/26 09:06:51

Starting implicit crosscheck copy at 2019/12/26 09:06:51
Finished implicit crosscheck copy at 2019/12/26 09:06:53

searching for all files in the recovery area
cataloging files...
no files cataloged


released channel: c1
released channel: c2
released channel: c3
released channel: c4
RMAN-00571: ===========================================================
RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ===============
RMAN-00571: ===========================================================
RMAN-03002: failure of restore command at 12/26/2019 09:07:18
RMAN-06026: some targets not found - aborting restore
RMAN-06023: no backup or copy of datafile 4 found to restore
RMAN-06023: no backup or copy of datafile 3 found to restore
RMAN-06023: no backup or copy of datafile 2 found to restore
RMAN-06023: no backup or copy of datafile 1 found to restore

查看了下1到4的数据文件备份,其实都存在。

RMAN> list backup of datafile 1;


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


BS Key  Type LV Size       Device Type Elapsed Time Completion Time    
------- ---- -- ---------- ----------- ------------ -------------------
5       Full    585.28M    DISK        00:01:47     2019/12/23 16:55:57
        BP Key: 5   Status: EXPIRED  Compressed: NO  Tag: TAG20191223T165408
        Piece Name: /rman_backup/Full_05uk5k1i_1_1.bak
  List of Datafiles in backup set 5
  File LV Type Ckp SCN    Ckp Time            Name
  ---- -- ---- ---------- ------------------- ----
  1       Full 1047397    2019/12/23 16:54:11 +DATA/phydb/datafile/system.256.1027260085

RMAN> list backup of datafile 2;


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


BS Key  Type LV Size       Device Type Elapsed Time Completion Time    
------- ---- -- ---------- ----------- ------------ -------------------
4       Full    376.65M    DISK        00:01:33     2019/12/23 16:55:44
        BP Key: 4   Status: EXPIRED  Compressed: NO  Tag: TAG20191223T165408
        Piece Name: /rman_backup/Full_06uk5k1j_1_1.bak
  List of Datafiles in backup set 4
  File LV Type Ckp SCN    Ckp Time            Name
  ---- -- ---- ---------- ------------------- ----
  2       Full 1047409    2019/12/23 16:54:12 +DATA/phydb/datafile/sysaux.257.1027260091

RMAN> list backup of datafile 3;


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


BS Key  Type LV Size       Device Type Elapsed Time Completion Time    
------- ---- -- ---------- ----------- ------------ -------------------
2       Full    6.55M      DISK        00:00:37     2019/12/23 16:54:49
        BP Key: 2   Status: EXPIRED  Compressed: NO  Tag: TAG20191223T165408
        Piece Name: /rman_backup/Full_07uk5k1k_1_1.bak
  List of Datafiles in backup set 2
  File LV Type Ckp SCN    Ckp Time            Name
  ---- -- ---- ---------- ------------------- ----
  3       Full 1047428    2019/12/23 16:54:14 +DATA/phydb/datafile/undotbs1.258.1027260095


RMAN> list backup of datafile 4;


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


BS Key  Type LV Size       Device Type Elapsed Time Completion Time    
------- ---- -- ---------- ----------- ------------ -------------------
4       Full    376.65M    DISK        00:01:33     2019/12/23 16:55:44
        BP Key: 4   Status: EXPIRED  Compressed: NO  Tag: TAG20191223T165408
        Piece Name: /rman_backup/Full_06uk5k1j_1_1.bak
  List of Datafiles in backup set 4
  File LV Type Ckp SCN    Ckp Time            Name
  ---- -- ---- ---------- ------------------- ----
  4       Full 1047409    2019/12/23 16:54:12 +DATA/phydb/datafile/users.259.1027260095

后面发现是权限问题,把/rman_backup目录下的备份修改成oracle:oinstall用户组就好了。