DB2 多分區(qū)數(shù)據(jù)庫(kù)備份的正確操作流程演示
以下的文章主要向大家講述的是DB2 多分區(qū)數(shù)據(jù)庫(kù)備份的正確操作流程,以及對(duì)DB2 多分區(qū)數(shù)據(jù)庫(kù)備份的實(shí)際操作中要涉及到的相關(guān)細(xì)節(jié)的描述,以下就是文章的主要內(nèi)容的詳細(xì)描述,望大家有所收獲。
分區(qū), 數(shù)據(jù)庫(kù)
編目分區(qū):
- Catalog database partition number = 0
這個(gè)就是編目分區(qū)。
斷掉所有的連接。
- DB2 force applications all
- DB2_all "<<+0<DB2 backup database sample to d:\data compress"
- DB2_all "<<-0<DB2 backup database sample to d:\data compress"
- DB2_all "<<+0< DB2 restore db sample from d:\data taken at 20090212141538 replace existing "
- DB2_all "<<-0< DB2 restore db sample from d:\data taken at 20090212141630 replace existing"
- replace existing
- If a database with the same alias as the target database alias already exists, this parameter specifies
- that the restore utility is to replace the existing database with the restored database. This is useful
- for scripts that invoke the restore utility, because the command line processor will not prompt the
- user to verify deletion of an existing database. If the WITHOUT PROMPTING parameter is specified,
- it is not necessary to specify REPLACE EXISTING, but in this case, the operation will fail if events occur that normally require user intervention.
為對(duì)分區(qū)數(shù)據(jù)庫(kù)的所有分區(qū)進(jìn)行備份操作,我們可利用 DB2_all 的作用。在語(yǔ)句前加上 DB2_all,并將語(yǔ)句引用在 "" 中,可令該語(yǔ)句在一個(gè)實(shí)例中的每個(gè)分區(qū)上被執(zhí)行,而無(wú)需分別對(duì)每個(gè)分區(qū)重復(fù)發(fā)出相同的命令。BACKUP 便可通過(guò)這種方式實(shí)現(xiàn)對(duì)分區(qū)數(shù)據(jù)庫(kù)的操作,但是對(duì)于編目分區(qū)例外。由于 DB2 在備份或恢復(fù)時(shí)要求獨(dú)占編目分區(qū),因此在對(duì)其它分區(qū)進(jìn)行備份操作之前,首先必須先完成該分區(qū)的備份操作。
另外,在 DB2_all 之后的 "" 語(yǔ)句中,我們還可以以下述方式作開頭,以指定命令所作用的分區(qū):
<<+分區(qū)號(hào)< :表示后續(xù)命令作用于該分區(qū)。
<<-分區(qū)號(hào)< :表示后續(xù)命令作用于除該分區(qū)之外的其它分區(qū)。
||<<-分區(qū)號(hào)< 或 <<-分區(qū)號(hào); :表示后DB2 多分區(qū)數(shù)據(jù)庫(kù)備份續(xù)命令作用于除該分區(qū)之外的其它分區(qū),
并且是以并行方式進(jìn)行的。
綜上所述,對(duì)于分區(qū)數(shù)據(jù)庫(kù)的數(shù)據(jù)進(jìn)行備份操作的命令為(以編目分區(qū)號(hào)為 0 舉例):
1. 無(wú)需并行操作的方式:
當(dāng)備份操作不需要使用并行方式時(shí),則不存在先對(duì)編目分區(qū)進(jìn)行操作的問(wèn)題,此時(shí)可通過(guò)一條命令實(shí)現(xiàn)備份操作。
DB2_all "DB2 BACKUP DATABASE <數(shù)據(jù)庫(kù)別名> TO <路徑/設(shè)備名>"
2. 使用并行操作的方式:
DB2_all "<<+0< DB2 BACKUP DATABASE <數(shù)據(jù)庫(kù)別名> TO <路徑/設(shè)備名>" (windows下)
DB2_all "||<<-0< DB2 BACKUP DATABASE <數(shù)據(jù)庫(kù)別名> TO <路徑/設(shè)備名>"
或
DB2_all "<<-0<; DB2 BACKUP DATABASE <數(shù)據(jù)庫(kù)別名> TO <路徑/設(shè)備名>"
即首先對(duì)編目分區(qū) - 0 號(hào)分區(qū)進(jìn)行備份操作,然后再對(duì)除編目分區(qū)之外的其它分區(qū)同時(shí)并行操作,以縮短操作的時(shí)間,這一點(diǎn)體現(xiàn)了分區(qū)數(shù)據(jù)庫(kù)的優(yōu)越性。
- DB2 force applications all
- DB2_all "<<+0<DB2 connect to churndb;DB2 backup database churndb to /DB2log/DB2buckup compress;DB2 terminate"
- DB2_all "<<-0<DB2 connect to churndb;DB2 backup database churndb to /DB2log/DB2buckup compress;DB2 terminate"
上述的相關(guān)內(nèi)容就是對(duì)DB2 多分區(qū)數(shù)據(jù)庫(kù)備份的描述,希望會(huì)給你帶來(lái)一些幫助在此方面。
【編輯推薦】
- IBM DB2 Content Manager V83與手工配置SSL
- 失敗DB2® access 服務(wù)器配置的正確恢復(fù)流程
- DB2確定某個(gè)表的統(tǒng)計(jì)信息的收集時(shí)間大揭秘
- import 或是 load多個(gè)DB2主從表談何容易?
- 揭秘DB2 9數(shù)據(jù)庫(kù)需要的內(nèi)存與磁盤條件!