asm dbfile 先查询出来, 为了要做datafile的newname
SQL> select file_id,file_name from dba_data_files;
在还原时要确认备份文件权限为oracle.oinstall
chown oracle.oinstall *
在新机要确认归档打开, 以及备份空间大小
我这环境默认是4G, 直接给改成400G
因为在recover时是消耗此空间的
SQL> archive log list;
SQL> show parameter db_recover
SQL> alter system set db_recovery_file_dest_size=400G;
修改db_files数量
SQL > alter system set db_files=1000 scope=spfile;
做完所有检查与配置记得关闭重起
$ export ORACLE_SID=ORCL
SQL> shut abort
SQL> startup nomount
开始还原
$ rman target /
RMAN> set dbid=1644883930;
RMAN> restore controlfile from '/dbfiles/shares/c-1644883930-20231103-01";
SQL> alter database mount
$ rman target /
catalog start with '/dbfiles/shares/"; # 指定日志路径
run{
set newname for datafile 1 to "/dbfiles/app/oracle/oradata/orcl/1.dbf";
set newname for datafile 2 to "/dbfiles/app/oracle/oradata/orcl/2.dbf";
set newname for datafile 3 to "/dbfiles/app/oracle/oradata/orcl/3.dbf";
set newname for datafile 4 to "/dbfiles/app/oracle/oradata/orcl/4.dbf";
set newname for datafile 5 to "/dbfiles/app/oracle/oradata/orcl/5.dbf";
#....
#....
#....
set newname for datafile 341 to "/dbfiles/app/oracle/oradata/orcl/341.dbf";
set newname for datafile 342 to "/dbfiles/app/oracle/oradata/orcl/342.dbf";
set newname for datafile 343 to "/dbfiles/app/oracle/oradata/orcl/343.dbf";
set newname for datafile 344 to "/dbfiles/app/oracle/oradata/orcl/344.dbf";
set newname for datafile 345 to "/dbfiles/app/oracle/oradata/orcl/345.dbf";
allocate channel c1 type disk;
allocate channel c2 type disk;
allocate channel c3 type disk;
allocate channel c4 type disk;
allocate channel c5 type disk;
RESTORE DATABASE ;
#将newname异动同步到 dba_data_files / v$datafile
switch datafile all;
#recover database using backup controlfile until cancel;
recover database until time "to_date('2023-11-03 15:42:00','yyyy-mm-dd hh24:mi:ss')";
release channel c1;
release channel c2;
release channel c3;
release channel c4;
release channel c5;
}