当前位置:Gxlcms > 数据库问题 > Oracle DataGuard常用管理命令

Oracle DataGuard常用管理命令

时间:2021-07-01 10:21:17 帮助过:25人阅读

alter database recover managed standby database disconnect from session; 开启同步重做日志,(使用归档日志进行同步)管理模式

ALTER DATABASE RECOVER MANAGED STANDBY DATABASE USING CURRENT LOGFILE DISCONNECT FROM SESSION; 开启同步重做日志,使用在线日志进行同步)管理模式

alter database recover managed standby database cancel; 管理模式到只读模式

select process,status from v$managed_standby; 查看日志应用

SELECT PROCESS, STATUS, THREAD#, SEQUENCE#,BLOCK#,BLOCKS,PID FROM V$MANAGED_STANDBY; 查看日志详细应用,进程工作状态

alter database open read only; 开启到只读模式

SELECT MESSAGE FROM V$DATAGUARD_STATUS; 查看DATA GUARD 状态

recover managed standby database disconnect from session; 只读还原管理模式

SELECT THREAD#,LOW_SEQUENCE#,HIGH_SEQUENCE# FROM V$ARCHIVE_GAP; 查询日志GAP

---测试看日志是否传送成功。
主库:
Sql>alter system switch logfile;
Sql> select max(SEQUENCE#) from v$archived_log;
备库:
Sql> /
select FIRST_TIME,NEXT_TIME, APPLIED,SEQUENCE# from v$archived_log order by SEQUENCE#;

SELECT MAX(R.SEQUENCE#) LAST_SEQ_RECD, MAX(L.SEQUENCE#) LAST_SEQ_SENT FROM V$ARCHIVED_LOG R, V$LOG L WHERE R.DEST_ID=2 AND L.ARCHIVED=‘YES‘;
SELECT NAME FROM V$ARCHIVED_LOG WHERE THREAD#=1 AND DEST_ID=1 AND SEQUENCE# BETWEEN 85 AND 86;

检查STANDBY LOG分配情况
select GROUP#,THREAD#,SEQUENCE#,USED,ARCHIVED,STATUS from v$standby_log;

查询数据库DG工作模式
SELECT NAME,OPEN_MODE,DATABASE_ROLE,PROTECTION_MODE FROM V$DATABASE;

修改主库为最大可用模式
ALTER DATABASE SET STANDBY DATABASE TO MAXIMIZE AVAILABILITY;
修修主库为最大保护模式 启动顺序为先启备库,再启主库, 关闭顺序为先关主库,再关备库
ALTER DATABASE SET STANDBY DATABASE TO MAXIMIZE PROTECTION;
修改主库为最大性能模式
ALTER DATABASE SET STANDBY DATABASE TO MAXIMIZE PERFORMANCE;

ALTER SYSTEM SET LOG_ARCHIVE_DEST_STATE_2=enable; 启用
ALTER SYSTEM SET LOG_ARCHIVE_DEST_STATE_2=reset; 停用

alter database add logfile group 1 (‘/mesdata/datafile/onlinelog/group019‘) size 200M ;
alter database add logfile group 3 size 200M ;
alter database add logfile group 4 size 200M ;
alter database add logfile group 6 size 200M ;
alter database add logfile group 13 size 200M ;
alter database add logfile group 14 size 200M ;
alter database add logfile group 15 size 200M ;
alter database add logfile group 16 size 200M ;
alter database add logfile group 17 size 200M ;

alter database add standby logfile group 9 (‘/mesarch/onlinelog/group09.log‘) size 200M ;
alter database add standby logfile group 10 size 200M ;
alter database add standby logfile group 11 size 200M ;
alter database add standby logfile group 12 size 200M ;
alter database add standby logfile group 13 size 200M ;
alter database add standby logfile group 14 size 200M ;
alter database add standby logfile group 15 size 200M ;
alter database add standby logfile group 16 size 200M ;
alter database add standby logfile group 17 size 200M ;

Oracle DataGuard常用管理命令

标签:online   查看   acl   and   oracl   disco   --   gap   命令   

人气教程排行