ALTER SYSTEM SET DB_CACHE_SIZE

Tuning de Banco, Tuning de SQL, Ferramentas de tuning
Responder
carlaestevao80
Rank: Programador Júnior
Rank: Programador Júnior
Mensagens: 18
Registrado em: Sex, 05 Mai 2006 8:48 am
Localização: Lisboa

Ola DBAs,
Administro uma BD em RAC 10gR1.
Ao efectuar a seguinte operacao no init da BD -

Selecionar tudo

ALTER SYSTEM SET DB_CACHE_SIZE
, não da qualquer tipo de erro.
Devolve que foi devidamente alterado, no entanto mesmo fazendo RESTART na BD o valor não e atribuido em nenhuma das instancias.
Sera que alguém me pode dar uma ajudita?

Obrigado :wink:
Trevisolli
Moderador
Moderador
Mensagens: 2016
Registrado em: Qua, 12 Jan 2005 3:25 pm
Localização: Araraquara - SP
Abraço,

Trevisolli
OCA Oracle PL/SQL Developer Certified Associate
OCP Oracle Forms Developer Certified Professional
Araraquara-SP

Carla, bom dia.

Achei esta documentação na internet, à respeito de reconfiguração dinâmica.
Espero que a ajude.

Fonte: http://www.dba-oracle.com/art_builder_9i_dyn1.htm

How Oracle9i supports dynamic reconfiguration
Feb 25, 2003
Donald Burleson


In my opinion, the single most important new feature of Oracle9i is the ability to dynamically modify almost all of Oracle’s performance parameters. This lets an Oracle professional dynamically reconfigure the Oracle instance while it's running, whether in reaction to a current performance problem or in anticipation of an impending performance demand. Because everything within the System Global Area (SGA)—the RAM used by an instance of Oracle—can now be modified dynamically, it's critical for you to understand how to monitor your Oracle database. When you learn to recognize trends and patterns within your system, you can proactively reconfigure the database in anticipation of regular resource needs.

With respect to ongoing database tuning activities, an Oracle expert will generally look at two areas: normally scheduled reconfiguration to support regularly scheduled changes in processing requirements, and trend-based dynamic reconfiguration made in response to information gained from STATSPACK. Let’s examine how Oracle supports both of these activities.

Scheduled reconfiguration

Consider an Oracle database that runs in Online Transaction Processing (OLTP) mode during the day and in Decision Support mode at night. These two tasks have very different requirements for optimal performance. For this type of database, the Oracle DBA can schedule a job to reconfigure the Oracle instance to the most appropriate configuration for the current type of processing.

You’ll generally use one of two tools for scheduling a dynamic reconfiguration. The most common approach is to use a UNIX cron job that launches a shell script to schedule a periodic reconfiguration. You could also use the Oracle dbms_job utility. Either of these tools will allow you to schedule a configuration change.

In Listing A you’ll find a UNIX script that can be used to reconfigure Oracle for decision support processing. Note that the script makes changes to the shared_pool, db_cache_size, and pga_aggregate_target parameters to accommodate data warehouse activity. A similar script could then be run in the morning to change the database configuration back to OLTP mode.

Listing A:

Selecionar tudo

#!/bin/ksh

# First, we must set the environment . . . .
ORACLE_SID=$1
export ORACLE_SID
ORACLE_HOME=`cat /etc/oratab|grep ^$ORACLE_SID:|cut -f2 -d':'`
#ORACLE_HOME=`cat /var/opt/oracle/oratab|grep ^$ORACLE_SID:|cut -f2 -d':'`
export ORACLE_HOME
PATH=$ORACLE_HOME/bin:$PATH
export PATH

$ORACLE_HOME/bin/sqlplus –s /nologin<<!
connect system/manager as sysdba;
alter system set db_cache_size=1500m;
alter system set shared_pool_size=500m;
alter system set pga_aggregate_target=4000m;
exit
!

Trend-based dynamic reconfiguration

When performing trend-based dynamic reconfiguration, you’ll collect historical data about the Oracle database and use this information to proactively reconfigure the database, perhaps by using the dbms_job package to fire ad-hoc changes or by scheduling regular reconfiguration using one of the methods I discussed. This is analogous to just-in-time manufacturing—where goods appear on the manufacturing floor at just the time they are needed in the assembly process—in that an Oracle DBA can anticipate processing needs and ensure that the SGA resources are delivered in time to accommodate processing tasks.

You can use STATSPACK to track signatures for important metrics and reveal patterns to predict the resources that your Oracle servers will need. Metric signatures are usually collected by hour of the day and by day of the week, making it easy to discover these patterns. For example, consider the hour of the day plot of the data buffer hit ratio (BHR) that appears in Figure A.



Figure A

This BHR plot shows a recurring shortage of buffer blocks.



Notice that the repeating signature seems to indicate a shortage of data buffer blocks between the hours of 2:00 and 3:00 A.M. and again between 8:00 and 9:00 P.M. Once you know this, you can schedule tasks to reallocate RAM to the data buffers during these time periods to alleviate the problem.

You can also plot the data BHR by day of the week, as you can see in Figure B. From the graph, you can see problems on Monday and Friday, indicating that you need to increase the db_cache_size for those days to correct the problem.



Figure B

A daily BHR plot can illustrate problems over a longer cycle.


Trend-based information is a gold mine for the Oracle DBA because it can be used to reveal previously unseen performance trends within an Oracle database. In my next article, I’ll take a closer look at the metrics used by savvy Oracle professionals to determine how to dynamically tune their Oracle9i databases.
carlaestevao80
Rank: Programador Júnior
Rank: Programador Júnior
Mensagens: 18
Registrado em: Sex, 05 Mai 2006 8:48 am
Localização: Lisboa

Obrigado pela informacao.
Mas a minha duvida persiste.
Eu faco o comando como SYSDBA:
ALTER SYSTEM SET DB_CACHE_SIZE = 640M scope=SPFILE
E devolvida resposta de sucesso.
Eu faço RESTART na base de dados e quando faço SHOW PARAMETER DB_CACHE_SIZE, e devolvido exactamente o mesmo valor que estava anteriormente.

CE

gilbertoca
Rank: DBA Sênior
Rank: DBA Sênior
Mensagens: 372
Registrado em: Ter, 24 Jan 2006 3:33 pm
Localização: Palmas - TO
Contato:

Você está usando o parâmetro SGA_TARGET?
Se for este o caso (usando sga), o parâmetro DB_CHACHE_SIZE não tem muita relevância http://download.oracle.com/docs/cd/B193 ... #sthref187. Apenas estabelecendo o mínimo do pool de memória.
Link muito importante: http://www.oracle.com/technology/pub/ar ... 0gdba.html

Selecionar tudo

gilberto@ti-des05:~> source .oracleDB
gilberto@ti-des05:~> sqlplus gilberto@migra

SQL*Plus: Release 10.1.0.2.0 - Production on Qua Out 24 10:16:48 2007

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

Enter password:

Connected to:
Oracle Database 10g Enterprise Edition Release 10.2.0.2.0 - Production
With the Partitioning, OLAP and Data Mining options

gilberto@ALFA> show parameter db_cach

NAME                                 TYPE        VALUE
------------------------------------ ----------- ------------------------------
db_cache_advice                      string      ON
db_cache_size                        big integer 32M
gilberto@ALFA> show parameter sga_

NAME                                 TYPE        VALUE
------------------------------------ ----------- ------------------------------
sga_max_size                         big integer 1728M
sga_target                           big integer 1728M
gilberto@ALFA>                             
Gilberto
carlaestevao80
Rank: Programador Júnior
Rank: Programador Júnior
Mensagens: 18
Registrado em: Sex, 05 Mai 2006 8:48 am
Localização: Lisboa


Ola,

Eu tenho o SGA_TARGET com o valor 0.
Portanto nesse caso é relevante o DB_CACHE_SIZE, mas não o consigo alterar :cry:

CE
gilbertoca
Rank: DBA Sênior
Rank: DBA Sênior
Mensagens: 372
Registrado em: Ter, 24 Jan 2006 3:33 pm
Localização: Palmas - TO
Contato:

Verifique o parâmetro DB_BLOCK_SIZE. O DB_CACHE_SIZE precisa ser um múltiplo desse parâmetro.
Outra coisa, você tem conhecimento que db_cache_size + shared_pool_size + large_pool_size não pode exceder sga_max_size?

O que impede você de usar o gerenciamento automático de memória?

Gilberto
carlaestevao80
Rank: Programador Júnior
Rank: Programador Júnior
Mensagens: 18
Registrado em: Sex, 05 Mai 2006 8:48 am
Localização: Lisboa


Olá,

Antes de mais, obrigado pela dica.
Já agora o que preciso fazer para configurar a Gestão Automática da Memória?

CE
gilbertoca
Rank: DBA Sênior
Rank: DBA Sênior
Mensagens: 372
Registrado em: Ter, 24 Jan 2006 3:33 pm
Localização: Palmas - TO
Contato:

Bom dia Carla!

Este documento (http://www.oracle.com/technology/pub/ar ... 0gdba.html), responde tudo.

Mas vamos resumir. Há duas formas de fazê-lo: uma através do EM - acho mais fácil e a outra ajustando o parâmetro SGA_TARGET.

Para fazer manualmente, setando o parâmetro, você soma os valores dos outros parâmetros em questâo, por exemplo:

Selecionar tudo

SHARED_POOL_SIZE=256M
DB_CACHE_SIZE=512M
LARGE_POOL_SIZE=256M
LOG_BUFFER=16M
SGA_TARGET = 256 M + 512M + 256 M + 16M + 16 M (fixed SGA
overhead [é uma recomendaçao!]) = 1056 M

isso para chegar em um valor para o SGA_TARGET (que tb pode ser encontrado pela consulta: select sum(value) from v$sga;). Depois, ajuste os parâmetros acima para o valor zero (0).
Então fica assim:

Selecionar tudo

alter system set sga_target=1056M;
alter system set db_cache_size = 0;
alter system set shared_pool_size = 0;
alter system set large_pool_size = 0;
alter system set java_pool_size = 0;
Gilberto
carlaestevao80
Rank: Programador Júnior
Rank: Programador Júnior
Mensagens: 18
Registrado em: Sex, 05 Mai 2006 8:48 am
Localização: Lisboa


Oi,

Neste caso, já não preciso mais preocupar-me com os outros parâmetros não é?
GRande ajuda...
Obrigadão :)

CE
gilbertoca
Rank: DBA Sênior
Rank: DBA Sênior
Mensagens: 372
Registrado em: Ter, 24 Jan 2006 3:33 pm
Localização: Palmas - TO
Contato:

Neste caso, já não preciso mais preocupar-me com os outros parâmetros não é?
Isso mesmo!
Agora sua preocupação é ajustar o parâmetro SGA_TARGET a um valor adequado para seu banco. Mas isso é já mais fácil!

Até,

Gilberto
carlaestevao80
Rank: Programador Júnior
Rank: Programador Júnior
Mensagens: 18
Registrado em: Sex, 05 Mai 2006 8:48 am
Localização: Lisboa


Olá,
Tentei fazer o que me sugeriu mas não dá.
Ao tentar colocar SGA_TARGET a 0 não houve qualquer problema, no entanto o DB_CACHE_SIZE não pode ficar a 0, porque tenho o DB_BLOCK_SIZE a 8192.
Como posso fazer nesta situação?
Continuo sem conseguir aumentar o DB_CACHE_SIZE :(

CE
gilbertoca
Rank: DBA Sênior
Rank: DBA Sênior
Mensagens: 372
Registrado em: Ter, 24 Jan 2006 3:33 pm
Localização: Palmas - TO
Contato:

carlaestevao80 escreveu:
Olá,
Tentei fazer o que me sugeriu mas não dá.
Ao tentar colocar SGA_TARGET a 0 não houve qualquer problema
Carla, acho que você NÂO leu bem o conteuúo dos links que passei! Nem mesmo o que falei sobre a ativação do gerenciamento automático de memoria.

Onde foi que você viu ou leu sobre colocar SGA_TARGET a 0?
carlaestevao80 escreveu:
, no entanto o DB_CACHE_SIZE não pode ficar a 0, porque tenho o DB_BLOCK_SIZE a 8192.
Como posso fazer nesta situação?
Continuo sem conseguir aumentar o DB_CACHE_SIZE :(

CE
elidias7
Rank: Analista Sênior
Rank: Analista Sênior
Mensagens: 153
Registrado em: Qui, 01 Nov 2007 2:53 pm
Localização: Osasco
Eli Dias
Oracle Certified Professional

Carla.

Você tentou alterar os parametros desta forma.......

Exemplo

*SQL> ALTER SYSTEM SET DB_CACHE_SIZE = 30M SCOPE=BOTH;
Você adiciona o valor desejavel

SQL> ALTER SYSTEM SET DB_KEEP_CACHE_SIZE = 8M SCOPE=BOTH;

SQL> ALTER SYSTEM SET DB_RECYCLE_CACHE_SIZE = 5M SCOPE=BOTH;

A outra coisa, essa historia de você ter colocado a SGA=0 ficou estranho, você provavelmente alterou os parametros dos processos da SGA

Espero ter ajudado!
carlaestevao80
Rank: Programador Júnior
Rank: Programador Júnior
Mensagens: 18
Registrado em: Sex, 05 Mai 2006 8:48 am
Localização: Lisboa

Bom dia,
Eu enganei-me ao escrever no POST eu não tentei colocar SGA_TARGET a 0.

Tentei colocar no valor da soma dos parâmetros que me indicaram. E depois ao tentar colocar o DB_CACHE_SIZE a 0 é q deu erro.

Peço desculpa pela confusao :(

CE
elidias7
Rank: Analista Sênior
Rank: Analista Sênior
Mensagens: 153
Registrado em: Qui, 01 Nov 2007 2:53 pm
Localização: Osasco
Eli Dias
Oracle Certified Professional

Mas então.

Você conseguiu realizar a alteração de alguma forma?
carlaestevao80
Rank: Programador Júnior
Rank: Programador Júnior
Mensagens: 18
Registrado em: Sex, 05 Mai 2006 8:48 am
Localização: Lisboa


Oi,
Até ao momento não consegui alterar o valor de forma alguma :(

CE
gilbertoca
Rank: DBA Sênior
Rank: DBA Sênior
Mensagens: 372
Registrado em: Ter, 24 Jan 2006 3:33 pm
Localização: Palmas - TO
Contato:

carlaestevao80 escreveu:
Oi,
Até ao momento não consegui alterar o valor de forma alguma :(

CE
Carla assim fica difícil ajudá-la! você não nos passa informação alguma a respeito desse procedimento. Se houve erro, como o banco se comportou, se o log de alerta diz alguma coisa, se o enterprise manager mostra alertas diferentes, etc.

Gilberto
Responder
  • Informação
  • Quem está online

    Usuários navegando neste fórum: Nenhum usuário registrado e 3 visitantes