重庆思庄Oracle、Redhat认证学习论坛

 找回密码
 注册

QQ登录

只需一步,快速开始

搜索
查看: 385|回复: 0
打印 上一主题 下一主题

[参考文档] RMAN "set newname for database" Does Not Work for Root datafiles

[复制链接]
跳转到指定楼层
楼主
发表于 2024-7-21 17:48:42 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
现象:
When restoring a PDB tablespace and using "set newname for database", RMAN tries to restore the Root datafiles to the source database directory.  I.e., ignoring the 'set newname for database'.  If permission of that source directory is not present, or the directory does not exists, then error will occur.

For example, at source DB, data file is under the following directory:

  <PATH_1>


RMAN> report schema;

using target database control file instead of recovery catalog
Report of database schema for database with db_unique_name <pdb name>

List of Permanent Datafiles
===========================
File Size(MB) Tablespace           RB segs Datafile Name
---- -------- -------------------- ------- ------------------------
1    910      SYSTEM               YES     <PATH_1>/system01.dbf
3    750      SYSAUX               NO      <PATH_1>/sysaux01.dbf
4    295      UNDOTBS1             YES     <PATH_1>/undotbs01.dbf
5    270      PDB$SEED:SYSTEM      NO      <PATH_1>/pdbseed/system01.dbf
6    330      PDB$SEED:SYSAUX      NO      <PATH_1>/pdbseed/sysaux01.dbf
7    5        USERS                NO      <PATH_1>/users01.dbf
8    100      PDB$SEED:UNDOTBS1    NO      <PATH_1>/pdbseed/undotbs01.dbf
9    270      <PDBNAME>:SYSTEM     NO      <PATH_1>/<PDBNAME>/system01.dbf
10   340      <PDBNAME>:SYSAUX     NO      <PATH_1>/<PDBNAME>/sysaux01.dbf
11   100      <PDBNAME>:UNDOTBS1   NO      <PATH_1>/<PDBNAME>/undotbs01.dbf
12   5        <PDBNAME>:USERS      NO      <PATH_1>/<PDBNAME>/users01.dbf
13   100      <PDBNAME>:TBS001     NO      <PATH_1>/tbs001.dbf

List of Temporary Files
=======================
File Size(MB) Tablespace           Maxsize(MB) Tempfile Name
---- -------- -------------------- ----------- --------------------
1    132      TEMP                 32767       <PATH_1>/temp01.dbf
2    36       PDB$SEED:TEMP        32767       <PATH_1>/pdbseed/temp012020-10-17_02-57-57-800-AM.dbf
3    36       <PDBNAME>:TEMP       32767       <PATH_1>/<PDBNAME>/temp01.dbf

RMAN>
We want to restore to the following directory:
  <PATH_2>


run{
allocate channel t1 type disk;
allocate channel t2 type disk;
allocate channel t3 type disk;
allocate channel t4 type disk;
SET UNTIL TIME = "to_date('2021-09-09 23:49:18','YYYY/MM/DD HH24:MI:SS')";
set newname for database root to '<PATH_2>%U';
set newname for database "PDB$SEED" to '<PATH_2>%U';
set newname for tablespace <PDBNAME>:SYSTEM to '<PATH_2>%U';
set newname for tablespace <PDBNAME>:SYSAUX to '<PATH_2>%U';
set newname for tablespace <PDBNAME>:UNDOTBS1 to '<PATH_2>%U';
set newname for tablespace <PDBNAME>:TBS001 to '<PATH_2>%U';
restore database root skip tablespace users database "PDB$SEED" database <PDBNAME> skip tablespace <PDBNAME>:USERS;
switch datafile all;
}

......
Starting restore at 17-SEP-21

channel t1: starting datafile backup set restore
channel t1: specifying datafile(s) to restore from backup set
channel t1: restoring datafile 00001 to <PATH_1>/system01.dbf
channel t1: restoring datafile 00003 to <PATH_1>/sysaux01.dbf
channel t1: restoring datafile 00004 to <PATH_1>/undotbs01.dbf
channel t1: reading from backup piece <BACKUP LOCATION>/db_0108lv6k_1_1
channel t2: starting datafile backup set restore
channel t2: specifying datafile(s) to restore from backup set
channel t2: restoring datafile 00009 to <PATH_2>data_D-<CDBNAME>_TS-SYSTEM_FNO-9
channel t2: restoring datafile 00010 to <PATH_2>data_D-<CDBNAME>_TS-SYSAUX_FNO-10
channel t2: restoring datafile 00011 to <PATH_2>data_D-<CDBNAME_TS-UNDOTBS1_FNO-11
channel t2: restoring datafile 00013 to <PATH_2>data_D-<CDBNAME>_TS-TBS001_FNO-13
channel t2: reading from backup piece <BACKUP LOCATION>/db_0208lv73_1_1
channel t3: starting datafile backup set restore
channel t3: specifying datafile(s) to restore from backup set
channel t3: restoring datafile 00005 to <PATH_2>data_D-<CDBNAME>_TS-SYSTEM_FNO-5
channel t3: restoring datafile 00006 to <PATH_2>data_D-<CDBNAME>_TS-SYSAUX_FNO-6
channel t3: restoring datafile 00008 to <PATH_2>data_D-<CDBNAME>_TS-UNDOTBS1_FNO-8
channel t3: reading from backup piece <BACKUP LOCATION>/db_0308lv7a_1_1
channel t1: ORA-19870: error while restoring backup piece <BACKUP LOCATION>/db_0108lv6k_1_1
ORA-19504: failed to create file "<PATH_1>/system01.dbf"  <<<<<<< tried to restore root database file to source DB location
ORA-27037: unable to obtain file status
Linux-x86_64 Error: 13: Permission denied
Additional information: 9

channel t3: piece handle=<BACKUP LOCATION>/db_0308lv7a_1_1 tag=TAG20210909T234836
channel t3: restored backup piece 1
channel t3: restore complete, elapsed time: 00:00:07
channel t2: piece handle=<BACKUP LOCATION>/db_0208lv73_1_1 tag=TAG20210909T234836
channel t2: restored backup piece 1
channel t2: restore complete, elapsed time: 00:00:15
failover to previous backup

released channel: t1
released channel: t2
released channel: t3
released channel: t4
RMAN-00571: ===========================================================
RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ===============
RMAN-00571: ===========================================================
RMAN-03002: failure of restore command at 09/17/2021 01:02:00
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 1 found to restore

RMAN>


原因:
The issue was investigated via bug 33388218, closed as "not a bug", this is a usage issue.

处理方法:
The command being used was:

set newname for database root to '<PATH_2>/%U';
It should be:

set newname for database cdb$root to '<PATH_2>/%U';

分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 支持支持 反对反对
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 注册

本版积分规则

QQ|手机版|小黑屋|重庆思庄Oracle、Redhat认证学习论坛 ( 渝ICP备12004239号-4 )

GMT+8, 2024-11-28 16:07 , Processed in 0.118074 second(s), 20 queries .

重庆思庄学习中心论坛-重庆思庄科技有限公司论坛

© 2001-2020

快速回复 返回顶部 返回列表