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

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


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


$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;


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


$mkdir/dsk4/backup

$rmantarget /


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


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


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


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


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


【补充】:oracle密码修改

若oracle密码未知,可以如下修改oracle密码:

$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

//把主库修改完的密码文件拷贝到备库中


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


SQL>showparameter name


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


主库监听状态:

$lsnrctlstatus


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


备库监听状态:

$lsnrctlstatus


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


测试主库能否ping通备库

$ tnsping shdb


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


备库启动实例

$exportORACLE_SID=shdb

//或修改.bash_profile

$sqlplus ‘/assysdba’

SQL>startupnomount;

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


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



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


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


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


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


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


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

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

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



linux下oracle11G DG搭建(三):围绕备库搭建操作,布布扣,bubuko.com

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

上一篇:在nginx中使用lua直接访问mysql和memcaced达到数据接口的统一


下一篇:str和repr的