同事總結的 : 用RMAN建立Physical Standby Database

tolywang發表於2007-11-30

7*24的應用環境中建立Physical Standby Database,既可以使用將表空間置於熱備狀態進行檔案複製方式建立,也可以使用RMAN備份進行建立,使用後者可以有效避免前者過程中生成過量Redo的問題,並且更簡單方便。

利用RMAN建立Physical Standby Database的基本步驟如下:


1:在Primary Database上使用RMAN建立資料檔案和歸檔日誌的備份集及Standby Control File

2:準備Standby Database,包括相關網路配置檔案/初始化引數檔案/密碼檔案/相關資料夾

3:複製之前建立的備份集到Standby Database Server

4:將Standby Database置於Nomount狀態

5:使用RMAN建立Standby DatabaseDORECOVER),最後RMAN會將Standby Database置於Mount Standby Database狀態

示例環境如下:

 

Hostname

IP

OS/Oralce

Primary

fb-rmadb

10.186.1.212

RHEL3U6/Oracle9.2.0.7

Standby

fbrmadbbak

10.186.1.216

RHEL3U6/Oracle9.2.0.7

Notes

1:如無特別提示,RMAN都在Primary Database Server上執行。

2:必須確保Standby Database Server上監聽要開啟,例項處於Nomount狀態

3RMAN備份集必須在Standby Database Server上對RMAN可見

4 Standby Database Server上必須存在密碼檔案,因為會從Primary Database Server上使用RMAN連線到Standby Database

5Standby Database Server上相關的檔案目錄必須存在(初始化引數檔案中使用到的目錄必須存在)

6Standby Database ServerOracle軟體安裝過程及profile設定過程省略。

7:兩個ServerOracle相關目錄結構一樣

具體建立過程:

1: Primary Database Server建立備份集及Standby控制檔案

建議設定通道屬性,使得最大備份片大小為2G,並預設儲存到/data/backup目錄下

fb-rmadb$rman target /

Recovery Manager: Release 9.2.0.7.0 - Production

Copyright (c) 1995, 2002, Oracle Corporation. All rights reserved.

connected to target database: RMA (DBID=1337371029)

RMAN> CONFIGURE CHANNEL DEVICE TYPE DISK MAXPIECESIZE 2048 M FORMAT '/data/backup/%U';

using target database controlfile instead of recovery catalog

new RMAN configuration parameters:

CONFIGURE CHANNEL DEVICE TYPE DISK MAXPIECESIZE 2048 M FORMAT '/data/backup/%U';

new RMAN configuration parameters are successfully stored

RMAN> configure controlfile autobackup on;

new RMAN configuration parameters:

CONFIGURE CONTROLFILE AUTOBACKUP ON;

new RMAN configuration parameters are successfully stored

RMAN> show all;

RMAN configuration parameters are:

CONFIGURE RETENTION POLICY TO REDUNDANCY 1; # default

CONFIGURE BACKUP OPTIMIZATION OFF; # default

CONFIGURE DEFAULT DEVICE TYPE TO DISK; # default

CONFIGURE CONTROLFILE AUTOBACKUP ON;

CONFIGURE CONTROLFILE AUTOBACKUP FORMAT FOR DEVICE TYPE DISK TO '%F'; # default

CONFIGURE DEVICE TYPE DISK PARALLELISM 1; # default

CONFIGURE DATAFILE BACKUP COPIES FOR DEVICE TYPE DISK TO 1; # default

CONFIGURE ARCHIVELOG BACKUP COPIES FOR DEVICE TYPE DISK TO 1; # default

CONFIGURE CHANNEL DEVICE TYPE DISK MAXPIECESIZE 2048 M FORMAT '/data/backup/%U';

RMAN configuration has no stored or default parameters

CONFIGURE MAXSETSIZE TO UNLIMITED; # default

CONFIGURE SNAPSHOT CONTROLFILE NAME TO '/u01/product/oracle/dbs/snapcf_rma.f'; # default

RMAN> BACKUP DATABASE

2> INCLUDE CURRENT CONTROLFILE FOR STANDBY

3> PLUS ARCHIVELOG;

Starting backup at 29-NOV-07

current log archived

allocated channel: ORA_DISK_1

channel ORA_DISK_1: sid=78 devtype=DISK

channel ORA_DISK_1: starting archive log backupset

channel ORA_DISK_1: specifying archive log(s) in backup set

input archive log thread=1 sequence=1 recid=1 stamp=639921994

input archive log thread=1 sequence=2 recid=2 stamp=639922002

input archive log thread=1 sequence=3 recid=3 stamp=639922003

input archive log thread=1 sequence=4 recid=4 stamp=639925442

channel ORA_DISK_1: starting piece 1 at 29-NOV-07

channel ORA_DISK_1: finished piece 1 at 29-NOV-07

piece handle=/data/backup/05j28v63_1_1 comment=NONE

channel ORA_DISK_1: backup set complete, elapsed time: 00:00:02

Finished backup at 29-NOV-07

Starting backup at 29-NOV-07

using channel ORA_DISK_1

channel ORA_DISK_1: starting full datafile backupset

channel ORA_DISK_1: specifying datafile(s) in backupset

including standby controlfile in backupset

input datafile fno=00002 name=/data/rma/undotbs01.dbf

input datafile fno=00001 name=/u01/product/oradata/rma/system01.dbf

input datafile fno=00008 name=/u01/product/oradata/rma/xdb01.dbf

input datafile fno=00003 name=/u01/product/oradata/rma/cwmlite01.dbf

input datafile fno=00005 name=/u01/product/oradata/rma/indx01.dbf

input datafile fno=00007 name=/u01/product/oradata/rma/users01.dbf

input datafile fno=00004 name=/u01/product/oradata/rma/drsys01.dbf

input datafile fno=00006 name=/u01/product/oradata/rma/tools01.dbf

input datafile fno=00036 name=/data/rma/sn_idx03.dbf

input datafile fno=00037 name=/data/rma/sn_idx04.dbf

input datafile fno=00038 name=/data/rma/sn_idx05.dbf

input datafile fno=00009 name=/data/rma/base_data01.dbf

input datafile fno=00010 name=/data/rma/ict_data01.dbf

input datafile fno=00011 name=/data/rma/log_data01.dbf

input datafile fno=00012 name=/data/rma/rec_data01.dbf

input datafile fno=00013 name=/data/rma/sn_data01.dbf

input datafile fno=00014 name=/data/rma/track_data01.dbf

input datafile fno=00015 name=/data/rma/wip_data01.dbf

input datafile fno=00016 name=/data/rma/wip_idx01.dbf

input datafile fno=00017 name=/data/rma/track_idx01.dbf

input datafile fno=00018 name=/data/rma/sn_idx01.dbf

input datafile fno=00019 name=/data/rma/rec_idx01.dbf

input datafile fno=00020 name=/data/rma/log_idx01.dbf

input datafile fno=00021 name=/data/rma/ict_idx01.dbf

input datafile fno=00022 name=/data/rma/base_idx01.dbf

input datafile fno=00023 name=/data/rma/base_data02.dbf

input datafile fno=00024 name=/data/rma/ict_data02.dbf

input datafile fno=00025 name=/data/rma/log_data02.dbf

input datafile fno=00026 name=/data/rma/rec_data02.dbf

input datafile fno=00027 name=/data/rma/sn_data02.dbf

input datafile fno=00028 name=/data/rma/track_data02.dbf

input datafile fno=00029 name=/data/rma/wip_data02.dbf

input datafile fno=00030 name=/data/rma/wip_idx02.dbf

input datafile fno=00031 name=/data/rma/track_idx02.dbf

input datafile fno=00032 name=/data/rma/sn_idx02.dbf

input datafile fno=00033 name=/data/rma/log_idx02.dbf

input datafile fno=00034 name=/data/rma/ict_idx02.dbf

input datafile fno=00035 name=/data/rma/base_idx02.dbf

input datafile fno=00039 name=/data/rma/sn_idx06.dbf

input datafile fno=00040 name=/data/rma/sn_data03.dbf

input datafile fno=00041 name=/data/rma/undotbs02.dbf

input datafile fno=00042 name=/data/rma/ict_data03.dbf

input datafile fno=00043 name=/data/rma/sn_data04.dbf

input datafile fno=00044 name=/data/rma/sn_data05.dbf

input datafile fno=00045 name=/data/rma/sn_idx07.dbf

input datafile fno=00046 name=/data/rma/sn_data06.dbf

input datafile fno=00047 name=/data/rma/sn_idx08.dbf

input datafile fno=00048 name=/data/rma/sn_data07.dbf

input datafile fno=00049 name=/data/rma/sn_idx09.dbf

input datafile fno=00050 name=/data/rma/undotbs03.dbf

input datafile fno=00051 name=/data/rma/sn_data08.dbf

input datafile fno=00052 name=/data/rma/undotbs04.dbf

input datafile fno=00053 name=/data/rma/sn_data09.dbf

input datafile fno=00054 name=/data/rma/sn_idx10.dbf

input datafile fno=00055 name=/data/rma/wip_idx03.dbf

input datafile fno=00056 name=/data/rma/wip_idx04.dbf

input datafile fno=00057 name=/data/rma/sn_data10.dbf

input datafile fno=00058 name=/data/rma/sn_idx11.dbf

input datafile fno=00059 name=/data/rma/sn_idx12.dbf

input datafile fno=00060 name=/data/rma/sn_idx13.dbf

input datafile fno=00061 name=/data/rma/sn_data11.dbf

input datafile fno=00062 name=/data/rma/rec_idx02.dbf

input datafile fno=00063 name=/data/rma/sn_idx14.dbf

channel ORA_DISK_1: starting piece 1 at 29-NOV-07

channel ORA_DISK_1: finished piece 1 at 29-NOV-07

piece handle=/data/backup/06j28v65_1_1 comment=NONE

channel ORA_DISK_1: starting piece 2 at 29-NOV-07

channel ORA_DISK_1: finished piece 2 at 29-NOV-07

piece handle=/data/backup/06j28v65_2_1 comment=NONE

channel ORA_DISK_1: starting piece 3 at 29-NOV-07

channel ORA_DISK_1: finished piece 3 at 29-NOV-07

piece handle=/data/backup/06j28v65_3_1 comment=NONE

channel ORA_DISK_1: starting piece 4 at 29-NOV-07

channel ORA_DISK_1: finished piece 4 at 29-NOV-07

piece handle=/data/backup/06j28v65_4_1 comment=NONE

channel ORA_DISK_1: starting piece 5 at 29-NOV-07

channel ORA_DISK_1: finished piece 5 at 29-NOV-07

piece handle=/data/backup/06j28v65_5_1 comment=NONE

channel ORA_DISK_1: starting piece 6 at 29-NOV-07

channel ORA_DISK_1: finished piece 6 at 29-NOV-07

piece handle=/data/backup/06j28v65_6_1 comment=NONE

channel ORA_DISK_1: starting piece 7 at 29-NOV-07

channel ORA_DISK_1: finished piece 7 at 29-NOV-07

piece handle=/data/backup/06j28v65_7_1 comment=NONE

channel ORA_DISK_1: starting piece 8 at 29-NOV-07

channel ORA_DISK_1: finished piece 8 at 29-NOV-07

piece handle=/data/backup/06j28v65_8_1 comment=NONE

channel ORA_DISK_1: starting piece 9 at 29-NOV-07

channel ORA_DISK_1: finished piece 9 at 29-NOV-07

piece handle=/data/backup/06j28v65_9_1 comment=NONE

channel ORA_DISK_1: starting piece 10 at 29-NOV-07

channel ORA_DISK_1: finished piece 10 at 29-NOV-07

piece handle=/data/backup/06j28v65_10_1 comment=NONE

channel ORA_DISK_1: starting piece 11 at 29-NOV-07

channel ORA_DISK_1: finished piece 11 at 29-NOV-07

piece handle=/data/backup/06j28v65_11_1 comment=NONE

channel ORA_DISK_1: starting piece 12 at 29-NOV-07

channel ORA_DISK_1: finished piece 12 at 29-NOV-07

piece handle=/data/backup/06j28v65_12_1 comment=NONE

channel ORA_DISK_1: starting piece 13 at 29-NOV-07

channel ORA_DISK_1: finished piece 13 at 29-NOV-07

piece handle=/data/backup/06j28v65_13_1 comment=NONE

channel ORA_DISK_1: starting piece 14 at 29-NOV-07

channel ORA_DISK_1: finished piece 14 at 29-NOV-07

piece handle=/data/backup/06j28v65_14_1 comment=NONE

channel ORA_DISK_1: starting piece 15 at 29-NOV-07

channel ORA_DISK_1: finished piece 15 at 29-NOV-07

piece handle=/data/backup/06j28v65_15_1 comment=NONE

channel ORA_DISK_1: starting piece 16 at 29-NOV-07

channel ORA_DISK_1: finished piece 16 at 29-NOV-07

piece handle=/data/backup/06j28v65_16_1 comment=NONE

channel ORA_DISK_1: starting piece 17 at 29-NOV-07

channel ORA_DISK_1: finished piece 17 at 29-NOV-07

piece handle=/data/backup/06j28v65_17_1 comment=NONE

channel ORA_DISK_1: starting piece 18 at 29-NOV-07

channel ORA_DISK_1: finished piece 18 at 29-NOV-07

piece handle=/data/backup/06j28v65_18_1 comment=NONE

channel ORA_DISK_1: starting piece 19 at 29-NOV-07

channel ORA_DISK_1: finished piece 19 at 29-NOV-07

piece handle=/data/backup/06j28v65_19_1 comment=NONE

channel ORA_DISK_1: starting piece 20 at 29-NOV-07

channel ORA_DISK_1: finished piece 20 at 29-NOV-07

piece handle=/data/backup/06j28v65_20_1 comment=NONE

channel ORA_DISK_1: starting piece 21 at 29-NOV-07

channel ORA_DISK_1: finished piece 21 at 29-NOV-07

piece handle=/data/backup/06j28v65_21_1 comment=NONE

channel ORA_DISK_1: starting piece 22 at 29-NOV-07

channel ORA_DISK_1: finished piece 22 at 29-NOV-07

piece handle=/data/backup/06j28v65_22_1 comment=NONE

channel ORA_DISK_1: starting piece 23 at 29-NOV-07

channel ORA_DISK_1: finished piece 23 at 29-NOV-07

piece handle=/data/backup/06j28v65_23_1 comment=NONE

channel ORA_DISK_1: starting piece 24 at 29-NOV-07

channel ORA_DISK_1: finished piece 24 at 29-NOV-07

piece handle=/data/backup/06j28v65_24_1 comment=NONE

channel ORA_DISK_1: starting piece 25 at 29-NOV-07

channel ORA_DISK_1: finished piece 25 at 29-NOV-07

piece handle=/data/backup/06j28v65_25_1 comment=NONE

channel ORA_DISK_1: starting piece 26 at 29-NOV-07

channel ORA_DISK_1: finished piece 26 at 29-NOV-07

piece handle=/data/backup/06j28v65_26_1 comment=NONE

channel ORA_DISK_1: starting piece 27 at 29-NOV-07

channel ORA_DISK_1: finished piece 27 at 29-NOV-07

piece handle=/data/backup/06j28v65_27_1 comment=NONE

channel ORA_DISK_1: starting piece 28 at 29-NOV-07

channel ORA_DISK_1: finished piece 28 at 29-NOV-07

piece handle=/data/backup/06j28v65_28_1 comment=NONE

channel ORA_DISK_1: starting piece 29 at 29-NOV-07

channel ORA_DISK_1: finished piece 29 at 29-NOV-07

piece handle=/data/backup/06j28v65_29_1 comment=NONE

channel ORA_DISK_1: starting piece 30 at 29-NOV-07

channel ORA_DISK_1: finished piece 30 at 29-NOV-07

piece handle=/data/backup/06j28v65_30_1 comment=NONE

channel ORA_DISK_1: starting piece 31 at 29-NOV-07

channel ORA_DISK_1: finished piece 31 at 29-NOV-07

piece handle=/data/backup/06j28v65_31_1 comment=NONE

channel ORA_DISK_1: starting piece 32 at 29-NOV-07

channel ORA_DISK_1: finished piece 32 at 29-NOV-07

piece handle=/data/backup/06j28v65_32_1 comment=NONE

channel ORA_DISK_1: starting piece 33 at 29-NOV-07

channel ORA_DISK_1: finished piece 33 at 29-NOV-07

piece handle=/data/backup/06j28v65_33_1 comment=NONE

channel ORA_DISK_1: starting piece 34 at 29-NOV-07

channel ORA_DISK_1: finished piece 34 at 29-NOV-07

piece handle=/data/backup/06j28v65_34_1 comment=NONE

channel ORA_DISK_1: starting piece 35 at 29-NOV-07

channel ORA_DISK_1: finished piece 35 at 29-NOV-07

piece handle=/data/backup/06j28v65_35_1 comment=NONE

channel ORA_DISK_1: starting piece 36 at 29-NOV-07

channel ORA_DISK_1: finished piece 36 at 29-NOV-07

piece handle=/data/backup/06j28v65_36_1 comment=NONE

channel ORA_DISK_1: starting piece 37 at 29-NOV-07

channel ORA_DISK_1: finished piece 37 at 29-NOV-07

piece handle=/data/backup/06j28v65_37_1 comment=NONE

channel ORA_DISK_1: backup set complete, elapsed time: 00:41:19

channel ORA_DISK_1: starting full datafile backupset

channel ORA_DISK_1: specifying datafile(s) in backupset

input datafile fno=00064 name=/data/rma/sn_data12.dbf

channel ORA_DISK_1: starting piece 1 at 29-NOV-07

channel ORA_DISK_1: finished piece 1 at 29-NOV-07

piece handle=/data/backup/07j291jk_1_1 comment=NONE

channel ORA_DISK_1: backup set complete, elapsed time: 00:00:45

channel ORA_DISK_1: starting full datafile backupset

channel ORA_DISK_1: specifying datafile(s) in backupset

input datafile fno=00066 name=/data/rma/sn_idx15.dbf

channel ORA_DISK_1: starting piece 1 at 29-NOV-07

channel ORA_DISK_1: finished piece 1 at 29-NOV-07

piece handle=/data/backup/08j291l1_1_1 comment=NONE

channel ORA_DISK_1: backup set complete, elapsed time: 00:00:35

channel ORA_DISK_1: starting full datafile backupset

channel ORA_DISK_1: specifying datafile(s) in backupset

input datafile fno=00067 name=/data/rma/sn_data13.dbf

channel ORA_DISK_1: starting piece 1 at 29-NOV-07

channel ORA_DISK_1: finished piece 1 at 29-NOV-07

piece handle=/data/backup/09j291m4_1_1 comment=NONE

channel ORA_DISK_1: backup set complete, elapsed time: 00:00:25

channel ORA_DISK_1: starting full datafile backupset

channel ORA_DISK_1: specifying datafile(s) in backupset

input datafile fno=00068 name=/data/rma/sn_idx16.dbf

channel ORA_DISK_1: starting piece 1 at 29-NOV-07

channel ORA_DISK_1: finished piece 1 at 29-NOV-07

piece handle=/data/backup/0aj291mt_1_1 comment=NONE

channel ORA_DISK_1: backup set complete, elapsed time: 00:00:35

channel ORA_DISK_1: starting full datafile backupset

channel ORA_DISK_1: specifying datafile(s) in backupset

input datafile fno=00069 name=/data/rma/wip_idx06.dbf

channel ORA_DISK_1: starting piece 1 at 29-NOV-07

channel ORA_DISK_1: finished piece 1 at 29-NOV-07

piece handle=/data/backup/0bj291o0_1_1 comment=NONE

channel ORA_DISK_1: backup set complete, elapsed time: 00:00:25

channel ORA_DISK_1: starting full datafile backupset

channel ORA_DISK_1: specifying datafile(s) in backupset

input datafile fno=00070 name=/data/rma/wip_data03.dbf

channel ORA_DISK_1: starting piece 1 at 29-NOV-07

channel ORA_DISK_1: finished piece 1 at 29-NOV-07

piece handle=/data/backup/0cj291op_1_1 comment=NONE

channel ORA_DISK_1: backup set complete, elapsed time: 00:00:25

channel ORA_DISK_1: starting full datafile backupset

channel ORA_DISK_1: specifying datafile(s) in backupset

input datafile fno=00071 name=/data/rma/sn_idx17.dbf

channel ORA_DISK_1: starting piece 1 at 29-NOV-07

channel ORA_DISK_1: finished piece 1 at 29-NOV-07

piece handle=/data/backup/0dj291pi_1_1 comment=NONE

channel ORA_DISK_1: backup set complete, elapsed time: 00:00:25

channel ORA_DISK_1: starting full datafile backupset

channel ORA_DISK_1: specifying datafile(s) in backupset

input datafile fno=00065 name=/data/rma/wip_idx05.dbf

channel ORA_DISK_1: starting piece 1 at 29-NOV-07

channel ORA_DISK_1: finished piece 1 at 29-NOV-07

piece handle=/data/backup/0ej291qb_1_1 comment=NONE

channel ORA_DISK_1: backup set complete, elapsed time: 00:00:25

Finished backup at 29-NOV-07

Starting backup at 29-NOV-07

current log archived

using channel ORA_DISK_1

channel ORA_DISK_1: starting archive log backupset

channel ORA_DISK_1: specifying archive log(s) in backup set

input archive log thread=1 sequence=5 recid=5 stamp=639928165

channel ORA_DISK_1: starting piece 1 at 29-NOV-07

channel ORA_DISK_1: finished piece 1 at 29-NOV-07

piece handle=/data/backup/0fj291r5_1_1 comment=NONE

channel ORA_DISK_1: backup set complete, elapsed time: 00:00:02

Finished backup at 29-NOV-07

Starting Control File and SPFILE Autobackup at 29-NOV-07

piece handle=/u01/product/oracle/dbs/c-1337371029-20071129-00 comment=NONE

Finished Control File and SPFILE Autobackup at 29-NOV-07

RMAN> exit

2: 準備Standby Database

包括相關網路配置檔案/初始化引數檔案/密碼檔案/相關資料夾

監聽配置檔案

fbrmadbbak$cat listener.ora

# LISTENER.ORA Network Configuration File: /u01/product/oracle/network/admin/listener.ora

# Generated by Oracle configuration tools.

LISTENER =

來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/35489/viewspace-85062/,如需轉載,請註明出處,否則將追究法律責任。

相關文章