Incremental backups:
Backuping up database based on changed blocks
stratergies:- incremental (differential(default) and cumulative )
incremental :- level 0 (full db) , level 1 ( backuping blocks since level 0 )
differential:- backuping db since last level 1 backup.
cumulative:- backuping db since last level 0 backup.
differential:- sun(level 0), mon (level 1) , tue(level 1), wed(level 1), thu(level 1), fri(level 1), sat(level 1)
cumulative:- sun(level 0), mon(sun+level 1), tue(sun+mon+level1), wed(sun+mon+tue+level1),
thu(sun+mon+tue+wed+level1), fri(sun+mon+tue+wed+thu+level1),sat(sun+mon+tue+wed+thu+fri+level1)
Recovery stepsfor both (differential & cumulative will be same rman auto-select backups):-
RMAN> STARTUP MOUNT;
RMAN> RESTORE DATABASE;
RMAN> RECOVER DATABASE;
RMAN> ALTER DATABASE OPEN RESETLOGS;
Side-by-Side Comparison
| Factor | Differential | Cumulative |
|---|
| Backup size (daily) | Smaller (only daily changes) | Larger (grows each day) |
| Backup time | Faster | Slower (more blocks each day) |
| Storage usage | Less | More |
| Recovery time | Slower (apply multiple L1s) | Faster (apply only 1 L1) |
| Backup sets to restore | L0 + all L1s since L0 | L0 + latest L1 only |
| Complexity | Slightly complex recovery | Simple recovery |
| Best for | Limited storage environments | Fast recovery requirement (low RTO) |
Point-in-time-recovery:-
1. Restore to specific time:-
RMAN> STARTUP MOUNT;
RMAN> RUN {
SET UNTIL TIME "TO_DATE('2024-04-09 14:00:00','YYYY-MM-DD HH24:MI:SS')";
RESTORE DATABASE;
RECOVER DATABASE;
}
RMAN> ALTER DATABASE OPEN RESETLOGS;
2. Restore to specific scn:-
RMAN> STARTUP MOUNT;
RMAN> RUN {
SET UNTIL SCN 1234567;
RESTORE DATABASE;
RECOVER DATABASE;
}
RMAN> ALTER DATABASE OPEN RESETLOGS;
3. Restore to specific log sequence:-
RMAN> STARTUP MOUNT;
RMAN> RUN {
SET UNTIL SEQUENCE 500 THREAD 1;
RESTORE DATABASE;
RECOVER DATABASE;
}
RMAN> ALTER DATABASE OPEN RESETLOGS;
_________________________________________________________________
TABLESPACE RECOVERY:-
-- Take tablespace offline
SQL> ALTER TABLESPACE users OFFLINE IMMEDIATE;
-- Restore and recover tablespace
RMAN> RESTORE TABLESPACE users;
RMAN> RECOVER TABLESPACE users;
-- Bring tablespace online
SQL> ALTER TABLESPACE users ONLINE;
_________________________________________________________________
Datafile recovery:-
-- If datafile is missing/corrupted
RMAN> RESTORE DATAFILE 5;
RMAN> RECOVER DATAFILE 5;
-- Or by filename
RMAN> RESTORE DATAFILE '/oradata/users01.dbf';
RMAN> RECOVER DATAFILE '/oradata/users01.dbf';
__________________________________________________________________
Control file recovery:-
-- If controlfile is lost
RMAN> STARTUP NOMOUNT;
RMAN> RESTORE CONTROLFILE FROM AUTOBACKUP;
-- OR from specific location
RMAN> RESTORE CONTROLFILE FROM '/backup/ctrl_backup';
RMAN> ALTER DATABASE MOUNT;
RMAN> RECOVER DATABASE;
RMAN> ALTER DATABASE OPEN RESETLOGS;
__________________________________________________________________
Archivelog only recovery (no restore required)
-- If datafiles are intact but archivelogs needed
RMAN> RECOVER DATABASE; -- applies pending archivelogs
-- Recover using specific archivelog
RMAN> RECOVER DATABASE UNTIL SEQUENCE 450;
__________________________________________________________________
No comments:
Post a Comment