Can Weak Backup & Recovery Skills Cost You Your Probation?
The article explains why mastering database backup and recovery—including failure types, logical vs. physical backups, flashback, full and partial restores, a weekly backup strategy, RMAN configuration, shell scripts, and monitoring queries—is essential for avoiding costly mistakes and passing a new‑job probation.
Database Failure Types
user process failure – handled automatically by PMON
instance failure – handled automatically by SMON
user errors – require DBA intervention via backup and restore
media failure – must be addressed with backup and redo‑log recovery
Backup and Recovery Classifications
Logical backup
Traditional export/import (exp/imp) and Data Pump (expdp/impdp) capture object states at a point in time
Target object‑oriented logical backups; cannot be used for media failure recovery because recovery consists only of a restore step without a recover phase
Physical backup
Designed for media failure scenarios
Manual OS‑level backup (UMAN) uses operating‑system commands to copy files and then applies archived redo logs for recovery
Automated backup using Oracle RMAN performs both restore and recovery automatically
Physical backups can be consistent (cold) or inconsistent (hot); a complete strategy should prioritize physical backups and use logical backups as a supplement for critical tables
Flashback Technology
Uses undo data or flashback logs for rapid logical recovery
Provides logical recovery at various granularity levels
Oracle 11g supports seven flashback methods; the fast‑recovery area is relevant only to flashback database
Full vs. Partial Recovery
Full recovery: uses a complete or incremental backup to restore a datafile to the last committed state before failure, avoiding data loss
Partial recovery: combines a full backup with archived logs to restore the database to a specific point in time or SCN, which may involve data loss
Backup Strategy
Weekly schedule – level‑0 full backup every Sunday; level‑1 incremental backups Monday through Saturday
Retention policy – redundancy 2
Enable automatic control‑file backup
RMAN> show all;</code>
<code>CONFIGURE RETENTION POLICY TO REDUNDANCY 2;</code>
<code>CONFIGURE CONTROLFILE AUTOBACKUP ON;Backup Script Example
#!/bin/bash
export ORACLE_BASE=/u01/app/oracle
export ORACLE_HOME=$ORACLE_BASE/product/11.2.0/dbhome_1
export ORACLE_SID=PROD
PATH=/usr/sbin:$PATH; export PATH
PATH=$ORACLE_HOME/bin:$PATH; export PATH
rman target / << EOF
run{
crosscheck backup;
allocate channel c1 device type disk;
allocate channel c2 device type disk;
backup incremental level 0 database format '/u01/backup/rman/db_%U.bak' plus archivelog format '/u01/backup/rman/ar_%U.bak';
backup current controlfile format '/u01/backup/rman/ctl_%U.bak';
report obsolete device type disk;
delete noprompt obsolete device type disk;
delete noprompt expired backup device type disk;
release channel c1;
release channel c2;
}
EOF
exitMake the scripts executable:
chmod a+x /home/oracle/scripts/rman_level0.sh
chmod a+x /home/oracle/scripts/rman_level1.shScheduling with crontab
0 * * * * /home/oracle/scripts/rman_level0.sh >> /u01/backup/rman/PROD_rman_L0_`date +%Y%m%d_%H%M%S`.log 2>&1
15,30,45 * * * * /home/oracle/scripts/rman_level1.sh >> /u01/backup/rman/PROD_rman_L1_`date +%Y%m%d_%H%M%S`.log 2>&1Verify Backup Status
select a.TIME_TAKEN_DISPLAY as "用时",
a.INPUT_BYTES_DISPLAY as "大小",
a.INPUT_BYTES_PER_SEC_DISPLAY as "速度",
a.INPUT_TYPE as "备份类型",
to_char(start_time,'day') day1,
to_char(start_time,'yyyy-mm-dd hh24:mi:ss') as "开始时间",
to_char(end_time,'yyyy-mm-dd hh24:mi:ss') as "结束时间",
output_device_type,
status,
input_type
from V$RMAN_BACKUP_JOB_DETAILS a;Illustrative Diagrams
Linux Tech Enthusiast
Focused on sharing practical Linux technology content, covering Linux fundamentals, applications, tools, as well as databases, operating systems, network security, and other technical knowledge.
How this landed with the community
Was this worth your time?
0 Comments
Thoughtful readers leave field notes, pushback, and hard-won operational detail here.
