Oracle查看SGA和PGA使用率

select name,total,round(total-free,2) used, round(free,2) free,round((total-free)/total*100,2) pctused from
(select 'SGA' name,(select sum(value/1024/1024) from v$sga) total,
(select sum(bytes/1024/1024) from v$sgastat where name='free memory')free from dual)
union
select name,total,round(used,2)used,round(total-used,2)free,round(used/total*100,2)pctused from (
select 'PGA' name,(select value/1024/1024 total from v$pgastat where name='aggregate PGA target parameter')total,
(select value/1024/1024 used from v$pgastat where name='total PGA allocated')used from dual)
union
select name,round(total,2) total,round((total-free),2) used,round(free,2) free,round((total-free)/total*100,2) pctused from (
select 'Shared pool' name,(select sum(bytes/1024/1024) from v$sgastat where pool='shared pool')total,
(select bytes/1024/1024 from v$sgastat where name='free memory' and pool='shared pool') free from dual)
union
select name,round(total,2)total,round(total-free,2) used,round(free,2) free,round((total-free)/total,2) pctused from (
select 'Default pool' name,( select a.cnum_repl*(select value from v$parameter where name='db_block_size')/1024/1024 total from x$kcbwds a, v$buffer_pool p
where a.set_id=p.LO_SETID and p.name='DEFAULT' and p.block_size=(select value from v$parameter where name='db_block_size')) total,
(select a.anum_repl*(select value from v$parameter where name='db_block_size')/1024/1024 free from x$kcbwds a, v$buffer_pool p
where a.set_id=p.LO_SETID and p.name='DEFAULT' and p.block_size=(select value from v$parameter where name='db_block_size')) free from dual)
union
select name,nvl(round(total,2),0)total,nvl(round(total-free,2),0) used,nvl(round(free,2),0) free,nvl(round((total-free)/total,2),0) pctused from (
select 'KEEP pool' name,(select a.cnum_repl*(select value from v$parameter where name='db_block_size')/1024/1024 total from x$kcbwds a, v$buffer_pool p
where a.set_id=p.LO_SETID and p.name='KEEP' and p.block_size=(select value from v$parameter where name='db_block_size')) total,
(select a.anum_repl*(select value from v$parameter where name='db_block_size')/1024/1024 free from x$kcbwds a, v$buffer_pool p
where a.set_id=p.LO_SETID and p.name='KEEP' and p.block_size=(select value from v$parameter where name='db_block_size')) free from dual)
union
select name,nvl(round(total,2),0)total,nvl(round(total-free,2),0) used,nvl(round(free,2),0) free,nvl(round((total-free)/total,2),0) pctused from (
select 'RECYCLE pool' name,( select a.cnum_repl*(select value from v$parameter where name='db_block_size')/1024/1024 total from x$kcbwds a, v$buffer_pool p
where a.set_id=p.LO_SETID and p.name='RECYCLE' and p.block_size=(select value from v$parameter where name='db_block_size')) total,
(select a.anum_repl*(select value from v$parameter where name='db_block_size')/1024/1024 free from x$kcbwds a, v$buffer_pool p
where a.set_id=p.LO_SETID and p.name='RECYCLE' and p.block_size=(select value from v$parameter where name='db_block_size')) free from dual)
union
select name,nvl(round(total,2),0)total,nvl(round(total-free,2),0) used,nvl(round(free,2),0) free,nvl(round((total-free)/total,2),0) pctused from(
select 'DEFAULT 16K buffer cache' name,(select a.cnum_repl*16/1024 total from x$kcbwds a, v$buffer_pool p
where a.set_id=p.LO_SETID and p.name='DEFAULT' and p.block_size=16384) total,
(select a.anum_repl*16/1024 free from x$kcbwds a, v$buffer_pool p
where a.set_id=p.LO_SETID and p.name='DEFAULT' and p.block_size=16384) free from dual)
union
select name,nvl(round(total,2),0)total,nvl(round(total-free,2),0) used,nvl(round(free,2),0) free,nvl(round((total-free)/total,2),0) pctused from(
select 'DEFAULT 32K buffer cache' name,(select a.cnum_repl*32/1024 total from x$kcbwds a, v$buffer_pool p
where a.set_id=p.LO_SETID and p.name='DEFAULT' and p.block_size=32768) total,
(select a.anum_repl*32/1024 free from x$kcbwds a, v$buffer_pool p
where a.set_id=p.LO_SETID and p.name='DEFAULT' and p.block_size=32768) free from dual)
union
select name,total,total-free used,free, (total-free)/total*100 pctused from (
select 'Java Pool' name,(select sum(bytes/1024/1024) total from v$sgastat where pool='java pool' group by pool)total,
( select bytes/1024/1024 free from v$sgastat where pool='java pool' and name='free memory')free from dual)
union
select name,Round(total,2),round(total-free,2) used,round(free,2) free, round((total-free)/total*100,2) pctused from (
select 'Large Pool' name,(select sum(bytes/1024/1024) total from v$sgastat where pool='large pool' group by pool)total,
( select bytes/1024/1024 free from v$sgastat where pool='large pool' and name='free memory')free from dual)
order by pctused desc;
NAME                          TOTAL       USED       FREE    PCTUSED
------------------------ ---------- ---------- ---------- ----------
SGA                      16310.8477   15933.34     377.51      97.69
PGA                            1594     1535.8       58.2      96.35
Shared pool                 2592.03    2302.34      289.7      88.82
Large Pool                       64       8.19      55.81      12.79
Default pool                3110.14    2451.91     658.23        .79
DEFAULT 16K buffer cache          0          0          0          0
DEFAULT 32K buffer cache          0          0          0          0
Java Pool                        32          0         32          0
KEEP pool                         0          0          0          0
RECYCLE pool                      0          0          0          0

10 rows selected.

  • 2
    点赞
  • 6
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
### 回答1: 问题:oracle查看sgapga使用率。 回答:可以使用以下命令查看Oracle数据库SGAPGA使用率: 1. 查看SGA使用情况: ``` select * from v$sga_monitor_info; ``` 2. 查看PGA使用情况: ``` select * from v$pgastat; ``` 以上命令可以在SQL*Plus或者Oracle SQL Developer等工具中执行。 ### 回答2: Oracle SGA(System Global Area)和PGA(Process Global Area)是数据库中占用大量内存的关键部分。如何合理地管理和监控它们的使用率,是保障数据库的性能和稳定性的重要因素。下面介绍一些常用的方法。 1. 使用V$SGA和V$PGASTAT视图 这两个视图分别提供了SGAPGA的统计信息,包括已使用和可用的内存大小,SGA组件的使用率等等。具体的查询命令如下: SELECT * FROM V$SGA; SELECT * FROM V$PGASTAT; 这些命令返回的结果包含了SGAPGA的各种信息和指标,如果结合了一些额外的条件,还可以更进一步地筛选有用的数据。 2. 使用Oracle Enterprise Manager Oracle Enterprise Manager是Oracle官方推出的一种基于Web的管理工具,通过它,可以轻松地实时查看SGAPGA的使用情况,通过图表和报表分析数据,并对其进行调整和管理。使用这个工具需要事先在客户端安装好相应的软件,并配置好数据库的设置。 3. 修改SGAPGA参数 如果SGAPGA使用率过高,需要进行优化和调整,这时就需要手动修改参数。可以通过ALTER SYSTEM命令或者修改parameter文件来实现,关键的参数包括shared_pool_size(SGA中共享池的大小)、buffer_pool_size(SGA中缓存池的大小)、sort_area_size(PGA中用来执行排序的内存大小)等等。 4. 使用第三方工具 除了Oracle自带的工具外,还有不少第三方工具可供选择。例如,Quest Toad、SolarWinds Database Performance Analyzer、Spotlight on Oracle等,这些工具都提供了各种SGAPGA的报表、分析和调整功能,方便用户进行监控和优化。 由于SGAPGA的使用情况可能随时发生变化,所以需要在系统运行期间不断地进行监控和调整,才能确保数据库的正常运行。 ### 回答3: Oracle是一种强大的企业级数据库管理系统,可以存储和处理海量的数据。在Oracle中,有一个重要的概念叫做SGA(System Global Area)和PGA(Program Global Area),它们分别用于存储系统级别和进程级别的数据结构,包括缓冲池、共享池、重做日志缓冲区等等。在运行Oracle应用程序时,SGAPGA使用率是非常重要的指标,因为它们直接影响到系统的性能和稳定性。 要查看OracleSGAPGA使用率,可以使用多种方法,下面列举几种常见的方式: 1. 使用V$SGAINFO和V$PGASTAT视图 V$SGAINFO视图可以显示SGA的总大小和各个部分的使用情况,例如共享池、缓冲池、重做日志缓冲区等。可以使用以下SQL语句查询: SELECT * FROM V$SGAINFO; V$PGASTAT视图可以显示PGA的使用情况,包括PGA的总大小、已使用大小、空闲大小、高水位等。可以使用以下SQL语句查询: SELECT * FROM V$PGASTAT; 2. 使用Oracle Enterprise Manager Oracle Enterprise Manager是一种强大的管理工具,可以帮助管理员监控和管理Oracle数据库实例。通过Oracle Enterprise Manager,可以轻松查看SGAPGA使用率。登录到Oracle Enterprise Manager控制台,选择“Performance”选项卡,然后选择“Memory”子选项卡,可以看到SGAPGA使用率以及其他相关指标。 3. 使用Oracle AWR报告 Oracle AWR(Automatic Workload Repository)是一种自动化性能分析工具,可以收集和保存Oracle数据库实例的性能数据。通过生成AWR报告,可以查看SGAPGA使用率以及其他重要的性能指标。可以使用以下SQL语句生成AWR报告: exec dbms_workload_repository.create_snapshot; exec dbms_workload_repository.create_snapshot; SELECT dbid, instance_number, startup_time FROM v$instance; SELECT snap_id, begin_interval_time, end_interval_time FROM dba_hist_snapshot WHERE dbid = &dbid AND instance_number = &instance_number ORDER BY snap_id DESC; SELECT * FROM TABLE(dbms_workload_repository.awr_report_text( &dbid, &instance_number, &snap_id_from, &snap_id_to)); 以上是查看OracleSGAPGA使用率的几种常见方法。通过监控SGAPGA使用率,可以快速发现和解决Oracle数据库中的性能瓶颈问题,保证系统的稳定运行。

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值