ITPub博客

首页 > Linux操作系统 > Linux操作系统 > DG 的一些配置

DG 的一些配置

原创 Linux操作系统 作者:g644516804 时间:2011-04-23 14:20:45 0 删除 编辑
最近在配置DG,还是有些不太理解的地方,有待研究!!!

DG的配置,在配置的时候首先得理解redo log,archive log,standby log;primary 产生redo log

然后将其归档为archive log存放并将redo log 传输到standby 库上转变成standby log,该存放位置通过参数文件中的参数standby_archive_dest来指定。而且primary和物理standbydb_name是一样的,通过db_unquie_name来区别!!

物理DG的配置:

Primary数据库配置

1确定主库处于归档模式:archive log list

2primary数据库设为FORCE LOGGING模式:alter database force logging;

3创建standby数据库控制文件:alter batabse create standby controlfile  as '/tmp/standby.ctl'

创建primary数据库的pfile文件,

然后配置standby

Startup nomount

Alter database mount standby databae;

Alter database recover managed standby database disconnect  from session;

Alter databae recover managed standby database disconnect cancel;

在配置物理standby的时候出现的问题:

1. Standby日志文件的位置不对

Alter system set standby_file_managedment=manual;

Alter database databasename rename .. to ..

Alter system set standby_file_managedment=auot;

2.角色切换

NOT ALLOWED - Either this is a standby database and the primary database has not been

switched first, or this is a primary database and there are no standby databases.
    SESSIONS ACTIVE - Indicates that there are active SQL sessions attached to the primary or standby database that need to be disconnected before the switchover operation is permitted.

如果主库是sessions atchive 备库是 not allowed都是正常的。主备库切换:

Primary

Alter database commit to switchover to physical standby with session shutdown;

Shutdown immediate;

Startup mount;

Standby:

Alter database commit to switchover to primary ;

Alter database open

再查看主备库的switchover_status

然后在之前的主库上开始接收应用                                         

Alter database recover managed standby database disconnect from session

查看 主从库的switchover_status

 

逻辑standby配置:

配置好物理standby之后,配置逻辑standby,首先得停止物理standbyredo 应用;

standby库上建立standby redo log,可以多创建几组:

Alter database add standby logfile group 4 (‘/oradata/redhat1/redostb1.log’) size 10m;

……

primary开启supplementl log功能:

Alter database add supplemental log data;

Select supplemental_log_data_pk from v$database;

然后 生成logminer字典信息:execute dbms_logstadby.build;

(该过程专门用于生成记录的元数据信息到redo log传输到logical standby;才会被logical standby进行SQL应用)

转换物理standby为逻辑standby

Alter database recover to logical standby new_dbname;(这里new_dbname为全新的dbname,primary的不一样)

然后重建密码文件和调整standby 参数文件

打开逻辑standby

Alter database open resetlogs;

Alter database start logical standby apply immediate;

Alter database stop logical standby apply immediate;(停止逻辑standbySQL应用)

下面为primarystandby的参数文件:

Primary

redhat.__db_cache_size=83886080

redhat.__java_pool_size=4194304

redhat.__large_pool_size=4194304

redhat.__shared_pool_size=71303168

redhat.__streams_pool_size=0

*.audit_file_dest='/orahome/admin/redhat/adump'

*.background_dump_dest='/orahome/admin/redhat/bdump'

*.compatible='10.2.0.1.0'

*.control_files='/oradata/redhat/control01.ctl','/oradata/redhat/control02.ctl','/oradata/redhat/control03.ctl'

*.core_dump_dest='/orahome/admin/redhat/cdump'

*.db_block_size=8192

*.db_domain=''

*.db_file_multiblock_read_count=16

*.db_name='redhat'

*.dispatchers='(PROTOCOL=TCP) (SERVICE=redhatXDB)'

*.job_queue_processes=10

*.open_cursors=300

*.pga_aggregate_target=16777216

*.processes=150

*.remote_login_passwordfile='EXCLUSIVE'

*.sga_target=167772160

*.undo_management='AUTO'

*.undo_tablespace='UNDOTBS1'

*.user_dump_dest='/orahome/admin/redhat/udump'

 

log_archive_format='%t_%s_%r.arc'

db_unique_name=redhat

*.log_archive_config='DG_CONFIG=(redhat,redhat1)'

 

*.log_archive_dest_1='location=/archive/redhat/ VALID_FOR=(ONLINE_LOGFILES,ALL_ROLES) DB_UNIQUE_NAME=redhat'

log_archive_dest_2='service=redhat1  LGWR  ASYNC  VALID_FOR=(ONLINE_LOGFILES,PRIMARY_ROLE) DB_UNIQUE_NAME=redhat1'

log_archive_dest_3='location=/archive/redhat_stb/ VALID_FOR=(STANDBY_LOGFILES,STANDBY_ROLE) DB_UNIQUE_NAME=redhat'

log_archive_max_processes=2

log_archive_dest_state_1=enable

 

log_archive_dest_state_2=enable

log_archive_dest_state_3=enable

remote_login_passwordfile=exclusive

fal_server=redhat1

fal_client=redhat

db_file_name_convert='/oradata/redhat/','/oradata/redhat1/'

log_file_name_convert='/archive/redhat/','/archive/redhat1/','/archive/redhat_stb','/archive/redhat1_stb'

standby_file_management=AUTO

standby_archive_dest='/archive/redhat_stb'

standby

db_cache_size=83886080

java_pool_size=4194304

shared_pool_size=71303168

streams_pool_size=0

*.audit_file_dest='/orahome/admin/redhat1/adump'

*.background_dump_dest='/orahome/admin/redhat1/bdump'

*.compatible='10.2.0.1.0'

*.control_files='/oradata/redhat1/control01.ctl'

*.core_dump_dest='/orahome/admin/redhat1/cdump'

*.db_block_size=8192

*.db_domain=''

*.db_file_multiblock_read_count=16

*.db_name='redhat'

*.dispatchers='(PROTOCOL=TCP) (SERVICE=redhatXDB)'

*.job_queue_processes=10

*.open_cursors=300

*.pga_aggregate_target=16777216

*.processes=150

*.remote_login_passwordfile='EXCLUSIVE'

*.sga_target=167772160

*.undo_management='AUTO'

*.undo_tablespace='UNDOTBS1'

*.user_dump_dest='/orahome/admin/redhat1/udump'

log_archive_format='%t_%s_%r.arc'

db_unique_name=redhat1

*.log_archive_config='DG_CONFIG=(redhat,redhat1)'

 

*.log_archive_dest_1='location=/archive/redhat1/ VALID_FOR=(ONLINE_LOGFILES,ALL_ROLES) DB_UNIQUE_NAME=redhat1'

log_archive_dest_2='service=redhat  LGWR  ASYNC  VALID_FOR=(ONLINE_LOGFILES,PRIMARY_ROLE) DB_UNIQUE_NAME=redhat'

log_archive_dest_3='location=/archive/redhat1_stb VALID_FOR=(STANDBY_LOGFILES,STANDBY_ROLE) DB_UNIQUE_NAME=redhat1'

log_archive_dest_state_1=enable

log_archive_dest_state_2=enable

log_archive_dest_state_3=defer

remote_login_passwordfile=exclusive

fal_server=redhat

fal_client=redhat1

db_file_name_convert='/oradata/redhat/','/oradata/redhat1/'

log_file_name_convert='/archive/redhat/','/archive/redhat1/','/archiv/redhat_stb/','/archive/redhat1_stb/'

standby_file_management=AUTO

standby_archive_dest='/archive/redhat1_stb/'    ---该目录为从primary传递过来的archive logstandby自己的archive log 存放在 /archive/redhat1/ 目录下 通过log_archive_dest来指定。

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

上一篇: RMAN命令详解
下一篇: 系统脚本之oracle
请登录后发表评论 登录
全部评论

注册时间:2011-03-04

  • 博文量
    104
  • 访问量
    246396