日期:2014-05-16 浏览次数:20547 次
DATE : 2012年12月20日
ABOUT : Install Oracle 11.2.0.1 on Linux 5.5
uname : Linux node2 2.6.18-194.el5 #1 SMP Tue Mar 16 21:52:39 EDT 2010 x86_64 x86_64 x86_64 GNU/Linux
一、Primary端操作:
1.Primary设置归档模式
这个生产库都是这种模式。
SQL> archive log list;
SQL> shutdown immediate
SQL> startup mount
SQL> alter database archivelog;
SQL> archive log list;
2. Primary设置force logging
SQL> alter database force logging;
SQL> select force_logging from v$database;
FORCE_LOG
---------
YES
3.配置Oracle Net
在Primary库和Standby 都要修改。也可以使用netca和netmgr命令配置。
注意:修改完后记得重启listener。lsnrctl reload
Primary:
listener.ora::(静态配置LISTENER)
-------------------
SID_LIST_LISTENER =
(SID_LIST =
(SID_DESC =
(GLOBAL_DBNAME = orcl)
(ORACLE_HOME = /u01/app/oracle/product/11.2.0/db_1)
(SID_NAME = orcl)
)
)
-------------------
tnsnames.ora::
-------------------
standby =
(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.99.92)(PORT = 1521))
)
(CONNECT_DATA =
(SERVER = DEDICATED)
(SERVICE_NAME = standby)
)
)
-------------------
Standby:
listener.ora::
-------------------
SID_LIST_LISTENER =
(SID_LIST =
(SID_DESC =
(GLOBAL_DBNAME = standby)
(ORACLE_HOME = /u01/app/oracle/product/11.2.0/db_1)
(SID_NAME = orcl)
)
)
-------------------
tnsnames.ora::
-------------------
orcl =
(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.99.91)(PORT = 1521))
)
(CONNECT_DATA =
(SERVICE_NAME = orcl)
)
)
-------------------
4.Primary添加data guard参数
主要添加以下参数
*.db_name='orcl'
*.db_unique_name='orcl'
*.log_archive_config='DG_CONFIG=(orcl,standby)'
*.log_archive_dest_1='LOCATION=/oradata/orcl/arch VALID_FOR=(ALL_LOGFILES,ALL_ROLES) DB_UNIQUE_NAME=orcl'
*.log_archive_dest_2='SERVICE=standby ASYNC VALID_FOR=(ONLINE_LOGFILES,PRIMARY_ROLE) DB_UNIQUE_NAME=standby'
*.remote_login_passwordfile='EXCLUSIVE'
These parameters take effect when the primary database is transitioned to the standby role
------------------------------------------------------------------------------------------
*.fal_server='standby'
*.db_file_name_convert='/orcl/standby/','/orcl/'
*.log_file_name_convert='/orcl/standby/arch/','/orcl/arch/'
*.standby_file_management='AUTO'
二、Standby端设置:
1.创建相关目录结构
2.将参口令文件传到standby 端
3.创建standby的初始化参数,主要增加以下参数:
*.db_name='orcl'
*.db_unique_name='standby'
*.control_files='/oradata/orcl/standby/control01.ctl','/oradata/orcl/standby/control02.ctl'
*.LOG_ARCHIVE_CONFIG='DG_CONFIG=(orcl,standby)'
*.db_file_name_convert='/orcl/','/orcl/standby/'
*.log_file_name_convert='/orcl/','/orcl/standby/'
*.log_archive_dest_1='LOCATION=/oradata/orcl/standby/arch/ VALID_FOR=(ALL_LOGFILES,ALL_ROLES) DB_UNIQUE_NAME=standby'
*.LOG_ARCHIVE_DEST_2='SERVICE=orcl ASYNC VALID_FOR=(ONLINE_LOGFILES,PRIMARY_ROLE) DB_UNIQUE_NAME=orcl'
*.standby_file_management='AUTO'
*.remote_login_passwordfile='EXCLUSIVE'
*.FAL_SERVER='orcl'
4.用spfile将standby启动到nomount状态:
SQL> create spfile from pfile;
SQL> startup nomount