quinta-feira, 12 de março de 2015

Download Gratuito Editora Oracle Press : Guia de Consulta Rápida - Oracle Query Tuning

Olá pessoal

Segue abaixo o link do  Guia de Consulta Rápida : Oracle Query Tuning disponibilizado pela Oracle Press em parceria com a SolarWinds.

Escrito por Oracle ACE Director Richard Niemiec, este ebook livre oferece as melhores práticas para ajustar consultas Oracle. Você vai ter dicas de especialistas para determinar quais consultas para sintonizar.O livro cobre os seguintes tópicos:

Oracle 11g Automatic SQL Tuning, 
Oracle 11g Automatic Workload Repository, 
Oracle Real Application Testing,
SQL Performance Analyzer.





Também estão incluídas técnicas testadas para o dicionário consultas de dados tuning.

Corra logo e faça seu Download gratuito no Link abaixo. Será necessário fazer um cadastro prévio.

Download Free Copy ou

http://go.mheducation.com/Ab050ASJ00oxuVG0070j0nW

Até logo!



sábado, 7 de março de 2015

Ambiente de Desenvolvimento com Oracle 11g Express Edition no OEL 5x

Olá !

Dessa vez irei demonstrar como criar uma ambiente para DEV utilizando o Oracle Express Edition no Oracle Linux 5.8.

O objetivo foi criar um servidor com Linux onde os meus alunos da faculdade pudessem resolver os exercícios das Disciplinas Banco de Dados e Projetos de Banco de Dados e puderem administrar esse ambiente de uma forma básica com as features disponíveis nessa versão de avaliação.

Não irei abordar a instalação do Oracle Linux 5.8 pois partimos de um ambiente ja instalado, mas você pode visualizar um exemplo aqui.

Pre-requisitos

A swap do Oracle Linux deverá ser no minimo 2G;
Instalar as bibliotecas libaio, bc e flex ou atualizalas.

[root@devoracle ~]# yum install libaio bc flex

Você deve efetuar o download do Oracle XE aqui.E descompacta-lo

[root@devoracle ~]# unzip -q oracle-xe-11.2.0-1.0.x86_64.rpm.zip

Após a descompactação o Oracle irá criar um diretório conforme abaixo:

[root@devoracle ~]# cd Disk1
[root@devoracle Disk1]# ls
oracle-xe-11.2.0-1.0.x86_64.rpm  response  upgrade

Passo 2: Instale o arquivo RPM usando os comandos abaixo:

rpm -ivh oracle-xe-11.2.0-1.0.x86_64.rpm

[root@devoracle Disk1]# rpm -ivh oracle-xe-11.2.0-1.0.x86_64.rpm
Preparing...                ########################################### [100%]
   1:oracle-xe              ########################################### [100%]
Executing post-install steps...
You must run '/etc/init.d/oracle-xe configure' as the root user to configure the database.

[root@devoracle Disk1]#


Passo 2: Configurar  11g XE Database and Options

Execute o seguinte comando /etc/init.d/oracle-xe configure  .


[root@devoracle Disk1]# /etc/init.d/oracle-xe configure

Oracle Database 11g Express Edition Configuration
-------------------------------------------------
This will configure on-boot properties of Oracle Database 11g Express
Edition.  The following questions will determine whether the database should
be starting upon system boot, the ports it will use, and the passwords that
will be used for database accounts.  Press <enter> to accept the defaults.
Ctrl-C will abort.

Specify the HTTP port that will be used for Oracle Application Express [8080]:

Specify a port that will be used for the database listener [1521]:

Specify a password to be used for database accounts.  Note that the same
password will be used for SYS and SYSTEM.  Oracle recommends the use of
different passwords for each database account.  This can be done after
initial configuration:
Confirm the password:

Do you want Oracle Database 11g Express Edition to be started on boot (y/n) [y]:y

Starting Oracle Net Listener...Done
Configuring database...Done
Starting Oracle Database 11g Express Edition instance...Done
Installation completed successfully.</enter>

A instalaçao foi criada no diretório .

Passo 3: Setar as variáveis de ambiente.

Para setar as variáveis de ambiente no Oracle , utilize o script oracle_env.sh incluso no diretorio de instalação

/u01/app/oracle/product/11.2.0/xe/bin

[root@devoracle Disk1]# cd /u01/app/oracle/product/11.2.0/xe/bin

Para setar execute os comando abaixo.'. ./oracle_env.sh':

[root@devoracle bin]# . ./oracle_env.sh

Para setar permanentemente para os usuários, adicione as variáveis nos arquivos .bashrc ou .bash_profile dos usuarios que irao acessar.

. /u01/app/oracle/product/11.2.0/xe/bin/oracle_env.sh

Agora acesso o SQL *Plus

Passo 4 - Permitir Acesso Remoto ao Orace 11g XE.

SQL> EXEC DBMS_XDB.SETLISTENERLOCALACCESS(FALSE);

PL/SQL procedure successfully completed.


Passo 5 - Mover a Flash Recovery Area (Fast Recovery Area)

Para proteger uma possível falha de disco, você deve mover a Flash Recovery Area para um disco separado;

Por default a Fast Recovery Area pode estar localizada em /u01/ap/oracle/fast_recovery_area

SQL> show parameter DB_RECOVERY_FILE_DEST;

NAME                                 TYPE        VALUE
------------------------------------ ----------- ------------------------------
db_recovery_file_dest                string      /u01/app/oracle/fast_recovery_area
db_recovery_file_dest_size           big integer 10G
SQL>


Então, para poder mover deverá ser criado uma pasta previa.

[root@devoracle ~]# mkdir /opt/fra
[root@devoracle ~]# chown oracle:dba /opt/fra

SQL> ALTER SYSTEM SET DB_RECOVERY_FILE_DEST = '/opt/fra';

System altered.

SQL>

Para mover os arquivos use o script movelog.sql:

SQL> @?/sqlplus/admin/movelogs
SQL> SET FEEDBACK 1
SQL> SET NUMWIDTH 10
SQL> SET LINESIZE 80
SQL> SET TRIMSPOOL ON
SQL> SET TAB OFF
SQL> SET PAGESIZE 100
SQL> declare
  2     cursor rlc is
  3        select group# grp, thread# thr, bytes/1024 bytes_k
  4          from v$log
  5        order by 1;
  6     stmt     varchar2(2048);
  7     swtstmt  varchar2(1024) := 'alter system switch logfile';
  8     ckpstmt  varchar2(1024) := 'alter system checkpoint global';
  9  begin
 10     for rlcRec in rlc loop
 11    stmt := 'alter database add logfile thread ' ||
 12                 rlcRec.thr || ' size ' ||
 13                 rlcRec.bytes_k || 'K';
 14        execute immediate stmt;
 15        begin
 16           stmt := 'alter database drop logfile group ' || rlcRec.grp;
 17           execute immediate stmt;
 18        exception
 19           when others then
 20              execute immediate swtstmt;
 21              execute immediate ckpstmt;
 22              execute immediate stmt;
 23        end;
 24        execute immediate swtstmt;
 25     end loop;
 26  end;
 27  /

PL/SQL procedure successfully completed.

SQL>
SQL>

Agora, defina um tamanho adequado para a Área de recuperação rápida.
Utilize df -h para garantir que há um amplo espaço.

SQL> ALTER SYSTEM SET DB_RECOVERY_FILE_DEST_SIZE = 20G;

System altered.


Verifique a nova localização e tamanho.

SQL> show parameter DB_RECOVERY_FILE_DEST;

NAME                                 TYPE        VALUE
------------------------------------ ----------- ------------------------------
db_recovery_file_dest                string      /opt/fra
db_recovery_file_dest_size           big integer 20G
SQL>

Passo 6: Adicionar membros para grupos de  Redo Log.

Você deve ter pelo menos dois Grupos Redo e cada grupo deve ter pelo menos dois membros.Além disso, os membros devem ser distribuídos em discos (ou pelo menos diretórios)

Na instalação padrão apenas um membro é criado por grupo.

Você pode visualizar os arquivos de log redo usando

SQL> SELECT * FROM V $ LOGFILE;

Uma vez que o local padrão para os dois membros é da Área de Recuperação Flash, os dois membros existentes foram movidos para o nosso novo FRA.

Agora você deve adicionar mais um membro para cada grupo sob /u01/app/oracle/oradata/XE

SQL> ALTER DATABASE ADD LOGFILE MEMBER '/u01/app/oracle/oradata/XE/log1b.LOG' TO GROUP 1;

Database altered.

SQL> ALTER DATABASE ADD LOGFILE MEMBER '/u01/app/oracle/oradata/XE/log2b.LOG' TO GROUP 2;

Database altered.

SQL>


Passo 7: Definir os parâmetros sessões e processos

SQL> show parameters sessions;

NAME                                 TYPE        VALUE
------------------------------------ ----------- ------------------------------
java_max_sessionspace_size           integer     0
java_soft_sessionspace_limit         integer     0
license_max_sessions                 integer     0
license_sessions_warning             integer     0
sessions                             integer     172
shared_server_sessions               integer

SQL> show parameters processes;

NAME                                 TYPE        VALUE
------------------------------------ ----------- ------------------------------
aq_tm_processes                      integer     0
db_writer_processes                  integer     1
gcs_server_processes                 integer     0
global_txn_processes                 integer     1
job_queue_processes                  integer     4
log_archive_max_processes            integer     4
processes                            integer     100

Após cada alteração, será necessário reiniciar o banco de dados pois os parâmetros no são dinâmicos

Aumente as sessões e, em seguida efetuar shutdown no banco de dados.


SQL> alter system set sessions=250 scope=spfile;

System altered.

SQL> shutdown immediate
Database closed.
Database dismounted.
ORACLE instance shut down.
SQL> startup
ORACLE instance started.

Total System Global Area 1068937216 bytes
Fixed Size                  2233344 bytes
Variable Size             780143616 bytes
Database Buffers          281018368 bytes
Redo Buffers                5541888 bytes
Database mounted.
Database opened.

Verifique mudança de parâmetro de sessões:

SQL> show parameters sessions;

NAME                                 TYPE        VALUE
------------------------------------ ----------- ------------------------------
java_max_sessionspace_size           integer     0
java_soft_sessionspace_limit         integer     0
license_max_sessions                 integer     0
license_sessions_warning             integer     0
sessions                             integer     252
shared_server_sessions               integer


SQL>  show parameters processes;

NAME                                 TYPE        VALUE
------------------------------------ ----------- ------------------------------
aq_tm_processes                      integer     0
db_writer_processes                  integer     1
gcs_server_processes                 integer     0
global_txn_processes                 integer     1
job_queue_processes                  integer     4
log_archive_max_processes            integer     4
processes                            integer     200
SQL>

Passo 8: Ativar o modo ARCHIVELOG

Para habilitar backups on-line ou "quentes", o Modo Archivelog deve ser ativado.

Além disso, se você não permitir que o modo ARCHIVELOG e use apenas offline ou backups "frios", se você precisar restaurar o banco de dados só será capaz de restaurar o último backup

Para ativar o modo ARCHIVELOG, efetue o shutdown do banco de dados e, em seguida, startup mount:

SQL> shutdown immediate
Database closed.
Database dismounted.
ORACLE instance shut down.
SQL> startup mount
ORACLE instance started.

Total System Global Area 1068937216 bytes
Fixed Size                  2233344 bytes
Variable Size             763366400 bytes
Database Buffers          297795584 bytes
Redo Buffers                5541888 bytes
Database mounted.

SQL> alter database archivelog;

Database altered.

Abra o banco de dados e verifique se o Modo de Arquivamento foi habilitado.

SQL> alter database open;

Database altered.

SQL>

SQL> SELECT LOG_MODE FROM SYS.V$DATABASE;

LOG_MODE
------------
ARCHIVELOG

SQL>



Etapa 9: Criar Script de Backup Online 


Para criar backups automatizados, você pode modificar o backup.sh incluídos em
/u01/app/oracle/product/11.2.0/xe/config/scripts

[root@devoracle ~]# mkdir /opt/ora_backup

Alterar o proprietário para oracle e que o grupo dba

[root@devoracle ~]# chown oracle:dba /opt/ora_backup

Copie o script backup.sh de /u01/app/oracle/product/11.2.0/xe/config/scripts para o diretório criado acima.

[root@devoracle ~]# cp  /u01/app/oracle/product/11.2.0/xe/config/scripts/backup.sh /opt/ora_backup/backup.sh

Abra o script backup.sh em um editor de texto ou vi. A última seção será parecido com este:

else
   echo Backup of the database succeeded.
   echo Log file is at $rman_backup_current.
fi

#Wait for user to press any key
echo -n "Press ENTER key to exit"
read userinp  


Altere para :

else
   echo Backup of the database succeeded.
   echo Log file is at $rman_backup_current.
   mail -s 'Oracle Backup Completed' 'professorbdemerson@gmail.com' < /u01/app/oracle/oxe_backup_current.log
fi

#Wait for user to press any key
#echo -n "Press ENTER key to exit"
#read userinp  



A linha de nós adicionamos acima, -s mail 'a Oracle backup concluído' 'professorbdemerson@gmail.com' </u01/app/oracle/oxe_backup_current.log, vai enviar uma notificação por e-mail que o backup foi concluído, bem como um log dos enventos  cópia de segurança log para o corpo da mensagem.

Note que também comentei as duas últimas linhas do roteiro (o prompt).

Crie um job no cron para executar o script com o usuário oracle

Você deve executá-lo pelo menos uma vez por dia. Com o Modo Archivelog habilitado, é importante que os backups ser verificados regularmente para impedir a Flash Recovery Area de encher.

Etapa 10: Criar usuário para criação dos objetos

[root@devoracle ~]# sqlplus sys as sysdba

SQL*Plus: Release 11.2.0.2.0 Production on Qui Mar 5 14:39:43 2015

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

Informe a senha:

Conectado a:
Oracle Database 11g Express Edition Release 11.2.0.2.0 - 64bit Production


SQL> 

SQL> create user emerson identified by oracle;

Usuário criado.

SQL> grant connect,resource,dba to emerson;

Concessão bem-sucedida.

SQL> exit
Desconectado de Oracle Database 11g Express Edition Release 11.2.0.2.0 - 64bit Production
[root@localhost ~]# sqlplus emerson/oracle

SQL*Plus: Release 11.2.0.2.0 Production on Qui Mar 5 14:37:48 2015

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


Conectado a:
Oracle Database 11g Express Edition Release 11.2.0.2.0 - 64bit Production

SQL> select * from v$instance;

INSTANCE_NUMBER INSTANCE_NAME
--------------- ----------------
HOST_NAME
----------------------------------------------------------------
VERSION   STARTUP_ STATUS PAR    THREAD# ARCHIVE LOG_SWITCH_WAIT
----------------- -------- ------------ --- ---------- ------- ---------------
LOGINS   SHU DATABASE_STATUS INSTANCE_ROLE     ACTIVE_ST BLO EDITION
---------- --- ----------------- ------------------ --------- --- -------
      1 XE
localhost.localdomain
11.2.0.2.0   05/03/15 OPEN NO     1 STARTED
ALLOWED    NO  ACTIVE PRIMARY_INSTANCE   NORMAL    NO  XE



SQL> exit


Estar pronto nosso Oracle XE ambiente de desenvolvimento.



No próximos post irei demonstrar como efetuar backup do banco de dados, instalar ferramentas adicionais como por exemplo o  SQL Developer 4.0.3 e efetuar conexão com o Banco de Dados.

Até lá !!

Emerson Martins


Referencias:

http://docs.oracle.com/cd/E17781_01/install.112/e18802/toc.htm

terça-feira, 18 de novembro de 2014

ORA-09925: Unable to create audit trail file ao efetuar startup no Oracle 12c

     

        Hoje pela manhã um parceiro me contactou a respeito de uma mensagem "ORA - alguma coisa" ao efetuar startup no banco de dados. Lembrando que erros ORA não mensagens de bem vindo para o cliente.

Então mão na massa:

[oracle@oracle12c cdb1]$ sqlplus / as sysdba

SQL*Plus: Release 12.1.0.1.0 Production on Tue Nov 18 14:56:17 2014

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

ERROR:
ORA-09925: Unable to create audit trail file
Linux-x86_64 Error: 2: No such file or directory
Additional information: 9925
ORA-01075: you are currently logged on


Enter user-name:

Causa: As pastas foram excluidas para liberar espaço pois continham muitos arquivos dentro delas.




Como a mensagem já é clara " ORA-09925: Unable to create audit trail file" o oracle não consegue criar as pastas de auditoria do banco de dados.

Solução:

Recriar as pastas dentro do diretório ADMIN/cdb1

[oracle@oracle12c cdb1]$ mkdir -p adump dpdump pfile


[oracle@oracle12c cdb1]$ sqlplus / as sysdba

SQL> startup
ORACLE instance started.

Total System Global Area 3774713856 bytes
Fixed Size                  2688344 bytes
Variable Size             922749608 bytes
Database Buffers         2835349504 bytes
Redo Buffers               13926400 bytes
Database mounted.
Database opened.
SQL>


E pá.

Referencias:

https://docs.oracle.com/cd/E11882_01/appdev.112/e25788/d_audit_mgmt.htm#BABFHEFH




quarta-feira, 26 de março de 2014

Entendendo Joins e Set Operators

                 Há um bom tempo utilizei a imagem 1 para descomplicar a utilização de JOINS em sala de aula com meus alunos. Após um tempo atrás um colega da área Eduardo Legatti divulgou no seu facebook a mesma imagem colocando os SET OPERATORS  (Conjunto de Operadores). Ela é bem útil na hora de construir um SQL "correto" visando não ter problemas de performance futuramente.

Mas afinal o que são JOINS?

Imagine a seguinte situação: Durante a construção de um relatório utilizando consulta SQL é normal surgir a necessidade de extrair informações de diferentes tabelas para gerar o resultado. Esta operação, chamada junção , necessita que o desenvolvedor informe os critérios para realizar a junção destas fontes.  Seguem abaixo os tipos de JOINS existentes:
  •    Cross join
  •    Inner join
  •    Left outer join
  •    Right outer join
  •    Outer Full join

Com diz o ditado uma imagem fala mais que "mil palavras" então segue abaixo as imagens.


Imagem 1 - SQL JOINS

Imagem 2 - SQL JOINS AND SET OPERATORS

Até a próxima.

Fontes:
http://www.codeproject.com/Articles/33052/Visual-Representation-of-SQL-Joins
Sistemas de Banco de Dados - Elmasryi * Navathe
http://docs.oracle.com/javadb/10.8.3.0/ref/rrefsqlj29840.html

segunda-feira, 17 de março de 2014

Desabilitando a interface gráfica no Oracle Linux 5.8


Olá galera!

 Semana passada estava iniciando um instalação do Oracle RAC no Virtualbox, após a instalação das máquinas precisei desabilitar a interface gráfica no Oracle Linux para as máquinas consumirem menos recursos de memória. Lembrando que podia ter feito a instalação do SO já sem interface gráfica.

Segue os passos necessários:


1. Editar o arquivo inittab
vi /etc/inittab

2. Localizar uma linha semelhante a esta já na parte final do arquivo e comentar
# Run xdm in runlevel 5
x:5:respawn:/etc/X11/prefdm -nodaemon


3. Acrescentar a linha abaixo:
# Run xdm in runlevel 5
#x:5:respawn:/etc/X11/prefdm -nodaemon

id:3:initdefault

4. Salve o arquivo, e efetuar reboot no servidor.
5. Caso queira reabilitar a interface gráfica novamente basta se logar e entrar com o comando:


# startx





Referências:
Oracle Enterprise Linux Fundamentals Student Guide
http://blog.zloether.com/2009/07/disable-gui-in-centosrhel.html

quinta-feira, 6 de março de 2014

Deletando um Serviço no Windows.


Olá pessoal.

Neste post não irei falar diretamente de banco de dados mas como deletar um serviço Oracle no windows. Certo dia tentei fazer uma instalação do Oracle 11g R2 em um servidor que não tinha sido instalado corretamente pelo cliente, porém quando o instalador iniciava a instalação o mesmo enviava uma mensagem de erro e dizia que o serviço já existia.

O procedimento foi o seguinte:

1 - Abra o Windows OS prompt de DOS (Execute-o como Administrador se estiver usando o Windows Server 2008 OS)


2 - No prompt de comando digite o seguinte:

     sc delete OracleServiceDNAME

     O comando acima irá remover o restante dependente desse serviço a partir do sistema operacional e seu registro.

     sc delete OracleOraDb11g_home1TNSListenerListener1


     O comando acima irá remover o serviço do Listener

3 - Verifique e verifique se as entradas e ligação para o serviço do Oracle apagadas são removidas a partir do Painel de Controle -> Ferramentas Administrativas -> Serviços

Bom por hoje só pessoal!

terça-feira, 22 de outubro de 2013

Parâmetros de Performance do MySQL

Olá galera!

Essa semana discutindo com um colega desenvolvedor sobre aplicações Web, me foi questionado quais o parâmetros necessários para deixar uma aplicação Web mais rápida, tendo como base os parâmetros do Database MySQL para deixar o BD afiado para pesquisas, diversas, levando em consideração um SQL bem escrito, entre outras coisas que são importantes.Pesquisando alguns parâmetros de performance do MySQL para aplicações web, me deparei com essa tabela abaixo, que julgo muito importante  e decidi compartilha-la para conhecimento, caso se tenha sob sua administração o MySQL

O MySQL contém diversos parâmetros para melhorar a performance do servidor e bancos de dados para aplicações Web, Móvel, etc. A planilha contem muitos parâmetros específicos para os mecanismos de armazenamento(ENGINE) que você escolher (MyIsam, InnoDB,etc) que são identificados pelo uso de ferramentas como o MySQL Administrator, phpMysqladmin e MySQL Workbench.

Parametros
Variáveis
Descrição(inglês)
Current Connections
Maximum AllowedMax_connectionsCurrently open connections as a percentage of maximum allowed connections.
Open ConnectionsThreads_connected
Connection UsageThreads_connected/ Max_connections
Currently running threadsThreads_runningHigher value indicates that you may run out of connections soon and new clients may be refused connection.
Highest no. of Concurrent ConnectionsMax_used_connections
Percentage of maximum allowed reached(Max_used_connections/ Max_connections) *100
MyISAM Key Cache
Allocated MemoryKey_buffer_sizeIf not using MyISAM tables, set it to 8-64M so as to use for internal temporary disk tables.
Block SizeKey_cache_block_size
No. of BlocksKey_buffer_size/Key_cache_block_size
Used Blocks(Key_buffer_size/ Key_cache_block_size)- key_blocks_unused
Percent of Used Blocks1-(Key_blocks_unused/No. of Blocks)*100Key cache in use.
Blocks requested from CacheKey_read_requests
Blocks served from diskKey_reads
Cache Hit Rate1- (Key_reads/Key_read_requests)*100For optimum efficiency it should be more than 99%.
Blocks Written to CacheKey_write_requests
Blocks Written to DiskKey_writes
Cache Writes RatioKey_writes/Key_write_requestsIt is generally 1 in an OLTP.
Innodb Cache
Allocated MemoryInnodb_buffer_pool_sizeIt can be 70-80% of available server memory for innodb only installations.
Cache Hit Rate1- (innodb_buffer_pool_reads/innodb_buffer_pool_read-requests) *100
Cache Write Wait RequiredInnodb_buffer_pool_wait_free/ innodb_buffer_pool_write_requestsInnodb should not have to wait before writing pages, for optimal performance.
Additional Pool SizeInnodb_additional_mem_pool_sizeStores innodb data dictionary and other internal structures.
 Innodb Logs
Log Buffer SizeInnodb_log_buffer_size8-16 M recommended.
Log Waits RequiredInnodb_log_waits/ innodb_log_wites
No. of log filesInnodb_log_files_in_group
Size of each log fileInnodb_log_file_sizeSize of each log file in a log group.
Total size of all log filesInnodb_log_file_size * Innodb_log_files_in_groupYou should set the combined size of log files to about 25%-100% of your buffer pool size to avoid unneeded buffer pool flush activity on log file overwrite. However, note that a larger log file size will increase the time needed for the recovery process.
Total log file size as percentage to innodb buffer pool sizeTotal size of all log files/ innodb_buffer_pool_sizeIncrease the size of innodb log files to improve performance.
Log flush intervalInnodb_flush_log_at_trx_commitIf set to 1, InnoDB will flush (fsync) the transaction logs to the disk at each commit, which offers full ACID behavior. If you are willing to compromise this safety, and you are running small transactions, you may set this to 0 or 2 to reduce disk I/O to the logs. Value 0 means that the log is only written to the log file and the log file flushed to disk approximately once per second. Value 2 means the log is written to the log file at each commit, but the log file is only flushed to disk approximately once per second.
Innodb
Data PagesInnodb_buffer_pool_pages_dataThe number of pages containing data (dirty or clean).
Dirty PagesInnodb_buffer_pool_pages_dirtyThe number of pages currently dirty.
Pages FlushedInnodb_buffer_pool_pages_flushedThe number of buffer pool pages that have been requested to be flushed.
Pages FreeInnodb_buffer_pool_pages_freeThe number of free pages.
Innodb_buffer_pool_pages_latchedThe number of latched pages in InnoDB buffer pool. These are pages currently being read or written or that can’t be flushed or removed for some other reason.
Innodb_buffer_pool_pages_miscThe number of pages busy because they have been allocated for administrative overhead such as row locks or the adaptive hash index. It can also be calculated as Innodb_buffer_pool_pages_total – Innodb_buffer_pool_pages_free – Innodb_buffer_pool_pages_data.
Buffer Pool PagesInnodb_buffer_pool_pages_totalTotal size of buffer pool, in pages.
Innodb_buffer_pool_read_ahead_rndThe number of “random” read-aheads InnoDB initiated. This happens when a query is to scan a large portion of a table but in random order.
Innodb_buffer_pool_read_ahead_seqThe number of sequential read-aheads InnoDB initiated. This happens when InnoDB does a sequential full table scan.
Innodb_buffer_pool_read_requestsThe number of logical read requests InnoDB has done.
Innodb_buffer_pool_readsThe number of logical reads that InnoDB could not satisfy from buffer pool and had to do a single-page read.
Innodb_buffer_pool_wait_freeNormally, writes to the InnoDB buffer pool happen in the background. However, if it’s necessary to read or create a page and no clean pages are available, it’s necessary to wait for pages to be flushed first. This counter counts instances of these waits. If the buffer pool size was set properly, this value should be small.
Innodb_buffer_pool_write_requestsThe number writes done to the InnoDB buffer pool.
Innodb_data_fsyncsThe number of fsync() operations so far.
Innodb_data_pending_fsyncsThe current number of pending fsync() operations.
Innodb_data_pending_readsThe current number of pending reads.
Innodb_data_pending_writesThe current number of pending writes.
Innodb_data_readThe amount of data read so far, in bytes.
Innodb_data_readsThe total number of data reads.
Innodb_data_writesThe total number of data writes.
Innodb_data_writtenThe amount of data written so far, in bytes.
Innodb_log_waitsThe number of waits we had because log buffer was too small and we had to wait for it to be flushed before continuing.
Innodb_log_write_requestsThe number of log writes requests.
Innodb_log_writesThe number of physical writes to the log file.
Innodb_os_log_fsyncsThe number of fsyncs writes done to the log file.
Innodb_os_log_pending_fsyncsThe number of pending log file fsyncs.
Innodb_os_log_pending_writesPending log file writes.
Innodb_os_log_writtenThe number of bytes written to the log file.
Innodb_page_sizeThe compiled-in InnoDB page size (default 16KB). Many values are counted in pages; the page size allows them to be easily converted to bytes.
Innodb_pages_createdThe number of pages created.
Innodb_pages_readThe number of pages read.
Innodb_pages_writtenThe number of pages written.
Innodb_row_lock_current_waitsThe number of row locks currently being waited for.
Innodb_row_lock_timeThe total time spent in acquiring row locks, in milliseconds.
Innodb_row_lock_time_avgThe average time to acquire a row lock, in milliseconds.
Innodb_row_lock_time_maxThe maximum time to acquire a row lock, in milliseconds.
Innodb_row_lock_waitsThe number of times a row lock had to be waited for.
Innodb_rows_deletedThe number of rows deleted from InnoDB tables.
Innodb_rows_insertedThe number of rows inserted in InnoDB tables.
Innodb_rows_readThe number of rows read from InnoDB tables.
Innodb_rows_updatedThe number of rows updated in InnoDB tables.
 Thread Cache
Number of threads that can be cachedThread_cache_size
Number of threads in the cacheThreads_cached
Threads created to handle connectionsThreads_created
Thread cache hit rate(Threads_created/ Threads_connected) * 100
Table Cache
No. of tables that can be cachedTable_cacheThe number of open tables for all threads. Increasing this value increases the number of file descriptors that mysqld requires.
Tables currently openOpen-tables
No. of table cache missesOpened_tablesIf the number increases rapidly, consider increasing the table_cache.
Query Cache
Query cache enabledHave_query_cache
Query Cache TypeQuery_cache_type‘Off’: query has been disabled; ‘Always’: all statements are cached except those beginning with SELECT SQL_NO_CACHE; ‘Demand’: Caching is done only for those beginning with SELECT SQL_CACHE.
Cache SizeQuery_cache_size
Max size of cached queryQuery_cache_limitThe maximum size of individual query results that can be cached.
Free MemoryQcache_free_memoryThe amount of free memory in the query cache.
Query parsing and execution bufferQuery_prealloc_sizeBetter performance by increasing this value, if you execute a lot of complex queries.
Block SizeQuery_cache_min_res_unitFor queries with large resultset, larger block size means better performance; but for queries with small resultset, a large block size leads to memory fragmentation.
Total BlocksQcache_total_blocksTotal number of blocks in the cache
Free BlocksQcache_free_blocksTotal number of free blocks in the cache
FragmentationQcache_free_blocks *100/ Qcache_total_blocksExtent of fragmentation in the query cache.
Queries in cacheQcache_queries_in_cache
Queries not cachedQcache_not_cachedQueries that cannot be cached, since it contains UDFs, user variables or it accesses system database.
Queries inserted to cacheQcache_inserts
Cache HitsQcache_hitsNumber of queries that served successfully by the query cache.
Queries pruned from cacheQcache_lowmem_prunesQueries that were inserted into the query cache, but subsequently got pruned, because of low memory.
Pruned as percentage of insertsQcache_lowmem_prunes* 100/  Qcache_insertsIf this rate is high, consider increasing Query_cache_size system variable.
Cache Hit RateQcache_hits * 100 / (Qcache_hits + Qcache_inserts)A high rate indicates that queries in cache are being reused by other threads; a low rate shows either not enough memory allocated to query cache or identical queries are not repeatedly issued to the server.
Sort Buffers
Buffer for in-memory sortingSort_buffer_sizeIt is allocated per client, so don’t make it too large; recommended 1 M.
Temporary files created because of insufficient Sort_buffer_sizeSort_merge_passesIf this value is high, increase the value of Sort_buffer_size.
Buffer for fast rebuilds of MyISAM indexesMyisam_sort_buffer_sizeIt is allocated per client.
Buffer for reading rows in sorted order after a sort operationRead_rnd_buffer_sizeIt is allocated per client.
Table Locks
Acquired immediatelyTable_locks_immediateNumber of times table locks are acquired immediately.
Wait was neededTable_locks_waitedNumber of times a wait was required before getting a table lock. If this is high, and you have performance problems, you should first optimize your queries, and then either split your table or tables.
Lock contentionTable_locks_waited * 100 / (Table_locks_waited + Table_locks_immediate)
Full Table Scans
Number of requests to read a row based on a fixed positionhandler_read_rndThis value is high if you are doing a lot of queries that require sorting of the result. You probably have a lot of queries that require MySQL to scan entire tables or you have joins that don’t use keys properly.
Number of requests to read the next row in the data file.handler_read_rnd_nextThis value is high if you are doing a lot of table scans. Generally this suggests that your tables are not properly indexed or that your queries are not written to take advantage of the indexes you have.
Number of times the first entry was read from an indexhandler_read_firstIf this value is high, it suggests that the server is doing a lot of full index scans.
Number of requests to read the next row in key order.handler_read_nextThis value is incremented if you are querying an index column with a range constraint or if you are doing an index scan.
Number of requests to read a row based on a key.handler_read_keyIf this value is high, it is a good indication that your tables are properly indexed for your queries.
Number of requests to read the previous row in key order.handler_read_prevThis read method is mainly used to optimize ORDER BY … DESC.
Percentage of full table scans1-(handler_read_rnd_next + handler_read_rnd) / (handler_read_rnd_next + handler_read_rnd + handler_read_first + handler_read_next + handler_read_key + handler_read_prev )Ratio of the number of rows read via full table scans to the sum of all handler variables (which denotes all row accesses). A high value indicates excessive table scans. You should examine tables and queries for proper use of indexes. Turn on the slow query log, identify the queries using full table scan and tune it.
Buffer for full table scans of MyISAM tablesRead_buffer_sizeThis value is per client.
SELECTs requiring full table scanSelect_scanA high value indicates that the queries are not tuned to use indexes.
Buffer for JOINs requiring full table scanJoin_buffer_sizeThis value is per client.
Joins requiring full scan of second and subsequent tablesSelect_full_joinIf the value is high, optimize the queries to use indexes.
Temporary Tables
Maximum table sizeTmp_table_sizeThe maximum size of an internal table that can be created in memory. If an internal table is larger than this size, it is converted into a MyISAM table on disk.
Maximum size of a memory tableMax_heap_table_sizeMySQL uses the lowest value of tmp_table_size and max_heap_table_size.
Total tables createdCreated_tmp_tablesNumber of temporary tables created in memory.
Temporary tables created on diskCreated_tmp_disk_tablesIf this value is high, try increasing the values of Tmp_table_size and Max_heap_table_size.
Slow Launch Threads
Minimum launch time for a thread to be considered slowSlow_launch_time
Number of slow launch threadsSlow_launch_threadsGeneral system overload; may be caused by non-optimal queries.
Network Traffic
Bytes Received from all clientsBytes_received
Bytes Sent to all clientsByets_sent
Binary Log
Binary log enabled?Log_bin
Synchronized to disk at each write?Sync_binlogSynchronizing is the safest choice since in the event of a crash you lose at most the last transaction.
Binary log cache sizeBinlog_cache_sizeIt stores all SQL statements for the binary log during a transaction; used only with transactional engines.
Transactions that used cacheBinlog_cache_useTransactions that used the binary log cache.
Transactions that  got saved in temporary fileBinlog_cache_disk_useNumber of transactions that used a temporary file because of insufficient Binlog_cache_size.
Percentage of transactions that  got saved in temporary fileBinlog_cache_disk_use * 100 / Binlog_cache_use
Slow Query Log
Enabled?Log_slow_queriesIdentifies queries running slow.
Min. execution time for a query to be considered slowLong_query_time
No. of slow queriesSlow_queriesNumber of queries that took more than long_query_time to execute.
Statements
All StatementsQuestionsTotal number of statements sent to the server by all clients.
SELECTsCom_select + Qcache_hits
INSERTsCom_insert + Com_replace
UPDATEsCom_update
DELETEsCom_delete
Percentage of total Data Manipulation Statements
System
CPU Usage
Total Memory
Memory Used by MySQL
Memory Free
Memory Requirement by MySQL if max users are connectedInnodb_buffer_pool_size + Key_buffer_size + Max_connections * (sort_buffer_size + read_buffer_size + binlog_cache_size) + max_connections * 2MB

Como já viram são muitos parâmetros, próximo post trarei alguns exemplos de utilizaçao dos mesmo.


Emerson Martins

Referencias:
http://dev.mysql.com/doc/refman/5.0/en/server-parameters.html
http://www.debianhelp.co.uk/mysqlperformance.htm
http://www.slideshare.net/osscube/mysql-performance-tuning-top-10-tips
Book High-Performance-MySQL-Optimization-Replication