我是靠谱客的博主 落后星星,最近开发中收集的这篇文章主要介绍Oracle Dataguard 操作汇总,觉得挺不错的,现在分享给大家,希望可以做个参考。

概述

 

col open_modefor a25

coldatabase_role for a30

coldb_unique_name for a20

selectopen_mode,database_role,db_unique_name from v$database;

 

col name format a30

col value format a30

col time_computed format a30

set linesize 200

select name,value,time_computed fromV$dataguard_stats;

 

1.停止Standby

select process, status fromv$managed_standby; --查看备库是否在应用日志进行恢复

alter database recover managed standby database cancel;
shutdown immediate;

 

2.切换到只读模式

-----由shutdown模式切换到只读模式-------

startup nomount;
alter database mount standby database;
alter database open read only;

-----由应用日志模式切换到只读模式-------

alter database recover managed standby database cancel; --取消日志应用
alter database open read only;

 

3.切换回管理恢复模式

startup nomount;
alter database mount standby database;

alter database recover managed standby database using current logfile disconnect from session;

 

4.主库和备库之间角色切换

4.1 主库切换为备库
alter databasecommit to switchover to physical standby;

alter database commit to switchover to physical standby with session shutdown;--主库有会话连接的时候
shutdown immediate
startup nomount;
alter database mount standby database;
alter database recover managed standby database disconnect from session;

 

4.2 从库切换为主库

alter database commit to switchover to primary;
shutdown immediate;
startup
alter system switch logfile;

 

5.备库自动使用主库传过来的日志进行恢复

alter database recover automatic standby database;

 

6.更改保护模式

alter database set standby database tomaximize protection;
alter database set standby database to maximize availability;
alter database set standby database to maximize performancen;

 

7.取消自动恢复模式

alter database recover managed standby database cancel;
alter database recover managed standby database finish;
alter database recover managed standby database finish force;

 

8. 日志切换sql和使传送日志sql

alter system archive log current;

alter system set log_archive_dest_state_2=defer scope=memory;

alter system set log_archive_dest_state_2=enable scope=memory;






最后

以上就是落后星星为你收集整理的Oracle Dataguard 操作汇总的全部内容,希望文章能够帮你解决Oracle Dataguard 操作汇总所遇到的程序开发问题。

如果觉得靠谱客网站的内容还不错,欢迎将靠谱客网站推荐给程序员好友。

本图文内容来源于网友提供,作为学习参考使用,或来自网络收集整理,版权属于原作者所有。
点赞(55)

评论列表共有 0 条评论

立即
投稿
返回
顶部