ITPub博客

首页 > Linux操作系统 > Linux操作系统 > 同事总结的 : 用RMAN创建Physical Standby Database

同事总结的 : 用RMAN创建Physical Standby Database

原创 Linux操作系统 作者:tolywang 时间:2007-11-30 00:00:00 0 删除 编辑

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/,如需转载,请注明出处,否则将追究法律责任。

请登录后发表评论 登录
全部评论
Oracle , MySQL, SAP IQ, SAP HANA, PostgreSQL, Tableau 技术讨论,希望在这里一起分享知识,讨论技术,畅谈人生 。

注册时间:2007-12-10

  • 博文量
    5595
  • 访问量
    13268051