oracledg如何安装-成都快上网建站

oracledg如何安装

这篇文章主要介绍oracle dg如何安装,文中介绍的非常详细,具有一定的参考价值,感兴趣的小伙伴们一定要看完!

成都创新互联专注于合肥网站建设服务及定制,我们拥有丰富的企业做网站经验。 热诚为您提供合肥营销型网站建设,合肥网站制作、合肥网页设计、合肥网站官网定制、小程序制作服务,打造合肥网络公司原创品牌,更为您提供合肥网站排名全网营销落地服务。

主备库均为归档模式,并且force logging
==开启归档并设为强制日志模式==
select log_mode,force_logging from v$database;
alter database archivelog;
alter database force logging;
===修改主库参数===
alter system set log_archive_config="dg_config=(db01,dg01)" scope=both;
alter system set standby_file_management=auto scope=both;
alter system set log_archive_dest_1="location=/oracle/app/oracle/oradata/arch/ valid_for=(all_logfiles,all_roles) db_unique_name=db01" scope=both;
alter system set log_archive_dest_state_1="enable";
alter system set log_archive_dest_2="service=dg01 lgwr async valid_for=(online_logfile,primary_role) db_unique_name=dg01" scope=both;
alter system set log_archive_dest_state_2="enable";
alter system set fal_server=dg01 scope=both;
alter system set fal_client=db01 scope=both;
alter system set db_file_name_convert="/oracle/app/oracle/oradata/dg01/","/oracle/app/oracle/oradata/db01/" scope=spfile;
alter system set log_file_name_convert="/oracle/app/oracle/oradata/dg01/","/oracle/app/oracle/oradata/db01/" scope=spfile;
===创建参数文件,修改后用于备库===
create pfile='/tmp/tt/initdg01.ora' from spfile;
===tnsnames.ora和监听(两端均为静态监听)===
===复制主库准备好的参数文件和密码文件到备库===
环境准备好后:
===备库利用修改好的参数文件,启动数据库到nomount状态===


===主库操作===
rman target / auxiliary sys/oracle@dg01
duplicate target database for standby from active database;
或者
duplicate target database for standby nonamefilecheck from active database;(无需目录转换)
===建立standy log(redolog+1)===
alter database add standby logfile thread 1 group 11 '/oracle/app/oracle/oradata/dg01/standby_group_11.log' size 52428800;
alter database add standby logfile thread 1 group 12 '/oracle/app/oracle/oradata/dg01/standby_group_12.log' size 52428800;
alter database add standby logfile thread 1 group 13 '/oracle/app/oracle/oradata/dg01/standby_group_13.log' size 52428800;
===dg验证===
验证物理备库是否工作:
检查是否存在报错:
select error,destination from v$archive_dest;
(1)在备库上检查已经存在的归档日志
select sequence# , first_time , next_time from  v$archived_log order  by  sequence#;
(2)在主库上强制进行日志切换,手动归档
alter  system  switch  logfile;
(3)在备库上检查归档日志(是否出现新的归档日志)
select sequence# , first_time , next_time from  v$archived_log order  by  sequence#;
(4)检查归档日志是否被“应用”
select  sequence# , applied  from  v$archived_log order by sequence#;
===当备库正在应用日志,把备库启动到只读模式
   停掉日志应用
alter database recover managed standby database cancel;
以只读方式打开备库
alter database open;


当数据库处于只读模式,把备库切换到Redo Apply
1. 让所有活动的会话退出备库
2. 日志应用
alter  database  recover  managed  standby  database disconnect  from  session;
或者(启动real-time apply)
alter  database  recover  managed  standby  database using  current  logfile disconnect  from  session;
====主备切换===
1、主库切换到备库
查看主库状态:
select database_role,switchover_status from v$database;
to standby
alter database commit to switchover to physical standby;
备注:
A:switchover_status出现session active/not allow
session active 表示还有活动的session
alter database commit to switchover to physical standby with session shut down;
B:not allow,ora-01153:an incompatible media recovery is active
alter database recover managed standby database finish;
或者
alter database recover managed standby database finish force;
重启主库
shutdown immediate
startup mount 
alter  database  recover  managed  standby  database disconnect  from  session;
select database_role,switchover_status from v$database;
to primary
2、备库切换到主库
select database_role,switchover_status from v$database;
to primary
alter database commit to switchover to primary;
shutdown immediate;
startup
alter system switch logfile;
重复验证dg。
=================
注意:
一般switchover切换都是计划中的切换,特点是切换后,不会丢失任何数据,而且这个过程是
可逆的,整个data guard环境不会被破坏,原来的data guard环境中的所有standby
都可以继续工作。
在进行data guard的物理standby切换前:
1)确认主从库之间的网络连接畅通;
2)确认没有活动的会话连接在数据库中;
3)primary数据库处于打开状态,standby数据库处于mount状态。

以上是“oracle dg如何安装”这篇文章的所有内容,感谢各位的阅读!希望分享的内容对大家有帮助,更多相关知识,欢迎关注创新互联行业资讯频道!


当前题目:oracledg如何安装
文章来源:http://kswjz.com/article/iegepc.html
扫二维码与项目经理沟通

我们在微信上24小时期待你的声音

解答本文疑问/技术咨询/运营咨询/技术建议/互联网交流