DG日常管理命令汇总
1.启动/停止MRP进程
为平潭等地区用户提供了全套网页设计制作服务,及平潭网站建设行业解决方案。主营业务为成都网站设计、成都网站制作、外贸网站建设、平潭网站设计,以传统方式定制建设网站,并提供域名空间备案等一条龙服务,秉承以专业、用心的态度为用户提供真诚的服务。我们深信只要达到每一位用户的要求,就会得到认可,从而选择与我们长期合作。这样,我们也可以走得更远!
log_archive_dest 为LGWR时需要创建standby redolog,为arch时无须设置standby redolog
--必须设置standby redolog,数据实时同步
alter database recover managed standby database using current controlfile disconnect;
--数据异步同步,当主库切换归档时进行数据同步
alter database recover managed standby database disconnect from session;
--关闭MRP进程
alter database recover managed standby database cancel;
2.检查主备库状态
select OPEN_MODE,PROTECTION_MODE,ACTIVATION#,DATABASE_ROLE,SWITCHOVER#,SWITCHOVER_STATUS FROM V$DATABASE;
确认主库状态为to standby或者为sessions active、保护模式应该maximum performance、角色为PRIMARY
在备库查询时通常为not allowed 或者sessions active,角色为PHYSICAL STANDBY
3.检查数据同步情况
-查看应用日志延迟时间:
select value from v$dataguard_stats where name='apply lag';
-查看接收日志延迟时间:
select value from v$dataguard_stats where name='transport lag';
-查看主库归档
Primary: SQL> select thread#, max(sequence#) "Last Primary Seq Generated"
from v$archived_log val, v$database vdb
where val.resetlogs_change# = vdb.resetlogs_change#
group by thread# order by 1;
-查看备库已接收归档
PhyStdby:SQL> select thread#, max(sequence#) "Last Standby Seq Received"
from v$archived_log val, v$database vdb
where val.resetlogs_change# = vdb.resetlogs_change#
group by thread# order by 1;
-查看备库已应用归档
PhyStdby:SQL>select thread#, max(sequence#) "Last Standby Seq Applied"
from v$archived_log val, v$database vdb
where val.resetlogs_change# = vdb.resetlogs_change#
and val.applied in ('YES','IN-MEMORY')
group by thread# order by 1;
-查看归档应用详细情况
select first_time,sequence#,applied from v$archived_log;
-查看主备库GAP
select * from v$archive_gap;
4.查询ASM Diskgroup 使用率
SET LINES 300 PAGES 9999
COL name FOR a15
COL USED_PERCENT FOR a15
SELECT GROUP_NUMBER,
NAME,
TOTAL_MB / 1024 total_gb,
FREE_MB / 1024,
USABLE_FILE_MB / 1024,
ROUND ( (TOTAL_MB - USABLE_FILE_MB) * 100 / TOTAL_MB) || '%'
USED_PERCENT
FROM V$ASM_DISKGROUP
ORDER BY 1;
5.检查进程
-
主库(确认ARCH进程正常)
-
SQL> SELECT PROCESS, CLIENT_PROCESS, SEQUENCE#, STATUS FROM V$MANAGED_STANDBY;
-
PROCESS CLIENT_PROCESS SEQUENCE# STATUS
-
------------------ ---------------- ---------- ------------------------
-
ARCH ARCH 731 CLOSING
-
DGRD N/A 0 ALLOCATED
-
DGRD N/A 0 ALLOCATED
-
ARCH ARCH 732 CLOSING
-
ARCH ARCH 733 CLOSING
-
ARCH ARCH 734 CLOSING
-
LNS LNS 735 WRITING
-
DGRD N/A 0 ALLOCATED
-
DGRD N/A 0 ALLOCATED
-
-
备库(要确认存在MRP、ARCH、RFS进程)
-
SQL> SELECT PROCESS, CLIENT_PROCESS, SEQUENCE#, STATUS FROM V$MANAGED_STANDBY;
-
PROCESS CLIENT_PROCESS SEQUENCE# STATUS
-
------------------ ---------------- ---------- ------------------------
-
ARCH ARCH 735 CLOSING
-
DGRD N/A 0 ALLOCATED
-
DGRD N/A 0 ALLOCATED
-
ARCH ARCH 731 CLOSING
-
ARCH ARCH 693 CLOSING
-
ARCH ARCH 692 CLOSING
-
RFS LGWR 736 IDLE
-
RFS UNKNOWN 0 IDLE
-
RFS UNKNOWN 0 IDLE
-
RFS Archival 0 IDLE
-
RFS LGWR 694 IDLE
-
PROCESS CLIENT_PROCESS SEQUENCE# STATUS
-
------------------ ---------------- ---------- ------------------------
-
MRP0 N/A 736 APPLYING_LOG
-
RFS UNKNOWN 0 IDLE
-
RFS Archival 0 IDLE
6.查询,添加standby log
-
select GROUP#, DBID db_id, THREAD#, SEQUENCE#, BYTES, USED, ARCHIVED, STATUS, FIRST_CHANGE#, NEXT_CHANGE#,LAST_CHANGE# from v$standby_log ;
-
alter database add standby logfile thread 1 group 7 size xxx ,group 8 size xxx ,group 9 size xxx,group 10 size xxx ;
网页名称:DG日常管理命令汇总
文章源于:
http://dzwzjz.com/article/pgsgsj.html