Search This Blog

Total Pageviews

Sunday, 22 May 2011

Oracle granule




SGA memory is allocated in unit of contiguous memory chunks called granule. The SGA memory components(shared pool,buffer cache, redo log buffer,java pool,streams pool,large pool) are sized as multiples of granules.

The granule size is determined based on the amount of memory requested at the instance startup. It is based on the SGA_MAX_SIZE. If MEMORY_MAX_TARGET is specified, then SGA_MAX_SIZE defaults to MEMORY_MAX_TARGET for the purpose of sizing the granule. Once set, the granule size does not change for the life of the instance.
However granule maximum size = 16MB on 32-bit platforms.
SQL> show parameter memory_max_target

NAME TYPE VALUE
------------------------------------ ----------- ------------------------------
memory_max_target big integer 800M

SQL> select bytes/1024/1024 bytes_Mb from v$sgainfo where name like 'Granule Size';

BYTES_MB
----------
4
RDBMS
SGA_MAX_SIZE (or memory_max_target)
GRANULE SIZE
9.2
<= 128MB
4MB

> 128MB
16MB
10.2
<= 1GB
4MB

> 1GB
16MB
11gR1
<= 1GB
4MB

1Gb - 4GB
16MB

4Gb - 16GB
64MB

16Gb - 64GB
256MB

> 64GB
512MB
11gR2 (and 11gR1 with patch 8813366 applied *)
< 1Gb
4Mb

1Gb - 8Gb
16Mb

8Gb - 16Gb
32Mb

16Gb - 32Gb
64Mb

32Gb - 64Gb
128Mb

64Gb - 128Gb
256Mb

> 128Gb
512Mb

How to test from above table. If I need granule size 16Mb, I have to Memory 1Gb - 4GB for SGA???
SQL> select * from v$version;

BANNER
--------------------------------------------------------------------------------
Oracle Database 11g Enterprise Edition Release 11.1.0.6.0 - Production
PL/SQL Release 11.1.0.6.0 - Production
CORE 11.1.0.6.0 Production
TNS for Linux: Version 11.1.0.6.0 - Production
NLSRTL Version 11.1.0.6.0 - Production

SQL> !free -m
total used free shared buffers cached
Mem: 888 849 38 0 2 740
I have only 900Mb for Physical Memory. Find Idea to test then created /tmp/pfile file for modified MEMORY_MAX_TARGET parameter.
SQL> create pfile='/tmp/pfile' from spfile;

File created.

SQL> shutdown immediate;
Database closed.
Database dismounted.
ORACLE instance shut down.
then faked /dev/shm size (this's just test for granule size to fake memory_max_target parameter)
Filesystem Size Used Avail Use% Mounted on
tmpfs 4.0G 0 4.0G 0% /dev/shm
then modified /tmp/pfile (MEMORY_MAX_TARGET=4G) - If MEMORY_MAX_TARGET is specified, then SGA_MAX_SIZE defaults to MEMORY_MAX_TARGET.
SQL> startup pfile='/tmp/pfile';
ORACLE instance started.

Total System Global Area 2058981376 bytes
Fixed Size 1300968 bytes
Variable Size 1644168728 bytes
Database Buffers 402653184 bytes
Redo Buffers 10858496 bytes
Database mounted.
Database opened.

SQL> show parameter memory_max_target

NAME TYPE VALUE
------------------------------------ ----------- ------------------------------
memory_max_target big integer 4G

SQL> select bytes/1024/1024 bytes_Mb from v$sgainfo where name like 'Granule Size';

BYTES_MB
----------
16
Used granule size 16M.
If we set a value in the spfile that is not a multiple of the granule size, the actual size allocated will be rounded up to the nearest granule.
SQL> select bytes/1024/1024 bytes_Mb from v$sgainfo where name like 'Granule Size';

BYTES_MB
----------
4

SQL> alter system set java_pool_size=4M;

System altered.

SQL> show parameter java_pool_size

NAME TYPE VALUE
------------------------------------ ----------- ------------------------------
java_pool_size big integer 4M

SQL> alter system set MEMORY_MAX_TARGET=4G scope=spfile;

System altered.

SQL> shutdown

SQL> startup

SQL> select bytes/1024/1024 bytes_Mb from v$sgainfo where name like 'Granule Size';

BYTES_MB
----------
16

SQL> show parameter java_pool_size

NAME TYPE VALUE
------------------------------------ ----------- ------------------------------
java_pool_size big integer 16M
The java_pool_size 4M in the spfile, after increased granule size, then the actual allocation for the java_pool_size will be rounded up to 16M.


Oracle 11g Grid Control rpm required on Red Hat 5 / centos 5 / oracle Linux 5 64bit

Oracle 11g Grid Control rpm required for Red Hat 5 / centos 5 / oracle Linux 5 64bit
Red Hat Enterprise Linux (RHEL) 5x86_64 platform.
oracle 11g 64bit rpm


■■ binutils-2.17.50.0.6 (x86_64)
■■ compat-libstdc++-33-3.2.3 (x86_64)
■■ compat-libstdc++-33-3.2.3 (i386)
■■ elfutils-libelf-0.125 (x86_64)
■■ elfutils-libelf-devel-0.125 (x86_64)
■■ gcc-4.1.2 (x86_64)
■■ gcc-c++-4.1.2 (x86_64)
■■ glibc-2.5-24 (x86_64)
■■ glibc-2.5-24 (i386)
■■ glibc-common-2.5 (x86_64)
■■ glibc-devel-2.5 (x86_64)
■■ glibc-devel-2.5 (i386)
■■ glibc-headers-2.5 (x86_64)
■■ ksh-20060214 (x86_64)
■■ libaio-0.3.106 (x86_64)
■■ libaio-0.3.106 (i386)
■■ libaio-devel-0.3.106 (x86_64)
■■ libaio-devel-0.3.106 (i386)
■■ libgcc-4.1.2 (x86_64)
■■ libgcc-4.1.2 (i386)
■■ libstdc++-4.1.2 (x86_64)
■■ libstdc++-4.1.2 (i386)
■■ libstdc++-devel 4.1.2 (x86_64)
■■ make-3.81 (x86_64)
■■ numactl-devel-0.9.8.x86_64 (x86_64)
■■ sysstat-7.0.2 (x86_64)
■■ unixODBC-2.2.11 (x86_64)
■■ unixODBC-2.2.11 (i386)
■■ unixODBC-devel-2.2.11 (x86_64)
■■ unixODBC-devel-2.2.11 (i386)

Saturday, 21 May 2011

Oracle 11g process

ora_pmon_ : The Process Monitor is responsible for monitoring processes. In this case pmon will perform recovery for user processes that fail, will rollback uncommitted transactions, and clean up the buffer cache and free the resources being consumed.

ora_smon_ : The System Monitor process is responsible for instance recovery –cleaning up temporary segments that are not required and coalescing contiguous free extents in dictionary managed tablespaces.

ora_dbw0_ : The Database Writer process(s) handle the writing of dirty/modified buffers in the database buffer cache to datafiles.Depending on the activity of the database, there may be multiple database writers to keep up with the changes occurring.


ora_lgwr_ : The Log Writer process is responsible for writing data from the redo log buffers to the redo log files on disk.

ora_ckpt_ : The Checkpoint Process is responsible for signaling the synchronization of all database files with checkpoint information ensuring data consistency and faster database recovery in case of a crash.

ora_vktm_ : The Virtual Keeper of Time process is responsible for keeping track of the wall-clock time and used as a reference-time counter.

ora_diag_ : The Diagnosability Process handles hang detection and deadlock resolution.

ora_dbrm_ : The Database Resource Manager process takes care of setting up resource manager related tasks and resource plans.

ora_psp0_ : The Process Spawner will spawn Oracle processes as needed.


ora_vktm_ : The Virtual Keeper of Time process is responsible for keeping track of the wall-clock time and used as a reference-time counter.

ora_dbrm_ : The Database Resource Manager process takes care of setting up resource manager related tasks and resource plans.


ora_mman_ : The mman process is used for internal database tasks.


ora_reco_ : The Recoverer process is responsible for recovering all in-doubt transactions in a distributed database setup – connecting to remote databases and resolving pending transactions.

ora_mmon_ : The mmon process will perform manageability-related background tasks such as issuing alerts, taking snapshots, and capturing statistics values for SQL objects.

ora_mmnl_ : The mmnl process will perform other but light-weight manageability-related tasks such as capturing session history and metrics computation.

ora_d000_ : The Dispatcher processes will listen to and receive requests from connected sessions – placing them in the request queue on
the next available server for further processing. Dispatcher processes will also pick up outgoing responses from a results
queue and transmit those results back to the clients.

ora_s000_ : The Shared Server process will pick up requests from a call request queue, make the calls to the database to resolve the request, and then return the results to a result queue.

ora_smco_ : The Space Management Coordinator process handles the coordination and execution of space management tasks – spawning wnnn processes to carry out the task.

ora_fbda_ : The Flashback Data Archiver process archives historical data for tracked tables into the flashback data archives – storing a pre-image of the rows into the flashback archive and keeping the metadata for those rows.

ora_cjq0_ : The Job Queue process is used for batch processing – running user jobs within a scheduler service. Able to run a large number of concurrent jobs, the coordinator process (cjq0) will spawn job queue slaves (jnnn) to actually run the jobs.

===
SET LINESIZE 500
col sid format 999999
col username format a20
col osuser format a15
col name for a20
col ERROR for 999999999999999
col TRACEFILE for a80
SELECT b.spid,a.sid, a.serial#,a.username, a.osuser,BACKGROUND,name ,bg.DESCRIPTION,ERROR,a.sql_id,TRACEFILE
FROM v$session a, v$process b,V$BGPROCESS BG
WHERE a.paddr= b.addr
and BACKGROUND=1
and bg.paddr= b.addr
ORDER BY b.spid;



Oracle trace file compress

# Gzips Oracle Archive logs that are older than 5 days
#

cd /opt/oracle/admin/cccdb/arch
/usr/bin/find . -name '*.arc' -mtime +5 -exec /usr/bin/gzip -9 {} \;

Oracle Shell script for wait capture

#!/bin/bash

ORACLE_HOME=/opt/oracle/product/10.2; export ORACLE_HOME
ORACLE_SID=cccdb; export ORACLE_SID

# export PATH=$ORACLE_HOME/bin:.:$PATH

sqlplus -s /nolog <connect / as sysdba

set serveroutput on
set pagesize 100 lines 130
set feed on heading off
spool orapinx.alert

-- execute immediate dbms_output.put_line('see oracle dump');

declare

x number(7);

begin

select sysdate from dual;
select count(*) into x from v\$session_wait where event like '\%wait on X\%';

-- dbms_output.put_line('see oracle dump');

if x>0 then

execute immediate 'ALTER SESSION SET max_dump_file_size = UNLIMITED' ;
execute immediate 'ALTER SESSION SET EVENTS ''10998 trace name context forever,level 1''';
execute immediate 'ALTER SYSTEM SET EVENTS ''immediate trace name systemstate level 10''';
execute immediate 'ALTER SYSTEM SET EVENTS ''immediate trace name systemstate level 10''';
execute immediate 'ALTER SYSTEM SET EVENTS ''immediate trace name systemstate level 10''';

dbms_output.put_line('see oracle dump');
else
null;
end if;
end;

spool off
exit
EOF

# /opt/oracle/admin/cccdb/scripts

touch /opt/oracle/admin/cccdb/orapinx1.tmp

if [ `cat orapinx.alert|wc -l` -gt 0 ]

then
# echo "test"
cat /opt/oracle/admin/cccdb/scripts/orapinx.alert > /opt/oracle/admin/cccdb/scripts/orapinx.tmp

# to remove blank space
# cat tablespace.tmp | awk '$0!~/^$/ {print $0}' > xyz.tmp
# ^L= ctrl+L <<<<<<<<<--------


cat /opt/oracle/admin/cccdb/scripts/orapinx.tmp | sed 's/^L//g' > /opt/oracle/admin/cccdb/scripts/orapinx1.tmp

mv /opt/oracle/admin/cccdb/orapinx1.tmp /opt/oracle/admin/cccdb/orapinx.tmp



# mailx -s " Ora-error wait PIN X for APTUS (Novagenesis) Database" -r oracle@joshua anuj.singh@XXXX.co.uk < orapinx.tmp

fi

Thursday, 19 May 2011

ORA-00600: internal error code, arguments: [kzsviver:1], [], [], [], [], [],

in Oracle 11g

ORA-00600: internal error code, arguments: [kzsviver:1], [], [], [], [], [],

alter user xyz identified by values is null in pl sql block <<<<<<<<

example .....

my_text :=
'Alter user '
|| pwd.username
|| ' identified by values '
|| ''''
|| l_old_password
|| '''';
-- dbms_output.put_line(my_text);
EXECUTE IMMEDIATE (my_text);

Validate corruption via RMAN 11g

oracle@apt-amd-02:~> rman

Recovery Manager: Release 11.2.0.1.0 - Production on Thu May 19 09:31:35 2011

Copyright (c) 1982, 2009, Oracle and/or its affiliates. All rights reserved.

RMAN> connect target /

connected to target database: ORCL (DBID=1267852645)

RMAN> validate database check logical;

Starting validate at 19-MAY-11
using target database control file instead of recovery catalog
allocated channel: ORA_DISK_1
channel ORA_DISK_1: SID=58 device type=DISK
channel ORA_DISK_1: starting validation of datafile
channel ORA_DISK_1: specifying datafile(s) for validation
input datafile file number=00002 name=/opt/app/oracle/oradata/orcl/sysaux01.dbf
input datafile file number=00001 name=/opt/app/oracle/oradata/orcl/system01.dbf
input datafile file number=00003 name=/opt/app/oracle/oradata/orcl/undotbs01.dbf
input datafile file number=00004 name=/opt/app/oracle/oradata/orcl/users01.dbf
input datafile file number=00005 name=/opt/app/oracle/oradata/orcl/example01.dbf
input datafile file number=00008 name=/opt/app/oracle/oradata/orcl/tsapexu01.dbf
input datafile file number=00007 name=/opt/app/oracle/oradata/orcl/tsapexf01.dbf
input datafile file number=00006 name=/opt/app/oracle/oradata/orcl/anujtest.dbf
channel ORA_DISK_1: validation complete, elapsed time: 00:02:06
List of Datafiles
=================
File Status Marked Corrupt Empty Blocks Blocks Examined High SCN
---- ------ -------------- ------------ --------------- ----------
1 OK 0 14032 101125 9202958
File Name: /opt/app/oracle/oradata/orcl/system01.dbf
Block Type Blocks Failing Blocks Processed
---------- -------------- ----------------
Data 0 69631
Index 0 13990
Other 0 3467

File Status Marked Corrupt Empty Blocks Blocks Examined High SCN
---- ------ -------------- ------------ --------------- ----------
2 OK 0 22319 106254 9202956
File Name: /opt/app/oracle/oradata/orcl/sysaux01.dbf
Block Type Blocks Failing Blocks Processed
---------- -------------- ----------------
Data 0 27420
Index 0 25986
Other 0 30515

File Status Marked Corrupt Empty Blocks Blocks Examined High SCN
---- ------ -------------- ------------ --------------- ----------
3 OK 0 1 28800 9202958
File Name: /opt/app/oracle/oradata/orcl/undotbs01.dbf
Block Type Blocks Failing Blocks Processed
---------- -------------- ----------------
Data 0 0
Index 0 0
Other 0 28799

File Status Marked Corrupt Empty Blocks Blocks Examined High SCN
---- ------ -------------- ------------ --------------- ----------
4 OK 0 1710 27200 9178356
File Name: /opt/app/oracle/oradata/orcl/users01.dbf
Block Type Blocks Failing Blocks Processed
---------- -------------- ----------------
Data 0 23370
Index 0 1357
Other 0 763

File Status Marked Corrupt Empty Blocks Blocks Examined High SCN
---- ------ -------------- ------------ --------------- ----------
5 OK 0 1689 12804 9089116
File Name: /opt/app/oracle/oradata/orcl/example01.dbf
Block Type Blocks Failing Blocks Processed
---------- -------------- ----------------
Data 0 6607
Index 0 1261
Other 0 3243

File Status Marked Corrupt Empty Blocks Blocks Examined High SCN
---- ------ -------------- ------------ --------------- ----------
6 OK 0 328 1280 7522828
File Name: /opt/app/oracle/oradata/orcl/anujtest.dbf
Block Type Blocks Failing Blocks Processed
---------- -------------- ----------------
Data 0 803
Index 0 0
Other 0 149

File Status Marked Corrupt Empty Blocks Blocks Examined High SCN
---- ------ -------------- ------------ --------------- ----------
7 OK 0 6273 6400 8527760
File Name: /opt/app/oracle/oradata/orcl/tsapexf01.dbf
Block Type Blocks Failing Blocks Processed
---------- -------------- ----------------
Data 0 0
Index 0 0
Other 0 127

File Status Marked Corrupt Empty Blocks Blocks Examined High SCN
---- ------ -------------- ------------ --------------- ----------
8 OK 0 2648 12800 8826300
File Name: /opt/app/oracle/oradata/orcl/tsapexu01.dbf
Block Type Blocks Failing Blocks Processed
---------- -------------- ----------------
Data 0 4606
Index 0 2615
Other 0 2931

channel ORA_DISK_1: starting validation of datafile
channel ORA_DISK_1: specifying datafile(s) for validation
including current control file for validation
including current SPFILE in backup set
channel ORA_DISK_1: validation complete, elapsed time: 00:00:02
List of Control File and SPFILE
===============================
File Type Status Blocks Failing Blocks Examined
------------ ------ -------------- ---------------
SPFILE OK 0 2
Control File OK 0 600
Finished validate at 19-MAY-11

RMAN>


Recovery Manager complete.
oracle@apt-amd-02:~> !sql
sqlplus / as sysdba

SQL*Plus: Release 11.2.0.1.0 Production on Thu May 19 09:38:41 2011

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


Connected to:
Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - 64bit Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options

SQL> SELECT * FROM v$database_block_corruption;

no rows selected

Oracle DBA

anuj blog Archive