学习oracle技术,每天学一点,每天进步一点

10条有关备份恢复的良好习惯 (ZT)

上一篇 / 下一篇  2008-06-17 11:47:11 / 个人分类:文摘

10条有关备份恢复的良好习惯
===========================================================

This document assumes that you are doing the Backup and Recovery basics
$pn"s(q0RH Q|1MY0- Running in Archivelog modeITPUB个人空间a |XOPp#f1w
- multiplexing the controlfileITPUB个人空间s!BW)VkG8W
- Taking regular backupsITPUB个人空间 Fqma/J j
- Periodically doing a complete restore to test your procedures.

ITPUB个人空间U cb6Cr'Sh2s

Questions and Answers
J&Xh\V1Xv!P L01. Turn on block checking.
]? x5r/XM%j&N/Q {0REASON: The aim is to detect, very early the presence of corrupt blocks in the database.
z?&] ~ I!m~0This has a slight performance overhead, but Checksums allow Oracle to detect earlyITPUB个人空间r[] AkX
corruption caused by underlying disk, storage system, or I/O system problems.

SQL> alter system set db_block_checking = true scope=both;


'np*R(_\2a02. Turn on block tracking when using RMAN backups (if running 10g)ITPUB个人空间a8f(| j6L5z)_
REASON: This will allow RMAN to backup only those blocks that have changed since the last full
hKP.m8W"AV_0backup, which will reduce the time taken to back up, as less blocks will be backed up.

SQL> alter database enable block change tracking using file ‘/u01/oradata/ora1/change_tracking.f’;

ITPUB个人空间-q)au(D j^7E P
3. Duplex log groups and members and have more than one archive log dest.ITPUB个人空间!?1`8Qk&\,HY2F gH$f
REASON: If an archivelog is corrupted or lost, by having multiple copies in multiple locations,
z3I%d$W0t1U/M0aD8Z9D&T0the other logs will still be available and could be used.

If an online log is deleted or becomes corrupt, you will have another member that can be
~-U'yeGt^ o0used to recover if required.

SQL> alter system set log_archive_dest_2='location=/new/location/archive2' scope=both;ITPUB个人空间!V%qqj:i6Q:G:s
SQL> alter database add logfile member '/new/location/redo21.log' to group 1;


.C+\yk R-y@04. When backing up the database use the 'check logical' parameterITPUB个人空间u&V6Y cFG#wK~
REASON: This will cause RMAN to check for logical corruption within a block as well as the normal
3s(G?c(D"V0head/tail checksumming. This is the best way to ensure that you will get a good backup.

RMAN> backup check logical database plus archivelog delete input;


M*k7om$N/E$b05. Test your backup.
j7F6X_@0REASON: This will do everything except actually restore the database. This is the best method toITPUB个人空间UhQ;TmK{&m(S f
determine if your backup is good and usable before being in a situation where it isITPUB个人空间0i-bR?9i*_/t
critical and issues exist.

RMAN> restore validate database;


s d;nW$NE5~06. Have each datafile in a single backup piece
9]'P0sqW,r0REASON: When doing a partial restore RMAN must read through the entire piece to get theITPUB个人空间KewG9k~6e
datafile/archivelog requested. The smaller the backup piece the quicker the restore can
%g@foS-eoHAzu!d0complete. This is especially relevent with tape backups of large databases or where theITPUB个人空间PQ$r`(V
restore is only on individual / few files.

RMAN> backup database filesperset 1 plus archivelog delete input;

ITPUB个人空间:m&m;kO"R;z
7. Maintain your RMAN catalog/controlfileITPUB个人空间@B^.l e+q
REASON: Choose your retention policy carefully. Make sure that it compliments your tape subsystemITPUB个人空间_9Wu^5puh,@
retention policy, requirements for backup recovery strategy. If not using a catalog,ITPUB个人空间Xq"^g{ tL3f
ensure that your controlfile record keep time instance parameter matches your retention policy.

SQL> alter system set control_file_record_keep_time=21 scope=both;ITPUB个人空间/RIXY,p
This will keep 21 days of backup records.

Run regular catalog maintenance.
G4OrXN5j+l/{0REASON: Delete obsolete will remove backups that are outside your retention policy.
"z)Lz/`M9G2B(K@%M0If obsolete backups are not deleted, the catalog will continue to grow until performanceITPUB个人空间{Z z g2C_!wHE
becomes an issue.

RMAN> delete obsolete;

REASON: crosschecking will check that the catalog/controlfile matches the physical backups.ITPUB个人空间#]m/m{6LAM,v{ F
If a backup is missing, it will set the piece to 'EXPIRED' so when a restore is started,
;xhvJkTR0that it will not be eligible, and an earlier backup will be used. To remove the expiredITPUB个人空间D7B#M3q'A,g-}1u[
backups from the catalog/controlfile use the delete expired command.

RMAN> crosscheck backup;ITPUB个人空间:i B#f/Ac
RMAN> delete expired backup;

ITPUB个人空间^oZ W1LU
8. Prepare for loss of controlfiles.ITPUB个人空间+O5\)|NA"ad }|
set autobackup onITPUB个人空间 e8T(\Y7Dry
REASON: This will ensure that you always have an up to date controlfile available that has been
P5Gp#K;Y(cP0taken at the end of the current backup not during.

RMAN> configure controlfile autobackup on;

keep your backup logsITPUB个人空间 XB-o+pt2O8R\xd
REASON: The backup log contains parameters for your tape access, locations on controlfile backups
M(JO6?{0that can be utilised if complete loss occurs.

9. Test your recovery
-L&O5oL^{3v2[0REASON: During a recovery situation this will let you know how the recovery will go without
p!F^0S)j0actually doing it, and can avoid having to restore source datafiles again.

SQL> recover database test;

ITPUB个人空间w g d F+r,\
10. Do not specify 'delete all input' when backing up archivelogs
$DLkJd2x^x0REASON: Delete all input' will backup from one destination then delete both copies of the
}y8ir$O%X7K0archivelog where as 'delete input' will backup from one location and then delete what has
g u:qg;Y]1? m Orm0been backed up. The next backup will back up those from location 2 as well as new logs
7@e#E,O9w*[0from location 1, then delete all that are backed up. This means that you will have the
j6wVUB A0archivelogs since the last backup available on disk in location 2 (as well as backed up
#b-|FX+\H/u(\0once) and two copies backup up prior to the previous backup.


TAG:

 

评分:0

我来说两句

显示全部

:loveliness: :handshake :victory: :funk: :time: :kiss: :call: :hug: :lol :'( :Q :L ;P :$ :P :o :@ :D :( :)

日历

« 2008-12-02  
 123456
78910111213
14151617181920
21222324252627
28293031   

数据统计

  • 访问量: 26110
  • 日志数: 312
  • 图片数: 2
  • 建立时间: 2007-12-11
  • 更新时间: 2008-11-28

RSS订阅

Open Toolbar