首页 > 数据库 >oracle 11g 调整sga和pga大小

oracle 11g 调整sga和pga大小

时间:2024-08-30 10:19:25浏览次数:11  
标签:11g target pga memory system SQL sga integer

oracle10g 11g 调整sga和pga大小

-------------------------------------------------------------------
---- 2024年8月22日14:18:48
---- bayaimn
------------------------------------------------------------------- 



++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

二、OA 办公测试 库:
 Oracle 11.2.0.1.0 
 
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

1、Linux 系统版本查询

cat /proc/version
cat /etc/issue
lsb_release -a
cat /etc/redhat-release
 free -g
 free -m
 
df -h /dev/shm
cat /etc/fstab | grep shm
lscpu
uname -a
 
env |  grep  ORA
sqlplus -V
 
sqlplus / as sysdba
set linesize 400
set pagesize 350


【查看SGA/ PGA】--------------------------------

show parameter mem;
show parameter pga;
show parameter sga;
show parameter work;

SELECT * FROM V$SGAINFO; 
select * from v$sga; 
show parameters area_size 
SELECT * FROM v$pgastat; 

# 查看 pga 
show parameters area_size 
SELECT * FROM v$pgastat; 


# 查看pga建议 

SELECT (SELECT ROUND(value/1024/1024,0) FROM v$parameter
WHERE name = 'pga_aggregate_target') "Current Mb"
, ROUND(pga_target_for_estimate/1024/1024,0) "Projected Mb"
, ROUND(estd_pga_cache_hit_percentage) "%"
FROM v$pga_target_advice
ORDER BY 2; 

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

[oracle@host-192-168-111-69 ~]$ cat /etc/redhat-release
CentOS Linux release 7.6.1810 (Core)
[oracle@host-192-168-111-69 ~]$  free -g
              total        used        free      shared  buff/cache   available
Mem:             15           4           0           4          10           6
Swap:             5           0           5
[oracle@host-192-168-111-69 ~]$  free -m
              total        used        free      shared  buff/cache   available
Mem:          16040        4709         435        4313       10896        6642
Swap:          6015           0        6015
[oracle@host-192-168-111-69 ~]$
[oracle@host-192-168-111-69 ~]$


[oracle@host-192-168-111-69 ~]$  env |  grep  ORA
ORACLE_SID=jsjn
ORACLE_HOME_LISTNER=/oracle/app/oracle/product/11.2.0/dbhome_1
ORACLE_BASE=/oracle/app
ORACLE_TERM=vt100
ORACLE_HOME=/oracle/app/oracle/product/11.2.0/dbhome_1
[oracle@host-192-168-111-69 ~]$  sqlplus -V

SQL*Plus: Release 11.2.0.1.0 Production



3、查询 spfilejsjn.ora、initjsjn.ora 的位置和完整性:
如果缺少文件,需要创建备份文件

[root@localhost dbs]# pwd
/u01/app/oracle/product/11.2.0/db_1/dbs



SQL> show parameter pfile;

NAME    TYPE        VALUE
--------- -------------------------
spfile     string      /oracle/app/oracle/product/11.2.0/dbhome_1/dbs/spfilejsjn.ora

cd  /oracle/app/oracle/product/11.2.0/dbhome_1/dbs/initjsjn.ora

create pfile  from spfile;

[oracle@host-192-168-111-69 dbs]$ ll
total 40
-rw-rw----. 1 oracle dba 1544 Aug 20 14:49 hc_DBUA0.dat
-rw-rw----. 1 oracle dba 1544 Sep  6  2021 hc_jngl.dat
-rw-rw----  1 oracle dba 1544 Aug 20 14:42 hc_jsjn.dat
-rw-r--r--  1 oracle dba  937 Aug 28 11:12 initjsjn.ora



show parameter work;SQL> SQL> SQL>
NAME                                 TYPE        VALUE
------------------------------------ ----------- ------------------------------
hi_shared_memory_address             integer     0
memory_max_target                    big integer 6464M
memory_target                        big integer 6464M
shared_memory_address                integer     0
SQL>
NAME                                 TYPE        VALUE
------------------------------------ ----------- ------------------------------
pga_aggregate_target                 big integer 0
SQL>
NAME                                 TYPE        VALUE
------------------------------------ ----------- ------------------------------
lock_sga                             boolean     FALSE
pre_page_sga                         boolean     FALSE
sga_max_size                         big integer 6464M
sga_target                           big integer 0
SQL>

NAME                                 TYPE        VALUE
------------------------------------ ----------- ------------------------------
fileio_network_adapters              string
listener_networks                    string
workarea_size_policy                 string      AUTO
SQL>


startup pfile='/oracle/app/oracle/product/11.2.0/dbhome_1/dbs/initjsjn.ora';


【方法1】
alter system set memory_max_target=11G  scope=spfile;
alter system set memory_target=11G  scope=spfile;
alter system set pga_aggregate_target=0  scope=spfile;
alter system set sga_target=0  scope=spfile;



SQL> SQL> 
show parameter mem;
show parameter pga;
show parameter sga;
show parameter work;
NAME                                 TYPE        VALUE
------------------------------------ ----------- ------------------------------
hi_shared_memory_address             integer     0
memory_max_target                    big integer 11G
memory_target                        big integer 11G
shared_memory_address                integer     0
SQL>
NAME                                 TYPE        VALUE
------------------------------------ ----------- ------------------------------
pga_aggregate_target                 big integer 0
SQL>
NAME                                 TYPE        VALUE
------------------------------------ ----------- ------------------------------
lock_sga                             boolean     FALSE
pre_page_sga                         boolean     FALSE
sga_max_size                         big integer 11G
sga_target                           big integer 0
SQL>

NAME                                 TYPE        VALUE
------------------------------------ ----------- ------------------------------
fileio_network_adapters              string
listener_networks                    string
workarea_size_policy                 string      AUTO
SQL>
SQL>




【方法2】

alter system set memory_max_target=6.3G  scope=spfile;
alter system set memory_target=6.3G scope=spfile;

alter system set sga_max_size=4.3G  scope=spfile;
alter system set sga_target=4.3G scope=spfile;

alter system set pga_aggregate_target=2G  scope=spfile;

shutdown immediate
startup


NAME                                 TYPE        VALUE
------------------------------------ ----------- ------------------------------
hi_shared_memory_address             integer     0
memory_max_target                    big integer 8G
memory_target                        big integer 8G
shared_memory_address                integer     0
SQL>
NAME                                 TYPE        VALUE
------------------------------------ ----------- ------------------------------
pga_aggregate_target                 big integer 2G
SQL>
NAME                                 TYPE        VALUE
------------------------------------ ----------- ------------------------------
lock_sga                             boolean     FALSE
pre_page_sga                         boolean     FALSE
sga_max_size                         big integer 6G
sga_target                           big integer 6G
SQL>

NAME                                 TYPE        VALUE
------------------------------------ ----------- ------------------------------
fileio_network_adapters              string
listener_networks                    string
workarea_size_policy                 string      AUTO
SQL>
SQL>



alter system set memory_max_target=13G  scope=spfile;
alter system set memory_target=13G scope=spfile;

alter system set sga_max_size=10G  scope=spfile;
alter system set sga_target=10G scope=spfile;

alter system set pga_aggregate_target=3G  scope=spfile;



show parameter cursor;
alter system set open_cursors = 2000 scope = spfile; 

show parameter session;
select count(1) from V$SESSION;
show parameter process;
select count(1) from V$PROCESS;

alter system set processes=1500 scope=spfile SID='baydb1';
alter system set sessions=2000  scope=spfile SID='baydb1';


shutdown immediate
startup

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

windows:


Connected to Oracle Database 11g Enterprise Edition Release 11.2.0.4.0 
Connected as sys@WINDB36 AS SYSDBA
 
SQL> show parameter  sga
 
NAME                                 TYPE        VALUE
------------------------------------ ----------- ------------------------------
lock_sga                             boolean     FALSE
pre_page_sga                         boolean     FALSE
sga_max_size                         big integer 1648M
sga_target                           big integer 0
 
SQL> show parameter  pga
 
NAME                                 TYPE        VALUE
------------------------------------ ----------- ------------------------------
pga_aggregate_target                 big integer 0
 
SQL> show parameter  mem
 
NAME                                 TYPE        VALUE
------------------------------------ ----------- ------------------------------
hi_shared_memory_address             integer     0
memory_max_target                    big integer 1648M
memory_target                        big integer 1648M
shared_memory_address                integer     0
 
SQL> show parameter  work
 
NAME                                 TYPE        VALUE
------------------------------------ ----------- ------------------------------
fileio_network_adapters              string      
listener_networks                    string      
workarea_size_policy                 string      AUTO
 
SQL> 
==================================================
linux


SQL> show parameter process;

NAME                                 TYPE        VALUE
------------------------------------ ----------- -----------------------------
aq_tm_processes                      integer     1
cell_offload_processing              boolean     TRUE
db_writer_processes                  integer     1
gcs_server_processes                 integer     0
global_txn_processes                 integer     1
job_queue_processes                  integer     1000
log_archive_max_processes            integer     4
processes                            integer     600
processor_group_name                 string
SQL> show parameter SGA ;

NAME                                 TYPE        VALUE
------------------------------------ ----------- -----------------------------
lock_sga                             boolean     FALSE
pre_page_sga                         boolean     FALSE
sga_max_size                         big integer 3008M
sga_target                           big integer 3008M
SQL> show parameter PGA ;

NAME                                 TYPE        VALUE
------------------------------------ ----------- -----------------------------
pga_aggregate_target                 big integer 999M
SQL> show parameter mem;

NAME                                 TYPE        VALUE
------------------------------------ ----------- -----------------------------
hi_shared_memory_address             integer     0
memory_max_target                    big integer 0
memory_target                        big integer 0
shared_memory_address                integer     0
SQL> show parameter work;

NAME                                 TYPE        VALUE
------------------------------------ ----------- -----------------------------
fileio_network_adapters              string
listener_networks                    string
workarea_size_policy                 string      AUTO
SQL>
SQL>
SQL>

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



【报错一】:
ORA-00845: MEMORY_TARGET not supported on this system



【处理办法】:

[root@rac2 ~]#  cat /etc/fstab | grep shm
tmpfs                                    /dev/shm                 tmpfs   defaults,size=15G 0 0
[root@rac2 ~]# 
[root@rac2 ~]#  df -h /dev/shm
文件系统        容量  已用  可用 已用% 挂载点
tmpfs           9.0G     0  9.0G    0% /dev/shm
[root@rac2 ~]# 
修改完后,需要重新挂载/dev/shm生效:
[root@rac2 ~]# mount -o remount /dev/shm
[root@rac2 ~]# mount -o remount /dev/shm

[或者,方法2]
# 普通快速修改
# mount -o size=15G  -o  remount  /dev/shm


[root@rac2 ~]# 
[root@rac2 ~]#  df -h /dev/shm
文件系统        容量  已用  可用 已用% 挂载点
tmpfs            15G     0   15G    0% /dev/shm
[root@rac2 dbs]# free -h
              total        used        free      shared  buff/cache   available
Mem:           9.8G        1.4G        2.2G        1.9G        6.2G        6.1G
Swap:            9G          0B          9G
[root@rac2 dbs]# df -lh | grep /dev/shm
tmpfs            15G     0   15G    0% /dev/shm




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

Oracle 11g中,ORACLE把SGA与PGA统一管理,总和为memory_target参数的设定,也就是MAX(SGA+PGA)<= memory_target(当然可以在创建新实例的时候确定是否使用这种方案,在10g中是没有的)。

如果错误设定sga_max_size>=memory_target(相等也不行,PGA至少需要大概十几M内存),则无法进行startup nomount,但是修改SGA命令又需要至少在startup nomount下面执行,所以必须使用另一种方式修改该参数。

【方法一】:
cd  /u01/app/oracle/product/11.2.0/db_1/dbs
ls -lt

【会话1】 bayaim:
                    这个memory 的大小不能超过 /dev/shm  大小
         否则报错: ORA-00845: MEMORY_TARGET not supported on this system

create spfile  from pfile;

alter system set memory_max_target=11G  scope=spfile;
alter system set memory_target=11G  scope=spfile;
alter system set pga_aggregate_target=0  scope=spfile;
alter system set sga_target=0  scope=spfile;

shutdown immediate
startup

startup pfile='/u01/app/oracle/product/11.2.0/db_1/dbs/initracdb2.ora';



【方法二】:

alter system set memory_max_target=8704M  scope=spfile;
alter system set memory_target=8704M scope=spfile;

alter system set sga_max_size=6G  scope=spfile;
alter system set sga_target=6G scope=spfile;

alter system set pga_aggregate_target=2G  scope=spfile;

shutdown immediate
startup


解决方法如下:
SQL> show parameter stream

NAME TYPE VALUE
------------------------------------ ----------- ------------------------------
streams_pool_size big integer 0
SQL>
将streams_pool_size的值设置为非0,
SQL> alter system set streams_pool_size=10M scope=memory;

System altered.


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

su - oracle
export LANG=en_US
export NLS_LANG=american_america.AL32UTF8
sqlplus / as sysdba


show parameter cursor;
alter system set open_cursors = 2000 scope = spfile; 

show parameter session;
select count(1) from V$SESSION;
show parameter process;
select count(1) from V$PROCESS;

alter system set processes=1500 scope=spfile SID='baydb1';
alter system set sessions=2000  scope=spfile SID='baydb1';

shutdown immediate
startup

 

标签:11g,target,pga,memory,system,SQL,sga,integer
From: https://www.cnblogs.com/bayaim/p/18388079

相关文章

  • Oracle 11g 数据库内存原理
    转自:1、https://blog.csdn.net/ly7472712/article/details/1162393882、https://www.cnblogs.com/prognani/archive/2012/05/14/2500679.htmlOracle11g数据库内存管理-----------------------------------------------------------------------------一、Oracle数据库内......
  • [转帖]11GR2数据库审计日志自动清理
    审计日志如果把SYSTEM表空间撑爆,也会导致数据库停摆,且11g默认审计是开启状态。今天就遇到了这样的情况,写了下面脚本来实现自动清理工作,记录操作过程。TRUNCATETABLESYS.AUD$REUSESTORAGE;--对于已经被审计日志撑爆的数据库或者初始化清理工作时报错ORA-46267,强烈建议用......
  • oracle10g 11g 调整sga和pga大小
    oracle10g11g调整sga和pga大小-----------------------------------------------------------------------2024年8月22日14:18:48----bayaimn-------------------------------------------------------------------+++++++++++++++++++++++++++++++++++++++++++++++......
  • 【FPGA数字信号处理】- 什么是频域?
    在数字信号处理的广袤领域中,频域犹如一座神秘的宝库,等待着我们去开启和探索。它为我们理解和分析信号提供了独特而强大的视角,无论是在通信、音频处理、图像处理还是众多其他科学技术领域,频域都发挥着至关重要的作用。今天,就让我们一同深入这个充满魅力的数字信号处理基础——......
  • 每天分享一个FPGA开源代码(1)- spi
    1、SPI总线进行通信的结构 SPI总线主要包括四根关键信号线:(1)SCK(SerialClock)串行时钟线,由主设备产生,控制数据传输的速率和时机。(2)MOSI(MasterOutSlaveIn)主设备数据输出线,数据由主设备发送给从设备。(3)MISO(MasterInSlaveOut)从设备数据输出线,数据由从设备发......
  • 系统化提升FPGA设计技能:从基础到高级应用的全面指南
    引言FPGA(Field-ProgrammableGateArray,现场可编程门阵列)是现代数字电路设计和嵌入式系统开发中极其重要的工具。与传统的专用集成电路(ASIC)不同,FPGA允许设计人员在硬件层面进行灵活的编程,从而在各种应用中实现高性能和低延迟的解决方案。FPGA在数字信号处理、通信、视频处理、......
  • FPGA第 7 篇,FPGA开发环境搭建,Altrea开发环境搭建,Quartus几个版本之间的区别,以Quartus/
    前言我们知道FPGA的应用领域非常广泛,包括但不限于以下,请看,而且未来应用前景也可以,几乎涵盖了所有涉及数字信号处理和技术实现的领域。上期我们介绍了FPGA的基础知识数字电路,请看,FPGA与数字电路https://blog.csdn.net/weixin_65793170/article/details/141363656?spm=10......
  • FPGA与STM32_FSMC总线通信实验
    在嵌入式系统设计中,FPGA(现场可编程门阵列)与微控制器如STM32的通信是常见的应用场景。STM32通过FSMC(灵活静态存储控制器)接口与FPGA进行数据交换,可以实现高速数据传输和复杂逻辑控制。本文将介绍如何通过FSMC总线实现STM32与FPGA之间的通信。实验目的理解FSMC总线的基本工作......
  • FPGA基础:格雷码及FIFO应用概述
    1简介反射二进制码反射二进制码(RBC),也称为反射二进制(RB)或格雷码(Graycode),得名于FrankGray,是二进制数制的一种排列方式,使得连续两个值之间仅有一个比特(二进制位)不同。格雷码在数字电路中的应用有助于减少误差、提高系统的可靠性,并简化逻辑操作,因此被广泛应用于各种数字系统和电子......
  • Oracle 11g 自动统计信息收集
    在Oracle11g中,默认有3个自动任务,分别是:自动统计信息收集、SQL调优顾问、段空间调整顾问,查看方法如下:colCLIENT_NAMEfora40colTASK_NAMEfora40colOPERATION_NAMEfora40SELECTCLIENT_NAME,TASK_NAME,OPERATION_NAME,STATUSFROMdba_autotask_task; 自动统计信息收......