ITPub博客

首页 > Linux操作系统 > Linux操作系统 > oracle 10g 最大性能模式的DATA GUARD配置

oracle 10g 最大性能模式的DATA GUARD配置

原创 Linux操作系统 作者:anchen211 时间:2008-11-25 15:11:41 0 删除 编辑

数据库版本:ORACLE10.2.0.1

操作系统平台:REDHAT 2.6.9-55.ELsmp i686

 

主库:

内网IP172.16.71.234

外网IP*.*.*.172

从库:

内网IP172.16.71.232

外网IP*.*.*.174

 

主从库的配置:

1 参数文件的配置

主从均采用如下配置:

 

fds20b.__db_cache_size=1006632960
fds20b.__java_pool_size=16777216
fds20b.__large_pool_size=16777216
fds20b.__shared_pool_size=184549376
fds20b.__streams_pool_size=0
*.audit_file_dest='/u01/app/oracle/admin/fds20b/adump'
*.background_dump_dest='/u01/app/oracle/admin/fds20b/bdump'
*.compatible='10.2.0.1.0'
*.control_files='/oradata/db/fds20b/control01.ctl','/oradata/db/fds20b/control02.ctl','/oradata/db/fds20b/control03.ctl'
*.core_dump_dest='/u01/app/oracle/admin/fds20b/cdump'
*.db_block_size=8192
*.db_domain='fs'
*.db_file_multiblock_read_count=16
*.db_name='fds20b'
*.db_unique_name='fds20b'
*.dispatchers='(PROTOCOL=TCP) (SERVICE=fds20bXDB)'
*.FAL_CLIENT='fds20a'
*.FAL_SERVER='fds20b'
*.job_queue_processes=0
*.log_archive_config='DG_CONFIG=(fds20b,fds20a)'
*.log_archive_dest_1='LOCATION=/oradata/arch/ VALID_FOR=(ALL_LOGFILES,ALL_ROLES) db_unique_name=fds20b'
*.log_archive_dest_2='SERVICE=fds20a VALID_FOR=(ONLINE_LOGFILES,PRIMARY_ROLE) DB_UNIQUE_NAME=fds20b LGWR ASYNC REOPEN=10'
*.log_archive_dest_state_1='enable'
*.log_archive_dest_state_2='enable'
*.log_archive_format='%t_%s_%r.dbf'
*.open_cursors=300
*.pga_aggregate_target=413138944
*.processes=150
*.remote_login_passwordfile='EXCLUSIVE'
*.sga_target=1241513984
*.smtp_out_server='61.135.207.210'
*.standby_archive_dest='/oradata/arch/'
*.standby_file_management='auto'
*.undo_management='AUTO'
*.undo_tablespace='UNDOTBS1'
*.user_dump_dest='/u01/app/oracle/admin/fds20b/udump'

 

说明:参数文件在主从库可以一致。但如果主从库的参数文件一致,在tnsnames.ora中的网络服务名就需要有所区别。我倾向于采用这种方案。

参数文件从主库生成并修改完成后从主库传到从库去。

 

2 配置tnsname.ora

 

主库:

 

[oracle@CHN-FS-7-5C5 ~]$ cat /u01/app/oracle/product/10.2.0/db_1/network/admin/tnsnames.ora 
# tnsnames.ora Network Configuration File: /u01/app/oracle/product/10.2.0/db_1/network/admin/tnsnames.ora
# Generated by Oracle configuration tools.
 
EXTPROC_CONNECTION_DATA =
  (DESCRIPTION =
    (ADDRESS_LIST =
      (ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC0))
    )
    (CONNECT_DATA =
      (SID = PLSExtProc)
      (PRESENTATION = RO)
    )
  )
FDS20B =
  (DESCRIPTION =
    (ADDRESS = (PROTOCOL = TCP)(HOST = 172.16.71.232)(PORT = 1521))
    (CONNECT_DATA =
      (SERVER = DEDICATED)
      (sid = fds20b)
    )
  )
 
 
FDS20A =
  (DESCRIPTION =
    (ADDRESS = (PROTOCOL = TCP)(HOST = 172.16.71.234)(PORT = 1521))
    (CONNECT_DATA =
      (SERVER = DEDICATED)
      (SID = fds20b)
    )
  )

 

从库:

 

[oracle@CHN-FS-7-5C3 tmp]$ more /u01/app/oracle/product/10.2.0/db_1/network/admin/tnsnames.ora 
# tnsnames.ora Network Configuration File: /u01/app/oracle/product/10.2.0/db_1/network/admin/tnsnames.ora
# Generated by Oracle configuration tools.
 
EXTPROC_CONNECTION_DATA =
  (DESCRIPTION =
    (ADDRESS_LIST =
      (ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC0))
    )
    (CONNECT_DATA =
      (SID = PLSExtProc)
      (PRESENTATION = RO)
    )
  )
FDS20B =
  (DESCRIPTION =
    (ADDRESS = (PROTOCOL = TCP)(HOST = 172.16.71.234)(PORT = 1521))
    (CONNECT_DATA =
      (SERVER = DEDICATED)
      (sid = fds20b)
    )
  )
 
 
FDS20A =
  (DESCRIPTION =
    (ADDRESS = (PROTOCOL = TCP)(HOST = 172.16.71.232)(PORT = 1521))
    (CONNECT_DATA =
      (SERVER = DEDICATED)
      (SID = fds20b)
    )
  )

 

注意:主从区别在于主从的同名网络服务名中的IP地址互换了一下。

 

3 备份主库并在从库进行恢复

 

[oracle@CHN-FS-7-5C5 admin]$ $ORACLE_HOME/bin/rman
 
Recovery Manager: Release 10.2.0.1.0 - Production on Tue Nov 25 10:00:43 2008
 
Copyright (c) 1982, 2005, Oracle.  All rights reserved.
 
RMAN> connect target /
 
connected to target database: FDS20B (DBID=1550955076)
RMAN> backup database format '/oradata/%u_%p_%c' filesperset 5;
 
Starting backup at 25-NOV-08
using channel ORA_DISK_1
channel ORA_DISK_1: starting piece 1 at 25-NOV-08
channel ORA_DISK_1: finished piece 1 at 25-NOV-08
piece handle=/oradata/05k0j1bv_1_1 tag=TAG20081125T105039 comment=NONE
channel ORA_DISK_1: starting piece 2 at 25-NOV-08
channel ORA_DISK_1: finished piece 2 at 25-NOV-08
piece handle=/oradata/05k0j1bv_2_1 tag=TAG20081125T105039 comment=NONE
channel ORA_DISK_1: starting piece 3 at 25-NOV-08
channel ORA_DISK_1: finished piece 3 at 25-NOV-08
piece handle=/oradata/05k0j1bv_3_1 tag=TAG20081125T105039 comment=NONE
channel ORA_DISK_1: backup set complete, elapsed time: 00:10:05
channel ORA_DISK_1: starting full datafile backupset
channel ORA_DISK_1: specifying datafile(s) in backupset
input datafile fno=00005 name=/oradata/db/fds20b/fds01.dbf
input datafile fno=00002 name=/oradata/db/fds20b/undotbs01.dbf
channel ORA_DISK_1: starting piece 1 at 25-NOV-08
channel ORA_DISK_1: finished piece 1 at 25-NOV-08
piece handle=/oradata/06k0j1us_1_1 tag=TAG20081125T105719 comment=NONE
channel ORA_DISK_1: starting piece 2 at 25-NOV-08
channel ORA_DISK_1: finished piece 2 at 25-NOV-08
piece handle=/oradata/06k0j1us_2_1 tag=TAG20081125T105719 comment=NONE
channel ORA_DISK_1: backup set complete, elapsed time: 00:01:30
channel ORA_DISK_1: starting full datafile backupset
channel ORA_DISK_1: specifying datafile(s) in backupset
including current control file in backupset
including current SPFILE in backupset
channel ORA_DISK_1: starting piece 1 at 25-NOV-08
channel ORA_DISK_1: finished piece 1 at 25-NOV-08
piece handle=/oradata/07k0j21n_1_1 tag=TAG20081125T105719 comment=NONE
channel ORA_DISK_1: backup set complete, elapsed time: 00:00:02
Finished backup at 25-NOV-08
 
RMAN> exit
 
 
Recovery Manager complete.

 

接着创建从库控制文件

[oracle@CHN-FS-7-5C5 admin]$ sqlplus / as sysdba
 
SQL*Plus: Release 10.2.0.1.0 - Production on Tue Nov 25 11:08:25 2008
 
Copyright (c) 1982, 2005, Oracle.  All rights reserved.
 
 
Connected to:
Oracle Database 10g Enterprise Edition Release 10.2.0.1.0 - Production
With the Partitioning, OLAP and Data Mining options
 
SQL> alter database create standby controlfile as '/oradata/standby.ctl';
 
Database altered.
 
SQL>

 

将这些文件均传送到从库。

控制文件复制到相应的参数文件所在的位置。

 

[oracle@CHN-FS-7-5C3 oradata]$ scp 172.16.71.234:/oradata/05k0j* .
oracle@172.16.71.234's password: 
05k0j1bv_1_1                                                                                      100% 2048MB  22.0MB/s   01:33    
05k0j1bv_2_1                                                                                      100% 2048MB  23.0MB/s   01:29    
05k0j1bv_3_1                                                                                      100% 1980MB  22.3MB/s   01:29    
[oracle@CHN-FS-7-5C3 oradata]$ scp 172.16.71.234:/oradata/06k0j* .
oracle@172.16.71.234's password: 
06k0j1us_1_1                                                                                      100% 2048MB  22.0MB/s   01:33    
06k0j1us_2_1                                                                                      100% 1880MB  22.1MB/s   01:25    
[oracle@CHN-FS-7-5C3 oradata]$ scp 172.16.71.234:/oradata/07k0j* .
oracle@172.16.71.234's password: 
07k0j21n_1_1                                                                                      100% 8256KB   8.1MB/s   00:00    
[oracle@CHN-FS-7-5C3 oradata]$ scp 172.16.71.234:/oradata/standby* .
oracle@172.16.71.234's password: 
standby.ctl                                  
 
[oracle@CHN-FS-7-5C3 oradata]$ cp standby.ctl /oradata/db/fds20b/control01.ctl 
[oracle@CHN-FS-7-5C3 oradata]$ cp standby.ctl /oradata/db/fds20b/control02.ctl 
[oracle@CHN-FS-7-5C3 oradata]$ cp standby.ctl /oradata/db/fds20b/control03.ctl

 

应该先热备后再创建从库控制文件。

 

4 在从库进行恢复

 

恢复前先MOUNT数据库

在从库进行如下操作:

 

Sqlplus / as sysdba
Create spfile from pfile=’/tmp/init.ora’;
startup nomount
alter database mount standby database;
exit

 

oracle@CHN-FS-7-5C3 bdump]$ $ORACLE_HOME/bin/rman
Recovery Manager: Release 10.2.0.1.0 - Production on Tue Nov 25 14:54:47 2008
Copyright (c) 1982, 2005, Oracle.  All rights reserved.
RMAN> connect target /
connected to target database: FDS20B (DBID=1550955076, not open) 
restore database;
recover database;

 

恢复之后可以关闭从库,并重新启动

Startup nomount;
Alter database mount standby database;
Alter database recover managed standby database disconnect from session;

 

这时就基本配置好了。可以看到主库基本不必进行重启。

 

这里我遇到了如下的错误:

ORA-16047: DGID mismatch between destination setting and standby

Tue Nov 25 14:24:38 2008

PING[ARC0]: Heartbeat failed to connect to standby 'fds20a'. Error is 16047.

Tue Nov 25 14:25:38 2008

Errors in file /u01/app/oracle/admin/fds20b/bdump/fds20b_arc0_28458.trc:

 

在主库查看归档配置

 

SQL> show parameter log_archive_dest_2

 

NAME                                 TYPE        VALUE

------------------------------------------- ----------------------------

log_archive_dest_2                   string      SERVICE=fds20a VALID_FOR=(ONLI

                                                 NE_LOGFILES,PRIMARY_ROLE) DB_U

                                                 NIQUE_NAME=fds20a LGWR ASYNC R

                                                 EOPEN=10

SQL> show parameter db_unique

 

NAME                                 TYPE        VALUE

---------------------------------------------------------------------------

db_unique_name                       string      fds20b

 

 

发现了配置的确有问题。log_archive_dest_2

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

下一篇: 流复制同步中断
请登录后发表评论 登录
全部评论

注册时间:2008-11-04

  • 博文量
    129
  • 访问量
    176709