All technological notes.
Problem:
archival backup:
retention policies
open or a mounted database.
Prerequisite:
OPEN database.MOUNTED state.Characteristics:
Archival backups cannot be written to the fast recovery area.
FORMAT clause to specify a different location.archival backup also guarantees that all of the files needed to restore the backup are included.
data filesSPFILEarchived log files (only those needed to recover an online backup)The only redo logs that are kept are those required to restore this backup to a consistent state.
archival backup is retained for as long as specified. Even if you have a much smaller retention window and run the DELETE OBSOLETE command, the archival backup remains.不会被删除直到指定时间BACKUP ... KEEP {FOREVER|UNTIL TIME 'SYSDATE + <n>'} RESTORE POINT <restore_point_name>
-- Example
KEEP {FOREVER | UNTIL TIME [=] ' date_string '}
NOKEEP
[RESTORE POINT rsname]
-- List all restore points known to the RMAN repository:
LIST RESTORE POINT ALL;
-- Display a specific restore point:
LIST RESTORE POINT 'rsname';
-- -------- Managing Archival Database Backups
-- Archiving a database backup forever:
CONNECT CATALOG rman/rman@catdb -- required catalog
CHANGE BACKUP TAG 'consistent_db_bkup' KEEP FOREVER;
-- Changing the status of a database copy:
-- to make a backup that is currently exempt from the retention policy eligible for the OBSOLETE status.
-- applies to all backups of the type specified if tag is not specified.
CHANGE COPY OF DATABASE CONTROLFILE NOKEEP;
UNTIL TIME clause: 标明备份保留时间
retention policy.FOREVER:
RESTORE POINT clause:标明数据对齐的时间点
control file.SCN.
UNTIL TIME clause specifies the date until which the backup must be kept.CHANGE command,
-- mount db
SHUTDOWN IMMEDIATE;
STARTUP MOUNT;
-- to make an archival backup of your ORCLCDE database with the KEEP FOREVER option
BACKUP AS COPY DATABASE KEEP FOREVER;
-- It failed because a backup with the KEEP FOREVER option requires the use of a recovery catalog.
-- A recovery catalog is required when KEEP FOREVER is specified because backup records will eventually age out of the control file.

-- to make an archival backup of your ORCLCDE database that will be kept for 9 days.
BACKUP AS COPY DATABASE KEEP UNTIL TIME 'SYSDATE+9';
-- It failed because a backup with the KEEP option (an archival backup) cannot be written to the Fast Recovery Area.
-- Allowing this has the potential of causing the Fast Recovery Area to quickly run out of space.

-- create dir: /home/oracle/archival_backup/
-- Create an archival backup with a FORMAT clause that will direct RMAN to create the backup in the /home/oracle/backup directory and keep it for 9 days.
BACKUP DATABASE FORMAT '/home/oracle/archival_backup/%U' TAG keep_db_tag KEEP UNTIL TIME 'SYSDATE+9';


ALTER DATABASE open;
LIST BACKUP;
-- delete obsolete backup in FRA
DELETE OBSOLETE;

ls /home/oracle/archival_backup/
