Chinaunix首页 | 论坛 | 博客
  • 博客访问: 927709
  • 博文数量: 358
  • 博客积分: 8185
  • 博客等级: 中将
  • 技术积分: 3751
  • 用 户 组: 普通用户
  • 注册时间: 2008-10-15 16:27
个人简介

The views and opinions expressed all for my own,only for study and test, not reflect the views of Any Company and its affiliates.

文章分类

全部博文(358)

文章存档

2012年(8)

2011年(18)

2010年(50)

2009年(218)

2008年(64)

我的朋友

分类: Oracle

2009-09-04 22:57:43

■■Backing Up an Oracle Database

■Backup Tools
・RMAN
RMAN can back up datafiles, the controlfile, archive logs, and the server parameter file(the spfile)

■Different types of backups
①Whole or Partial Backups
・A whole backup is a backup of all the datafiles, the controlfile, and (if you are using it) the spfile
・do not back up the online redo logs,Online redo log files are protected by multiplexing, and optionally, by archiving
・only datafiles for permanent tablespaces can be backed up
・※Partial backups are valid only if your database is in archivelog mode.
This means applying changes from the archived and online redo log files to bring it up to date.
②Full or Incremental Backups
・A full backup, which may be whole or partial, is a complete copy of one or more datafiles. Every block of the datafile is backed up. 
・An incremental backup is a backup of just some of the blocks of a datafile: only the blocks that have been changed or added since the last full backup will be included.
・※Incremental backups can be done only with RMAN, not with operating system commands.
Incremental backups can be done whether the database is open or closed, and whether it is in archivelog or noarchivelog mode. But they can be done only by RMAN.
③Offline or Online Backups
・An offline backup is a backup taken while the database is closed. You may hear offline backups referred to as“closed,”“cold,”or“consistent”backups. 
・An online backup is a backup taken while the database is in use. Other terms for online backups are“open,”“hot,”or“inconsistent”backups.
・※Online backups can be whole or partial, be full or incremental, and be carried out with RMAN or with operating system commands. But they can only be done if the database is in archivelog mode.
 using operating system utilities to perform online backups,
 ALTER TABLESPACE…BEGIN BACKUP
 CP...
 ALTER TABLESPACE…END BACKUP
④Image Copies or Backup Sets
・An image copy is a backup of a file that is byte for byte the same as the source file
・A backup set is a proprietary structure generated by RMAN
a backup set never contains empty blocks.
・※Image copies can go only to disk. Backup sets can go to disk or tape.
※※
ⅰ.must in archivelog mode:
・Online backups
・Partial backups
Offline restore of critical datafiles
ⅱ.only with RMAN:
・Incremental backups 

■RMAN Settings
・Device Settings 
The options for disk backups are the degree of parallelism, the target directory(Default DB_RECOVERY_FILE_DEST), and whether to generate backup sets or image copies  
・Backup Set Settings
-the Maximum Backup Piece Size.
-specify multiplexing of backup sets,by specifying multiple copies
・Policy Settings
-The first option on the Policy Settings tab is whether to back up the controlfile and the server parameter (spfile) file whenever a backup of anything else is taken.
-The next option is whether to optimize backups by excluding files that have not changed since the last backup
-Then there is an option “Enable block change tracking for faster incremental backups.”
(Change Tracking Writer (or CTWR) background process.)
eg:
SQL> select program from v$process where program like '%CTWR%';
未选定行
SQL> alter database enable block change tracking using file '/tmp/tracking';
数据库已更改。
SQL> select program from v$process where program like '%CTWR%';
PROGRAM
--------------------------------------------------------------------------------
oracle@centos5 (CTWR)
-Finally, there is the Retention Policy section

■Scheduling Automatic Backups
Oracle Suggested backup strategy:a whole online backup+incremental backups
eg:
run {
allocate channel oem_backup_disk1 type disk ;
backup incremental level 0 cumulative filesperset = 2 as BACKUPSET tag '%TAG' database include 

current controlfile;
backup filesperset = 2 as BACKUPSET tag '%TAG' archivelog all not backed up;
release channel oem_backup_disk1;
}
allocate channel for maintenance type disk;
delete noprompt obsolete device type disk;
release channel;

■Controlfile Backup
BACKUP CONTROLFILE TO TRACE

eg:Backing Up the Controlfile to Trace with SQL*Plus
SQL> alter database backup controlfile to trace;
数据库已更改。
SQL> show parameter user_dump_dest;
NAME                                 TYPE                   VALUE
------------------------------------ ---------------------- ------------------------------
user_dump_dest                       string                 /u01/app/oracle/admin/gaudi/udump
[oracle@centos5 tmp]$ cd /u01/app/oracle/product/10.2.0.1/archive1
[oracle@centos5 archive1]$ ls

■The Default Backup Destination
The flash recovery area is controlled by two parameters: DB_RECOVERY_FILE_DEST and DB_RECOVERY_FILE_DEST_SIZE(default 2G)
It is therefore important to monitor the flash recovery area;
SQL> select * from v$recovery_file_dest;

NAME                                     SPACE_LIMIT SPACE_USED SPACE_RECLAIMABLE 

NUMBER_OF_FILES
---------------------------------------- ----------- ---------- ----------------- -----------

----
/u01/app/oracle/flash_recovery_area       2147483648  222855168                 0              

 5

阅读(367) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~