How to Restore Archive logs from a backup set in oracle
How Does oracle capture archived logs from the backup set?
In Dalian Hospital, the database is archived. However, after archiving, rman uses crontab to automatically archive the logs and delete the archived log files on the system. After the RealSync program stops for a period of time, archive logs must be applied to solve the log loss problem.
The problem is: the metadata about backup in the control file in the database has been lost, but the backup set exists. At this time, we began to call an internal non-public function package of oracle: dbms_backup_restore to extract archived logs from the backup set to the specified system directory. To meet our needs. The statement is as follows:
Declaredevtype varchar2 (256); done boolean; begindevtype: = sys. dbms_backup_restore.deviceAllocate (type => '', ident => 't2'); sys. dbms_backup_restore.restoreSetArchivedLog (destination => '/archivelog02'); sys. dbms_backup_restore.restoreArchivedLog (thread => 2, sequence => 51500); sys. dbms_backup_restore.restoreBackupPiece (done => done, handle => '/backup/zlhis/rman/al_zlhis_201%30_8623%2_23768_1', params => null); sys. dbms_backup_restore.deviceDeallocate; end;
Note: destination => '/archivelog02 specifies the location where the archived logs are stored. thread indicates the thread Number of rac, sequence is the serial number of the archive log to be restored. handle indicates the absolute path of the Backup set. After modification, run the SQL plus command window.