Good morning, reading the documentation from Oracle I found a way that I feel comfortable with when taking a backup of a database, but I can't find satisfying informations about restoring them... In the following code I'll show how I take the backup, assuming that the database has activated Archivelog and Controlfile autobackup, using Win2016 Server and Oracle 12c and oracle_sid correctly set:
C:\> sqlplus owner/password@database as sysdba
SQL> shutdown immediate;
SQL> startup mount;
SQL> exit;
C:\> rman target owner/password@database
RMAN> backup archivelog all format "E:\Backup\%d_ALogs_%e_%p.Dmp" delete input;
RMAN> backup database format "E:\Backup\%d_%f_%p.Dmp";
RMAN> alter database open;
At this time I copy the backup of the control file in the same directory and compress all the files in .7z, then I move it in a different server. Let's assume I want to move this database in a different server, or I need to format the same server due to a failure, or a system update (to Win 2019, for example) and I need to restore it. After installing Oracle 12c (for simplicity I'll install the same version, but I may want/need to install the 19th; let's face this problem in a second time), I create a new database with the same name of the old one, the same owner with the same password, I assign system and sysdba the same password as the old one and the same configuration parameters. Everything is the same, just the OS and Oracle are freshly installed and I need to restore the database. As far as I can understand, I don't need the Archivelogs backup, because during the backup I flushed them all and stored permanently in the databse, am I right? I don't need the Control file either, because the database has been created by Oracle, am I right? Now I extract the last .Dmp file I created in E:\Backup, shutdown the database as my previously code and, in RMAN, I give:
RMAN> restore database <with what parameters?>;
RMAN> recover database;
RMAN> alter database open;
I found different ways to specify the parameters, but the most correct, always as far as I can understand, is:
RMAN> restore database format "E:\Backup\filename.Dmp";
Can it work?
Thank you very much in advance and excuse me for being so verbose, but I needed/wanted to be as much precise as possible.