ITPub博客

首页 > Linux操作系统 > Linux操作系统 > 单机Linux平台Oracle 10g DataGuard Physical Standby 搭建实例(1)

单机Linux平台Oracle 10g DataGuard Physical Standby 搭建实例(1)

原创 Linux操作系统 作者:cow977 时间:2011-07-01 20:16:13 0 删除 编辑
这一部分是Primary 端准备工作
 

操作系统: RHEL5,主机名:RHEL5

主库SID:orcl,备库SID:stby

 

1. 主库设置为force logging 模式

SQL> alter database force logging;

SQL> select force_logging from v$database;

 

2. 主库设为归档模式

SQL> shutdown immediate

SQL> startup mount

SQL> alter database archivelog;

SQL> archive log list;

 

3. 创建备库的密码文件和控制文件

SQL> alter database create standby controlfile as '/tmp/control01.ctl';

--说明:判断一个数据库是Primary还是Standby,就是通过控制文件来判断的。

$ cp $ORACLE_HOME/dbs/orapworcl $ORACLE_HOME/dbs/orapwstby

 

4. 修改初始化参数文件

SQL> create pfile='/tmp/init.ora' from spfile;

init.ora 添加如下内容:

*.DB_UNIQUE_NAME='orcl'

*.log_archive_config='DG_CONFIG=(orcl,stby)'

*.log_archive_dest_1='LOCATION=/u1/app/oracle/oradata/arch valid_for=(ALL_LOGFILES,ALL_ROLES) DB_UNIQUE_NAME=orcl'

*.log_archive_dest_2='SERVICE=stby LGWR ASYNC valid_for=(ONLINE_LOGFILES,PRIMARY_ROLES) DB_UNIQUE_NAME=stby'

*.log_archive_max_processes=2

*.standby_file_management='AUTO'

*.standby_archive_dest=' ?/dbs/arch'

*.FAL_SERVER='stby'

*.FAL_CLIENT='orcl'

*.log_file_name_convert='stby','orcl'

*.db_file_name_convert='stby','orcl'

-- 注意:orcl,stby是在tnsnames文件中配置的

 

5. '/tmp/init.ora'这个pfile启动数据库,并生成spfile

SQL> shutdown immediate

SQL> startup pfile='/tmp/init.ora';

SQL> create spfile from pfile='/tmp/init.ora';

 

6. 修改listener.ora tnsnames.ora 文件

Listener.ora 文件:

SID_LIST_LISTENER =

  (SID_LIST =

    (SID_DESC =

      (SID_NAME = PLSExtProc)

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

      (PROGRAM = extproc)

    )

    (SID_DESC =

      (GLOBAL_DBNAME = orcl)

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

      (SID_NAME = orcl) 

    )

  )

LISTENER =

  (DESCRIPTION_LIST =

    (DESCRIPTION =

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

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

    )

  )

注意:SID_LIST_LISTENER配置的是静态注册,如果没有该参数,而且Data Guard启动顺序又不正确,那么在主库可能会报 PING[ARC1]: Heartbeat failed to connect to standby 'orcl_st'. Error is 12514. 错误,导致归档无法完成。

 

Tnsnames.ora 文件

ORCL =

  (DESCRIPTION =

    (ADDRESS_LIST =

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

    )

    (CONNECT_DATA = (SERVER = DEDICATED) (SERVICE_NAME = orcl) )

  )

STBY =

  (DESCRIPTION =

    (ADDRESS_LIST =

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

    )

    (CONNECT_DATA = (SERVER = DEDICATED) (SERVICE_NAME = stby))

  )

 

 

来自 “ ITPUB博客 ” ,链接:http://blog.itpub.net/81227/viewspace-701181/,如需转载,请注明出处,否则将追究法律责任。

请登录后发表评论 登录
全部评论

注册时间:2011-03-02

  • 博文量
    699
  • 访问量
    755183