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.检查进程

    1. 主库(确认ARCH进程正常)
    2. SQL> SELECT PROCESS, CLIENT_PROCESS, SEQUENCE#, STATUS FROM V$MANAGED_STANDBY;
    3. PROCESS CLIENT_PROCESS SEQUENCE# STATUS
    4. ------------------ ---------------- ---------- ------------------------
    5. ARCH ARCH 731 CLOSING
    6. DGRD N/A 0 ALLOCATED
    7. DGRD N/A 0 ALLOCATED
    8. ARCH ARCH 732 CLOSING
    9. ARCH ARCH 733 CLOSING
    10. ARCH ARCH 734 CLOSING
    11. LNS LNS 735 WRITING
    12. DGRD N/A 0 ALLOCATED
    13. DGRD N/A 0 ALLOCATED
    14. 备库(要确认存在MRP、ARCH、RFS进程)
    15. SQL> SELECT PROCESS, CLIENT_PROCESS, SEQUENCE#, STATUS FROM V$MANAGED_STANDBY;
    16. PROCESS CLIENT_PROCESS SEQUENCE# STATUS
    17. ------------------ ---------------- ---------- ------------------------
    18. ARCH ARCH 735 CLOSING
    19. DGRD N/A 0 ALLOCATED
    20. DGRD N/A 0 ALLOCATED
    21. ARCH ARCH 731 CLOSING
    22. ARCH ARCH 693 CLOSING
    23. ARCH ARCH 692 CLOSING
    24. RFS LGWR 736 IDLE
    25. RFS UNKNOWN 0 IDLE
    26. RFS UNKNOWN 0 IDLE
    27. RFS Archival 0 IDLE
    28. RFS LGWR 694 IDLE
    29. PROCESS CLIENT_PROCESS SEQUENCE# STATUS
    30. ------------------ ---------------- ---------- ------------------------
    31. MRP0 N/A 736 APPLYING_LOG
    32. RFS UNKNOWN 0 IDLE
    33. RFS Archival 0 IDLE


    6.查询,添加standby log

    点击(此处)折叠或打开

    1. select GROUP#, DBID db_id, THREAD#, SEQUENCE#, BYTES, USED, ARCHIVED, STATUS, FIRST_CHANGE#, NEXT_CHANGE#,LAST_CHANGE# from v$standby_log ;
    2. 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://ybzwz.com/article/pgsgsj.html