jueves, 20 de febrero de 2020

RMAN RECOVER DATABASE NEW HOST

To recover the database on the new host:

  1. Ensure that the prerequisites described in Prerequisites of Disaster Recovery are met.
  2. If possible, restore or re-create all relevant network files such as tnsnames.ora and listener.ora and a password file.
  3. Start RMAN and connect to the target database instance.
    At this stage, no initialization parameter file exists. If you have set ORACLE_SID and ORACLE_HOME, then you can use operating system authentication to connect as SYSDBA or SYSBACKUP.
  4. Specify the DBID for the target database with the SET DBID command, as described in "Restoring the Server Parameter File".
    For example, enter the following command:
    SET DBID 676549873;
    
  5. Run the STARTUP NOMOUNT command.
    When the server parameter file is not available, RMAN attempts to start the instance with a dummy server parameter file.
  6. Allocate a channel to the media manager and then restore the server parameter file from autobackup.
    For example, enter the following command to restore the server parameter file from Oracle Secure Backup:
    RUN
    {
      ALLOCATE CHANNEL c1 DEVICE TYPE sbt;
      RESTORE SPFILE FROM AUTOBACKUP;
    }
    
  7. Restart the instance with the restored server parameter file.
    STARTUP FORCE NOMOUNT;
    
  8. Write a command file to perform the restore and recovery operation, and then execute the command file. The command file must do the following:
    1. Allocate a channel to the media manager.
    2. Restore a control file autobackup (see "Performing Recovery with a Backup Control File and No Recovery Catalog").
    3. Mount the restored control file.
    4. Catalog any backups not recorded in the repository with the CATALOG command.
    5. Restore the data files to their original locations. If volume names have changed, then run SET NEWNAME commands before the restore operation and perform a switch after the restore operation to update the control file with the new locations for the data files, as shown in the following example.
    6. Recover the data files. RMAN stops recovery when it reaches the log sequence number specified.
    RMAN> RUN
    {
      # Manually allocate a channel to the media manager
      ALLOCATE CHANNEL t1 DEVICE TYPE sbt;
      # Restore autobackup of the control file. This example assumes that you have 
      # accepted the default format for the autobackup name.
      RESTORE CONTROLFILE FROM AUTOBACKUP;
      #  The set until command is used in case the database
      #  structure has changed in the most recent backups, and you want to
      #  recover to that point in time. In this way RMAN restores the database
      #  to the same structure that the database had at the specified time.
      ALTER DATABASE MOUNT;
      SET UNTIL SEQUENCE 1124 THREAD 1;
      RESTORE DATABASE;
      RECOVER DATABASE;
    }
    

No hay comentarios: