Keep Sequences in Shared Pool for RAC Environment
Hi,
We have 2 node RAC setup for production environment. I want to pin cached sequences in my database. We are using following command for this purpose.
EXEC DBMS_SHARED_POOL.KEEP('HR.MySeq','Q');
Do I need to execute this command for each single node?
Pinning is in the Shared Pool in the SGA. So it is local to an instance.
Therefore, you would need to execute it in each instance (i.e. on each node).
Note : However, with sequences in RAC, you have to be careful with the definition. Have you defined it or do you need to define it as CACHE/NOCACHE ? Have you defined it or do you need to define it as ORDER (to guarantee order generation in RAC) ?
Hemant K Chitale
Similar Messages
-
How to pin sequences in the shared pool for RAC?
We have a RAC environment with two instances. I want to pin some sequences in the shared pool to boost the performance. Do I need to pin them in both of the instances or just pin them in one instance?
Thanks in advanceIf you cannot tolerate gaps, you must not use sequences. Period. A sequence-generated key will have gaps because transactions roll back, because databases get shut down, etc. If you want to ensure that there are no gaps, you have to write code that serializes access to a resource (i.e. a custom table of sequences) over the full length of a transaction. Of course, this is hugely inefficient and kills the application's scalability, but it does prevent gaps. Sequences are much faster and much more scalable, but they do not and can not guarantee that there are no gaps.
Assuming the intention is to minimize gaps, rather than to eliminate them, NOCACHE & ORDER can help. That means, though, that you may need to communicate with the other nodes in the cluster every time you need a new value from the sequence, which is the slow part. Pinning the sequence is not going to be beneficial.
Justin -
Hi,
I plan to use shared disks to create Oracle RAC using ASM. What options do I have? OCFS2? or any other option?
Can some one lead me to a documnet on how can I use the shared disks for RAC?
Thanks.javed555 wrote:
I plan to use shared disks to create Oracle RAC using ASM. What options do I have? You have two options:
1. Create shared virtual, i.e. file-backed disks. These files will be stored in /OVS/sharedDisk/ and made available to each guest
2. Expose physical devices directly to each guest, e.g. an LVM partition or a multipath LUN.
With both options, the disks show up as devices in the guests and you would then provision them with ASM, exactly the same way as if your RAC nodes were physical.
OCFS2 or NFS are required to create shared storage for Oracle VM Servers. This is to ensure the /OVS mount point is shared between multiple Oracle VM Servers. -
Doubts about shared disk for RAC
Hi All,
I am really new to RAC.Even after reading various documents,I still have many doubts regarding shared storage and file systems needed for RAC.
1.Clusterware has to be installed on a shared file system like OCFS2.Which type of hard drive is required to install OCFS2 so that it can be accessed from all nodes??
It has to be an external hard drive???Or we can use any simple hard disk for shared storage??
If we use external hard drive then does it need to be connected to a seperate server alltogether or can it be connected to any one of the nodes in the cluster???
Apart from this shared drives,approximately what size of hard disk is required for all nodes(for just a testing environment).
Sincerely appreciate a reply!!
Thanks in advance.Clusterware has to be installed on shared storage. RAC also requires shared storage for the database.
Shared storage can be managed via many methods.
1. Some sites using Linux or UNIX-based OSes choose to use RAW disk devices. This method is not frequently used due to the unpleasant management overhead and long-term manageability for RAW devices.
2. Many sites use cluster filesystems. On Linux and Windows, Oracle offers OCFS2 as one (free) cluster filesystem. Other vendors also offer add-on products for some OSes that provide supported cluster filesystems (like GFS, GPFS, VxFS, and others). Supported cluster filesystems may be used for Clusterware files (OCR and voting disks) as well as database files. Check Metalink for a list of supported cluster filesystems.
3. ASM can be used to manage shared storage used for database files. Unfortunately, due to architecture decisions made by Oracle, ASM cannot currently be used for Clusterware files (OCR and voting disks). It is relatively common to see ASM used for DB files and either RAW or a cluster filesystem used for Clusterware files. In other words, ASM and cluster filesystems and RAW are not mutually exclusive.
As for hardware--I have not seen any hardware capable of easily connecting multiple servers to internal storage. So, shared storage is always (in my experience) housed externally. You can find some articles on OTN and other sites (search Google for them) that use firewire drives or a third computer running openfiler to provide the shared storage in test environments. In production environments, SAN devices are commonly employed to provide concurrent access to storage from multiple servers.
Hope this helps!
Message was edited by:
Dan_Norris -
Manually Setting up a Standby Database for RAC Environment
Hi,
I am a Junior DBA so apologies if this sounds like a silly question.
We have production 11g Extended RAC environment setup. Management have asked for a separate single instance database be setup as a standby DB on a separate 'cold' server in case we lose complete connection to both sides of the RAC. I read up on Oracle Data Guard and presented this as a solution, but they seem adamant about manually going in and copying out the latest backup and archive logs over to the standby database.
Can this be done? I mean, can ASM managed backup files and archive logs from one database be simply copied out of the backup directory and imported into a completely separate database as easy as that?
We are using ASM to manage to data files on the RAC. My understanding is that we cant manually access the files on an OS level when using ASM, but maybe I am wrong. Any help or opinions on this would be greatly appreciated.
Rgs,
RobHi,
Can this be done? I mean, can ASM managed backup files and archive logs from one database be simply copied out of the backup directory and imported into a completely separate >database as easy as that?Yes, but depends on DB version.
what is the DB version.
from 11g you have cp command so there is a possibility to copy generated archive logs to standby location, so that you can apply..
In 10g there is no such option. you need to create a standby database. with automatic shipping
Thanks -
Is a gateway mandatory for RAC environment?
Question:
Is a gateway mandatory for RAC installation, general on RAC environment?
*..when yes, why?*
Many thanks
I make this test with my only one RAC node
1. Run with gateway:
[oracle@linux1 ~]$ crs_stat -t
Name Type Target State Host
ora....SM1.asm application ONLINE ONLINE linux1
ora....X1.lsnr application ONLINE ONLINE linux1
ora.linux1.gsd application ONLINE ONLINE linux1
ora.linux1.ons application ONLINE ONLINE linux1
ora.linux1.vip application ONLINE ONLINE linux1
ora.orcl.db application ONLINE ONLINE linux1
ora....l1.inst application ONLINE ONLINE linux1
ora....test.cs application ONLINE ONLINE linux1
ora....cl1.srv application ONLINE ONLINE linux1
[oracle@linux1 ~]$ srvctl status database -d orcl
Instance orcl1 is running on node linux1All thing seem correct!
2. run without gateway (blank setting):
[oracle@linux1 ~]$ crs_stat -t
Name Type Target State Host
ora....SM1.asm application ONLINE OFFLINE
ora....X1.lsnr application ONLINE OFFLINE
ora.linux1.gsd application ONLINE ONLINE linux1
ora.linux1.ons application ONLINE ONLINE linux1
ora.linux1.vip application ONLINE OFFLINE
ora.orcl.db application ONLINE OFFLINE
ora....l1.inst application ONLINE OFFLINE
ora....test.cs application ONLINE OFFLINE
ora....cl1.srv application ONLINE OFFLINE
[oracle@linux1 ~]$ srvctl status database -d orcl
Instance orcl1 is not running on node linux1Something is false!By default, the server's default gateway is used as a ping target during the Oracle RAC 10g VIP status check action.
Upon a ping failure, Oracle will decide that the current interface where the VIP is running has failed, and will initiate
an interface / internode VIP failover.
In above case, we used just one node for CRS installation, so the VIP coudn't failover to other nodes and thus reported additional error like :
CRS-1006: No more members to consider
CRS-0215: Could not start resource 'ora.dbtest2.vip'.
Try ->
A parameter FAIL_WHEN_DEFAULTGW_NOT_FOUND in the file
$ORA_CRS_HOME/bin/racvip to address this problem.
The following steps will fix the VIP starting problem for above mentioned scenario.
1- stop nodeapps
2- As root,
vi the script $ORA_CRS_HOME/bin/racgvip and change the value of
variable FAIL_WHEN_DEFAULTGW_NOT_FOUND=0 .
3- start nodeapps and you should see the resources ONLINE
You may proceed with netca and dbca to create a RAC database after this. -
Increase Shared Pool for erorr # ORA-04031
hi,
what do i need to look at before i increase the shared pool of our database?
there is just the one database instance on the machine.
i am concerned about the repurcussions on the server.
i hope the information below is of help.
db version: 10.2.0.1.0
os: Red Hat Linux 3
SQL> select name, value from v$parameter where name like '%pool%';
name value
shared_pool_size 150994944
large_pool_size 33554432
java_pool_size 50331648
streams_pool_size 0
shared_pool_reserved_size 10066329
buffer_pool_keep
buffer_pool_recycle
global_context_pool_size
olap_page_pool_size 0
thanks,
santosh sewlalHi Santosh,
This is what i faced last two days back! Now i am monitoring the Issue! If you got any solutions please let me know how to avoid this!
ORA-04031 error can be due to either an inadequeate sizing of the SHARED POOL size or due to heavy
fragmentation leading the database to not finding large enough chuncks of memory.
You can monitor this with the two events...
alter system set events '4031 trace name errorstack level 3';
alter system set events '4031 trace name heapdump level 3';
Fragmentataion is one of the causes of ora 4031
Please refer these.
1.Article-ID: Note 146599.1
Title: Diagnosing and Resolving Error ORA-04031
2.Article-ID: Note 62143.1
Title: Understanding and Tuning the Shared Pool
3.Article-ID: Note 61623.1
This is paticular for Oracle 9i Rel 2, Hope the same for Oracle 10 G
Regards
Ravi -
Dear All,
what is the best options for shared storage system for Oracle RAC 10g R2 on windows operating system.
How to share disk in windows so that it can be available in all RAC nodes in Dynamic mode.
Need help from people who have configured RAC on windows operating system and have used shared disk option.
Regards,
ImranIn production, the only realistic options are to turn to certified SAN or NAS vendors.
The issue is simplel - even though many types of shared storage allows you to have multiple machines connected to the same disk, certified shared storage allows these machines to write to the same disk sector and block. Most storage solutions have built-in protection to stop that from happening.
For a small shop, I certainly recommend NetApp NAS. -
VMWare Fusion & Shared Disks for RAC install
Does anyone have any advice on how best to install a 2 node RAC 10G on a Macbook Pro. I've searched the forums here and haven't found much on this subject.
I'm having problems setting up the shared disks to be used for the voting disk and ASM.
Cheers,
MikeThis link might help you in what you are looking for.
http://www.apple.com/itpro/profiles/rotech/
Good luck,
--MM -
Hello Team:
I ran a metalink script to report the shared pool utilization recently. I took this output when the database was on peak load.
SQL> /
Obj mem: 66435759 bytes (63.36MB)
Shared sql: 324219036 bytes (309.2MB)
Cursors: 341207073 bytes (325.4MB)
Free memory: 67228508 bytes (64.11MB)
Shared pool utilization (total): 468785754 bytes (447.07MB)
Shared pool allocation (actual): 754974720bytes (720MB)
Percentage Utilized: 91%
does this mean I have to add more space to shared pool. If so what is the threshold value?
Regards,
BalaBhawani nandan Prasad - Principal DBA -- See a to z diagnostics about Shared pool
1. Memory 2
a. Shared Pool 2
1. Introduction 2
2. Architecture 2
3. Scripts for different DBA tasks: 5
a.Measure object usage inside the shared pool and Tune shared pool 7
b.Check reload problem in library cache 12
c.Find the large queries in the shared pool library cache (using > 4mb each) 13
d.Find objects that can be considered pining into the shared pool 13
e.LRU work and objects were loaded and flushed 13
f.How much are waiting for Library Cache Latch 14
g.Queries identical but aren’t shared. 14
h.Get Biggest chunk of free memory. 14
i.Check the shared pool reserved size status 16
j.When having multiple subheaps: 16
k.Check shared pool at first glance quick diagnostics 17
l.Memory Usage - object list level view 17
m.Loads Number of times object has been loaded 17
n.Check number of times and object has been executed 18
o.Check shared pool in more details 18
p.Library Cache Statistics 18
q.Reserve Pool Settings 19
r.Pinned Objects 19
s.Finding literal SQL 19
t.Finding the Library Cache hit ratio 19
u. Row Cache Misses – Dictionary cache stats 19
v. Checking hash chain lengths 20
w. Checking for high version counts 20
x. Finding statement/s which use lots of shared pool memory 20
y. Allocations causing shared pool memory to be 'aged' out 21
z. Issues in various Oracle Releases 21
4. Terminology 22
5. Oracle 11g Caching and Pooling – SQL Result Cache 27
6. References 37
2. SQL 38
3. Statistics 38
4. Wait events 38
5. Schema 39
6. General 39
a. Scripts 39
1. accept.sql 39
1. Memory
a. Shared Pool
1. Introduction
Shared pool is used to cache different types of data such as textual and executable forms of PL/SQL blocks and SQL statements, dictionary cache data, and other data in SGA. Additional shared memory needed in the SHARED POOL if using ASM storage. Gathering schema/database stats (table/index stats) makes database query performance better and it reduce utilization of shared pool. Hence, practice to schedule job to gather stats regularly which suites your database performance. If you use shared pool effectively you can reduce resource consumption in at least four ways
1. Parse overhead is avoided if the SQL statement is already in the shared pool. This saves CPU resources on the host and elapsed time for the end user.
2. Latching resource usage is significantly reduced, which results in greater scalability.
3. Shared pool memory requirements are reduced, because all applications use the same pool of SQL statements and dictionary resources.
4. I/O resources are saved, because dictionary elements that are in the shared pool do not require disk access.
This sharable area of memory is managed as a sophisticated cache and heap manager rolled into one. It has 3 fundamental problems to overcome:
1. The unit of memory allocation is not a constant - memory allocations from the pool can be anything from a few bytes to many kilobytes
2. Not all memory can be 'freed' when a user finishes with it (as is the case in a traditional heap manager) as the aim of the shared pool is to maximize share of information. The information in the memory may be useful to another session - Oracle cannot know in advance if the items will be of any use to anyone else or not.
3. There is no disk area to page out to so this is not like a traditional cache where there is a file backing store. Only "rewriteable" information can be discarded from the cache and it has to be re-created when it is next needed.
Oracle 10g architecture of Shared pool:
Library Cache Shared SQL Area (Hash Value, SQL source, Execution plan)
Data Dictionary Cache
Enqueues Fixed Area Other
Latches
Oracle 11g architecture of Shared pool:
Library Cache Shared SQL Area (Hash Value, SQL source, Execution plan)
Data Dictionary Cache
Result Cache
Enqueues Fixed Area Other
Latches
1. Library Cache
Shared Sql Area: contains Parsed SQL and execution Plans for statements already run against the database. This area allows SQL execution plans to be reused by many users.
Private SQL Area: Private SQL areas are non-shared memory areas assigned to unique user sessions.
Pl/sql Area: contains the recently executed Procedures, Functions and Packages.
Control Structures: Common control structure information example Memory for Latches and locks, sequence cache.
2. Dictionary cache known as the row cache.
Dictionary cache stores all the metadata info of tables and views in the database, Names and data types of the columns in the database, Object and system privileges of all the Users. Oracle maintains the stats of all the objects in the shared pool, if any of the memory objects are not used from the last 3 seconds, these memory objects will be aged out and will be removed from the cache. All the Shared Pool Structures are maintained by a LRU (least recently Used) algorithm, by which Oracle removes the objects from the shared Pool, until there is enough free space in the shared Pool to keep new Object.
3. Scripts for different DBA tasks:
Dictionary Views for shared POOL:
NON-RAC
V$DB_CACHE_ADVICE
V$DB_OBJECT_CACHE
V$DLM_LATCH
V$DLM_LOCKS
V$LATCH
V$LATCHHOLDER
V$LATCHNAME
V$LATCH_CHILDREN
V$LATCH_MISSES
V$LATCH_PARENT
V$LIBRARYCACHE
V$LOCK
V$LOCKED_OBJECT
V$LOCKS_WITH_COLLISIONS
V$LOCK_ACTIVITY
V$LOCK_ELEMENT
V$OPEN_CURSOR
V$PROCESS
V$PX_PROCESS
V$PX_PROCESS_SYSSTAT
V$PX_SESSION
V$PX_SESSTAT
V$ROWCACHE
V$ROWCACHE_PARENT
V$ROWCACHE_SUBORDINATE
V$SESSION
V$SESSION_CONNECT_INFO
V$SESSION_CURSOR_CACHE
V$SESSION_EVENT
V$SESSION_LONGOPS
V$SESSION_OBJECT_CACHE
V$SESSION_WAIT
V$SESSTAT
V$SESS_IO
V$SGA
V$SGASTAT
V$SGAINFO
V$SGA_DYAMIC_COMPONENTS
V$SGA_DYNAMIC_FREE_MEMORY
V$SGA_RESIZE_OPS
V$SGA_CURRENT_RESIZE_OPS
v$shared_pool_advice
V_$SHARED_POOL_ADVICE
V$SHARED_POOL_RESERVED
V$SHARED_SERVER
V$SORT_SEGMENT
V$SORT_USAGE
V$SQL
V$SQLAREA
V$SQLTEXT
V$SQLTEXT_WITH_NEWLINES
V$SQL_BIND_DATA
V$SQL_BIND_METADATA
V$SQL_CURSOR
V$SQL_SHARED_CURSOR
V$SQL_SHARED_MEMORY
V$STATNAME
V$SUBCACHE
V$SYSSTAT
V$SYSTEM_CURSOR_CACHE
V$SYSTEM_EVENT
V$SYSTEM_PARAMETER
X$KSMSP
RAC
GV$LATCH
GV$LATCHHOLDER
GV$LATCHNAME
GV$LATCH_CHILDREN
GV$LATCH_MISSES
GV$LATCH_PARENT
GV$LIBRARYCACHE
GV$LOCK
GV$LOCKED_OBJECT
GV$LOCKS_WITH_COLLISIONS
GV$LOCK_ACTIVITY
GV$LOCK_ELEMENT
GV$PROCESS
GV$PX_PROCESS
GV$PX_PROCESS_SYSSTAT
GV$PX_SESSION
GV$PX_SESSTAT
GV$ROWCACHE
GV$ROWCACHE_PARENT
GV$ROWCACHE_SUBORDINATE
GV$SESSION
GV$SESSION_CONNECT_INFO
GV$SESSION_CURSOR_CACHE
GV$SESSION_EVENT
GV$SESSION_LONGOPS
GV$SESSION_OBJECT_CACHE
GV$SESSION_WAIT
GV$SESSTAT
GV$SESS_IO
GV$SGA
GV$SGASTAT
gv$shared_pool_advice
GV$SHARED_POOL_RESERVED
GV$SHARED_SERVER
GV$SORT_SEGMENT
GV$SORT_USAGE
GV$SQL
GV$SQLAREA
GV$SQLTEXT
GV$SQLTEXT_WITH_NEWLINES
GV$SQL_BIND_DATA
GV$SQL_BIND_METADATA
GV$SQL_CURSOR
GV$SQL_SHARED_CURSOR
GV$SQL_SHARED_MEMORY
GV$STATNAME
GV$SUBCACHE
GV$SYSSTAT
GV$SYSTEM_CURSOR_CACHE
GV$SYSTEM_EVENT
GV$SYSTEM_PARAMETER
GV$WAITSTAT
GV$_LOCK
a.Measure object usage inside the shared pool and Tune shared pool
set pagesize 132
column owner format a16
column name format a36
column sharable_mem format 999,999,999
column executions format 999,999,999
prompt
prompt Memory Usage of Shared Pool Order - Biggest First
prompt
column name format 45
select owner, name||' - '||type name, sharable_mem from v$db_object_cache
where sharable_mem > 10000
and type in ('PACKAGE', 'PACKAGE BODY', 'FUNCTION', 'PROCEDURE')
order by sharable_mem desc
prompt
prompt Loads into Shared Pool - Most Loads First
prompt
select owner, name||' - '||type name, loads , sharable_mem from v$db_object_cache
where loads > 3
and type in ('PACKAGE', 'PACKAGE BODY', 'FUNCTION', 'PROCEDURE')
order by loads desc
prompt
prompt Executions of Objects in the Shared Pool - Most Executions First
prompt
select owner, name||' - '||type name, executions from v$db_object_cache
where executions > 100
and type in ('PACKAGE', 'PACKAGE BODY', 'FUNCTION', 'PROCEDURE')
order by executions desc
select 'If the values for the EXEC and LOADS close increase SHARED_POOL_SIZE!' from dual ;
set feedback off
set linesize 80
set pagesize 52
clear columns
clear breaks
col executions HEADING EXEC
col sharable_mem heading SHAMEM
col owner format a8
col name format a30
col type format a12
set numwidth 8
ttitle center 'Data Base Objects Owned by All Users Statistics' skip 2
select name, type, sharable_mem, loads, executions, pins
from sys.v_$db_object_cache ;
b.Check reload problem in library cache
select namespace, pins, reloads from v$librarycache;
show parameters shared_pool
select bytes/1024/1024 from v$sgastat where pool='shared pool' and name='free memory';
c.Find the large queries in the shared pool library cache (using > 4mb each)
SELECT sql_text "Stmt", count(*), sum(sharable_mem) "Mem",
sum(users_opening) "Open", sum(executions) "Exec"
FROM v$sql GROUP BY sql_text HAVING sum(sharable_mem) > 4096000;
d.Find objects that can be considered pining into the shared pool
column name format a40
column owner format a15
select owner, name, executions, locks, pins, loads, kept from v$db_object_cache where loads > 10;
create temp table and insert records of candidates to be pinned.
CREATE TABLE LRU_TMP AS SELECT * FROM X$KSMLRU;
INSERT INTO LRU_TMP SELECT * FROM X$KSMLRU;
Use the LRU_TMP table for analysis.
SELECT USERNAME, KSMLRCOM, KSMLRHON, KSMLRNUM, KSMLRSIZ, SQL_TEXT
FROM V$SQLAREA A, LRU_TMP K, V$SESSION S WHERE KSMLRSIZ > 3000
AND A.ADDRESS=S.SQL_ADDRESS AND A.HASH_VALUE = S.SQL_HASH_VALUE
AND SADDR=KSMLRSES;
You can see the candidates to pin from the query below
COL STORED_OBJECT FORMAT A40;
COL SQ_EXECUTIONS FORMAT 999,999;
SELECT /*+ ORDERED USE_HASH(D) USE_HASH(C) */ O.KGLNAOWN||’.'||O.KGLNAOBJ STORED_OBJECT, SUM(C.KGLHDEXC) SQL_EXECUTIONS
FROM SYS.X$KGLOB O, SYS.X$KGLRD D, SYS.X$KGLCURSOR C
WHERE
O.INST_ID = USERENV(’INSTANCE’) AND
D.INST_ID = USERENV(’INSTANCE’) AND
C.INST_ID = USERENV(’INSTANCE’) AND
O.KGLOBTYP IN (7, 8, 9, 11, 12) AND
D.KGLHDCDR = O.KGLHDADR AND
C.KGLHDPAR = D.KGLRDHDL
GROUP BY O.KGLNAOWN, O.KGLNAOBJ
HAVING SUM(C.KGLHDEXC) > 0
ORDER BY 2 DESC;
How to pin object
EXECUTE SYS.DBMS_SHARED_POOL.SIZES(150);
EXECUTE SYS.DBMS_SHARED_POOL.KEEP('SYS.STANDARD');
EXECUTE SYS.DBMS_SHARED_POOL.UNKEEP('SYS.STANDARD');
e.LRU work and objects were loaded and flushed
LRU work in the shared pool KSMLRNUM stores the number of objects that were flushed to load the large object. KSMLRISZ stores the size of the object that was loaded (contiguous memory allocated)
column ksmlrcom format a20
column username format a5
select username,sid,KSMLRCOM,KSMLRSIZ,KSMLRNUM, KSMLRHON, KSMLROHV, KSMLRSES from x$ksmlru , v$session where KSMLRSES=SADDR and KSMLRNUM >2 ;
f.How much are waiting for Library Cache Latch
select count(*),event from v$session_wait where event not like '%SQL%' and event not like '%ipc%' and event not like '%timer%' GROUP BY EVENT;
select count(*),wait_time from v$session_wait where event='latch free' and p2=106 group by wait_time;
select sid,wait_time,seconds_in_wait from v$session_wait where event='latch free' and p2=106 and WAIT_TIME>1;
g.Queries identical but aren’t shared.
SELECT address, hash_value, version_count , users_opening , users_executing,
substr(sql_text,1,240) "SQL" FROM v$sqlarea WHERE version_count > 10;
h.Get Biggest chunk of free memory.
select sysdate, decode( sign(ksmchsiz - 812), -1, (ksmchsiz - 16) / 4,
decode(sign(ksmchsiz - 4012),-1, trunc((ksmchsiz + 11924) / 64),
decode(sign(ksmchsiz - 65548), -1, trunc(1/log(ksmchsiz - 11, 2)) + 238,254))) bucket,
sum(ksmchsiz) free_space, count(*) free_chunks, trunc(avg(ksmchsiz)) average_size,
max(ksmchsiz) biggest from x$ksmsp
where inst_id = userenv('Instance') and ksmchcls = 'free' group by
decode(sign(ksmchsiz - 812),-1, (ksmchsiz - 16) / 4,
decode(sign(ksmchsiz - 4012),-1, trunc((ksmchsiz + 11924) / 64),
decode(sign(ksmchsiz - 65548),-1, trunc(1/log(ksmchsiz - 11, 2)) + 238,254 ))) ;
SELECT KSMCHCLS CLASS, COUNT(KSMCHCLS) NUM, SUM(KSMCHSIZ) SIZ,
To_char( ((SUM(KSMCHSIZ)/COUNT(KSMCHCLS)/1024)),’999,999.00′)||’k’ “AVG SIZE”
FROM X$KSMSP GROUP BY KSMCHCLS;
CLASS NUM SIZ AVG SIZE
freeabl 19010 34519404 1.77k
recr 23581 24967956 1.03k
R-freea 68 1632 .02k
perm 22 39801268 1,766.75k
R-free 34 7238192 207.90k
free 2389 36075980 14.75k
Watch for trends using these guidelines:
a) if ‘free’ memory is low (less than 5mb or so) you may need to increase the shared_pool_size and shared_pool_reserved_size. You should expect ‘free’ memory to increase and decrease over time. Seeing trends where ‘free’ memory decreases consistently is not necessarily a problem, but seeing consistent spikes up and down could be a problem.
b) if ‘freeable’ or ‘perm’ memory continually grows then it is possible you are seeing a memory bug.
c) if ‘freeabl’ and ‘recr’ memory classes are always huge, this indicates that you have a lot of cursor info stored that is not releasing.
d) if ‘free’ memory is huge but you are still getting 4031 errors, the problem is likely reloads and invalids in the library cache causing fragmentation.
-Note says that this query can hang database on HP platforms
See the shared pool parameters
column name format a30
select name,value from v$parameter where name like '%shared_pool%' ;
select x.ksppinm, y.ksppstvl from x$ksppi x , x$ksppcv y where x.indx = y.indx and lower(x.ksppinm) like '%spin%';
SELECT count(*) FROM v$latch_children WHERE NAME = 'library cache';
Shrinking and growing operations from V$SGA_RESIZE_OPS dynamic view:
select to_char(end_time, ‘dd-Mon-yyyy hh24:mi’) end, oper_type, initial_size, target_size, final_size from V$SGA_RESIZE_OPS where component=’shared pool’ order by end;
#shared_pool_summary.sql -get an overview of chunks in the shared pool
select
ksmchcom contents,
count(*) chunks,
sum(decode(ksmchcls, 'recr', ksmchsiz)) recreatable,
sum(decode(ksmchcls, 'freeabl', ksmchsiz)) freeable,
sum(ksmchsiz) total
from
sys.x_$ksmsp
where
inst_id = userenv('Instance') and
ksmchcls not like 'R%'
group by
ksmchcom
#reserved_pool_summary.sql - get an overview of chunks in the reserved pool
select
ksmchcom contents,
count(*) chunks,
sum(decode(ksmchcls, 'R-recr', ksmchsiz)) recreatable,
sum(decode(ksmchcls, 'R-freea', ksmchsiz)) freeable,
sum(ksmchsiz) total
from
sys.x_$ksmspr
where
inst_id = userenv('Instance')
group by
ksmchcom
#save_sqlplus_settings.sql -reset sqlplus settings
set termout off
store set sqlplus_settings replace
clear breaks
clear columns
clear computes
set feedback off
set verify off
set termout on
set define "&"
#restore_sqlplus_settings.sql -reset sqlplus settings
set termout off
@sqlplus_settings
clear breaks
clear columns
clear computes
set termout on
i.Check the shared pool reserved size status
SELECT free_space, avg_free_size, used_space, avg_used_size, REQUEST_MISSES, request_failures, last_miss_size FROM v$shared_pool_reserved;
An ORA-04031 error referencing large failed requests, indicates the Reserved Area is too fragmented. The reserved pool is small when: REQUEST_FAILURES > 0 (and increasing), The DBA should Increase shared_pool_reserved_size and shared_pool_size together. It is possible that too much memory has been allocated to the reserved list. The DBA should Decrease shared_pool_reserved_size, If: REQUEST_MISS = 0 or not increasing
FREE_MEMORY = > 50% of shared_pool_reserved_size minimum
col free_space for 999,999,999,999 head “TOTAL FREE”
col avg_free_size for 999,999,999,999 head “AVERAGE|CHUNK SIZE
col free_count for 999,999,999,999 head “COUNT”
col request_misses for 999,999,999,999 head “REQUEST|MISSES
col request_failures for 999,999,999,999 head “REQUEST|FAILURES”
col max_free_size for 999,999,999,999 head “LARGEST CHUNK”
select free_space, avg_free_size, free_count, max_free_size, request_misses, request_failures from v$shared_pool_reserved;
TOTAL FREE AVERAGE
CHUNK SIZE COUNT LARGEST CHUNK REQUEST
MISSES REQUEST
FAILURES
7,238,192 212,888 34 212,888 0 0
You should also use hidden and unsupported parameter “_shared_pool_reserved_pct” to control reserved pool. This parameter controls the allocated percentage of shared pool for reserved pool. By default it is %5 of the shared pool and if you use ASMM for memory management you can set this value higher like 10 to allocate reserved pool dynamically. When you set the parameter you will see the shared_pool_reserved_size parameter will be adjusted to the new setting. The parameter can not be modified when instance is started. You can use the query below to see the current value
select a.ksppinm “Parameter”, b.ksppstvl “Session Value”, c.ksppstvl “Instance Value” from sys.x$ksppi a, sys.x$ksppcv b, sys.x$ksppsv c where a.indx = b.indx and a.indx = c.indx and a.ksppinm = ‘_shared_pool_reserved_pct’;
Parameter Session Value Instance Value
sharedpool_reserved_pct 10 10
j.When having multiple subheaps:
select KSMCHIDX, ksmchcom ChunkComment,
decode(round(ksmchsiz/1000),0,'0-1K', 1,'1-2K', 2,'2-3K', 3,'3-4K',4,'4-5K',5,'5-6k',6,'6-7k',7,'7-8k',8,'8-9k', 9,'9-10k', '> 10K'), count(*), ksmchcls Status, sum(ksmchsiz) Bytes
from x$ksmsp where KSMCHCOM = 'free memory' group by KSMCHIDX,ksmchcom, ksmchcls, decode(round(ksmchsiz/1000),0,'0-1K', 1,'1-2K', 2,'2-3K', 3,'3-4K',4,'4-5K',5,'5-6k',6,'6-7k',7,'7-8k',8,'8-9k', 9,'9-10k','> 10K');
SubPool SGA_HEAP CHUNKCOMMENT size COUNT(*) STATUS BYTES
1 sga heap(1,0) free memory > 10K 34 R-free 7238192
1 sga heap(1,0) free memory 3-4K 2 free 6284
1 sga heap(1,0) free memory > 10K 241 free 35707400
1 sga heap(1,0) free memory 8-9k 1 free 7712
1 sga heap(1,0) free memory 2-3K 4 free 6752
1 sga heap(1,0) free memory 0-1K 2090 free 133288
1 sga heap(1,0) free memory 9-10k 21 free 188676
1 sga heap(1,0) free memory 1-2K 30 free 25868
If you see lack of large chunks it is possible that you can face with ORA-04031 in near future.
k.Check shared pool at first glance quick diagnostics
select 'You may need to increase the SHARED_POOL_RESERVED_SIZE' Description, 'Request Failures = '||REQUEST_FAILURES Logic
from v$shared_pool_reserved where REQUEST_FAILURES > 0
and 0 != (select to_number(VALUE) from v$parameter
where NAME = 'shared_pool_reserved_size')
union
select 'You may be able to decrease the SHARED_POOL_RESERVED_SIZE' Description,'Request Failures = '||REQUEST_FAILURES Logic
from v$shared_pool_reserved where REQUEST_FAILURES < 5
and 0 != (select to_number(VALUE) from v$parameter
where NAME = 'shared_pool_reserved_size')
l.Memory Usage - object list level view
• Owner - Owner of the object
• Object - Name/namespace of the object
• Sharable Memory - Amount of sharable memory in the shared pool consumed by the object
select OWNER, NAME||' - '||TYPE object,SHARABLE_MEM
from v$db_object_cache where SHARABLE_MEM > 10000
and type in ('PACKAGE','PACKAGE BODY','FUNCTION','PROCEDURE')
order by owner asc ,SHARABLE_MEM desc
SELECT * FROM (SELECT ROW_NUMBER () over (PARTITION BY NAMESPACE ORDER BY SHARABLE_MEM DESC) ROW_within , NAMESPACE, SHARABLE_MEM, SUBSTR(NAME,1,40) NAME FROM V$DB_OBJECT_CACHE ORDER BY SHARABLE_MEM DESC) WHERE ROW_WITHIN <= 2 ORDER BY NAMESPACE, ROW_WITHIN;
ROW_WITHIN NAMESPACE SHARABLE_MEM NAME
1 CLUSTER 2794 C_OBJ#_INTCOL#
2 CLUSTER 1684 SMON_SCN_TO_TIME
1 RSRCPLAN 5117 SYS_GROUP -
Best practice for RAC RMAN backup
I have a 10gR2 RAC db that is 3.5TB. It is a 2 node cluster on AIX. Each instance is db1 on node1, and db2 on node2, the "world" database name is db.
Currently we are doing our backup from 1 node of the cluster, specifying that it connect to to db2, so this instance is doing all of the backup work. We allocate 14 channels to back this database up to tape (yes, we have plenty of tape resources, connecting to a tape machine with > 20 physical tape drives). Would it be better to have our rman script connect to the general database db and let the listener decide which instance to send the channel allocation to, or keep all the work on one node.I seem to remember that when I was reading up on RAC and RMAN a couple of years ago (maybe up to 4 years ago) that there was something about always doing backups from the same node in a RAC configuration i.e. you have logically 'db' in your network configuration and also direct names of 'db1' and 'db2', and you should always use one of 'db1' or 'db2' but never 'db'. And I also mean do not alternate between 'db1' and 'db2'. Pick one of them and always do your backups from that instance.
I think this was to do with things like the database identifier, and the instance identifier too, which RMAN reads and puts into the backup. It also affects things like reading the archive logs, which must be cross mounted to both nodes. I have this feeling that using the same node kept a kind of consistency within the backups, and meant that Oracle was getting all of the block images from one node i.e. from one of the SGAs. If you used both nodes simultaneously you could run into issues with their SGAs being out of sync. I know this does not make much sense, given that RAC is all about keeping the SGAs consistent with each other. But at the end of the day I do remember something about always using one node all the time to do your RMAN backups.
Not sure if these rules hold true if you are using ASM, which itself is shared in a RAC environment.
Things may have moved on since then, but that was still 10g Release 2 documentation, so I would guess it is still true. At the end of the day, it is not the backup that is important, but the recovery. You don't want to create any kind of inconsistent backup that RMAN cannot successfully recover, even though the backup may look good when you create it.
I'd check out the RMAN and RAC documentation further to see if this is supported.
John -
DB Version: 11.2.0.2
OS : Solaris 5.10
We are thinking of setting up a RAC db(Development) with a Firewire 800 device as our Shared storage. We are thinking of buying a 2 port Firewire Storage device mentioned in the below URL along with 2 firewire PCI cards for both of our machines.
http://www.lacie.com/asia/products/product.htm?id=10330
I have read in other OTN posts that RAC with firewire storage is only good for Demo purpose. Does this mean that it is not good for development DBs at least?T.Boyd wrote:
DB Version: 11.2.0.2
OS : Solaris 5.10
We are thinking of setting up a RAC db(Development) with a Firewire 800 device as our Shared storage. We are thinking of buying a 2 port Firewire Storage device mentioned in the below URL along with 2 firewire PCI cards for both of our machines.
http://www.lacie.com/asia/products/product.htm?id=10330
I have read in other OTN posts that RAC with firewire storage is only good for Demo purpose. Does this mean that it is not good for development DBs at least?Oracle "supports" this in a pure development environment. There is (or was) an Oracle owned mailing list that specifically dealt with this - using firewire shared storage for RAC.
Some years ago I tried it (with a Lacie drive). But could not get both RHEL3 servers to open a connection to the drive. The config was correct, but the 2nd server always failed to establish a connection (complaining something like that no more connections were supported to the drive). I put that one down as a driver bug of sorts - and were not keen to go bug hunting and build the driver from source code. Left it at that - but according to the docs I read (from Oracle) at the time, this was a "valid" config for testing RAC. -
Should I use shared pool advisor?
Hi, I am new to the Oracle DB and preparing for the first test of the OCA. If there is a SQL statement that is parsing repeatly, should I use shared pool advisor or SGA advisor?
thanks a lot for helpuser592813 wrote:
Hi, I am new to the Oracle DB and preparing for the first test of the OCA. If there is a SQL statement that is parsing repeatly, should I use shared pool advisor or SGA advisor?
thanks a lot for helpYou need to tell us that what do you mean by "parse" here? Is it a soft parse or hard parse? If its a hard parse, and you have made sure that your application has not used literals , you may look at the shared pool for being undersized by its sizing advisory. If you have a bad code in the application throwing unsharable queries, there is no point of increasing the shared pool as at any one point of time,it would become useless. For this, the fix would be tune the queries and not to resize the shared pool.
If on the other hand, you have soft parsing happening, you can further try to optimize it by making it "no parsing" using the parameter session_cached_cursors . But for this as well, there is no need to increase the size of the shared pool.
HTH
Aman.... -
How Prepare Disks for RAC installation
How configure disks for RAC instalation for Windows Enterprise Server 2003
Best resource for RAC on Windows:
www.jobcestbon.com/oracle/RacOnWindows.pdf
HTH
Thanks
-Chandra PabbaI read it, but i unable to configure Shared Memory accourding to this link. Please guide me how i can configure shared Memory for RAC in Windows Server Enterprise 2003.
Thanks -
How Do I Configure SSL for RAC Installation.
Experts,
Requesting your inputs on configuring SSL for my RAC environment.
- Oracle DB version is 11.2.0.2
- RAC is with two nodes.
- Two nodes are : rac1.oracle.com and rac2.oracle.com
- RAC setup has SCAN feature configured. SCAN FQDN : racscan.oracle.com
- All clients talk to RAC DB using SCAN feature as shown below.
client applications -> racscan.oracle.com ---> rac1.oracle.com
---> rac2.oracle.com
- tnsnames.ora file on both RAC instances has hostname as "racscan.oracle.com" instead of their individual phyiscal host names.
How do I configure SSL for RAC:
1. Do I need to generate certificate request for individual hostnames or only for SCAN hostname ?.
2. If I generate a certificate based on SCAN hostname, how does SSL work since SCAN hostname is not a phyiscal host name ?
3. What is recommended strategy for configuring SSL for RAC environment ?
ThanksThe documentation on the creation of Oracle Wallets is not specific to RAC, and the RAC SCAN instructions for TCPS are very vague on the specific requirements for the certificates required in the wallets for proper operation. I too am struggling to get it to work. Does anyone have a more technical guide to the specific configuration of the certificates needed and what specific configuration file changes need to be made?
Also, the self signed documentation is getting REALLY old. Oracle, please stop giving instructions that demonstrate irresponsibility and show the proper method of certificate requesting and importing to wallets.
Edited by: user11338513 on Mar 21, 2012 2:23 PM
Maybe you are looking for
-
Remote app no longer sees AppleTV and shares
I've noticed that the Remote App on my iPhone 4 looks different than it used to, so I guess it's been updated recently. Anyways, now I don't have AirPlay anymore in any video or audio apps. I haven't changed anything in terms of network set up, Apple
-
VALUATION NOT APPEARING IN RESULT RECORDING
Hello.... I have created an inspection plan where i have assigned all the characteristic to be inspected with quantative data. Upon goods receipt inspection lot is generated, while doing result recording when i enter the result for eg. if the charact
-
How do I get Bridge CS6 to recognize collections created in Bridge CS4?
I just downloaded Photoshop CS6 beta. When I opened Bridge CS6, my collections (created in Bridge CS4) were not visible. Is there a way to import the collections into CS6?
-
Problems with Halo Combat Evolved on mac mini server with HD3000 graphics
There is frequent flickering of certain elements in the game (ie. background) and certain elements such as weapons are not rendered at all. This happens sporatically and not in a predictable manner. Does any body have any idea what is going on? I rea
-
Adobe Reader not opening nor allowing PDF to open
Hi there. I just downloaded Adobe Reader 11.0.06 to my mac. When I try to open the application nothing happens and when I try to read/download a PDF file from any given site it gives me the following message: ''Before viewing PDF documents in this br