ITPub博客

首页 > Linux操作系统 > Linux操作系统 > ORACLE 11G dg小笔记1

ORACLE 11G dg小笔记1

原创 Linux操作系统 作者:sinanwei 时间:2011-12-07 10:01:51 0 删除 编辑

1.主库
a.SQL>alter database force logging;   //前提是已经归档模式
b.SQL>alter database create standby controlfile as '/u01/123.ctl'  //备库的控制文件
c.在主库上创建密码文件注意大小写,如果已经有密码文件就无需创建
>orapwd file=/u01/app/oracle/oracle/product/10.2.0/db_1/dbs/orapw+sid entries=5 password=oracle entries=10;
windows上路径修改之外文件名为PWD+sid
d.创建备库日志文件,大于等于主库组数即可
SQL>alter database add standby logfile group 4('/u01/oradata/redo04.log') size 50M;
创建3组即可;
e.配置监听文件,尤其是tnsname.ora文件可以一致,listener.ora文件分别各自创建即可
例如tnsname.ora文件内容:
orcl_pd =
  (DESCRIPTION =
   (ADDRESS_LIST =
    (ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.3.87)(PORT = 1521))
  )
    (CONNECT_DATA =
    (SERVER = DEDICATED)
    (SERVICE_NAME = snwdg)
  )
)
orcl_st =
  (DESCRIPTION =
    (ADDRESS_LIST =
      (ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.3.88)(PORT = 1521))
    )
    (CONNECT_DATA =
      (SERVER = DEDICATED)
      (SERVICE_NAME = snwdg)
    )
  )
f.修改主库的参数文件
增加:
*.db_name='snwdg'
*.DB_UNIQUE_NAME='orcl_pd'
*.log_archive_config='DG_CONFIG=(orcl_pd,orcl_st)'
*.log_archive_dest_1='location=/u01/testarch(为主库上的归档路径) VALID_FOR=(ALL_LOGFILES,ALL_ROLES)' DB_UNIQUE_NAME='orcl_pd'
*.log_archive_dest_2='SERVICE=orcl_st arch ASYNC VALID_FOR=(ONLINE_LOGFILES,PRIMARY_ROLE) DB_UNIQUE_NAME=standby'
*.LOG_ARCHIVE_DEST_STATE_1=ENABLE
*.LOG_ARCHIVE_DEST_STATE_2=ENABLE
*.remote_login_passwordfile='EXCLUSIVE'
切换时用到的参数
*.FAL_SERVER=orcl_st
*.FAL_CLIENT=orcl_pd
*.STANDBY_FILE_MANAGEMENT=AUTO

g.把备库控制文件,密码文件,tnsname.ora文件,参数文件,数据文件,日志文件一同拷贝到备库上

h.备库需要修改的参数
*.log_archive_dest_1='location=/u01/arch(备库的归档路径) VALID_FOR=(ALL_LOGFILES,ALL_ROLES)' DB_UNIQUE_NAME='orcl_st'
*.log_archive_dest_2='SERVICE=orcl_pd arch ASYNC VALID_FOR=(ONLINE_LOGFILES,PRIMARY_ROLE) DB_UNIQUE_NAME=orcl_pd'
*.DB_UNIQUE_NAME='orcl_st'
切换
*.FAL_SERVER=orcl_pd
*.FAL_CLIENT=orcl_st


 

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

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

注册时间:2011-08-10

  • 博文量
    28
  • 访问量
    65574