Dataguard从库性能的监控

简介: 【前言】Oracle 11G开始支持了active dataguard,这时候从库就可以分担一些主库的读的压力了。这种架构有个问题就是从库的性能压力很难排除出来。有个朋友也是使用从库进行数据的抽取,但是这个从库每隔一段时间就会由于压力过大而导致系统宕机了。

【前言】Oracle 11G开始支持了active dataguard,这时候从库就可以分担一些主库的读的压力了。这种架构有个问题就是从库的性能压力很难排除出来。有个朋友也是使用从库进行数据的抽取,但是这个从库每隔一段时间就会由于压力过大而导致系统宕机了。在排查问题的时候很多时候需要读取awr报告,但是从库的awr报告是属于主库的,给整个排查增加了难度。还好这个时候从库是可以生成statspack报告的。

这个操作需要进行一些简单的配置,以下的操作都是在主库上面进行的,通过sys用户登录,详细操作如下:

  1. 创建statspack 所需要的schemas:PERFSTAT
  • 设置用户的密码
  • 数据表空间
  • Temp表空间

SQL> @?/rdbms/admin/spcreate.sql

Choose the PERFSTAT user's password

-----------------------------------

Not specifying a password will result in the installation FAILING

 

Enter value for perfstat_password: oracle

oracle

 

 

Choose the Default tablespace for the PERFSTAT user

---------------------------------------------------

Below is the list of online tablespaces in this database which can

store user data. Specifying the SYSTEM tablespace for the user's

default tablespace will result in the installation FAILING, as

using SYSTEM for performance data is not supported.

 

Choose the PERFSTAT users's default tablespace. This is the tablespace

in which the STATSPACK tables and indexes will be created.

 

TABLESPACE_NAME      CONTENTS STATSPACK DEFAULT TABLESPACE

------------------------------ --------- ----------------------------

SYSAUX             PERMANENT *

USERS             PERMANENT

 

Pressing <return> will result in STATSPACK's recommended default

tablespace (identified by *) being used.

 

Enter value for default_tablespace:

 

Using tablespace SYSAUX as PERFSTAT default tablespace.

 

 

Choose the Temporary tablespace for the PERFSTAT user

-----------------------------------------------------

Below is the list of online tablespaces in this database which can

store temporary data (e.g. for sort workareas). Specifying the SYSTEM

tablespace for the user's temporary tablespace will result in the

installation FAILING, as using SYSTEM for workareas is not supported.

 

Choose the PERFSTAT user's Temporary tablespace.

 

TABLESPACE_NAME      CONTENTS DB DEFAULT TEMP TABLESPACE

------------------------------ --------- --------------------------

TEMP             TEMPORARY *

 

Pressing <return> will result in the database's default Temporary

tablespace (identified by *) being used.

 

Enter value for temporary_tablespace:

 

  1. 创建schemas:stdbyperf
  • 设置用户的密码
  • 数据表空间
  • Temp表空间

SQL> @?/rdbms/admin/sbcreate

Choose the STDBYPERF user's password

-----------------------------------

Not specifying a password will result in the installation FAILING

 

Enter value for stdbyuser_password: oracle

oracle

 

Choose the Default tablespace for the STDBYPERF user

---------------------------------------------------

Below is the list of online tablespaces in this database which can

store user data. Specifying the SYSTEM tablespace for the user's

default tablespace will result in the installation FAILING, as

using SYSTEM for performance data is not supported.

 

Choose the STDBYPERF users's default tablespace. This is the tablespace

in which the STATSPACK tables and indexes will be created.

 

TABLESPACE_NAME      CONTENTS STATSPACK DEFAULT TABLESPACE

------------------------------ --------- ----------------------------

SYSAUX             PERMANENT *

USERS             PERMANENT

 

Pressing <return> will result in STATSPACK's recommended default

tablespace (identified by *) being used.

 

Enter value for default_tablespace:

 

Using tablespace SYSAUX as STDBYPERF default tablespace.

 

Choose the Temporary tablespace for the STDBYPERF user

-----------------------------------------------------

Below is the list of online tablespaces in this database which can

store temporary data (e.g. for sort workareas). Specifying the SYSTEM

tablespace for the user's temporary tablespace will result in the

installation FAILING, as using SYSTEM for workareas is not supported.

 

Choose the STDBYPERF user's Temporary tablespace.

 

TABLESPACE_NAME      CONTENTS DB DEFAULT TEMP TABLESPACE

------------------------------ --------- --------------------------

TEMP             TEMPORARY *

 

Pressing <return> will result in the database's default Temporary

tablespace (identified by *) being used.

 

  1. 创建stdbyperfdblink

SQL> @?/rdbms/admin/sbaddins

The following standby instances (TNS_NAME alias) have been configured

for data collection

 

DATABASE    INSTANCE DB LINK PACKAGE

----------------- -------------- ---------------------------- -------------------------------

TIANJIN      joe     STDBY_LINK_TIANJIN STATSPACK_TIANJIN_joe

 

=== END OF LIST ===

 

THE INSTANCE YOU ARE GOING TO ADD MUST BE ACCESSIBLE AND OPEN READ ONLY

 

Do you want to continue (y/n) ?

Enter value for key:

You entered:

 

Enter the TNS ALIAS that connects to the standby database instance

-----------------------------------------------------------------

Make sure the alias connects to only one instance (without load balancing).

Enter value for tns_alias: TIANJIN #tnsnames文件配置

You entered: TIANJIN

 

Enter the PERFSTAT user's password of the standby database

---------------------------------------------------------

Performance data will be fetched from the standby database via

database link. We will connect to user PERFSTAT.

Enter value for perfstat_password: oracle # PERFSTAT用户的密码

You entered: oracle

 

  1. stdbyperf 收集系统性能信息

    SQL> connect stdbyperf/your_password

    SQL> exec statspack_<db_unique_name>_<instance_name>.snap

[oracle@db01 admin]$ sqlplus stdbyperf/oracle

 

SQL*Plus: Release 11.2.0.3.0 Production on Thu Mar 2 02:42:09 2017

 

Copyright (c) 1982, 2011, Oracle. All rights reserved.

 

 

Connected to:

Oracle Database 11g Enterprise Edition Release 11.2.0.3.0 - 64bit Production

With the Partitioning, OLAP, Data Mining and Real Application Testing options

 

SQL> exec statspack_TIANJIN_joe.snap

 

PL/SQL procedure successfully completed.

 

  1. stdbyperf收集系统性能信息

SQL> @?/rdbms/admin/sbreport

 

Instances in this Statspack schema

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

DB Unique Name         Instance Name

------------------------------ ----------------

TIANJIN          joe

 

Enter the DATABASE UNIQUE NAME of the standby database to report

Enter value for db_unique_name: TIANJIN

You entered: TIANJIN

 

Enter the INSTANCE NAME of the standby database instance to report

Enter value for inst_name: joe

You entered: joe

 

Specify the number of days of snapshots to choose from

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Entering the number of days (n) will result in the most recent

(n) days of snapshots being listed. Pressing <return> without

specifying a number lists all completed snapshots.

 

Listing all Completed Snapshots

                 Snap

Instance Snap Id Snap Started      Level Comment

------------ --------- -------------------- -----------

joe     3 02 Mar 2017 02:42 5

 

  1. 其他删除操作

SQL>@?/rdbms/admin/sbpurge #删除快照

SQL>@?/rdbms/admin/sbdelins   #删除配置

SQL>@?/rdbms/admin/sbdrop   #删除schema

 

  1. 详细报告

DB Unique Name Instance Startup Time Release RAC

------------------------------ ------------ --------------- ----------- ---

TIANJIN joe 18-Apr-17 14:05 11.2.0.3.0 NO

 

Host Name: db02 Num CPUs: 2 Phys Memory (MB): 2,000

~~~~

 

Snapshot Snap Id Snap Time Sessions Curs/Sess Comment

~~~~~~~~ ---------- ------------------ -------- --------- -------------------

Begin Snap: 1 01-Mar-17 05:27:28 32 .8

End Snap: 2 01-Mar-17 05:28:26 32 .7

Elapsed: 0.97 (mins)

 

Cache Sizes Begin End

~~~~~~~~~~~ ---------- ----------

Buffer Cache: 356M Std Block Size: 8K

Shared Pool: 224M Log Buffer: 7,032K

 

Load Profile Total Per Second

~~~~~~~~~~~~ ------------------ -----------------

DB time(s): 1.6 0.0

DB CPU(s): 1.2 0.0

Redo MB applied: 1.4 0.0

Logical reads: 1,972.0 34.0

Physical reads: 12.0 0.2

Physical writes: 1,560.0 26.9

User calls: 492.0 8.5

Parses: 211.0 3.6

Hard parses: 163.0 2.8

W/A MB processed: 11.3 0.2

Logons: 1.0 0.0

Executes: 1,095.0 18.9

Rollbacks: 0.0 0.0

 

Instance Efficiency Indicators

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Buffer Nowait %: 100.00 Redo NoWait %:

Buffer Hit %: 99.85 Optimal W/A Exec %: 100.00

Library Hit %: 78.84 Soft Parse %: 22.75

Execute to Parse %: 80.73 Latch Hit %: 100.00

Parse CPU to Parse Elapsd %: 47.98 % Non-Parse CPU: 45.39

 

Shared Pool Statistics Begin End

------ ------

Memory Usage %: 55.11 64.14

% SQL with executions>1: 71.92 83.57

% Memory for SQL w/exec>1: 75.27 89.08

相关文章
|
机器学习/深度学习 API 开发工具
通义千问API入门教程
本教程将带你从零开始,快速了解如何通过 API 使用通义千问大模型,并尝试使用大模型 API 开发一些简单的应用应用到工作中,提升效率。
|
5月前
|
存储 运维 Ubuntu
Ubuntu环境下NTP时间同步服务的离线安装方法
以上就是Ubuntu环境下离线安装和配置NTP时间同步服务的全过程。这种有效的操作不仅可为有网络隔离需求的安全重要环境提供参考,同时也能帮助研发、运维人员在同类情况下处理问题。太阳走过万丈高空,而我们通过NTP服务,轻松把握时间,如同手握流沙,控制每一颗时间粒子的行走。
956 23
|
数据采集 Oracle 关系型数据库
实时计算 Flink版产品使用问题之怎么实现从Oracle数据库读取多个表并将数据写入到Iceberg表
实时计算Flink版作为一种强大的流处理和批处理统一的计算框架,广泛应用于各种需要实时数据处理和分析的场景。实时计算Flink版通常结合SQL接口、DataStream API、以及与上下游数据源和存储系统的丰富连接器,提供了一套全面的解决方案,以应对各种实时计算需求。其低延迟、高吞吐、容错性强的特点,使其成为众多企业和组织实时数据处理首选的技术平台。以下是实时计算Flink版的一些典型使用合集。
|
Oracle 关系型数据库 数据库
手把手教你Oracle DataGuard主备切换(switchover)
手把手教你Oracle DataGuard主备切换(switchover)
1540 4
|
索引
封装vuetify3中v-time-picker组件,并解决使用时分秒类型只能在修改秒之后v-model才会同步更新的问题
封装vuetify3中v-time-picker组件,并解决使用时分秒类型只能在修改秒之后v-model才会同步更新的问题
186 2
|
SQL 关系型数据库 MySQL
Vanna使用ollama分析本地数据库
这篇文章详细介绍了如何使用Vanna和Ollama框架来分析本地数据库,实现自然语言查询转换为SQL语句并与数据库交互的过程。
2506 7
Vanna使用ollama分析本地数据库
|
存储 NoSQL Java
Redis 从入门到精通之Redis字符串操作
Redis字符串操作命令 自增:INCR key(key对应的值必须是整数类型) 自减:DECR key(key对应的值必须是整数类型) 自增指定的值:INCRBY key increment 自减指定的值:DECRBY key decrement 追加字符串:APPEND key value 截取字符串:GETRANGE key start end 改写字符串:SETRANGE key offset value 返回子字符串:SUBSTR key start end(该命令已被废弃,建议使用GETRANGE命令代替)
422 96
|
安全 Linux Shell
Linux - ulimit命令详解与修改不生效
Linux - ulimit命令详解与修改不生效
1600 1
|
Cloud Native 关系型数据库 MySQL
千万商家的智能决策引擎--AnalyticDB如何助力生意参谋双十一
生意参谋是阿里官方打造的全渠道、全链路、一站式数据平台,致力于为用户提供经营分析、市场洞察、客群洞察等多样化数据服务,帮助用户全面提升商业决策效率。多种多样的分析需求对生意参谋的架构提出了巨大的挑战,借助于云原生数据仓库AnalyticDB MySQL的强大能力,生意参谋与QuickBI团队强强联合,打造了“商家自助分析”产品,帮助商家定制自己的数据报表,满足商家对自身各维度数据进行随心所欲的分析需求,帮助千万商家实现“数据价值在线化”。
千万商家的智能决策引擎--AnalyticDB如何助力生意参谋双十一