使用begin backup備份資料庫
10g可以進行database級別的hot backup,此之前只能以tablespace為單位,個人感覺rman的backup as copy命令更方便。
使用此方法備份需要注意以下兩點
1
產生大量的日誌,備份過程中block若被修改,整個block image都會被寫入redo log
2
備份期間資料檔案頭的SCN保持不變,以便recover時定位需要使用的歸檔日誌
V$backup檢視處於backup狀態的datafile
SQL> select * from V$BACKUP;
FILE# STATUS CHANGE# TIME
--------- ---------------- ------------ -----------
1 NOT ACTIVE 0
2 NOT ACTIVE 0
3 ACTIVE 15021 12-NOV-97
http://space.itpub.net/15480802/viewspace-687334
What Happens When A Tablespace/Database Is Kept In Begin Backup Mode [ID 469950.1] |
||
|
||
|
Modified 11-MAR-2011 Type HOWTO Status MODERATED |
|
In
this Document
Platforms: 1-914CU;
This document is being delivered to you via Oracle Support's Rapid Visibility (RaV) process and therefore has not been subject to an independent technical review. |
Applies to:
Oracle
Server - Enterprise Edition - Version: 8.1.7.4 to 11.1.0.6 - Release: 8.1.7 to
11.1
Information in this document applies to any platform.
Goal
This document explains in detail about what happens when a tablespace/datafile is kept in hot backup/begin backup mode.
Solution
To perform. online/hot backup we have to put the
tablespace in begin backup mode followed by copying the datafiles and then
putting the tablespace to end backup.
In 8i, 9i we have to put each tablespace individually in begin/end backup mode
to perform. the online backup. From 10g onwards the entire database can be put
in begin/end backup mode.
Make sure that the database is in archivelog mode
Example :
Performing a single
tablespace backup
+ sql>alter tablespace system begin backup;
+ Copy the corresponding
datafiles using appropriate O/S commands.
+ sql>alter
tablespace system end backup;
Performing a full
database backup (starting from 10g)
+ sql> alter database begin backup;
+ Copy all the datafiles
using appropriate O/S commands.
+ sql> alter database
end backup;
One danger in making online
backups is the possibility of inconsistent data within a block. For example,
assume that you are backing up block 100 in datafile users.dbf. Also, assume
that the copy utility reads the entire block while DBWR is in the middle of
updating the block. In this case, the copy utility may read the old data in the
top half of the block and the new data in the bottom top half of the block. The
result is called a fractured block, meaning that the data contained in this
block is not consistent. at a given SCN.
Therefore oracle
internally manages the consistency as below :
1. The first time a block is changed in a datafile that is in hot backup
mode, the entire block is written to the redo log files, not just the changed
bytes. Normally only the changed bytes (a redo vector) is written. In hot
backup mode, the entire block is logged the first time. This is because you can
get into a situation where the process copying the datafile and DBWR are
working on the same block simultaneously.
Lets say they are and the OS blocking read factor is 512bytes (the OS reads 512 bytes from disk at a time). The backup program goes to read an 8k Oracle block. The OS gives it 4k. Meanwhile -- DBWR has asked to rewrite this block. the OS schedules the DBWR write to occur right now. The entire 8k block is rewritten. The backup program starts running again (multi-tasking OS here) and reads the last 4k of the block. The backup program has now gotten an fractured block -- the head and tail are from two points in time.
We cannot deal with that during recovery. Hence, we log the entire block image so that during recovery, this block is totally rewritten from redo and is consistent with itself atleast. We can recover it from there.
2. The datafile headers which contain the SCN of the last completed
checkpoint are not updated while a file is in hot backup mode. This lets the
recovery process understand what archive redo log files might be needed to
fully recover this file.
To limit the effect of this additional logging, you should ensure you only
place one tablepspace at a time in backup mode and bring the tablespace out of
backup mode as soon as you have backed it up. This will reduce the number of
blocks that may have to be logged to the minimum possible.
Try to take the hot/online backups when there is less / no load on the database, so that less redo will be generated.
來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/15480802/viewspace-721096/,如需轉載,請註明出處,否則將追究法律責任。
相關文章
- 用begin backup的方式遷移資料庫資料庫
- Backup And Recovery User's Guide-備份資料庫-使用RMAN備份資料庫檔案GUIIDE資料庫
- Oracle備份與恢復系列(三)alter tablspace begin backupOracle
- Backup And Recovery User's Guide-備份資料庫-使用RMAN備份控制檔案GUIIDE資料庫
- Backup And Recovery User's Guide-備份資料庫-使用RMAN備份表空間和資料檔案GUIIDE資料庫
- 如何使用Hyper Backup備份資料至異地
- Backup And Recovery User's Guide-備份資料庫-使用RMAN備份歸檔重做日誌GUIIDE資料庫
- 使用RMAN備份資料庫資料庫
- Backup And Recovery User's Guide-備份資料庫-備份處於非歸檔模式的資料庫GUIIDE資料庫模式
- 使用Handy Backup 6.2進行資料備份方法
- Backup And Recovery User's Guide-備份資料庫-RMAN備份概覽-RMAN備份的目的GUIIDE資料庫
- 【RMAN】使用增量備份更新資料庫備份映象資料庫
- Backup And Recovery User's Guide-從RMAN開始-備份資料庫-增量備份GUIIDE資料庫
- Backup And Recovery User's Guide-備份資料庫-RMAN備份概覽-進行壓縮備份GUIIDE資料庫
- Backup And Recovery User's Guide-備份資料庫-RMAN備份概覽-為RMAN備份指定TAGGUIIDE資料庫
- 使用innobackupex備份mysql資料庫MySql資料庫
- 使用Xtrabackup備份mysql資料庫MySql資料庫
- Backup And Recovery User's Guide-備份資料庫-RMAN備份概覽-為RMAN備份指定格式GUIIDE資料庫
- Backup And Recovery User's Guide-備份資料庫-RMAN備份概覽-指定備份輸出選項GUIIDE資料庫
- Backup And Recovery User's Guide-從RMAN開始-備份資料庫-備份處於歸檔模式的資料庫GUIIDE資料庫模式
- 資料備份軟體:EaseUS Todo Backup for MacMac
- 如何恢復Hyper Backup備份的資料
- 資料庫備份資料庫
- Backup And Recovery User's Guide-備份資料庫-備份歸檔重做日誌檔案GUIIDE資料庫
- 使用JOB定時備份資料庫資料庫
- (轉)使用Xtrabackup備份MySQL資料庫MySql資料庫
- 使用RMAN建立資料庫備份庫(筆記)資料庫筆記
- 理解備份集backup set與備份片backup piece
- Backup And Recovery User's Guide-從RMAN開始-備份資料庫-典型的備份選項GUIIDE資料庫
- Backup And Recovery User's Guide-備份RMAN備份-使用RMAN備份備份集GUIIDE
- Backup And Recovery User's Guide-從RMAN開始-備份資料庫GUIIDE資料庫
- Backup And Recovery User's Guide-對於SUSPENDED資料庫的備份GUIIDE資料庫
- mysql 資料庫 備份MySql資料庫
- 資料庫備份策略資料庫
- MongoDB資料庫備份MongoDB資料庫
- mysql 資料庫備份MySql資料庫
- 資料庫備份方案資料庫
- 資料備份 reed-solomn 庫 的使用