你好,游客 登录 注册 搜索
背景:
阅读新闻

Oracle 10g RAC环境下创建物理DATAGUARD

[日期:2011-06-09] 来源:Linux社区  作者:ksly1226 [字体:大 中 小]
5、设置备库参数文件

从主库rac1上根据spfile创建一个pfile文件,并传到备库上。

SQL> create pfile from spfile;


File created.


SQL> exit

Disconnected from Oracle Database 10g Enterprise Edition Release 10.2.0.3.0 - Production

With the Partitioning, Real Application Clusters and Data Mining options

[oracle@rac1 ~]$ cd $ORACLE_HOME/dbs

[oracle@rac1 dbs]$ scp initrac1.ora 172.25.0.35:`pwd`

initrac1.ora


在备库上修改参数文件:


? 删除所有非"*"打头的参数设置及rac相关参数

? 设置dataguard参数


修改后参数如下:

[oracle@standby dbs]$ more initrac1.ora

*.audit_file_dest='/opt/oracle/admin/rac/adump'

*.background_dump_dest='/opt/oracle/admin/rac/bdump'

*.compatible='10.2.0.3'

*.control_files='/soft/oradata/rac/control01.ctl','/soft/oradata/rac/control02.ctl','/soft/oradata/rac/control03.ctl'

*.core_dump_dest='/opt/oracle/admin/rac/cdump'

*.db_block_size=8192

*.db_domain=''

*.db_file_multiblock_read_count=16

*.db_file_name_convert='/DEV/RAW/','/SOFT/ORADATA/RAC/'

*.db_name='rac'

*.db_unique_name='STANDBY'

*.fal_client='STANDBY'

*.fal_server='PRIMARY'

*.job_queue_processes=10

*.log_archive_config='DG_CONFIG=(primary,standby)'

*.log_archive_dest_1='LOCATION= /soft/oradata/archivelog/ VALID_FOR=(ALL_LOGFILES,ALL_ROLES) DB_UNIQUE_NAME=standby'

*.log_archive_dest_2='SERVICE=primary LGWR ASYNC VALID_FOR=(ONLINE_LOGFILES,PRIMARY_ROLE) DB_UNIQUE_NAME=primary'

*.log_archive_dest_state_1='ENABLE'

*.log_archive_dest_state_2='ENABLE'

*.log_archive_format='%t_%s_%r.arc'

*.log_archive_max_processes=4

*.log_file_name_convert='/DEV/RAW/','/SOFT/ORADATA/RAC/'

*.open_cursors=300

*.pga_aggregate_target=16777216

*.processes=150

*.remote_login_passwordfile='EXCLUSIVE'

*.sga_max_size=157286400

*.sga_target=157286400

*.standby_file_management='AUTO'

*.undo_management='AUTO'

undo_tablespace='UNDOTBS1'

*.user_dump_dest='/opt/oracle/admin/rac/udump'

以上有些参数非必须设置的,但是为了switchover更方便,建议都修改上。

Undo表空间保留其中一个就可以。

路径转换相关参数要设置对,否则会报错。


6、把备库启动到nomount状态

[oracle@standby ~]$ sqlplus "/as sysdba"


SQL*Plus: Release 10.2.0.3.0 - Production on Wed Apr 30 18:42:39 2008


Copyright (c) 1982, 2006, Oracle. All Rights Reserved.


Connected to an idle instance.


SQL> startup nomount

ORACLE instance started.


Total System Global Area 159383552 bytes

Fixed Size 1260672 bytes

Variable Size 62915456 bytes

Database Buffers 92274688 bytes

Redo Buffers 2932736 bytes


7、从主库拷贝备份到备库上

之前备份的所有文件都拷贝到备库上,路径要和主库备份路径保持一致。如果不一致,linux下可以用ln的方式解决。

注意:两个节点都有归档的备份,要把这些备份都拷贝到备库上。

RAC1:

[oracle@rac1 backup]$ scp * 172.25.0.35:`pwd`

01jf4fqq_1_1 100% 23MB 3.8MB/s 00:06

03jf4fr9_1_1 100% 194KB 194.0KB/s 00:00

04jf4frg_1_1 100% 315MB 3.4MB/s 01:34

08jf4fv9_1_1 100% 13KB 13.0KB/s 00:00

09jf4fvf_1_1 100% 4608 4.5KB/s 00:00

CON_0ajf4gqi_1_1 100% 15MB 3.7MB/s 00:04


RAC2:

[oracle@rac2 backup]$ scp * 172.25.0.35:`pwd`

02jf4fql_1_1 100% 7145KB 3.5MB/s 00:02

05jf4frg_1_1 100% 175MB 3.4MB/s 00:52

06jf4ft0_1_1 100% 15MB 1.5MB/s 00:10

07jf4ftm_1_1 100% 96KB 96.0KB/s 00:00

 


、恢复备库

1、在主库添加指向备库的tnsname

在主库的tnsnames.ora添加如下内容:

STANDBY =

(DESCRIPTION =

(ADDRESS = (PROTOCOL = TCP)(HOST =200.200.200.123)(PORT = 1521))

(CONNECT_DATA =

(SERVER = DEDICATED)

(SERVICE_NAME = standby)

)


2、在主库执行,利用auxiliary来恢复备库

[oracle@rac1 ~]$ $ORACLE_HOME/bin/rman target / auxiliary sys/6212327@standby


Recovery Manager: Release 10.2.0.3.0 - Production on Wed Apr 30 19:37:05 2008


Copyright (c) 1982, 2005, Oracle. All rights reserved.


connected to target database: RAC (DBID=2232067446)

connected to auxiliary database: RAC (not mounted)


RMAN> run

{

allocate channel c1 device type disk format '/soft/backup/%U' connect sys/6212327@rac1;

2> 3> 4> allocate channel c2 device type disk format '/soft/backup/%U' connect sys/6212327@rac2;

5> allocate auxiliary channel ac1 device type disk format '/soft/backup/%U';

6> allocate auxiliary channel ac2 device type disk format '/soft/backup/%U';

7> duplicate target database for standby;

8> }


using target database control file instead of recovery catalog

allocated channel: c1

channel c1: sid=132 instance=rac1 devtype=DISK


allocated channel: c2

channel c2: sid=134 instance=rac2 devtype=DISK


allocated channel: ac1

channel ac1: sid=155 devtype=DISK


allocated channel: ac2

channel ac2: sid=154 devtype=DISK


Starting Duplicate Db at 30-APR-08


contents of Memory Script:

{

restore clone standby controlfile;

sql clone 'alter database mount standby database';

}

executing Memory Script


Starting restore at 30-APR-08


channel ac1: starting datafile backupset restore

channel ac1: restoring control file

channel ac1: reading from backup piece /soft/backup/CON_0ajf4gqi_1_1

channel ac1: restored backup piece 1

piece handle=/soft/backup/CON_0ajf4gqi_1_1 tag=TAG20080430T150554

channel ac1: restore complete, elapsed time: 00:00:04

output filename=/soft/oradata/rac/control01.ctl

output filename=/soft/oradata/rac/control02.ctl

output filename=/soft/oradata/rac/control03.ctl

Finished restore at 30-APR-08


sql statement: alter database mount standby database


contents of Memory Script:

{

set newname for tempfile 1 to

"/soft/oradata/rac/raw6";

switch clone tempfile all;

set newname for datafile 1 to

"/soft/oradata/rac/raw1";

set newname for datafile 2 to

"/soft/oradata/rac/raw3";

set newname for datafile 3 to

"/soft/oradata/rac/raw2";

set newname for datafile 4 to

"/soft/oradata/rac/raw5";

set newname for datafile 5 to

"/soft/oradata/rac/raw7";

restore

check readonly

clone database

;

}

executing Memory Script


executing command: SET NEWNAME


renamed temporary file 1 to /soft/oradata/rac/raw6 in control file


executing command: SET NEWNAME


executing command: SET NEWNAME


executing command: SET NEWNAME


executing command: SET NEWNAME


executing command: SET NEWNAME


Starting restore at 30-APR-08


channel ac1: starting datafile backupset restore

channel ac1: specifying datafile(s) to restore from backup set

restoring datafile 00002 to /soft/oradata/rac/raw3

restoring datafile 00004 to /soft/oradata/rac/raw5

channel ac1: reading from backup piece /soft/backup/05jf4frg_1_1

channel ac2: starting datafile backupset restore

channel ac2: specifying datafile(s) to restore from backup set

restoring datafile 00001 to /soft/oradata/rac/raw1

restoring datafile 00003 to /soft/oradata/rac/raw2

restoring datafile 00005 to /soft/oradata/rac/raw7

channel ac2: reading from backup piece /soft/backup/04jf4frg_1_1

channel ac1: restored backup piece 1

piece handle=/soft/backup/05jf4frg_1_1 tag=TAG20080430T144919

channel ac1: restore complete, elapsed time: 00:01:22

channel ac2: restored backup piece 1

piece handle=/soft/backup/04jf4frg_1_1 tag=TAG20080430T144919

channel ac2: restore complete, elapsed time: 00:01:32

Finished restore at 30-APR-08


contents of Memory Script:

{

switch clone datafile all;

}

executing Memory Script


datafile 1 switched to datafile copy

input datafile copy recid=6 stamp=653426781 filename=/soft/oradata/rac/raw1

datafile 2 switched to datafile copy

input datafile copy recid=7 stamp=653426781 filename=/soft/oradata/rac/raw3

datafile 3 switched to datafile copy

input datafile copy recid=8 stamp=653426781 filename=/soft/oradata/rac/raw2

datafile 4 switched to datafile copy

input datafile copy recid=9 stamp=653426781 filename=/soft/oradata/rac/raw5

datafile 5 switched to datafile copy

input datafile copy recid=10 stamp=653426781 filename=/soft/oradata/rac/raw7

Finished Duplicate Db at 30-APR-08

released channel: c1

released channel: c2

released channel: ac1

released channel: ac2


从日志可以看到,oracle先根据参数文件把控制文件恢复到合适位置,然后再根据db_file_name_cover把数据文件恢复到合适位置。

linux
相关资讯       Oracle教程 
本文评论   查看全部评论 (0)
表情: 表情 姓名: 字数

       

评论声明
  • 尊重网上道德,遵守中华人民共和国的各项有关法律法规
  • 承担一切因您的行为而直接或间接导致的民事或刑事法律责任
  • 本站管理人员有权保留或删除其管辖留言中的任意内容
  • 本站有权在网站内转载或引用您的评论
  • 参与本评论即表明您已经阅读并接受上述条款