码迷,mamicode.com
首页 > 数据库 > 详细

linux下oracle11G DG搭建(三):环绕备库搭建操作

时间:2017-06-17 13:48:17      阅读:231      评论:0      收藏:0      [点我收藏+]

标签:enter   standby   prot   trie   jsb   location   async   bsp   primary   

linux下oracle11G DG搭建(三):环绕备库搭建操作


环境

名称

主库

备库

主机名

bjsrv

shsrv

软件版本号

RedHat Enterprise5.5、Oracle 11g 11.2.0.1

RedHat Enterprise5.5、Oracle 11g 11.2.0.1



三、环绕备库操作:

1、备库-改动初始化參数文件

$cd$ORACLE_HOME/dbs

$df -h


技术分享


$vi initshdb.ora

改动简要说明:

*.audit_file_dest=‘/u01/app/oracle/admin/sh/adump‘

//审计文件存放的路径

*.audit_trail=‘db‘

*.compatible=‘11.2.0.0.0‘

*.control_files=‘/u01/app/oracle/oradata/sh/sh_control01.ctl

*.db_block_size=8192

*.db_name=‘TestDB12‘

*.db_recovery_file_dest=‘/u01/app/oracle/fast_recovery_area‘

*.db_recovery_file_dest_size=4322230272

*.diagnostic_dest=‘/u01/app/oracle‘

*.dispatchers=‘(PROTOCOL=TCP) (SERVICE=TestDB12XDB)‘//用于共享,删除

*.log_archive_format=‘arch_%t_%s_%r.log‘

*.memory_target=642006528

*.open_cursors=300

*.processes=150

*.remote_login_passwordfile=‘EXCLUSIVE‘

*.undo_tablespace=‘UNDOTBS1‘

 

DB_UNIQUE_NAME=shdb

LOG_ARCHIVE_CONFIG=‘DG_CONFIG=(bjdb,shdb)‘

 

LOG_ARCHIVE_DEST_1=

 ‘LOCATION=/dsk4/arch_sh

 VALID_FOR=(ALL_LOGFILES,ALL_ROLES)

 DB_UNIQUE_NAME=shdb‘

 

LOG_ARCHIVE_DEST_2=

 ‘SERVICE=bjdbASYNC             //应该是对方

 VALID_FOR=(ONLINE_LOGFILES,PRIMARY_ROLE)

 DB_UNIQUE_NAME=bjdb

 

LOG_ARCHIVE_DEST_STATE_1=ENABLE

LOG_ARCHIVE_DEST_STATE_2=ENABLE

 

LOG_ARCHIVE_MAX_PROCESSES=3

 

FAL_SERVER=bjdb

DB_FILE_NAME_CONVERT=‘/u01/app/oracle/oradata/TestDB12‘,‘/u01/app/oracle/oradata/sh‘                              //先对方,后自己

LOG_FILE_NAME_CONVERT=

 ‘/dsk1/oradata/bj‘,‘/dsk1/oradata/sh‘,‘/dsk2/oradata/bj‘,‘/dsk2/oradata/sh‘

STANDBY_FILE_MANAGEMENT=AUTO          //先对方,后自己

 

參考例子:

*.audit_file_dest=‘/u01/app/oracle/admin/sh/adump‘

*.audit_trail=‘db‘

*.compatible=‘11.2.0.0.0‘

*.control_files=‘/u01/app/oracle/oradata/sh/sh_control01.ctl

*.db_block_size=8192

*.db_name=‘TestDB12‘

*.db_recovery_file_dest=‘/u01/app/oracle/fast_recovery_area‘

*.db_recovery_file_dest_size=4322230272

*.diagnostic_dest=‘/u01/app/oracle‘

*.log_archive_format=‘arch_%t_%s_%r.log‘

*.memory_target=642006528

*.open_cursors=300

*.processes=150

*.remote_login_passwordfile=‘EXCLUSIVE‘

*.undo_tablespace=‘UNDOTBS1‘

 

DB_UNIQUE_NAME=shdb

LOG_ARCHIVE_CONFIG=‘DG_CONFIG=(bjdb,shdb)‘

 

LOG_ARCHIVE_DEST_1=

 ‘LOCATION=/dsk4/arch_sh

 VALID_FOR=(ALL_LOGFILES,ALL_ROLES)

 DB_UNIQUE_NAME=shdb‘

 

LOG_ARCHIVE_DEST_2=

 ‘SERVICE=bjdbASYNC            

 VALID_FOR=(ONLINE_LOGFILES,PRIMARY_ROLE)

 DB_UNIQUE_NAME=bjdb

 

LOG_ARCHIVE_DEST_STATE_1=ENABLE

LOG_ARCHIVE_DEST_STATE_2=ENABLE

 

LOG_ARCHIVE_MAX_PROCESSES=3

 

FAL_SERVER=bjdb

DB_FILE_NAME_CONVERT=‘/u01/app/oracle/oradata/TestDB12‘,‘/u01/app/oracle/oradata/sh‘                               

LOG_FILE_NAME_CONVERT=

 ‘/dsk1/oradata/bj‘,‘/dsk1/oradata/sh‘,‘/dsk2/oradata/bj‘,‘/dsk2/oradata/sh‘

STANDBY_FILE_MANAGEMENT=AUTO         

2、主库-启备库前主库备份

备库启动之前。给主库做一个备份。

注意:DG下。养成在启动备库前为主库做备份的习惯。以供应对启动备库后产生的未知情况。

主库处于mount状态下:

SQL>selectstatus from v$instance;


技术分享


$mkdir/dsk4/backup

$rmantarget /


技术分享


RMAN> backupdatabase format ‘/dsk4/backup/%d_%s.bak‘;


技术分享


3、主库、备库-网络配置

主库下:

$ lsnrctlstart         //启动监听

$cd/u01/app/oracle/product/11.2.0/dbhome_1/network/admin

$ vilistener.ora

# listener.oraNetwork Configuration File: /u01/app/oracle/product/11.2.0/dbhome_1/network/admin/listener.ora

# Generated byOracle configuration tools.

 

LISTENER =

  (DESCRIPTION =

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

  )

 

ADR_BASE_LISTENER =/u01/app/oracle

$vi tnsnames.ora //手工创建tnsnames文件

# tnsnames.oraNetwork Configuration File:/u01/app/oracle/product/11.2.0/dbhome_1/network/admin/tnsnames.ora

# Generated byOracle configuration tools.

 

bjdb =

  (DESCRIPTION =

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

    (CONNECT_DATA =

      (SERVER = DEDICATED)

      (SERVICE_NAME =bjdb)

    )

  )

 

shdb =

  (DESCRIPTION =

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

    (CONNECT_DATA =

      (SERVER = DEDICATED)

      (SERVICE_NAME = shdb)

    )

  )

备库下:

$ lsnrctlstart        //启动监听

$cd/u01/app/oracle/product/11.2.0/dbhome_1/network/admin

$ vilistener.ora      //编辑监听

# listener.oraNetwork Configuration File: /u01/app/oracle/product/11.2.0/dbhome_1/network/admin/listener.ora

# Generated byOracle configuration tools.

 

LISTENER =

  (DESCRIPTION =

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

  )

 

ADR_BASE_LISTENER =/u01/app/oracle

 

$vi tnsnames.ora    //手工创建tnsnames文件

BJDB =

  (DESCRIPTION =

(ADDRESS_LIST =

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

    )

(CONNECT_DATA = (SERVER = DEDICATED)

      (SERVICE_NAME = bjdb)

    )

  )

 SHDB =

  (DESCRIPTION =

(ADDRESS_LIST =

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

    )

(CONNECT_DATA = (SERVER = DEDICATED)

      (SERVICE_NAME = shdb)

    )

  )

4、备库-网络測试:

$sqlplussys/oracle@bjdb as sysdba


技术分享


【补充】:oraclepassword改动

若oraclepassword未知。能够例如以下改动oraclepassword:

$cd /u01/app/oracle/product/11.2.0/dbhome_1/dbs

$orapwd file=orapwTestDB12 password=oracle entries=3 force=y

$scp orapwTestDB12 shsrv:$ORACLE_HOME/dbs/orapwshdb

//把主库改动完的password文件复制到备库中


技术分享


SQL>showparameter name


技术分享


主库监听状态:

$lsnrctlstatus


技术分享


备库监听状态:

$lsnrctlstatus


技术分享


測试主库是否能ping通备库

$ tnsping shdb


技术分享


备库启动实例

$exportORACLE_SID=shdb

//或改动.bash_profile

$sqlplus ‘/assysdba’

SQL>startupnomount;

SQL>showparameter pfile;              //备库使用pfile启动


技术分享



SQL>showparameter name             //看一下数据库參数是否正确


技术分享


SQL>showparameter archive            //查询一下归档设置是否正确


技术分享


技术分享


********************未完待续**************************

声明:
         原创作品,出自 “深蓝的blog” 博客。同意转载。转载时请务必注明出处(http://blog.csdn.net/huangyanlong)。

         关于涉及版权事宜,作者有权追究法律责任。



linux下oracle11G DG搭建(三):环绕备库搭建操作

标签:enter   standby   prot   trie   jsb   location   async   bsp   primary   

原文地址:http://www.cnblogs.com/yfceshi/p/7040006.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!