0

i'm trying to create backup restore script . in short my backup script creating new directory every day from the operating system level and then backup the database using the directory created

i tried the below script but it seems RMAN doesn't recognize the controlfiles here is my script

**#RMAN RESTORE SCRIPT** 
#!/bin/bash
#Environment Variables

ORACLE_HOME=/u01/app/oracle/product/12.2.0.1/dbhome_1    
ORACLE_SID=cdb11    
PATH=$PATH:$ORACLE_HOME/bin    
DD=`date +%Y-%m-%d-%H-%M`    
export ORACLE_HOME ORACLE_SID PATH DD controlfile backupsets    
controlfile=/ArchiveDBBackup/DAILY_RMAN/${DD}/CDB1_CONTROLFILE    
backupsets=/ArchiveDBBackup/DAILY_RMAN/${DD}/    
export controlfile backupsets    

LOGFILE=/RMAN/log/DAILY_FULLBKP_RESTORE_`date +%Y%m%d`.log    
rman target / LOG $LOGFILE <<EOF
run
{
shutdown immediate;
startup nomount;
set dbid=961936136
restore controlfile FROM '$controlfile';
alter database mount;
catalog start with '$backupsets' noprompt;
restore database;
recover database;
alter database open resetlogs;
exit
}

EOF

Error :-

RMAN-03002: failure of restore command at 07/04/2021 09:35:57 RMAN-06172: no AUTOBACKUP found or specified handle is not a valid copy or piece

any idea how can RMAN recognize linux variables ? or anyway to achieve the restore with those variables ?

1
  • Singly-quoted strings are not interpolated by any shell I know of.
    – mustaccio
    Jul 4 at 12:48
0

Modify the following:

controlfile=/ArchiveDBBackup/DAILY_RMAN/${DD}/CDB1_CONTROLFILE

to be:

controlfile='/ArchiveDBBackup/DAILY_RMAN/${DD}/CDB1_CONTROLFILE'

Then try again.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.