分享
 
 
 

Oracle 10g使用RMAN创建physical standby

王朝oracle·作者佚名  2008-08-07
窄屏简体版  字體: |||超大  

1.试验环境

SQL> select * from v$version;

BANNER

----------------------------------------------------------------

Oracle Database 10g Enterprise Edition Release 10.2.0.1.0 - Prod

PL/SQL Release 10.2.0.1.0 - Production

CORE 10.2.0.1.0 Production

TNS for Linux: Version 10.2.0.1.0 - Production

NLSRTL Version 10.2.0.1.0 - Production

2.确认主库处于归档模式

SQL> archive log list;

Database log mode Archive Mode

Automatic archival Enabled

Archive destination /u02/arch

Oldest online log sequence 154

Next log sequence to archive 156

Current log sequence 156

3.创建备库instance

windows平台利用oradim工具创建一个新的instance,

unix/linux平台设置新的ORACLE_SID即可

4.准备好主备库的参数文件

主库:

orcl.__db_cache_size=184549376

orcl.__java_pool_size=4194304

orcl.__large_pool_size=4194304

orcl.__shared_pool_size=88080384

orcl.__streams_pool_size=0

*.audit_file_dest='/u01/oracle/admin/orcl/adump'

*.background_dump_dest='/u01/oracle/admin/orcl/bdump'

*.compatible='10.2.0.1.0'

*.control_files='/u01/oracle/oradata/orcl/control01.ctl','

/u01/oracle/oradata/orcl/control02.ctl','

/u01/oracle/oradata/orcl/control03.ctl'

*.core_dump_dest='/u01/oracle/admin/orcl/cdump'

*.db_block_size=8192

*.db_domain=''

*.db_file_multiblock_read_count=16

*.db_name='orcl'

*.dispatchers='(PROTOCOL=TCP) (SERVICE=orclXDB)'

*.job_queue_processes=10

*.log_archive_dest_1='LOCATION=/u02/arch'

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

*.nls_language='SIMPLIFIED CHINESE'

*.nls_territory='CHINA'

*.open_cursors=300

*.pga_aggregate_target=94371840

*.processes=150

*.remote_login_passwordfile='EXCLUSIVE'

*.sga_target=285212672

*.undo_management='AUTO'

*.undo_tablespace='UNDOTBS1'

*.user_dump_dest='/u01/oracle/admin/orcl/udump'

#################################

db_unique_name=node1

service_names=orcl

log_archive_config='dg_config=(node1,node2)'

log_archive_dest_2='service=dbstandby

valid_for=(online_logfiles,primary_role) db_unique_name=node2'

log_archive_dest_state_1=enable

log_archive_dest_state_2=enable

fal_server=dbstandby

standby_file_management=AUTO

备库:

orcl.__db_cache_size=184549376

orcl.__java_pool_size=4194304

orcl.__large_pool_size=4194304

orcl.__shared_pool_size=88080384

orcl.__streams_pool_size=0

*.audit_file_dest='/u01/oracle/admin/orcl/adump'

*.background_dump_dest='/u01/oracle/admin/orcl/bdump'

*.compatible='10.2.0.1.0'

*.control_files='/u01/oracle/oradata/orcl/control01.ctl','

/u01/oracle/oradata/orcl/control02.ctl','

/u01/oracle/oradata/orcl/control03.ctl'

*.core_dump_dest='/u01/oracle/admin/orcl/cdump'

*.db_block_size=8192

*.db_domain=''

*.db_file_multiblock_read_count=16

*.db_name='orcl'

*.dispatchers='(PROTOCOL=TCP) (SERVICE=orclXDB)'

*.job_queue_processes=10

*.log_archive_dest_1='LOCATION=/u02/arch'

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

*.nls_language='SIMPLIFIED CHINESE'

*.nls_territory='CHINA'

*.open_cursors=300

*.pga_aggregate_target=94371840

*.processes=150

*.remote_login_passwordfile='EXCLUSIVE'

*.sga_target=285212672

*.undo_management='AUTO'

*.undo_tablespace='UNDOTBS1'

*.user_dump_dest='/u01/oracle/admin/orcl/udump'

#################################

db_unique_name=node2

service_names=orcl

log_archive_config='dg_config=(node1,node2)'

log_archive_dest_2='service=dbprimary

valid_for=(online_logfiles,primary_role) db_unique_name=node1'

log_archive_dest_state_1=enable

log_archive_dest_state_2=enable

fal_server=dbprimary

fal_client=dbstandby

standby_file_management=AUTO

5.生成password file

c:/>orapwd file=d:/oracle/ora92/DATABASE/PWDtest.ORA password=pass

或者直接将主库上的密码文件copy一份到备库上

6.配置网络

配置主备库的listener.ora,tnsnames.ora。修改完listener.ora后需要重启监听器。

主库:

listener.ora

SID_LIST_LISTENER =

(SID_LIST =

(SID_DESC =

(SID_NAME = PLSExtProc)

(ORACLE_HOME = /u01/oracle/product/10.2.0)

(PROGRAM = extproc)

)

)

LISTENER =

(DESCRIPTION_LIST =

(DESCRIPTION =

(ADDRESS = (PROTOCOL = TCP)(HOST = s1.gti.com)(PORT = 1521))

(ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC0))

)

)

tnsnames.ora

dbprimary =

(DESCRIPTION =

(ADDRESS_LIST =

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

)

(CONNECT_DATA =

(SERVICE_NAME = orcl)

)

)

dbstandby =

(DESCRIPTION =

(ADDRESS_LIST =

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

)

(CONNECT_DATA =

(SERVICE_NAME = orcl)

)

)

备库:

listener.ora

SID_LIST_LISTENER =

(SID_LIST =

(SID_DESC =

(SID_NAME = orcl)

(ORACLE_HOME = /u01/oracle/product/10.2.0)

)

)

LISTENER =

(DESCRIPTION_LIST =

(DESCRIPTION =

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

(ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC0))

)

)

tnsnames.ora

dbprimary =

(DESCRIPTION =

(ADDRESS_LIST =

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

)

(CONNECT_DATA =

(SERVICE_NAME = orcl)

)

)

dbstandby =

(DESCRIPTION =

(ADDRESS_LIST =

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

)

(CONNECT_DATA =

(SERVICE_NAME = orcl)

)

)

7.使用rman备份主库

[oracle@s1 ~]$ rman target /

Recovery Manager: Release 10.2.0.1.0 - Production on Thu May 29 19:52:37 2008

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

connected to target database: ORCL (DBID=1171867028)

RMAN> backup full format='/u02/db_%U'

database include current controlfile for standby;

...................

8.归档主库当前日志

SQL> alter system archive log current;

System altered.

9.启动备库到nomount

sqlplus "/ as sysdba"

Connected to an idle instance.

SQL> startup nomount

Total System Global Area 285212672 bytes

Fixed Size 1218992 bytes

Variable Size 96470608 bytes

Database Buffers 184549376 bytes

Redo Buffers 2973696 bytes

10.利用rman恢复备库

[oracle@s1 ~]$ rman target /

Recovery Manager: Release 10.2.0.1.0 - Production on Thu May 29 19:53:21 2008

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

connected to target database: ORCL (DBID=1171867028)

RMAN> connect auxiliary sys/a@dbstandby

connected to auxiliary database: ORCL (DBID=1171867028, not mount)

RMAN> duplicate target database for standby nofilenamecheck;

.............................

如果第8步没有归档当前日志,duplicate时可能出现错误:

RMAN-05507: standby controlfile checkpoint (710256) is more recent than duplicat

ion point in time (709530)

至此,备库创建成功。

11.将备库置于自动恢复状态

SQL> conn / as sysdba

Connected.

SQL>alter database recover managed standby database disconnect from session;

Media recovery complete.

12.switchover

物理STANDBY的SWITCHOVER切换会把当前的一个物理STANDBY切换为PRIMARY数据库,而PRIMARY数据库且变成物理STNADBY数据库。

一般SWITCHOVER切换都是计划中的切换,特点是在切换后,不会丢失任何的数据,而且这个过程是可逆的,整个DATA GUARD环境不会被破坏,原来DATA GUARD环境中的所有物理和逻辑STANDBY都可以继续工作。

在进行DATA GUARD的物理STANDBY切换前需要注意:

确认主库和从库间网络连接通畅;

确认没有活动的会话连接在数据库中;

PRIMARY数据库处于打开的状态,STANDBY数据库处于MOUNT状态;

确保STANDBY数据库处于ARCHIVELOG模式;

如果设置了REDO应用的延迟,那么将这个设置去掉;

确保配置了主库和从库的初始化参数,使得切换完成后,DATA GUARD机制可以顺利的运行。

主库:

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

SQL*Plus: Release 10.2.0.1.0 - Production on Thu May 29 19:55:02 2008

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

Connected to:

Oracle Database 10g Enterprise Edition Release 10.2.0.1.0 - Production

With the Partitioning, OLAP and Data Mining options

SQL> alter database commit to switchover to physical standby;

Database altered.

SQL> shutdown immediate;

ORA-01507: database not mounted

ORACLE instance shut down.

SQL> startup nomount

ORACLE instance started.

Total System Global Area 285212672 bytes

Fixed Size 1218992 bytes

Variable Size 96470608 bytes

Database Buffers 184549376 bytes

Redo Buffers 2973696 bytes

SQL> alter database mount standby database;

Database altered.

SQL> alter database recover managed standby database disconnect from session;

Database altered.

备库:

SQL> alter database commit to switchover to primary;

Database altered.

SQL> shutdown immediate;

ORA-01109: database not open

Database dismounted.

ORACLE instance shut down.

SQL> startup

ORACLE instance started.

Total System Global Area 285212672 bytes

Fixed Size 1218992 bytes

Variable Size 96470608 bytes

Database Buffers 184549376 bytes

Redo Buffers 2973696 bytes

Database mounted.

Database opened.

SQL>

至此完成自由切换。

 
 
 
免责声明:本文为网络用户发布,其观点仅代表作者个人观点,与本站无关,本站仅提供信息存储服务。文中陈述内容未经本站证实,其真实性、完整性、及时性本站不作任何保证或承诺,请读者仅作参考,并请自行核实相关内容。
2023年上半年GDP全球前十五强
 百态   2023-10-24
美众议院议长启动对拜登的弹劾调查
 百态   2023-09-13
上海、济南、武汉等多地出现不明坠落物
 探索   2023-09-06
印度或要将国名改为“巴拉特”
 百态   2023-09-06
男子为女友送行,买票不登机被捕
 百态   2023-08-20
手机地震预警功能怎么开?
 干货   2023-08-06
女子4年卖2套房花700多万做美容:不但没变美脸,面部还出现变形
 百态   2023-08-04
住户一楼被水淹 还冲来8头猪
 百态   2023-07-31
女子体内爬出大量瓜子状活虫
 百态   2023-07-25
地球连续35年收到神秘规律性信号,网友:不要回答!
 探索   2023-07-21
全球镓价格本周大涨27%
 探索   2023-07-09
钱都流向了那些不缺钱的人,苦都留给了能吃苦的人
 探索   2023-07-02
倩女手游刀客魅者强控制(强混乱强眩晕强睡眠)和对应控制抗性的关系
 百态   2020-08-20
美国5月9日最新疫情:美国确诊人数突破131万
 百态   2020-05-09
荷兰政府宣布将集体辞职
 干货   2020-04-30
倩女幽魂手游师徒任务情义春秋猜成语答案逍遥观:鹏程万里
 干货   2019-11-12
倩女幽魂手游师徒任务情义春秋猜成语答案神机营:射石饮羽
 干货   2019-11-12
倩女幽魂手游师徒任务情义春秋猜成语答案昆仑山:拔刀相助
 干货   2019-11-12
倩女幽魂手游师徒任务情义春秋猜成语答案天工阁:鬼斧神工
 干货   2019-11-12
倩女幽魂手游师徒任务情义春秋猜成语答案丝路古道:单枪匹马
 干货   2019-11-12
倩女幽魂手游师徒任务情义春秋猜成语答案镇郊荒野:与虎谋皮
 干货   2019-11-12
倩女幽魂手游师徒任务情义春秋猜成语答案镇郊荒野:李代桃僵
 干货   2019-11-12
倩女幽魂手游师徒任务情义春秋猜成语答案镇郊荒野:指鹿为马
 干货   2019-11-12
倩女幽魂手游师徒任务情义春秋猜成语答案金陵:小鸟依人
 干货   2019-11-12
倩女幽魂手游师徒任务情义春秋猜成语答案金陵:千金买邻
 干货   2019-11-12
 
推荐阅读
 
 
 
>>返回首頁<<
 
靜靜地坐在廢墟上,四周的荒凉一望無際,忽然覺得,淒涼也很美
© 2005- 王朝網路 版權所有