Oracle MAA--Maximum Availability Architecture
系统环境:
操作系统:RedHat EL5
Oracle: Oracle 10gR2
Cluster: CRS 10.2.0.1
Maximum Availability Architecture 最高可用性架构
MAA 配置案例:通过DG实现RAC to RAC的Physical DG,实现数据的容灾。
1、系统环境
案例:
主机环境:
(Prmary DB:)
192.168.8.150 rac1
192.168.8.152 rac1-vip
10.10.10.1 rac1-priv
192.168.8.161 rac2
192.168.8.163 rac2-vip
10.10.10.2 rac2-priv
(Standby DB:)
192.168.8.191 node1
192.168.8.193 node1-vip
10.10.10.191 node2-priv
192.168.8.192 node2
192.168.8.194 node2-vip
10.10.10.192 node2-priv
数据库环境:
Primary Database:
db_name = prod
db_unique_name = prod
instance_name = prod1 ,prod2
service_name = prod
Standby Database:
db_name = prod
db_unique_name = stddb
instance_name = stddb1 ,stddb2
service_name = stddb
2、主备库配置
主库初始化参数配置:
[oracle@rac2 ~]$ cat initprod2.ora
*.audit_file_dest='/u01/app/oracle/admin/prod/adump'
*.background_dump_dest='/u01/app/oracle/admin/prod/bdump'
*.cluster_database_instances=2
*.cluster_database=true
*.compatible='10.2.0.1.0'
*.control_files='+DG1/prod/controlfile/current.260.801040711','+RECOVERY/prod/controlfile/current.256.801040711','+dg2/prod/controlfile/control03.ctl'
*.core_dump_dest='/u01/app/oracle/admin/prod/cdump'
*.db_block_size=8192
*.db_create_file_dest='+DG1'
*.db_domain=''
*.db_file_multiblock_read_count=16
*.db_name='prod'
*.db_recovery_file_dest='+RECOVERY'
*.db_recovery_file_dest_size=2147483648
*.dispatchers='(PROTOCOL=TCP) (SERVICE=prodXDB)'
prod1.instance_number=1
prod2.instance_number=2
*.job_queue_processes=10
*.log_archive_format='arch_%t_%s_%r.log'
*.open_cursors=300
*.pga_aggregate_target=94371840
*.processes=150
*.remote_listener='LISTENERS_PROD'
*.remote_login_passwordfile='exclusive'
*.sga_target=285212672
prod2.thread=2
prod1.thread=1
*.undo_management='AUTO'
prod1.undo_tablespace='UNDOTBS1'
prod2.undo_tablespace='UNDOTBS2'
*.user_dump_dest='/u01/app/oracle/admin/prod/udump'
*.db_unique_name='prod'
LOG_ARCHIVE_CONFIG='DG_CONFIG=(prod,stddb)'
LOG_ARCHIVE_DEST_1= 'LOCATION=+RECOVERY VALID_FOR=(ALL_LOGFILES,ALL_ROLES) DB_UNIQUE_NAME=prod'
LOG_ARCHIVE_DEST_2= 'SERVICE=stddb LGWR ASYNC VALID_FOR=(ONLINE_LOGFILES,PRIMARY_ROLE) DB_UNIQUE_NAME=stddb'
LOG_ARCHIVE_DEST_STATE_1=ENABLE
LOG_ARCHIVE_DEST_STATE_2=ENABLE
REMOTE_LOGIN_PASSWORDFILE=EXCLUSIVE
LOG_ARCHIVE_MAX_PROCESSES=3
FAL_SERVER=stddb
FAL_CLIENT=prod
DB_FILE_NAME_CONVERT='+DG1','+DG1'
LOG_FILE_NAME_CONVERT='+DG1/STDDB','+DG1/PROD','+RECOVERY/STDDB','+RECOVERY/PROD'
STANDBY_FILE_MANAGEMENT=AUTO
备库初始化参数配置:
[oracle@node1 dbs]$ cat initstddb1.ora
*.audit_file_dest='/u01/app/oracle/admin/stddb/adump'
*.background_dump_dest='/u01/app/oracle/admin/stddb/bdump'
*.cluster_database_instances=2
*.cluster_database=true
*.compatible='10.2.0.1.0'
*.control_files='+DG1/stddb/controlfile/std_control.ctl'
*.core_dump_dest='/u01/app/oracle/admin/stddb/cdump'
*.db_block_size=8192
*.db_create_file_dest='+DG1'
*.db_domain=''
*.db_file_multiblock_read_count=16
*.db_name='prod'
*.db_recovery_file_dest_size=2147483648
*.dispatchers='(PROTOCOL=TCP) (SERVICE=stddbXDB)'
stddb1.instance_number=1
stddb2.instance_number=2
*.job_queue_processes=10
*.log_archive_format='arch_%t_%s_%r.log'
*.open_cursors=300
*.pga_aggregate_target=94371840
*.processes=150
*.remote_listener='LISTENERS_PROD'
*.remote_login_passwordfile='exclusive'
*.sga_target=285212672
stddb2.thread=2
stddb1.thread=1
*.undo_management='AUTO'
stddb1.undo_tablespace='UNDOTBS1'
stddb2.undo_tablespace='UNDOTBS2'
*.user_dump_dest='/u01/app/oracle/admin/stddb/udump'
*.db_unique_name='stddb'
LOG_ARCHIVE_CONFIG='DG_CONFIG=(prod,stddb)'
LOG_ARCHIVE_DEST_1= 'LOCATION=+RECOVERY VALID_FOR=(ALL_LOGFILES,ALL_ROLES) DB_UNIQUE_NAME=stddb'
LOG_ARCHIVE_DEST_2= 'SERVICE=prod LGWR ASYNC VALID_FOR=(ONLINE_LOGFILES,PRIMARY_ROLE) DB_UNIQUE_NAME=prod'
LOG_ARCHIVE_DEST_STATE_1=ENABLE
LOG_ARCHIVE_DEST_STATE_2=ENABLE
REMOTE_LOGIN_PASSWORDFILE=EXCLUSIVE
LOG_ARCHIVE_MAX_PROCESSES=3
FAL_SERVER=prod
FAL_CLIENT=stddb
DB_FILE_NAME_CONVERT='+DG1','+DG1'
LOG_FILE_NAME_CONVERT='+DG1/PROD','+DG1/STDDB','+RECOVERY/PROD','+RECOVERY/STDDB'
STANDBY_FILE_MANAGEMENT=AUTO
主备库网络配置:
[oracle@node1 dbs]$
------主库端tnsnames.ora 添加以下信息
STDDB =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = node1-vip)(PORT = 1521))
(ADDRESS = (PROTOCOL = TCP)(HOST = node2-vip)(PORT = 1521))
(LOAD_BALANCE = yes)
(CONNECT_DATA =
(SERVER = DEDICATED)
(SERVICE_NAME = racdb)
)
)
-------备库端tnsnames.ora 添加以下信息
PROD =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = rac1-vip)(PORT = 1521))
(ADDRESS = (PROTOCOL = TCP)(HOST = rac2-vip)(PORT = 1521))
(LOAD_BALANCE = yes)
(CONNECT_DATA =
(SERVER = DEDICATED)
(SERVICE_NAME = prod)
)
)
3、建立Physical DG后,注册数据库和Instance 到GI
(具体构建Physical DG的过程,见相关文档)
------注册数据库 、实例 (以 oracle 身份)
[root@node1 ~]# su - oracle
[oracle@node1 ~]$ srvctl add database -h
Usage: srvctl add database -d <name> -o <oracle_home> [-m <domain_name>] [-p <spfile>] [-A <name|ip>/netmask] [-r {PRIMARY | PHYSICAL_STANDBY | LOGICAL_STANDBY}] [-s <start_options>] [-n <db_name>] [-y {AUTOMATIC | MANUAL}]
-d <name> Unique name for the database
-o <oracle_home> ORACLE_HOME for cluster database
-m <domain> Domain for cluster database
-p <spfile> Server parameter file for cluster database
-A <addr_str> Database cluster alias
-n <db_name> Database name (DB_NAME), if different from the unique name given by the -d option
-r <role> Role of the database (primary, physical_standby, logical_standby)
-s <start_options> Startup options for the database
-y <dbpolicy> Management policy for the database (automatic, manual)
-h Print usage
注册数据库:
[oracle@node1 ~]$ srvctl add database -d stddb -o /u01/app/oracle/product/10.2.0/db_1 -n prod
[oracle@node1 ~]$ crs_stat -t
Name Type Target State Host
------------------------------------------------------------
ora....SM1.asm application ONLINE ONLINE node1
ora....E1.lsnr application ONLINE ONLINE node1
ora.node1.gsd application ONLINE ONLINE node1
ora.node1.ons application ONLINE ONLINE node1
ora.node1.vip application ONLINE ONLINE node1
ora....SM2.asm application ONLINE ONLINE node2
ora....E2.lsnr application ONLINE ONLINE node2
ora.node2.gsd application ONLINE ONLINE node2
ora.node2.ons application ONLINE ONLINE node2
ora.node2.vip application ONLINE ONLINE node2
ora.stddb.db application OFFLINE OFFLINE
注册实例:
[oracle@node1 ~]$ srvctl add instance -h
Usage: srvctl add instance -d <name> -i <inst_name> -n <node_name>
-d <name> Unique name for the database
-i <inst> Instance name
-n <node> Node name
-h Print usage
[oracle@node1 ~]$ srvctl add instance -d stddb -i stddb1 -n node1
[oracle@node1 ~]$ srvctl add instance -d stddb -i stddb2 -n node2
[oracle@node1 ~]$ crs_stat -t
Name Type Target State Host
------------------------------------------------------------
ora....SM1.asm application ONLINE ONLINE node1
ora....E1.lsnr application ONLINE ONLINE node1
ora.node1.gsd application ONLINE ONLINE node1
ora.node1.ons application ONLINE ONLINE node1
ora.node1.vip application ONLINE ONLINE node1
ora....SM2.asm application ONLINE ONLINE node2
ora....E2.lsnr application ONLINE ONLINE node2
ora.node2.gsd application ONLINE ONLINE node2
ora.node2.ons application ONLINE ONLINE node2
ora.node2.vip application ONLINE ONLINE node2
ora.stddb.db application OFFLINE OFFLINE
ora....b1.inst application OFFLINE OFFLINE
ora....b2.inst application OFFLINE OFFLINE
注册ASM:(如果是11g环境,不需要这一步)
[oracle@node1 ~]$ crs_stat |grep asm
NAME=ora.node1.ASM1.asm
NAME=ora.node2.ASM2.asm
[oracle@node1 ~]$ srvctl modify instance -d stddb -i stddb1 -s +ASM1
[oracle@node1 ~]$ srvctl modify instance -d stddb -i stddb2 -s +ASM2
[oracle@node1 ~]$ srvctl enable asm -n node1 -i +ASM1
[oracle@node1 ~]$ srvctl enable asm -n node2 -i +ASM2
[oracle@node1 ~]$ crs_stat -t
Name Type Target State Host
------------------------------------------------------------
ora....SM1.asm application ONLINE ONLINE node1
ora....E1.lsnr application ONLINE ONLINE node1
ora.node1.gsd application ONLINE ONLINE node1
ora.node1.ons application ONLINE ONLINE node1
ora.node1.vip application ONLINE ONLINE node1
ora....SM2.asm application ONLINE ONLINE node2
ora....E2.lsnr application ONLINE ONLINE node2
ora.node2.gsd application ONLINE ONLINE node2
ora.node2.ons application ONLINE ONLINE node2
ora.node2.vip application ONLINE ONLINE node2
ora.stddb.db application OFFLINE OFFLINE
ora....b1.inst application OFFLINE OFFLINE
ora....b2.inst application OFFLINE OFFLINE
[oracle@node1 ~]$
更改备库DB在CRS中的启动方式:
----把备库的启动方式改为手工
在10g ,standby的DB只能在mount下做recover,而11g可以在open下做recover,所以对于11g的环境不需要修改!
[oracle@node1 ~]$ srvctl modify database -d stddb -y manual
@至此,Oracle MAA 架构基本完成!
本文出自 “天涯客的blog” 博客,请务必保留此出处http://tiany.blog.51cto.com/513694/1396674