Oracle 9i & 10g Notes
Oracle 9i & 10g Notes
CONTENTS:
==================================================================================
==========
0. QUICK INFO/VIEWS ON SESSIONS, LOCKS, AND UNDO/ROLLBACK INFORMATION IN A SINGLE
INSTANCE:
==================================================================================
=========
-- ---------------------------
-- 0.1 QUICK VIEW ON SESSIONS:
-- ---------------------------
-- ------------------------
-- 0.2 QUICK VIEW ON LOCKS: (use the sys.obj$ to find ID1:)
-- ------------------------
First, lets take a look at some important dictionary views with respect to locks:
This view stores all information relating to locks in the database. The
interesting columns in this view are sid (identifying the session
holding or aquiring the lock), type, and the lmode/request pair. Important
possible values of type are TM (DML or Table Lock),
TX (Transaction), MR (Media Recovery), ST (Disk Space Transaction). Exactly one of
the lmode, request pair is either 0 or 1
while the other indicates the lock mode. If lmode is not 0 or 1, then the session
has aquired the lock, while it waits to aquire the lock
if request is other than 0 or 1. The possible values for lmode and request are:
1: null,
2: Row Share (SS),
3: Row Exclusive (SX),
4: Share (S),
5: Share Row Exclusive (SSX) and
6: Exclusive(X)
If the lock type is TM, the column id1 is the object's id and the name of the
object can then be queried like so:
select name from sys.obj$ where obj# = id1 A lock type of JI indicates that a
materialized view is being
SELECT ADDR, KADDR, SID, TYPE, ID1, ID2, LMODE, BLOCK from v$lock;
SELECT
p.spid unix_spid,
s.sid sid,
p.addr,
s.paddr,
substr(s.username, 1, 10) username,
substr(s.schemaname, 1, 10) schemaname,
s.command command,
substr(s.osuser, 1, 10) osuser,
substr(s.machine, 1, 25) machine
FROM v$session s, v$process p
WHERE s.paddr=p.addr
ORDER BY p.spid;
Usage of v$session_longops:
===========================
This view displays the status of various operations that run for longer than 6
seconds (in absolute time). These operations currently
include many backup and recovery functions, statistics gathering, and query
execution, and more operations are added for every Oracle release.
To monitor query execution progress, you must be using the cost-based optimizer
and you must:
Set the TIMED_STATISTICS or SQL_TRACE parameter to true
Gather statistics for your objects with the ANALYZE statement or the DBMS_STATS
package
l.opname,l.target,l.target_desc,l.message,s.username,s.osuser,s.lockwait from
v$session_longops l, v$session s
where l.sid = s.sid and l.serial# = s.serial#;
Oracle has a view inside the Oracle data buffers. The view is called v$bh, and
while v$bh was originally
developed for Oracle Parallel Server (OPS), the v$bh view can be used to show the
number of data blocks
in the data buffer for every object type in the database.
The following query is especially exciting because you can now see what objects
are consuming
the data buffer caches. In Oracle9i, you can use this information to segregate
tables to separate
RAM buffers with different blocksizes.
Here is a sample query that shows data buffer utilization for individual objects
in the database.
Note that this script uses an Oracle9i scalar sub-query, and will not work in pre-
Oracle9i systems
unless you comment-out column c3.
select
owner c0,
object_name c1,
count(1) c2,
(count(1)/(select count(*) from v$bh)) *100 c3
from
dba_objects o,
v$bh bh
where
o.object_id = bh.objd
and
o.owner not in ('SYS','SYSTEM','AURORA$JIS$UTILITY$')
group by
owner,
object_name
order by
count(1) desc
;
-- -----------------------------
-- 0.3 QUICK VIEW ON TEMP USAGE:
-- -----------------------------
SELECT b.tablespace,
ROUND(((b.blocks*p.value)/1024/1024),2),
a.sid||','||a.serial# SID_SERIAL,
a.username,
a.program
FROM sys.v_$session a,
sys.v_$sort_usage b,
sys.v_$parameter p
WHERE p.name = 'db_block_size'
AND a.saddr = b.session_addr
ORDER BY b.tablespace, b.blocks;
-- --------------------------------
-- 0.4 QUICK VIEW ON UNDO/ROLLBACK:
-- --------------------------------
-- --------------------------------
-- 0.5 SOME EXPLANATIONS:
-- --------------------------------
-- explanation of "COMMAND":
-- explanation of locks:
Locks:
0, 'None', /* Mon Lock equivalent */
1, 'Null', /* N */
2, 'Row-S (SS)', /* L */
3, 'Row-X (SX)', /* R */
4, 'Share', /* S */
5, 'S/Row-X (SRX)', /* C */
6, 'Exclusive', /* X */
to_char(b.lmode)
TX: enqueu, waiting
TM: DDL on object
MR: Media Recovery
UL= user locks, geplaats door programmatuur m.b.v. bijvoorbeeld DBMS_LOCK package
DML locks:
0, None
1, Null (NULL)
2, Row-S (SS)
3, Row-X (SX)
4, Share (S)
5, S/Row-X (SSX)
6, Exclusive (X)
Oracle server uses locks to provide concurrent access to shared resources whereas
it uses latches to provide
exclusive and short-term access to memory structures inside the SGA. Latches also
prevent more than one process
to execute the same piece of code, which other process might be executing. Latch
is also a simple lock,
which provides serialize and only exclusive access to the memory area in SGA.
Oracle doesn�t use latches to
provide shared access to resources because it will increase CPU usage. Latches are
used for big memory structure
and allow operations required for locking the sub structures. Shared resources can
be tables, transactions,
redo threads, etc. Enqueue can be local or global. If it is a single instance then
enqueues will be local to
that instance. There are global enqueus also like ST enqueue, which is held before
any space transaction
can be occurred on any tablespace in RAC. ST enqueues are held only for
dictionary-managed tablespaces.
These oracle locks are generally known as Enqueue, because whenever there is a
session request for a lock
on any shared resource structure, it's lock data structure is queued to one of the
linked list attached to
that resource structure (Resource structure is discussed later).
Before proceeding further with this topic, here is little brief about Oracle
locks. Oracle locks can be applied
to compound and simple objects like tables and the cache buffer. Locks can be held
in different modes like shared,
excusive, null, sub-shared, sub-exclusive and shared sub-exclusive. Depending on
the type of object,
different modes are applied. Foe example, a compound object like a table with
rows, all above mentioned modes
could be applicable whereas for simple objects only the first three will be
applicable. These lock modes don�t
have any importance of their own but the importance is how they are being used by
the subsystem.
These lock modes (compatibility between locks) define how the session will get a
lock on that object.
-- Explanation of Waits:
v$system_event
This view displays the count (total_waits) of all wait events since startup of the
instance.
If timed_statistics is set to true, the sum of the wait times for all events are
also displayed
in the column time_waited. The unit of time_waited is one hundreth of a second.
Since 10g, an additional column (time_waited_micro) measures wait times in
millionth of a second.
total_waits where event='buffer busy waits' is equal the sum of count in
v$waitstat.
v$enqueue_stat can be used to break down waits on the enqueue wait event. While
this view totals all
events in an instance, v$session
select
event c1,
total_waits c2,
time_waited / 100 c3,
total_timeouts c4,
average_wait /100 c5
from
sys.v_$system_event
where
event not in (
'dispatcher timer',
'lock element cleanup',
'Null event',
'parallel query dequeue wait',
'parallel query idle wait - Slaves',
'pipe get',
'PL/SQL lock timer',
'pmon timer',
'rdbms ipc message',
'slave wait',
'smon timer',
'SQL*Net break/reset to client',
'SQL*Net message from client',
'SQL*Net message to client',
'SQL*Net more data to client',
'virtual circuit status',
'WMON goes to sleep'
)
AND
event not like 'DFS%'
and
event not like '%done%'
and
event not like '%Idle%'
AND
event not like 'KXFX%'
order by
c2 desc
;
SELECT b.event,
(e.total_waits - b.total_waits) total_waits,
(e.total_timeouts - b.total_timeouts) total_timeouts,
(e.time_waited - b.time_waited) time_waited
FROM beg_system_event b,
end_system_event e
WHERE b.event = e.event;
SELECT *
FROM v$sysstat
WHERE class=4;
select c.name,a.addr,a.gets,a.misses,a.sleeps,
a.immediate_gets,a.immediate_misses,a.wait_time, b.pid
from v$latch a, v$latchholder b, v$latchname c
where a.addr = b.laddr(+) and a.latch# = c.latch#
order by a.latch#;
-- ---------------------------------------------------------------
-- 0.6. QUICK INFO ON HIT RATIO, SHARED POOL etc..
-- ---------------------------------------------------------------
-- Hit ratio:
SELECT (1-(pr.value/(dbg.value+cg.value)))*100
FROM v$sysstat pr, v$sysstat dbg, v$sysstat cg
WHERE pr.name = 'physical reads'
AND dbg.name = 'db block gets'
AND cg.name = 'consistent gets';
-- ---------------------------------------
-- 0.7 Quick Table and object information
-- ---------------------------------------
Compare 2 owners:
-----------------
select
substr(table_name, 1, 3) schema
, table_name
, column_name
, substr(data_type,1 ,1) data_type
from
user_tab_columns
where COLUMN_NAME='ENV_ID'
where
table_name like 'ALG%'
or table_name like 'STG%'
or table_name like 'ODS%'
or table_name like 'DWH%'
or table_name like 'MKM%'
order by
decode(substr(table_name, 1, 3), 'ALG', 10, 'STG', 20, 'ODS', 30, 'DWH',
40, 'MKM', 50, 60)
, table_name
, column_id
-- --------------------------------------
-- 0.8 QUICK INFO ON PRODUCT INFORMATION:
-- --------------------------------------
ersa
SELECT * FROM PRODUCT_COMPONENT_VERSION;
SELECT * FROM NLS_DATABASE_PARAMETERS;
SELECT * FROM NLS_SESSION_PARAMETERS;
SELECT * FROM NLS_INSTANCE_PARAMETERS;
SELECT * FROM V$OPTION;
SELECT * FROM V$LICENSE;
SELECT * FROM V$VERSION;
Starting with version 8, Oracle began shipping 64bit versions of it's RDBMS
product on UNIX platforms
that support 64bit software. IMPORTANT: 64bit Oracle can only be installed on
Operating Systems that are 64bit enabled.
In general, if Oracle is 64bit, '64bit' will be displayed on the opening banners
of Oracle executables
such as 'svrmgrl', 'exp' and 'imp'. It will also be displayed in the headers of
Oracle trace files.
Otherwise if '64bit' is not display at these locations, it can be assumed that
Oracle is 32bit.
or
Oracle clients:
---------------
Server Version
Client Version 10.1.0 9.2.0 9.0.1 8.1.7 8.1.6 8.1.5 8.0.6 8.0.5 7.3.4
10.1.0 Yes Yes Was Yes #2 No No No No No
9.2.0 Yes Yes Was Yes No No Was No No #1
9.0.1 Was Was Was Was Was No Was No Was
8.1.7 Yes Yes Was Yes Was Was Was Was Was
8.1.6 No No Was Was Was Was Was Was Was
8.1.5 No No No Was Was Was Was Was Was
8.0.6 No Was Was Was Was Was Was Was Was
8.0.5 No No No Was Was Was Was Was Was
7.3.4 No Was Was Was Was Was Was Was Was
-- -----------------------------------------------------
-- 0.9 QUICK INFO WITH REGARDS LOGS AND BACKUP RECOVERY:
-- -----------------------------------------------------
-- ----------------------------------------------------------------------------
-- 0.10 QUICK INFO WITH REGARDS TO TABLESPACES, DATAFILES, REDO LOGFILES etc..:
-- -----------------------------------------------------------------------------
-- tablespace free-used:
----------------------------------------------
-- 0.11 AUDIT Statements:
----------------------------------------------
-----------------------------------------------
-- 0.12 EXAMPLE OF DYNAMIC SQL:
-----------------------------------------------
-----------------------------------------------
-- 0.13 ORACLE MOST COMMON DATATYPES:
-----------------------------------------------
Table created.
Table created.
Table created.
1 row created.
1 row created.
1 row created.
1 row created.
1 row created.
1 row created.
1 row created.
1 row created.
1 row created.
1 row created.
1 row created.
ID
----------
5
99
999
1001
65536
1048576
1.0995E+12
10
100
9 rows selected.
1 row created.
1 row created.
1 row created.
1 row created.
ID
----------
5
9999
93
1.0995E+12
========================
1. NOTES ON PERFORMANCE:
=========================
1.1 POOLS:
==========
-- SHARED POOL:
-- ------------
-- Hard Parse
If a new SQL statement is issued which does not exist in the shared pool then this
has to be parsed fully.
Eg: Oracle has to allocate memory for the statement from the shared pool, check
the statement syntactically
and semantically etc... This is referred to as a hard parse and is very expensive
in both terms of CPU used
and in the number of latch gets performed.
--Soft Parse
If a session issues a SQL statement which is already in the shared pool AND it can
use an existing version
of that statement then this is known as a 'soft parse'.
As far as the application is concerned it has asked to parse the statement.
if two statements are textually identical but cannot be shared then these are
called 'versions' of the same statement.
If Oracle matches to a statement with many versions it has to check each version
in turn to see
if it is truely identical to the statement currently being parsed. Hence high
version counts are best avoided.
The best approach to take is that all SQL should be sharable unless it is adhoc or
infrequently used SQL where
it is important to give CBO as much information as possible in order for it to
produce a good execution plan.
The values 40,5 and 30 are example values so this query is looking for different
statements whose first
40 characters are the same which have only been executed a few times each and
there are at least 30 different
occurrances in the shared pool. This query uses the idea it is common for literal
statements to begin
"SELECT col1,col2,col3 FROM table WHERE ..." with the leading portion of each
statement being the same.
--Avoid Invalidations
Some specific orders will change the state of cursors to INVALIDATE. These orders
modify directly
the context of related objects associated with cursors. That's orders are
TRUNCATE, ANALYZE or DBMS_STATS.GATHER_XXX
on tables or indexes, grants changes on underlying objects. The associated cursors
will stay in the SQLAREA but when it
will be reference next time, it should be reloaded and reparsed fully, so the
global performance will be impacted.
The following query could help us to better identify the concerned cursors:
-- SESSION_CACHED_CURSORS parameter
<Parameter:SESSION_CACHED_CURSORS> is a numeric parameter which can be set at
instance level or at session level
using the command:
ALTER SESSION SET session_cached_cursors = NNN;
The value NNN determines how many 'cached' cursors there can be in your session.
Whenever a statement is parsed Oracle first looks at the statements pointed to by
your private session cache -
if a sharable version of the statement exists it can be used. This provides a
shortcut access to frequently parsed
statements that uses less CPU and uses far fewer latch gets than a soft or hard
parse.
To get placed in the session cache the same statement has to be parsed 3 times
within the same cursor - a pointer to the
shared cursor is then added to your session cache. If all session cache cursors
are in use then the least recently
used entry is discarded.
If you do not have this parameter set already then it is advisable to set it to a
starting value of about 50.
The statistics section of the bstat/estat report includes a value for 'session
cursor cache hits' which shows
if the cursor cache is giving any benefit. The size of the cursor cache can then
be increased or decreased as necessary.
SESSION_CACHED_CURSORS are particularly useful with Oracle Forms applications when
forms are frequently opened and closed.
-- SHARED_POOL_RESERVED_SIZE parameter
There are quite a few notes explaining <Parameter:SHARED_POOL_RESERVED_SIZE>
already in circulation. The parameter
was introduced in Oracle 7.1.5 and provides a means of reserving a portion of the
shared pool for large memory allocations.
The reserved area comes out of the shared pool itself.
From a practical point of view one should set SHARED_POOL_RESERVED_SIZE to about
10% of SHARED_POOL_SIZE unless either
the shared pool is very large OR SHARED_POOL_RESERVED_MIN_ALLOC has been set lower
than the default value:
If the shared pool is very large then 10% may waste a significant amount of memory
when a few Mb will suffice.
If SHARED_POOL_RESERVED_MIN_ALLOC has been lowered then many space requests may be
eligible to be satisfied
from this portion of the shared pool and so 10% may be too little.
It is easy to monitor the space usage of the reserved area using the
<View:V$SHARED_POOL_RESERVED>
which has a column FREE_SPACE.
-- SHARED_POOL_RESERVED_MIN_ALLOC parameter
In Oracle8i this parameter is hidden.
SHARED_POOL_RESERVED_MIN_ALLOC should generally be left at its default value,
although in certain cases values
of 4100 or 4200 may help relieve some contention on a heavily loaded shared pool.
-- SHARED_POOL_SIZE parameter
<Parameter:SHARED_POOL_SIZE> controls the size of the shared pool itself. The size
of the shared pool can
impact performance. If it is too small then it is likely that sharable information
will be flushed from the pool
and then later need to be reloaded (rebuilt). If there is heavy use of literal SQL
and the shared pool is too large then
over time a lot of small chunks of memory can build up on the internal memory
freelists causing the shared pool latch
to be held for longer which in-turn can impact performance. In this situation a
smaller shared pool may perform better
than a larger one. This problem is greatly reduced in 8.0.6 and in 8.1.6 onwards
due to the enhancement in <bug:986149> .
NB: The shared pool itself should never be made so large that paging or swapping
occur as performance
can then decrease by many orders of magnitude.
-- _SQLEXEC_PROGRESSION_COST parameter (8.1.5 onwards)
This is a hidden parameter which was introduced in Oracle 8.1.5. The parameter is
included here as
the default setting has caused some problems with SQL sharability. Setting this
parameter to 0 can avoid these
issues which result in multiple versions statements in the shared pool.
Eg: Add the following to the init.ora file
# _SQLEXEC_PROGRESSION_COST is set to ZERO to avoid SQL sharing issues
_sqlexec_progression_cost=0
Note that a side effect of setting this to '0' is that the V$SESSION_LONGOPS view
is not populated by long running queries.
In Oracle9i, MTS was renamed to "Shared Server". For the purposes of the shared
pool, the behaviour is essentially the same.
Indeling SGA:
-------------
statistics:
-----------
Executions:
-----------
The values 40,5 and 30 are example values so this query is looking for
different statements whose first 40 characters are the same
which have only been executed a few times each and there are at least 30 different
occurrances in the shared pool. This query uses the idea it is common for literal
statements to begin
"SELECT col1,col2,col3 FROM table WHERE ..." with the leading portion of each
statement being the same.
V$SQLAREA:
SQL_TEXT
VARCHAR2(1000)
First thousand characters of the SQL text for the current cursor
SHARABLE_MEM
NUMBER
Amount of shared memory used by a cursor. If multiple child cursors exist, then
the sum of all
shared memory used by all child cursors.
PERSISTENT_MEM
NUMBER
Fixed amount of memory used for the lifetime of an open cursor. If multiple child
cursors exist,
the fixed sum of memory used for the lifetime of all the child cursors.
RUNTIME_MEM
NUMBER
Fixed amount of memory required during execution of a cursor. If multiple child
cursors exist,
the fixed sum of all memory required during execution of all the child cursors.
SORTS
NUMBER
Sum of the number of sorts that were done for all the child cursors
VERSION_COUNT
NUMBER
Number of child cursors that are present in the cache under this parent
LOADED_VERSIONS
NUMBER
Number of child cursors that are present in the cache and have their context heap
(KGL heap 6) loaded
OPEN_VERSIONS
NUMBER
The number of child cursors that are currently open under this current parent
USERS_OPENING
NUMBER
The number of users that have any of the child cursors open
FETCHES
NUMBER
Number of fetches associated with the SQL statement
EXECUTIONS
NUMBER
Total number of executions, totalled over all the child cursors
USERS_EXECUTING
NUMBER
Total number of users executing the statement over all child cursors
LOADS
NUMBER
The number of times the object was loaded or reloaded
FIRST_LOAD_TIME
VARCHAR2(19)
Timestamp of the parent creation time
INVALIDATIONS
NUMBER
Total number of invalidations over all the child cursors
PARSE_CALLS
NUMBER
The sum of all parse calls to all the child cursors under this parent
DISK_READS
NUMBER
The sum of the number of disk reads over all child cursors
BUFFER_GETS
NUMBER
The sum of buffer gets over all child cursors
ROWS_PROCESSED
NUMBER
The total number of rows processed on behalf of this SQL statement
COMMAND_TYPE
NUMBER
The Oracle command type definition
OPTIMIZER_MODE
VARCHAR2(10)
Mode under which the SQL statement is executed
PARSING_USER_ID
NUMBER
The user ID of the user that has parsed the very first cursor under this parent
PARSING_SCHEMA_ID
NUMBER
The schema ID that was used to parse this child cursor
KEPT_VERSIONS
NUMBER
The number of child cursors that have been marked to be kept using the
DBMS_SHARED_POOL package
ADDRESS
RAW(4)
The address of the handle to the parent for this cursor
HASH_VALUE
NUMBER
The hash value of the parent statement in the library cache
MODULE
VARCHAR2(64)
Contains the name of the module that was executing at the time that the SQL
statement was first parsed as set
by calling DBMS_APPLICATION_INFO.SET_MODULE
MODULE_HASH
NUMBER
The hash value of the module that is named in the MODULE column
ACTION
VARCHAR2(64)
Contains the name of the action that was executing at the time that the SQL
statement was first parsed
as set by calling DBMS_APPLICATION_INFO.SET_ACTION
ACTION_HASH
NUMBER
The hash value of the action that is named in the ACTION column
SERIALIZABLE_ABORTS
NUMBER
Number of times the transaction fails to serialize, producing ORA-08177 errors,
totalled over all the child cursors
IS_OBSOLETE
VARCHAR2(1)
Indicates whether the cursor has become obsolete (Y) or not (N). This can happen
if the number of child cursors
is too large.
CHILD_LATCH
NUMBER
Child latch number that is protecting the cursor
V$SQL:
------
V$SQL lists statistics on shared SQL area without the GROUP BY clause and contains
one row for each child
of the original SQL text entered.
SHARABLE_MEM
NUMBER
Amount of shared memory used by this child cursor (in bytes)
PERSISTENT_MEM
NUMBER
Fixed amount of memory used for the lifetime of this child cursor (in bytes)
RUNTIME_MEM
NUMBER
Fixed amount of memory required during the execution of this child cursor
SORTS
NUMBER
Number of sorts that were done for this child cursor
LOADED_VERSIONS
NUMBER
Indicates whether the context heap is loaded (1) or not (0)
OPEN_VERSIONS
NUMBER
Indicates whether the child cursor is locked (1) or not (0)
USERS_OPENING
NUMBER
Number of users executing the statement
FETCHES
NUMBER
Number of fetches associated with the SQL statement
EXECUTIONS
NUMBER
Number of executions that took place on this object since it was brought into the
library cache
USERS_EXECUTING
NUMBER
Number of users executing the statement
LOADS
NUMBER
Number of times the object was either loaded or reloaded
FIRST_LOAD_TIME
VARCHAR2(19)
Timestamp of the parent creation time
INVALIDATIONS
NUMBER
Number of times this child cursor has been invalidated
PARSE_CALLS
NUMBER
Number of parse calls for this child cursor
DISK_READS
NUMBER
Number of disk reads for this child cursor
BUFFER_GETS
NUMBER
Number of buffer gets for this child cursor
ROWS_PROCESSED
NUMBER
Total number of rows the parsed SQL statement returns
COMMAND_TYPE
NUMBER
Oracle command type definition
OPTIMIZER_MODE
VARCHAR2(10)
Mode under which the SQL statement is executed
OPTIMIZER_COST
NUMBER
Cost of this query given by the optimizer
PARSING_USER_ID
NUMBER
User ID of the user who originally built this child cursor
PARSING_SCHEMA_ID
NUMBER
Schema ID that was used to originally build this child cursor
KEPT_VERSIONS
NUMBER
Indicates whether this child cursor has been marked to be kept pinned in the
cache using the DBMS_SHARED_POOL package
ADDRESS
RAW(4)
Address of the handle to the parent for this cursor
TYPE_CHK_HEAP
RAW(4)
Descriptor of the type check heap for this child cursor
HASH_VALUE
NUMBER
Hash value of the parent statement in the library cache
PLAN_HASH_VALUE
NUMBER
Numerical representation of the SQL plan for this cursor. Comparing one
PLAN_HASH_VALUE to another easily
identifies whether or not two plans are the same (rather than comparing the two
plans line by line).
CHILD_NUMBER
NUMBER
Number of this child cursor
MODULE
VARCHAR2(64)
Contains the name of the module that was executing at the time that the SQL
statement was first parsed,
which is set by calling DBMS_APPLICATION_INFO.SET_MODULE
MODULE_HASH
NUMBER
Hash value of the module listed in the MODULE column
ACTION
VARCHAR2(64)
Contains the name of the action that was executing at the time that the SQL
statement was first parsed,
which is set by calling DBMS_APPLICATION_INFO.SET_ACTION
ACTION_HASH
NUMBER
Hash value of the action listed in the ACTION column
SERIALIZABLE_ABORTS
NUMBER
Number of times the transaction fails to serialize, producing ORA-08177 errors,
per cursor
OUTLINE_CATEGORY
VARCHAR2(64)
If an outline was applied during construction of the cursor, then this column
displays the category
of that outline. Otherwise the column is left blank.
CPU_TIME
NUMBER
CPU time (in microseconds) used by this cursor for parsing/executing/fetching
ELAPSED_TIME
NUMBER
Elapsed time (in microseconds) used by this cursor for parsing/executing/fetching
OUTLINE_SID
NUMBER
Outline session identifier
CHILD_ADDRESS
RAW(4)
Address of the child cursor
SQLTYPE
NUMBER
Denotes the version of the SQL language used for this statement
REMOTE
VARCHAR2(1)
(Y/N) Identifies whether the cursor is remote mapped or not
OBJECT_STATUS
VARCHAR2(19)
Status of the cursor (VALID/INVALID)
LITERAL_HASH_VALUE
NUMBER
Hash value of the literals which are replaced with system-generated bind
variables and are to be matched,
when CURSOR_SHARING is used. This is not the hash value for the SQL statement. If
CURSOR_SHARING is not used,
then the value is 0.
LAST_LOAD_TIME
VARCHAR2(19)
IS_OBSOLETE
VARCHAR2(1)
Indicates whether the cursor has become obsolete (Y) or not (N). This can happen
if the number of child cursors
is too large.
CHILD_LATCH
NUMBER
Child latch number that is protecting the cursor
"Versions" of a statement occur where the SQL is character for character identical
but the underlying objects or binds
etc.. are different.
1.2 statistics:
---------------
- ANALYZE COMMAND:
- DBMS_UTILITY.ANALYZE_SCHEMA() procedure:
DBMS_UTILITY.ANALYZE_SCHEMA (
schema VARCHAR2,
method VARCHAR2,
estimate_rows NUMBER DEFAULT NULL,
estimate_percent NUMBER DEFAULT NULL,
method_opt VARCHAR2 DEFAULT NULL);
DBMS_UTILITY.ANALYZE_DATABASE (
method VARCHAR2,
estimate_rows NUMBER DEFAULT NULL,
estimate_percent NUMBER DEFAULT NULL,
method_opt VARCHAR2 DEFAULT NULL);
To exexcute:
exec DBMS_UTILITY.ANALYZE_SCHEMA('CISADM','COMPUTE');
You should next use the ANALYZE TABLE COMPUTE STATISTICS command
De WHERE clause of a query must use the 'leading column' of (one of the)
index(es):
Suppose an index 'indx1' exists on EMPLOYEE(city, state, zip)
The more tables are 'normalized', the higher the performance costs for
queries joining tables
declare
i number := 0;
cursor s1 is SELECT * FROM tab1 WHERE col1 = 'value1'
FOR UPDATE;
begin
for c1 in s1 loop
update tab1 set col1 = 'value2'
WHERE current of s1;
end loop;
commit;
end;
/
-- ------------------------------
declare
i number := 1000;
begin
while i>1 loop
insert into TEST
values (1, sysdate+i,'joop');
i := i - 1;
commit;
end loop;
commit;
end;
/
-- ------------------------------
declare
i number := 1;
j date;
k varchar2(10);
begin
while i<1000000 loop
j:=sysdate+i;
k:=TO_CHAR(SYSDATE+i,'DAY');
insert into TEST2
values (i,1, j, k,'joop');
i := i + 1;
commit;
end loop;
commit;
end;
/
-- ------------------------------
declare
i number := 1;
j date;
k varchar2(10);
l varchar2(10);
begin
while i<1000 loop
j:=sysdate+i;
k:=TO_CHAR(SYSDATE+i,'DAY');
l:=TO_CHAR(SYSDATE+i-1,'DAY');
insert into TEST3
(ID,DATUM,DAG,VORIG,NAME)
values (i, j, k, l,'joop');
i := i + 1;
commit;
end loop;
commit;
end;
/
Deze maakt ook gebruik van de PLAN_TABLE en de PLUSTRACE role moet bestaan.
Desgewenst kan het plustrce.sql script worden uitgevoerd (onder SYS).
- nested loop: 1 table is de driving table met full table scan of gebruik van
index,
en de tweede table wordt benadert m.b.v. een index van de
tweede table gebaseerd op de WHERE clause.
- merge join: als er geen bruikbare index is, worden alle rows opgehaald,
gesorteerd, en gejoined naar een resultset.
- Hash join: bepaalde init.ora parameters moeten aanwezig zijn
(HASH_JOIN_ENABLE=TRUE, HASH_AREA_SIZE= , of via
ALTER SESSION SET HASH_JOIN_ENABLED=TRUE).
Meestal zeer effectief bij joins van een kleine table met een grote table.
De kleine table is de driving table in memory en het vervolg is een algolritme
wat lijkt op de nested loop
Turn SQL tracing on in session 448. The trace information will get written to
user_dump_dest.
Init.ora:
Max_dump_file_size in OS blocks
SQL_TRACE=TRUE (kan zeer grote files opleveren, is voor alle sessions)
USER_DUMP_DEST= lokatie trace files
1.12 Indien de CBO niet het beste access path gebruikt: hints in query:
-----------------------------------------------------------------------
==============================================
3. Data dictonary queries m.b.t perfoRMANce:
==============================================
V$FILESTAT, V$DATAFILE
SELECT
substr(DF.Name, 1, 6) Drive,
DF.Name File_Name,
FS.Phyblkrd+FS.Phyblkwrt Total_IO,
100*(FS.Phyblkrd+FS.Phyblkwrt) / MaxIO Weight
FROM V$FILESTAT FS, V$DATAFILE DF,
(SELECT MAX(Phyblkrd+Phyblkwrt) MaxIO FROM V$FILESTAT)
WHERE
DF.File#=FS.File#
ORDER BY Weight desc
/
SELECT *
FROM SYS.X$KSPPI
WHERE SUBSTR(KSPPINM,1,1) = '_';
Kijk in
DBA_TAB_COLUMNS.NUM_DISTINCT
DBA_TABLES.NUM_ROWS
SELECT (1-(pr.value/(dbg.value+cg.value)))*100
FROM v$sysstat pr, v$sysstat dbg, v$sysstat cg
WHERE pr.name = 'physical reads'
AND dbg.name = 'db block gets'
AND cg.name = 'consistent gets';
CLEAR
SET HEAD ON
SET VERIFY OFF
set pagesize 23
set pause on
set pause 'Hit any key...'
SQL>
========================================================
4. IMP and EXP, IMPDP and EXPDP, and SQL*Loader Examples
========================================================
SELECT
owner_name
,job_name
,operation
,job_mode
,state
,degree
,attached_sessions
FROM dba_datapump_jobs
;
SELECT
DPS.owner_name
,DPS.job_name
,S.osuser
FROM
dba_datapump_sessions DPS
,v$session S
WHERE S.saddr = DPS.saddr
;
JOB_NAME=NightlyDRExport
DIRECTORY=export_dir
DUMPFILE=export_dir:fulldb_%U.dmp
LOGFILE=export_dir:NightlyDRExport.explog
FULL=Y
PARALLEL=2
FILESIZE=650M
CONTENT=ALL
STATUS=30
ESTIMATE_ONLY=Y
JOB_NAME=EstimateOnly
DIRECTORY=export_dir
LOGFILE=export_dir:EstimateOnly.explog
FULL=Y
CONTENT=DATA_ONLY
ESTIMATE=STATISTICS
ESTIMATE_ONLY=Y
STATUS=60
Example 3. EXPDP parfile, only 1 schema, writing to multiple files with %U
variable, limited to 650M
----------------------------------------------------------------------------------
------------
JOB_NAME=SH_TABLESONLY
DIRECTORY=export_dir
DUMPFILE=export_dir:SHONLY_%U.dmp
LOGFILE=export_dir:SH_TablesOnly.explog
SCHEMAS=SH
PARALLEL=2
FILESIZE=650M
STATUS=60
JOB_NAME=HR_PAYROLL_REFRESH
DIRECTORY=export_dir
DUMPFILE=export_dir:HR_PAYROLL_REFRESH_%U.dmp
LOGFILE=export_dir:HR_PAYROLL_REFRESH.explog
STATUS=20
FILESIZE=132K
CONTENT=ALL
TABLES=HR.EMPLOYEES,HR.DEPARTMENTS,HR.PAYROLL_CHECKS,HR.PAYROLL_HOURLY,HR.PAYROLL_
SALARY,HR.PAYROLL_TRANSACTIONS
JOB_NAME=HREXPORT
DIRECTORY=export_dir
DUMPFILE=export_dir:HREXPORT_%U.dmp
LOGFILE=export_dir:2005-04-10_HRExport.explog
SCHEMAS=HR
CONTENTS=ALL
FLASHBACK_TIME=TO_TIMESTAMP"('04-10-2005 23:59', 'MM-DD-YYYY HH24:MI')"
Example 6. IMPDP parfile, Imports data +only+ into selected tables in the HR
schema, Multiple dump files will be used
----------------------------------------------------------------------------------
------------------------------------
JOB_NAME=HR_PAYROLL_IMPORT
DIRECTORY=export_dir
DUMPFILE=export_dir:HR_PAYROLL_REFRESH_%U.dmp
LOGFILE=export_dir:HR_PAYROLL_IMPORT.implog
STATUS=20
TABLES=HR.PAYROLL_CHECKS,HR.PAYROLL_HOURLY,HR.PAYROLL_SALARY,HR.PAYROLL_TRANSACTIO
NS
CONTENT=DATA_ONLY
TABLE_EXISTS_ACTION=TRUNCATE
Example 7. IMPDP parfile,3 tables in the SH schema are the only tables to be
refreshed,These tables will be truncated before loading
----------------------------------------------------------------------------------
----------------------------------------------
DIRECTORY=export_dir
JOB_NAME=RefreshSHTables
DUMPFILE=export_dir:fulldb_%U.dmp
LOGFILE=export_dir:RefreshSHTables.implog
STATUS=30
CONTENT=DATA_ONLY
SCHEMAS=SH
INCLUDE=TABLE:"IN('COUNTRIES','CUSTOMERS','PRODUCTS','SALES')"
TABLE_EXISTS_ACTION=TRUNCATE
DIRECTORY=export_dir
JOB_NAME=GenerateImportDDL
DUMPFILE=export_dir:hr_payroll_refresh_%U.dmp
LOGFILE=export_dir:GenerateImportDDL.implog
SQLFILE=export_dir:GenerateImportDDL.sql
INCLUDE=TABLE
BEGIN
DBMS_SCHEDULER.CREATE_JOB (
job_name => 'HR_EXPORT'
,job_type => 'PLSQL_BLOCK'
,job_action => 'BEGIN HR.SP_EXPORT;END;'
,start_date => '04/18/2005 23:00:00.000000'
,repeat_interval => 'FREQ=DAILY'
,enabled => TRUE
,comments => 'Performs HR Schema Export nightly at 11 PM'
);
END;
/
======================================
How to use the NETWORK_LINK paramater:
======================================
Note 1:
=======
To effectively implement the data mart approach, the data specialists must get
data into the data marts quickly and efficiently.
The challenge the team faces is figuring out how to quickly refresh the warehouse
data to the data marts, which run on
heterogeneous platforms. And that's why Lora is at the meeting. What options does
she propose for moving the data?
An experienced and knowledgeable DBA, Lora provides the meeting attendees with
three possibilities, as follows:
Transportable Tablespaces:
Lora starts by describing the transportable tablespaces option. The quickest way
to transport an entire tablespace to
a target system is to simply transfer the tablespace's underlying files, using FTP
(file transfer protocol)
or rcp (remote copy).
However, just copying the Oracle data files is not sufficient; the target database
must recognize and import the files
and the corresponding tablespace before the tablespace data can become available
to end users.
Using transportable tablespaces
involves copying the tablespace files and making the data available in the target
database.
A few checks are necessary before this option can be considered. First, for a
tablespace TS1 to be transported to a
target system,
it must be self-contained. That is, all the indexes, partitions, and other
dependent segments of the tables in the tablespace
must be inside the tablespace. Lora explains that if a set of tablespaces contains
all the dependent segments,
the set is considered
to be self-contained. For instance, if tablespaces TS1 and TS2 are to be
transferred as a set and a table in TS1 has
an index in TS2, the tablespace set is self-contained. However, if another index
of a table in TS1 is in tablespace TS3,
the tablespace set (TS1, TS2) is not self-contained.
To transport the tablespaces, Lora proposes using the Data Pump Export utility in
Oracle Database 10g. Data Pump is Oracle's
next-generation data transfer tool, which replaces the earlier Oracle Export (EXP)
and Import (IMP) tools.
Unlike those older tools, which use regular SQL to extract and insert data, Data
Pump uses proprietary APIs that bypass
the SQL buffer, making the process extremely fast. In addition, Data Pump can
extract specific objects, such as a particular
stored procedure or a set of tables from a particular tablespace. Data Pump Export
and Import are controlled by jobs,
which the DBA can pause, restart, and stop at will.
Lora has run a test before the meeting to see if Data Pump can handle Acme's
requirements. Lora's test transports the
TS1 and TS2 tablespaces as follows:
1. Check that the set of TS1 and TS2 tablespaces is self- contained. Issue the
following command:
BEGIN
SYS.DBMS_TTS.TRANSPORT_SET_CHECK ('TS1','TS2');
END;
no rows selected
SELECT STATUS
FROM DBA_TABLESPACES
WHERE TABLESPACE_NAME IN ('TS1','TS2');
STATUS
---------
READ ONLY
READ ONLY
4. Transfer the data files of each tablespace to the remote system, into the
directory /u01/oradata,
using a transfer mechanism such as FTP or rcp.
5. In the target database, create a database link to the source database (named
srcdb in the line below).
6. In the target database, import the tablespaces into the database, using Data
Pump Import.
impdp lora/lora123
TRANSPORT_DATAFILES="'/u01/oradata/ts1_1.dbf','/u01/oradata/ts2_1.dbf'"
NETWORK_LINK='srcdb'
TRANSPORT_TABLESPACES=\(TS1,TS2\)
NOLOGFILE=Y
This step makes the TS1 and TS2 tablespaces and their data available in the target
database.
Note that Lora doesn't export the metadata from the source database. She merely
specifies the value srcdb,
the database link to the source database, for the parameter NETWORK_LINK in the
impdp command above.
Data Pump Import fetches the necessary metadata from the source across the
database link and re-creates it in the target.
7. Finally, make the TS1 and TS2 tablespaces in the source database read-write.
Note 2:
=======
The NETWORK_LINK parameter initiates a network import. This means that the impdp
client initiates the import request,
typically to the local database. That server contacts the remote source database
referenced by the database link
in the NETWORK_LINK parameter, retrieves the data, and writes it directly back to
the target database.
There are no dump files involved.
In the following example, the source_database_link would be replaced with the name
of a valid database link
that must already exist.
In all Oracle versions 7,8,8i,9i,10g you can use the exp and imp utilities.
c:\> cd [oracle_db_home]\bin
c:\> set nls_lang=american_america.WE8ISO8859P15
# export NLS_LANG=AMERICAN_AMERICA.UTF8
# export NLS_LANG=AMERICAN_AMERICA.AL32UTF8
FROM Oracle8i one can use the QUERY= export parameter to SELECTively unload a
subset of the data FROM a table.
Look at this example:
exp scott/tiger tables=emp query=\"WHERE deptno=10\"
The Export utility is used to export the metadata describing the objects contained
in the transported tablespace.
For our example scenario, the Export command could be:
This operation will generate an export file, jan_sales.dmp. The export file will
be small, because it contains
only metadata. In this case, the export file will contain information describing
the table temp_jan_sales,
such as the column names, column datatype, and all other information that the
target Oracle database will need
in order to access the objects in ts_temp_sales.
$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$
$
Extended example:
-----------------
CASE 1:
=======
We create a user Albert on a 10g DB. This user will create a couple of tables
with referential constraints (PK-FK relations). Then we will export this user,
drop the user, and do an import. See what we have after the import.
-- User:
create user albert identified by albert
default tablespace ts_cdc
temporary tablespace temp
QUOTA 10M ON sysaux
QUOTA 20M ON users
QUOTA 50M ON TS_CDC
;
-- GRANTS:
GRANT create session TO albert;
GRANT create table TO albert;
GRANT create sequence TO albert;
GRANT create procedure TO albert;
GRANT connect TO albert;
GRANT resource TO albert;
-- connect albert/albert
-- create tables
-- show constraints:
-- make an export
C:\oracle\expimp>
See above
-- do the import
C:\oracle\expimp>
- connect albert/albert
7 rows selected.
LOCID CITY
---------- ----------------
1 Amsterdam
2 Haarlem
3
4 Utrecht
-- show constraints:
CASE 2:
=======
We are not going to drop the user, but empty the tables:
-- do the import
So the data gets imported, but we have a problem with the FOREIGN KEYS:
SQL>
$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$
$$$$$$$$$$$$$$$$$$$$
What is exported?:
------------------
Example:
--------
D:\temp>
Can one export to multiple files?/ Can one beat the Unix 2 Gig limit?
---------------------------------------------------------------------
Use the following technique if you use an Oracle version prior to 8i:
Error 1:
--------
3. Other fix:
Error 2:
--------
Hi. This warning is generated because the statistics are questionable due to the
client character set difference from the server character set.
There is an article which discusses the causes of questionable statistics
available
via the MetaLink Advanced Search option by Doc ID:
Doc ID: 159787.1 9i: Import STATISTICS=SAFE
If you do not want this conversion to occur, you need to ensure the client NLS
environment
performing the export is set to match the server.
Fix ~~~~
a) If the statistics of a table are not required to include in export
take the export with parameter STATISTICS=NONE
Example: $exp scott/tiger file=emp1.dmp tables=emp STATISTICS=NONE
b) In case, the statistics are need to be included can use
STATISTICS=ESTIMATE or COMPUTE (default is Estimate).
Error 3:
--------
ERRORS
------
SYMPTOMS
--------
A schema level export with the 9.2.0.4 export utility from a 9.2.0.4 or higher
release database in which XDB has been installed, fails when exporting
the cluster definitions with:
...
. exporting cluster definitions
EXP-00056: ORACLE error 1403 encountered
ORA-01403: no data found
EXP-00000: Export terminated unsuccessfully
You can confirm that XDB has been installed in the database:
SQL> SELECT substr(comp_id,1,15) comp_id, status, substr(version,1,10) version,
substr(comp_name,1,30) comp_name FROM dba_registry ORDER BY 1;
SQL> ALTER SYSTEM SET EVENTS '1403 trace name errorstack off';
System altered.
The trace file that was written to your USER_DUMP_DEST directory, shows:
You can confirm that you have no invalid XDB objects in the database:
no rows selected
Note: If you do have invalid XDB objects, and the same ORA-1403 error occurs
when performing a full database export, see the solution mentioned in:
[NOTE:255724.1] <ml2_documents.showDocument?p_id=255724.1&p_database_id=NOT>
CHANGES
-------
You recently restored the database from a backup or you recreated the
controlfile, or you performed Operating System actions on your database
tempfiles.
CAUSE
-----
Note that the errors are different when exporting with a 9.2.0.3 or earlier
export utility:
The errors are also different when exporting with a 9.2.0.5 or later export
utility:
FIX
---
or:
If the controlfile has a reference to the tempfile(s), but the files are
missing on disk, re-create the temporary tablespace, e.g.:
Other errors:
-------------
GENERIC
=======
Question: What is actually happening when I export and import data?
See Note 61949.1 </metalink/plsql/showdoc?db=NOT&id=61949.1> "Overview
of Export and Import in Oracle7"
COMPATIBILITY
=============
Question: Which version should I use when moving data between different database
releases?
See Note 132904.1 </metalink/plsql/showdoc?db=NOT&id=132904.1>
"Compatibility Matrix for Export & Import Between Different Oracle Versions"
See Note 291024.1 </metalink/plsql/showdoc?db=NOT&id=291024.1>
"Compatibility and New Features when Transporting Tablespaces with Export and
Import"
See Note 76542.1 </metalink/plsql/showdoc?db=NOT&id=76542.1> "NT:
Exporting from Oracle8, Importing Into Oracle7"
Question: How to resolve the IMP-69 error when importing into a database?
See Note 163334.1 </metalink/plsql/showdoc?db=NOT&id=163334.1> "Import
Gets IMP-00069 when Importing 8.1.7 Export"
See Note 1019280.102 </metalink/plsql/showdoc?db=NOT&id=1019280.102>
"IMP-69 on Import"
PARAMETERS
==========
Question: What is the difference between a Direct Path and a Conventional Path
Export?
See Note 155477.1 </metalink/plsql/showdoc?db=NOT&id=155477.1>
"Parameter DIRECT: Conventional Path Export versus Direct Path Export"
Question: What is the meaning of the Export parameter CONSISTENT=Y and when should
I use it?
See Note 113450.1 </metalink/plsql/showdoc?db=NOT&id=113450.1> "When to
Use CONSISTENT=Y During an Export"
Question: How to use the Oracle8i/9i Export parameter QUERY=... and what does it
do?
See Note 91864.1 </metalink/plsql/showdoc?db=NOT&id=91864.1> "Query=
Syntax in Export in 8i"
See Note 277010.1 </metalink/plsql/showdoc?db=NOT&id=277010.1> "How to
Specify a Query in Oracle10g Export DataPump and Import DataPump"
Question: How to create multiple export dumpfiles instead of one large file?
See Note 290810.1 </metalink/plsql/showdoc?db=NOT&id=290810.1>
"Parameter FILESIZE - Make Export Write to Multiple Export Files"
PERFORMANCE
===========
Question: Import takes so long to complete. How can I improve the performance of
Import?
See Note 93763.1 </metalink/plsql/showdoc?db=NOT&id=93763.1> "Tuning
Considerations when Import is slow"
Question: Why has export performance decreased after creating tables with LOB
columns?
See Note 281461.1 </metalink/plsql/showdoc?db=NOT&id=281461.1> "Export
and Import of Table with LOB Columns (like CLOB and BLOB) has Slow Performance"
LARGE FILES
===========
Question: Which commands to use for solving Export dump file problems on UNIX
platforms?
See Note 30528.1 </metalink/plsql/showdoc?db=NOT&id=30528.1> "QREF:
Export/Import/SQL*Load Large Files in Unix - Quick Reference"
Question: How to solve the EXP-15 and EXP-2 errors when Export dump file is larger
than 2Gb?
See Note 62427.1 </metalink/plsql/showdoc?db=NOT&id=62427.1> "2Gb or Not
2Gb - File limits in Oracle"
See Note 1057099.6 </metalink/plsql/showdoc?db=NOT&id=1057099.6> "Unable
to export when export file grows larger than 2GB"
See Note 290810.1 </metalink/plsql/showdoc?db=NOT&id=290810.1>
"Parameter FILESIZE - Make Export Write to Multiple Export Files"
ORA-942
=======
Question: How to resolve an ORA-942 during import of the ORDSYS schema?
See Note 109576.1 </metalink/plsql/showdoc?db=NOT&id=109576.1> "Full
Import shows Errors when adding Referential Constraint on Cartrige Tables"
NLS
===
Question: Which effect has the client's NLS_LANG setting on an export and import?
See Note 227332.1 </metalink/plsql/showdoc?db=NOT&id=227332.1> "NLS
considerations in Import/Export - Frequently Asked Questions"
See Note 15656.1 </metalink/plsql/showdoc?db=NOT&id=15656.1>
"Export/Import and NLS Considerations"
INTERMEDIA OBJECTS
==================
Question: How to solve an EXP-78 when exporting metadata for an interMedia Text
index?
See Note 130080.1 </metalink/plsql/showdoc?db=NOT&id=130080.1> "Problems
with EXPORT after upgrading from 8.1.5 to 8.1.6"
Question: I dropped the ORDSYS schema, but now I get ORA-6550 and PLS-201 when
exporting?
See Note 120540.1 </metalink/plsql/showdoc?db=NOT&id=120540.1> "EXP-8
PLS-201 After Drop User ORDSYS"
REPLICATION OBJECTS
===================
Question: How to resolve import errors on DBMS_IJOB.SUBMIT for Replication jobs?
See Note 137382.1 </metalink/plsql/showdoc?db=NOT&id=137382.1> "IMP-3,
PLS-306 Unable to Import Oracle8i JobQueues into Oracle8"
Question: How to reorganize Replication base tables with Export and Import?
See Note 1037317.6 </metalink/plsql/showdoc?db=NOT&id=1037317.6> "Move
Replication System Tables using Export/Import for Oracle 8.X"
Possible causes are file systems that do not support a certain limit (eg. dump
file size > 2Gb) or a disk/filesystem that ran out of space.
EXP-00067: "Direct path cannot export %s which contains object or lob data."
Note 1048461.6 </metalink/plsql/showdoc?db=NOT&id=1048461.6> "EXP-00067
PERFORMING DIRECT PATH EXPORT"
EXP-00079: Data in table %s is protected (EXP-79)
Note 277606.1 </metalink/plsql/showdoc?db=NOT&id=277606.1> "How to
Prevent EXP-00079 or EXP-00080 Warning (Data in Table xxx is Protected) During
Export"
IMP-00016: Required character set conversion (type %lu to %lu) not supported
Note 168066.1 </metalink/plsql/showdoc?db=NOT&id=168066.1> "IMP-16 When
Importing Dumpfile into a Database Using Multibyte Characterset"
ORA-04030: Out of process memory when trying to allocate %s bytes (%s,%s) (IMP-3
ORA-4030 ORA-3113)
Note 165016.1 </metalink/plsql/showdoc?db=NOT&id=165016.1> "Corrupt
Packages When Export/Import Wrapper PL/SQL Code"
PLS-00103: Encountered the symbol "," when expecting one of the following ...
(IMP-17 IMP-3 ORA-6550 PLS-103)
Note 123355.1 </metalink/plsql/showdoc?db=NOT&id=123355.1> "IMP-17 and
IMP-3 errors referring dbms_stats package during import"
Note 278937.1 </metalink/plsql/showdoc?db=NOT&id=278937.1> "Import
DataPump: ORA-39083 and PLS-103 when Importing Statistics Created with Non "." NLS
Decimal Character"
to call sqlloader
Example 1:
----------
BONUS.PAR:
userid=scott
control=bonus.ctl
bad=bonus.bad
log=bonus.log
discard=bonus.dis
rows=2
errors=2
skip=0
BONUS.CTL:
LOAD DATA
INFILE bonus.dat
APPEND
INTO TABLE BONUS
(name position(01:08) char,
city position(09:19) char,
salary position(20:22) integer external)
Example 2:
----------
LOAD1.CTL:
LOAD DATA
INFILE 'PLAYER.TXT'
INTO TABLE BASEBALL_PLAYER
FIELDS TERMINATED BY ',' OPTIONALLY ENCLOSED BY '"'
(player_id,last_name,first_name,middle_initial,start_date)
LOAD DATA
INFILE 'SMSSOFT.TXT'
TRUNCATE
INTO TABLE SMSSOFTWARE
FIELDS TERMINATED BY ',' OPTIONALLY ENCLOSED BY '"'
(DWMACHINEID, SERIALNUMBER, NAME, SHORTNAME, SOFTWARE, CMDB_ID, LOGONNAME)
LOAD DATA
INFILE *
BADFILE 'd:\stage\loader\load.bad'
DISCARDFILE 'd:\stage\loader\load.dsc'
APPEND
INTO TABLE TEST
FIELDS TERMINATED BY "<tab>" TRAILING NULLCOLS
(
c1,
c2 char,
c3 date(8) "DD-MM-YY"
)
BEGINDATA
1<tab>X<tab>25-12-00
2<tab>Y<tab>31-12-00
Note: The <tab> placeholder is only for illustration purposes, in the acutal
implementation,
one would use a real tab character which is not visible.
Example 5:
----------
The following shows the control file (sh_sales.ctl) loading the sales table:
set copycommit 1
set arraysize 1000
copy FROM HR/PASSWORD@loc -
create EMPLOYEE -
using
SELECT * FROM employee -
WHERE state='NM'
=======================================================
5. Add, Move AND Size Datafiles, tablespaces, logfiles:
=======================================================
ADD:
----
alter database
add logfile group 4
('/db01/oracle/CC1/log_41.dbf', '/db02/oracle/CC1/log_42.dbf') size 5M;
ALTER DATABASE
ADD LOGFILE ('/oracle/dbs/log1c.rdo', '/oracle/dbs/log2c.rdo') SIZE 500K;
ALTER DATABASE
ADD LOGFILE ('/oracle/dbs/log1c.rdo', '/oracle/dbs/log2c.rdo') SIZE 500K;
ALTER DATABASE
ADD LOGFILE ('G:\ORADATA\AIRM\REDO05.LOG') SIZE 20M;
DROP:
-----
-An instance requires at least two groups of online redo log files,
regardless of the number of members in the groups. (A group is one or more
members.)
-You can drop an online redo log group only if it is inactive.
If you need to drop the current group, first force a log switch to occur.
alter database
add logfile member '/db03/oracle/CC1/log_3c.dbf' to group 4;
LOGFILE
GROUP 1 '/u01/oradata/redo01.log'SIZE 10M,
GROUP 2 '/u02/oradata/redo02.log'SIZE 10M,
GROUP 3 '/u03/oradata/redo03.log'SIZE 10M,
GROUP 4 '/u04/oradata/redo04.log'SIZE 10M
LOGFILE
GROUP 1 ('/u01/oradata/redo1a.log','/u05/oradata/redo1b.log') SIZE 10M,
GROUP 2 ('/u02/oradata/redo2a.log','/u06/oradata/redo2b.log') SIZE 10M,
GROUP 3 ('/u03/oradata/redo3a.log','/u07/oradata/redo3b.log') SIZE 10M,
GROUP 4 ('/u04/oradata/redo4a.log','/u08/oradata/redo4b.log') SIZE 10M
-- Related Queries
View information on log files
SELECT *
FROM gv$log;
This statement overcomes two situations where dropping redo logs is not possible:
If there are only two log groups The corrupt redo log file
belongs to the current group.
-- Use this version of clearing a log file if the corrupt log file has not been
archived.
ALTER DATABASE CLEAR UNARCHIVED LOGFILE GROUP 3;
SELECT member
FROM v_$logfile;
SHUTDOWN;
host
$ cp /u03/logs/log1a.log /u04/logs/log1a.log
$ cp /u03/logs/log1b.log /u05/logs/log1b.log
$ exit
startup mount
host
$ rm /u03/logs/log1a.log
$ rm /u03/logs/log1b.log
$ exit
SELECT member
FROM v_$logfile;
Drop a redo log file group ALTER DATABASE DROP LOGFILE GROUP <group_number>;
ALTER DATABASE DROP LOGFILE GROUP 4;
or
SELECT SYSDATE
FROM dual;
COMMIT;
conn / as sysdba
Stop log file archiving The following is undocumented and unsupported and should
be used only with great care and following through tests. One might consider this
for loading a data warehouse. Be sure to restart logging as soon as the load is
complete or the system will be at extremely high risk.
The rest of the database remains unchanged. The buffer cache works in exactly the
same way, old buffers get overwritten, old dirty buffers get written to disk. It's
just the process of physically flushing the redo buffer that gets disabled.
SHUTDOWN;
alter database
datafile '/db05/oracle/CC1/data01.dbf' rezise 400M; (increase or decrease size)
alter database
datafile '/db05/oracle/CC1/data01.dbf'
autoextend ON
maxsize unlimited;
The AUTOEXTEND option cannot be turned OFF at for the entire tablespace with
a single command. Each datafile within the tablespace must explicitly turn off
the AUTOEXTEND option via the ALTER DATABASE command.
+447960585647
connect internal
shutdown
mv /db01/oracle/CC1/data01.dbf /db02/oracle/CC1
connect / as SYSDBA
startup mount CC1
connect internal
shutdown
mv /db05/oracle/CC1/redo01.dbf /db02/oracle/CC1
connect / as SYSDBA
startup mount CC1
in case of problems:
example:
--------
shutdown immediate
op Unix:
mv /u01/oradata/spltst1/redo01.log /u02/oradata/spltst1/
mv /u03/oradata/spltst1/redo03.log /u02/oradata/spltst1/
-- autoallocate:
----------------
We can have a locally managed tablespace, but the segment space management,
via the free lists and the pct_free and pct_used parameters,
be still used manually.
To specify manual space management, use the SEGMENT SPACE MANAGEMENT MANUAL clause
-- temporary tablespace:
------------------------
1 /u03/oradata/bcict2/temp.dbf
2 /u03/oradata/bcict2/temp01.dbf
3 /u03/oradata/bcict2/temp02.dbf
The extent management clause is optional for temporary tablespaces because all
temporary tablespaces
are created with locally managed extents of a uniform size. The Oracle default for
SIZE is 1M.
But if you want to specify another value for SIZE, you can do so as shown in the
above statement.
or:
If the controlfile has a reference to the tempfile(s), but the files are
missing on disk, re-create the temporary tablespace, e.g.:
-- undo tablespace:
-- ----------------
-- ROLLBACK TABLESPACE:
-- --------------------
##################################################################################
#####
More info:
----------
Used extents, on the other hand, are recorded in the data dictionary table
sys.uet$, which is clustered in the
C_FILE#_BLOCK# cluster. Unlike the C_TS# cluster, C_FILE#_BLOCK# is sized on the
assumption that segments
will have an average of just 4 or 5 extents each. Unless your data dictionary was
specifically
customized prior to database creation to allow for more used extents per segment,
then creating segments
with thousands of extents (like mentioned in the previous section) will cause
excessive cluster block chaining
in this cluster. The major dilemma with an excessive number of used and/or free
extents is that they can
misrepresent the operations of the dictionary cache LRU mechanism. Extents should
therefore not be allowed to grow
into the thousands, not because of the impact of full table scans, but rather the
performance of the data dictionary
and dictionary cache.
Keep in mind though, that this information is not cached in the dictionary cache.
It must be obtained from the
database block every time that it is required, and if those blocks are not in the
buffer cache,
that involves I/O and potentially lots of it. Take for example a query against
DBA_EXTENTS. This query would
be required to read every segment header and every additional extent map block in
the entire database.
It is for this reason that it is recommended that the number of extents per
segment in locally managed tablespaces
be limited to the number of rows that can be contained in the extent map with the
segment header block.
This would be approximately - (db_block_size / 16) - 7. For a database with a db
block size of 8K,
the above formula would be 505 extents.
declare
var1 number;
var2 number;
var3 number;
var4 number;
var5 number;
var6 number;
var7 number;
begin
dbms_space.unused_space('AUTOPROV1', 'MACADDRESS_INDEX', 'INDEX',
var1, var2, var3, var4, var5, var6, var7);
dbms_output.put_line('OBJECT_NAME = NOG ZON SLECHTE INDEX');
dbms_output.put_line('TOTAL_BLOCKS ='||var1);
dbms_output.put_line('TOTAL_BYTES ='||var2);
dbms_output.put_line('UNUSED_BLOCKS ='||var3);
dbms_output.put_line('UNUSED_BYTES ='||var4);
dbms_output.put_line('LAST_USED_EXTENT_FILE_ID ='||var5);
dbms_output.put_line('LAST_USED_EXTENT_BLOCK_ID ='||var6);
dbms_output.put_line('LAST_USED_BLOCK ='||var7);
end;
/
ALTER a COLUMN:
===============
In situations where you have B*-tree index leaf blocks that can be freed up for
reuse, you can merge
those leaf blocks using the following statement:
-- Dropping an index:
example:
create public synonym EMPLOYEE for HARRY.EMPLOYEE;
SELECT name FROM scott.emp@foo; # link name different FROM global name
Oracle lets you create synonyms so that you can hide the database link name FROM
the user.
A synonym allows access to a table on a remote database using the same syntax that
you would use
to access a table on a local database. For example, assume you issue the following
query
against a table in a remote database:
TO FIND OBJECTS:
To create a package body we now specify each PL/SQL block that makes up the
package,
note that we are not creating these blocks separately (no CREATE OR REPLACE is
required for the procedure and function definitions). An example follows :-
SELECT text
FROM sys.dba_views
WHERE view_name = 'CONTROL_PLAZA_V';
CREATE VIEW X
AS
SELECT * FROM gebruiker@aptest
Dynamic queries:
----------------
- Do the query:
Sequences are database objects from which multiple users can generate unique
integers.
You can use sequences to automatically generate primary key values.
While the interMedia and cartridge schemas can be recreated by running their
associated
scripts as needed, I am not 100% on the steps associated with the MTSSYS user.
Unfortunately, the OUTLN user is created at database creation time when sql.bsq is
run.
The OUTLN user owns the package OUTLN_PKG which is used to manage stored outlines
and their outline categories.
There are other tables (base tables), indexes, grants, and synonyms related to
this package.
6: Install on Solaris
7: Install on Linux
8: Install on OpenVMS
9: Install on AIX
==================================
6.1. Install Oracle 92 on Solaris:
==================================
6.1 Tutorial 1:
===============
--------------------------------------------------------------------------------
The following, short Installation Guide shows how to install Oracle 9.2.0 for SUN
Solaris 8.
You may download our scripts to create a database, we suggest this way and NOT
using DBASSIST. Besides this scripts,
you can download our SQLNET configuration files TNSNAMES.ORA. LISTENER.ORA and
SQLNET.ORA.
For our installation, we used the following ORACLE_HOME and ORACLE_SID, please
adjust these parameters
for your own environment.
ORACLE_HOME = /opt/oracle/product/9.2.0
ORACLE_SID = TYP2
--------------------------------------------------------------------------------
To determine the amount of RAM memory installed on your system, enter the
following command.
$ /usr/sbin/prtconf
To determine the amount of SWAP installed on your system, enter the following
command and multiply
the BLOCKS column by 512.
$ swap -l
$ uname -a
$ showrev -p
$ pkginfo -i [package_name]
$ xclock
Each of the four commands above should point to the /usr/ccs/bin directory. If
not, add /usr/ccs/bin to the
beginning of the PATH environment variable in the current shell.
The JRE shipped with Oracle9i is used by Oracle Java applications such as the
Oracle Universal Installer
is the only one supported. You should not modify this JRE, unless it is done
through a patch provided by
Oracle Support Services. The inventory can contain multiple versions of the JRE,
each of which can be used
by one or more products or releases. The Installer creates the oraInventory
directory
the first time it is run to keep an inventory of products that it installs on your
system as well as other
installation information. The location of oraInventory is defined in
/var/opt/oracle/oraInst.loc.
Products in an ORACLE_HOME access the JRE through a symbolic link in
$ORACLE_HOME/JRE to the actual location
of a JRE within the inventory. You should not modify the symbolic link.
Oracle9i includes native support for files greater than 2 GB. Check your shell to
determine
whether it will impose a limit.
The file (blocks) value should be multiplied by 512 to obtain the maximum file
size imposed by the shell.
A value of unlimited is the operating system default and is the maximum value of 1
TB.
Set to the sum of the PROCESSES parameter for each Oracle database, adding the
largest one twice, then add
an additional 10 for each database.
For example, consider a system that has three Oracle instances with the PROCESSES
parameter
in their initSID.ora files set to the following values:
ORACLE_SID=TYP1, PROCESSES=100
ORACLE_SID=TYP2, PROCESSES=100
ORACLE_SID=TYP3, PROCESSES=200
The value of SEMMNS is calculated as follows:
Setting parameters too high for the operating system can prevent the machine from
booting up.
Refer to Sun Microsystems Sun SPARC Solaris system administration documentation
for parameter limits.
*
* Kernel Parameters on our SUN Enterprise with 640MB for Oracle 9
*
set shmsys:shminfo_shmmax=4294967295
set shmsys:shminfo_shmmin=1
set shmsys:shminfo_shmmni=100
set shmsys:shminfo_shmseg=10
set semsys:seminfo_semmni=100
set semsys:seminfo_semmsl=100
set semsys:seminfo_semmns=2500
set semsys:seminfo_semopm=100
set semsys:seminfo_semvmx=32767
-- remarks:
The parameter for shared memory (shminfo_shmmax) can be set to the maximum
value; it will not impact Solaris in any way.
The values for semaphores (seminfo_semmni and seminfo_semmns) depend on the
number of clients you want to collect
data from.
As a rule of the thumb, the values should be set to at least (2*nr of clients +
15).
You will have to reboot the system after making changes to the /etc/system file.
Solaris doesn't automatically allocate shared memory, unless you specify the
value in /etc/system and reboot.
Were I you, i'd put in lines in /etc/system that look something like this:
only the first value is *really* important. It specifies the maximum amount
of shared memory to allocate. I'd make this parameter be about 70-75% of your
physical ram (assuming you have nothing else on this machine running besides
Oracle ... if not, adjust down accordingly). Then this value will dictate
your maximum SGA size as you build your database.
set shmsys:shminfo_shmmax=4294967295
set shmsys:shminfo_shmmin=1
set shmsys:shminfo_shmmni=100
set shmsys:shminfo_shmseg=10
set semsys:seminfo_semmsl=256
set semsys:seminfo_semmns=1024
set semsys:seminfo_semmni=400
-- end remarks
PATH=/bin:/usr/bin:/usr/sbin:/opt/bin:/usr/ccs/bin:/opt/local/GNU/bin
PATH=$PATH:/opt/local/bin:/opt/NSCPnav/bin:$ORACLE_HOME/bin
PATH=$PATH:/usr/local/samba/bin:/usr/ucb:.
export PATH
CLASSPATH=$ORACLE_HOME/JRE:$ORACLE_HOME/jlib:$ORACLE_HOME/rdbms/jlib
CLASSPATH=$CLASSPATH:$ORACLE_HOME/network/jlib
Usually the CD-ROM will be mounted automatically by the Solaris Volume Manager, if
not, do it as follows as user root.
$ su root
$ mkdir /cdrom
$ mount -r -F hsfs /dev/.... /cdrom
exit or CTRL-D
$ cd <somewhere>
$ mkdir Disk1 Disk2 Disk3
$ cd Disk1
$ gunzip 901solaris_disk1.cpio.gz
$ cat 901solaris_disk1.cpio | cpio -icd
This will extract all the files for Disk1, repeat steps for Disk2 and D3isk3. Now
you should have three directories
(Disk1, Disk2 and Disk3) containing installation files.
If you used Oracle before on your system, then you must edit the Oracle Inventory
File, usually located in:
/var/opt/oracle/oraInst.loc
inventory_loc=/opt/oracle/product/oraInventory
$ cd /Disk1
$ DISPLAY=<Any X-Window Host>:0.0
$ export DISPLAY
$ ./runInstaller
example display:
$ export DISPLAY=192.168.1.10:0.0
Answer the questions in the Installer, we use the following install directories
TYP2:/opt/oracle/product/9.2.0:Y
Edit and save the CREATE DATABASE File initTYP2.sql in $ORACLE_HOME/dbs, or create
a symbolic-Link
from $ORACLE_HOME/dbs to your Location.
$ cd $ORACLE_HOME/dbs
$ ln -s /export/home/oracle/config/9.2.0/initTYP2.ora initTYP2.ora
$ ls -l
First start the Instance, just to test your initTYP2.ora file for correct syntax
and system resources.
$ cd /export/home/oracle/config/9.2.0/
$ sqlplus /nolog
SQL> connect / as sysdba
SQL> startup nomount
SQL> shutdown immediate
Start Listener
Oracle JVM
Orcale XML
Oracle Spatial
Oracle Ultra Search
Oracle OLAP
Oracle Data Mining
Example Schemas
Run the following script install_options.sh to enable this options in the
database. Before running this scripts
adjust the initSID.ora paramaters
as follows for the build process. After this, you can reset the paramters to
smaller values.
parallel_automatic_tuning = false
shared_pool_size = 200000000
java_pool_size = 100000000
$ ./install_options.sh
These Scripts can be used as Templates. Please note, that some Parameters like
ORACLE_HOME, ORACLE_SID and PATH
must be adjusted on your own Environment. Besides this, you should check the
initSID.ora Parameters
for your Database (Size, Archivelog, ...)
MAIL=/usr/mail/${LOGNAME:?}
umask=022
EDITOR=vi; export EDITOR
ORACLE_BASE=/opt/app/oracle; export ORACLE_BASE
ORACLE_HOME=$ORACLE_BASE/product/9.2; export ORACLE_HOME
ORACLE_SID=OWS; export ORACLE_SID
ORACLE_TERM=xterm; export ORACLE_TERM
TNS_ADMIN=$ORACLE_HOME/network/admin; export TNS_ADMIN
NLS_LANG=AMERICAN_AMERICA.AL16UTF8; export NLS_LANG
ORA_NLS33=$ORACLE_HOME/ocommon/nls/admin/data; export ORA_NLS33
LD_LIBRARY_PATH=$ORACLE_HOME/lib:/lib:/usr/lib:/usr/openwin/lib
LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/dt/lib:/usr/ucblib:/usr/local/lib
export LD_LIBRARY_PATH
PATH=.:/usr/bin:/usr/sbin:/sbin:/usr/ucb:/etc:$ORACLE_HOME/lib:/usr/oasys/bin:$ORA
CLE_HOME/bin:/usr/local/bin:
export PATH
PS1='$PWD >'
DISPLAY=172.17.2.128:0.0
export DISPLAY
=====================================
7. install Oracle 9i on Linux:
=====================================
====================
7.1.Article 1:
====================
The following short Guide shows how to install and configure Oracle 9.2.0 on
RedHat Linux 7.2 / 8.0 You may download our
Scripts to create a database, we suggest this way and NOT using DBASSIST. Besides
these scripts, you can download our
NET configuration files: LISTNER.ORA, TNSNAMES.ORA and SQLNET.ORA.
System Requirements
Create Unix Group �dba�
Create Unix User �oracle�
Setup Environment ($HOME/.bash_profile) as follows
Mount the Oracle 9i CD-ROM (only if you have the CD) ...
... or Unpacking downloaded installation files
Install with Installer in interactive mode
Create the Database
Create your own DB-Create Script (optional)
Start Listener
Automatically Start / Stop the Database
Setup Kernel Parameters ( if necessary )
Install Oracle Options (optional)
Download Scripts for RedHat Linux 7.2
For our installation, we used the following ORACLE_HOME AND ORACLE_SID, please
adjust these parameters for
your own environment.
ORACLE_HOME = /opt/oracle/product/9.2.0
ORACLE_SID = VEN1
--------------------------------------------------------------------------------
System Requirements
Oracle 9i needs Kernel Version 2.4 and glibc 2.2, which is included in RedHat
Linux 7.2.
Component
Check with ...
... Output
System Libraries
rpm -q glibc
glibc-2.2.4-19.3
Proc*C/C++
rpm -q gcc
gcc-2.96-98
export JAVA_HOME=/usr/local/jdk
export JSDK_HOME=/usr/local/jsdk
CLASSPATH=$CLASSPATH:$JAVA_HOME/lib:$JSDK_HOME/lib/jsdk.jar
export CLASSPATH
PATH=$POSTFIX/bin:$POSTFIX/sbin:$POSTFIX/sendmail
PATH=$PATH:/usr/local/jre/bin:/usr/local/jdk/bin:/bin:/sbin:/usr/bin:/usr/sbin
PATH=$PATH:/usr/local/bin:$ORACLE_HOME/bin:/usr/local/jsdk/bin
PATH=$PATH:/usr/local/sbin:/usr/bin/X11:/usr/X11R6/bin:/root/bin
PATH=$PATH:/usr/local/samba/bin
export PATH
Mount the Oracle 9i CD-ROM (only if you have the CD) ...
$ su root
$ mkdir /cdrom
$ mount -t iso9660 /dev/cdrom /cdrom
$ exit
$ cd <somewhere>
$ cpio -idmv < Linux9i_Disk1.cpio
$ cpio -idmv < Linux9i_Disk2.cpio
$ cpio -idmv < Linux9i_Disk3.cpio
Now you should have three directories (Disk1, Disk2 and Disk3) containing
installation files.
$ cd Disk1
$ DISPLAY=<Any X-Window Host>:0.0
$ export DISPLAY
$ ./runInstaller
Answer the questions in the Installer, we use the following install directories
VEN1:/opt/oracle/product/9.2.0:Y
Edit and save the CREATE DATABASE File initVEN1.sql in $ORACLE_HOME/dbs, or create
a symbolic-Link from
$ORACLE_HOME/dbs to your Location.
$ cd $ORACLE_HOME/dbs
$ ln -s /home/oracle/config/9.2.0/initVEN1.ora initVEN1.ora
$ ls -l
$ cd /home/oracle/config/9.2.0/
$ sqlplus /nolog
SQL> connect / as sysdba
SQL> startup nomount
SQL> shutdown immediate
SQL> @initVEN1.sql
SQL> @shutdown immediate
SQL> startup
You can generate your own DB-Create Script using the Tool: $ORACLE_HOME/bin/dbca
Start Listener
Oracle9i uses UNIX resources such as shared memory, swap space, and semaphores
extensively
for interprocess communication. If your kernel parameter settings are insufficient
for Oracle9i,
you will experience problems during installation and instance startup.
The greater the amount of data you can store in memory, the faster your database
will operate. In addition,
by maintaining data in memory, the UNIX kernel reduces disk I/O activity.
Use the ipcs command to obtain a list of the system�s current shared memory and
semaphore segments,
and their identification number and owner.
You can modify the kernel parameters by using the /proc file system.
# cat sem
The output will list, in order, the values for the SEMMSL, SEMMNS, SEMOPM, and
SEMMNI parameters.
The following example shows how the output will appear.
In the preceding example, 250 is the value of the SEMMSL parameter, 32000 is the
value of the SEMMNS parameter, 32
is the value of the SEMOPM parameter, and 128 is the value of the SEMMNI
parameter.
5. Review the current shared memory parameters using the cat or more utility.
# cat shared_memory_parameter
6. Modify the shared memory parameter using the echo utility. For example, to
modify the SHMMAX parameter, enter the following:
7. Write a script to initialize these values during system startup and include the
script in your system init files.
Refer to the following table to determine if your system shared memory and
semaphore kernel parameters are set high enough for Oracle9i.
The parameters in the following table are the minimum values required to run
Oracle9i with a single database instance.
You can put the initialization in the file /etc/rc.d/rc.local
Oracle JVM
Orcale XML
Oracle Spatial
Oracle Ultra Search
Oracle OLAP
Oracle Data Mining
Example Schemas
Run the following script install_options.sh to enable this options in the
database. Before running this scripts adjust
the initSID.ora paramaters as follows for the build process. After this, you can
reset the paramters to smaller values.
parallel_automatic_tuning = false
shared_pool_size = 200000000
java_pool_size = 100000000
$ ./install_options.sh
These Scripts can be used as Templates. Please note, that some Parameters like
ORACLE_HOME, ORACLE_SID and PATH must
be adjusted on your own Environment. Besides this, you should check the
initSID.ora Parameters for your Database (Size, Archivelog, ...)
====================
7.2.Article 2:
====================
--------------------------------------------------------------------------------
Contents
Overview
Swap Space Considerations
Configuring Shared Memory
Configuring Semaphores
Configuring File Handles
Create Oracle Account and Directories
Configuring the Oracle Environment
Configuring Oracle User Shell Limits
Downloading / Unpacking the Oracle9i Installation Files
Update Red Hat Linux System - (Oracle Metalink Note: 252217.1)
Install the Oracle 9.2.0.4.0 RDBMS Software
Install the Oracle 9.2.0.5.0 Patchset
Post Installation Steps
Creating the Oracle Database
--------------------------------------------------------------------------------
Overview
When installing Red Hat Linux Fedora Core 2, I install ALL components.
(Everything). This makes it easier than trying to troubleshoot missing software
components.
As of March 26, 2004, Oracle includes the Oracle9i RDBMS software with the
9.2.0.4.0 patchset already included. This will save considerable time since the
patchset does not have to be downloaded and installed. We will, however, be
applying the 9.2.0.5.0 patchset.
The post installation section includes steps for configuring the Oracle Networking
files, configuring the database to start and stop when the machine is cycled, and
other miscellaneous tasks.
--------------------------------------------------------------------------------
To check the amount of memory / swap you have allocated, type either:
# free
- OR -
# cat /proc/swaps
- OR -
If you have less than 512MB of memory (between your RAM and SWAP), you can add
temporary swap space by creating a temporary swap file. This way you do not have
to use a raw device or even more drastic, rebuild your system.
As root, make a file that will act as additional swap space, let's say about
300MB:
# dd if=/dev/zero of=tempswap bs=1k count=300000
Finally we format the "partition" as swap and add it to the swap space:
# mke2fs tempswap
# mkswap tempswap
# swapon tempswap
--------------------------------------------------------------------------------
The Oracle RDBMS uses shared memory in UNIX to allow processes to access common
data structures and data.
These data structures and data are placed in a shared memory segment to allow
processes the fastest form of
Interprocess Communications (IPC) available. The speed is primarily a result of
processes not needing to copy
data between each other to share common data and structures - relieving the kernel
from having to get involved.
Oracle uses shared memory in UNIX to hold its Shared Global Area (SGA). This is an
area of memory within
the Oracle instance that is shared by all Oracle backup and foreground processes.
It is important to size
the SGA to efficiently hold the database buffer cache, shared pool, redo log
buffer as well as other shared
Oracle memory structures. Inadequate sizing of the SGA can have a dramatic
decrease in performance of the database.
To determine all shared memory limits you can use the ipcs command. The following
example shows the values
of my shared memory limits on a fresh RedHat Linux install using the defaults:
# ipcs -lm
The SHMMAX parameter is used to define the maximum size (in bytes) for a shared
memory segment and should be set
large enough for the largest SGA size. If the SHMMAX is set incorrectly (too low),
it is possible that the
Oracle SGA (which is held in shared segments) may be limited in size. An
inadequate SHMMAX setting would result
in the following:
ORA-27123: unable to attach to shared memory segment
You can determine the value of SHMMAX by performing the following:
# cat /proc/sys/kernel/shmmax
33554432
As you can see from the output above, the default value for SHMMAX is 32MB. This
is often too small to configure the Oracle SGA. I generally set the SHMMAX
parameter to 2GB.
NOTE: With a 32-bit Linux operating system, the default maximum size of the SGA is
1.7GB. This is the reason I will often set the SHMMAX parameter to 2GB since it
requires a larger value for SHMMAX.
On a 32-bit Linux operating system, without Physical Address Extension (PAE), the
physical memory is divided into a 3GB user space and a 1GB kernel space. It is
therefore possible to create a 2.7GB SGA, but you will need make several changes
at the Linux operating system level by changing the mapped base. In the case of a
2.7GB SGA, you would want to set the SHMMAX parameter to 3GB.
Keep in mind that the maximum value of the SHMMAX parameter is 4GB.
To change the value SHMMAX, you can use either of the following three methods:
This is method I use most often. This method sets the SHMMAX on startup by
inserting the following kernel parameter in the /etc/sysctl.conf startup file:
# echo "kernel.shmmax=2147483648" >> /etc/sysctl.conf
If you wanted to dynamically alter the value of SHMMAX without rebooting the
machine, you can make this change directly to the /proc file system. This command
can be made permanent by putting it into the /etc/rc.local startup file:
# echo "2147483648" > /proc/sys/kernel/shmmax
You can also use the sysctl command to change the value of SHMMAX:
# sysctl -w kernel.shmmax=2147483648
SHMMNI
We now look at the SHMMNI parameters. This kernel parameter is used to set the
maximum number of shared memory segments system wide. The default value for this
parameter is 4096. This value is sufficient and typically does not need to be
changed.
You can determine the value of SHMMNI by performing the following:
# cat /proc/sys/kernel/shmmni
4096
SHMALL
Finally, we look at the SHMALL shared memory kernel parameter. This parameter
controls the total amount of shared memory (in pages) that can be used at one time
on the system. In short, the value of this parameter should always be at least:
ceil(SHMMAX/PAGE_SIZE)
The default size of SHMALL is 2097152 and can be queried using the following
command:
# cat /proc/sys/kernel/shmall
2097152
From the above output, the total amount of shared memory (in bytes) that can be
used at one time on the system is:
SM = (SHMALL * PAGE_SIZE)
= 2097152 * 4096
= 8,589,934,592 bytes
The default setting for SHMALL should be adequate for our Oracle installation.
NOTE: The page size in Red Hat Linux on the i386 platform is 4096 bytes. You can,
however, use bigpages which supports the configuration of larger memory page
sizes.
--------------------------------------------------------------------------------
Configuring Semaphores
Now that we have configured our shared memory settings, it is time to take care of
configuring our semaphores. A semaphore can be thought of as a counter that is
used to control access to a shared resource. Semaphores provide low level
synchronization between processes (or threads within a process) so that only one
process (or thread) has access to the shared segment, thereby ensureing the
integrity of that shared resource. When an application requests semaphores, it
does so using "sets".
To determine all semaphore limits, use the following:
# ipcs -ls
The SEMMSL kernel parameter is used to control the maximum number of semaphores
per semaphore set.
Oracle recommends setting SEMMSL to the largest PROCESS instance parameter setting
in the init.ora file for all databases hosted on the Linux system plus 10. Also,
Oracle recommends setting the SEMMSL to a value of no less than 100.
SEMMNI
The SEMMNI kernel parameter is used to control the maximum number of semaphore
sets on the entire Linux system.
Oracle recommends setting the SEMMNI to a value of no less than 100.
SEMMNS
The SEMMNS kernel parameter is used to control the maximum number of semaphores
(not semaphore sets) on the entire Linux system.
Oracle recommends setting the SEMMNS to the sum of the PROCESSES instance
parameter setting for each database on the system, adding the largest PROCESSES
twice, and then finally adding 10 for each Oracle database on the system. To
summarize:
The SEMOPM kernel parameter is used to control the number of semaphore operations
that can be performed per semop system call.
The semop system call (function) provides the ability to do operations for
multiple semaphores with one semop system call. A semaphore set can have the
maximum number of SEMMSL semaphores per semaphore set and is therefore recommended
to set SEMOPM equal to SEMMSL.
Finally, we see how to set all semaphore parameters using several methods. In the
following, the only parameter I care about changing (raising) is SEMOPM. All other
default settings should be sufficient for our example installation.
This is method I use most often. This method sets all semaphore kernel parameters
on startup by inserting the following kernel parameter in the /etc/sysctl.conf
startup file:
# echo "kernel.sem=250 32000 100 128" >> /etc/sysctl.conf
If you wanted to dynamically alter the value of all semaphore kernel parameters
without rebooting the machine, you can make this change directly to the /proc file
system. This command can be made permanent by putting it into the /etc/rc.local
startup file:
# echo "250 32000 100 128" > /proc/sys/kernel/sem
You can also use the sysctl command to change the value of all semaphore settings:
--------------------------------------------------------------------------------
When configuring our Linux database server, it is critical to ensure that the
maximum number of file handles is large enough. The setting for file handles
designate the number of open files that you can have on the entire Linux system.
Use the following command to determine the maximum number of file handles for the
entire system:
# cat /proc/sys/fs/file-max
103062
Oracle recommends that the file handles for the entire system be set to at least
65536. In most cases, the default for Red Hat Linux is 103062. I have seen others
(Red Hat Linux AS 2.1, Fedora Core 1, and Red Hat version 9) that will only
default to 32768. If this is the case, you will want to increase this value to at
least 65536.
This is method I use most often. This method sets the maximum number of file
handles (using the kernel parameter file-max) on startup by inserting the
following kernel parameter in the /etc/sysctl.conf startup file:
# echo "fs.file-max=65536" >> /etc/sysctl.conf
If you wanted to dynamically alter the value of all semaphore kernel parameters
without rebooting the machine, you can make this change directly to the /proc file
system. This command can be made permanent by putting it into the /etc/rc.local
startup file:
# echo "65536" > /proc/sys/fs/file-max
You can also use the sysctl command to change the maximum number of file handles:
# sysctl -w fs.file-max=65536
NOTE: It is also possible to query the current usage of file handles using the
following command:
# cat /proc/sys/fs/file-nr
1140 0 103062
In the above example output, here is an explanation of the three values from the
file-nr command:
Total number of allocated file handles.
Total number of file handles currently being used.
Maximum number of file handles that can be allocated. This is essentially the
value of file-max - (see above).
NOTE: If you need to increase the value in /proc/sys/fs/file-max, then make sure
that the ulimit is set properly. Usually for 2.4.20 it is set to unlimited. Verify
the ulimit setting my issuing the ulimit command:
# ulimit
unlimited
--------------------------------------------------------------------------------
Now let's create the Oracle UNIX account all all required directories:
Login as the root user id.
% su -
Create directories.
# mkdir -p /u01/app/oracle
# mkdir -p /u03/app/oradata
# mkdir -p /u04/app/oradata
# mkdir -p /u05/app/oradata
# mkdir -p /u06/app/oradata
Create the UNIX Group for the Oracle User Id.
# groupadd -g 115 dba
Create the UNIX User for the Oracle Software.
# useradd -u 173 -c "Oracle Software Owner" -d /u01/app/oracle -g "dba" -m -s
/bin/bash oracle
# passwd oracle
Changing password for user oracle.
New UNIX password: ************
BAD PASSWORD: it is based on a dictionary word
Retype new UNIX password: ************
passwd: all authentication tokens updated successfully.
Change ownership of all Oracle Directories to the Oracle UNIX User.
# chown -R oracle:dba /u01
# chown -R oracle:dba /u03
# chown -R oracle:dba /u04
# chown -R oracle:dba /u05
# chown -R oracle:dba /u06
Oracle Environment Variable Settings
NOTE: Ensure to set the environment variable: LD_ASSUME_KERNEL=2.4.1 Failing to
set the LD_ASSUME_KERNEL parameter will cause
the Oracle Universal Installer to hang!
Verify all mount points. Please keep in mind that all of the following mount
points can simply be directories if you only have one hard drive.
For our installation, we will be using four mount points (or directories) as
follows:
/u03 : This mount point will contain the physical Oracle files:
Control File 1
Online Redo Log File - Group 1 / Member 1
Online Redo Log File - Group 2 / Member 1
Online Redo Log File - Group 3 / Member 1
/u04 : This mount point will contain the physical Oracle files:
Control File 2
Online Redo Log File - Group 1 / Member 2
Online Redo Log File - Group 2 / Member 2
Online Redo Log File - Group 3 / Member 2
/u05 : This mount point will contain the physical Oracle files:
Control File 3
Online Redo Log File - Group 1 / Member 3
Online Redo Log File - Group 2 / Member 3
Online Redo Log File - Group 3 / Member 3
/u06 : This mount point will contain the all physical Oracle data files.
This will be one large RAID 0 stripe for all Oracle data files.
All tablespaces including System, UNDO, Temporary, Data, and Index.
--------------------------------------------------------------------------------
After configuring the Linux operating environment, it is time to setup the Oracle
UNIX User ID for the installation of the Oracle RDBMS Software.
Keep in mind that the following steps need to be performed by the oracle user id.
Before delving into the details for configuring the Oracle User ID, I packaged an
archive of shell scripts and configuration files to assist
with the Oracle preparation and installation. You should download the archive
"oracle_920_installation_files_linux.tar" as the Oracle User ID
and place it in his HOME directory.
$ pwd
/u01/app/oracle
$ cp oracle_920_installation_files_linux/.bash_profile ~/.bash_profile
$ . ~/.bash_profile
.bash_profile executed
$
--------------------------------------------------------------------------------
Many of the Linux shells (including BASH) implement certain controls over certain
critical resources like the number of file descriptors that
can be opened and the maximum number of processes available to a user's session.
In most cases, you will not need to alter any of these shell limits,
but you find yourself getting errors when creating or maintaining the Oracle
database, you may want to read through this section.
You can use the following command to query these shell limits:
# ulimit -a
core file size (blocks, -c) 0
data seg size (kbytes, -d) unlimited
file size (blocks, -f) unlimited
max locked memory (kbytes, -l) unlimited
max memory size (kbytes, -m) unlimited
open files (-n) 1024
pipe size (512 bytes, -p) 8
stack size (kbytes, -s) 10240
cpu time (seconds, -t) unlimited
max user processes (-u) 16383
virtual memory (kbytes, -v) unlimited
Maximum Number of Open File Descriptors for Shell Session
Let's first talk about the maximum number of open file descriptors for a user's
shell session.
NOTE: Make sure that throughout this section, that you are logged in as the oracle
user account since this is the shell account we want to test!
Ok, you are first going to tell me, "But I've already altered my Linux environment
by setting the system wide kernel parameter /proc/sys/fs/file-max".
Yes, this is correct, but there is still a per user limit on the number of open
file descriptors. This typically defaults to 1024.
To check that, use the following command:
% su - oracle
% ulimit -n
1024
If you wanted to change the maximum number of open file descriptors for a user's
shell session, you could edit the /etc/security/limits.conf as the root account.
For your Linux system, you would add the following lines:
oracle soft nofile 4096
oracle hard nofile 101062
The first line above sets the soft limit, which is the number of files handles (or
open files) that the Oracle user will have after logging in to the shell account.
The hard limit defines the maximum number of file handles (or open files) are
possible for the user's shell account. If the oracle user account starts to
recieve error messages about running out of file handles, then number of file
handles should be increased for the oracle using the user should increase the
number of file handles using the hard limit setting. You can increase the value of
this parameter to 101062 for the current session by using the following:
% ulimit -n 101062
Keep in mind that the above command will only effect the current shell session. If
you were to log out and log back in, the value would be set back to its default
for that shell session.
NOTE: Although you can set the soft and hard file limits higher, it is critical to
understand to never set the hard limit for nofile for your shell account equal to
/proc/sys/fs/file-max. If you were to do this, your shell session could use up all
of the file descriptors for the entire Linux system, which means that the entire
Linux system would run out of file descriptors. At this point, you would not be
able to initiate any new logins since the system would not be able to open any PAM
modules, which are required for login. Notice that I set my hard limit to 101062
and not 103062. In short, I am leaving 2000 spare!
We're not totally done yet. We still need to ensure that pam_limits is configured
in the /etc/pam.d/system-auth file. The steps defined below sould already be
performed with a normal Red Hat Linux installation, but should still be validated!
The PAM module will read the /etc/security/limits.conf file. You should have an
entry in the /etc/pam.d/system-auth file as follows:
$ ulimit -Sa
core file size (blocks, -c) 0
data seg size (kbytes, -d) unlimited
file size (blocks, -f) unlimited
max locked memory (kbytes, -l) unlimited
max memory size (kbytes, -m) unlimited
open files (-n) 4096
pipe size (512 bytes, -p) 8
stack size (kbytes, -s) 10240
cpu time (seconds, -t) unlimited
max user processes (-u) 16383
virtual memory (kbytes, -v) unlimited
Finally, let's check all current hard shell limits:
$ ulimit -Ha
core file size (blocks, -c) unlimited
data seg size (kbytes, -d) unlimited
file size (blocks, -f) unlimited
max locked memory (kbytes, -l) unlimited
max memory size (kbytes, -m) unlimited
open files (-n) 101062
pipe size (512 bytes, -p) 8
stack size (kbytes, -s) unlimited
cpu time (seconds, -t) unlimited
max user processes (-u) 16383
virtual memory (kbytes, -v) unlimited
The soft limit is now set to 4096 while the hard limit is now set to 101062.
NOTE: There may be times when you cannot get access to the root user account to
change the /etc/security/limits.conf file. You can set this value in the user's
login script for the shell as follows:
su - oracle
cat >> ~oracle/.bash_profile << EOF
ulimit -n 101062
EOF
NOTE: For this section, I used the BASH shell. The session values will not always
be the same for other shells.
Maximum Number of Processes for Shell Session
This section is very similar to the previous section, "Maximum Number of Open File
Descriptors for Shell Session" and deals with the same concept of soft limits and
hard limits as well as configuring pam_limits. For most default Red Hat Linux
installations, you will not need to be concerned with the maximum number of user
processes as this value is generally high enough!
NOTE: For this section, I used the BASH shell. The session values will not always
be the same for other shells.
Let's start by querying the current limit of the maximum number of processes for
the oracle user:
% su - oracle
% ulimit -u
16383
If you wanted to change the soft and hard limits for the maximum number of
processes for the oracle user, (and for that matter, all users), you could edit
the /etc/security/limits.conf as the root account. For your Linux system, you
would add the following lines:
oracle soft nproc 2047
oracle hard nproc 16384
NOTE: There may be times when you cannot get access to the root user account to
change the /etc/security/limits.conf file. You can set this value in the user's
login script for the shell as follows:
su - oracle
cat >> ~oracle/.bash_profile << EOF
ulimit -u 16384
EOF
Miscellaneous Notes
To check all current soft shell limits, enter the following command:
$ ulimit -Sa
core file size (blocks, -c) 0
data seg size (kbytes, -d) unlimited
file size (blocks, -f) unlimited
max locked memory (kbytes, -l) unlimited
max memory size (kbytes, -m) unlimited
open files (-n) 4096
pipe size (512 bytes, -p) 8
stack size (kbytes, -s) 10240
cpu time (seconds, -t) unlimited
max user processes (-u) 16383
virtual memory (kbytes, -v) unlimited
To check maximum hard limits, enter the following command:
$ ulimit -Ha
core file size (blocks, -c) unlimited
data seg size (kbytes, -d) unlimited
file size (blocks, -f) unlimited
max locked memory (kbytes, -l) unlimited
max memory size (kbytes, -m) unlimited
open files (-n) 101062
pipe size (512 bytes, -p) 8
stack size (kbytes, -s) unlimited
cpu time (seconds, -t) unlimited
max user processes (-u) 16383
virtual memory (kbytes, -v) unlimited
The file (blocks) value should be multiplied by 512 to obtain the maximum file
size imposed by the shell. A value of unlimited is the operating system default
and typically has a maximum value of 1 TB.
NOTE: Oracle9i Release 2 (9.2.0) includes native support for files greater than 2
GB. Check your shell to determine whether it will impose a limit.
--------------------------------------------------------------------------------
Most of the actions throughout the rest of this document should be done as the
"oracle" user account unless otherwise noted. If you are not logged in as the
"oracle" user account, do so now.
You should now have three directories called "Disk1, Disk2 and Disk3" containing
the Oracle9i Installation files:
/Disk1
/Disk2
/Disk3
--------------------------------------------------------------------------------
The following RPMs, all of which are available on the Red Hat Fedora Core 2 CDs,
will need to be updated as per the steps described in Metalink Note: 252217.1 -
"Requirements for Installing Oracle 9iR2 on RHEL3".
All of these packages will need to be installed as the root user:
# cd /mnt/cdrom/Fedora/RPMS
# rpm -Uvh libpng-1.2.2-22.i386.rpm
From Fedora Core 2 / Disk #2
# cd /mnt/cdrom/Fedora/RPMS
# rpm -Uvh gnome-libs-1.4.1.2.90-40.i386.rpm
From Fedora Core 2 / Disk #3
# cd /mnt/cdrom/Fedora/RPMS
# rpm -Uvh compat-libstdc++-7.3-2.96.126.i386.rpm
# rpm -Uvh compat-libstdc++-devel-7.3-2.96.126.i386.rpm
# rpm -Uvh compat-db-4.1.25-2.1.i386.rpm
# rpm -Uvh compat-gcc-7.3-2.96.126.i386.rpm
# rpm -Uvh compat-gcc-c++-7.3-2.96.126.i386.rpm
# rpm -Uvh openmotif21-2.1.30-9.i386.rpm
# rpm -Uvh pdksh-5.2.14-24.i386.rpm
From Fedora Core 2 / Disk #4
# cd /mnt/cdrom/Fedora/RPMS
# rpm -Uvh sysstat-5.0.1-2.i386.rpm
Set gcc296 and g++296 in PATH
Put gcc296 and g++296 first in $PATH variable by creating the following symbolic
links:
# mv /usr/bin/gcc /usr/bin/gcc323
# mv /usr/bin/g++ /usr/bin/g++323
# ln -s /usr/bin/gcc296 /usr/bin/gcc
# ln -s /usr/bin/g++296 /usr/bin/g++
Check hostname
Make sure the hostname command returns a fully qualified host name by amending the
/etc/hosts file if necessary:
# hostname
Install the 3006854 patch:
The Oracle / Linux Patch 3006854 can be downloaded here.
# unzip p3006854_9204_LINUX.zip
# cd 3006854
# sh rhel3_pre_install.sh
--------------------------------------------------------------------------------
NOTE: If you forgot to set the DISPLAY environment variable and you get the
following error:
you will then need to execute the following command to get "runInstaller" working
again:
% rm -rf /tmp/OraInstall
If you don't do this, the Installer will hang without giving any error messages.
Also make sure that "runInstaller" has stopped running in the background. If not,
kill it.
Change directory to the Oracle installation files you downloaded and extracted.
Then run: runInstaller.
$ su - oracle
$ cd orainstall/Disk1
$ ./runInstaller
Initializing Java Virtual Machine from /tmp/OraInstall2004-05-02_08-45-
13PM/jre/bin/java. Please wait...
Screen Name Response
Welcome Screen: Click "Next"
Inventory Location: Click "OK"
UNIX Group Name: Use "dba"
Root Script Window: Open another window, login as the root userid, and run
"/tmp/orainstRoot.sh". When the script has completed, return to the dialog from
the Oracle Installer and hit Continue.
File Locations: Leave the "Source Path" at its default setting. For the
Destination name, I like to use "OraHome920". You can leave the Destination path
at it's default value which should be "/u01/app/oracle/product/9.2.0".
Available Products: Select "Oracle9i Database 9.2.0.4.0" and click "Next"
Installation Types: Select "Enterprise Edition (2.84GB)" and click "Next"
Database Configuration: Select "Software Only" and click "Next"
Summary: Click "Install"
% $ORACLE_HOME/Apache/Apache/bin/apachectl stop
% agentctl stop
% lsnrctl stop
--------------------------------------------------------------------------------
Once you have completed installing of the Oracle9i (9.2.0.4.0) RDBMS software, you
should now apply the 9.2.0.5.0 patchset.
NOTE: The details and instructions for applying the 9.2.0.5.0 patchset in this
article is not absolutely necessary. I provide it here simply as a convenience for
those how do want to apply the latest patchset.
Use the following steps to install the Oracle10g Universal Installer and then the
Oracle 9.2.0.5.0 patchset.
Next, we need to install the Oracle10g Universal Installer into the same
$ORACLE_HOME we used to install the Oracle9i RDBMS software.
NOTE: Using the old Universal Installer that was used to install the Oracle9i
RDBMS software, (OUI release 2.2), cannot be used to install the 9.2.0.5.0
patchset and higher!
Starting with the Oracle 9.2.0.5.0 patchset, Oracle requires the use of the
Oracle10g Universal Installer to apply the 9.2.0.5.0 patchset and to perform all
subsequent maintenance operations on the Oracle software $ORACLE_HOME.
Let's get this thing started by installing the Oracle10g Universal Installer. This
must be done by running the runInstaller that is included with the 9.2.0.5.0
patchset we extracted in the above step:
% cd orapatch/Disk1
% ./runInstaller -ignoreSysPrereqs
Starting Oracle Universal Installer...
% cd $ORACLE_HOME/bin
% ln -s -f $ORACLE_HOME/oui/bin/runInstaller.sh runInstaller
We now install the Oracle 9.2.0.5.0 patchset by executing the newly installed 10g
Universal Installer:
% cd
% runInstaller -ignoreSysPrereqs
Starting Oracle Universal Installer...
Select a Product to Install: Select "Oracle 9iR2 Patchsets 9.2.0.5.0" and click
"Next"
Summary: Click "Install"
--------------------------------------------------------------------------------
% cd
% cd oracle_920_installation_files_linux
% cp ldap.ora $ORACLE_HOME/network/admin/
% cp tnsnames.ora $ORACLE_HOME/network/admin/
% cp sqlnet.ora $ORACLE_HOME/network/admin/
% cp listener.ora $ORACLE_HOME/network/admin/
% cd
% lsnrctl start
Update /etc/oratab:
The dbora script (below) relies on an entry in the /etc/oratab. Perform the
following actions as the oracle user account:
% su -
# cp /u01/app/oracle/oracle_920_installation_files_linux/dbora /etc/init.d
# ln -s /etc/init.d/dbora /etc/rc3.d/S99dbora
# ln -s /etc/init.d/dbora /etc/rc4.d/S99dbora
# ln -s /etc/init.d/dbora /etc/rc5.d/S99dbora
# ln -s /etc/init.d/dbora /etc/rc0.d/K10dbora
# ln -s /etc/init.d/dbora /etc/rc6.d/K10dbora
--------------------------------------------------------------------------------
Finally, let's create an Oracle9i database. This can be done using scripts that I
already included with the oracle_920_installation_files_linux.tar download. The
scripts are included in the ~oracle/admin/ORA920/create directory. To create the
database, perform the following steps:
% su - oracle
% cd admin/ORA920/create
% ./RUN_CRDB.sh
After starting the RUN_CRDB.sh, there will be no screen activity until the
database creation is complete. You can, however, bring up a new console window to
the Linux databse server as the oracle user account, navigate to the same
directory you started the database creation from, and tail the crdb.log log file.
$ telnet linux3
...
Fedora Core release 2 (Tettnang)
Kernel 2.6.5-1.358 on an i686
login: oracle
Password: xxxxxx
.bash_profile executed
[oracle@linux3 oracle]$ cd admin/ORA920/create
[oracle@linux3 create]$ tail -f crdb.log
=====================================
8. Install Oracle 9.2.0.2 on OpenVMS:
=====================================
VMS:
====
Using OUI to install Oracle9i Release 2 on an OpenVMS System
We have a PC running Xcursion and a 16 Processor GS1280 with the 2 built-in disks
In the examples we booted on disk DKA0:
Oracle account is on disk DKA100. Oracle and the database will be installed on
DKA100.
Install disk MUST be ODS-5.
Installation uses the 9.2 downloaded from the Oracle website. It comes in a Java
JAR file.
Oracle ships a JRE with its product. However, you will have to install Java on
OpenVMS so you can unpack
the 9.2 JAR file that comes from the Oracle website
Unpack the JAR file as described on the Oracle website. This will create two .BCK
files.
When the two backup save sets files are restored, you should end up with two
directories:
[disk1] directory
[disk2] directory
These directories will be in the root of a disk. In this example they are in the
root of DKA100.
The OUI requires X-Windows. If the Alpha system you are using does not have a
graphic head,
use a PC with an X-Windows terminal such as Xcursion.
@DKA100:[disk1]runinstaller.
This will not work because the RUNINSTALLER.COM file is not in the root of
DKA100:[disk1].
You must first copy RUNINSTALLER.COM from the dka100:[disk1.000000] directory into
dka100:[disk1]:
@DKA100:[disk1]runinstaller
- Assign name and directory structure for the Oracle Home ORACLE_HOME
Ora_home
Dka100:[oracle.oracle9]
@[.oracle9]orauser .
/DKA100/oracle/oracle9/database/
$ @dka100:[oracle.oracle9]orauser db9i1
The next line starts the Listener (needed for client connects).
The final lines start the database.
Stop database example
Example of how to stop the database.
Test database server
Use the Enterprise Manager console to test the database server.
Oracle Enterprise Manager
Enter address of server and SID.
Name the server.
Click OK.
Databases connect information
Select database.
Enter system account and password.
Change connection box to �AS SYSDBA.�
Click OK.
Open database
Database is opened and exposed.
Listener
Listener automatically picks up the SID from the database.
Start Listener before database and the SID will display in the Listener.
If you start the database before the Listener, the SID may not appear immediately.
To see if the SID is registered in the Listener, enter:
$lsnrctl stat
Alter a user
User is altered:
AIX:
====
Purpose
=======
Each step should be done in the order that it is listed. These steps are the
bare minimum that is necessary for a typical install of the Oracle9i RDBMS.
The following steps are required to verify your version of the AIX operating
system is certified with the version of the RDBMS (Oracle9i Release 2 (9.2.0)):
The "Status" column displays the certification status. The links in the
"Addt'l Info" and "Install Issue" columns may contain additional information
relevant to a given version. Note that if patches are listed under one of
these links, your installation is not considered certified unless you apply
them. The "Addt'l Info" link also contains information about available
patchsets. Installation of patchsets is not required to be considered
certified, but they are highly recommended.
Pre-Installation Steps for the System Administrator
====================================================
The following steps are required to verify your operating system meets minimum
requirements for installation, and should be performed by the root user. For
assistance with system administration issues, please contact your system
administator or operating system vendor.
Use these steps to manually check the operating system requirements before
attempting to install Oracle RDBMS software, or you may choose to use the
convenient "Unix InstallPrep script" which automates these checks for you. For
more information about the script, including download information, please
review the following article:
The InstallPrep script currently does not check requirements for AIX5L systems.
? 400 MB in /tmp *
? 256 MB of physical RAM memory
? Two times the amount of physical RAM memory for Swap/Paging space
(On systems with more than 2 GB of physical RAM memory, the
requirements for Swap/Paging space can be lowered, but Swap/Paging
space should never be less than physical RAM memory.)
* You may also redirect /tmp by setting the TEMP environment variable.
This is only recommended in rare circumstances where /tmp cannot be
expanded to meet free space requirements.
Create an AIX user and group that will own the Oracle software.
(user = oracle, group = dba)
? Use the "smit security" command to create a new group and user
Please ensure that the user and group you use are defined in the local
/etc/passwd (user) and /etc/group (group) files rather than resolved via
a network service such as NIS.
Create a second, third, and fourth mount point for the database files.
(typically /u02, /u03, and /u04) Use of multiple mount points is not
required, but is highly recommended for best performance and ease of
recoverability.
# smit chaio
# lslpp -l bos.adt.libm
If this fileset is not installed and "COMMITTED", then you must install
it from the AIX operating system CD-ROM from IBM. With the correct
CD-ROM mounted, run the following command to begin the process to load
the required bos.adt.libm fileset:
# smit install_latest
# lslpp -l bos.perf.perfstat
# lslpp -l bos.perf.libperfstat
6. Download and install JDK 1.3.1 from IBM. At the time this article was
created, the JDK could be downloaded from the following URL:
http://www.ibm.com/developerworks/java/jdk/aix/index.html
NOTE: You must shutdown ALL Oracle database instances (if any) before
running the rootpre.sh script. Do not run the rootpre.sh script
if you have a newer version of an Oracle database already installed
on this system.
# /cdrom/rootpre.sh
Installation Steps for the Oracle User
=======================================
Environment variables should be set in the login script for the oracle
user. If the oracle user's default shell is the C-shell (/usr/bin/csh),
then the login script will be named ".login". If the oracle user's
default shell is the Bourne-shell (/usr/bin/bsh) or the Korn-shell
(/usr/bin/sh or /usr/bin/ksh), then the login script will be named
".profile". In either case, the login script will be located in the
oracle user's home directory ($HOME).
The examples below assume that your software mount point is /u01.
Parameter Value
----------- -----------------------------
ORACLE_HOME /u01/app/oracle/product/9.2.0
PATH /u01/app/oracle/product/9.2.0/bin:/usr/ccs/bin:
/usr/bin/X11:
(followed by any other directories you wish to include)
ORACLE_SID Set this to what you will call your database instance.
(typically 4 characters in length)
DISPLAY <ip-address>:0.0
(review Note:153960.1 for detailed information)
Set the oracle user's umask to "022" in you ".profile" or ".login" file.
Example:
umask 022
Log off and log on as the oracle user to ensure all environment variables
are set correctly. Use the following command to view them:
% env | more
Before attempting to run the Oracle Universal Installer (OUI), verify that
you can successfully run the following command:
% /usr/bin/X11/xclock
If this does not display a clock on your display screen, please review the
following article:
4. Start the Oracle Universal Installer and install the RDBMS software:
Use the following commands to start the installer:
% cd /tmp
% /cdrom/runInstaller
? When prompted for whether rootpre.sh has been run by root, enter "y".
This should have been done in Pre-Installation step 8 above.
? If prompted, enter the "UNIX Group Name" for the oracle user (dba).
? If prompted, enter the directory where you would like to put datafiles
at the "Database File Location Screen". Click Next.
? At the "Choose JDK Home Directory", enter the directory where you have
previously installed the JDK 1.3.1 from IBM. This should have been
done in Pre-Installation step 6 above.
Note: If you are having problems changing CD-ROMs when prompted to do so,
please review the following article:
Your Oracle9i Release 2 (9.2.0) RDBMS installation is now complete and ready
for use.
Appendix A
==========
Mount the CD-ROM, then use a web browser to open the file "index.htm" located
at the top level directory of the CD-ROM. On this CD-ROM you will find the
Installation Guide, Administrator's Reference, and other useful documentation.
http://otn.oracle.com/documentation/content.html
Select the highest version CD-pack displayed to ensure you get the most
up-to-date information.
Unattended install:
-------------------
Note 1:
-------
This note describes how to start the unattended install of patch 9.2.0.5 on AIX
5L, which can be applied
to 9.2.0.2, 9.2.0.3, 9.2.0.4
Shut down the existing Oracle server instance with normal or immediate priority.
For example,
shutdown all instances (cleanly) if running Parallel Server.
Stop all listener, agent and other processes running in or against the ORACLE_HOME
that will have
the patch set installation. Run slibclean (/usr/sbin/slibclean) as root to remove
ant currently unused
modules in kernel and library memory.
Edit the values for all fields labeled as <Value Required> according to the
comments and
examples in the template.
Start the Oracle Universal Installer from the directory described in Step 4 which
applies to your situation.
You should pass the full path of the response file template you have edited
locally as the last argument
with your own value of ORACLE_HOME and FROM_LOCATION. The following is an example
of the command:
Run the $ORACLE_HOME/root.sh script from a root session. If you are applying the
patch set
in a cluster database environment, the root.sh script should be run in the same
way on both the local node
and all participating nodes.
Note 2:
-------
Where... Description
filename
Identifies the full path of the specific response file
-silent
Runs Oracle Universal Installer in complete silent mode. The Welcome window is
suppressed automatically.
This parameter is optional. If you use -silent, -nowelcome is not necessary.
-nowelcome
Suppresses the Welcome window that appears during installation. This parameter is
optional.
Note 3:
-------
Unattended install of 9.2.0.5 on Win2K:
Make a copy of the response file template provided in the response directory where
you unzipped
the patch set file.
Edit the values for all fields labeled as <Value Required> according to the
comments and examples
in the template.
Start Oracle Universal Installer release 10.1.0.2 located in the unzipped area of
the patch set.
For example, Disk1\setup.exe. You should pass the full path of the response file
template you have edited
locally as the last argument with your own value of ORACLE_HOME and FROM_LOCATION.
The syntax is as follows:
===============================
9.2 Oracle and UNIX and other OS:
===============================
You have the following options for creating your new Oracle database:
DBCA can be launched by the Oracle Universal Installer, depending upon the type of
install that you select,
and provides a graphical user interface (GUI) that guides you through the creation
of a database.
You can chose not to use DBCA, or you can launch it as a standalone tool at any
time in the future to create a database.
Run DCBA as
% dbca
If you already have existing scripts for creating your database, you can still
create your database manually.
However, consider editing your existing script to take advantage of new Oracle
features. Oracle provides a sample database
creation script and a sample initialization parameter file with the database
software files it distributes,
both of which can be edited to suit your needs.
In all cases, the Oracle software needs to be installed on your host machine.
9.1.1 Operating system dependencies:
------------------------------------
For example, on Linux, glibc 2.1.3 is needed with Oracle version 8.1.7.
Linux could be quite critical with respect to libraries in combination
with Oracle.
# sysctl -w kernel.shmmax=100000000
# echo "kernel.shmmax = 100000000" >> /etc/sysctl.conf
Opmerking: Het onderstaANDe is algemeen, maar is ook afgeleid van een Oracle
8.1.7
installatie op Linux Redhat 6.2
Als de 8.1.7 installatie gedaan wordt is ook nog de Java JDK 1.1.8 nodig.
Deze kan gedownload worden van www.blackdown.org
ON UNIX:
========
Example 1:
----------
/dbs01 - - - - - Db directory 1
/dbs01 /app - - - - Constante
/dbs01 /app /oracle - - $ORACLE_BASE Oracle base
directory
/dbs01 /app /oracle /admin - $ORACLE_ADMIN Oracle admin
directory
/dbs01 /app /oracle /product - - Constante
/dbs01 /app /oracle /product /817 $ORACLE_HOME Oracle home
directory
Example 3:
----------
Example 4:
----------
Example 5:
----------
initBENE.ora /opt/oracle/product/8.0.6/dbs
tnsnames.ora /opt/oracle/product/8.0.6/network/admin
listener.ora /opt/oracle/product/8.0.6/network/admin
alert log /var/opt/oracle/bene/bdump
oratab /var/opt/oracle
Example 6:
----------
ORACLE_BASE /u01/app/oracle
ORACLE_HOME $ORACLE_BASE/product/10.1.0/db_1
ORACLE_PATH /u01/app/oracle/product/10.1.0/db_1/bin:.
Note: The period adds the current working directory to the search path.
ORACLE_SID SAL1
ORAENV_ASK NO
SQLPATH /home:/home/oracle:/u01/oracle
TNS_ADMIN $ORACLE_HOME/network/admin
TWO_TASK
Function Specifies the default connect identifier to use in the connect string.
If this environment variable is set,
you do not need to specify the connect identifier in the connect string. For
example, if the TWO_TASK environment variable
is set to sales, you can connect to a database using the CONNECT username/password
command
rather than the CONNECT username/password@sales command.
Syntax Any connect identifier.
Example PRODDB_TCP
to identify the SID and Oracle home directory for the instance that you want to
shut down, enter the following command:
Solaris:
$ cat /var/opt/oracle/oratab
$ cat /etc/oratab
ON NT/2000:
===========
SET ORACLE_BASE=G:\ORACLE
SET ORACLE_HOME=G:\ORACLE\ORA81
SET ORACLE_SID=AIRM
SET ORA_NLSxxx=G:\ORACLE\ORA81\ocommon\nls\admin\data
SET NLS_LANG=AMERICAN_AMERICA.WE8ISO8859P1
ON OpenVMS:
===========
When a new database is created a new directory is created in the root directory
to store database specific configuration files. This directory is called
[.DB_dbname].
This directory will normally hold the system tablespace data file as well
as the database specific startup, shutdown and orauser files.
The Oracle environment for a VMS user is set up by running the appropriate
ORAUSER_dbname.COM file. This sets up the necessary command symbols and logical
names
to access the various ORACLE utilities.
Each database created on a VMS system will have an ORAUSER file in it's home
directory
and will be named ORAUSER_dbname.COM, e.g. for a database SALES the file
specification could be:
ORA_ROOT:[DB_SALES]ORAUSER_SALES.COM
To have the environment set up automatically on login, run this command file in
your login.com file.
To access SQLPLUS use the following command with a valid username and password:
$ SQLPLUS username/password
/opt/oracle/product/8.1.6
/opt/oracle/product/8.1.6/admin/PROD
/opt/oracle/product/8.1.6/admin/pfile
/opt/oracle/product/8.1.6/admin/adhoc
/opt/oracle/product/8.1.6/admin/bdump
/opt/oracle/product/8.1.6/admin/udump
/opt/oracle/product/8.1.6/admin/adump
/opt/oracle/product/8.1.6/admin/cdump
/opt/oracle/product/8.1.6/admin/create
/u02/oradata/PROD
/u03/oradata/PROD
/u04/oradata/PROD
etc..
Benodigde groups in UNIX: group dba. Deze moet voorkomen in de /etc/group file
vaak is ook nog nodig de group oinstall
groupadd dba
groupadd oinstall
groupadd oper
# groupadd dba
# useradd oracle
# mkdir /usr/oracle
# mkdir /usr/oracle/9.0
# chown -R oracle:dba /usr/oracle
# touch /etc/oratab
# chown oracle:dba /etc/oratab
mkdir /opt/u01
mkdir /opt/u02
mkdir /opt/u03
mkdir /opt/u04
Geef nu ownership van deze mount points aan user oracle en group oinstall
chmod 644 *
chmod u+x filename
chmod ug+x filename
umask is de default mode van een file of directory wanneer deze aangemaakt wordt.
rwxrwxrwx=777
rw-rw-rw-=666
rw-r--r--=644 welke correspondeert met umask 022
Linux:
startx
cd /usr/local/src/Oracle8iR3
./runInstaller
of
Het kan zijn dat de installer vraagt om scripts uit te voeren zoals:
orainstRoot.sh en root.sh
Om dit uit te voeren:
or
Create an operating system account for the user. Add the user to the OSDBA or
OSOPER operating system defined groups.
Ensure that the initialization parameter, REMOTE_LOGIN_PASSWORDFILE, is set to
NONE. This is the default value
for this parameter.
For a remote database connection over a secure connection, the user must also
specify the net service name
of the remote database:
OSDBA:
unix : dba
windows: ORA_DBA
OSOPER:
unix : oper
windows: ORA_OPER
This statement adds the user to the password file, thereby enabling connection AS
SYSDBA.
For example, user scott has been granted the SYSDBA privilege, so he can connect
as follows:
Step 1:
-------
Step 3: init.ora
----------------
Using AMM via the sga_target parameter renders several parameters obsolete.
Remember, you can continue
to perform manual SGA tuning if you like, but if you set sga_target, then these
parameters will default to zero:
db_keep_cache_size - This is used to store small tables that perform full table
scans. This data buffer pool was a sub-pool of db_block_buffers in Oracle8i.
db_recycle_cache_size - This is reserved for table blocks from very large tables
that perform full table scans. This was buffer_pool_keep in Oracle8i.
large_pool_size - This is a special area of the shared pool that is reserved for
SGA usage when using the multi-threaded server. The large pool is used for
parallel query and RMAN processing, as well as setting the size of the Java pool.
shared_pool_size - This parameter defines the pool that is shared by all users in
the system, including SQL areas and data dictionary caching. A large
shared_pool_size is not always better than a smaller shared pool. If your
application contains non-reusable SQL, you may get better performance with a
smaller shared pool.
java_pool_size -- This parameter specifies the size of the memory area used by
Java, which is similar to the shared pool used by SQL and PL/SQL.
This is exactly the same automatic tuning principle behind the Oracle9i
pga_aggregate_target parameter that made these parameters obsolete. If you set
pga_aggregate_target, then these parameters are ignored:
sort_area_size - This parameter determines the memory region that is allocated for
in-memory sorting. When the v$sysstat value sorts (disk) become excessive, you may
want to allocate additional memory.
hash_area_size - This parameter determines the memory region reserved for hash
joins. Starting with Oracle9i, Oracle Corporation does not recommend using
hash_area_size unless the instance is configured with the shared server option.
Oracle recommends that you enable automatic sizing of SQL work areas by setting
pga_aggregate_target hash_area_size is retained only for backward compatibility
purposes.
# Archive
LOG_ARCHIVE_DEST_1='LOCATION=/vobs/oracle/oradata/mynewdb/archive'
LOG_ARCHIVE_FORMAT=%t_%s.dbf
LOG_ARCHIVE_START=TRUE
# Shared Server
# Uncomment and use first DISPATCHES parameter below when your listener is
# configured for SSL
# (listener.ora and sqlnet.ora)
# DISPATCHERS = "(PROTOCOL=TCPS)(SER=MODOSE)",
# "(PROTOCOL=TCPS)(PRE=oracle.aurora.server.SGiopServer)"
DISPATCHERS="(PROTOCOL=TCP)(SER=MODOSE)",
"(PROTOCOL=TCP)(PRE=oracle.aurora.server.SGiopServer)",
(PROTOCOL=TCP)
# Miscellaneous
COMPATIBLE=9.2.0
DB_NAME=mynewdb
# Network Registration
INSTANCE_NAME=mynewdb
# Pools
JAVA_POOL_SIZE=31457280
LARGE_POOL_SIZE=1048576
SHARED_POOL_SIZE=52428800
# Resource Manager
RESOURCE_MANAGER_PLAN=SYSTEM_PLAN
###########################################
# Cursors and Library Cache
###########################################
open_cursors=300
###########################################
# Database Identification
###########################################
db_domain=antapex.org
db_name=test10g
###########################################
# Diagnostics and Statistics
###########################################
background_dump_dest=C:\oracle/admin/test10g/bdump
core_dump_dest=C:\oracle/admin/test10g/cdump
user_dump_dest=C:\oracle/admin/test10g/udump
###########################################
# File Configuration
###########################################
control_files=("C:\oracle\oradata\test10g\control01.ctl",
"C:\oracle\oradata\test10g\control02.ctl",
"C:\oracle\oradata\test10g\control03.ctl")
db_recovery_file_dest=C:\oracle/flash_recovery_area
db_recovery_file_dest_size=2147483648
###########################################
# Job Queues
###########################################
job_queue_processes=10
###########################################
# Miscellaneous
###########################################
compatible=10.2.0.1.0
###########################################
# Processes and Sessions
###########################################
processes=150
###########################################
# SGA Memory
###########################################
sga_target=287309824
###########################################
# Security and Auditing
###########################################
audit_file_dest=C:\oracle/admin/test10g/adump
remote_login_passwordfile=EXCLUSIVE
###########################################
# Shared Server
###########################################
dispatchers="(PROTOCOL=TCP) (SERVICE=test10gXDB)"
###########################################
# Sort, Hash Joins, Bitmap Indexes
###########################################
pga_aggregate_target=95420416
###########################################
# System Managed Undo and Rollback Segments
###########################################
undo_management=AUTO
undo_tablespace=UNDOTBS1
LOG_ARCHIVE_DEST=c:\oracle\oradata\log
LOG_ARCHIVE_FORMAT=arch_%t_%s_%r.dbf'
$ SQLPLUS /nolog
CONNECT SYS/password AS SYSDBA
Start an instance without mounting a database. Typically, you do this only during
database creation or while performing
maintenance on the database. Use the STARTUP command with the NOMOUNT option. In
this example, because the initialization
parameter file is stored in the default location, you are not required to specify
the PFILE clause:
STARTUP NOMOUNT
At this point, there is no database. Only the SGA is created and background
processes are started in preparation
for the creation of a new database.
To create the new database, use the CREATE DATABASE statement. The following
statement creates database mynewdb:
catalog.sql All databases Creates the data dictionary and public synonyms for many
of its views
Grants PUBLIC access to the synonyms
catproc.sql All databases Runs all scripts required for, or used with PL/SQL
catclust.sql Real Application Clusters Creates Real Application Clusters data
dictionary views
Oracle supplies other scripts that create additional structures you can use in
managing your database and creating database applications. These scripts are
listed in Table B-2.
See Also:
Your operating system-specific Oracle documentation for the exact names and
locations of these scripts on your operating system
+++++++
- playdwhs
- accpdwhs
En op de pl101 de volgende instance:
- proddwhs
1. FS:
SIZE(G): LPs: PPs:
/dbms/tdbaplay/playdwhs/admin 0.25 4 8
/dbms/tdbaplay/playdwhs/database 15 240 480
/dbms/tdbaplay/playdwhs/recovery 4 64 128
/dbms/tdbaplay/playdwhs/export 5 80 160
+++++++
To make the database functional, you need to create additional files and
tablespaces for users.
The following sample script creates some additional tablespaces:
Run the scripts necessary to build views, synonyms, and PL/SQL packages:
@/dbms/tdbaaccp/ora10g/home/rdbms/admin/catexp.sql
Script Description
CATALOG.SQL: Creates the views of the data dictionary tables, the dynamic
performance views, and public synonyms
for many of the views. Grants PUBLIC access to the synonyms.
CREATE SPFILE='/opt/app/oracle/product/9.2/dbs/spfileOWS.ora'
FROM PFILE='/opt/app/oracle/admin/OWS/pfile/init.ora';
CREATE SPFILE='/opt/app/oracle/product/9.2/dbs/spfilePEGACC.ora'
FROM PFILE='/opt/app/oracle/admin/PEGACC/scripts/init.ora';
CREATE SPFILE='/opt/app/oracle/product/9.2/dbs/spfilePEGTST.ora'
FROM PFILE='/opt/app/oracle/admin/PEGTST/scripts/init.ora';
If you use named user licensing, Oracle can help you enforce this form of
licensing. You can set a limit on the number of users
created in the database. Once this limit is reached, you cannot create more users.
Note:
This mechanism assumes that each person accessing the database has a unique user
name and that no people share a user name.
Therefore, so that named user licensing can help you ensure compliance with your
Oracle license agreement, do not allow
multiple users to log in using the same user name.
LICENSE_MAX_USERS = 200
- per-processor licensing:
Oracle encourages customers to license the database on the per-processor licensing
model. With this licensing method
you count up the number of CPUs in your computer, and multiply that number by the
licensing cost of the database
and database options you need.
Currently the Standard (STD) edition of the database is priced at $15,000 per
processor, and the Enterprise (EE) edition is priced at
$40,000 per processor. The RAC feature is $20,000 per processor extra, and you
need to add 22 percent annually for the support contract.
It's possible to license the database on a per-user basis, which makes financial
sense if there'll never be many users accessing
the database. However, the licensing method can't be changed after it is initially
licensed. So if the business grows and
requires significantly more users to access the database, the costs could exceed
the costs under the per-processor model.
You also have to understand what Oracle corporation considers to be a user for the
purposes of licensing purposes.
If 1,000 users access the database through an application server, which only makes
five connections to the database,
then Oracle will require that either 1,000 user licenses be purchased or that the
database be licensed via
the per-processor pricing model.
The Oracle STD edition is licensed at $300 per user (with a five user minimum),
and EE edition costs $800 per user
(with a 25 user minimum). There is still an annual support fee of 22 percent,
which should be budgeted in addition to the licensing fees.
If the support contract is not paid each year, then the customer is not licensed
to upgrade to the latest version of the database and must
re-purchase all of the licenses over again in order to upgrade versions. This
section only gives you a brief overview of the available
licensing options and costs, so if you have additional questions you really should
contact an Oracle sales representative
The easiest way to create a 8i, 9i database, is using the "Database Configuration
Assistant".
Using this tool, you are able to create a database and setup the NET configuration
and the listener,
in a graphical environment.
WE8ISO8859P15
WE8MMSWIN1252
Example 1:
----------
$ SQLPLUS /nolog
CONNECT username/password AS sysdba
-- Create database
CREATE DATABASE rbdb1
CONTROLFILE REUSE
LOGFILE '/u01/oracle/rbdb1/redo01.log' SIZE 1M REUSE,
'/u01/oracle/rbdb1/redo02.log' SIZE 1M REUSE,
'/u01/oracle/rbdb1/redo03.log' SIZE 1M REUSE,
'/u01/oracle/rbdb1/redo04.log' SIZE 1M REUSE
DATAFILE '/u01/oracle/rbdb1/system01.dbf' SIZE 10M REUSE
AUTOEXTEND ON
NEXT 10M MAXSIZE 200M
CHARACTER SET WE8ISO8859P1;
run catalog.sql
run catproq.sql
-- Bring new rollback segments online and drop the temporary system one
ALTER ROLLBACK SEGMENT rb1 ONLINE;
ALTER ROLLBACK SEGMENT rb2 ONLINE;
ALTER ROLLBACK SEGMENT rb3 ONLINE;
ALTER ROLLBACK SEGMENT rb4 ONLINE;
Example 2:
----------
connect internal
startup nomount pfile=/disk00/oracle/software/7.3.4/dbs/initDB1.ora
etc..
etc..
connect system/manager
@/disk00/oracle/software/7.3.4/rdbms/admin/catdbsyn.sql
@/disk00/oracle/software/7.3.4/rdbms/admin/pubbld.sql
t.b.v. PRODUCT_USER_PROFILE, SQLPLUS_USER_PROFILE
@catalog.sql
@catproq.sql
Oracle 9i:
----------
Example 1:
----------
9.2.1 oratab:
-------------
Voorbeeld:
# $ORACLE_SID:$ORACLE_HOME:[N|Y]
#
ORCL:/u01/app/oracle/product/8.0.5:Y
#
Het script dbstart zal oratab lezen en ook tests doen en om de oracle versie
te bepalen. Verder bestaat de kern uit:
Tijdens het opstarten van Unix worden de scrips in de /etc/rc2.d uitgevoerd die
beginnen met een 'S'
en in alfabetische volgorde.
De Oracle database processen zullen als (een van de) laatste processen worden
gestart.
Het bestAND S99oracle is gelinkt met deze directory.
Inhoud S99oracle:
Het dbstart script is een standaard Oracle script. Het kijkt in oratab welke sid's
op 'Y' staan,
en zal deze databases starten.
Tijdens het down brengen van Unix (shutdown -i 0) worden de scrips in de directory
/etc/rc2.d
uitgevoerd die beginnen met een 'K' en in alfabetische volgorde.
De Oracle database processen zijn een van de eerste processen die worden
afgesloten.
Het bestand K10oracle is gelinkt met de /etc/rc2.d/K10oracle
Startdb [ORACLE_SID]
--------------------
Dit script is een onderdeel van het script S99Oracle. Dit script heeft 1
parameter, ORACLE_SID
. $ORACLE_ADMIN/env/profile
ORACLE_SID=$1
echo $ORACLE_SID
Stopdb [ORACLE_SID]
-------------------
Dit script is een onderdeel van het script K10Oracle. Dit script heeft 1
parameter, ORACLE_SID
ORACLE_SID=$1
export $ORACLE_SID
# Batches (Oracle)
1) Older versions
9.7 Tools:
----------
info:
showrev -p
pkginfo -i
relink:
mk -f $ORACLE_HOME/rdbms/lib/ins_rdbms.mk install
mk -f $ORACLE_HOME/svrmgr/lib/ins_svrmgr.mk install
mk -f $ORACLE_HOME/network/lib/ins_network.mk install
$ORACLE_HOME/bin
relink all
Relinking Oracle
[Step 1] Log into the UNIX system as the Oracle software owner
Typically this is the user 'oracle'.
[Step 3] Verify and/or Configure the UNIX Environment for Proper Relinking:
For all Oracle Versions and UNIX Platforms: The Platform specific environment
variables LIBPATH, LD_LIBRARY_PATH,
& SHLIB_PATH typically are already set to include system library locations like
'/usr/lib'.
In most cases, you need only check what they are set to first, then add the
$ORACLE_HOME/lib directory to them
where appropriate. i.e.:
% setenv LD_LIBRARY_PATH ${ORACLE_HOME}/lib:${LD_LIBRARY_PATH}
(see [NOTE:131207.1] How to Set UNIX Environment Variables for help with setting
UNIX environment variables)
Note: ldap option is available only from 9i. In 8i, you would have to manually
relink ldap.
You can relink most of the executables associated with an Oracle Server
Installation
by running the following command: % relink all
This will not relink every single executable Oracle provides
(you can discern which executables were relinked by checking their timestamp with
-or-
Since the 'relink' command merely calls the traditional 'make' commands, you
still have the option of running the 'make' commands independently:
For executables: oracle, exp, imp, sqlldr, tkprof, mig, dbv, orapwd, rman,
svrmgrl, ogms, ogmsctl
% cd $ORACLE_HOME/rdbms/lib
% make -f ins_rdbms.mk install
For executables: sqlplus
% cd $ORACLE_HOME/sqlplus/lib
% make -f ins_sqlplus.mk install
For executables: isqlplus
% cd $ORACLE_HOME/sqlplus/lib
% make -f ins_sqlplus install_isqlplus
For executables: dbsnmp, oemevent, oratclsh
% cd $ORACLE_HOME/network/lib
% make -f ins_oemagent.mk install
For executables: names, namesctl
% cd $ORACLE_HOME/network/lib
% make -f ins_names.mk install
For executables: osslogin, trcasst, trcroute, onrsd, tnsping
% cd $ORACLE_HOME/network/lib
% make -f ins_net_client.mk install
For executables: tnslsnr, lsnrctl
% cd $ORACLE_HOME/network/lib
% make -f ins_net_server.mk install
For executables related to ldap (for example Oracle Internet Directory):
% cd $ORACLE_HOME/ldap/lib
% make -f ins_ldap.mk install
Note:
Unix Installation/OS: RDBMS Technical Forum
solaris upgrade
--------------------------------------------------------------------------------
You must relink even if you find that the databases came up after Solaris upgrade
and they seem fine.
--------------------------------------------------------------------------------
Hello Ray,
Regards,
Soumya
P522:/home/oracle $lsnrctl
exec(): 0509-036 Cannot load program lsnrctl because of the following errors:
0509-130 Symbol resolution failed for /usr/lib/libc.a[aio_64.o] because:
0509-136 Symbol kaio_rdwr64 (number 0) is not exported from
dependent module /unix.
0509-136 Symbol listio64 (number 1) is not exported from
dependent module /unix.
0509-136 Symbol acancel64 (number 2) is not exported from
dependent module /unix.
0509-136 Symbol iosuspend64 (number 3) is not exported from
dependent module /unix.
0509-136 Symbol aio_nwait (number 4) is not exported from
dependent module /unix.
0509-150 Dependent module libc.a(aio_64.o) could not be loaded.
0509-026 System error: Cannot run a file that does not have a valid
format.
0509-192 Examine .loader section symbols with the
'dump -Tv' command.
trace:
------
NOTE: The "truss" command works on SUN and Sequent. Use "tusc" on HP-UX, "strace"
on Linux,
"trace" on SCO Unix or call your system administrator to find the equivalent
command on your system.
Monitor your Unix system:
Logfiles:
---------
Unix message files record all system problems like disk errors, swap errors, NFS
problems, etc.
Monitor the following files on your system to detect system problems:
tail -f /var/adm/SYSLOG
tail -f /var/adm/messages
tail -f /var/log/syslog
===============
10. CONSTRAINTS:
===============
SELECT DISTINCT
substr(owner, 1, 10) as INDEX_OWNER,
substr(index_name, 1, 40) as INDEX_NAME,
substr(tablespace_name,1,40) as TABLE_SPACE,
substr(index_type, 1, 10) as INDEX_TYPE,
substr(table_owner, 1, 10) as TABLE_OWNER,
substr(table_name, 1, 40) as TABLE_NAME,
BLEVEL,NUM_ROWS,STATUS
FROM DBA_INDEXES
order by index_owner;
SELECT DISTINCT
substr(owner, 1, 10) as INDEX_OWNER,
substr(index_name, 1, 40) as INDEX_NAME,
substr(index_type, 1, 10) as INDEX_TYPE,
substr(table_owner, 1, 10) as TABLE_OWNER,
substr(table_name, 1, 40) as TABLE_NAME
FROM DBA_INDEXES
WHERE table_name='HEAT_CUSTOMER';
SELECT
substr(owner, 1, 10) as INDEX_OWNER,
substr(index_name, 1, 40) as INDEX_NAME,
substr(index_type, 1, 10) as INDEX_TYPE,
substr(table_owner, 1, 10) as TABLE_OWNER,
substr(table_name, 1, 40) as TABLE_NAME
FROM DBA_INDEXES
WHERE owner<>table_owner;
SELECT
c.constraint_type as TYPE,
SUBSTR(c.table_name, 1, 40) as TABLE_NAME,
SUBSTR(c.constraint_name, 1, 40) as CONSTRAINT_NAME,
SUBSTR(c.r_constraint_name, 1, 40) as REF_KEY,
SUBSTR(b.column_name, 1, 40) as COLUMN_NAME
FROM DBA_CONSTRAINTS c, DBA_CONS_COLUMNS b
WHERE
c.constraint_name=b.constraint_name AND
c.OWNER in ('TRIDION_CM','TCMLOGDBUSER','VPOUSERDB')
AND c.constraint_type in ('P', 'R', 'U');
SELECT
c.constraint_type as TYPE,
SUBSTR(c.table_name, 1, 40) as TABLE_NAME,
SUBSTR(c.constraint_name, 1, 40) as CONSTRAINT_NAME,
SUBSTR(c.r_constraint_name, 1, 40) as REF_KEY,
SUBSTR(b.column_name, 1, 40) as COLUMN_NAME
FROM DBA_CONSTRAINTS c, DBA_CONS_COLUMNS b
WHERE
c.constraint_name=b.constraint_name AND
c.OWNER='RM_LIVE'
AND c.constraint_type in ('P', 'R', 'U');
SELECT distinct
c.constraint_type as TYPE,
SUBSTR(c.table_name, 1, 40) as TABLE_NAME,
SUBSTR(c.constraint_name, 1, 40) as CONSTRAINT_NAME,
SUBSTR(c.r_constraint_name, 1, 40) as REF_KEY
FROM DBA_CONSTRAINTS c, DBA_CONS_COLUMNS b
WHERE
c.constraint_name=b.constraint_name AND
c.OWNER='RM_LIVE'
AND c.constraint_type ='R';
-----------------------------------------------------------------------
create table reftables
(TYPE varchar2(32),
TABLE_NAME varchar2(40),
CONSTRAINT_NAME varchar2(40),
REF_KEY varchar2(40),
REF_TABLE varchar2(40));
update reftables
set REF_TABLE=(select distinct table_name from dba_cons_columns
where owner='RM_LIVE' and CONSTRAINT_NAME=REF_KEY);
----------------------------------------------------------------------
SELECT
c.constraint_type as TYPE,
SUBSTR(c.table_name, 1, 40) as TABLE_NAME,
SUBSTR(c.constraint_name, 1, 40) as CONSTRAINT_NAME,
SUBSTR(c.r_constraint_name, 1, 40) as REF_KEY
FROM DBA_CONSTRAINTS c, DBA_CONS_COLUMNS b
WHERE
c.constraint_name=b.constraint_name AND
c.OWNER='RM_LIVE'
AND c.constraint_type ='R';
SELECT
c.constraint_type as TYPE,
SUBSTR(c.table_name, 1, 40) as TABLE_NAME,
SUBSTR(c.constraint_name, 1, 40) as CONSTRAINT_NAME,
SUBSTR(c.r_constraint_name, 1, 40) as REF_KEY,
(select b.table_name from dba_cons_columns where
b.constraint_name=c.r_constraint_name) as REF_TABLE
FROM DBA_CONSTRAINTS c, DBA_CONS_COLUMNS b
WHERE
c.constraint_name=b.constraint_name AND
c.OWNER='RM_LIVE'
AND c.constraint_type ='R' or c.constraint_type ='P' ;
select
SELECT
SUBSTR(owner, 1, 10) as OWNER,
constraint_type as TYPE,
SUBSTR(table_name, 1, 40) as TABLE_NAME,
SUBSTR(constraint_name, 1, 40) as CONSTRAINT_NAME,
SUBSTR(r_constraint_name, 1, 40) as REF_KEY,
DELETE_RULE as DELETE_RULE,
status
FROM DBA_CONSTRAINTS
WHERE OWNER='BRAINS' AND constraint_type in ('R', 'P', 'U');
SELECT
SUBSTR(owner, 1, 10) as OWNER,
constraint_type as TYPE,
SUBSTR(table_name, 1, 30) as TABLE_NAME,
SUBSTR(constraint_name, 1, 30) as CONSTRAINT_NAME,
SUBSTR(r_constraint_name, 1, 30) as REF_KEY,
DELETE_RULE as DELETE_RULE,
status
FROM DBA_CONSTRAINTS
WHERE OWNER='BRAINS' AND constraint_type in ('R');
-- owner en alle primary key constraints bepalen van een bepaalde user, op
bepaalde objects
SELECT
c.constraint_type as Type,
substr(x.index_name, 1, 40) as INDX_NAME,
substr(c.constraint_name, 1, 40) as CONSTRAINT_NAME,
substr(x.tablespace_name, 1, 40) as TABLESPACE
FROM DBA_CONSTRAINTS c, DBA_INDEXES x
WHERE
c.constraint_name=x.index_name AND
c.constraint_name='UN_DEMO1';
SELECT
c.constraint_type as Type,
substr(x.index_name, 1, 40) as INDX_NAME,
substr(c.constraint_name, 1, 40) as CONSTRAINT_NAME,
substr(c.table_name, 1, 40) as TABLE_NAME,
substr(c.owner, 1, 10) as OWNER
FROM DBA_CONSTRAINTS c, DBA_INDEXES x
WHERE
c.constraint_name=x.index_name AND
c.owner='JOOPLOC';
SELECT
substr(s.segment_name, 1, 40) as Segmentname,
substr(c.constraint_name, 1, 40) as Constraintname,
substr(s.tablespace_name, 1, 40) as Tablespace,
substr(s.segment_type, 1, 10) as Type
FROM DBA_SEGMENTS s, DBA_CONSTRAINTS c
WHERE
s.segment_name=c.constraint_name
AND
c.owner='PROJECTS';
DBA_INDEXES
DBA_IND_COLUMNS
SELECT
substr(i.index_name, 1, 40) as INDEX_NAME,
substr(i.index_type, 1, 15) as INDEX_TYPE,
substr(i.table_name, 1, 40) as TABLE_NAME,
substr(c.index_owner, 1, 10) as INDEX_OWNER,
substr(c.column_name, 1, 40) as COLUMN_NAME,
c.column_position as POSITION
FROM DBA_INDEXES i, DBA_IND_COLUMNS c
WHERE i.index_name=c.index_name AND i.owner='SALES';
-- aanzetten:
-- uitzetten:
-- voorbeeld:
Dit kan handig zijn bij bijvoorbeeld het laden van een
table waarbij mogelijk dubbele waarden voorkomen
Als nu blijkt dat bij het aanzetten van de constraint, er dubbele records
voorkomen,
kunnen we deze dubbele records plaatsen in de EXCEPTIONS table:
@ORACLE_HOME\rdbms\admin\utlexcpt.sql
2. Constraint aaNzetten:
Hierbij kun je dus niet zondermeer een row met een bepaald custid
uit customers verwijderen, indien er een row in contacts bestaat met hetzelfde
custid.
DBA_TABLES
DBA_INDEXES,
DBA_CONSTRAINTS,
DBA_IND_COLUMNS,
DBA_SEGMENTS
USER_TABLES, ALL_TABLES
USER_INDEXES, ALL_INDEXES
USER_CONSTRAINTS, ALL_CONSTRAINTS
USER_VIEWS, ALL_VIEWS
USER_SEQUENCES, ALL_SEQUENCES
USER_CONS_COLUMNS, ALL_CONS_COLUMNS
USER_TAB_COLUMNS, ALL_TAB_COLUMNS
USER_SOURCE, ALL_SOURCE
cat
tab
col
dict
================================
11. DBMS_JOB and scheduled Jobs:
================================
DBMS_JOB.SUBMIT()
DBMS_JOB.REMOVE()
DBMS_JOB.CHANGE()
DBMS_JOB.WHAT()
DBMS_JOB.NEXT_DATE()
DBMS_JOB.INTERVAL()
DBMS_JOB.RUN()
11.2.1 DBMS_JOB.SUBMIT()
-----------------------
PROCEDURE DBMS_JOB.SUBMIT
(job OUT BINARY_INTEGER,
what IN VARCHAR2,
next_date IN DATE DEFAULT SYSDATE,
interval IN VARCHAR2 DEFAULT 'NULL',
no_parse IN BOOLEAN DEFAULT FALSE);
PROCEDURE DBMS_JOB.ISUBMIT
(job IN BINARY_INTEGER,
what IN VARCHAR2,
next_date in DATE DEFAULT SYSDATE
interval IN VARCHAR2 DEFAULT 'NULL',
no_parse in BOOLEAN DEFAULT FALSE);
The difference between ISUBMIT and SUBMIT is that ISUBMIT specifies a job number,
whereas SUBMIT returns a job number generated by the DBMS_JOB package
Submit a job:
--------------
The jobnumber (if you use SUBMIT() ) will be derived from the sequence SYS.JOBSEQ
Example 1:
----------
DECLARE
jobno NUMBER;
BEGIN
DBMS_JOB.SUBMIT
(job => jobno
,what => 'test1;'
,next_date => SYSDATE
,interval => 'SYSDATE+1/24');
COMMIT;
END;
/
So suppose you submit the above job at 08.15h. Then the next, and first time,
that the job will run is at 09.15h.
Example 2:
----------
Example 3:
----------
PRINT jobno
JOBNO
----------
14144
DECLARE
jobno NUMBER;
BEGIN
DBMS_JOB.SUBMIT
(job => jobno
,what => 'begin space_logger; end;'
,next_date => SYSDATE
,interval => 'SYSDATE+1/24');
COMMIT;
END;
/
---------------------------------------------------------------------------------
Example 6:
----------
----------------------------------------------------------------------------------
----
variable jobno number;
begin
DBMS_JOB.SUBMIT(:jobno, 'test1;', null, 'TRUNC(LAST_DAY(SYSDATE ) + 1)' );
commit;
end;
/
In the job definition, use two single quotation marks around strings.
Always include a semicolon at the end of the job definition.
11.2.2 DBMS_JOB.REMOVE()
------------------------
BEGIN
DBMS_JOB.REMOVE(14144);
END;
/
11.2.3 DBMS_JOB.CHANGE()
------------------------
In this example, job number 14144 is altered to execute every three days:
BEGIN
DBMS_JOB.CHANGE(1, NULL, NULL, 'SYSDATE + 3');
END;
/
If you specify NULL for WHAT, NEXT_DATE, or INTERVAL when you call the
procedure DBMS_JOB.CHANGE, the current value remains unchanged.
11.2.4 DBMS_JOB.WHAT()
----------------------
You can alter the definition of a job by calling the DBMS_JOB.WHAT procedure.
The following example changes the definition for job number 14144:
BEGIN
DBMS_JOB.WHAT(14144,
'DBMS_DDL.ANALYZE_OBJECT(''TABLE'',
''HR'', ''DEPARTMENTS'',
''ESTIMATE'', NULL, 50);');
END;
/
11.2.5 DBMS_JOB.NEXT_DATE()
---------------------------
You can alter the next execution time for a job by calling the
DBMS_JOB.NEXT_DATE procedure, as shown in the following example:
BEGIN
DBMS_JOB.NEXT_DATE(14144, SYSDATE + 4);
END;
/
11.2.6 DBMS_JOB.INTERVAL():
---------------------------
BEGIN
DBMS_JOB.INTERVAL(14144, 'NULL');
END;
/
execute dbms_job.interval(<job number>,'SYSDATE+(1/48)');
In this case, the job will not run again after it successfully executes
and it will be deleted FROM the job queue
11.2.7 DBMS_JOB.BROKEN():
-------------------------
A job is labeled as either broken or not broken. Oracle does not attempt to run
broken jobs.
Example:
BEGIN
DBMS_JOB.BROKEN(10, TRUE);
END;
/
Example:
The following example marks job 14144 as not broken and sets its
next execution date to the following Monday:
BEGIN
DBMS_JOB.BROKEN(14144, FALSE, NEXT_DAY(SYSDATE, 'MONDAY'));
END;
/
Example:
Example:
BEGIN
FOR job_rec IN broken_jobs_cur
LOOP
DBMS_JOB.BROKEN(job_rec.job,FALSE);
END LOOP;
END job_fixer;
11.2.8 DBMS_JOB.RUN():
----------------------
BEGIN
DBMS_JOB.RUN(14144);
END;
/
11.3 DBMS_SCHEDULER:
--------------------
BEGIN
DBMS_SCHEDULER.create_job (
job_name => 'test_self_contained_job',
job_type => 'PLSQL_BLOCK',
job_action => 'BEGIN DBMS_STATS.gather_schema_stats(''JOHN''); END;',
start_date => SYSTIMESTAMP,
repeat_interval => 'freq=hourly; byminute=0',
end_date => NULL,
enabled => TRUE,
comments => 'Job created using the CREATE JOB procedure.');
End;
/
BEGIN
DBMS_SCHEDULER.run_job (job_name => 'TEST_PROGRAM_SCHEDULE_JOB',
use_current_session => FALSE);
END;
/
BEGIN
DBMS_SCHEDULER.stop_job (job_name => 'TEST_PROGRAM_SCHEDULE_JOB');
END;
/
BEGIN
DBMS_SCHEDULER.drop_job (job_name => 'TEST_PROGRAM_SCHEDULE_JOB');
DBMS_SCHEDULER.drop_job (job_name => 'test_self_contained_job');
END;
/
Oracle 10g:
-----------
Views:
V_$SCHEDULER_RUNNING_JOBS
GV_$SCHEDULER_RUNNING_JOBS
DBA_QUEUE_SCHEDULES
USER_QUEUE_SCHEDULES
_DEFSCHEDULE
DEFSCHEDULE
AQ$SCHEDULER$_JOBQTAB_S
AQ$_SCHEDULER$_JOBQTAB_F
AQ$SCHEDULER$_JOBQTAB
AQ$SCHEDULER$_JOBQTAB_R
AQ$SCHEDULER$_EVENT_QTAB_S
AQ$_SCHEDULER$_EVENT_QTAB_F
AQ$SCHEDULER$_EVENT_QTAB
AQ$SCHEDULER$_EVENT_QTAB_R
DBA_SCHEDULER_PROGRAMS
USER_SCHEDULER_PROGRAMS
ALL_SCHEDULER_PROGRAMS
DBA_SCHEDULER_JOBS
USER_SCHEDULER_JOBS
ALL_SCHEDULER_JOBS
DBA_SCHEDULER_JOB_CLASSES
ALL_SCHEDULER_JOB_CLASSES
DBA_SCHEDULER_WINDOWS
ALL_SCHEDULER_WINDOWS
DBA_SCHEDULER_PROGRAM_ARGS
USER_SCHEDULER_PROGRAM_ARGS
ALL_SCHEDULER_PROGRAM_ARGS
DBA_SCHEDULER_JOB_ARGS
USER_SCHEDULER_JOB_ARGS
ALL_SCHEDULER_JOB_ARGS
DBA_SCHEDULER_JOB_LOG
DBA_SCHEDULER_JOB_RUN_DETAILS
USER_SCHEDULER_JOB_LOG
USER_SCHEDULER_JOB_RUN_DETAILS
ALL_SCHEDULER_JOB_LOG
ALL_SCHEDULER_JOB_RUN_DETAILS
DBA_SCHEDULER_WINDOW_LOG
DBA_SCHEDULER_WINDOW_DETAILS
ALL_SCHEDULER_WINDOW_LOG
ALL_SCHEDULER_WINDOW_DETAILS
DBA_SCHEDULER_WINDOW_GROUPS
ALL_SCHEDULER_WINDOW_GROUPS
DBA_SCHEDULER_WINGROUP_MEMBERS
ALL_SCHEDULER_WINGROUP_MEMBERS
DBA_SCHEDULER_SCHEDULES
USER_SCHEDULER_SCHEDULES
ALL_SCHEDULER_SCHEDULES
DBA_SCHEDULER_RUNNING_JOBS
ALL_SCHEDULER_RUNNING_JOBS
USER_SCHEDULER_RUNNING_JOBS
DBA_SCHEDULER_GLOBAL_ATTRIBUTE
ALL_SCHEDULER_GLOBAL_ATTRIBUTE
DBA_SCHEDULER_CHAINS
USER_SCHEDULER_CHAINS
ALL_SCHEDULER_CHAINS
DBA_SCHEDULER_CHAIN_RULES
USER_SCHEDULER_CHAIN_RULES
ALL_SCHEDULER_CHAIN_RULES
DBA_SCHEDULER_CHAIN_STEPS
USER_SCHEDULER_CHAIN_STEPS
ALL_SCHEDULER_CHAIN_STEPS
DBA_SCHEDULER_RUNNING_CHAINS
USER_SCHEDULER_RUNNING_CHAINS
ALL_SCHEDULER_RUNNING_CHAINS
==================
12. Net8 / SQLNet:
==================
-----------------
Username: system
Password: manager
Host String: XXX
-----------------
SQLNET.AUTHENTICATION_SERVICES= (NTS)
NAMES.DIRECTORY_PATH= (TNSNAMES)
DB1=
(DESCRIPTION=
(ADDRESS_LIST=
(ADDRESS=(PROTOCOL=TCP)(HOST=STARBOSS)(PORT=1521)
)
(CONNECT_DATA=
(SERVICE_NAME=DB1.world)
)
)
voorbeeld 2.
DB1.world=
(DESCRIPTION=
(ADDRESS_LIST=
(ADDRESS=(COMMUNITY=tcp.world)(PROTOCOL=TCP)(HOST=STARBOSS)(PORT=1521)
)
(CONNECT_DATA=(SID=DB1)
)
)
DB2.world=
(... )
DB3.world=
(... )
etc..
voorbeeld 3.
RCAT =
(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = TCP)(HOST = w2ktest)(PORT = 1521))
)
(CONNECT_DATA =
(SERVICE_NAME = rcat.antapex)
)
)
Example 1:
----------
LISTENER=
(DESCRIPTION=
(ADDRESS=(PROTOCOL=TCP)(HOST=STARBOSS)(PORT=1521))
)
SID_LIST_LISTENER=
(SID_LIST=
(SID_DESC=
(GLOBAL_DBNAME=DB1.world)
(ORACLE_HOME=D:\oracle8i)
(SID_NAME=DB1)
)
)
Example 2:
----------
WPRD =
(DESCRIPTION_LIST =
(DESCRIPTION =
(ADDRESS_LIST=(ADDRESS=(PROTOCOL=TCP)(HOST=blnl01)(PORT=1521)))))
SID_LIST_WPRD =
(SID_LIST =
(SID_DESC =
(GLOBAL_DBNAME = WPRD)
(ORACLE_HOME = /opt/oracle/product/8.1.6)
(SID_NAME = WPRD)))
WTST =
(DESCRIPTION_LIST =
(DESCRIPTION =
(ADDRESS_LIST=(ADDRESS=(PROTOCOL=TCP)(HOST=blnl01)(PORT=1522)))))
SID_LIST_WTST =
(SID_LIST =
(SID_DESC =
(GLOBAL_DBNAME = WTST)
(ORACLE_HOME = /opt/oracle/product/8.1.6)
(SID_NAME = WTST)))
Example 3:
----------
LISTENER =
(DESCRIPTION_LIST =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC0))
)
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = missrv)(PORT = 1521))
)
)
SID_LIST_LISTENER =
(SID_LIST =
(SID_DESC =
(SID_NAME = PLSExtProc)
(ORACLE_HOME = D:\oracle\ora901)
(PROGRAM = extproc)
)
(SID_DESC =
(GLOBAL_DBNAME = o901)
(ORACLE_HOME = D:\oracle\ora901)
(SID_NAME = o901)
)
(SID_DESC =
(SID_NAME = MAST)
(ORACLE_HOME = D:\oracle\ora901)
(PROGRAM = hsodbc)
)
(SID_DESC =
(SID_NAME = NATOPS)
(ORACLE_HOME = D:\oracle\ora901)
(PROGRAM = hsodbc)
)
(SID_DESC =
(SID_NAME = VRF)
(ORACLE_HOME = D:\oracle\ora901)
(PROGRAM = hsodbc)
)
(SID_DESC =
(SID_NAME = DRILLS)
(ORACLE_HOME = D:\oracle\ora901)
(PROGRAM = hsodbc)
)
(SID_DESC =
(SID_NAME = DDS)
(ORACLE_HOME = D:\oracle\ora901)
(PROGRAM = hsodbc)
)
(SID_DESC =
(SID_NAME = IVP)
(ORACLE_HOME = D:\oracle\ora901)
(PROGRAM = hsodbc)
(SID_DESC =
(SID_NAME = ALBERT)
(ORACLE_HOME = D:\oracle\ora901)
(PROGRAM = hsodbc)
)
)
ORCL=
(DESCRIPTION=
(ADDRESS_LIST=
(ADDRESS=(PROTOCOL=TCP)(HOST=DBPROD)(PORT=1521))
(ADDRESS=(PROTOCOL=TCP)(HOST=DBFAIL)(PORT=1521))
)
(CONNECT_DATA=(SERVICE_NAME=PROD)(SERVER=DEDICATED)
)
)
Client Load Balancing is a feature that allows clients to randomly select from a
list of listeners.
Oracle Net moves through the list of listeners and balances the load of connection
requests
accross the available listeners.
Here is an example of the tnsnames.ora entry that allows for load balancing:
ORCL=
(DESCRIPTION=
(LOAD_BALANCE=ON)
(ADDRESS_LIST=
(ADDRESS=(PROTOCOL=TCP)(HOST=MWEISHAN-DELL)(PORT=1522))
(ADDRESS=(PROTOCOL=TCP)(HOST=MWEISHAN-DELL)(PORT=1521))
)
(CONNECT_DATA=(SERVICE_NAME=PROD)(SERVER=DEDICATED)
)
)
With the dedicated Server, each server process has a PGA, outside the SGA
When Shared Server is used, the user program area's are in the SGA in the large
pool.
1. DISPATCHERS:
The DISPATCHERS parameter defines the number of dispatchers that should start when
the instance is started.
For example, if you want to configure 3 TCP/IP dispatchers and to IPC dispatchers,
DISPATCHERS="(PRO=TCP)(DIS=3)(PRO=IPC)(DIS=2)"
For example, if you have 500 concurrent TCP/IP connections, and you want each
dispatcher to manage
50 concurrent connections, you need 10 dispatchers.
You set your DISPATCHERS parameter as follows:
DISPATCHERS="(PRO=TCP)(DIS=10)"
2. SHARED_SERVER:
View information about dispatchers and shared servers with the following commands
and queries:
lsnrctl services
Notes:
=======
Note 1:
-------
Doc ID: Note:274130.1 Content Type: TEXT/PLAIN
Subject: SHARED SERVER CONFIGURATION Creation Date: 25-MAY-2004
Type: BULLETIN Last Revision Date: 24-JUN-2004
Status: PUBLISHED
PURPOSE
-------
USAGE:
-----
DISPATCHERS = "(PROTOCOL=TCP)(DISPATCHERS=3)"
ORACLE.IDC.ORACLE.COM =
(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = TCP)(HOST = xyzac)(PORT = 1521))
)
(CONNECT_DATA =
(SERVER = DEDICATED)
(SERVICE_NAME = oracle)
)
)
to
ORACLE.IDC.ORACLE.COM =
(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = TCP)(HOST = xyzac)(PORT = 1521))
)
(CONNECT_DATA =
(SERVER = SHARED)
(SERVICE_NAME = Oracle)
)
)
Change SERVER=SHARED.
SERVER
---------
DEDICATED
DEDICATED
DEDICATED
SHARED
DEDICATED
NOTE:
====
The following parameters are optional (if not specified, Oracle selects
defaults):
MAX_DISPATCHERS:
===============
Specifies the maximum number of dispatcher processes that can run
simultaneously.
SHARED_SERVERS:
==============
Specifies the number of shared server processes created when an instance
is started up.
MAX_SHARED_SERVERS:
==================
Specifies the maximum number of shared server processes that can run
simultaneously.
CIRCUITS:
========
Specifies the total number of virtual circuits that are available for
inbound and outbound network sessions.
SHARED_SERVER_SESSIONS:
======================
Specifies the total number of shared server user sessions to allow.
Setting this parameter enables you to reserve user sessions for
dedicated servers.
Other parameters affected by shared server that may require adjustment:
LARGE_POOL_SIZE:
===============
Specifies the size in bytes of the large pool allocation heap. Shared
server may force the default value to be set too high, causing
performance problems or problems starting the database.
SESSIONS:
========
Specifies the maximum number of sessions that can be created in the
system. May need to be adjusted for shared server.
Note 1:
LSNRCTL> set password <password> where <password> is the password you want to use.
To change a password, use "Change_Password" You can also designate a password when
you configure the listener
with the Net8 Assistant. These passwords are stored in the listener.ora file and
although they will not show
in the Net8 Assistant, they are readable in the listener.ora file.
Note 2:
Note 3:
See the net8 admin guide for info but in short -- you can:
LSNRCTL> change_password
Old password: <just hit enter if you don't have one yet>
New password:
Reenter new password:
Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=slackdog)(PORT=1521)))
Password changed for LISTENER
The command completed successfully
LSNRCTL> save_config
Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=slackdog)(PORT=1521)))
Saved LISTENER configuration parameters.
Listener Parameter File /d01/home/oracle8i/network/admin/listener.ora
Old Parameter File /d01/home/oracle8i/network/admin/listener.bak
The command completed successfully
LSNRCTL>
Now, you need to use a password to do various operations (such as STOP) but not
others (such as STATUS)
=============================================
13. Datadictionary queries Rollback segments:
=============================================
Doe de query begin meting, en bij einde meting en bekijk het verschil
Query 2:
minimum=a/b (100/10=10)
=========================================================
14. Data dictionary queries m.b.t. security, permissions:
=========================================================
========================
15. INIT.ORA parameters:
========================
LOG_ARCHIVE_DEST=/oracle/admin/cc1/arch
LOG_ARCHIVE_START=TRUE
LOG_ARCHIVE_FORMAT=archcc1_%s.log
10g:
LOG_ARCHIVE_DEST=c:\oracle\oradata\log'
LOG_ARCHIVE_FORMAT=arch_%t_%s_%r.dbf'
other:
LOG_ARCHIVE_DEST_1=
LOG_ARCHIVE_DEST_2=
LOG_ARCHIVE_MAX_PROCESSES=2
15.2 init.ora en perfoRMANce en SGA:
------------------------------------
SHARED_POOL_SIZE: in bytes or K or M
SHARED_POOL_SIZE specifies (in bytes) the size of the shared pool. The shared pool
contains shared cursors, stored procedures,
control structures, and other structures. If you set PARALLEL_AUTOMATIC_TUNING to
false,
Oracle also allocates parallel execution message buffers from the shared pool.
Larger values improve perfoRMANce in multi-user systems.
Smaller values use less memory.
You can monitor utilization of the shared pool by querying the view V$SGASTAT.
SHARED_POOL_RESERVED_SIZE:
The parameter was introduced in Oracle 7.1.5 and provides a means of reserving a
portion of the shared pool
for large memory allocations. The reserved area comes out of the shared pool
itself.
From a practical point of view one should set SHARED_POOL_RESERVED_SIZE to about
10%
of SHARED_POOL_SIZE unless either the shared pool is very large OR
SHARED_POOL_RESERVED_MIN_ALLOC
has been set lower than the default value:
15.3 init.ora en jobs:
----------------------
db_name = CC1
global_names = TRUE
instance_name = CC1
db_domain = antapex.net
audit_file_dest = /dbs01/app/oracle/admin/AMI_PRD/adump
background_dump_dest = /dbs01/app/oracle/admin/AMI_PRD/bdump
user_dump_dest = /dbs01/app/oracle/admin/AMI_PRD/udump
core_dump_dest = /dbs01/app/oracle/admin/AMI_PRD/cdump
are enforced)
compatible = 8.1.7.0.0
control_files = /dbs04/oradata/AMI_PRD/ctrl/cc1_01.ctl
control_files = /dbs05/oradata/AMI_PRD/ctrl/cc1_02.ctl
control_files = /dbs06/oradata/AMI_PRD/ctrl/cc1_03.ctl
PARAMETER DESCRIPTION
------------------------------ ----------------------------------------
O7_DICTIONARY_ACCESSIBILITY Version 7 Dictionary Accessibility
support [TRUE | FALSE]
db_file_multiblock_read_count:
The db_file_multiblock_read_count initialization parameter determines the maximum
number of database blocks
read in one I/O operation during a full table scan. The setting of this
parameter can reduce
the number of I/O calls required for a full table scan, thus improving
performance.
- UNDO_MANAGEMENT
If AUTO, use automatic undo management mode. If MANUAL, use manual undo
management mode.
- UNDO_TABLESPACE
A dynamic parameter specifying the name of an undo tablespace to use.
- UNDO_RETENTION
A dynamic parameter specifying the length of time to retain undo. Default is 900
seconds.
- UNDO_SUPPRESS_ERRORS
If TRUE, suppress error messages if manual undo management SQL statements are
issued when operating
in automatic undo management mode. If FALSE, issue error message. This is a
dynamic parameter.
If you're database is on manual, you can still use the following 8i type
parameters:
- ROLLBACK_SEGMENTS
Specifies the rollback segments to be acquired at instance startup
- TRANSACTIONS
Specifies the maximum number of concurrent transactions
- TRANSACTIONS_PER_ROLLBACK_SEGMENT
Specifies the number of concurrent transactions that each rollback segment is
expected to handle
- MAX_ROLLBACK_SEGMENTS
Specifies the maximum number of rollback segments that can be online for any
instance
Example 1:
----------
# Archive
LOG_ARCHIVE_DEST_1='LOCATION=/vobs/oracle/oradata/mynewdb/archive'
LOG_ARCHIVE_FORMAT=%t_%s.dbf
LOG_ARCHIVE_START=TRUE
# Shared Server
# Uncomment and use first DISPATCHES parameter below when your listener is
# configured for SSL
# (listener.ora and sqlnet.ora)
# DISPATCHERS = "(PROTOCOL=TCPS)(SER=MODOSE)",
# "(PROTOCOL=TCPS)(PRE=oracle.aurora.server.SGiopServer)"
DISPATCHERS="(PROTOCOL=TCP)(SER=MODOSE)",
"(PROTOCOL=TCP)(PRE=oracle.aurora.server.SGiopServer)",
(PROTOCOL=TCP)
# Miscellaneous
COMPATIBLE=9.2.0
DB_NAME=mynewdb
# Network Registration
INSTANCE_NAME=mynewdb
# Pools
JAVA_POOL_SIZE=31457280
LARGE_POOL_SIZE=1048576
SHARED_POOL_SIZE=52428800
# Resource Manager
RESOURCE_MANAGER_PLAN=SYSTEM_PLAN
Example 2:
----------
##############################################################################
# Copyright (c) 1991, 2001 by Oracle Corporation
##############################################################################
###########################################
# Cache and I/O
###########################################
db_block_size=8192
db_cache_size=50331648
###########################################
# Cursors and Library Cache
###########################################
open_cursors=300
###########################################
# Diagnostics and Statistics
###########################################
background_dump_dest=D:\oracle\admin\iasdb\bdump
core_dump_dest=D:\oracle\admin\iasdb\cdump
timed_statistics=TRUE
user_dump_dest=D:\oracle\admin\iasdb\udump
###########################################
# Distributed, Replication and Snapshot
###########################################
db_domain=missrv.miskm.mindef.nl
remote_login_passwordfile=EXCLUSIVE
###########################################
# File Configuration
###########################################
control_files=("D:\oracle\oradata\iasdb\CONTROL01.CTL",
"D:\oracle\oradata\iasdb\CONTROL02.CTL", "D:\oracle\oradata\iasdb\CONTROL03.CTL")
###########################################
# Job Queues
###########################################
job_queue_processes=4
###########################################
# MTS
###########################################
dispatchers="(PROTOCOL=TCP)(PRE=oracle.aurora.server.GiopServer)",
"(PROTOCOL=TCP)(PRE=oracle.aurora.server.SGiopServer)"
###########################################
# Miscellaneous
###########################################
aq_tm_processes=1
compatible=9.0.0
db_name=iasdb
###########################################
# Network Registration
###########################################
instance_name=iasdb
###########################################
# Pools
###########################################
java_pool_size=41943040
shared_pool_size=33554432
###########################################
# Processes and Sessions
###########################################
processes=150
###########################################
# Redo Log and Recovery
###########################################
fast_start_mttr_target=300
###########################################
# Sort, Hash Joins, Bitmap Indexes
###########################################
pga_aggregate_target=33554432
sort_area_size=524288
###########################################
# System Managed Undo and Rollback Segments
###########################################
undo_management=AUTO
undo_tablespace=UNDOTBS
==============
17. Snapshots:
==============
In de "local" database, waar de snapshot copy komt te staan, geef een statement
als bijv:
17.2 Snapshots:
---------------
Simple snapshot:
The refresh of the snapshot can be a complete refresh, with the refresh rate
specified in the "create snapshot" command.
Also a snapshot log can be used at the remote original table in order to
replicate
only the transaction data.
Complex snapshot:
pctfree 5
tablespace SNAP
storage (initial 100K next 100K pctincrease 0)
REFRESH COMPLETE
START WITH SYSDATE
NEXT SYSDATE+7
AS
SELECT DEPTNO, COUNT(*) Dept_count
FROM EMPLOYEE@MY_LINK
GROUP BY Deptno;
Because the records in this snapshot will not correspond one to one
with the records in the master table (since the query contains a group by clause)
this is a complex snapshot. Thus the snapshot will be completely recreated
every time it is refreshed.
In this case the refresh fast clause tells oracle to use a snapshot log to refresh
the local snapshot.
When a snapshotlog is used, only the changes to the master table are sent to the
targets.
The snapshot log must be created in the master database (WHERE the original object
is)
Snapshot groups:
----------------
Group A at the snapshot site (see Figure 3-7) contains only some of the objects in
the corresponding Group A
at the master site. Group B at the snapshot site contains all objects in Group B
at the master site.
Under no circumstances, however, could Group B at the snapshot site contain
objects FROM Group A at the master site.
As illustrated in Figure 3-7, a snapshot group has the same name as the master
group on which the snapshot group is based.
For example, a snapshot group based on a "PERSONNEL" master group is also named
"PERSONNEL."
Refresh groups:
---------------
Related snapshots can be collected int refresh groups. The purpose of a refresh
group is to coordinate
the refresh schedules of it's members.
This is achieved via the DBMS_REFRESH package. The procedures in this package are
MAKE, ADD, SUBSTRACT, CHANGE, DESTROY, and REFRESH
Types of snapshots:
-------------------
Primary Key
-----------
Primary key snapshots are the default type of snapshot. They are updateable if the
snapshot was
created as part of a snapshot group and "FOR UPDATE" was specified when defining
the snapshot.
Changes are propagated according to the row-level changes that have occurred, as
identified by
the primary key value of the row (not the ROWID). The SQL statement for creating
an updateable,
primary key snapshot might look like:
Primary key snapshots may contain a subquery so that you can create a horizontally
partitioned subset
of data at the remote snapshot site. This subquery may be as simple as a basic
WHERE clause or as
complex as a multilevel WHERE EXISTS clause. Primary key snapshots that contain a
SELECTed class of subqueries
can still be incrementally or fast refreshed. The following is a subquery snapshot
with a WHERE
clause containing a subquery:
ROWID
-----
To be fast refreshed, the defining query for a snapshot must observe certain
restrictions.
If you require a snapshot whose defining query is more general and cannot observe
the restrictions,
then the snapshot is complex and cannot be fast refreshed.
A CONNECT BY clause
Clauses that do not comply with the requirements detailed in Table 3-1,
"Restrictions for Snapshots with Subqueries"
See Also:
Oracle8i Data Warehousing Guide for more information about complex materialized
views.
"Snapshot" is synonymous with "materialized view" in Oracle documentation, and
"materialized view"
is used in the Oracle8i Data Warehousing Guide.
Read Only
---------
You can also query the DBA_SNAPSHOT_REFRESH_TIMES view at the master site to
obtain the last refresh times for each snapshot. Administrators can use this
information
to monitor snapshot activity FROM master sites and coordinate changes to snapshot
sites
if a master table needs to be dropped, altered, or relocated.
Internal Mechanisms
Oracle automatically registers a snapshot at its master database when you create
the snapshot,
and unregisters the snapshot when you drop it.
Caution:
Oracle cannot guarantee the registration or unregistration of a snapshot at
its master site during the creation or drop of the snapshot, respectively.
If Oracle cannot successfully register a snapshot during creation,
Oracle completes snapshot registration during a subsequent refresh of the
snapshot.
If Oracle cannot successfully unregister a snapshot when you drop the snapshot,
the registration information for the snapshot persists in the master database
until
it is manually unregistered. Complex snapshots might not be registered.
Manual registration
-------------------
Snapshot Log
------------
When you create a snapshot log for a master table, Oracle creates an underlying
table
as the snapshot log. A snapshot log holds the primary keys and/or the ROWIDs of
rows
that have been updated in the master table. A snapshot log can also contain filter
columns
to support fast refreshes of snapshots with subqueries.
The name of a snapshot log's table is MLOG$_master_table_name.
The snapshot log is created in the same schema as the target master table.
One snapshot log can support multiple snapshots on its master table.
As described in the previous section, the internal trigger adds change information
to the snapshot log whenever a DML transaction has taken place on the target
master table.
Primary Key: The snapshot records changes to the master table based on the primary
key of the affected rows.
Row ID: The snapshot records changes to the master table based on the ROWID of the
affected rows.
Combination: The snapshot records changes to the master table based on both the
primary key and the
ROWID of the affected rows. This snapshot log supports both primary key and ROWID
snapshots, which is helpful for mixed environments.
A combination snapshot log works in the same manner as the primary key and ROWID
snapshot log,
except that both the primary key and the ROWID of the affected row are recorded.
Though the difference between snapshot logs based on primary keys and ROWIDs is
small
(one records affected rows using the primary key, while the other records affected
rows using the physical ROWID),
the practical impact is large. Using ROWID snapshots and snapshot logs makes
reorganizing and truncating your master tables
difficult because it prevents your ROWID snapshots FROM being fast refreshed.
If you reorganize or truncate your master table, your ROWID snapshot must be
COMPLETE refreshed
because the ROWIDs of the master table have changed.
To delete a snapshot log, execute the DROP SNAPSHOT LOG SQL statement in SQL*Plus.
For example, the following statement deletes the snapshot log for a table named
CUSTOMERS in the SALES schema:
=============
18. Triggers:
=============
A trigger is PL/SQL code block attached and executed by an event which occurs to a
database table.
Triggers are implicitly invoked by DML commands. Triggers are stored as text and
compiled at
execute time, because of this it is wise not to include much code in them but to
call out to
previously stored procedures or packages as this will greatly improve perfoRMANce.
You may not use COMMIT, ROLLBACK and SAVEPOINT statements within trigger blocks.
Remember that triggers may be executed thousands of times for a large update -
they can seriously affect SQL execution perfoRMANce.
Triggers may be called BEFORE or AFTER the following events :-
After the CREATE OR REPLACE statement is the object identifier (TRIGGER) and the
object name (MYTRIG1).
This trigger specifies that before any data change event on the BOOK table this
PL/SQL code block
will be compiled and executed. The user will not be allowed to update the table
outside of normal working hours.
In this case we have specified that the trigger will be executed after any data
change event on any affected row.
Within the PL/SQL block body we can check which update action is being performed
for the
currently affected row and take whatever action we feel is appropriate. Note that
we can
specify the old and new values of updated rows by prefixing column names with the
:OLD and :NEW qualifiers.
--------------------------------------------------------------------------------
BEGIN
IF INSERTING OR DELETING THEN
handle_delayed_triggers ('AH_HENKILOROOLI', 'HENKILOROOLI_CHECK');
END IF;
IF INSERTING OR UPDATING OR DELETING THEN /* FE */
handle_delayed_triggers('AH_HENKILOROOLI', 'FRONTEND_FLAG'); /* FE */
END IF; /* FE */
END;
The BEFORE or AFTER option in the CREATE TRIGGER statement specifies exactly when
to fire the
trigger body in relation to the triggering statement that is being run.
In a CREATE TRIGGER statement, the BEFORE or AFTER option is specified just before
the triggering statement.
For example, the PRINT_SALARY_CHANGES trigger in the previous example is a BEFORE
trigger.
INSTEAD OF Triggers
The INSTEAD OF option can also be used in triggers. INSTEAD OF triggers provide a
transparent way
of modifying views that cannot be modified directly through UPDATE, INSERT, and
DELETE statements.
These triggers are called INSTEAD OF triggers because, unlike other types of
triggers,
Oracle fires the trigger instead of executing the triggering statement.
The trigger performs UPDATE, INSERT, or DELETE operations directly on the
underlying tables.
The following example shows an INSTEAD OF trigger for inserting rows into the
MANAGER_INFO view.
The FOR EACH ROW option determines whether the trigger is a row trigger or a
statement trigger.
If you specify FOR EACH ROW, then the trigger fires once for each row of the table
that is affected
by the triggering statement. The absence of the FOR EACH ROW option indicates that
the trigger fires only once
for each applicable statement, but not separately for each row affected by the
statement.
--------------------------------------------------------------------------------
Note:
You may need to set up the following data structures for certain examples to work:
--------------------------------------------------------------------------------
If there are five employees in department 20, then the trigger fires five times
when this statement is entered,
because five rows are affected.
The following trigger fires only once for each UPDATE of the Emp_tab table:
Trigger Size
The size of a trigger cannot be more than 32K.
Recompiling Triggers
Use the ALTER TRIGGER statement to recompile a trigger manually.
For example, the following statement recompiles the PRINT_SALARY_CHANGES trigger:
ALTER TRIGGER Print_salary_changes COMPILE;
====================================
19 BACKUP RECOVERY, TROUBLESHOOTING:
====================================
19.1 SCN:
--------
The Control files and all datafiles contain the last SCN (System Change Number)
after:
- at commit
- redolog buffers 1/3 full, > 1 MB changes
- before DBWR writes modified blocks to datafiles
On most Unix systems the operating system block size is 512 bytes. This means
that setting LOG_CHECKPOINT_INTERVAL to a value of 10,000 (the default
setting), causes a checkpoint to occur after 5,120,000 (5M) bytes are written
to the redo log. If the size of your redo log is 20M, you are taking 4
checkpoints for each log.
The following initialization parameter setting sets the log switch interval
to 30 minutes (a typical value).
ARCHIVE_LAG_TARGET = 1800
You Asked
Tom,
Would you tell me what snapshot too old error. When does it happen? What's the
possible
causes? How to fix it?
Jane
and we said...
I think support note <Note:40689.1> covers this topic very well:
Overview
~~~~~~~~
This article will discuss the circumstances under which a query can return the
Oracle
error ORA-01555 "snapshot too old (rollback segment too small)". The article will
then
proceed to discuss actions that can be taken to avoid the error and finally will
provide
some simple PL/SQL scripts that illustrate the issues discussed.
Terminology
~~~~~~~~~~~
It is assumed that the reader is familiar with standard Oracle terminology such as
'rollback segment' and 'SCN'. If not, the reader should first read the Oracle
Server
Concepts manual and related Oracle documentation.
In addition to this, two key concepts are briefly covered below which help in the
understanding of ORA-01555:
1. READ CONSISTENCY:
====================
This is documented in the Oracle Server Concepts manual and so will not be
discussed
further. However, for the purposes of this article this should be read and
understood if
not understood already.
Oracle Server has the ability to have multi-version read consistency which is
invaluable
to you because it guarantees that you are seeing a consistent view of the data (no
'dirty
reads').
cleanout').
Upon commit, the database simply marks the relevant rollback segment header entry
as
committed. Now, when one of the changed blocks is revisited Oracle examines the
header of
the data block which indicates that it has been changed at some point. The
database needs
to confirm whether the change has been committed or whether it is currently
uncommitted.
To do this, Oracle determines the rollback segment used for the previous
transaction
(from the block's header) and then determines whether the rollback header
indicates
whether it has been committed or not.
If it is found that the block is committed then the header of the data block is
updated
so that subsequent accesses to the block do not incur this processing.
This behaviour is illustrated in a very simplified way below. Here we walk through
the
stages involved in updating a data block.
Description: Next the user hits commit. Note that all that
this does is it
updates the rollback segment header's
corresponding transaction
slot as committed. It does *nothing* to the data
block.
Description: Some time later another user (or the same user)
revisits data block 500. We can see that there
is an uncommitted change in the
data block according to the data block's header.
ORA-01555 Explanation
~~~~~~~~~~~~~~~~~~~~~
There are two fundamental causes of the error ORA-01555 that are a result of
Oracle
trying to attain a 'read consistent' image. These are :
Both of these situations are discussed below with the series of steps that cause
the
ORA-01555. In the steps, reference is made to 'QENV'. 'QENV' is short for 'Query
Environment', which can be thought of as the environment that existed when a query
is
first started and to which Oracle is trying to attain a read consistent image.
Associated
with this environment is the SCN
(System Change Number) at that time and hence, QENV 50 is the query environment
with SCN
50.
This breaks down into two cases: another session overwriting the rollback that
the
current session requires or the case where the current session overwrites the
rollback
information that it requires. The latter is discussed in this article because this
is
usually the harder one to understand.
Steps:
Now, Oracle can see from the block's header that it has been changed and it
is
later than the required QENV (which was 50). Therefore we need to get an image of
the
block as of this QENV.
If an old enough version of the block can be found in the buffer cache then
we
will use this, otherwise we need to rollback the current block to generate another
It is under this condition that Oracle may not be able to get the required
rollback information because Session 1's changes have generated rollback
information that
has overwritten it and returns the ORA-1555 error.
6. Session 1's query then visits a block that has been changed since the
initial QENV
was established. Oracle therefore needs to derive an image of the block as at that
point
in time.
If the transaction slot has been overwritten and the transaction table cannot be
rolled
back to a sufficiently old enough version then Oracle cannot derive the block
image and
will return ORA-1555.
(Note: Normally Oracle can use an algorithm for determining a block's SCN during
block
cleanout even when the rollback segment slot has been overwritten. But in this
case
Oracle cannot guarantee that the version of the block has not changed since the
start of
the query).
Solutions
~~~~~~~~~
This section lists some of the solutions that can be used to avoid the ORA-01555
problems
discussed in this article. It addresses the cases where rollback segment
information is
overwritten by the same session and when the rollback segment transaction table
entry is
overwritten.
4. Add additional rollback segments. This will allow the updates etc. to be
spread
across more rollback segments thereby reducing the chances of overwriting required
rollback information.
5. If fetching across commits, the code can be changed so that this is not
done.
6. Ensure that the outer select does not revisit the same block at different
times
during the processing. This can be achieved by :
1. Use any of the methods outlined above except for '6'. This will allow
transactions
to spread their work across multiple rollback segments therefore reducing the
likelihood
or rollback segment transaction table slots being consumed.
2. If it is suspected that the block cleanout variant is the cause, then force
block
cleanout to occur prior to the transaction that returns the ORA-1555. This can be
achieved by issuing the following in SQL*Plus, SQL*DBA or Server Manager :
If indexes are being accessed then the problem may be an index block and
clean out
can be forced by ensuring that all the index is traversed. Eg, if the index is on
a
numeric column with a minimum value of 25 then the following query will force
cleanout of
the index :
Examples
~~~~~~~~
Listed below are some PL/SQL examples that can be used to illustrate the ORA-1555
cases
given above. Before these PL/SQL examples will return this error the database must
be
configured as follows :
o Use a small buffer cache (db_block_buffers).
REASON: You do not want the session executing the script to be able to find
old
versions of the block in the buffer cache which can be used to satisfy a block
visit
without requiring the rollback information.
REASON: You need to ensure that the work being done is generating rollback
information that will overwrite the rollback information required.
ROLLBACK OVERWRITTEN
rem * 1555_a.sql -
rem * Example of getting ora-1555 "Snapshot too old" by
rem * session overwriting the rollback information required
rem * by the same session.
declare
-- Must use a predicate so that we revisit a changed block at a different
-- time.
-- If another tx is updating the table then we may not need the predicate
cursor c1 is select rowid, bigemp.* from bigemp where a < 20;
begin
for c1rec in c1 loop
declare
begin
There are other special cases that may result in an ORA-01555. These are given
below but
are rare and so not discussed in this article :
o If a query visits a data block that has been changed by using the Oracle
discrete
transaction facility then it will return ORA-01555.
o It is feasible that a rollback segment created with the OPTIMAL clause maycause
a
query to return ORA-01555 if it has shrunk during the life of the query causing
rollback
segment information required to generate consistent read versions of blocks to be
lost.
Summary
~~~~~~~
This article has discussed the reasons behind the error ORA-01555 "Snapshot too
old", has
provided a list of possible methods to avoid the error when it is encountered, and
has
provided simple PL/SQL scripts that illustrate the cases discussed.
Here's a demonstration. First I create a simple table, called TBL_SRC. This is the
table on which
we want to perform change-data-capture (CDC).
Next, I show a couple of CDC tables, and the trigger on TBL_SRC that will load the
CDC tables.
Let's see the magic in action. I'll insert a record. We'll see the 'provisional'
SCN in the TRX table.
Then we'll commit, and see the 'true'/post-commit SCN:
1 row created.
commit;
Commit complete.
Notice how the SCN "changed" from 3732931665 to 3732931668. Oracle was doing some
background transactions in between.
This approach works back to at least Oracle 7.3.4. Not perfect, because it only
captures DML.
A TRUNCATE is DDL, and that's not captured. For the actual implementation, I
stored the before and after values
as CSV strings.
LOG_ARCHIVE_DEST=/oracle/admin/cc1/arch
LOG_ARCHIVE_DEST_1=d:\oracle\oradata\arc
LOG_ARCHIVE_START=TRUE
LOG_ARCHIVE_FORMAT=arc_%s.log
LOG_ARCHIVE_DEST_1=
LOG_ARCHIVE_DEST_2=
LOG_ARCHIVE_MAX_PROCESSES=2
###############################################
# Example archive log backup script in UNIX: #
###############################################
svrmgrl <<EOFarch1
connect internal
svrmgrl <<EOFarch2
connect internal
archive log start;
exit
EOFarch2
rm -f $FILES
###############################
# End backup script example #
###############################
Tablespace:
Datafile;
Backup mode:
When you issue ALTER TABLESPACE .. BEGIN BACKUP, it freezes the datafile header.
This is so that we know what redo logs we need to apply to a given file to make
it consistent. While you are backing up that file hot, we are still writing to
it -- it is logically inconsistent. Some of the backed up blocks could be from
the SCN in place at the time the backup began -- others from the time it ended
and others from various points in between.
De control file bevat dus een SCN die te oud is t.o.v. de SCN's
in de archived redo logs.
Dit moet je Oracle laten weten via
Queries:
--------
SELECT name
FROM v$archived_log
WHERE sequence# = (SELECT max(sequence#) FROM v$archived_log
WHERE 1699499 >= first_change#;
Stel 1 datafile is corrupt. Nu behoeft slechts die ene file te worden teruggezet
en daarna recovery toe te passen.
$ cp /stage/users01.dbf /u01/db1
en oracle komt met een suggestie van het toepassen van archived logfiles
SVRMGRL>startup mount;
SVRMGRL>recover database;
controlfile:
startup nomount
create controlfile reuse database "brdb" noresetlogs archivelog
maxlogfiles 16
maxlogmembers 2
maxdatafiles 100
maxinstances 1
maxloghistory 226
logfile
group 1 ('/disk03/db1/redo/redo01a.dbf', '/disk04/db1/redo/redo01b.dbf') size 2M,
group 2 ('/disk03/db1/redo/redo02a.dbf', '/disk04/db1/redo/redo02b.dbf') size 2M
datafile
'/disk04/oracle/db1/sys01.dbf',
'/disk05/oracle/db1/rbs01.dbf',
'/disk06/oracle/db1/data01.dbf',
'/disk04/oracle/db1/index01.dbf',
STARTUP NOMOUNT
of
5. SVRMGRL>@script
If you want another database name use CREATE CONTROLFILE SET DATABASE
STARTUP NOMOUNT
CREATE CONTROLFILE REUSE DATABASE "O901" RESETLOGS NOARCHIVELOG
MAXLOGFILES 50
MAXLOGMEMBERS 5
MAXDATAFILES 100
MAXINSTANCES 1
MAXLOGHISTORY 113
LOGFILE
GROUP 1 'D:\ORACLE\ORADATA\O901\REDO01.LOG' SIZE 100M,
GROUP 2 'D:\ORACLE\ORADATA\O901\REDO02.LOG' SIZE 100M,
GROUP 3 'D:\ORACLE\ORADATA\O901\REDO03.LOG' SIZE 100M
DATAFILE
'D:\ORACLE\ORADATA\O901\SYSTEM01.DBF',
'D:\ORACLE\ORADATA\O901\UNDOTBS01.DBF',
'D:\ORACLE\ORADATA\O901\CWMLITE01.DBF',
'D:\ORACLE\ORADATA\O901\DRSYS01.DBF',
'D:\ORACLE\ORADATA\O901\EXAMPLE01.DBF',
'D:\ORACLE\ORADATA\O901\INDX01.DBF',
'D:\ORACLE\ORADATA\O901\TOOLS01.DBF',
'D:\ORACLE\ORADATA\O901\USERS01.DBF'
CHARACTER SET UTF8
;
Voorbeeld controlfile:
----------------------
STARTUP NOMOUNT
CREATE CONTROLFILE REUSE DATABASE "SALES" NORESETLOGS ARCHIVELOG
MAXLOGFILES 5
MAXLOGMEMBERS 2
MAXDATAFILES 255
MAXINSTANCES 2
MAXLOGHISTORY 1363
LOGFILE
GROUP 1 (
'/oradata/system/log/log1.log',
'/oradata/dump/log/log1.log'
) SIZE 100M,
GROUP 2 (
'/oradata/system/log/log2.log',
'/oradata/dump/log/log2.log'
) SIZE 100M
DATAFILE
'/oradata/system/system.dbf',
'/oradata/rbs/rollback.dbf',
'/oradata/rbs/rollbig.dbf',
'/oradata/system/users.dbf',
'/oradata/temp/temp.dbf',
'/oradata/data_big/ahp_lkt_data_small.dbf',
'/oradata/data_small/ahp_lkt_data_big.dbf',
'/oradata/data_big/ahp_lkt_index_small.dbf',
'/oradata/index_small/ahp_lkt_index_big.dbf',
'/oradata/data_small/maniin_ah_data_small.dbf',
'/oradata/index_small/maniin_ah_data_big.dbf',
'/oradata/index_big/maniin_ah_index_small.dbf',
'/oradata/index_big/maniin_ah_index_big.dbf',
'/oradata/index_big/fe_heat_data_big.dbf',
'/oradata/data_small/fe_heat_index_big.dbf',
'/oradata/data_small/eksa_data_small.dbf',
'/oradata/data_big/eksa_data_big.dbf',
'/oradata/index_small/eksa_index_small.dbf',
'/oradata/index_big/eksa_index_big.dbf',
'/oradata/data_small/provisioning_data_small.dbf',
'/oradata/data_small/softplan_data_small.dbf',
'/oradata/index_small/provisioning_index_small.dbf',
'/oradata/system/tools.dbf',
'/oradata/index_small/fe_heat_index_small.dbf',
'/oradata/data_small/softplan_data_big.dbf',
'/oradata/index_small/softplan_index_small.dbf',
'/oradata/index_small/softplan_index_big.dbf',
'/oradata/data_small/fe_heat_data_small.dbf'
;
# Recovery is required if any of the datafiles are restored backups,
# or if the last shutdown was not normal or immediate.
RECOVER DATABASE UNTIL CANCEL USING BACKUP CONTROLFILE;
ALTER DATABASE OPEN RESETLOGS;
ORA-01194, ORA-01195:
---------------------
-------
Note 1:
-------
Either you had the database in archive mode or in non archive mode:
archive mode
non-archive mode:
If you have checked that the scn's of all files are the samed number,
you might try in the init.ora file:
_allow_resetlogs_corruption = true
-------
Note 2:
-------
Problem Description
-------------------
You restored your hot backup and you are trying to do a point-in-time recovery.
When you tried to open your database you received the following error:
ORA-01195: online backup of file <name> needs more recovery to be consistent
The reported file is an online backup that must be recovered to the time the
backup ended.
Action: Either apply more redo logs until the file is consistent or restore the
file from an older backup
and repeat the recovery.
For more information about online backup, see the index entry
"online backups" in the <Oracle7 Server Administrator's Guide>.
This is assuming that the hot backup completed error free.
Solution Description
--------------------
Continue to apply the requested logs until you are able to open the database.
Explanation
-----------
When you perform hot backups on a file, the file header is frozen. For example,
datafile01 may have a file header frozen at SCN #456. When you backup the next
datafile
the SCN # may be differnet. For example the file header for datafile02 may be
frozen
with SCN #457. Therefore, you must apply archive logs until you reach the SCN #
of the
last file that was backed up. Usually, applying one or two more archive logs will
solve
the problem, unless there was alot of activity on the database during the backup.
-------
Note 3:
-------
I am working with a test server, I can load it again but I would like to know if
this
kind of problem could be solved or not. Just to let you know, that I am new
in Oracle Database Administration.
I ran a hot backup script, which deleted the old ARCHIVE, logs at the end.
After checking the script's log, I realized that the hot backup was not successful
and it
deleted the Archives. I tried to startup the database and an error occurred;
"ORA-01589: must use RESETLOGS or NORESETLOGS option for database open"
I tried to open it with the RESETLOGS option then another error occurred;
"ORA-01195: online backup of file 1 needs more recovery to be consistent"
Just because, it was a test environment, I have never taken any cold backups.
I still have hot backups. I don't know how to recover from those.
If anyone can tell me how to do it from SQLPLUS (SVRMGRL is not loaded),
I would really appreciate it.
Thanks,
Hi Hima,
The following might help. You now have a database that is operating
like it's in noarchive mode since the logs are gone.
This will list all your online redolog files and their respective
sequence and first change numbers.
5. Confirm each of the logs that you are prompted for until you
receive the message "Media recovery complete". If you are prompted for a non-
existing
archived log, Oracle probably needs one or more of the online logs to proceed with
the recovery.
Compare the sequence number referenced in the ORA-280 message with the sequence
numbers
of your online logs. Then enter the full path name of one of the members of the
redo group
whose sequence number matches the one you are being asked for. Keep entering
online logs as requested until you receive the message "Media recovery
complete".
-------
Note 4:
-------
I have a hot backup of my database. (Tablespaces into hotbackup mode, copy files,
tablespaces out
of hotbackup mode, archive current log, backup controlfile to a file and also to a
trace).
(yep im in archivelog mode as well)
I restore my backup copy of the database - (just the datafiles) startup nomount
and then run
an edited controlfile trace backup (with resetlogs).
I'm prompted for logs in the usual way but the recovery ends with an ORA-1547 -
Recover succeeded but open resetlogs would give the following error.
The next error is that datafile 1 (system ts) - would need more recovery.
Now metalink tells me that this is usually due to backups being restored that are
older
than the archive redo logs - this isn't the case. I have all the archive redo logs
I need to
cover the time the backup was taken up to the present. The time specified in the
recovery
is after the backup as well.
What am I missing here? Its driving me nuts. I'm off back to the docs again!
Thanks in advance
Tim
--------------------------------------------------------------------------------
The error indicates that Oracle requires a few more scns to get all the datafiles
in sync.
It is quite possible that those scns are present in the online redo logfiles which
were lost.
In such cases when Oracle asks for a non-existent archive log, you should provide
the complete path
of the online log file for the recovery to succeed.
Since you dont have an online log file you should use
RECOVER DATABASE UNTIL CANCEL USING BACKUP CONTROLFILE.
In this case when you exhaust all the archive log files, you issue the cancel
command which will
automatically rollback all the incomplete transactions and get all the datafile
headers
in sync with the controlfile.
Anand
--------------------------------------------------------------------------------
I am not sure whether you have missed this step or just missed in the note.
You need to also to switch the log at the end of the back up (I do as a matter of
practice else you
need the next log which is not sure to be available in case of a failure).
Otherwise some of the changes
to reach a consistant state is still in the online log and you can never open
untill
you reach a consistent state.
--------------------------------------------------------------------------------
To successfully perform incomplete recovery, you need a full db backup that was
completed prior
to the point to which you want to recover, plus you need all archive logs
containing all SCNs
up to the point to which you want to recover.
Applying these rules to your case, I have two questions:
- are you recovering to the point in time AFTER the time the successful full
backup was copleted?
- is there an archive log that was generated AFTER the time you specify in until
time?
If both answers are yes, then you should have no problems.
I actually recently performed such a recovery several times.
--------------------------------------------------------------------------------
Thanks Guys! I think Mark has hit the nail on the head here. I was being an idiot!
Ive ran this exercise a few more times (with success) and I am convinced that what
I was doing
was trying to recover to a point in time that basically was before the latest scn
of any one file
in the hot backup set I was using - convinced myself that I wasnt -
but I must have been..... perhaps I need a holiday!
Thanks again
Tim
--------------------------------------------------------------------------------
-------
Note 5:
-------
ORA-01547: warning: RECOVER succeeded but OPEN RESETLOGS would get error below
ORA-01152: file 2 was not restored from a sufficiently old backup
ORA-01110: data file 2: 'D:\ORACLE\ORADATA\<instance>\UNDOTBS01.DBF'
File number, name and directory may vary depending on Oracle configuration
Details:
Undo tablespace data description
If the transaction does not complete due to some error or should there be a user
decision
to reverse (rollback) the change, this Undo data is critical for the ability to
roll back
or undo the changes that were made. Undo data also ensures a way to provide read
consistency
in the database. Read consistency means that if there is a data change in a row of
data that
is not yet committed, a new query of this same row or table will not display any
of the
uncommitted data to other users, but will use the information from the Undo
segments in the Undo tablespace
to actually construct and present a consistent view of the data that only includes
During recovery, Oracle uses its Redo logs to play forward through transactions in
a database
so that all lost transactions (data changes and their Undo data generation) are
replayed into
the database. Then, once all the Redo data is applied to the data files, Oracle
uses the information
in the Undo segments to undo or roll back all uncommitted transactions. Once
recovery is complete,
all data in the database is committed data, the System Change Numbers (SCN) on all
data files
and the control_files match, and the database is considered consistent.
As for Oracle 9i, the default method of Undo management is no longer manual, but
automatic;
there are no Rollback segments in individual user tablespaces, and all Undo
management is processed
by the Oracle server, using the Undo tablespace as the container to maintain the
Undo segments
for the user tablespaces in the database. The tablespace that still maintains its
own Rollback segments
is the System tablespace, but this behavior is by design and irrelevant to the
discussion here.
If this configuration is left as the default for the database, and the 5.022 or
5.025 version of the
VERITAS Backup Exec (tm) Oracle Agent is used to perform Oracle backups, the Undo
tablespace
will not be backed up. If Automatic Undo Management is disabled and the database
administrator (DBA)
has modified the locations for the Undo segments (if the Undo data is no longer in
the Undo tablespace),
this data may be located elsewhere, and the issues addressed by this TechNote may
not affect
the ability to fully recover the database, although it is still recommended that
the upgrade
to the 5.026 Oracle Agent be performed.
Scenario 1
The first scenario would be a recovery of the entire database to a previous point-
in-time.
This type of recovery would utilize the RECOVER DATABASE USING BACKUP CONTROLFILE
statement
and its customizations to restore the entire database to a point before the entry
of improper
or corrupt data or to roll back to a point before the accidental deletion of
critical data.
In this type of situation, the most common procedure for the restore is to just
restore
the entire online backup over the existing Oracle files with the database
shutdown.
(See the Related Documents section for the appropriate instructions on how to
restore and recover
an Oracle database to a point-in-time using an online backup.)
In this scenario, where the entire database would be rolled back in time, an
offline restore
would include all data files, archived log files, and the backup control_file from
the tape
or backup media. Once the RECOVER DATABASE USING BACKUP CONTROLFILE command was
executed,
Oracle would begin the recovery process to roll forward through the Redo log
transactions,
and it would then roll back or undo uncommitted transactions.
At the point when the recovery process started on the actual Undo tablespace,
Oracle would see that
the SCN of that tablespace was too high (in relation to the record in the
control_file).
This would happen simply because the Undo tablespace wasn't on the tape or backup
media that was restored,
so the original Undo tablespace wouldn't have been overwritten, as were the other
data files,
during the restore operation. The failure would occur because the Undo tablespace
would still be
at its SCN before the restore from backup (an SCN in the future as related to the
restored backup control_file).
All other tablespaces and control_files would be back at their older SCNs (not
necessarily consistent yet),
and the Oracle server would respond with the following error messages:
ORA-01547: warning: RECOVER succeeded but OPEN RESETLOGS would get error below
ORA-01152: file 2 was not restored from a sufficiently old backup
ORA-01110: data file 2: 'D:\ORACLE\ORADATA\<instance>\UNDOTBS01.DBF'
At this point, the database cannot be opened with the RESETLOGS option, nor in a
normal mode.
Any attempt to do so yields the error referenced above.
Error at line 1:
ORA-01152: file 2 was not restored from a sufficiently old backup
ORA-01110: data file 2: 'D:\ORACLE\ORADATA\DRTEST\UNDOTBS01.DBF'
The only recourse here is to recover or restore an older backup that contains an
Undo tablespace,
whether from an older online backup, or from a closed or offline backup or copy of
the database.
Without this ability to acquire an older Undo tablespace to rerun the recovery
operation,
it will not be possible to start the database. At this point, Oracle Technical
Support must be contacted.
Scenario 2
The second scenario would involve the actual corruption or loss of the Undo
tablespace's data files.
If the Undo tablespace data is lost or corrupted due to media failure or other
internal
logical error or user error, this data/tablespace must be recovered.
Oracle 9i does offer the ability to create a new Undo tablespace and to alter the
Oracle Instance to use
this new tablespace when deemed necessary by the DBA. One of the requirements to
accomplish this change, though,
is that there cannot be any active transactions in the Undo segments of the
tablespace when it is time to
actually drop it. In the case of data file corruption, uncommitted transactions in
the database that have
data in Undo segments can be extremely troublesome because the existence of any
uncommitted transactions
will lock the Undo segments holding the data so that they cannot be dropped. This
will be evidenced by
an "ORA-01548" error if this is attempted. This error, in turn, prevents the drop
and recreation of
the Undo tablespace, and thus prevents the successful recovery of the database.
To overcome this problem, the transaction tables of the Undo segments can be
traced to provide details
on transactions that Oracle is trying to recover via rollback and these traces
will also identify
the objects that Oracle is trying to apply the undo to. Oracle Doc ID: 94114.1 may
be referenced to set up
a trace on the database startup so that the actual transactions that are locking
the Undo segments
can be identified and dropped. Dropping objects that contain uncommitted
transactions that are holding
locks on Undo segments does entail data loss, and the amount of loss depends on
how much uncommitted data
was in the Undo segments at the point of failure.
When utilized, this trace is actually monitoring or dumping data from the
transaction tables in the headers
of the Undo segments (where the records that track the data in the Undo segments
are located),
but if the Undo tablespace's data file is actually missing, has been offline
dropped, or if these
Undo segment headers have been corrupted, even the ability to dump the transaction
table data is lost
and the only recourse at this point may be to open the database, export, and
rebuild. At this point,
Oracle Technical Support must be contacted.
Backup Exec Agent for Oracle 5.022 and 5.025 should be upgraded to 5.026
When using the 5.022 or 5.025 version of the Backup Exec for Windows Servers
Oracle Agent
(see the Related Documents section for the appropriate instructions on how to
identify the version
of the Oracle Agent in use), the Oracle Undo tablespace is not available for
backup because the
Undo tablespace falls into the type category of Undo, and only tablespaces with a
content type of
PERMANENT are located and made available for backup. Normal full backups with all
Oracle components
selected will run without error and will complete with a successful status since
the Undo tablespace
is not actually flagged as a selection.
In most Oracle recovery situations, this absence of the Undo tablespace data for
restore would not
cause any problem because the original Undo tablespace is still available on the
database server.
Restores of User tablespaces, which do not require a rollback in time, would
proceed normally
since lost data or changes would be replayed back into the database, and Undo data
would be
available to roll back uncommitted transactions to leave the database in a
consistent
state and ready for user access.
The only solution to the problems referenced within this TechNote is to upgrade
the Backup Exec for
Windows Servers Oracle Agent to version 5.026, and to take new offline (closed
database) and then
new online (running database) backups of the entire Oracle 9i database as per the
Oracle Agent
documentation in the Backup Exec 9.0 for Windows Servers Administrator's Guide.
Oracle 9i database backups
made with the 5.022 and 5.025 Agent that shipped with Backup Exec 9.0 for Windows
Servers
build 4367 or build 4454 should be considered suspect in the context of the
information
provided in this TechNote.
Note: The 5.022, 5.025, and 5.026 versions of the Oracle Agent are compatible with
Backup Exec 8.6 for Windows NT and Windows 2000, which includes support for Oracle
9i,
as well as Backup Exec 9.0 for Windows Servers. See the Related Documents section
for
instructions on how to identify the version of the Oracle Agent in use.
-------
Note 6:
-------
- Backup
a) Consistent backups
A consistent backup means that all data files and control files are consistent
to a point in time. I.e. they have the same SCN. This is the only method of
backup when the database is in NO Archive log mode.
b) Inconsistent backups
An Inconsistent backup is possible only when the database is in Archivelog mode
and proper Oracle aware software is used. Most default backup software can not
backup open files. Special precautions need to be used and testing needs to be
done. You must apply redo logs to the data files, in order to restore the
database to a consistent state.
d) Backup Methods
Essentially, there are two backup methods, hot and cold, also known as online
and offline, respectively.
A cold backup is one taken when the database is shutdown.
A hot backup is on taken when the database is running.
Commands for a hot backup:
1. Svrmgr>alter database Archivelog
Svrmgr> log archive start
Svrmgr> alter database open
2. Svrmgr> archive log list
--This will show what the oldest online log sequence is. As a precaution,
always keep the all archived log files starting from the oldest online log
sequence.
3. Svrmgr> Alter tablespace tablespace_name BEGIN BACKUP
4. --Using an OS command, backup the datafile(s) of this tablespace.
5. Svrmgr> Alter tablespace tablespace_name END BACKUP
--- repeat step 3, 4, 5 for each tablespace.
6. Svrmgr> archive log list
---do this again to obtain the current log sequence. You will want to make
sure you have a copy of this redo log file.
7. So to force an archived log, issue
Svrmgr> ALTER SYSTEM SWITCH LOGFILE
A better way to force this would be:
svrmgr> alter system archive log current;
8. Svrmgr> archive log list
This is done again to check if the log file had been archived and to find
the latest archived sequence number.
e) Incremental backups
These are backups that are taken on blocks that have been modified since the
last backup. These are useful as they don't take up as much space and time.
There are two kinds of incremental backups
Cumulative and Non cumulative.
Cumulative incremental backups include all blocks that were changed since the
last backup at a lower level. This one reduces the work during restoration as
only one backup contains all the changed blocks.
Noncumulative only includes blocks that were changed since the previous backup
at the same or lower level.
Using rman, you issue the command "backup incremental level n"
f) Support scenarios
When the database crashes, you now have a backup. You restore the backup and
then recover the database. Also, don't forget to take a backup of the control
file whenever there is a schema change.
RECOVERY
=========
There are several kinds of recovery you can perform, depending on the type of
failure and the kind of backup you have. Essentially, if you are not running in
archive log mode, then you can only recover the cold backup of the database and
you will lose any new data and changes made since that backup was taken.
If, however, the database is in Archivelog mode you will be able to restore the
database up to the time of failure.
There are three basic types of recovery:
1. Online Block Recovery.
This is performed automatically by Oracle.(pmon) Occurs when a process dies
while changing a buffer. Oracle will reconstruct the buffer using the online
redo logs and writes it to disk.
2. Thread Recovery.
This is also performed automatically by Oracle. Occurs when an instance
crashes while having the database open. Oracle applies all the redo changes
in the thread that occurred since the last time the thread was checkpointed.
3. Media Recovery.
This is required when a data file is restored from backup. The checkpoint
count in the data files here are not equal to the check point count in the
control file.
This is also required when a file was offlined without checkpoint and when
using a backup control file.
Now let's explain a little about Redo vs Rollback.
Redo information is recorded so that all commands that took place can be
repeated during recovery. Rollback information is recorded so that you can undo
changes made by the current transaction but were not committed. The Redo Logs
are used to Roll Forward the changes made, both committed and non- committed
changes. Then from the Rollback segments, the undo information is used to
rollback the uncommitted changes.
Media Failure and Recovery in Noarchivelog Mode
In this case, your only option is to restore a backup of your Oracle
files.
The files you need are all datafiles, and control files.
You only need to restore the password file or parameter files if they are lost
or are corrupted.
Media Failure and Recovery in Archivelog Mode
In this case, there are several kinds of recovery you can perform, depending on
what has been lost. The three basic kinds of recovery are:
1. Recover database - here you use the recover database command and the database
must be closed and mounted. Oracle will recover all datafiles that are online.
2. Recover tablespace - use the recover tablespace command. The database can be
open but the tablespace must be offline.
3. Recover datafile - use the recover datafile command. The database can be
open but the specified datafile must be offline.
Note: You must have all archived logs since the backup you restored from,
or else you will not have a complete recovery.
a) Point in Time recovery:
A typical scenario is that you dropped a table at say noon, and want to recover
it. You will have to restore the appropriate datafiles and do a point-in-time
recovery to a time just before noon.
Note: you will lose any transactions that occurred after noon.
After you have recovered until noon, you must open the database with resetlogs.
This is necessary to reset the log numbers, which will protect the database
from having the redo logs that weren't used be applied.
The four incomplete recovery scenarios all work the same:
Recover database until time '1999-12-01:12:00:00';
Recover database until cancel; (you type in cancel to stop)
Recover database until change n;
Recover database until cancel using backup controlfile;
Note: When performing an incomplete recovery, the datafiles must be online.
Do a select name, status from v$datafile to find out if there are any files
which are offline. If you were to perform a recovery on a database which has
tablespaces offline, and they had not been taken offline in a normal state, you
will lose them when you issue the open resetlogs command. This is because the
data file needs recovery from a point before the resetlogs option was used.
b) Recovery without control file
If you have lost the current control file, or the current control file is
inconsistent with files that you need to recover, you need to recover either by
using a backup control file command or create a new control file. You can also
recreate the control file based on the current one using the
'backup control file to trace' command which will create a script for you to
run to create a new one.
Recover database using backup control file command must be used when using a
control file other that the current. The database must then be opened with
resetlogs option.
c) Recovery of missing datafile with rollback segment
The tricky part here is if you are performing online recovery. Otherwise you
can just use the recover datafile command. Now, if you are performing an
online recovery, you must first ensure that in the init.ora file, you remove
the parameter rollback_segments. Otherwise, oracle will want to use those
rollback segments when opening the database, but can't find them and wont open.
Until you recover the datafiles that contain the rollback segments, you need to
create some temporary rollback segments in order for new transactions to work.
Even if other rollback segments are ok, they will have to be taken offline.
So, all the rollback segments that belong to the datafile need to be recovered.
If all the datafiles belonging to the tablespace rollback_data were lost, you
can now issue a recover tablespace rollback_data.
Next bring the tablespace online and check the status of the rollback segments
by doing a select segment_name, status from dba_rollback_segs;
You will see the list of rollback segments that are in status Need Recovery.
Simply issue alter rollback segment online command to complete.
Don't forget to reset the rollback_segments parameter in the init.ora.
d) Recovery of missing datafile without rollback segment
There are three ways to recover in this scenario, as mentioned above.
1. recover database
2. recover datafile 'c:\orant\database\usr1orcl.ora'
3. recover tablespace user_data
e) Recovery with missing online redo logs
Missing online redo logs means that somehow you have lost your redo logs before
they had a chance to archived. This means that crash recovery cannot be
performed, so media recovery is required instead. All datafiles will need to
berestored and rolled forwarded until the last available archived log file is
applied. This is thus an incomplete recovery, and as such, the recover
database command is necessary.
(i.e. you cannot do a datafile or tablespace recovery).
As always, when an incomplete recovery is performed, you must open the database
with resetlogs.
Note: the best way to avoid this kind of a loss, is to mirror your online log
files.
f) Recovery with missing archived redo logs
If your archives are missing, the only way to recover the database is to
restore from your latest backup. You will have lost any uncommitted
transactions which were recorded in the archived redo logs. Again, this is why
Oracle strongly suggests mirroring your online redo logs and duplicating copies
of the archives.
g) Recovery with resetlogs option
Reset log option should be the last resort, however, as we have seen from above,
it may be required due to incomplete recoveries. (recover using a backup
control file, or a point in time recovery). It is imperative that you backup
up the database immediately after you have opened the database with reset logs.
The reason is that oracle updates the control file and resets log numbers, and
you will not be able to recover from the old logs.
The next concern will be if the database crashes after you have opened the
database with resetlogs, but have not had time to backup the database.
How to recover?
Shut down the database
Backup all the datafiles and the control file
Startup mount
Alter database open resetlogs
This will work, because you have a copy of a control file after the
resetlogs point.
Media failure before a backup after resetlogs.
If a media failure should occur before a backup was made after you opened the
database using resetlogs, you will most likely lose data.
The reason is because restoring a lost datafile from a backup prior to the
resetlogs will give an error that the file is from a point in time earlier,
and you don't have its backup log anymore.
h) Recovery with corrupted/missing rollback segments.
If a rollback segment is missing or corrupted, you will not be able to open the
database. The first step is to find out what object is causing the rollback to
appear corrupted. If we can determine that, we can drop that object.
If we can't we will need to log an iTar to engage support.
So, how do we find out if it's actually a bad object?
1. Make sure that all tablespaces are online and all datafiles are online.
This can be checked through v$datafile, under the status column.
For tablespaces associated with the datafiles, look in dba_tablespaces.
If this doesn't show us anything, i.e., all are online, then
2. Put the following in the init.ora:
event = "10015 trace name context forever, level 10"
This event will generate a trace file that will reveal information about the
transaction Oracle is trying to roll back and most importantly, what object
Oracle is trying to apply the undo to.
Stop and start the database.
3. Check in the directory that is specified by the user_dump_dest parameter
(in the init.ora or show parameter command) for a trace file that was
generated at startup time.
4. In the trace file, there should be a message similar to:
error recovery tx(#,#) object #.
TX(#,#) refers to transaction information.
The object # is the same as the object_id in sys.dba_objects.
5. Use the following query to find out what object Oracle is trying to
perform recovery on.
select owner, object_name, object_type, status
from dba_objects where object_id = <object #>;
6. Drop the offending object so the undo can be released. An export or relying
on a backup may be necessary to restore the object after the corrupted
rollback segment goes away.
7. After dropping the object, put the rollback segment back in the init.ora
parameter rollback_segments, remove the event, and shutdown and startup
the database.
In most cases, the above steps will resolve the problematic rollback segment.
If this still does not resolve the problem, it may be likely that the
corruption is in the actual rollback segment.
If in fact the rollback segment itself is corrupted, we should see if we can
restore from a backup. However, that isn't always possible, there may not be a
recent backup etc. In this case, we have to force the database open with the
unsupported, hidden parameters, you will need to log an iTar to engage support.
Please note, that this is potentially dangerous!
When these are used, transaction tables are not read on opening of the database
Because of this, the typical safeguards associated with the rollback segment
are disabled.
Their status is 'offline' in dba_rollback_segs.
Consequently, there is no check for active transactions before dropping the
rollback segment. If you drop a rollback segment which contains active
transactions then you will have logical corruption. Possibly this corruption
will be in the data dictionary.
If the rollback segment datafile is physically missing, has been offlined
dropped, or the rollback segment header itself is corrupt, there is no way to
dump the transaction table to check for active transactions. So the only thing
to do is get the database open, export and rebuild. Log an iTar to engage support
to help with this process.
If you cannot get the database open, there is no other alternative than
restoring from a backup.
i) Recovery with System Clock change.
You can end up with duplicate timestamps in the datafiles when a system clock
changes.
A solution here is to recover the database until time 'yyyy-mm-dd:00:00:00',
and set the time to be later than the when the problem occurred. That way it
will roll forward through the records that were actually performed later, but
have an earlier time stamp due to the system clock change.
Performing a complete recovery is optimal, as all transactions will be applied.
j) Recovery with missing System tablespace.
The only option is to restore from a backup.
k) Media Recovery of offline tablespace
When a tablespace is offline, you cannot recover datafiles belonging to this
tablespace using recover database command. The reason is because a recover
database command will only recover online datafiles. Since the tablespace is
offline, it thinks the datafiles are offline as well, so even if you recover
database and roll forward, the datafiles in this tablespace will not be touched.
Instead, you need to perform a recover tablespace command. Alternatively, you
could restored the datafiles from a cold backup, mount the database and select
from the v$datafile view to see if any of the datafiles are offline. If they
are, bring them online, and then you can perform a recover database command.
l) Recovery of Read-Only tablespaces
If you have a current control file, then recovery of read only tablespaces is
no different than recovering read-write files.
The issues with read-only tablespaces arise if you have to use a backup control
file. If the tablespace is in read-only mode, and hasn't changed to read-write
since the last backup, then you will be able to media recovery using a backup
control file by taking the tablespace offline. The reason here is that when you
are using the backup control file, you must open the database with resetlogs.
And we know that Oracle wont let you read files from before a resetlogs was
done. However, there is an exception with read-only tablespaces. You will be
able to take the datafiles online after you have opened the database.
When you have tablespaces that switch modes and you don't have a current control
file, you should use a backup control file that recognizes the tablespace in
read-write mode. If you don't have a backup control file, you can create a new
one using the create controlfile command.
Basically, the point here is that you should take a backup of the control file
every time you switch a tablespaces mod
ORA-01547:
ORA-01110:
ORA-01588
ORA-00205:
----------
OTHER ERRORS:
=============
ORA=00214
---------
The above errors indicates that there is a failed distributed transaction that
needs to be manually cleaned up.
See <Note 1012842.102>
In some cases, the instance may crash before the solutions are implemented.
If this is the case, issue an 'alter system disable distributed recovery'
immediately after the database starts to allow the database to run without
having reco terminate the instance.
Workaround
Configure log_archive_min_succeed_dest = 2
Do not use log_archive_duplex_dest
19.16 ORA-1578 ORACLE data block corrupted (file # %s, block # %s)
---------------------------------------------------------------
Note:1034037.6
Subject: ORA-01102: WHEN STARTING THE DATABASE
Type: PROBLEM
Status: PUBLISHED
Content Type: TEXT/PLAIN
Creation Date: 25-JUL-1997
Last Revision Date: 10-FEB-2000
Problem Description:
====================
You are trying to startup the database and you receive the following error:
ORA-01102: cannot mount database in EXCLUSIVE mode
Cause: Some other instance has the database mounted exclusive
or shared.
Action: Shutdown other instance or mount in a compatible mode.
or
Problem Explanation:
====================
Search Words:
=============
Solution Description:
=====================
Verify that the database was shutdown cleanly by doing the following:
% ls $ORACLE_HOME/dbs/sgadef<sid>.dbf
% rm $ORACLE_HOME/dbs/sgadef<sid>.dbf
% kill -9 <Process_ID_Number>
3. Verify that no shared memory segments and semaphores that are owned
by "oracle" still exist
% ipcs -b
% ipcrm -m <Shared_Memory_ID_Number>
% ipcrm -s <Semaphore_ID_Number>
NOTE: The example shown above assumes that you only have one
database on this machine. If you have more than one
database, you will need to shutdown all other databases
before proceeding with Step 4.
Solution Explanation:
=====================
The "lk<sid>" and "sgadef<sid>.dbf" files are used for locking shared memory.
It seems that even though no memory is allocated, Oracle thinks memory is
still locked. By removing the "sgadef" and "lk" files you remove any knowledge
oracle has of shared memory that is in use. Now the database can start.
.
Note:1013221.6
Subject: RECOVERING FROM A LOST DATAFILE IN A ROLLBACK TABLESPACE
Type: PROBLEM
Status: PUBLISHED
Content Type: TEXT/PLAIN
Creation Date: 16-OCT-1995
Last Revision Date: 18-JUN-2002
Solution 1:
---------------
Error scenario:
Solution 2:
---------------
INTRODUCTION
------------
Rollback segments can be monitored through the data dictionary view,
dba_rollback_segs. There is a status column that describes what state the
rollback segment is currently in. Normal states are either online or offline.
Occasionally, the status of "needs recovery" will appear.
UNDERSTANDING
-------------
A rollback segment falls into this status of needs recovery whenever
Oracle tries to roll back an uncommitted transaction in its transaction
table and fails.
Setting this event will generate a trace file that will reveal the
necessary information about the transaction Oracle is trying to roll
back and most importantly, what object Oracle is trying to apply
the undo to.
3-SHUTDOWN the database (if normal does not work, immediate, if that does
not work, abort) and bring it back up.
6-USE the following query to find out what object Oracle is trying to
perform recovery on.
7-THIS object must be dropped so the undo can be released. An export or relying
on a backup may be necessary to restore the object after the corrupted
rollback segment goes away.
8-AFTER dropping the object, put the rollback segment back in the init.ora
parameter rollback_segments, removed the event, and shutdown and startup
the database.
In most cases, the above steps will resolve the problematic rollback segment.
If this still does not resolve the problem, it may be likely that the
corruption is in the actual rollback segment.
At this point, if the problem has not been resolved, please contact
customer support.
Solution 3:
---------------
simulate the loss of datafile by removing FROM the os and shut down abort the
database.
mount the database so RMAN can restore the file,
at this point offlining the file succeeds but you cannot open the database.
so the question is can we offline a rollback segment datafile containing active
transactions and open the database ?
How to perform recovery in such case using an RMAN backup without using the
catalog.
I appreciate for any insight and tips into this issue.
Madhukar
Hi,
The only supported way to recover FROM the loss of a rollback segment datafile
containing
a rollback segment with a potentially active data dictionary transaction is to
restore the datafile
FROM backup and roll forward to a point in time prior to the loss of the datafile
(assuming archivelog mode).
Hi Tom,
What does Rollforward upto a time prior to the loss of the datafile got to do with
the recovery,
are you suggesting this so that active transaction is not lost,is it possible ?
Because during the recovery the rollforward is followed by rollback and all the
active transactions
FROM the rollback segment's transaction table will be rolled back isnt it ?
My question is if I have a active transaction in a rollback segment and the file
containing
that rollback segment is lost and the database crashed or did a shutdown abort can
we open the
database after offlining the datafile and commenting out the rollback_segments
parameter in the init.ora parameter,
I tried to do it and got the errors which I mentioned earlier.
So in this case I have to do offline recovery only or what ?
Thanks,
madhukar
Hi,
You won't be able to open the database if you lose a rollback segment datafile
that contains an active transaction.
You will have to:
Restore a good backup of the file
RECOVER DATAFILE '<name>'
ALTER DATABASE DATAFILE '<name>' ONLINE;
The only way you would be able to open the database is if the status of the
rollback were OFFLINE,
any other status requires that you recover as noted before.
Regards
Tom Villane
Oracle Support Metalink Analyst
Hi Tom,
Thank you for the reply.you said that the only way the database can be opened is
if the status of the rollback segment
was offline,but what happens to an active transaction which was using this
rollback segment,
once the database is opened and the media recovery performed on the datafile,the
database will show
values which were part of an active transaction and not committed,isnt this the
logical corruption?
madhukar
FROM: Madhukar Yedulapuram 05-May-02 08:14
Subject: Re : Recovery FROM the loss of a Rollback segment datafile containing
active transactions
Tom,
Can I get some reponse to my questions.
Thank You,
Madhukar
Hi,
Sorry for the confusion, I should not have said "rolling forward to a point in
time..." in my previous reply.
No, there won't be corruption or inconsistency. The redo logs will contain the
information for both
committed and uncommitted transactions. Since this includes changes made to
rollback segment blocks,
it follows that rollback data is also (indirectly) recorded in the redo log.
To recover FROM a loss of Datafiles in the SYSTEM tablespace or
datafiles with active rollback segments. You must perform closed database
recovery.
-Shutdown the database
-Restore the file FROM backup
-Recover the datafile
-Open the database.
References:
Oracle8i Backup and Recovery Guide, chapter 6 under "Losing Datafiles in
ARCHIVELOG Mode ".
Regards
Tom Villane
Oracle Support Metalink Analyst
Hi Tom,
After offlining the rollback segment containing active transaction you can open
the database and do the recovery
and after that any active transactions should be rolled back and the data should
not show up,
but I performed the following test and Oracle is showing logical corruption by
showing data which was never committed.
Hi,
What you are showing is expected and normal, and not corruption.
At the time that you issue the "alter rollback segment test_rbs online;" Oracle
does an implicit commit
becuase any "ALTER" statement is considered DDL and Oracle issues an
implicit COMMIT before and after any data definition language (DDL)statement.
Regards
Tom Villane
Oracle Support Metalink Analyst
--------------------------------------------------------------------------------
Hi Tom,
So what you are saying is the moment I say
Alter rollback segment RBS# online,oracle will issue
an implicit commit,but if you look at my test just after performing the tablespace
recovery
(had only one datafile in the RBS tablespace
which was offlined before opening the database and doing the recovery),
I brought the tablespace online and did a SELECT FROM the table which was having
the active transaction in one of the rollback segments,so this statement has
issued an
implicit commit and I could see the data which was never actually committed,doesnt
this
contradict the Oracle's stance that only that data will be shown which shown which
is committed,
I think this statement is true for Intance and Crash recovery,not for media
recovery as the case
in point proves,but still if you say Oracle issues an implicit commit,then the
stance of oracle is consistent.
madhukar
Hi,
A slight correction to what I posted, I should have said the implicit commit
happened
when the rollback segment was altered offline.
Whether it's an implicit commit (before and after a DDL statement like CREATE,
DROP, RENAME, ALTER)
or if the user did the commit, or if the user exits the application (forces a
commit).
All of the above are considered commits and the data will be saved.
Regards
Tom Villane
Oracle Support Metalink Analyst
Hi Tom,
Thank You very much,so the moment i brought the RBS offline,the transaction was
committed and the data saved in the table,is that what you are saying.
So the data was committed even before performing the recovery,so recovery is
essentially not applying anything in this case.
madhukar
Hi,
Yes, that is what happened.
Regards
Tom Villane
Oracle Support Metalink Analyst
isn't a problem because we most certainly will accept that file. As a test you
can do this (i just did)
At this point, I went out and erased the two datafiles associated with T. I
moved the copy of the one datafile in place...
tkyte@TKYTE816> alter tablespace t online;
alter tablespace t online
*
ERROR at line 1:
ORA-01113: file 9 needs media recovery
ORA-01110: data file 9: 'C:\TEMP\T.DBF'
and now it tells of the missing datafile -- all we need do at this point is:
session level
ALTER SESSION SET EVENTS 'IMMEDIATE TRACE NAME BLOCKDUMP LEVEL 67109037';
ALTER SESSION SET EVENTS 'IMMEDIATE TRACE NAME CONTROLF LEVEL 10';
SVRMGRL>startup mount
SVRMGRL>alter database open;
ora-01157 cannot identify datafile 4 - file not found
ora-01110 data file 4 '/oradata/temp/temp.dbf'
SVRMGRL>alter database datafile '/oradata/temp/temp.dbf' offline drop;
SVRMGRL>alter database open;
SVRMGRL>drop tablespace temp including contents;
SVRMGRL>create tablespace temp datafile '....
19.24 SYSTEM DATAFILE RECOVERY
-----------------------------
- a normal datafile can be taken offline and the database started up.
- the system file can be taken offline but the database cannot start
19.26 ORA-00600
--------------
Temporary Segment
=================
ALTER TABLESPACE tablespace DEFAULT STORAGE ( MAXEXTENTS UNLIMITED);
Table Segment
=============
ALTER TABLE MANIIN_ASIAKAS STORAGE ( MAXEXTENTS UNLIMITED);
Index Segment
=============
ALTER INDEX index STORAGE ( MAXEXTENTS UNLIMITED);
Problem Description
-------------------
In the "alert.log", you find the following warning messages:
kccrsz: denied expansion of controlfile section 9 by 65535 record(s)
the number of records is already at maximum value (65535)
krcpwnc: following controlfile record written over:
RECID #520891 Recno 53663 Record timestamp ...
kccrsz: denied expansion of controlfile section 9 by 65535 record(s)
the number of records is already at maximum value (65535)
krcpwnc: following controlfile record written over:
RECID #520892 Recno 53664 Record timestamp
Solution Description
--------------------
Set the CONTROL_FILE_RECORD_KEEP_TIME to 0:
* Insert the parameter CONTROL_FILE_RECORD_KEEP_TIME = 0 IN "INIT.ORA"
-OR-
* Set it momentarily if you cannot shut the database down now:
Explanation
-----------
The default value for * the CONTROL_FILE_RECORD_KEEP_TIME is 7 days.
SELECT value FROM v$parameter
WHERE name='control_file_record_keep_time';
VALUE
-----
7
* the MAXLOGHISTORY database parameter has already reached the maximum of
65535 and it cannot be increased anymore.
Problem Description:
====================
Instance cannot be started because of ORA-470. LGWR has also died
creating a trace file with an ORA-204 error. It is possible that the
maxloghistory limit of 65535 as specified in the controlfile has
been reached.
Diagnostic Required:
====================
The following information should be requested for diagnostics:
1. LGWR trace file produced
2. Dump of the control file - using the command:
ALTER SESSION SET EVENTS 'immediate trace name controlf level 10'
3. Controlfile contents, using the command:
ALTER DATABASE BACKUP CONTROLFILE TO TRACE;
Diagnostic Analysis:
====================
The following observations will indicate that we have the maxloghistory
limit of 65535:
1. The Lgwr trace file should show the following stack trace:
- in 8.0.3 and 8.0.4, OSD skgfdisp returns ORA-27069,
stack:
kcrfds -> kcrrlh -> krcpwnc -> kccroc -> kccfrd -> kccrbl -> kccrbp
- in 8.0.5 kccrbl causes SEGV before the call to skgfdisp
with wrong block number.
stack:
kcrfds -> kcrrlh -> krcpwnc -> kccwnc -> kccfrd -> kccrbl
2. FROM the 'dump of the controlfile':
...
... numerous lines omittted
...
LOG FILE HISTORY RECORDS:
(blkno = 0x13, size = 36, max = 65535, in-use = 65535, last-recid= 188706)
...
the max value of 65535 reconfirms that the limit has been reached.
3. Further confirmation can be seen FROM the controlfile trace:
CREATE CONTROLFILE REUSE DATABASE "ORCL" NORESETLOGS NOARCHIVELOG
MAXLOGFILES 16
MAXLOGMEMBERS 2
MAXDATAFILES 50
MAXINSTANCES 1
MAXLOGHISTORY 65535
...
Diagnostic Solution:
===================
1. Set control_file_record_keep_time = 0 in the init.ora.
This parameter specifies the minimum age of a log history record
in days before it can be reused. With the parameter set to 0,
reusable sections never expand and records are reused immediately
as required.
[NOTE:1063567.6] <ml2_documents.showDocument?p_id=1063567.6&p_database_id=NOT>
gives a good description on the use of this parameter.
2. Mount the database and retrieve details of online redo log files for use in
step 6. Because the recovery will need to roll forward through current online
redo logs, a list of online log details is required to indicate which redo
log is current. This can be obtained using the following command:
startup mount
SELECT * FROM v$logfile;
3. Open the database.
This is a very important step. Although the startup will fail, it is a
very important step before recreating the controlfile in step 5 and hense,
enabling crash recovery to repair any incomplete log switch. Without this
step it may be impossible to recover the database.
alter database open
4. Shutdown the database, if it did not already crash in step 3.
5. Using the backup controlfile trace, recreate the controlfile with a smaller
maxloghistory value. The MAXLOGHISTORY section of the current control file
cannot be extended beyond 65536 entries. The value should reflect the amount
of log history that you wish to maintain.
An ORA-219 may be returned when the size of the controlfile, based on the
values of the MAX- parameters, is higher then the maximum allowable size.
[NOTE:1012929.6] <ml2_documents.showDocument?p_id=1012929.6&p_database_id=NOT>
gives a good step-by-step guide to recreating the control file.
6. Recover the database.
The database will automatically be mounted due to the recreation of the
controlfile in step 5 :
Recover database using backup controlfile;
At the recovery prompt apply the online logs in sequence by typing the
unquoted full path and file name of the online redo log to apply, as noted
in step 2. After applying the current redo log, you will receive the
message 'Media Recovery Complete'.
7. Once media recovery is complete, open the database as follows:
alter database open resetlogs;
Database files have the COMPATIBLE version in the file header. If you
set the parameter to a higher value, all the headers will be updated at next
database startup. This means that if you shutdown your database, downgrade the
COMPATIBLE parameter, and try to restart your database, you'll receive an error
message something like:
- You may only change the value of COMPATIBLE after a COLD Backup.
- You may only change the value of COMPATIBLE if the database has been
shutdown in NORMAL/IMMEDIATE mode.
This parameter allows you to use a new release, while at the same time
guaranteeing backward
compatibility with an earlier release (in case it becomes necessary to revert to
the earlier release).
This parameter specifies the release with which Oracle7 Server must maintain
compatibility.
Some features of the current release may be restricted. For example, if you are
running release 7.2.2.0
with compatibility set to 7.1.0.0 in order to guarantee compatibility, you will
not be able to use 7.2 features.
When using the standby database and feature, this parameter must have the same
value on the primary
and standby databases, and the value must be 7.3.0.0.0 or higher. This parameter
allows you to immediately
take advantage of the maintenance improvements of a new release in your production
systems
without testing the new functionality in your environment. The default value is
the earliest release with which
compatibility can be guaranteed. Ie: It is not possible to set COMPATIBLE to 7.3
on an Oracle8 database.
-----------------
The database could not start up. If you start the database manually, from the
command line --
you would discover this. For example:
Problem Description:
====================
When you manually switch redo logs, or when the log buffer causes the redo
threads to switch, you see errors similar to the following in your alert log:
...
Fri Apr 24 13:42:00 1998
Thread 1 advanced to log sequence 170
Current log# 4 seq# 170 mem# 0: /.../rdlACPT04.rdl
Fri Apr 24 13:42:04 1998
Errors in file /.../acpt_arch_15973.trc:
ORA-202: controlfile: '/.../ctlACPT01.dbf'
ORA-27044: unable to write the header block of file
SVR4 Error: 48: Operation not supported
Additional information: 3
Fri Apr 24 13:42:04 1998
kccexpd: controlfile resize from 356 to 368 block(s) denied by OS
...
Note: The particular SVR4 error observed may differ in your case and is
irrelevant here.
Solution Description:
=====================
1. Use a database blocksize smaller than 16k. This may not be practical
in all cases, and to change the db_block_size of a database
you must rebuild the database.
- OR -
CONTROL_FILE_RECORD_KEEP_TIME = 0
The database must be shut down and restarted to have the changed
init.ora file read.
Explanation:
============
The write of a 16K buffer to a control file seems to fail during an implicit
resize operation on the controlfile that came as a result of adding log
history records (V$LOG_HISTORY) when archiving an online redo log after a log
switch.
Starting with Oracle8 the control file can grow to a much larger size than it
was able to in Oracle7. Bug 663726
<ml2_documents.showDocument?p_id=663726&p_database_id=BUG>
is only reproducible when the control file
needs to grow AND when the db_block_size = 16k. This has been tested on
instances with a smaller database block size and the problem has not been able
to be reproduced.
Records in some sections in the control file are circularly reusable while
records in other sections are never reused. CONTROL_FILE_RECORD_KEEP_TIME
applies to reusable sections. It specifies the minimum age in days that a
record must have before it can be reused. In the event a new record needs to
be added to a reusable section and the oldest record has not aged enough, the
record section expands.
For most applications, shared pool size is critical to Oracle perfoRMANce. The
shared pool holds both the d
ata dictionary cache and the fully parsed or compiled representations of PL/SQL
blocks and SQL statements.
When any attempt to allocate a large piece of contiguous memory in the shared pool
fails
Oracle first flushes all objects
that are not currently in use from the pool and the resulting free memory chunks
are merged.
If there is still not a single chunk large enough to satisfy the request ORA-04031
is returned.
The message that you will get when this error appears is the following:
Error: ORA 4031
Text: unable to allocate %s bytes of shared memory (%s,%s,%s)
This view keeps information of every SQL statement and PL/SQL block executed in
the database.
The following SQL can show you statements with literal values or candidates to
include bind variables:
Possibly no memory left in Oracle, or the OS does not grant more memory.
Also inspect the size of any swap file.
Hi,
but when i login through other unix id and do the same thing.
I'm not getting any error..
$ ls -l $ORACLE_HOME/bin/oracle
-rwsr-s--x 1 ora920 ora920 51766646 Mar 31 13:03
/usr/oracle/ora920/bin/oracle
regardless of who I log in as, when you have a setuid program as the oracle
binary is, it'll be running "as the owner"
tell me, what does ipcs -a show you, who is the owner of the shared memory
segments associated with the SGA. If that is not Oracle -- you are "getting
confused" somewhere for the s bit would ensure that Oracle was the owner.
19.35:
======
ORA-12545:
----------
This one is probaly due to the fact the IP or HOSTNAME in tnsnames is wrong.
ORA-12514:
----------
This one is probaly due to the fact the SERVICE_NAME in tnsnames is wrong or
should be
fully qualified with domain name.
ORA-12154:
----------
This one is probaly due to the fact the alias you have used in the logon dialogbox
is wrong.
fully qualified with domain name.
ORA-12535:
----------
ORA-12505:
----------
Note 1:
-------
Symptom:
When trying to connect to Oracle the following error is generated:
ORA-12224: TNS: listener could not resolve SID given in connection description.
Cause:
The SID specified in the connection was not found in the listener�s tables. This
error will be returned
if the database instance has not registered with the listener.
Possible Remedy:
Check to make sure that the SID is correct. The SIDs that are currently registered
with the listener can be obtained by typing:
Note 2:
-------
eg.
C:>tnsping ora920
As one can see, this is the connection information stored in a tnsnames.ora file:
ORA920.EU.DBMOTIVE.COM =
(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = TCP)(HOST = DEV01)(PORT = 2491))
)
(CONNECT_DATA =
(SID = UNKNOWN)
(SERVER = DEDICATED)
)
)
However, the SID UNKNOWN is not known by the listener at the database server side.
In order to test the known services by a listener, we can issue following command
at the database server side:
C:>lsnrctl services
Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=DEV01)(PORT=1521)))
Services Summary...
Service "ORA10G.eu.dbmotive.com" has 1 instance(s).
Instance "ORA10G", status UNKNOWN, has 1 handler(s) for this service...
Handler(s):
"DEDICATED" established:0 refused:0
LOCAL SERVER
Service "ORA920.eu.dbmotive.com" has 2 instance(s).
Instance "ORA920", status UNKNOWN, has 1 handler(s) for this service...
Handler(s):
"DEDICATED" established:0 refused:0
LOCAL SERVER
Instance "ORA920", status READY, has 1 handler(s) for this service...
Handler(s):
"DEDICATED" established:2 refused:0 state:ready
LOCAL SERVER
The command completed successfully
Changing the SID in our tnsnames.ora to a known service by the listener (ORA920)
solved the problem.
19.36 ORA-12560
---------------
Note 1:
-------
Note 2:
-------
PURPOSE
RELATED DOCUMENTS
PR:1070749.6
NOTE:1016454.102 <ml2_documents.showDocument?p_id=1016454.102&p_database_id=NOT>
TNS 12560 DB CREATE VIA INSTALLATION OR CONFIGURATION ASSISTANT FAILS
BUG:948671 <ml2_documents.showDocument?p_id=948671&p_database_id=BUG> ORADIM
SUCCSSFULLY CREATES AN UNUSABLE SID WITH NON-ALPHANUMERIC
CHARACTER
BUG:892253 <ml2_documents.showDocument?p_id=892253&p_database_id=BUG> ORA-12560
CREATING DATABASE WITH DB CONFIGURATION ASSISTANT IF
SID HAS NON-ALPHA
If you encounter an ORA-12560 error when you try to start Server Manager
or SQL*Plus locally on your Windows NT server, you should first check
the ORACLE_SID value. Make sure the SID is correctly set, either in the
Windows NT registry or in your environment (with a set command). Also, you
must verify that the service is running. See the entries above for more details.
If you have verified that ORACLE_SID is properly set, and the service
is running, yet you still get an ORA-12560, then it is possible that you
have created an instance with a non-alphanumeric character.
The Getting Started Guide for Oracle8i on Windows NT documents that SID
names can contain only alphanumerics, however if you attempt to create a SID
with an underscore or a dash on Oracle8i you are not prevented from doing so.
The service will be created and started successfully, but attempts to connect
will fail with an ORA-12560.
You must delete the instance and recreate it with no special characters -
only alphanumerics are allowed in the SID name.
See BUG#948671, which was logged against 8.1.5 on Windows NT for this issue.
Note 3:
-------
This note describes some of the possible reasons for ORA-12560 errors
connecting to server on Unix Box. The list below shows some of the
causes, the symptoms and the action to take. It is possible you will hit
a cause not described here, in that case the information above should allow
it to be identified.
Problem:
Trying to connect to the database via listener and the ORA-12500 are
prompted. You may see in the listener.log ORA-12500 and ORA-12560:
In many cases the error ORA-12500 is caused due to leak of resources in the
Unix Box, if you are enable to connect to database and randomly you get
the error your operating system is reached the maximum values for some
resources. Otherwise, if you get the error in first connection the problem
may be in the configuration of the system.
Solution:
Finding the resource which is been reached is difficult, the note 2064862.102
<ml2_documents.showDocument?p_id=2064862.102&p_database_id=NOT>
indicates some suggestion to solve the problems.
Problem:
Trying to connect to database via SQL*Net the error the error ORA-12538
is prompted. In the trace file you can see:
Solution:
- Check the protocol used in the TNSNAMES.ORA by the connection string
- Ensure that the TNSNAMES.ORA you check is the one that is actually being
used by Oracle. Define the TNS_ADMIN environment variable to point to the
TNSNAMES directory.
- Using the $ORACLE_HOME/bin/adapters command, ensure the protocol is
installed. Run the command without parameters to check if the protocol is
installed, then run the command with parameters to see whether a
particular tool/application contains the protocol symbols e.g.:
1. $ORACLE_HOME/bin/adapters
2. $ORACLE_HOME/bin/adapters $ORACLE_HOME/bin/oracle
$ORACLE_HOME/bin/adapters $ORACLE_HOME/bin/sqlplus
Explanation:
If the protocol is not installed every connection attempting to use it will
fail with ORA-12538 because the executable doesn't contain the required
protocol symbol/s.
Problem:
Trying to connect to database locally with a different account to the
software owner, the error the error ORA-12546 is prompted. In the trace file
you can see:
nioqper: error from nscall
nioqper: nr err code: 0
nioqper: ns main err code: 12546
nioqper: ns (2) err code: 12560
nioqper: nt main err code: 516
nioqper: nt (2) err code: 13
nioqper: nt OS err code: 0
Solution:
Make sure the permissions of oracle executable are correct, this should be:
Explanation:
The problem occurs due to an incorrect setting on the oracle executable.
Problem:
You are trying to connect to a database using SQL*Net and receive the
following error ORA-12541 ORA-12560 after change the TCP/IP port in the
listener.ora and you are using PARAMETER USE_CKPFILE_LISTENER in
listener.ora.
Solution:
Check [NOTE:1061927.6]
<ml2_documents.showDocument?p_id=1061927.6&p_database_id=NOT> to resolve the
problem.
Explanation:
If TCP protocol is listed in the Listener.ora's ADDRESS_LIST section and
the parameter USE_CKPFILE_LISTENER = TRUE, the Listener ignores the TCP
port number defined in the ADDRESS section and listens on a random port.
RELATED DOCUMENTS
-----------------
Note:39774.1 <ml2_documents.showDocument?p_id=39774.1&p_database_id=NOT> LOG &
TRACE Facilities on NET .
Note:45878.1 <ml2_documents.showDocument?p_id=45878.1&p_database_id=NOT>
SQL*Net Common Errors & Diagnostic Worksheet
Net8i Admin/Ch.11 Troubleshooting Net8 / Resolving the Most Common
Error Messages
19.37 ORA-12637
---------------
A process was unable to receive a packet from another process. Possible causes
are: 1. The other process was terminated.
2. The machine on which the other process is running went down.
3. Some other communications error occurred.
Note 1:
Just edit the file sqlnet.ora and search for the string
SQLNET.AUTHENTICATION_SERVICES.
When it exists it�s set to = (TNS), change this to = (NONE). When it doesn�t
exist, add the string
SQLNET.AUTHENTICATION_SERVICES = (NONE)
Note 2:
SQLNET.AUTHENTICATION_SERVICES
Purpose
Use the parameter SQLNET.AUTHENTICATION_SERVICES to enable one or more
authentication services.
If authentication has been installed, it is recommended that this parameter be set
to either none or to one
of the authentication methods.
Default
None
Values
Authentication Methods Available with Oracle Net Services:
none for no authentication methods. A valid username and password can be used to
access the database.
all for all authentication methods
nts for Windows NT native authentication
Authentication Methods Available with Oracle Advanced Security:
kerberos5 for Kerberos authentication
cybersafe for Cybersafe authentication
radius for RADIUS authentication
dcegssapi for DCE GSSAPI authentication
See Also:
Oracle Advanced Security Administrator's Guide
Example
SQLNET.AUTHENTICATION_SERVICES=(kerberos5, cybersafe)
Note 3:
Problem solved. Specific NT group (wwwauthor) which caused problems had existed
already with specific permissions,
then it was dropped and created again with exactly the same name (but, of course,
with different internal ID).
This situation have been identified as causing some kind of mess.
A completely new group with different name has been created.
Note 4:
I added a second instance to the Oracle server. Since then, on the server and all
clients,
I get ORA-12637 packet receive failure when I try to connect to this database. Why
is this?
Hello
Please also verify that the server's LISTENER.ORA file contains the following
parameter:
CONNECT_TIMEOUT_LISTENER=0
Note 5:
Note 6:
Problem Description
-------------------
Connections to Oracle 9.2 using a Cybersafe authenticated user fails on Solaris
2.6 with ORA-12637 and a core dump is generated.
Solution Description
--------------------
1) Shutdown Oracle, the listener and any clients.
2) In $ORACLE_HOME/lib take a backup copy of the file sysliblist
3) Edit sysliblist. Move the -lthread entry to the beginning.
So change from, -lnsl -lsocket -lgen -ldl -lsched -lthread To, -
lthread -lnsl -lsocket -lgen -ldl -lsched
4) Do $ORACLE_HOME/bin/relink all
Note 7:
fix:
dba_2pc_pending:
Lists all in-doubt distributed transactions. The view is empty until populated by
an in-doubt transaction.
After the transaction is resolved, the view is purged.
LOCAL_TRAN_ID GLOBAL_TRAN_ID
---------------------- ----------------------------------------------------------
6.31.5950 1145324612.10D447310B5FCE408A296417959EBEEC00000000
STATE TRAN_COMMENT
---------------- ------------------------------------------------------------
prepared
Rollback complete.
SQL> commit;
Errors
ORA-30019 Illegal rollback Segment operation in Automatic Undo mode
Symptoms
Attempting to clean up the pending transaction using
DBMS_TRANSACTION.PURGE_LOST_DB_ENTRY, getting ora-30019:
Fix
1.) alter session set "_smu_debug_mode" = 4;
2.) execute DBMS_TRANSACTION.PURGE_LOST_DB_ENTRY('local_tran_id');
Problem Description:
---------------------
You are doing a describe or select on a table and receive:
ORA-600 [12850]:
Meaning: 12850 occurs when it can't find the user who owns the object
from the dictionary.
ORA-600 [15625]:
Meaning: The arguement 15625 is occuring because some index entry for the
table is not found in obj$.
Problem Explanation:
--------------------
The data dictionary is corrupt.
You cannot drop the tables in question because the data dictionary doesn't know
they exist.
Search Words:
-------------
ORA-600 [12850]
ORA-600 [15625]
describe
delete
table
Solution Description:
---------------------
You need to rebuild the database.
Solution Explanation:
---------------------
Since the table(s) cannot be accessed or dropped because of the data dictionary
corruption, rebuilding the database is the only option.
19.40 ORA-01092:
================
----------------------------------------------------------------------------------
---------
Symptom(s)
~~~~~~~~~~
Change(s)
~~~~~~~~~~
Cause
~~~~~~~
Fix
~~~~
max_rollback_segments = transactions/transactions_per_rollback_segment or
30 whichever is greater.
1. Use these calculations and find out the value for max_rollback_segments.
2. Set it to this value or 30 whichever is greater.
3. Startup database after this correct setting.
Reference info
~~~~~~~~~~~~~~
[BUG:2233336] <ml2_documents.showDocument?p_id=2233336&p_database_id=BUG> -
RDBMS ERRORS AT STARTUP CAN CAUSE ODMA TO OMIT CLEANUP ACTIONS
[NOTE:30764.1] <ml2_documents.showDocument?p_id=30764.1&p_database_id=NOT> -
Init.ora Parameter "MAX_ROLLBACK_SEGMENTS" Reference Note
----------------------------------------------------------------------------------
----------
Problem Summary:
================
Problem Description:
====================
When you startup your Oracle RDBMS database, you receive the following error:
Problem Explanation:
====================
Solution Summary:
=================
Solution Description:
=====================
2. Login as root.
4. Change the owner of all the files and the directory to the
software owner.
For example:
% chown oracle *
% chmod 755 .
Solution Explanation:
=====================
---------------------------------------------------------------------------
Cause
In the case where there's locally managed temp tablespace in the database,after
controlfile is
re-created using the statement generated by "alter database backup controlfile to
trace", the database
can't be opened again because it complains that temp tablespace is empty. However
no tempfiles can be added
to the temp tablespace, nor can the temp tablespace be dropped because the
database is not yet open.
The query failed because of inadequate sort space(memory + disk)
Fix
We can increase the sort_area_size and sort_area_retained_size to a very high
value so that the query completes.
Then DB will open and we can take care of the TEMP tablespace
-------------------------------------------------------------------------------
One of our DBAs dropped the OUTLN user in 10G and now the instance will not start.
Thanks...
Hi Ronald,
http://metalink.oracle.com/metalink/plsql/ml2_documents.showDocument?p_database_id
=BUG&p_id=3786479
Regards,
Fairlie Rego
----------------------------------------------------------------------------------
Displayed below are the messages of the selected thread.
Hi,
Since our undotbs is very large and we try to follow the Doc ID: 157278.1, we are
trying to change the undotbs
to a new one
We try to
1. Create UNDO tablespace undotb2 datafile $ORACLE_HOME/oradata/undotb2.dbf size
300M
2. ALTER SYSTEM SET undo_tablespace=undotb2;
3. Change undo = undotb2;
4. Restart the database;
5. alter tablespace undotbs offline;
6. when we restart the database, it shows the following error.
SQL>
/u01/oracle/product/9.0.1/admin/TEST/udump/ora_29151.trc
Oracle9i Release 9.0.1.3.0 - Production
JServer Release 9.0.1.3.0 - Production
ORACLE_HOME = /u01/oracle/product/9.0.1
System name: Linux
Node name: utxrho01.unitex.com.hk
Release: 2.4.2-2smp
Version: #1 SMP Sun Apr 8 20:21:34 EDT 2001
Machine: i686
Instance name: TEST
Redo thread mounted by this instance: 1
Oracle process number: 9
Unix process pid: 29151, image: [email protected] (TNS V1-V3)
Regards,
Henry
Hi Henry,
What you are seeing is bug 2360088, which is fixed in Oracle 9.2.0.2.
I suggest that you log an iSR (formerly iTAR) for a quicker solution for the
problem.
Regards
Pravin
----------------------------------------------------------------------------------
-
Note 1:
-------
This note contains information that has not yet been reviewed by the
PAA Internals group or DDR.
As such, the contents are not necessarily accurate and care should be
taken when dealing with customers who have encountered this error.
If you are going to use the information held in this note then please
take whatever steps are needed to in order to confirm that the
information is accurate. Until the article has been set to EXTERNAL, we
do not guarantee the contents.
</Internal_Only>
Note: For additional ORA-600 related information please read Note 146580.1
PURPOSE:
This article represents a partially published OERI note.
<Internal_Only>
PURPOSE:
This article discusses the internal error "ORA-600 [qerfxFetch_01]", what
it means and possible actions. The information here is only applicable
to the versions listed and is provided only for guidance.
ERROR:
ORA-600 [qerfxFetch_01]
VERSIONS:
versions 9.2
DESCRIPTION:
FUNCTIONALITY:
Fixed table row source.
IMPACT:
NON CORRUPTIVE - No underlying data corruption.
</Internal_Only>
SUGGESTIONS:
If the Known Issues section below does not help in terms of identifying
a solution, please submit the trace files and alert.log to Oracle
Support Services for further analysis.
Known Issues:
<Internal_Only>
Ensure that this note comes out on top in Metalink when searched
ora-600 ora-600 ora-600 ora-600 ora-600 ora-600 ora-600
ora-600 ora-600 ora-600 ora-600 ora-600 ora-600 ora-600
qerfxFetch_01 qerfxFetch_01 qerfxFetch_01 qerfxFetch_01 qerfxFetch_01
qerfxFetch_01 qerfxFetch_01 qerfxFetch_01 qerfxFetch_01 qerfxFetch_01
qerfxFetch_01 qerfxFetch_01 qerfxFetch_01 qerfxFetch_01 qerfxFetch_01
qerfxFetch_01 qerfxFetch_01 qerfxFetch_01 qerfxFetch_01 qerfxFetch_01
</Internal_Only>
Note 2:
-------
Doc ID </help/usaeng/Search/search.html>:
Note:2306106.8 Content Type: TEXT/X-HTML
Subject: Support Description of Bug 2306106
Creation Date: 13-AUG-2003
Type: PATCH Last Revision Date: 14-AUG-2003
Status: PUBLISHED
Note 3:
-------
Bug 2306106 is fixed in the 9.2.0.2 patchset. This bug is not published and thus
cannot be viewed externally
in MetaLink. All it says on this bug is 'ORA-600 [qerfxFetch_01] possible -
affects OEM'.
Note 1:
-------
Note 2:
-------
Note: For additional ORA-600 related information please read Note 146580.1
</metalink/plsql/showdoc?db=NOT&id=146580.1>
PURPOSE:
This article discusses the internal error "ORA-600 [kteuproptime-2]",
what it means and possible actions. The information here is only
applicable to the versions listed and is provided only for guidance.
ERROR:
ORA-600 [kteuproptime-2]
VERSIONS:
versions 9.0 to 9.2
DESCRIPTION:
FUNCTIONALITY:
UNDO EXTENTS
IMPACT:
INSTANCE FAILURE
POSSIBLE PHYSICAL CORRUPTION
SUGGESTIONS:
If instance is down and fails to restart due to this error then set the
following parameter, which will gather additional information to
assist support in identifing the cause:
Restart the instance and submit the trace files and alert.log to
Oracle Support Services for further analysis.
Known Issues:
Note 3:
-------
Hi,
This will only cause a problem if there was an instance crash after a
transaction committed but before it propogated the extent commit times to all
its extents AND there was a shrink of extents before the transaction could
be recovered.
But still, this bug was not published (not for any particular reason
except it was found internal).
Greetings,
Note 4:
-------
Regards,
Ken Robinson
Oracle Server EE Analyst
Note 5:
-------
Symptoms
Oracle instance crashes and details of the ORA-00600 error are written to the
alert.log
ORA-00600: internal error code, arguments: [kteuPropTime-2], [], [], []
Followed by
Fatal internal error happened while SMON was doing active transaction recovery.
Then
SMON: terminating instance due to error 600
Instance terminated by SMON, pid = 22972
This occurs as Oracle encounters an error when propagating Extent Commit Times in
the Undo Segment Header Extent Map Blocks.
It could be because SMON is over-enthusiastic in shrinking extents in SMU
segments. As a result, extent commit times
do not get written to all the extents and SMON causes the instance to crash,
leaving one or more of the undo segments
corrupt.
When opening the database following the crash, Oracle tries to perform crash
recovery and encounters problems
recovering committed transactions stored in the corrupt undo segments. This leads
to more ORA-00600 errors
and a further instance crash. The net result is that the database cannot be
opened:
Workaround
Until the corrupt undo segment can be identified and offlined then unfortunately
the database will not open.
Identify the corrupt undo segment by setting the following parameters in the
init.ora file:
_smu_debug_mode=1
event="10015 trace name context forever, level 10"
With these parameters set, an attempt to open the database will still cause a
crash, but Oracle will write
vital information about the corrupt rollback/undo segments to a trace file in
user_dump_dest.
This is an extract from such a trace file, revealing that undo segment number 6
(_SYSSMU6$) is corrupt.
Notice that the information stored in the segment header about the number of
extents was inconsistent
with the extent map.
Retention Table
-----------------------------------------------------------
Extent Number:0 Commit Time: 1060617115
Extent Number:1 Commit Time: 1060611728
Extent Number:2 Commit Time: 1060611728
Extent Number:3 Commit Time: 1060611728
Extent Number:4 Commit Time: 1060611728
_corrupted_rollback_segments=(_SYSSMU6$)
This time, Oracle will start and open OK, which will allow you to check the status
of the undo segments
by querying DBA_ROLLBACK_SEGS.
SMON will complain every 5 minutes by writing entries to the alert.log as long as
there are undo segments
in need of recovery
At this point, you must either download and apply patch 2431450 or create private
rollback segments.
Note 6:
-------
This manifests with this error: ORA-00376: file xx cannot be read at this time
Dropping the corrupt UNDO tablespace can be tricky and you may get the message:
select
segment_name,
status
from
dba_rollback_segs
where
tablespace_name='undotbs_corrupt'
and
status = �NEEDS RECOVERY�;
SEGMENT_NAME STATUS
------------------------------ ----------------
_SYSSMU22$ NEEDS RECOVERY
_OFFLINE_ROLLBACK_SEGMENTS=_SYSSMU22$
Note 7:
-------
USE the following query to find out what object Oracle is trying to
perform recovery on.
19.43 ORA-1653
==============
Note 1:
-------
SCOPE& APPLICATION
------------------
It is for users requiring further information on ORA-01653 error message.
When looking to resolve the error by using any of the solutions suggested, please
consult the DBA for assistance.
Error: ORA-01653
Text: unable to extend table %s.%s by %s in tablespace %s
-------------------------------------------------------------------------------
Cause: Failed to allocate an extent for table segment in tablespace.
Action: Use ALTER TABLESPACE ADD DATAFILE statement to add one or more
files to the tablespace indicated.
Explanation:
------------
This error does not necessarily indicate whether or not you have enough space
in the tablespace, it merely indicates that Oracle could not find a large enough
area of free
contiguous space in which to fit the next extent.
Diagnostic Steps:
-----------------
1. In order to see the free space available for a particular tablespace, you must
use the view DBA_FREE_SPACE. Within this view, each record represents one
fragment of space. How the view DBA_FREE_SPACE can be used to determine
the space available in the database is described in:
[NOTE:121259.1] <ml2_documents.showDocument?p_id=121259.1&p_database_id=NOT>
Using DBA_FREE_SPACE
2. The DBA_TABLES view describes the size of next extent (NEXT_EXTENT) and the
percentage increase (PCT_INCREASE) for all tables in the database.
The "next_extent" size is the size of extent that is trying to be allocated
(and for
which you have the error).
3. Look to see if any users have the tablespace in question as their temporary
tablespace.
This can be checked by looking at DBA_USERS (TEMPORARY_TABLESPACE).
Possible solutions:
-------------------
- Manually Coalesce Adjacent Free Extents
ALTER TABLESPACE <tablespace name> COALESCE;
The extents must be adjacent to each other for this to work.
- Add a Datafile:
ALTER TABLESPACE <tablespace name> ADD DATAFILE '<full path and file
name>'
SIZE <integer> <k|m>;
- Enable autoextend:
ALTER DATABASE DATAFILE '<full path and file name>' AUTOEXTEND ON
MAXSIZE UNLIMITED;
References:
-----------
[NOTE:1025288.6] <ml2_documents.showDocument?p_id=1025288.6&p_database_id=NOT> How
to Diagnose and Resolve ORA-01650, ORA-01652, ORA-01653, ORA-01654, ORA-01688 :
Unable to Extend < OBJECT > by %S in Tablespace
[NOTE:1020090.6] <ml2_documents.showDocument?p_id=1020090.6&p_database_id=NOT>
Script to Report on Space in Tablespaces
[NOTE:1020182.6] <ml2_documents.showDocument?p_id=1020182.6&p_database_id=NOT>
Script to Detect Tablespace Fragmentation
[NOTE:1012431.6] <ml2_documents.showDocument?p_id=1012431.6&p_database_id=NOT>
Overview of Database Fragmentation
[NOTE:121259.1] <ml2_documents.showDocument?p_id=121259.1&p_database_id=NOT>
Using DBA_FREE_SPACE
[NOTE:61997.1] <ml2_documents.showDocument?p_id=61997.1&p_database_id=NOT> SMON
- Temporary Segment Cleanup and Free Space Coalescing
Note 2:
-------
This document can be used to diagnose and resolve space management errors - ORA-
1650, ORA-1652,
ORA-1653, ORA-1654 and ORA-1688.
A. In order to address the UNABLE TO EXTEND issue, you need to get the following
information:
SELECT max(bytes)
FROM dba_free_space
WHERE tablespace_name = '<tablespace name>';
The above query returns the largest available contiguous chunk of space.
Please note that if the tablespace you are concerned with is of type
TEMPORARY,
then please refer to [NOTE:188610.1]
<ml2_documents.showDocument?p_id=188610.1&p_database_id=NOT>.
If this query is done immediately after the failure, it will show that the
largest contiguous space in the tablespace is smaller than the next extent
the object was trying to allocate.
next_extent = 512000
pct_increase = 50
=> extent size = 512000 * (1 + (50/100)) = 512000 * 1.5 = 768000
If this error is caused by a query, then try and ensure that the query
is tuned to perform its sorts as efficiently as possible.
B. Possible Solutions
There are several options for solving errors due to failure to extend:
b. Add a Datafile
--------------
[NOTE:1020182.6]
<ml2_documents.showDocument?p_id=1020182.6&p_database_id=NOT> Script to Detect
Tablespace Fragmentation
[NOTE:1012431.6]
<ml2_documents.showDocument?p_id=1012431.6&p_database_id=NOT> Overview of
Database Fragmentation
[NOTE:30910.1] <ml2_documents.showDocument?p_id=30910.1&p_database_id=NOT>
Recreating Database Objects
Related Documents:
==================
[NOTE:15284.1] <ml2_documents.showDocument?p_id=15284.1&p_database_id=NOT>
Understanding and Resolving ORA-01547
<Note.151994.1> Overview Of ORA-01653 Unable To Extend Table %s.%s By %s In
Tablespace %s:
<Note.146595.1> Overview Of ORA-01654 Unable To Extend Index %s.%s By %s In
Tablespace %s:
[NOTE:188610.1] <ml2_documents.showDocument?p_id=188610.1&p_database_id=NOT>
DBA_FREE_SPACE Does not Show Information about Temporary Tablespaces
[NOTE:1069041.6] <ml2_documents.showDocument?p_id=1069041.6&p_database_id=NOT> How
to Find Creator of a SORT or TEMPORARY SEGMENT or Users
Performing Sorts for Oracle8 and 9
Search Words:
=============
ORA-600 [KSLAWE:!PWQ]
Possible bugs: Fixed in:
<Bug:3566420 </metalink/plsql/showdoc?db=Bug&id=3566420>> BACKGROUND PROCESS GOT
OERI:KSLAWE:!PWQ AND INSTANCE CRASHES 9.2.0.6, 10G
References:
<Note:271084.1 </metalink/plsql/showdoc?db=Not&id=271084.1>> ALERT: ORA-
600[KSLAWE:!PWQ] RAISED IN V92040 OR V92050 ON SUN 64BIT ORACLE
ORA-600 [ksmals]
Possible bugs: Fixed in:
<Bug:2662683 </metalink/plsql/showdoc?db=Bug&id=2662683>> ORA-7445 & HEAP
CORRUPTION WHEN RUNNING APPS PROGRAM THAT DOES HEAVY INSERTS 9.2.0.4
References:
<Note:247822.1 </metalink/plsql/showdoc?db=Not&id=247822.1>> ORA-600 [ksmals]
ORA-600 [4000]
Possible bugs: Fixed in:
<Bug:2959556 </metalink/plsql/showdoc?db=Bug&id=2959556>> STARTUP after an ORA-
701 fails with OERI[4000] 9.2.0.5, 10G
<Bug:1371820 </metalink/plsql/showdoc?db=Bug&id=1371820>> OERI:4506 / OERI:4000
possible against transported tablespace 8.1.7.4, 9.0.1.4, 9.2.0.1
References:
<Note:47456.1 </metalink/plsql/showdoc?db=Not&id=47456.1>> ORA-600 [4000]
"trying to get dba of undo segment header block from usn"
ORA-600 [4454]
Possible bugs: Fixed in:
<Bug:1402161 </metalink/plsql/showdoc?db=Bug&id=1402161>> OERI:4411/OERI:4454 on
long running job 8.1.7.3, 9.0.1.3, 9.2.0.1
References:
<Note:138836.1 </metalink/plsql/showdoc?db=Not&id=138836.1>> ORA-600 [4454]
ORA-600 [kcbgcur_9]
Possible bugs: Fixed in:
<Bug:2722809 </metalink/plsql/showdoc?db=Bug&id=2722809>> OERI:kcbgcur_9 on
direct load into AUTO space managed segment 9.2.0.4, 10G
<Bug:2392885 </metalink/plsql/showdoc?db=Bug&id=2392885>> Direct path load may
fail with OERI:kcbgcur_9 / OERI:ktfduedel2 9.2.0.4, 10G
<Bug:2202310 </metalink/plsql/showdoc?db=Bug&id=2202310>> OERI:KCBGCUR_9 possible
from SMON dropping a rollback segment in locally managed tablespace 9.0.1.4,
9.2.0.1
<Bug:2035267 </metalink/plsql/showdoc?db=Bug&id=2035267>> OERI:KCBGCUR_9 possible
during TEMP space operations 9.0.1.3, 9.2.0.1
<Bug:1804676 </metalink/plsql/showdoc?db=Bug&id=1804676>> OERI:KCBGCUR_9 possible
from ONLINE REBUILD INDEX with concurrent DML 8.1.7.3, 9.0.1.3, 9.2.0.1
<Bug:1785175 </metalink/plsql/showdoc?db=Bug&id=1785175>> OERI:kcbgcur_9 from
CLOB TO CHAR or BLOB TO RAW conversion 9.2.0.2, 10G
References:
<Note:114058.1 </metalink/plsql/showdoc?db=Not&id=114058.1>> ORA-600
[kcbgcur_9] "Block class pinning violation"
References:
<Note:209363.1 </metalink/plsql/showdoc?db=Not&id=209363.1>> ORA-600
[qerrmOFBu1] - "Error during remote row fetch operation
<Note:207319.1 </metalink/plsql/showdoc?db=Not&id=207319.1>> ALERT: Connections
from Oracle 9.2 to Oracle7 are Not Supported
References:
<Note:139037.1 </metalink/plsql/showdoc?db=Not&id=139037.1>> ORA-600 [kdddgb2]
ADJUST_SCN Event
~~~~~~~~~~~~~~~~
*** WARNING ***
This event should only ever be used under the guidance
of an experienced Oracle analyst.
If an SCN is ahead of the current database SCN, this indicates
some form of database corruption. The database should be rebuilt
after bumping the SCN.
****************
**NOTE: You can check that the ADJUST_SCN event has fired as it
should write a message to the alert log in the form
"Debugging event used to advance scn to %s".
If this message is NOT present in the alert log the event
has probably not fired.
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
If the database will NOT open:
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Take a backup.
You can use event 10015 to trigger an ADJUST_SCN on database open:
startup mount;
alter session set events '10015 trace name adjust_scn level 1';
(NB: You can only use IMMEDIATE here on an OPEN database. If the
database is only mounted use the 10015 trigger to adjust SCN,
otherwise you get ORA 600 [2251], [65535], [4294967295] )
If you get an ORA 600:2256 shutdown, use a higher level and reopen.
Do *NOT* set this event in init.ora or the instance will crash as soon
as SMON or PMON try to do any clean up. Always use it with the
"alter session" command.
~~~~~~~~~~~~~~~~~~~~~~~~~~
If the database *IS* OPEN:
~~~~~~~~~~~~~~~~~~~~~~~~~~
You can increase the SCN thus:
alter session set events 'IMMEDIATE trace name ADJUST_SCN level 1';
If you try to raise the SCN to a level LESS THAN or EQUAL to its
current setting you will get <OERI:2256> - See below.
Ie: The event steps the SCN to known levels. You cannot use
the same level twice.
b) Multiply the TARGET wrap number by 4. This will give you the level
to use in the adjust_scn to get the correct wrap number.
c) Next, add the following value to the level to get the desired base
value as well :
---------------------------------------------------------------------------
Argument Description:
Until version 7.2.3 this internal error can be logged for two separate
reasons, which we will refer to as type I and type II. The two types can
be distinguished by the number of arguments:
Type I has four or five arguments after the [2662].
Type II has one argument after the [2662].
From 7.2.3 onwards type II no longer exists.
Type I
~~~~~~
a. Current SCN WRAP
b. Current SCN BASE
c. dependant SCN WRAP
d. dependant SCN BASE
e. Where present this is the DBA where the dependant SCN came from.
From kcrf.h:
If the SCN comes from the recent or current SCN then a dba
of zero is saved. If it comes from undo$ because the undo segment is
not available then the undo segment number is saved, which looks like
a block from file 0. If the SCN is for a media recovery redo (i.e.
block number == 0 in change vector), then the dba is for block 0
of the relevant datafile. If it is from another database for
distribute xact then dba is DBAINF(). If it comes from a TX lock
then the dba is really usn<<16+slot.
Type II
~~~~~~~
a. checksum -> log block checksum - zero if none (thread # in old format)
---------------------------------------------------------------------------
Diagnosis:
~~~~~~~~~~
In addition to different basic types from above, there are different
situations and coherences where ORA-600 [2662] type 'I' can be raised.
Getting started:
~~~~~~~~~~~~~~~~
(1) is the error raised during normal database operations (i.e. when the
database is up) or during startup of the database?
(2) what is the SCN difference [d]-[b] ( subtract argument 'b' from arg 'd')?
(3) is there a fifth argument [e] ?
If so convert the dba to file# block#
Is it a data dictionary object? (file#=1)
If so find out object name with the help of reference dictionary
from second database
(4) What is the current SQL statement? (see trace)
Which table is refered to?
Does the table match the object you found in step before?
Deeper analysis:
~~~~~~~~~~~~~~~~
- investigate trace file
this will be a user trace file normally but could be an smon trace too
SEE BELOW for EXAMPLES which demonstrate the sort of output you may
see in trace files and the things to check.
- If Parallel Server check both nodes are using the same lock manager
instance & point at the same control files.
Possible causes:
- doing an open resetlogs with _ALLOW_RESETLOGS_CORRUPTION enabled
- a hardware problem, like a faulty controller, resulting in a failed
write to the control file or the redo logs
- restoring parts of the database from backup and not doing the
appropriate recovery
- restoring a control file and not doing a RECOVER DATABASE USING BACKUP
CONTROLFILE
- having _DISABLE_LOGGING set during crash recovery
- problems with the DLM in a parallel server environment
- a bug
Solutions:
- if the SCNs in the error are very close:
Attempting a startup several times will bump up the dscn every time we
open the database even if open fails. The database will open when
dscn=scn.
- Once this has occurred you would normally want to rebuild the
database via exp/rebuild/imp as there is no guarantee that some
other blocks are not ahead of time.
Articles:
~~~~~~~~~
Solutions:
[NOTE:30681.1] Details of the ADJUST_SCN Event
[NOTE:1070079.6] alter system checkpoint
Possible Causes:
[NOTE:1021243.6] CHECK INIT.ORA SETTING _DISABLE_LOGGING
[NOTE:74903.1] How to Force the Database Open (_ALLOW_RESETLOGS_CORRUPTION)
[NOTE:41399.1] Forcing the database open with `_ALLOW_RESETLOGS_CORRUPTION`
[NOTE:851959.9] OERI:2662 DURING CREATE SNAPSHOT AT MASTER SITE
Known Bugs:
~~~~~~~~~~~
---------------------------------------------------------------------------
---------------------------------------------------------------------------
Examples:
~~~~~~~~
Below are some examples of this type of error and the information
you will see in the trace files.
~~~~~~~~~~
CASE (a)
~~~~~~~~~~
blockdump should look like this:
***
buffer dba: 0x05000002 inc: 0x00000001 seq: 0x0001a9c6
ver: 1 type: 1=KTU UNDO HEADER
-> interpret:
dba: 0x05000002 -> 83886082 (0x05000002) = 5,2
XXX tsn: 4 -> this is rollback segment 4
tsn: 4 -> this rollback segment is in tablespace 4
-> [e] > 0 and represents dba from block which is in trace
-> [d]-[b] = 71195 - 71183 = 12
***
TRN TBL::
-> If some recovery steps have just been performed review these steps
as the mismatch may be due to open resetlogs with
_allow_resetlogs_corruption enabled or similar.
See <Parameter:Allow_Resetlogs_corruption> for information on this
parameter.
------------------------------------------------------------------
~~~~~~~~~~
CASE (b)
~~~~~~~~~~
blockdump looks like this:
***
buffer dba: 0x0100012f inc: 0x00000815 seq: 0x00000d48
ver: 1 type: 6=trans data
data_block_dump
===============
...
***
interpret:
dba: 0x0100012f -> 8,10 ==> 16777519 (0x0100012f) = 1,303
(0x1 0x12f)
***
SVRMGR> SELECT SEGMENT_NAME, SEGMENT_TYPE FROM DBA_EXTENTS
2> WHERE FILE_ID = 1 AND 303 BETWEEN BLOCK_ID AND
3> BLOCK_ID + BLOCKS - 1;
SEGMENT_NAME SEGMENT_TYPE
---------------------------------------------------------- -----------------
UNDO$ TABLE
1 row selected.
***
---------------------------------------------------------------------------
---------------------------------------------------------------------------
---------------------------------------------------------------------------
hypothesis:
current SCN decreased
Evidence:
reproduced ORA-600 [2662] by aborting tx and using _allow_resetlog_corruption
while open resetlogs. check database SCN before!
-- this breaks tx
cancel
Media recovery cancelled.
SVRMGR> alter database open resetlogs;
alter database open resetlogs
*
ORA-00600: internal error code, arguments:
[2662], [0], [392928], [0], [392931], [0], [], []
because we know current SCN before (392943) we see, that current SCN has
decreased
so we have exactly reached the current SCN from before 'shutdown abort'
So current SCN was bumpt up from 392928 to 392942.
As such, the contents are not necessarily accurate and care should be
taken when dealing with customers who have encountered this error.
</Internal_Only>
Note: For additional ORA-600 related information please read Note 146580.1
</metalink/plsql/showdoc?db=NOT&id=146580.1>
PURPOSE:
This article discusses the internal error "ORA-600 [2662]", what
it means and possible actions. The information here is only applicable
to the versions listed and is provided only for guidance.
ERROR:
ORA-600 [2662] [a] [b] [c] [d] [e]
VERSIONS:
versions 6.0 to 10.1
DESCRIPTION:
The ORA-600 [2662] occurs when an SCN is compared to the dependent SCN
stored in a UGA variable.
If the SCN is less than the dependent SCN then we signal the ORA-600 [2662]
internal error.
ARGUMENTS:
Arg [a] Current SCN WRAP
Arg [b] Current SCN BASE
Arg [c] dependent SCN WRAP
Arg [d] dependent SCN BASE
Arg [e] Where present this is the DBA where the dependent SCN came from.
FUNCTIONALITY:
File and IO buffer management for redo logs
IMPACT:
INSTANCE FAILURE
POSSIBLE PHYSICAL CORRUPTION
SUGGESTIONS:
If not using Parallel Server, check that 2 instances have not mounted
the same database.
Check for SMON traces and have the alert.log and trace files ready
to send to support.
If the SCNs in the error are very close, then try to shutdown and startup
the instance several times.
In some situations, the SCN increment during startup may permit the
database to open. Keep track of the number of times you attempted a
startup.
If the Known Issues section below does not help in terms of identifying
a solution, please submit the trace files and alert.log to Oracle
Support Services for further analysis.
Known Issues:
Bug# 2899477 See Note 2899477.8 </metalink/plsql/showdoc?db=NOT&id=2899477.8>
Minimise risk of a false OERI[2662]
Fixed: 9.2.0.5, 10.1.0.2
<Internal_Only>
Type I
~~~~~~
a. Current SCN WRAP
b. Current SCN BASE
c. dependent SCN WRAP
d. dependent SCN BASE
e. Where present this is the DBA where the dependent SCN came from.
From kcrf.h:
If the SCN comes from the recent or current SCN then a dba
of zero is saved. If it comes from undo$ because the undo segment is
not available then the undo segment number is saved, which looks like
a block from file 0. If the SCN is for a media recovery redo (i.e.
block number == 0 in change vector), then the dba is for block 0
of the relevant datafile. If it is from another database for a
distributed transaction then dba is DBAINF(). If it comes from a TX
lock then the dba is really usn<<16+slot.
Type II
~~~~~~~
a. checksum -> log block checksum - zero if none (thread # in old format)
---------------------------------------------------------------------------
Diagnosis:
~~~~~~~~~~
In addition to different basic types from above, there are different
situations where ORA-600 [2662] type I can be raised.
Getting started:
~~~~~~~~~~~~~~~~
(1) is the error raised during normal database operations (i.e. when the
database is up) or during startup of the database?
(2) what is the SCN difference [d]-[b] ( subtract argument 'b' from arg 'd')?
(3) is there a fifth argument [e] ?
If so convert the dba to file# block#
Is it a data dictionary object? (file#=1)
If so find out object name with the help of reference dictionary
from second database
(4) What is the current SQL statement? (see trace)
Which table is refered to?
Does the table match the object you found in previous step?
Deeper analysis:
~~~~~~~~~~~~~~~~
(1) investigate trace file:
this will be a user trace file normally but could be an smon trace too
(2) search for: 'buffer'
("buffer dba" in Oracle7 dumps, "buffer tsn" in Oracle8/Oracle9 dumps)
this will bring you to a blockdump which usually represents the
'real' source of OERI:2662
WARNING: There may be more than one buffer pinned to the process
so ensure you check out all pinned buffers.
If Parallel Server check both nodes are using the same lock manager
instance & point at the same control files.
Possible causes:
Solutions:
(1) if the SCNs in the error are very close, attempting a startup several
times will bump up the dscn every time we open the database even if
open fails. The database will open when dscn=scn.
(2)You can bump the SCN either on open or while the database is open
using <Event:ADJUST_SCN> (see Note 30681.1
</metalink/plsql/showdoc?db=NOT&id=30681.1>).
Be aware that you should rebuild the database if you use this
option.
Once this has occurred you would normally want to rebuild the
database via exp/rebuild/imp as there is no guarantee that some
other blocks are not ahead of time.
Articles:
~~~~~~~~~
Solutions:
Note 30681.1 </metalink/plsql/showdoc?db=NOT&id=30681.1> Details of the
ADJUST_SCN Event
Note 1070079.6 </metalink/plsql/showdoc?db=NOT&id=1070079.6> Alter System
Checkpoint
Possible Causes:
Note 1021243.6 </metalink/plsql/showdoc?db=NOT&id=1021243.6> CHECK INIT.ORA
SETTING _DISABLE_LOGGING
Note 41399.1 </metalink/plsql/showdoc?db=NOT&id=41399.1> Forcing the database
open with `_ALLOW_RESETLOGS_CORRUPTION`
Note 851959.9 </metalink/plsql/showdoc?db=NOT&id=851959.9> OERI:2662 DURING
CREATE SNAPSHOT AT MASTER SITE
Known Bugs:
~~~~~~~~~~~
---------------------------------------------------------------------------
Ensure that this note comes out on top in Metalink when searched
ora-600 ora-600 ora-600 ora-600 ora-600 ora-600 ora-600
ora-600 ora-600 ora-600 ora-600 ora-600 ora-600 ora-600
2662 2662 2662 2662 2662 2662 2662 2662 2662
2662 2662 2662 2662 2662 2662 2662 2662 2662
</Internal_Only
19.47: _allow_read_only_corruption
==================================
If you have a media failure and for some reason (such as having lost an archived
log file) you cannot perform
a complete recovery on some datafiles, then you might need this parameter. It is
new for 8i. Previously there
was only _allow_resetlogs_corruption which allowed you to do a RESETLOGS open of
the database
in such situations. Of course, a database forced open in this way would be in a
crazy state
because the current SCN would reflect the extent of the incomplete recovery, but
some datafiles
would have blocks in the future, which would lead to lots of nasty ORA-00600
errors
(although there is an ADJUST_SCN event that could be used for relief). Once in
this position,
the only thing to do would be to do a full database export, rebuild the database,
import and then assess the damage.
19.48: _allow_resetlogs_corruption
==================================
log problem:
_allow_resetlogs_corruption = true
alter session set events '10015 trace name adjust_scn level 1';
alter session set events '10015 trace name adjust_scn level 4096';
You can try with recover database until cancel and then open iz with resetlogs
option.
Using event 10015 you are forcing a SCN jump that will eventually syncronize the
SCN values from your
datafiles and controlfiles.
The level controls how much the SCN will be incremented with. In the case of a
9.0.1 I had, it worked
only with 4096, however it may be that even a level of 1 to 3 would make the SCN
jump 1 million.
So you have to dump those headers and compare the SCNs inside before and after the
event 10015.
I was succeful too in opening a db after loosing controlfile and online redo logs
,
however Oracle support made it pretty clear that the only usage for the database
afterwards is to do a
full export and recreate it from that. It would be better if Oracle support walks
you through this procedure.
Note 1:
=======
Problem:
ORA-1161, database name <name> in file header does not match given name
You are certain that the file is good and that it belongs to that database.
Solution:
Check the file's properties in Windows Explorer and verify that it is not
a "Hidden" file.
Explanation:
If you have set the "Show All Files' option under Explorer, View, Options,
you are able to see 'hidden' files that other users and/or applications
cannot. If any or all datafiles are marked as 'hidden' files, Oracle does
not see them when it tries to recreate the controlfile.
You must change the properties of the file by right-clicking on the file
in Windows Explorer and then deselecting the check box marked "Hidden" under
the General tab. You should then be able to create the controlfile.
References:
Note 2:
=======
This message may result, if the db_name in the init.ora does not match with the
set "db_name" given
while creating the controlfile.
Thanks,
Note 3:
=======
We ran into a similar problem when trying to create a new instance with datafiles
from another database.
The error comes in the create control file statement. Oracle uses REUSE as the
default option when you do the
alter database backup controlfile to trace. If you delete REUSE then the new
database name you will change
all the header information in all the database datafiles and you will be able to
start up the instance.
Hope this helps.
Note 4:
=======
Note 1:
-------
The 'OSDBA' and 'OSOPER' groups are chosen at installation time and usually
both default to the group 'dba'. These groups are compiled into the 'oracle'
executable and so are the same for
all databases running from a given ORACLE_HOME directory. The actual groups being
used for OSDBA and OSOPER
can be checked thus:
cd $ORACLE_HOME/rdbms/lib
cat config.[cs]
The line '#define SS_DBA_GRP "group"' should name the chosen OSDBA group.
The line '#define SS_OPER_GRP "group"' should name the chosen OSOPER group.
Note 2:
-------
a) SQLNET.ORA Checks:
---------------------
1. The "sqlnet.ora" can be found in the following locations (listed by search
order):
$TNS_ADMIN/sqlnet.ora
$HOME/sqlnet.ora
$ORACLE_HOME/network/admin/sqlnet.ora
/var/opt/oracle/sqlnet.ora
/etc/sqlnet.ora
A corrupted "sqlnet.ora" file, or one with security options set, will cause
a 'connect internal' request to prompt for a password.
To determine if this is the problem, locate the "sqlnet.ora" that is being
used.
The one being used will be the first one found according to the search order
listed above.
Next, move the file so that it will not be found by this search:
% mv sqlnet.ora sqlnet.ora_save
% mv sqlnet.ora_save sqlnet.ora
If moving the "sqlnet.ora" resolves the issue, then verify the contents of the
file:
a) SQLNET.AUTHENTICATION_SERVICES
If you are not using database links, comment this line out or try setting it
to:
SQLNET.AUTHENTICATION_SERVICES = (BEQ,NONE)
b) SQLNET.CRYPTO_SEED
c) AUTOMATIC_IPC
AUTOMATIC_IPC = OFF
$ cd $TNS_ADMIN
$ chmod 644 sqlnet.ora tnsnames.ora listener.ora
$ ls -l sqlnet.ora tnsnames.ora listener.ora
% cd $ORACLE_HOME
% pwd
sh or ksh:
----------
$ ORACLE_HOME=<path_to_ORACLE_HOME>
$ export ORACLE_HOME
Example:
$ ORACLE_HOME=/u01/app/oracle/product/7.3.3
$ export ORACLE_HOME
csh:
----
% setenv ORACLE_HOME <path_to_ORACLE_HOME>
Example:
% setenv ORACLE_HOME /u01/app/oracle/product/7.3.3
If your "ORACLE_HOME" contains a link or the instance was started with the
"ORACLE_HOME" set to another value, the instance may try to start using the
memory location that another instance is using.
An example of this might be:
% ln -s /u01/app/oracle/product/7.3.3 /u01/app/oracle/7.3.3
% setenv ORACLE_HOME /u01/app/oracle/7.3.3
% svrmgrl
If this prompts for a password then most likely the combination of your
"ORACLE_HOME" and "ORACLE_SID" hash to the same shared memory address of
another running instance. Otherwise you may be able to connect internal
but you will receive an ORA-01034 "Oracle not available" error.
% echo $ORACLE_SID
csh:
----
setenv |grep -i two
TWO_TASK=
- or -
TWO_TASK=PROD
sh or ksh:
----------
unset TWO_TASK
csh:
----
unsetenv TWO_TASK
Example :
$ TWO_TASK=V817
$ export TWO_TASK
$ sqlplus /nolog
$ unset TWO_TASK
$ sqlplus /nolog
SQL> conn / as sysdba
Connected.
If you are running Oracle release 8.0.4, and upon starting "svrmgrl" you
receive an ORA-06401 "NETCMN: invalid driver designator" error, you should
also unset two_task.
The login connect string may be getting its value from the TWO_TASK
environment variable if this is set for the user.
4. Check the permissions on the Oracle executable:
% cd $ORACLE_HOME/bin
% ls -l oracle ('ls -n oracle' should work as well)
a. Make sure the operating system user issuing the CONNECT INTERNAL belongs
to the "osdba" group as defined in the "$ORACLE_HOME/rdbms/lib/config.s"
or "$ORACLE_HOME/rdbms/lib/config.c". Typically this is set to "dba".
To verify the operating system groups the user belongs to, do the following:
% id
uid=1030(oracle) gid=1030(dba)
If these do not match, you either need to add the operating system user
to the group as it is seen in the "config" file, or modify the "config"
file and relink the "oracle" binary.
b. Be sure you are not logged in as the "root" user and that the environment
variables "USER", "USERNAME", and "LOGNAME" are not set to "root".
The "root" user is a special case and cannot connect to Oracle as the
"internal" user unless the effective group is changed to the "osdba" group,
which is typically "dba".
To do this, either modify the "/etc/password" file (not recommended) or
use the "newgrp" command:
# newgrp dba
"newgrp" always opens a new shell, so you cannot issue "newgrp" from
within a shell script.
Keep this in mind if you plan on executing scripts as the "root" user.
c. Verify that the "osdba" group is only listed once in the "/etc/group" file:
If more than one line starting with the "osdba" group is returned, you
need to remove the ones that are not correct.
It is not possible to have more than one group use a group name.
d. Check that the oracle user uid and gid are matching with /etc/passwd and
/etc/group :
$ id
uid=500(oracle) gid=235(dba)
% mount
/u07 on /dev/md/dsk/d7 nosuid/read/write
If the filesytem is mounted "nosuid", as seen in this example, you will need
to unmount the filesystem and mount it without the "nosuid" option.
Consult your operating system documentation or your operating system vendor
for instruction on modifying mount options.
7. Please read the following warning before you attempt to use the information
in this step:
******************************************************************
* *
* WARNING: If you remove segments that belong to a running *
* instance you will crash the instance, and this may *
* cause database corruption. *
* *
* Please call Oracle Support Services for assistance *
* if you have any doubts about removing shared memory *
* segments. *
* *
******************************************************************
If an instance crashed or was killed off using "kill" there may be shared
memory segments hanging around that belong to the down instance.
If there are no other instances running on the machine you can issue:
% ipcs -b
In this case the "ID" of "1601" is owned by "oracle" and if there are no
other instances running in most cases this can safely be removed:
% ipcrm -m 1601
If your SGA is split into multiple segments you will have to remove all
segments associated with the instance. If there are other instances
running, and you are not sure which memory segments belong to the failed
instance, you can do the following:
a. Shut down all the instances on the machine and remove whatever shared
memory still exists that is owned by the software owner.
b. Reboot the machine.
c. If your Oracle software is release 7.3.3 or newer, you can connect into
each instance that is up and identify the shared memory owned by that
instance:
% svrmgrl
SVRMGR> connect internal
SVRMGR> oradebug ipc
In Oracle8:
-----------
Area #0 `Fixed Size', containing Subareas 0-0
Total size 000000000000b8c0, Minimum Subarea size 00000000
Subarea Shmid Size Stable Addr
0 7205 000000000000c000 80000000
In Oracle7:
-----------
Note the "Shmid" for Oracle8 and "Seg Id" for Oracle7 for each running
instance.
By process of elimination find the segments that do not belong to an
instance and remove them.
8. If you are prompted for a password and then receive error ORA-09925 "unable
to create audit trail file" or error ORA-09817 "write to audit file failed",
along with "SVR4 Error: 28: No space left on device", do the following:
% touch afile
If it could not create the called "afile", you need to change the permissions
on your audit directory:
% chmod 751
9. If connect internal prompts you for a password and then you receive an
ORA-12705 "invalid or unknown NLS parameter value specified" error, you
need to verify the settings for "ORA_NLS", "ORA_NLS32", "ORA_NLS33" or
"NLS_LANG".
You will need to consult your Installation and Configuration Guide for the
proper settings for these environment variables.
10. If you have installed Oracle software and are trying to connect with
Server Manager to create or start the database, and receive a TNS-12571
"packet writer failure" error, please refer to Note:1064635.6
11. If in SVRMGRL (Server Manager line mode), you are running the "startup.sql"
script and receive the following error:
You need to ensure that "ORACLE_HOME" and "LD_LIBRARY_PATH" are set correctly.
$ LD_LIBRARY_PATH=$ORACLE_HOME/lib
$ export LD_LIBRARY_PATH
$ ORACLE_HOME=/u01/app/oracle/product/8.0.4
$ export ORACLE_HOME
12. Ensure that the disk the instance resides on has not reached 100% capacity.
% df -k
If it has reached 100% capacity, this may be the cause of 'connect internal'
prompting for a password.
Additional disk space will need to be made available before 'connect internal'
will work.
14. When you get ora-1031 "Insufficient privileges" on connect internal after you
supply a valid password and you have multiple instances running from the same
ORACLE_HOME, be sure that if an instance has REMOTE_LOGIN_PASSWORDFILE set to
exclusive that the file $ORACLE_HOME/dbs/orapw<sid> does exist, otherwise it
defaults to the use of the file orapw that consequently causes access problems
for any other database that has the parameter set to shared.
Set the parameter REMOTE_LOGIN_PASSWORDFILE to shared for all instances that
share
the common password file and create an exclusive orapw<sid> password files for
any
instances that have this set to exclusive.
ERROR:
ORA-01031: insufficient privileges
level:
3. On Windows NT, if you are able to connect internally but then startup fails
for some reason, successive connect internal attempts might prompt for a
password. You may also receive errors such as:
4. If you are using Multi-Threaded Server (MTS), make sure you are using a
dedicated
server connection.
A dedicated server connection is required to start up or shutdown the database.
This can also cause connect internal problems. See entry Note:1066589.6
6. You are on Digital Unix, running SVRMGRL (Server Manager line mode), and you
receive an ORA-12547 "TNS:lost contact" error and a password prompt.
This problem occurs when using Parallel Server and the True Cluster software
together.
If Parallel Server is not linked in, svrmgrl works as expected.
Oracle V8.0.5 requires an Operating System patch which previous versions of
Oracle did not require.
The above patch allows svrmgrl to communicate with the TCR software.
Another possibility is that you need to raise the value of kernel parameter
per-proc-stack-size
when increased from its default value of 2097152 to 83886080 resolved this
problem.
7. You are on version 6.2 of the Silicon Graphics UNIX (IRIX) operating system
and you have recently installed RDBMS release 8.0.3.
If you are logged on as "oracle/dba" and an attempt to log in to Server Manager
using "connect/internal" prompts you for a password, you should refer to entry
Note:1040607.6
8. On AIX 4.3.3 after applying ML5 or higher you can not longer connect as
internal
or if on 9.X '/ as sysdba' does not work as well.
This is a known AIX bug and it occurs on all RS6000 ports including SP2.
There is two workarounds and one solution. They are as follows:
# mkpasswd -v -d
# touch /etc/passwd
d) Additional Information:
--------------------------
1. In the "Oracle7 Administrator's Reference for UNIX", there is a note that
states:
If REMOTE_OS_AUTHENT is set to true, users who are members of the dba group
on the remote machine are able to connect as INTERNAL without a password.
However, if you are connecting remotely, that is connecting via anything
except the bequeath adapter, you will be prompted for a password regardless
of the value of "REMOTE_OS_AUTHENT".
Refer to bug 644988
References:
~~~~~~~~~~~
[NOTE:1048876.6] UNIX: Connect internal prompts for password after install
[NOTE:1064635.6] ORA-12571: PACKET WRITER FAILURE WHEN STARTING SVRMGR
[NOTE:1010852.6] OPENVMS: ORA-01031: WHEN ISSUING "CONNECT INTERNAL" IN SQL*DBA
OR SERVER MANAGER
[NOTE:1027964.6] LCC-00161 AND ORA-01031 ON STARTUP
[NOTE:1058680.6] ORA-00106 or ORA-01031 ERROR when trying to STARTUP or SHUTDOWN
DATABASE
[NOTE:1066589.6] UNIX: Connect Internal asks for password when TWO_TASK is set
[NOTE:1040607.6] SGI: ORA-01012 ORA-01031: WHEN USING SRVMGR AFTER 8.0.3 INSTALL
[NOTE:97849.1] Connect internal Requires Password
[NOTE:50507.1] SYSDBA and SYSOPER Privileges in Oracle8 and Oracle7
[NOTE:18089.1] UNIX: Connect INTERNAL / AS SYSBDA Privilege on Oracle 7/8
[BUG:644988] REMOTE_OS_AUTHENT=TRUE: NOT ALLOWING USERS TO CONNECT INTERNAL
WITHOUT PASSWORD
Search Words:
~~~~~~~~~~~~~
svrmgrm sqldba sqlplus sqlnet
remote_login_passwordfile
Note 3:
-------
Note 4:
-------
Note 5:
-------
I am not sure it is the same, but I got this error today in windows when
sql_authentication in sqlnet.ora was NONE.
Changing it to NTS solved the problem.
Note 1:
-------
PURPOSE:
This article discusses the internal error "ORA-600 [17059]", what
it means and possible actions. The information here is only applicable
to the versions listed and is provided only for guidance.
ERROR:
ORA-600 [17059] [a]
VERSIONS:
versions 7.1 to 10.1
DESCRIPTION:
ARGUMENTS:
Arg [a] Object containing the table
FUNCTIONALITY:
Kernel Generic Library cache manager
IMPACT:
PROCESS FAILURE
NON CORRUPTIVE - No underlying data corruption.
SUGGESTIONS:
One symptom of this error is that the session will appear to hang for a
period of time prior to this error being reported.
If the Known Issues section below does not help in terms of identifying
a solution, please submit the trace files and alert.log to Oracle
Support Services for further analysis.
Issuing this SQL as SYS (SYSDBA) may help show any problem
objects in the dictionary:
select do.obj#,
po.obj# ,
p_timestamp,
po.stime ,
decode(sign(po.stime-p_timestamp),0,'SAME','*DIFFER*') X
from sys.obj$ do, sys.dependency$ d, sys.obj$ po
where P_OBJ#=po.obj#(+)
and D_OBJ#=do.obj#
and do.status=1 /*dependent is valid*/
and po.status=1 /*parent is valid*/
and po.stime!=p_timestamp /*parent timestamp not match*/
order by 2,1
;
Normally the above select would return no rows. If any rows are
returned the listed dependent objects may need recompiling.
Known Issues:
Fixed: 9.2.0.2
Note 2:
-------
fact:
fact: Oracle Server - Enterprise Edition
symptom: ORA-00600: internal error code, arguments: [%s], [%s], [%s], [%s],
[%s], [%s], [%s]
fix:
This is fixed in 9.0.1.4, 9.2.0.2 & 10i. One-off patches are available
for 8.1.7.4. A workaround is to flush the shared pool.
Note 3:
-------
Internal Error ORA-600 [17059] when querying Data dictionary views like
dba_tablespaces,
dba_indexes, dba_ind_partitions etc
Symptom(s)
~~~~~~~~~~
While querying Data dictionary views like dba_tablespaces,
dba_indexes, dba_ind_partitions etc, getting internal error ORA-600 [17059]
Change(s)
~~~~~~~~~~
You probably altered some objects or executed some cat*.sql scripts.
Cause
~~~~~~~
Some SYS objects are INVALID.
Fix
~~~~
Connect SYS
run $ORACLE_HOME/rdbms/admin/utlrp.sql and make sure all the objects are valid.
Note 1:
-------
Errors
ORA 600 "internal error code, arguments: [%s],[%s],[%s], [%s], [%s],
Symptoms
The following error occurs when compiling a form or library ( fmb / pll ) against
RDBMS 9.2
Triggers / local program units in the form / library contain calls to stored
database procedures and / or functions.
The error does not occur when compiling against RDBMS 9.0.1 or lower.
Cause
This is a known bug / issue. The compilation error occurs when the form contains a
call to a stored database
function / procedure which has two DATE IN variables receiving DEFAULT values such
as SYSDATE.
Reference:
<Bug:2713384> Abstract: INTERNAL ERROR [1401] WHEN COMPILE FUNCTION WITH 2
DEFAULT DATE VARIABLES ON 9.2
Fix
The bug is fixed in Oracle Forms 10g (9.0.4). There is no backport fix available
for
Forms 9i (9.0.2)
Note 2:
-------
PURPOSE:
This article discusses the internal error "ORA-600 [17003]", what
it means and possible actions. The information here is only applicable
to the versions listed and is provided only for guidance.
ERROR:
ORA-600 [17003] [a] [b] [c]
VERSIONS:
versions 7.0 to 10.1
DESCRIPTION:
The error indicates that we have tried to lock a library cache object by
using the dependency number to identify the target object and have found
that no such dependency exists.
ARGUMENTS:
Arg [a] Library Cache Object Handle
Arg [b] Dependency number
Arg [c] 1 or 2 (indicates where the error was raised internally)
FUNCTIONALITY:
Kernel Generic Library cache manager
IMPACT:
PROCESS MEMORY FAILURE
NO UNDERLYING DATA CORRUPTION.
SUGGESTIONS:
If a patchset has recently been applied, please confirm that there were
no errors associated with this upgrade.
Specifically, there are some XDB related bugs which can lead to this error
being reported.
Known Issues:
Bug# 2611590 See [NOTE:2611590.8]
<ml2_documents.showDocument?p_id=2611590.8&p_database_id=NOT>
OERI:[17003] running XDBRELOD.SQL
Fixed: 9.2.0.3, 10.1.0.2
Bug# 3073414
XDB may not work after applying a 9.2 patch set
Fixed: 9.2.0.5
19.53: ORA-00600: internal error code, arguments: [qmxiUnpPacked2], [121], [], [],
[], [], [], []
==================================================================================
===============
Note 1.
-------
ERROR:
ORA-600 [qmxiUnpPacked2] [a]
VERSIONS:
versions 9.2 to 10.1
DESCRIPTION:
Generally due to XMLType data that has not been successfully upgraded from
a previous version.
ARGUMENTS:
Arg [a] Type of XOB
FUNCTIONALITY:
Qernel xMl support Xob to/from Image
IMPACT:
PROCESS FAILURE
NON CORRUPTIVE - No underlying data corruption.
SUGGESTIONS:
If you still encounter the error having tried the suggestions in the
above article, or the article isn't applicible to your environment then
ensure that the upgrade to current version was completed succesfully
without error.
If the Known Issues section below does not help in terms of identifying
a solution, please submit the trace files and alert.log to Oracle
Support Services for further analysis.
Known Issues:
Bug# 2607128 See [NOTE:2607128.8]
OERI:[qmxiUnpPacked2] if CATPATCH.SQL/XDBPATCH.SQL fails
Fixed: 9.2.0.3
Bug# 2734234
CONSOLIDATION BUG FOR ORA-600 [QMXIUNPPACKED2] DURING CATPATCH.SQL 9.2.0.2
Note 2.
-------
Doc ID: Note:235423.1 Content Type: TEXT/X-HTML
Subject: How to resolve ORA-600 [qmxiUnpPacked2] during upgrade Creation
Date: 14-APR-2003
Type: HOWTO Last Revision Date: 18-MAR-2005
Status: PUBLISHED
Oracle 9.2.0.2
Multiple Platforms, 64-bit
Symptom(s)
~~~~~~~~~~
ORA-600 [qmxiUnpPacked2] []
Cause
~~~~~
Fix
~~~~
Option 1
========
If your shared_pool_size and java_pool_size are less than 150Mb the do the
following :-
startup migrate;
5/ spool catpatch
@?/rdbms/admin/catpatch.sql
Option 2
========
3/ Edit the xdbpatch.sql script and add the following as the first line in
the script:-
startup migrate;
4/ spool catpatch
@?/rdbms/admin/catpatch.sql
Option 3
========
If XDB is NOT in use and there are NO registered XML Schemas an alternative
is to drop, and maybe re-install XDB :-
@?/rdbms/admin/catnoqm.sql
startup migrate;
@?/rdbms/admin/catpatch.sql
If the error is seen during normal database operation, ensure that upgrade
to current version was completed succesfully without error. Once this is
confirmed attempt to reproduce the error, if successful forward ALERT.LOG,
trace files and full error stack to Oracle Support Services for further
analysis.
References
~~~~~~~~~~~
19.54 ORA-00600: internal error code, arguments: [kcbget_37], [1], [], [], [], [],
[], []
==================================================================================
=======
ORA-00600: internal error code, arguments: [kcbso1_1], [], [], [], [], [], [], []
ORA-00600: internal error code, arguments: [kcbget_37], [1], [], [], [], [], [],
[]
Affects:
Product (Component) Oracle Server (RDBMS)
Range of versions believed to be affected Versions < 10G
Versions confirmed as being affected 8.1.7.4
9.2.0.2
Fixed:
This issue is fixed in 9.2.0.3 (Server Patch Set)
Symptoms:
Memory Corruption
Internal Error may occur (ORA-600)
ORA-600 [1100] / ORA-600 [kcbget_37]
Affects:
Product (Component) PL/SQL (Plsql)
Range of versions believed to be affected Versions < 10.2
Versions confirmed as being affected 10.1.0.3
Fixed:
This issue is fixed in 9.2.0.7 (Server Patch Set)
10.1.0.4 (Server Patch Set)
10g Release 2 (future version)
Description
Truncate table in exception handler can cause OERI:kcbzwb_4
with the fix for bug 3768052 installed.
Workaround:
Turn off or deinstall the fix for bug 3768052.
Note that the procedure containing the affected transactional commands
will have to be recompiled after backing out the bug fix.
Affects:
Product (Component) PL/SQL (Plsql)
Range of versions believed to be affected Versions < 10.2
Versions confirmed as being affected 10.1.0.3
Fixed:
This issue is fixed in 9.2.0.7 (Server Patch Set)
10.1.0.4 (Server Patch Set)
10g Release 2 (future version)
Description
Truncate table in exception handler can cause OERI:kcbzwb_4
with the fix for bug 3768052 installed.
Workaround:
Turn off or deinstall the fix for bug 3768052.
Note that the procedure containing the affected transactional commands
will have to be recompiled after backing out the bug fix.
19.56 ORA-00600: internal error code, arguments: [kcbgtcr_6], [], [], [], [], [],
[], []
==================================================================================
======
<Internal_Only>
This note contains information that has not yet been reviewed by DDR.
As such, the contents are not necessarily accurate and care should be
taken when dealing with customers who have encountered this error.
Thanks. PAA Internals Group
</Internal_Only>
Note: For additional ORA-600 related information please read Note 146580.1
PURPOSE:
This article discusses the internal error "ORA-600 [kcbgtcr_6]", what
it means and possible actions. The information here is only applicable
to the versions listed and is provided only for guidance.
ERROR:
ORA-600 [kcbgtcr_6] [a]
VERSIONS:
versions 8.0 to 10.1
DESCRIPTION:
Two buffers have been found in the buffer cache that are both current
and for the same DBA (Data Block Address).
We should not have two 'current' buffers for the same DBA in the cache,
if this is the case then this error is raised.
ARGUMENTS:
Arg [a] Buffer class
Note that for Oracle release 9.2 and earlier there are no additional
arguments reported with this error.
FUNCTIONALITY:
Kernel Cache Buffer management
IMPACT:
PROCESS FAILURE
POSSIBLE INSTANCE FAILURE
NON CORRUPTIVE - No underlying data corruption.
SUGGESTIONS:
If using 64bit AIX then ensure that minimum version in use is 9.2.0.3
or patch for Bug 2652771 has been applied.
If the Known Issues section below does not help in terms of identifying
a solution, please submit the trace files and alert.log to Oracle
Support Services for further analysis.
Known Issues:
Bug 2652771 Shared data structures corrupted around latch code on 64bit
AIX ports.
Fixed 9.2.0.3
backports available for older versions (8.1.7) from Metalink.
<Internal_Only>
ORA-600 [kcbgtcr_6]
Versions: 8.0.5 - 10.1 Source: kcb.c
Meaning:
Argument Description:
None
---------------------------------------------------------------------------
Explanation:
We have identified two 'CURRENT' buffers for the same DBA in the cache,
this is incorrect, and this error will be raised.
---------------------------------------------------------------------------
Diagnosis:
Check the trace file, this will show the buffers i.e :-
Here it is clear that we have two current buffers for the dba.
If this isn't the case check the error reproduces consistently after
bouncing the instance?
---------------------------------------------------------------------------
Known Bugs:
Bug 2652771 Shared data structures corrupted around latch code on 64bit
AIX ports.
- Fixed 9.2.0.3, backports available for older versions.
Note: For additional ORA-600 related information please read Note 146580.1
PURPOSE:
This article discusses the internal error "ORA-600 [1100]", what
it means and possible actions. The information here is only applicable
to the versions listed and is provided only for guidance.
ERROR:
ORA-600 [1100] [a] [b] [c] [d] [e]
VERSIONS:
versions 6.0 to 9.2
DESCRIPTION:
FUNCTIONALITY:
GENERIC LINKED LISTS
IMPACT:
PROCESS FAILURE
POSSIBLE INSTANCE FAILURE IF DETECTED BY PMON PROCESS
No underlying data corruption.
SUGGESTIONS:
Known Issues:
<Internal_Only>
Ensure that this note comes out on top in Metalink when searched
ora-600 ora-600 ora-600 ora-600 ora-600 ora-600 ora-600
ora-600 ora-600 ora-600 ora-600 ora-600 ora-600 ora-600
1100 1100 1100 1100 1100 1100 1100 1100 1100 1100
1100 1100 1100 1100 1100 1100 1100 1100 1100 1100
</Internal_Only>
Note 2:
-------
Fixed:
This issue is fixed in 9.2.0.6 (Server Patch Set)
10.1.0.4 (Server Patch Set)
10g Release 2 (future version)
Description
When an instance is under high load it is possible for sessions to get
ORA-600[KGLHDUNP2_2] and ORA-600 [1100] errors. This can also show
as a corrupt linked list in the SGA.
The full bug text (if published) can be seen at <Bug:3724548> (This link will not
work for UNPUBLISHED bugs)
You can search for any interim patches for this bug here <Patch:3724548> (This
link will Error if no interim patches exist)
.
gcc: unrecognized option `-q64'
ld: 0711-736 ERROR: Input file /lib/crt0_64.o:
XCOFF64 object files are not allowed in 32-bit mode.
collect2: ld returned 8 exit status
make: 1254-004 The error code from the last command is 1.
Stop.
After some digging I found out that this is because the machine is AIX 5.2
running under 32-bit and it is looking at the oracle's lib directory which
has 64 bit libraries. So after running "perl Makefile.PL", I edited the
Makefile
1. changing the references to Oracle's ../lib to ../lib32,
2. changing change crt0_64.o to crt0_r.o.
3. Remove the -q32 and/or -q64 options from the list of libraries to link
with.
Now when I ran "make" it went smoothly, so did make test and make install.
I ran my own simple perl testfile which connects to the Oracle and gets
some info and it works fine.
Now I have an application which can be customised to call perl scripts and
when I call this test script from that application it fails with:
whats happening here is that the application sets its own LIBPATH to
include oracle's lib(instead of lib32) in the beginning and that makes
perl look at the wrong place for the file - libclntsh.a .Unfortunately it
will take too long for the application developers to change this in their
application and I am looking for a quick solution. The test script is
something like:
use Env;
use strict;
use lib qw( /opt/harvest/common/perl/lib ) ;
#use lib qw( $ORACLE_HOME/lib32 ) ;
use DBI;
my $connect_string="dbi:Oracle:";
my $datasource="d1ach2";
$ENV{'LIBPATH'} = "${ORACLE_HOME}/lib32:$ENV{'LIBPATH'}" ;
.
.
my $dbh = DBI->connect($connect_string, $dbuser, $dbpwd)
or die "Can't connect to $datasource: $DBI::errstr";
.
.
I have a work around for it: write a wrapper ksh script which exports the
LIBPATH and then calls the perl script which works fine but I was
wondering if there is a way to set the libpath or do something else inside
the current perl script so that it knows where to look for the right
library files inspite of the wrong LIBPATH?
Or did I miss something when I changed the Makefile and did not install
everything right? Is there anyway I check this? (the make install didnot
throw any errors)
Thanks!
Rachana.
note 12:
--------
19.59 Listener problem: IBM/AIX RISC System/6000 Error: 13: Permission denied
-----------------------------------------------------------------------------
Note 1:
..
..
The problem really was in permissions of /etc/hosts on the node2. It was -rw-
r----- (640).
Now it is -rw-rw-r-- (664) and everything goes ok.
Thank you!
d0planon@zb121l01:/data/oracle/d0planon/admin/home/$ lsnrctl
LSNRCTL> status
Connecting to (ADDRESS=(PROTOCOL=tcp)(HOST=)(PORT=1521))
TNS-12541: TNS:no listener
TNS-12560: TNS:protocol adapter error
TNS-00511: No listener
IBM/AIX RISC System/6000 Error: 79: Connection refused
Answer 1:
Answer 2:
Maybe there are multiple instances of the listener, so if you try the following
19.61: 64BIT PRO*COBOL IS NOT THERE EVNN AFTER UPGRDING TO 9.2.0.3 ON AIX-5L BOX
--------------------------------------------------------------------------------
Problem statement:
64BIT PRO*COBOL IS NOT THERE EVNN AFTER UPGRDING TO 9.2.0.3 ON AIX-5L BOX
*** 03/19/03 10:13 am ***
2889686.996
.
=========================
PROBLEM:
.
1. Clear description of the problem encountered:
.
cst. has upgraded from 9.2.0.2 to 9.2.0.3 on a AIX 5L 64-Bit Box and is not
seeing the 64-bit Procob executable. Actually the same problem existed when
upgraded from 9.2.0.1 to 9.2.0.2, but the one-off patch has been provided in
the Bug#2440385 to resolve the issue. As per the Bug, problem has been fixed
in 9.2.0.3. But My Cst. is facing the same problem on 9.2.0.3 also.
.
This is what the Cst. says
============================
This is the original bug # 2440385. The fix provides 64 bit versions of
Pro*Cobol.There are two versions of the patch for the bug: one is for the
9.2.0.1 RDBMS and the other is for 9.2.0.2. So the last time I hit this
issue, I applied the 9.2.0.2 RDBMS patch to the 9.2.0.1 install. The 9.2.0.2
patch also experienced the relinking problem on rtsora just like the 9.2.0.1
install did. I ignored the error to complete the patch application. Then I
used the patch for the 2440385 bug to get 64 bit procob/rtsora executables
(the patch actually provides executables rather than performing a successful
relinking) to get the Pro*Cobol 1.8.77 precompiler to work with the
MicroFocus Server Express 2.0.11 (64 bit) without encountering "bad magic
number" error.
.
The current install that I am performing I've downloaded the Oracle 9.2.0.3
Pro*Cobol capability fix either so the rtsora relinking fails as well. Thus I
don't have a working Pro*Cobol precompiler to allow me to generate our Cobol
programs against the database.
.
2. Pertinent configuration information (MTS/OPS/distributed/etc)
.
3. Indication of the frequency and predictability of the problem
.
4. Sequence of events leading to the problem
.
5. Technical impact on the customer. Include persistent after effects.
.
=========================
DIAGNOSTIC ANALYSIS:
.
One-off patch should be provided on top of 9.2.0.3 as provided on top of
9.2.0.2/9.2.0.1
.
=========================
WORKAROUND:
.
.
=========================
RELATED BUGS:
.
2440385
.
=========================
REPRODUCIBILITY:
.
1. State if the problem is reproducible; indicate where and predictability
.
2. List the versions in which the problem has reproduced
.
9.2.0.3
.
3. List any versions in which the problem has not reproduced
Note 1:
=======
9201,9202,9203,9204,9205
32 bit cobol: procob32 or procob18_32.
64 bit cobol: procob or procob18
PATCHES:
2440385 Pro*COBOL: PATCH FOR SUPPORTING 64BIT PRO*COBOL 9.2.0.2 26-NOV-2002 17M
2440385 Pro*COBOL: PATCH FOR SUPPORTING 64BIT PRO*COBOL 9.2.0.1 01-OCT-2002 17M
Also includes 2440385. Provide the patch for supporting 64-bit Pro*COBOL.
Note 2:
=======
Hi, we recently upgraded to 9i. However, we still have 32 bit Cobol, so we're
using the procob18_32 precompiler
to compile our programs. Some of my compiles have worked successfully. However,
I'm receiving the follow error
in one of my compiles:
What's strange is that if I compile the program against the same DB using procob
instead of procob18_32,
it compiles cleanly. I noticed in my compile that failed using procob18_32, it had
the following message:
..
..
Hi, I started using procob32 instead of procob18_32, and that resolved my problem.
Thanks for any help you may have already started to provide.
Note 3:
=======
PROCOB=procob32
Using $ORACLE_HOME/precomp/demo/procob/demo_procob_32.mk:
PROCOB_32=procob32
Using $ORACLE_HOME/precomp/demo/procob/demo_procob18_32.mk
PROCOB18_32=procob18_32
Note 4:
=======
A workaround consists to assign host table variables into oracle table variables
and replace inside SQL command host table
variables by oracle table variables.
But, as we've got a lot a program like this, we don't enjoy to do this.
Have somebody another idea ?
Hi
From the details provided , it seems you are hitting the same.
Best Regards
Amit Joshi
Note 5:
=======
Re: Server Express 64bit and Oracle 9i problem (114) on AIX 5.2
Hi Wayne (and Panos)
The 64-bit edition of Oracle 9i on AIX 5.x creates rtsora -- the 64-bit
version of the run-time -- and rtsora32 -- the 32-bit version of the
run-time.
It's imperative that you use the correct edition of Server Express, i.e.
32-bit or 64-bit -- note well, that these are separate products on this
platform -- for the mode in which you wish to use Oracle. In addition, you
need to ensure that LIBPATH is set to point to the correct Oracle 'lib'
directory -- $ORACLE_HOME/lib32 for 32-bit, or $ORACLE_HOME/lib for 64-bit
If you wish to recreate those executables, say if you've updated your COBOL
environment since installing Oracle, then from looking at the makefiles --
ins_precomp.mk and env_precomp.mk -- then the effective commands to use to
re-link the run-time correctly are as follows (logged in under your Oracle
user ID) :
either mode:
<set up COBDIR, ORACLE_HOME, ORACLE_BASE, ORACLE_SID as appropriate for your
installation>
export PATH=$COBDIR/bin:$ORACLE_HOME/bin:$PATH
32-bit :
export LIBPATH=$COBDIR/lib:$ORACLE_HOME/lib32:$LIBPATH
cd $ORACLE_HOME/precomp/lib
make LIBDIR=lib32 -f ins_precomp.mk EXE=rtsora32 rtsora32
64-bit:
export LIBPATH=$COBDIR/lib:$ORACLE_HOME/lib:$LIBPATH
cd $ORACLE_HOME/precomp/lib
make -f ins_precomp.mk rtsora
or
64-bit : procob / procob18 , e.g.
procob myapp.pco
cob -it myapp.cob
rtsora myapp.int
If you're using Server Express 2.2 SP1 or later, you can also compile using
the Cobsql preprocessor, which will invoke the correct version of Pro*COBOL
under the covers, allowing for a single precompile-compile step, e.g.
cob -ik myapp.pco -C "p(cobsql) csqlt==oracle8 endp"
This method also aids debugging, as you will see the original source code
while animating, rather than the output from the precompiler. See the Server
Express Database Access manual. Prior to SX 2.2 SP1, Cobsql only supported
the creation of 32-bit applications.
I hope this helps -- if you're still having problems, please let me know.
Regards,
SimonT.
Re: Re: Server Express 64bit and Oracle 9i problem (114) on AIX 5.2
Hi Simon (and anyone else)
Thanks for that. We still seem to be getting a very unusual error with our c
ompiles in or makes.
When we attempt to compile our COBOL it works fine. However if the COBOL has
embedded Oracle SQL our procomp makes try to access ADA. We do not use ADA.
I thought this must have been included by accident; but can find no flag or
install option for it. So can you give us any clues as to why we are suffer
ing an ADA plague :-))
Wayne
Re: Server Express 64bit and Oracle 9i problem (114) on AIX 5.2
Hi Wayne.
If you invoke 'procob' from the command line, you should see something along
the lines of :
If you're either not seeing the correct Pro*COBOL banner, or it's not
located in the correct directory, I'd suggest rebuilding the procob and
procob32 binaries. Logged in under your Oracle user ID, with the Oracle
environment set up :
cd $ORACLE_HOME/precomp/lib
make -f ins_precomp.mk procob32 procob
and then try your compilation process again.
Regards,
SimonT.
Re: Re: Server Express 64bit and Oracle 9i problem (114) on AIX 5.2
Hi Simon
It appears this (build keyword) is not a requirement for the job to run on S
olaris but is for AIX.
Cheers
Wayne
Note 6:
=======
Note 7:
=======
I have the following error while relinking "rtsora" on AIX 5L/64bit platform on
oracle 9.2.0.3
(I believe my patch is up-to-date). Our Micro Focus compiler version is 2.0.11
Stop.
make: 1254-004 The error code from the last command is 2.
Cathy,
Support for 64 bit Pro*Cobol 9.2.0.3 on AIX 5.1 was provided through one off patch
for bug 2440385
You will need to download and apply the patch for bug 2440385.
==OR==
You can dowload and apply the latest 9.2.0.4 patchset where the bug is fixed.
Thanks,
Amit Chitnis.
Note 8:
=======
symptom: /oracle/product/9.2.0/precomp/lib32/cobsqlintf.o
fix:
Reference:
Note 9:
=======
If you wish to recreate those executables, say if you've updated your COBOL
environment since installing Oracle, then from looking at the makefiles --
ins_precomp.mk and env_precomp.mk -- then the effective commands to use to
re-link the run-time correctly are as follows (logged in under your Oracle
user ID) :
either mode:
<set up COBDIR, ORACLE_HOME, ORACLE_BASE, ORACLE_SID as appropriate for your
installation>
export PATH=$COBDIR/bin:$ORACLE_HOME/bin:$PATH
32-bit :
export LIBPATH=$COBDIR/lib:$ORACLE_HOME/lib32:$LIBPATH
cd $ORACLE_HOME/precomp/lib
make LIBDIR=lib32 -f ins_precomp.mk EXE=rtsora32 rtsora32
64-bit:
export LIBPATH=$COBDIR/lib:$ORACLE_HOME/lib:$LIBPATH
cd $ORACLE_HOME/precomp/lib
make -f ins_precomp.mk rtsora
Note 10:
========
On 9.2.0.5, try to get the pro cobol patch for 9203. Then just copy the procobol
files
to the cobol directory.
19.62: ORA-12170:
=================
Connection Timeout.
***
This article is being delivered in Draft form and may contain
errors. Please use the MetaLink "Feedback" button to advise
Oracle of any issues related to this article.
***
PURPOSE
-------
To specify the time, in seconds, for a client to connect with the database server
and provide the necessary authentication information.
Without this parameter, a client connection to the database server can stay open
indefinitely without authentication. Connections without authentication can
introduce possible denial-of-service attacks, whereby malicious clients attempt to
flood database servers with
connect requests that consume resources.
Example
SQLNET.INBOUND_CONNECT_TIMEOUT=3
RELATED DOCUMENTS
-----------------
Oracle9i Net Services Reference Guide, Release 2 (9.2), Part Number A96581-02
SQLNET.EXPIRE_TIME:
-------------------
Purpose:
Determines time interval to send a probe to verify the session is alive
Default:
None
Minimum Value:
0 minutes
Recommended Value:
10 minutes
Example:
sqlnet.expire_time=10
sqlnet.expire_time
Enables dead connection detection, that is, after the specifed time (in minutes)
the server checks
if the client is still connected.
If not, the server process exits. This parameter must be set on the server
PROBLEM:
Long query (20 minutes) returns ORA-01013 after about a minute.
SOLUTION:
The SQLNET.ORA parameter SQLNET.EXPIRE_TIME was set to a one(1).
The parameter was changed to...
SQLNET.EXPIRE_TIME=2147483647
This allowed the query to complete.
This is documented in the Oracle Troubleshooting manual on page 324.
The manual part number is A54757.01.
Keywords:
SQLNET.EXPIRE_TIME,SQLNET.ORA,ORA-01013
sqlnet.expire_time should be set on the server. The server sends keep alive
traffic over connections
that have already been established. You won't need to change your firewall.
The architecture to do that means that the server will send a probe packet to the
client. That probe packet
is viewed by the most firewalls as traffic on the line. That will in short reset
the idle timers on the firewall.
If you happen to have the disconnects from idle timers then it may help.
It was not intended for that feature but it is a byproduct of the design.
Note 1:
-------
TITLE
-----
SQL*Net, Net8, Oracle Net Services - Tracing and Logging at a Glance.
PURPOSE
-------
Oracle Net Services is the replacement name for the Oracle Networking product
formerly known as SQL*Net (Oracle7 [v2.x]) and Net8 (Oracle8/8i [v8.0/8.1]).
For consistency, the term Oracle Net is used thoughout this article and refers
to all Oracle Net product versions.
The aim of this document is to overview SQL*Net, Net8, Oracle Net Services
tracing and logging facilities. The intended audience includes novice Oracle
users and DBAs alike. Although only basic information on how to enable and
disable tracing and logging features is described, the document also serves
as a quick reference. The document provides the reader with the minimum
information necessary to generate trace and log files with a view to
forwarding them to Oracle Support Services (OSS) for further diagnosis. The
article does not intend to describe trace/log file contents or explain how to
interpret them.
TRACE_LEVEL_[CLIENT|SERVER|LISTENER] = [0-16|USER|ADMIN|SUPPORT|OFF]
TRACE_FILE_[CLIENT|SERVER|LISTENER] = <FILE NAME>
TRACE_DIRECTORY_[CLIENT|SERVER|LISTENER] = <DIRECTORY>
TRACE_UNIQUE_[CLIENT|SERVER|LISTENER] = [ON|TRUE|OFF|FALSE]
TRACE_TIMESTAMP_[CLIENT|SERVER|LISTENER] = [ON|TRUE|OFF|FALSE] #Oracle8i+
TRACE_FILELEN_[CLIENT|SERVER|LISTENER] = <SIZE in KB> #Oracle8i+
TRACE_FILENO_[CLIENT|SERVER|LISTENER] = <NUMBER> #Oracle8i+
TNSPING.TRACE_LEVEL = [0-16|USER|ADMIN|SUPPORT|OFF]
TNSPING.TRACE_DIRECTORY = <DIRECTORY>
NAMES.TRACE_LEVEL = [0-16|USER|ADMIN|SUPPORT|OFF]
NAMES.TRACE_FILE = <FILE NAME>
NAMES.TRACE_DIRECTORY = <DIRECTORY>
NAMES.TRACE_UNIQUE = [ON|OFF]
NAMES.LOG_FILE = <FILE NAME>
NAMES.LOG_DIRECTORY = <DIRECTORY>
NAMES.LOG_UNIQUE = [ON|OFF]
NAMESCTL.TRACE_LEVEL = [0-16|USER|ADMIN|SUPPORT|OFF]
NAMESCTL.TRACE_FILE = <FILE NAME>
NAMESCTL.TRACE_DIRECTORY = <DIRECTORY>
NAMESCTL.TRACE_UNIQUE = [ON|OFF]
Note: With the exception of parameters suffixed with LISTENER, all other
parameter suffixes and prefixes [CLIENT|NAMES|NAMESCTL|SERVER|TNSPING]
are fixed and cannot be changed. For parameters suffixed with LISTENER,
the suffix name should be the actual Listener name. For example, if
the Listener name is PROD_LSNR, an example trace parameter name would
be TRACE_LEVEL_PROD_LSNR=OFF.
CONFIGURATION FILES
-------------------
Files required to enable Oracle Net tracing and logging features include:
2. Oracle Net tracing and logging can consume vast quantities of disk space.
Monitor for sufficient disk space when tracing is enabled.
On some Unix operating systems, /tmp is used for swap space.
Although generally writable by all users, this is not an ideal location for
trace/log file generation.
3. Oracle Net tracing should only be enabled for the duration of the issue at
hand. Oracle Net tracing should always be disabled after problem resolution.
4. Large trace/log files place an overhead on the processes that generate them.
In the absence of issues, the disabling of tracing and/or logging will
improve Oracle Net overall efficiency.
Alternatively, regularly truncating log files will also improve efficiency.
5. Ensure that the target trace/log directory is writable by the connecting
user, Oracle software owner and/or user that starts the Net Listener.
This section provides a detailed description of each trace and log parameter.
TRACE LEVELS
TRACE_LEVEL_[CLIENT|SERVER|LISTENER] = [0-16|USER|ADMIN|SUPPORT|OFF]
Determines the degree to which Oracle Net tracing is provided.
Configuration file is SQLNET.ORA, LISTENER.ORA.
Level 0 is disabled - level 16 is the most verbose tracing level.
Listener tracing requires the Net Listener to be reloaded or restarted
after adding trace parameters to LISTENER.ORA.
Oracle Net (client/server) tracing takes immediate effect after tracing
parameters are added to SQLNET.ORA.
By default, the trace level is OFF.
TRACE DIRECTORY
TRACE_DIRECTORY_[CLIENT|SERVER|LISTENER] = <DIRECTORY>
Determines the directory in which trace files are written.
Any valid operating system directory name.
Configuration file is SQLNET.ORA, LISTENER.ORA.
Directory should be writable by the connecting user and/or Oracle software
owner.
Default trace directory is $ORACLE_HOME/network/trace.
TRACE_UNIQUE_[CLIENT|SERVER|LISTENER] = [ON|TRUE|OFF|FALSE]
Allows generation of unique trace files per connection.
Trace file names are automatically appended with '_<PID>.TRC'.
Configuration file is SQLNET.ORA, LISTENER.ORA.
Unique tracing is ideal for sporadic issues/errors that occur infrequently
or randomly.
Default value is OFF
TRACE TIMING
TRACE_TIMESTAMP_[CLIENT|SERVER|LISTENER] = [ON|TRUE|OFF|FALSE]
A timestamp in the form of [DD-MON-YY 24HH:MI;SS] is recorded against each
operation traced by the trace file.
Configuration file is SQLNET.ORA, LISTENER.ORA
Suitable for hanging or slow connection issues.
Available from Oracle8i onwards.
Default value is is OFF.
TRACE_FILELEN_[CLIENT|SERVER|LISTENER] = <SIZE>
Determines the maximum trace file size in Kilobytes (Kb).
Configuration file is SQLNET.ORA, LISTENER.ORA.
Available from Oracle8i onwards.
Default value is UNLIMITED.
TRACE_FILENO_[CLIENT|SERVER|LISTENER] = <NUMBER>
Determines the maximum number of trace files through which to perform
cyclic tracing.
Configuration file is SQLNET.ORA, LISTENER.ORA.
Suitable when disk space is limited or when tracing is required to be
enabled for long periods.
Available from Oracle8i onwards.
Default value is 1 (file).
LOG DIRECTORY
DISABLING LOGGING
LOGGING_LISTENER = [ON|OFF]
Disables Listener logging facility.
Configuration file is LISTENER.ORA.
Default value is ON.
SERVER (SQLNET.ORA)
trace_level_server = 16
trace_file_server = svr
trace_directory_server = /u01/app/oracle/product/9.0.1/network/trace
trace_unique_server = on
trace_timestamp_server = on
trace_filelen_server = 100
trace_fileno_server = 2
log_file_server = svr
log_directory_server = /u01/app/oracle/product/9.0.1/network/log
namesctl.trace_level = 16
namesctl.trace_file = namesctl
namesctl.trace_directory = /u01/app/oracle/product/9.0.1/network/trace
namesctl.trace_unique = on
LISTENER (LISTENER.ORA)
trace_level_listener = 16
trace_file_listener = listener
trace_directory_listener = /u01/app/oracle/product/9.0.1/network/trace
trace_timestamp_listener = on
trace_filelen_listener = 100
trace_fileno_listener = 2
logging_listener = off
log_directory_listener = /u01/app/oracle/product/9.0.1/network/log
log_file_listener=listener
names.trace_level = 16
names.trace_file = names
names.trace_directory = /u01/app/oracle/product/9.0.1/network/trace
names.trace_unique = off
tracing = yes
RELATED DOCUMENTS
-----------------
Note 16658.1 (7) Tracing SQL*Net/Net8
Note 111916.1 SQLNET.ORA Logging and Tracing Parameters
Note 39774.1 Log & Trace Facilities on Net v2
Note 73988.1 How to Get Cyclic SQL*Net Trace Files when Disk Space is Limited
Note 1011114.6 SQL*Net V2 Tracing
Note 1030488.6 Net8 Tracing
Note 2:
-------
This article describes the log and trace facilities that can be used to
examine application connections that use SQL*Net. This article is based on
usage of SQL*NET v2.3. It explains how to invoke the trace facility and how
to use the log and trace information to diagnose and resolve operating problems.
Following topics are covered below:
________________________________________
All errors encountered in SQL*Net are logged to a log file for evaluation by a
network or database administrator. The log file provides additional information
for an administrator when the error on the screen is inadequate to understand
the failure. The log file, by way of the error stack, shows the state of the
TNS software at various layers. The properties of the log file are:
o Error information is appended to the log file when an error occurs.
o The Names server may have logging turned on or off. If on, a Names
server's operational events are written to a specified logfile. You set
logging parameters using the Oracle Network Manager.
________________________________________
Attention: The trace facility uses a large amount of disk space and may have
a significant impact upon system performance. Therefore, you are
cautioned to turn the trace facility ON only as part of a diagnostic
procedure and to turn it OFF promptly when it is no longer necessary.
o Network listener
o SQL*Net version 2 components
- SQL*Net client
- SQL*Net server
o MultiProtocol Interchange components
- the Connection Manager and pumps
- the Navigator
o Oracle Names
- Names server
- Names Control Utility
The trace facility can be used to identify the following types of problems:
- Difficulties in establishing connections
- Abnormal termination of established connections
- Fatal errors occurring during the operation of TNS network
components
________________________________________
While logging provides the state of the TNS components at the time of an
error, tracing provides a description of all software events as they occur,
and therefore provides additional information about events prior to an
error. There are three levels of diagnostics, each providing more
information than the previous level. The three levels are:
1. The reported error from Oracle7 or tools; this is the single error that
is commonly returned to the user.
2. The log file containing the state of TNS at the time of the error. This
can often uncover low level errors in interaction with the underlying
protocols.
3. The trace file containing English statements describing what the TNS
software has done from the time the trace session was initiated until the
failure is recreated.
When an error occurs, a simple error message is displayed and a log file is
generated. Optionally, a trace file can be generated for more information.
(Remember, however, that using the trace facility has an impact on your
system performance.)
In the following example, the user failed to use Oracle Network Manager to
create a configuration file, and misspelled the word "PORT" as "POT" in the
connect descriptor. It is not important that you understand in detail the
contents of each of these results; this example is intended only to provide
a comparison.
****************************************************************
Fatal OSN connect error 12533, connecting to:
(DESCRIPTION=(CONNECT_DATA=(SID=trace)(CID=(PROGRAM=)(HOST=lala)
(USER=ginger)))(ADDRESS_LIST=(ADDRESS=(PROTOCOL=ipc)
(KEY=bad_port))(ADDRESS=(PROTOCOL=tcp)(HOST=lala)(POT=1521))))
VERSION INFORMATION:
TNS for SunOS: Version 2.0.14.0.0 - Developer's Release
Oracle Bequeath NT Protocol Adapter for SunOS: Version
2.0.14.0.0 - Developer's Release
Unix Domain Socket IPC NT Protocol Adaptor for SunOS: Version
2.0.14.0.0 - Developer's Release
TCP/IP NT Protocol Adapter for SunOS: Version 2.0.14.0.0 -
Developer's Release
Time: 07-MAY-93 17:38:50
Tracing to file: /home/ginger/trace_admin.trc
Tns error struct:
nr err code: 12206
TNS-12206: TNS:received a TNS error while doing navigation
ns main err code: 12533
TNS-12533: TNS:illegal ADDRESS parameters
ns secondary err code: 12560
nt main err code: 503
TNS-00503: Illegal ADDRESS parameters
nt secondary err code: 0
nt OS err code: 0
Calling address:
(DESCRIPTION=(CONNECT_DATA=(SID=trace)(CID=(PROGRAM=)(HOST=lala)(USER=ging
er)))
(ADDRESS_LIST=(ADDRESS=(PROTOCOL=ipc)(KEY=bad_port))(ADDRESS=(PROTOCOL=tcp
)(HOST
Getting local community information
Looking for local addresses setup by nrigla
No addresses in the preferred address list
TNSNAV.ORA is not present. No local communities entry.
Getting local address information
Address list being processed...
No community information so all addresses are "local"
Resolving address to use to call destination or next hop
Processing address list...
No community entries so iterate over address list
This a local community access
Got routable address information
Making call with following address information:
(DESCRIPTION=(EMPTY=0)(ADDRESS=(PROTOCOL=ipc)(KEY=bad_port)))
Calling with outgoing connect data
(DESCRIPTION=(CONNECT_DATA=(SID=trace)(CID=(PROGRAM=)(HOST=lala)(USER=ging
er)))
(ADDRESS_LIST=(ADDRESS=(PROTOCOL=tcp)(HOST=lala)(POT=1521))))
(DESCRIPTION=(EMPTY=0)(ADDRESS=(PROTOCOL=ipc)(KEY=bad_port)))
KEY = bad_port
connecting...
opening transport...
-<ERROR>- sd=8, op=1, resnt[0]=511, resnt[1]=2, resnt[2]=0
-<ERROR>- unable to open transport
-<ERROR>- nsres: id=0, op=1, ns=12541, ns2=12560; nt[0]=511, nt[1]=2,
nt[2]=0
connect attempt failed
Call failed...
Call made to destination
Processing address list so continuing
Getting local community information
Looking for local addresses setup by nrigla
No addresses in the preferred address list
TNSNAV.ORA is not present. No local communities entry.
Getting local address information
Address list being processed...
No community information so all addresses are "local"
Resolving address to use to call destination or next hop
Processing address list...
No community entries so iterate over address list
This a local community access
Got routable address information
Making call with following address information:
(DESCRIPTION=(EMPTY=0)(ADDRESS=(PROTOCOL=tcp)(HOST=lala)(POT=1521)))
Calling with outgoing connect data
(DESCRIPTION=(CONNECT_DATA=(SID=trace)(CID=(PROGRAM=)(HOST=lala)(USER=ging
er)))
(ADDRESS_LIST=(ADDRESS=(PROTOCOL=tcp)(HOST=lala)(POT=521))))
(DESCRIPTION=(EMPTY=0)(ADDRESS=(PROTOCOL=tcp)(HOST=lala)(POT=1521)))
In the trace file, note that unexpected events are preceded with an
-<ERROR>- stamp. These events may represent serious errors, minor errors, or
merely unexpected results from an internal operation. More serious and
probably fatal errors are stamped with the -<FATAL?>- prefix.
In this example trace file, you can see that the root problem, the
misspelling of "PORT," is indicated by the trace line: -<FATAL?>- failed to
recognize: POT
Log files produced by different components have unique names. The default
file names are:
You can control the name of the log file. For each component, any valid
string can be used to create a log file name. The parameters are of the
form:
LOG_FILE_component = string
For example:
LOG_FILE_LISTENER = TEST
Some platforms have restrictions on the properties of a file name. See your
Oracle operating system specific manuals for platform specific restrictions.
_____________________________________
1. Browse the log file for the most recent error that matches the error
number you have received from the application. This is almost always the
last entry in the log file. Notice that an entry or error stack in the log
file is usually many lines in length. In the example earlier in this
chapter, the error number was 12207.
2. Starting at the bottom, look up to the first non-zero entry in the error
report. This is usually the actual cause. In the example earlier in this
chapter, the last non-zero entry is the "ns" error 12560.
3. Look up the first non-zero entry in later chapters of this book for its
recommended cause and action. (For example, you would find the "ns" error
12560 under ORA-12560.) To understand the notation used in the error report,
see the previous chapter, "Interpreting Error Messages."
4. If that error does not provide the desired information, move up the error
stack to the second to last error and so on.
5. If the cause of the error is still not clear, turn on tracing and
re-execute the statement that produced the error message. The use of the
trace facility is described in detail later in this chapter. Be sure to turn
tracing off after you have re-executed the command.
________________________________________
The steps used to invoke tracing are outlined here. Each step is fully
described in subsequent sections.
o Client
o Server
o Listener
o Connection Manager and pump (cmanager)
o Navigator (navigator)
o Names server
o Names Control Utility
2. Save existing trace file if you need to retain information on it. By default
most trace files will overwrite an existing ones. TRACE_UNIQUE parameter needs
to be included in appropriate config. files if unique trace files are required.
This appends Process Id to each file.
For Example:
For Names server tracing, NAMES.TRACE_UNIQUE=ON needs to be set in NAMES.
ORA file. For Names Control Utility, NAMESCTL.TRACING_UNIQUE=TRUE needs
to be in SQLNET.ORA. TRACE_UNIQUE_CLIENT=ON in SQLNET.ORA for Client
Tracing.
3. For any component, you can invoke the trace facility by editing the
component configuration file that corresponds to the component traced. The
component config. files are SQLNET.ORA, LISTENER.ORA, INTCHG.ORA, and NAMES.
ORA.
CLIENT: Set the trace parameters in the client-side SQLNET.ORA and invoke
a client application, such as SQL*Plus, a Pro*C application, or
any application that uses the Oracle network products.
SERVER: Set the trace parameters in the server-side SQLNET.ORA. The next
process started by the listener will have tracing enabled. The
trace parameters must be created or edited manually.
CONNECTION MANAGER:
Set the trace parameters in INTCHG.ORA and start the Connection
Manager from the Interchange Control Utility or command line. The
pumps are started automatically with the Connection Manager, and
their trace files are controlled by the trace parameters for the
Connection Manager.
NAMES SERVER:
Trace parameters needs to be set in NAMES.ORA and start the Names
server.
5. Be sure to turn tracing off when you do not need it for a specific
diagnostic purpose.
________________________________________
The trace parameters are defined in the same configuration files as the log
parameters. Table below shows the configuration files for different network
components and the default names of the trace files they generate.
--------------------------------------------------------
| Trace Parameters | Configuration | |
| Corresponding to | File | Output Files |
|-------------------|-----------------|------------------|
| | | |
| Client | SQLNET.ORA | SQLNET.TRC |
| Server | | SQLNET.TRC |
| TNSPING Utility | | TNSPING.TRC |
| Names Control | | |
| Utility | | NAMESCTL.TRC |
|-------------------|-----------------|------------------|
| Listener | LISTENER.ORA | LISTENER.TRC |
|-------------------|-----------------|------------------|
| Interchange | INTCHG.ORA | |
| Connection | | |
| Manager | | CMG.TRC |
| Pumps | | PMP.TRC |
| Navigator | | NAV.TRC |
|-------------------|-----------------|------------------|
| Names server | NAMES.ORA | NAMES.TRC |
|___________________|_________________|__________________|
The configuration files for each component are located on the computer
running that component.
________________________________________
------------------------------------------------------------------------------
| | | |
| PARAMETERS | VALUES | Example (DOS client, UNIX server) |
| | | |
|------------------------|----------------|------------------------------------|
|Parameters for Client |
|===================== |
|------------------------------------------------------------------------------|
| | | |
| TRACE_LEVEL_CLIENT | OFF/USER/ADMIN | TRACE_LEVEL_CLIENT=USER |
| | | |
| TRACE_FILE_CLIENT | string | TRACE_FILE_CLIENT=CLIENT |
| | | |
| TRACE_DIRECTORY_CLIENT | valid directory| TRACE_DIRECTORY_CLIENT=c:\NET\ADMIN|
| | | |
| TRACE_UNIQUE_CLIENT | OFF/ON | TRACE_UNIQUE_CLIENT=ON |
| | | |
| LOG_FILE_CLIENT | string | LOG_FILE_CLIENT=CLIENT |
| | | |
| LOG_DIRECTORY_CLIENT | valid directory| LOG_DIRECTORY_CLIENT=c:\NET\ADMIN |
|------------------------------------------------------------------------------|
|Parameters for Server |
|===================== |
|------------------------------------------------------------------------------|
| | | |
| TRACE_LEVEL_SERVER | OFF/USER/ADMIN | TRACE_LEVEL_SERVER=ADMIN |
| | | |
| TRACE_FILE_SERVER | string | TRACE_FILE_SERVER=unixsrv_2345.trc |
| | | |
| TRACE_DIRECTORY_SERVER | valid directory| TRACE_DIRECTORY_SERVER=/tmp/trace |
| | | |
| LOG_FILE_SERVER | string | LOG_FILE_SERVER=unixsrv.log |
| | | |
| LOG_DIRECTORY_SERVER | valid directory| LOG_DIRECTORY_SERVER=/tmp/trace |
|------------------------------------------------------------------------------|
---(SQLNET.ORA Cont.)---------------------------------------------------------
| | | |
| PARAMETERS | VALUES | Example (DOS client, UNIX server) |
| | | |
|------------------------|----------------|------------------------------------|
|
|Parameters for TNSPING |
|====================== |
|------------------------------------------------------------------------------|
| | | |
| TNSPING.TRACE_LEVEL | OFF/USER/ADMIN | TNSPING.TRACE_LEVEL=user |
| | | |
| TNSPING.TRACE_DIRECTORY| directory |TNSPING.TRACE_DIRECTORY= |
| | | /oracle7/network/trace |
| | | |
|------------------------------------------------------------------------------|
|Parameters for Names Control Utility |
|==================================== |
|------------------------------------------------------------------------------|
| | | |
| NAMESCTL.TRACE_LEVEL | OFF/USER/ADMIN |NAMESCTL.TRACE_LEVEL=user |
| | | |
| NAMESCTL.TRACE_FILE | file |NAMESCTL.TRACE_FILE=nc_south.trc |
| | | |
| NAMESCTL.TRACE_DIRECTORY| directory |NAMESCTL.TRACE_DIRECTORY=/o7/net/trace|
| | | |
| NAMESCTL.TRACE_UNIQUE | TRUE/FALSE |NAMESCTL.TRACE_UNIQUE=TRUE or ON/OFF|
| | | |
------------------------------------------------------------------------------
Note: You control log and trace parameters for the client through Oracle
Network Manager. You control log and trace parameters for the server by
manually adding the desired parameters to the SQLNET.ORA file.
Parameters for Names Control Utility & TNSPING Utility need to be added
manually to SQLNET.ORA file. You cannot create them using Oracle Network
Manager.
________________________________________
The following table shows the valid LISTENER.ORA parameters used in logging
and tracing of the listener.
------------------------------------------------------------------------------
| | | |
| PARAMETERS | VALUES | Example (DOS client, UNIX server) |
| | | |
|------------------------|----------------|------------------------------------|
| | | |
|TRACE_LEVEL_LISTENER | USER | TRACE_LEVEL_LISTENER=OFF |
| | | |
|TRACE_FILE_LISTENER | string | TRACE_FILE_LISTENER=LISTENER |
| | | |
|TRACE_DIRECTORY_LISTENER| valid directory| TRACE_DIRECTORY_LISTENER=$ORA_SQLNETV2
|
| | | |
------------------------------------------------------------------------------
________________________________________
The following table shows the valid INTCHG.ORA parameters used in logging
and tracing of the Interchange.
---------------------------------------------------------------------------------
-
| | |
|
| PARAMETERS | VALUES | Example (DOS client, UNIX server)
|
| | (default)|
|
|------------------------|--------------------|-----------------------------------
-|
| | |
|
|TRACE_LEVEL_CMANAGER | OFF|USER|ADMIN | TRACE_LEVEL_CMANAGER=USER
|
| | |
|
|TRACE_FILE_CMANAGER | string (CMG.TRC) | TRACE_FILE_CMANAGER=CMANAGER
|
| | |
|
|TRACE_DIRECTORY_CMANAGER| valid directory | TRACE_DIRECTORY_CMANAGER=C:\ADMIN
|
| | |
|
|LOG_FILE_CMANAGER | string (INTCHG.LOG)| LOG_FILE_CMANAGER=CMANAGER
|
| | |
|
|LOG_DIRECTORY_CMANAGER | valid directory | LOG_DIRECTORY_CMANAGER=C:\ADMIN
|
| | |
|
|LOGGING_CMANAGER | OFF/ON | LOGGING_CMANAGER=ON
|
| | |
|
|LOG_INTERVAL_CMANAGER | Any no of minutes | LOG_INTERVAL_CMANAGER=60
|
| | (60 minutes)|
|
|TRACE_LEVEL_NAVIGATOR | OFF/USER/ADMIN | TRACE_LEVEL_NAVIGATOR=ADMIN
|
| | |
|
|TRACE_FILE_NAVIGATOR | string (NAV.TRC)| TRACE_FILE_NAVIGATOR=NAVIGATOR
|
| | |
|
|TRACE_DIRECTORY_NAVIGATOR| valid directory | TRACE_DIRECTORY_NAVIGATOR=C:\ADMIN
|
| | |
|
|LOG_FILE_NAVIGATOR |string (NAVGATR.LOG)| LOG_FILE_NAVIGATOR=NAVIGATOR
|
| | |
|
|LOG_DIRECTORY_NAVIGATOR | valid directory | LOG_DIRECTORY_NAVIGATOR=C:\ADMIN
|
| | |
|
|LOGGING_NAVIGATOR | OFF/ON | LOGGING_NAVIGATOR=OFF
|
| | |
|
|LOG_LEVEL_NAVIGATOR | ERRORS|ALL (ERRORS)| LOG_LEVEL_NAVIGATOR=ERRORS
|
| | |
|
---------------------------------------------------------------------------------
-
Note: The pump component shares the trace parameters of the Connection
Manager, but it generates a separate trace file with the unchangeable
default name PMPpid.TRC.
________________________________________
The following table shows the valid NAMES.ORA parameters used in logging and
tracing of the Names server.
------------------------------------------------------------------------------
| | | |
| PARAMETERS | VALUES | Example (DOS client, UNIX server) |
| | (default)| |
|------------------------|----------------|------------------------------------|
| | | |
| NAMES.TRACE_LEVEL | OFF/USER/ADMIN | NAMES.TRACE_LEVEL=ADMIN |
| | | |
| NAMES.TRACE_FILE | file(names.trc)| NAMES.TRACE_FILE=nsrv3.trc |
| | | |
| NAMES.TRACE_DIRECTORY | directory | NAMES.TRACE_DIRECTORY=/o7/net/trace|
| | | |
| NAMES.TRACE_UNIQUE | TRUE/FALSE | NAMES.TRACE_UNIQUE=TRUE or ON/OFF |
| | | |
| NAMES.LOG_FILE | file(names.log)| NAMES.LOG_FILE=nsrv1.log |
| | | |
| NAMES.LOG_DIRECTORY | directory | NAMES.LOG_DIRECTORY= /o7/net/log |
| | | |
------------------------------------------------------------------------------
________________________________________
TRACE_LEVEL_CLIENT = ADMIN
The following trace file is the result of a connection attempt that failed
because the hostname is invalid.
The trace output is a combination of debugging aids for Oracle specialists
and English information for network administrators. Several key events can
be seen by analyzing this output from beginning to end:
If you look up Error 12545 in Chapter 3 of this Manual, you will find the
following description:
Calling address:
(DESCRIPTION=(CONNECT_DATA=(SID=trace)(CID=(PROGRAM=)(HOST=lala)
(USER=ginger)))(ADDRESS_LIST=(ADDRESS=(PROTOCOL=ipc
(KEY=bad_host))(ADDRESS=(PROTOCOL=tcp)(HOST=lavender)
(PORT=1521))))
Getting local community information
Looking for local addresses setup by nrigla
No addresses in the preferred address list
TNSNAV.ORA is not present. No local communities entry.
Getting local address information
Address list being processed...
No community information so all addresses are "local"
Resolving address to use to call destination or next hop
Processing address list...
No community entries so iterate over address list
This a local community access
Got routable address information
Note 1:
Note 2:
There are two or more transactions sharing the rollback segment at the time of the
shrink.
What happens is that the first process gets to the end of an extent, notices the
need to shrink
and begins the recursive transaction to do so. But the next transaction blunders
past the end
of that extent before the recursive transaction has been committed.
The preferred solution is to have sufficient rollback segments to eliminate the
sharing of
rollback segments between processes. Look in V$RESOURCE_LIMIT for the high-water-
mark of transactions.
That is the number of rollback segments you need. The alternative solution is to
raise OPTIMAL
to reduce the risk of the error.
Note 3:
This error is harmless. You can try (and probably should) set optimal to null
and
maxextents to unlimited (which might minimize the frequency of these errors).
These errors happen sometimes when oracle is shrinking the rollback segments
upto the optimal
size. The undo data for shrinking is also kept in the rollback segments. So
when it attempts to
shrink the same rollback segment where its trying to write the undo, it throws
this warning.
Its not a failure per se .. since oracle will retry and succeed.
Note 1:
-------
If there are other products installed through the OUI, create a copy of =
the
oraInst.loc file (depending on the UNIX system,
possibly in /etc or /var/opt/oracle).
This will retain the existing oraInventory directory and create a new =
one for use by the new product.
19.67: ORA-06502: PL/SQL: numeric or value error: character string buffer too
small
==================================================================================
=
Note 1:
Hi,
BEGIN
SELECT my_first_column,
my_second_column
INTO p_1,
p_2
FROM my_table
WHERE user_id = a_user;
END;
/
The procedure is larger than this, but using error_position variables I have
tracked it down
to one SQL statement. But I don't understand why I'm getting the ORA-06502,
because the variables I am selecting
into are defined as the same types as the columns I'm selecting. The variable I
am selecting into is in fact
a VARCHAR2(4), but if I replace the sql statement with p_1 := 'AB'; it still
fails.
It succeeds if I do p_1 := 'A';
Has anyone seen this before or anything similar that they might be able to help me
with please?
Thanks,
mtae.
-- Answer 1:
It is the code from which you are calling it that has the problem, e.g.
DECLARE
v1 varchar2(1);
v2 varchar2(1);
BEGIN
my_proc ('USER',v1,v2);
END;
/
-- Answer 2
try this:
SELECT my_first_column,
my_second_column
INTO v_1,
v_2
FROM my_table
WHERE user_id = a_user;
p_1 := v_1;
p_2 := v_2;
END;
/
thread:
see this error every time I shutdown a 10gR3 grid control database on 10.2.0.3
RDBMS, even though all opmn and OMS
processes are down. So far, I have not seen any problems, apart from the annoying
shutdown warning.
Cause
This is due to unpublished Bug 4483084 'ORA-600 [LIBRARYCACHENOTEMPTYONCLOSE]'
This is a bug in that an ORA-600 error is reported when it is found that something
is still going
on during shutdown. It does not indicate any damage or a problem in the system.
Solution
At the time of writing, it is likely that the fix will be to report a more
meaningful external error, although this
has not been finalised.
The error can be safely ignored as it does not indicate a problem with the
database.
thread:
Hi,
You need to Ignore this error, as there is absolutely no impact to the database
due to this error.
Thanks,
Ram
thread:
>>>> thread 1:
Q:
Dear exeprts,
Plz tell me how can I resolve ORA-12518 Tns: Listener could not hand off client
conenction.
A:
Your server is probably running out of memory and need to swap memory to disk.
One cause can be an Oracle process consuming too much memory.
Regards.
>>>> thread 2:
Q:
Hi All,
Thanks,
A:
--------
TNS-12518 TNS:listener could not hand off client connection
A:
Did you by any chance upgrade with SP2? If so, you could
be running into firewall problems - 1521 is open, the initial
contact made, but the handoff to a random (blocked!) port
fails...
--
Regards,
Frank van Bortel
>>>> thread 3:
Q:
A:
>>>> thread 4
Q:
This weekend I installed Oracle Enterprise 10g release 2 on Windows 2003 server.
The server is a Xeon dual processor 2.5MHz each with 3GB RAM and 300GB harddisk on
RAID 1.
The installation was fine, I then installed our application on it, that went
smoothly as well.
I had 3 users logged in to test the installation and everything was ok.
Today morning we had 100 users trying to login and some got access, but majority
got the ORA error above
and have no access. I checked the tnsnames.ora file and sqlnet.ora file, service
on the database all looks ok.
I also restarted the listener service on the server, but I still get this error
message.
I've also increased no of sessions to 1000.
Has anyone ever come across a issue like this in Oracle 10g.
Regards
A:
I think I've resolved the problem, majority of my users are away on easter break
so when they return
I will know whether this tweak has paid off or not.
Basically my SGA settings were quite high, so 60% of RAM was being used by SGA and
40% by Windows.
I basically reduced the total SGA to 800 MB and i've had no connection problems,
ever since.
>>>> thread 5
Should you be working with Multi threaded server connections, you might need to
increase
the value of large_pool_size.
-- thread:
Q:
I just upgraded to Oracle 10g release 2 and I keep getting this error in my alert
log
A:
This is not a bug, it's the expected behavior in 10gr2. The "private strand flush
not complete" is a "noise" error,
and can be disregarded because it relates to internal cache redo file management.
Oracle Metalink note 372557.1 says that a "strand" is a new 10gr2 term for redo
latches. It notes that a strand is a new mechanism
to assign redo latches to multiple processes, and it's related to the
log_parallelism parameter. The note says that the number of
strands depends on the cpu_count.
When you switch redo logs you will see this alert log message since all private
strands have to be flushed to the current redo log.
-- thread:
Q:
HI,
I'm using the Oracle 10g R2 in a server with Red Hat ES 4.0, and i received the
following message in alert log
"Private strand flush not complete", somebody knows this error?
Thanks,
A:
Hi,
Best Regards,
-- thread:
Q:
Hi,
I`m having such info in alert_logfile... maybee some ideas or info...
Private strand flush not complete
What could this posible mean ??
Thu Feb 9 22:03:44 2006
Thread 1 cannot allocate new log, sequence 387
Private strand flush not complete
Current log# 2 seq# 386 mem# 0: /path/redo02.log
Thread 1 advanced to log sequence 387
Current log# 3 seq# 387 mem# 0: /path/redo03.log
Thanks
A:
see http://download-
uk.oracle.com/docs/cd/B19306_01/server.102/b14237/waitevents003.htm#sthref4478
regards
Parameters: None
Note 1:
-------
Q:
Hi
Iam getting error message "Thread 1 cannot allocate new log", sequence40994
A:
Rick
Sometimes, you can see in your alert.log file, the following corresponding
messages:
This message indicates that Oracle wants to reuse a redo log file, but
the
corresponding checkpoint associated is not terminated. In this case,
Oracle
must wait until the checkpoint is completely realized. This situation
may be encountered particularly when the transactional activity is
important.
These two statistics must not be different more than once. If this is
1) Give the checkpoint process more time to cycle through the logs
- add more redo log groups
- increase the size of the redo logs
2) Reduce the frequency of checkpoints
- increase LOG_CHECKPOINT_INTERVAL
- increase size of online redo logs
3) Improve the efficiency of checkpoints enabling the CKPT process
with CHECKPOINT_PROCESS=TRUE
4) Set LOG_CHECKPOINT_TIMEOUT = 0. This disables the checkpointing
based on
time interval.
5) Another means of solving this error is for DBWR to quickly write
the dirty
buffers on disk. The parameter linked to this task is:
DB_BLOCK_CHECKPOINT_BATCH.
Note 2:
-------
Q:
Hi All,
Lets generate a good discussion thread for this database performance
issue.
Sometimes this message is found in the alert log generated.
Thread 1 advanced to log sequence xxx
Current log# 2 seq# 248 mem# 0: /df/sdfds
Thread 1 cannot allocate new log, sequence xxx
Checkpoint not complete
I would appreciate a discussion on the following
1. What are the basic reasons for this warning
2. What is the preventive measure to be taken / Methods to detect its
occurance
3. What are the post occurance measures/solutions for this.
Regards
A:
A:
Amongst other reasons, this happens when redo logs are not sized properly.
A checkpoint could not be completed because a new log is trying to be
allocated while it is still in use (or hasn't been archived yet).
This can happen if you are running very long transactions that are
producing large amounts of redo (which you did not anticipate) and the redo
logs are too small to handle it.
If you are not archiving, increasing the size of your logfiles should help
(each log group should have at least 2 members on separate disks).
Also, be aware of what type of hardware you are using. Typically, raid-5 is
slower for writes than raid-1.
If you are archiving and have increased the size of the redo logs, also try
adding an additional arch process.
In the future, make sure to monitor the ratio of redo log entries to
requests (it should be around 5000 to 1).
If it slips below this ratio, you may want to consider adding addtional
members to your log groups and increasing their size.
A:
-- thread 1:
Q:
thread 1:
The error may have a number of different root causes. For example, anetwork error
may have caused bad data to be received,
or the clientapplication may have sent wrong data, or the data in the network
buffermay have been overwritten.
Since there are many potential causes of thiserror, it is essential to have a
reproducible testcase to correctlydiagnose
the underlying cause. If operating system network logs areavailable, it is
advisable to check them for evidence of networkfailures
which may indicate network transmission problems.
thread 2:
We just found out that it was related to Block option DML RETURNINGVALUE in
Forms4.5
We set it to NO, and the problem was solved
Thanks anyway
thread 3:
Hello,
Note 1:
-------
Q:
I was inserting 2.000.000 records in a table and the connection has been killed.
in my alert file I found the following message : "SMON: Parallel transaction
recovery tried"
A:
Hi,
Note 2:
-------
You get this message if SMON failed to generate the slave servers necessary to
perform a parallel rollback of a transaction.
Check the value for the parameter, FAST_START_PARALLEL_ROLLBACK (default is LOW).
LOW limits the number of rollback processes to 2 * CPU_COUNT.
HIGH limits the number of rollback processes to 4 * CPU_COUNT.
You may want to set the value of this parameter to FALSE. Received on Wed Mar 10
2004 - 23:58:40 CST
Note 3:
-------
Q:
A:
Note 4:
-------
With Real Application Clusters, the SMON process of one instance can perform
instance recovery for a failed CPU or instance.
Note 1:
-------
Q:
Hi there,
Oracle has started using mutexes and it is said that they are more efficient as
compared to latches.
Questions
1)What is mutex?I know mutex are mutual exclusions and they are the concept of
multiple threads.What I want to know that how
this concept is implemented in Oracledatabase?
2) How they are better than latches?both are used for low level locking so how one
is better than the other?
Any input is welcome.
Thanks and regards
Aman....
A:
1) Simply put mutexes are memory structures. They are used to serialize the access
to shared structures.
IMHO their most important characteristics are two. First, they can be taken in
shared or exclusive mode. Second, getting a mutex
can be done in wait or no-wait mode.
2) The main advantages over latches are that mutexes requires less memory and are
faster to get and release.
A:
In Oracle, latches and mutexes are different things and managed using different
modules.
KSL* modules for latches and KGX* for mutexes.
As Chris said, general mutex operatins require less CPU instructions than latch
operations (as they aren't as sophisticated
as latches and don't maintain get/miss counts as latches do).
But the main scalability benefit comes from that there's a mutex structure in each
child cursor handle and the mutex
itself acts as cursor pin structure. So if you have a cursor open (or cached in
session cursor cache) you don't need
to get the library cache latch (which was previously needed for changing cursor
pin status), but you can modify the cursor's
mutex refcount directly (with help of pointers in open cursor state area in
sessions UGA).
Therefore you have much higher scalability when pinning/unpinning cursors (no
library cache latching needed,
virtually no false contention) and no separate pin structures need to be
allocated/maintained.
Few notes:
1) library cache latching is still needed for parsing etc, the mutexes address
only the pinning issue in library cache
2) mutexes are currently used for library cache cursors (not other objects like
PL/SQL stored procs, table defs etc)
3) As mutexes are a generic mechanism (not library cache specific) they're used in
V$SQLSTATS underlying structures too
4) When mutexes are enabled, you won't see cursor pins from X$KGLPN anymore (as
X$KGLPN is a fixed table based on the KGL pin array
- which wouldn't be used for cursors anymore)
[pl101][tdbaprod][/dbms/tdbaprod/prodrman/admin/dump/bdump] cat
prodrman_mmnl_1011950.trc
/dbms/tdbaprod/prodrman/admin/dump/bdump/prodrman_mmnl_1011950.trc
Oracle Database 10g Enterprise Edition Release 10.2.0.3.0 - 64bit Production
With the Partitioning, OLAP and Data Mining options
ORACLE_HOME = /dbms/tdbaprod/ora10g/home
System name: AIX
Node name: pl101
Release: 3
Version: 5
Machine: 00CB85FF4C00
Instance name: prodrman
Redo thread mounted by this instance: 1
Oracle process number: 12
Unix process pid: 1011950, image: oracle@pl101 (MMNL)
Note 1:
-------
> /dbms/tdbaprod/prodrman/admin/dump/bdump/prodrman_cjq0_1003754.trc
> Oracle Database 10g Enterprise Edition Release 10.2.0.3.0 - 64bit Production
> With the Partitioning, OLAP and Data Mining options
> ORACLE_HOME = /dbms/tdbaprod/ora10g/home
> System name: AIX
> Node name: pl101
> Release: 3
> Version: 5
> Machine: 00CB85FF4C00
> Instance name: prodrman
> Redo thread mounted by this instance: 1
> Oracle process number: 10
> Unix process pid: 1003754, image: oracle@pl101 (CJQ0)
>
> *** 2008-04-01 05:46:17.709
> *** SERVICE NAME:(SYS$BACKGROUND) 2008-04-01 05:44:28.394
> *** SESSION ID:(107.1) 2008-04-01 05:44:28.394
> Waited for process J000 to initialize for 60 seconds
> *** 2008-04-01 05:46:17.709
> Dumping diagnostic information for J000:
> /dbms/tdbaaccp/accpross/admin/dump/bdump/accpross_cjq0_1970272.trc
> Oracle Database 10g Enterprise Edition Release 10.2.0.3.0 - 64bit Production
> With the Partitioning, OLAP and Data Mining options
> ORACLE_HOME = /dbms/tdbaaccp/ora10g/home
> System name: AIX
> Node name: pl003
> Release: 3
> Version: 5
> Machine: 00CB560D4C00
> Instance name: accpross
> Redo thread mounted by this instance: 1
> Oracle process number: 10
> Unix process pid: 1970272, image: oracle@pl003 (CJQ0)
>
> *** 2008-04-01 06:01:21.210
> *** SERVICE NAME:(SYS$BACKGROUND) 2008-04-01 06:00:48.099
> *** SESSION ID:(217.1) 2008-04-01 06:00:48.099
> Waited for process J001 to initialize for 60 seconds
> *** 2008-04-01 06:01:21.210
> Dumping diagnostic information for J001:
> OS pid = 3645448
> loadavg : 1.28 1.18 1.16
> swap info: free_mem = 107.12M rsv = 24.00M
> alloc = 3749.61M avail = 6144.00M swap_free = 2394.39M
> F S UID PID PPID C PRI NI ADDR SZ WCHAN STIME
TTY TIME CMD
> 240001 A tdbaaccp 3645448 1 8 64 20 7566c510 91844
05:59:48 - 0:00 ora_j001_accpross
> open: Permission denied
> 3645448: ora_j001_accpross
> 0x00000001000f81e0 sskgpwwait(??, ??, ??, ??, ??) + ??
> 0x00000001000f5c54 skgpwwait(??, ??, ??, ??, ??) + 0x94
> 0x000000010010ba00 ksliwat(??, ??, ??, ??, ??, ??, ??, ??) + 0x640
> 0x0000000100116744 kslwaitns_timed(??, ??, ??, ??, ??, ??, ??, ??) + 0x24
> 0x0000000100170374 kskthbwt(0x0, 0x0, 0x7000000, 0x7000000, 0x16656c, 0x1,
0xfffffff, 0x7000000) + 0x214
> 0x0000000100116884 kslwait(??, ??, ??, ??, ??, ??) + 0x84
> 0x00000001021d4fcc kkjsexe() + 0x32c
> 0x00000001021d5d58 kkjrdp() + 0x478
> 0x00000001041c8bd0 opirip(??, ??, ??) + 0x4f0
> 0x0000000102ab4ba8 opidrv(??, ??, ??) + 0x448
> 0x000000010409df30 sou2o(??, ??, ??, ??) + 0x90
> 0x0000000100000870 opimai_real(??, ??) + 0x150
> 0x00000001000006d8 main(??, ??) + 0x98
> 0x0000000100000360 __start() + 0x90
> *** 2008-04-01 06:01:26.792
> /dbms/tdbaprod/prodross/admin/dump/bdump/prodross_cjq0_2068516.trc
> Oracle Database 10g Enterprise Edition Release 10.2.0.3.0 - 64bit Production
> With the Partitioning, OLAP and Data Mining options
> ORACLE_HOME = /dbms/tdbaprod/ora10g/home
> System name: AIX
> Node name: pl101
> Release: 3
> Version: 5
> Machine: 00CB85FF4C00
> Instance name: prodross
> Redo thread mounted by this instance: 1
> Oracle process number: 10
> Unix process pid: 2068516, image: oracle@pl101 (CJQ0)
>
> *** 2008-04-01 05:13:52.362
> *** SERVICE NAME:(SYS$BACKGROUND) 2008-04-01 05:11:46.862
> *** SESSION ID:(217.1) 2008-04-01 05:11:46.861
> Waited for process J000 to initialize for 60 seconds
> *** 2008-04-01 05:13:52.362
> Dumping diagnostic information for J000:
> OS pid = 1855710
> loadavg : 1.08 1.15 1.20
> swap info: free_mem = 63.91M rsv = 24.00M
> alloc = 2110.61M avail = 6144.00M swap_free = 4033.39M
> F S UID PID PPID C PRI NI ADDR SZ WCHAN STIME
TTY TIME CMD
> 240001 A tdbaprod 1855710 1 4 66 22 1cb2f5400 92672
05:10:46 - 0:00 ora_j000_prodross
> open: Permission denied
> 1855710: ora_j000_prodross
> 0x00000001000f81e0 sskgpwwait(??, ??, ??, ??, ??) + ??
> 0x00000001000f5c54 skgpwwait(??, ??, ??, ??, ??) + 0x94
> 0x000000010010ba00 ksliwat(??, ??, ??, ??, ??, ??, ??, ??) + 0x640
> 0x0000000100116744 kslwaitns_timed(??, ??, ??, ??, ??, ??, ??, ??) + 0x24
> 0x0000000100170374 kskthbwt(0x0, 0x0, 0x7000000, 0x7000000, 0x15aab2, 0x1,
0xfffffff, 0x7000000) + 0x214
> 0x0000000100116884 kslwait(??, ??, ??, ??, ??, ??) + 0x84
> 0x00000001021d4fcc kkjsexe() + 0x32c
> 0x00000001021d5d58 kkjrdp() + 0x478
> 0x00000001041c8bd0 opirip(??, ??, ??) + 0x4f0
> 0x0000000102ab4ba8 opidrv(??, ??, ??) + 0x448
> 0x000000010409df30 sou2o(??, ??, ??, ??) + 0x90
> 0x0000000100000870 opimai_real(??, ??) + 0x150
> 0x00000001000006d8 main(??, ??) + 0x98
> 0x0000000100000360 __start() + 0x90
> *** 2008-04-01 05:13:59.017
> /dbms/tdbaprod/prodtrid/admin/dump/bdump/prodtrid_mmon_921794.trc
> Oracle Database 10g Enterprise Edition Release 10.2.0.3.0 - 64bit Production
> With the Partitioning, OLAP and Data Mining options
> ORACLE_HOME = /dbms/tdbaprod/ora10g/home
> System name: AIX
> Node name: pl101
> Release: 3
> Version: 5
> Machine: 00CB85FF4C00
> Instance name: prodtrid
> Redo thread mounted by this instance: 1
> Oracle process number: 11
> Unix process pid: 921794, image: oracle@pl101 (MMON)
>
> *** 2008-04-01 06:01:39.797
> *** SERVICE NAME:(SYS$BACKGROUND) 2008-04-01 06:01:39.385
> *** SESSION ID:(106.1) 2008-04-01 06:01:39.385
> Waited for process m000 to initialize for 60 seconds
> *** 2008-04-01 06:01:39.797
> Dumping diagnostic information for m000:
Note 1:
-------
Q:
CODE
*** 2007-06-18 11:16:49.696
Dump diagnostics for process q002 pid 786600 which did not start after 120
seconds:
(spawn_time:x10BF1F175 now:x10BF3CB36 diff:x1D9C1)
*** 2007-06-18 11:16:54.668
Dumping diagnostic information for q002:
OS pid = 786600
loadavg : 0.07 0.27 0.28
swap info: free_mem = 9.56M rsv = 40.00M
alloc = 4397.23M avail = 10240.00M swap_free = 5842.77M
skgpgpstack: fgets() timed out after 60 seconds
skgpgpstack: pclose() timed out after 60 seconds
ERROR: process 786600 is not alive
*** 2007-06-18 11:19:41.152
*** 2007-06-18 11:27:36.403
Process startup failed, error stack:
ORA-27300: OS system dependent operation:fork failed with status: 12
ORA-27301: OS failure message: Not enough space
ORA-27302: failure occurred at: skgpspawn3
So we think it's oracle's fault, but we're not sure. We're AIX guys, not oracle,
so we're not sure about this.
Can anyone confirm if this is caused by oracle?
A:
Looks like a bug. We are running on a Windows 2003 Server Standard edition. I had
the same problem.
Server was not responding anymore after the following errors:
And later:
O/S-Error: (OS 1450) Insufficient system resources exist to complete the requested
service.
We are running the latest patchset 10.2.0.2 because of a big problem in 10.2.0.1
(wrong parsing causes client memory problems.
Procobol., plsql developer ect crash because oracle made mistakes skipping the
parse process, goto direct execute and return
corrupted data to the client.
Tomorrow I will rise a level 1 TAR indicating we had a crach. Server is now
running normaly.
A:
The patch 10 (patch number 5639232) is supposed to solve the problem for
10.2.0.2.0.
We applied it monday morning and everything is fine up to now.
Note 2:
-------
Q:
question:
-----------------------------------------------------------
my bdump received two error message traces this morning. One of the trace displays
a lot of detail, mainly as:
*** SESSION ID:(822.1) 2007-02-11 00:35:06.147
Waited for process J000 to initialize for 60 seconds
*** 2007-02-11 00:35:20.276
Dumping diagnostic information for J000:
OS pid = 811172
loadavg : 0.55 0.42 0.44
swap info: free_mem = 3.77M rsv = 24.50M
alloc = 2418.36M avail = 6272.00M swap_free = 3853.64M
F S UID PID PPID C PRI NI ADDR SZ WCHAN STIME TTY TIME CMD
240001 A oracle 811172 1 0 60 20 5bf12400 86396 00:34:32 - 0:00 ora_j000_BAAN
open: The file access permissions do not allow the specified action.
Then whole bunch of the pointers and something like this "0x0000000100055800
kghbshrt(??, ??, ??, ??, ??, ??) + 0x80"
how do I find out what really went wrong? This error occured after I did an export
pump of the DB, about 10 minutes later.
This is first time I sae such and the export pump has been for a year.
My system is Oracle 10g R2 on AIX 5.3L
Note 3:
-------
pmon
The process monitor performs process recovery when a user process fails. PMON is
responsible for cleaning up
the cache and freeing resources that the process was using. PMON also checks on
the dispatcher processes
(described later in this table) and server processes and restarts them if they
have failed.
mman
Used for internal database tasks.
dbw0
The database writer writes modified blocks from the database buffer cache to the
datafiles. Oracle Database allows a maximum
of 20 database writer processes (DBW0-DBW9 and DBWa-DBWj). The initialization
parameter DB_WRITER_PROCESSES specifies
the number of DBWn processes. The database selects an appropriate default setting
for this initialization parameter
(or might adjust a user specified setting) based upon the number of CPUs and the
number of processor groups.
lgwr
The log writer process writes redo log entries to disk. Redo log entries are
generated in the redo log buffer
of the system global area (SGA), and LGWR writes the redo log entries sequentially
into a redo log file.
If the database has a multiplexed redo log, LGWR writes the redo log entries to a
group of redo log files.
ckpt
At specific times, all modified database buffers in the system global area are
written to the datafiles by DBWn.
This event is called a checkpoint. The checkpoint process is responsible for
signalling DBWn at checkpoints and updating
all the datafiles and control files of the database to indicate the most recent
checkpoint.
smon
The system monitor performs recovery when a failed instance starts up again. In a
Real Application Clusters database,
the SMON process of one instance can perform instance recovery for other instances
that have failed. SMON also cleans up
temporary segments that are no longer in use and recovers dead transactions
skipped during system failure and instance recovery
because of file-read or offline errors. These transactions are eventually
recovered by SMON when the tablespace or file is brought back online.
reco
The recoverer process is used to resolve distributed transactions that are pending
due to a network or system failure
in a distributed database. At timed intervals, the local RECO attempts to connect
to remote databases and automatically complete
the commit or rollback of the local portion of any pending distributed
transactions.
cjq0
Job Queue Coordinator (CJQ0)
Job queue processes are used for batch processing. The CJQ0 process dynamically
spawns job queue slave processes (J000...J999) to run the jobs.
d000
Dispatchers are optional background processes, present only when the shared server
configuration is used.
s000
Dunno.
mmon
Performs various manageability-related background tasks.
mmnl
Performs frequent and light-weight manageability-related tasks, such as session
history capture and metrics computation.
j000
A job queue slave. (See cjq0)
Addition:
---------
-------------------
--New in 10gR2
-------------------
PSP0 (new in 10gR2) - Process SPawner - to create and manage other Oracle
processes.
NOTE: There is no documentation currently in the Oracle Documentation set on this
process.
Further explaination From "What's New in Oracle Data Guard?" in the Oracle� Data
Guard Concepts and Administration 10g Release 2 (10.2)
-------------------
--New in 10gR1
-------------------
MMAN - Memory MANager - it serves as SGA Memory Broker and coordinates the sizing
of the memory components,
which keeps track of the sizes of the components and pending resize operations.
Used by Automatic Shared Memory Management feature.
RVWR -Recovery Writer - which is responsible for writing flashback logs which
stores pre-image(s) of data blocks.
It is used by Flashback database feature in 10g, which provides a way to quickly
revert an entire Oracle database to the state
it was in at a past point in time.
- This is different from traditional point in time recovery.
- One can use Flashback Database to back out changes that:
- Have resulted in logical data corruptions.
- Are a result of user error.
- This feature is not applicable for recovering the database in case of media
failure.
- The time required for flashbacking a database to a specific time in past is
DIRECTLY PROPORTIONAL to the number of changes made and not on the size
of the database.
Jnnn - Job queue processes which are spawned as needed by CJQ0 to complete
scheduled jobs. This is not a new process.
CTWR - Change Tracking Writer (CTWR) which works with the new block changed
tracking features in 10g for fast RMAN incremental backups.
MMNL - Memory Monitor Light process - which works with the Automatic Workload
Repository new features (AWR) to write out
full statistics buffers to disk as needed.
MMON - Memory MONitor (MMON) process - is associated with the Automatic Workload
Repository new features used for automatic problem
detection and self-tuning. MMON writes out the required statistics for AWR on a
scheduled basis.
RBAL - It is the ASM related process that performs rebalancing of disk resources
controlled by ASM.
ARBx - These processes are managed by the RBAL process and are used to do the
actual rebalancing of ASM controlled disk resources.
The number of ARBx processes invoked is directly influenced by the asm_power_limit
parameter.
The QMON processes are optional background processes for Oracle Streams Advanced
Queueing (AQ) which monitor and maintain all
the system and user owned AQ objects. These optional processes, like the job_queue
processes, does not cause the instance to fail
on process failure. They provide the mechanism for message expiration, retry, and
delay, maintain queue statistics,
remove processed messages from the queue table and maintain the dequeue IOT.
The number of queue monitor processes is controlled via the dynamic initialisation
parameter AQ_TM_PROCESSES.
If this parameter is set to a non-zero value X, Oracle creates that number of QMNX
processes starting from ora_qmn0_
(where is the identifier of the database) up to ora_qmnX_ ; if the parameter is
not specified or is set to 0,
then QMON processes are not created. There can be a maximum of 10 QMON processes
running on a single instance.
For example the parameter can be set in the init.ora as follows
19.78: ORA-00600: internal error code, arguments: [13080], [], [], [], [], [], [],
[]:
==================================================================================
====
Note 1:
Q:
WARNING: inbound connection timed out (ORA-3136) this error appearing in Alert log
.
Please explain following:---------------
1.How to overcome this error?
2.Is there any adverse effect in long run?
3.Is it require to SHUTDOWN the DATABASE to solve it.
A:
http://www.freelists.org/archives/oracle-l/08-2005/msg01627.html
A:
What the error is telling you is that a connection attempt was made, but the
session authentication was not provided
before SQLNET.INBOUND_CONNECT_TIMEOUT seconds.
As far as adverse effects in the long run, you have a user or process that is
unable to connect to the database.
So someone is unhappy about the database/application.
Q:
A:
Yep this is annoying, especially if you have alert log monitors :(. I had
these when I first went to 10G... make these changes to get rid of them:
Listener.ora:
INBOUND_CONNECT_TIMEOUT_<LISTENER_NAME>=0
.. for every listener
Sqlnet.ora:
SQLNET.INBOUND_CONNECT_TIMEOUT=0
Note 2:
SQLNET.INBOUND_CONNECT_TIMEOUT
Purpose
Use the SQLNET.INBOUND_CONNECT_TIMEOUT parameter to specify the time, in seconds,
for a client to connect with the database server
and provide the necessary authentication information.
. Without this parameter, a client connection to the database server can stay open
indefinitely without authentication.
Connections without authentication can introduce possible denial-of-service
attacks, whereby malicious clients attempt to
flood database servers with connect requests that consume resources.
To protect both the database server and the listener, Oracle Corporation
recommends setting this parameter in combination
with the INBOUND_CONNECT_TIMEOUT_listener_name parameter in the listener.ora file.
When specifying values for these parameters,
consider the following recommendations:
Note 1:
-------
Q:
Hi,
Is there anyone who knows how to insert a value containing "&" into a table?
sth like this:
thanks in advance
A:
Try:
set define off
Then execute your insert.
Q:
Hi,
We have 10gr2 on windows server 2003 standard edition.
The below errors are generated in mman trace files every now and then.
metalink doesnt give much info either.( BUG : 5201883 for your reference )
did anybody happened to have come across this issue and probably resolved it.
Any comments are appreciated.
A:
A:
either
1) ignore the messages and delete generated trace files periodically
and/or
2) wait for patchset 10.2.0.4
=====================
20. DATABASE TRACING:
=====================
The current state of database and instance trace is reported in the data
dictionary view DBA_ENABLED_TRACES.
Oracle�s released a few new facilities to help with tracing in 10g, here�s a real
quick wrap up of the most significant:
You can tag database sessions with a session identifier that can later be used to
identify sessions to trace.
You can set the identifier like this:
begin
dbms_session.set_identifier('GUY1');
end;
You can set this from a login trigger if you don�t have access to the source code.
To set trace on for a matching client id,
you use DBMS_MONITOR.CLIENT_ID_TRACE_ENABLE:
BEGIN
You can add waits and or bind variables to the trace file using the flags shown.
Many Oracle-aware applications set Module and action properties and you can use
these to enable tracing as well.
The serv_mod_act_trace_enable method allows you to set the tracing on for sessions
matching particular service, module, actions
and (for clusters) instance identifiers. You can see current values for these
usng the following query:
So to generate traces for all SQL*plus sessions that connect to the cluster from
any instance,
I could issue the following command:
BEGIN
DBMS_MONITOR.serv_mod_act_trace_enable
(service_name => 'ghrac1',
module_name => 'SQL*Plus',
action_name => DBMS_MONITOR.all_actions,
waits => TRUE,
binds => FALSE,
instance_name => NULL
);
END;
.
/
DBMS_MONITOR can enable traces for specific sid and serial as you would expect:
BEGIN
dbms_monitor.session_trace_enable (session_id => 180,
serial_num => 492,
waits => TRUE,
binds => TRUE
);
END;
/
The sid and serial need to be current now � unlike the other methods, this does
not setup a permanent trace request
(simply because the sid and serial# will never be repeated). Also, you need to
issue this from the same instance
if you are in a RAC cluster.
Providing NULLs for sid and serial# traces the current session.
This hasn�t changed much in 10g; the traces are in the USER_DUMP_DEST directory,
and you can analyze them using tkprof.
The trcsess utility is a new additional that allows you to generate a trace based
on multiple input files and several other conditions.
To generate a single trace file combining all the entries from the SQL*Plus
sessions I traced earlier,
then to feed them into tkprof for analysis, I would issue the following commands:
Note 2:
-------
The DBMS_MONITOR package has routines for enabling and disabling statistics
aggregation as well as for tracing by session ID,
or tracing based upon a combination of service name, module name, and action name.
(These three are associated hierarchically:
you can't specify an action without specifying the module and the service name,
but you can specify only the service name,
or only the service name and module name.) The module and action names, if
available, come from within the application code.
For example, Oracle E-Business Suite applications provide module and action names
in the code, so you can identify these
by name in any of the Oracle Enterprise Manager pages. (PL/SQL developers can
embed calls into their applications by using the
DBMS_APPLICATION_INFO package to set module and action names.)
Note that setting the module, action, and other paramters such as client_id no
longer causes a round-trip to the database
�these routines now piggyback on all calls from the application.
The service name is determined by the connect string used to connect to a service.
User sessions not associated with a specific
service are handled by sys$users (sys$background is the default service for the
background processes). Since we have a service
and a module name, we can turn on tracing for this module as follows:
To trace the SQL based on the session ID, look at the Oracle Enter-prise Manager
Top Sessions page, or query the V$SESSION view
as you likely currently do.
With the session ID (SID) and serial number, you can use DBMS_MONITOR to enable
tracing for just this session:
exec dbms_monitor.session_trace_enable(81);
The serial number defaults to the current serial number for the SID (unless
otherwise specified), so if that's the session
and serial number you want to trace, you need not look any further. Also, by
default, WAITS are set to true and BINDS to false,
so the syntax above is effectively the same as the following:
Note that WAITS and BINDS are the same parameters that you might have set in the
past using DBMS_SUPPORT and the 10046 event.
Note 3: DBMS_MONITOR:
---------------------
The DBMS_MONITOR package let you use PL/SQL for controlling additional tracing and
statistics gathering.
Subprogram Description
CLIENT_ID_STAT_DISABLE Procedure
CLIENT_ID_STAT_ENABLE Procedure
CLIENT_ID_TRACE_DISABLE Procedure
Disables the trace previously enabled for a given Client Identifier globally for
the database
CLIENT_ID_TRACE_ENABLE Procedure
Enables the trace for a given Client Identifier globally for the database
DATABASE_TRACE_DISABLE Procedure
DATABASE_TRACE_ENABLE Procedure
SERV_MOD_ACT_STAT_DISABLE Procedure
SERV_MOD_ACT_STAT_ENABLE Procedure
Enables statistic gathering for a given combination of Service Name, MODULE and
ACTION
SERV_MOD_ACT_TRACE_DISABLE Procedure
Disables the trace for ALL enabled instances for a or a given combination of
Service Name, MODULE and ACTION name globally
SERV_MOD_ACT_TRACE_ENABLE Procedure
Enables SQL tracing for a given combination of Service Name, MODULE and ACTION
globally unless an instance_name is specified
SESSION_TRACE_DISABLE Procedure
Disables the previously enabled trace for a given database session identifier
(SID) on the local instance
SESSION_TRACE_ENABLE Procedure
Enables the trace for a given database session identifier (SID) on the local
instance
----------------------------------------------------------------------------------
------------------------------------
-- CLIENT_ID_STAT_ENABLE Procedure
This procedure enables statistic gathering for a given Client Identifier.
Statistics gathering is global for the database
and persistent across instance starts and restarts. That is, statistics are
enabled for all instances of the same database,
including restarts. Statistics are viewable through V$CLIENT_STATS views.
Syntax
DBMS_MONITOR.CLIENT_ID_STAT_ENABLE(
client_id IN VARCHAR2);
Parameters
Parameter Description
client_id
The Client Identifier for which statistic aggregation is enabled.
Examples
EXECUTE DBMS_MONITOR.CLIENT_ID_STAT_ENABLE('janedoe');
EXECUTE DBMS_MONITOR.CLIENT_ID_STAT_ENABLE('edp$jvl');
EXECUTE DBMS_MONITOR.CLIENT_ID_STAT_DISABLE('edp$jvl');
-- CLIENT_ID_STAT_DISABLE Procedure
This procedure will disable statistics accumulation for all instances and remove
the accumulated results
from V$CLIENT_STATS view enabled by the CLIENT_ID_STAT_ENABLE Procedure.
Syntax
DBMS_MONITOR.CLIENT_ID_STAT_DISABLE(
client_id IN VARCHAR2);
Parameters
Parameter Description
client_id
The Client Identifier for which statistic aggregation is disabled.
Examples
To disable accumulation:
EXECUTE DBMS_MONITOR.CLIENT_ID_STAT_DISABLE('janedoe');
----------------------------------------------------------------------------------
------------------------------------
-- CLIENT_ID_TRACE_DISABLE Procedure
This procedure will disable tracing enabled by the CLIENT_ID_TRACE_ENABLE
Procedure.
Syntax
DBMS_MONITOR.CLIENT_ID_TRACE_DISABLE(
client_id IN VARCHAR2);
Parameters
Parameter Description
client_id
The Client Identifier for which SQL tracing is disabled.
Examples
-- CLIENT_ID_TRACE_ENABLE Procedure
This procedure will enable the trace for a given client identifier globally for
the database.
Syntax
DBMS_MONITOR.CLIENT_ID_TRACE_ENABLE(
client_id IN VARCHAR2,
waits IN BOOLEAN DEFAULT TRUE,
binds IN BOOLEAN DEFAULT FALSE);
Parameters
Parameter Description
client_id
Database Session Identifier for which SQL tracing is enabled.
waits
If TRUE, wait information is present in the trace.
binds
If TRUE, bind information is present in the trace.
Usage Notes
The trace will be written to multiple trace files because more than one Oracle
shadow process can work
on behalf of a given client identifier.
The tracing is enabled for all instances and persistent across restarts.
Examples
----------------------------------------------------------------------------------
------------------------------------
-- SERV_MOD_ACT_STAT_DISABLE Procedure
This procedure will disable statistics accumulation and remove the accumulated
results from V$SERV_MOD_ACT_STATS view.
Statistics disabling is persistent for the database. That is, service statistics
are disabled for instances of the same database
(plus dblinks that have been activated as a result of the enable).
Syntax
DBMS_MONITOR.SERV_MOD_ACT_STAT_DISABLE(
service_name IN VARCHAR2,
module_name IN VARCHAR2,
action_name IN VARCHAR2 DEFAULT ALL_ACTIONS);
Parameters
Parameter Description
service_name
Name of the service for which statistic aggregation is disabled.
module_name
Name of the MODULE. An additional qualifier for the service. It is a required
parameter.
action_name
Name of the ACTION. An additional qualifier for the Service and MODULE name.
Omitting the parameter
(or supplying ALL_ACTIONS constant) means enabling aggregation for all Actions for
a given Server/Module combination.
In this case, statistics are aggregated on the module level.
-- SERV_MOD_ACT_STAT_ENABLE Procedure
This procedure enables statistic gathering for a given combination of Service
Name, MODULE and ACTION. Calling this procedure enables
statistic gathering for a hierarchical combination of Service name, MODULE name,
and ACTION name on all instances for the same database.
Statistics are accessible by means of the V$SERV_MOD_ACT_STATS view.
Syntax
DBMS_MONITOR.SERV_MOD_ACT_STAT_ENABLE(
service_name IN VARCHAR2,
module_name IN VARCHAR2,
action_name IN VARCHAR2 DEFAULT ALL_ACTIONS);
Parameters
Parameter Description
service_name
Name of the service for which statistic aggregation is enabled.
module_name
Name of the MODULE. An additional qualifier for the service. It is a required
parameter.
action_name
Name of the ACTION. An additional qualifier for the Service and MODULE name.
Omitting the parameter
(or supplying ALL_ACTIONS constant) means enabling aggregation for all Actions for
a given Server/Module combination.
In this case, statistics are aggregated on the module level.
Usage Notes
Examples
EXECUTE
DBMS_MONITOR.SERV_MOD_ACT_STAT_ENABLE('APPS1','GLEDGER','DEBIT_ENTRY');
If both of the preceding commands are issued, statistics are accumulated as
follows:
For the APPS1 service, because accumulation for each Service Name is the default.
----------------------------------------------------------------------------------
------------------------------------
-- DATABASE_TRACE_ENABLE Procedure
This procedure enables SQL trace for the whole database or a specific instance.
Syntax
DBMS_MONITOR.DATABASE_TRACE_ENABLE(
waits IN BOOLEAN DEFAULT TRUE,
binds IN BOOLEAN DEFAULT FALSE,
instance_name IN VARCHAR2 DEFAULT NULL);
Parameters
Parameter Description
waits
If TRUE, wait information will be present in the trace
binds
If TRUE, bind information will be present in the trace
instance_name
If set, restricts tracing to the named instance
EXECUTE dbms_monitor.database_trace_enable
EXECUTE dbms_monitor.database_trace_disable
-- DATABASE_TRACE_DISABLE Procedure
This procedure disables SQL trace for the whole database or a specific instance.
Syntax
DBMS_MONITOR.DATABASE_TRACE_DISABLE(
instance_name IN VARCHAR2 DEFAULT NULL);
Parameters
Parameter Description
instance_name
Disables tracing for the named instance
----------------------------------------------------------------------------------
------------------------------------
SERV_MOD_ACT_TRACE_DISABLE Procedure
This procedure will disable the trace at ALL enabled instances for a given
combination of Service Name, MODULE, and ACTION name globally.
Syntax
DBMS_MONITOR.SERV_MOD_ACT_TRACE_DISABLE(
service_name IN VARCHAR2,
module_name IN VARCHAR2,
action_name IN VARCHAR2 DEFAULT ALL_ACTIONS,
instance_name IN VARCHAR2 DEFAULT NULL);
Parameters
Parameter Description
service_name
Name of the service for which tracing is disabled.
module_name
Name of the MODULE. An additional qualifier for the service.
action_name
Name of the ACTION. An additional qualifier for the Service and MODULE name.
instance_name
If set, this restricts tracing to the named instance_name.
Usage Notes
Specifying NULL for the module_name parameter means that statistics will no longer
be accumulated for the sessions which do not set the MODULE attribute.
Examples
EXECUTE DBMS_MONITOR.SERV_MOD_ACT_TRACE_ENABLE('APPS1',
DBMS_MONITOR.ALL_MODULES, DBMS_MONITOR.ALL_ACTIONS,TRUE,
FALSE,NULL);
To disable tracing specified in the previous step:
EXECUTE DBMS_MONITOR.SERV_MOD_ACT_TRACE_DISABLE('APPS1');
To enable tracing for a given combination of Service and MODULE (all ACTIONs):
EXECUTE DBMS_MONITOR.SERV_MOD_ACT_TRACE_ENABLE('APPS1','PAYROLL',
DBMS_MONITOR.ALL_ACTIONS,TRUE,FALSE,NULL);
To disable tracing specified in the previous step:
EXECUTE DBMS_MONITOR.SERV_MOD_ACT_TRACE_DISABLE('APPS1','PAYROLL');
--------------------------------------------------------------------------------
SERV_MOD_ACT_TRACE_ENABLE Procedure
This procedure will enable SQL tracing for a given combination of Service Name,
MODULE and ACTION globally unless an instance_name is specified.
Syntax
DBMS_MONITOR.SERV_MOD_ACT_TRACE_ENABLE(
service_name IN VARCHAR2,
module_name IN VARCHAR2 DEFAULT ANY_MODULE,
action_name IN VARCHAR2 DEFAULT ANY_ACTION,
waits IN BOOLEAN DEFAULT TRUE,
binds IN BOOLEAN DEFAULT FALSE,
instance_name IN VARCHAR2 DEFAULT NULL);
Parameters
Parameter Description
service_name
Name of the service for which tracing is enabled.
module_name
Name of the MODULE. An optional additional qualifier for the service.
action_name
Name of the ACTION. An optional additional qualifier for the Service and MODULE
name.
waits
If TRUE, wait information is present in the trace.
binds
If TRUE, bind information is present in the trace.
instance_name
If set, this restricts tracing to the named instance_name.
Usage Notes
The procedure enables a trace for a given combination of Service, MODULE and
ACTION name. The specification is strictly hierarchical: Service Name or Service
Name/MODULE, or Service Name, MODULE, and ACTION name must be specified. Omitting
a qualifier behaves like a wild-card, so that not specifying an ACTION means all
ACTIONs. Using the ALL_ACTIONS constant achieves the same purpose.
This tracing is useful when an application MODULE and optionally known ACTION is
experiencing poor service levels.
Tracing information is present in multiple trace files and you must use the
trcsess tool to collect it into a single file.
Specifying NULL for the module_name parameter means that statistics will be
accumulated for the sessions which do not set the MODULE attribute.
Examples
EXECUTE DBMS_MONITOR.SERV_MOD_ACT_TRACE_ENABLE('APPS1',
DBMS_MONITOR.ALL_MODULES, DBMS_MONITOR.ALL_ACTIONS,TRUE,
FALSE,NULL);
To enable tracing for a given combination of Service and MODULE (all ACTIONs):
EXECUTE DBMS_MONITOR.SERV_MOD_ACT_TRACE_ENABLE('APPS1','PAYROLL',
DBMS_MONITOR.ALL_ACTIONS,TRUE,FALSE,NULL);
--------------------------------------------------------------------------------
SESSION_TRACE_DISABLE Procedure
This procedure will disable the trace for a given database session at the local
instance.
Syntax
DBMS_MONITOR.SESSION_TRACE_DISABLE(
session_id IN BINARY_INTEGER DEFAULT NULL,
serial_num IN BINARY_INTEGER DEFAULT NULL);
Parameters
Parameter Description
session_id
Name of the service for which SQL trace is disabled.
serial_num
Serial number for this session.
Usage Notes
Examples
EXECUTE DBMS_MONITOR.SESSION_TRACE_DISABLE(7,4634);;
--------------------------------------------------------------------------------
SESSION_TRACE_ENABLE Procedure
This procedure enables a SQL trace for the given Session ID on the local instance
Syntax
DBMS_MONITOR.SESSION_TRACE_ENABLE(
session_id IN BINARY_INTEGER DEFAULT NULL,
serial_num IN BINARY_INTEGER DEFAULT NULL,
waits IN BOOLEAN DEFAULT TRUE,
binds IN BOOLEAN DEFAULT FALSE)
Parameters
Table 60-13 SESSION_TRACE_ENABLE Procedure Parameters
Parameter Description
session_id
Database Session Identifier for which SQL tracing is enabled. Specifying NULL
means that my current session should be traced.
serial_num
Serial number for this session. Specifying NULL means that any session which
matches session_id (irrespective of serial number) should be traced.
waits
If TRUE, wait information is present in the trace.
binds
If TRUE, bind information is present in the trace.
Usage Notes
The procedure enables a trace for a given database session, and is still useful
for client/server applications.
The trace is enabled only on the instance to which the caller is connected, since
database sessions do not span instances.
This tracing is strictly local to an instance.
Examples
EXECUTE DBMS_MONITOR.SESSION_TRACE_ENABLE(82,30962);
EXECUTE DBMS_MONITOR.SESSION_TRACE_DISABLE(82,30962);
Either
EXECUTE DBMS_MONITOR.SESSION_TRACE_ENABLE(5);
or
EXECUTE DBMS_MONITOR.SESSION_TRACE_ENABLE();
or
EXECUTE DBMS_MONITOR.SESSION_TRACE_ENABLE(binds=>TRUE);
Note 4:
-------
End-to-End Tracing
Now suppose that BILL's session becomes idle and LORA's session becomes active. At
that point the shared server originally
servicing BILL is assigned to LORA's session. At this point, the tracing
information emitted is not from BILL's session,
but from LORA's. When LORA's session becomes inactive, this shared server may be
assigned to another active session,
which will have completely different information.
In 10g, this problem has been effectively addressed through the use of end-to-end
tracing. In this case, tracing is not done only
by session, but by an identifiable name such as a client identifier. A new package
called DBMS_MONITOR is available for this purpose.
For instance, you may want to trace all sessions with the identifier
account_update. To set up the tracing, you would issue:
exec DBMS_MONITOR.CLIENT_ID_TRACE_ENABLE('account_update');
This command enables tracing on all sessions with the identifier account_update.
When BILL connects to the database,
he can issue the following to set the client identifier:
exec DBMS_SESSION.SET_IDENTIFIER ('account_update')
Tracing is active on the sessions with the identifier account_update, so the above
session will be traced and a trace file
will be generated on the user dump destination directory. If another user connects
to the database and sets her client identifier
to account_update, that session will be traced as well, automatically, without
setting any other command inside the code.
All sessions with the client identifier account_update will be traced until the
tracing is disabled by issuing:
exec DBMS_MONITOR.CLIENT_ID_TRACE_DISABLE('account_update');
The resulting trace files can be analyzed by tkprof. However, each session
produces a different trace file. For proper problem
diagnosis, we are interested in the consolidated trace file; not individual ones.
How do we achieve that?
Simple. Using a tool called trcsess, you can extract information relevant to
client identifier account_update to a single file
that you can run through tkprof. In the above case, you can go in the user dump
destination directory and run:
trcsess output=account_update_trc.txt clientid=account_update *
This command creates a file named account_update_trc.txt that looks like a regular
trace file but has information on only
those sessions with client identifier account_update. This file can be run through
tkprof to get the analyzed output.
Contrast this approach with the previous, more difficult method of collecting
trace information. Furthermore, tracing is enabled
and disabled by some variable such as client identifier, without calling alter
session set sql_trace = true from that session.
Another procedure in the same package, SERV_MOD_ACT_TRACE_ENABLE, can enable
tracing in other combinations such as for a
specific service, module, or action, which can be set by dbms_application_info
package.
Note 5:
-------
The following Tip is from the outstanding book "Oracle PL/SQL Tuning: Expert
Secrets for High Performance Programming"
by Dr. Tim Hall, Oracle ACE of the year, 2006:
There are numerous ways to enable, disable and vary the contents of this trace.
The following methods have been available
for several versions of the database.
-- All versions.
SQL> ALTER SESSION SET EVENTS '10046 trace name context forever, level 8';
SQL> ALTER SESSION SET EVENTS '10046 trace name context off';
The dbms_support package is not present by default, but can be loaded as the SYS
user by executing the @$ORACLE_HOME/rdbms/admin/dbmssupp.sql script.
For methods that require tracing levels, the following are valid values:
12 - The same as 2, but with both bind variable values and wait events.
The same combinations are possible for those methods with boolean parameters for
waits and binds.
With the advent of Oracle 10g, the SQL tracing options have been centralized and
extended using the dbms_monitor package.
The examples below show a few possible variations for enabling and disabling SQL
trace in Oracle 10g.
-- Oracle 10g
The package provides the conventional session level tracing along with two new
variations. First, tracing can be enabled
on multiple sessions based on the value of the client_identifier column of the
v$session view, set using the dbms_session package.
trcsess
With all these options, the consolidated trace file can be as broad or as specific
as needed.
tkprof
The SQL trace files produced by the methods discussed previously can be read in
their raw form, or they can be translated
by the tkprof utility into a more human readable form. The output below lists the
usage notes from the tkprof utility in Oracle 10g.
$ tkprof
Usage: tkprof tracefile outputfile [explain= ] [table= ]
[print= ] [insert= ] [sys= ] [sort= ]
table=schema.tablename Use 'schema.tablename' with 'explain=' option.
explain=user/password Connect to ORACLE and issue EXPLAIN PLAN.
print=integer List only the first 'integer' SQL statements.
aggregate=yes|no
insert=filename List SQL statements and data inside INSERT statements.
sys=no TKPROF does not list SQL statements run as user SYS.
record=filename Record non-recursive statements found in the trace file.
waits=yes|no Record summary for any wait events found in the trace file.
sort=option Set of zero or more of the following sort options:
The waits parameter was only added in Oracle 9i, so prior to this version wait
information had to be read from the raw trace file.
The values of bind variables must be read from the raw files as they are not
displayed in the tkprof output.
Examples:
---------
So how can we get access to the one program in DBMS_SYSTEM we want without
exposing those other dangerous
elements to the public? The answer, of course, is to build a package of our own to
encapsulate DBMS_SYSTEM
and expose only what is safe. In the process, we can make DBMS_SYSTEM easier to
use as well.
Those of us who are "keyboard-challenged" (or just plain lazy) would certainly
appreciate
not having to type a procedure name with 36 characters.
I've created a package called trace to cover DBMS_SYSTEM and provide friendlier
ways to set SQL tracing on or off
in other user's sessions. Here is the package specification:
r_rec rr_rec;
/*
|| Exposes DBMS_SYSTEM.SET_SQL_TRACE_IN_SESSION
|| with easier to call programs
||
|| Author: John Beresniewicz, Savant Corp
|| Created: 07/30/97
||
|| Compilation Requirements:
|| SELECT on SYS.V_$SESSION
|| EXECUTE on SYS.DBMS_SYSTEM (or create as SYS)
||
|| Execution Requirements:
||
*/
END trace;
The trace package provides ways to turn SQL tracing on or off by session id or
username.
One thing that annoys me about DBMS_SYSTEM.SET_SQL_TRACE_IN_SESSION is having to
figure out and pass
a session serial number into the procedure. There should always be only one
session per sid at any time
connected to the database, so trace takes care of figuring out the appropriate
serial number behind the scenes.
The xon and off procedures are both overloaded on the single IN parameter, with
versions accepting
either the numeric session id or a character string for the session username.
Allowing session selection
by username may be easier than by sids. Why? Because sids are transient and must
be looked up at runtime,
whereas username is usually permanently associated with an individual. Beware,
though, that multiple sessions
may be concurrently connected under the same username, and invoking trace.xon by
username will turn tracing on
in all of them.
/*
|| Use DBMS_SYSTEM.SET_SQL_TRACE_IN_SESSION to turn tracing on
|| or off by either session id or username. Affects all sessions
|| that match non-NULL values of the user and sid parameters.
*/
PROCEDURE set_trace
(sqltrace_TF BOOLEAN
,user IN VARCHAR2 DEFAULT NULL
,sid IN NUMBER DEFAULT NULL)
IS
BEGIN
/*
|| Loop through all sessions that match the sid and user
|| parameters and set trace on in those sessions. The NVL
|| function in the cursor WHERE clause allows the single
|| SELECT statement to filter by either sid OR user.
*/
FOR sid_rec IN
(SELECT sid,serial#
FROM v$session S
WHERE S.type='USER'
AND S.username = NVL(UPPER(user),S.username)
AND S.sid = NVL(sid,S.sid) )
LOOP
SYS.DBMS_SYSTEM.SET_SQL_TRACE_IN_SESSION
(sid_rec.sid, sid_rec.serial#, sqltrace_TF);
END LOOP;
END set_trace;
/*
|| The programs exposed by the package all simply
|| call set_trace with different parameter combinations.
*/
PROCEDURE Xon(sid_IN IN NUMBER)
IS
BEGIN
set_trace(sqltrace_TF => TRUE, sid => sid_IN);
END Xon;
END trace;
All of the real work done in the trace package is contained in a single private
procedure called set_trace.
The public procedures merely call set_trace with different parameter combinations.
This is a structure
that many packages exhibit: private programs with complex functionality exposed
through public programs
with simpler interfaces.
Once set_trace was in place, the publicly visible procedures were trivial.
A final note about the procedure name "xon": I wanted to use the procedure name
"on," but ran afoul of the
PL/SQL compiler since ON is a reserved word in SQL and PL/SQL.
-- TRACING a session:
-----------------------
6.1.
The following INIT.ORA parameters must be set:
#SQL_TRACE = TRUE
USER_DUMP_DEST = <preferred directory for the trace output>
TIMED_STATISTICS = TRUE
MAX_DUMP_FILE_SIZE = <optional, determines trace output file size>
6.2
To enable the SQL trace facility for your current session, enter:
or use
DBMS_SUPPORT.START_TRACE_IN_SESSION(86,43326);
To enable the SQL trace facility for your instance, set the value of the
SQL_TRACE initialization parameter to TRUE. Statistics will be collected for all
sessions.
Once the SQL trace facility has been enabled for the instance,
you can disable it for an individual session by entering:
ALTER SESSION SET SQL_TRACE = FALSE;
6.3
Examples of TKPROF
7 STATSPACK:
------------
Statspack is a set of SQL, PL/SQL, and SQL*Plus scripts that allow the collection,
In this case, SYSDATE+(1/48)' causes the statistics to be gathered each 1/48 day-
every half hour.
To stop and remove the automatic-collection job:
execute dbms_job.remove(<job number>);
Install Statspack:
sqlplus sys
--
-- Install Statspack
-- Enter tablespace names when prompted
--
@?/rdbms/admin/spcreate.sql
--
-- Drop Statspack
-- Reverse of spcreate.sql
--
-- @?/rdbms/admin/spdrop.sql
--
To examine the change in instancewide statistics between two time periods, the
SPREPORT.SQL file is run
while connected to the PERFSTAT user. The SPREPORT.SQL command file is located in
the rdbms/admin directory
of the Oracle home.
===========
21. Overig:
===========
20.1 NLS:
=========
Bij Server:
If clients using different character sets will access the database, then choose a
superset that includes
all client character sets. Otherwise, character conversions may be necessary at
the cost of
increased overhead and potential data loss.
client:
in init.ora: NLS_SORT=ENGLISH
bij client: ALTER SESSION SET NLS_SORT=FRENCH;
Examples:
---------
Example 1:
----------
export NLS_NUMERIC_CHARACTERS=',.'
ALTER SESSION SET NLS_NUMERIC_CHARACTERS=',.'
In SQL functions:
NLS parameters can be used explicitly to hardcode NLS behavior within a SQL
function.
Doing so will override the default values that are set for the session in the
initialization parameter file,
set for the client with environment variables, or set for the session by the ALTER
SESSION statement.
For example:
Example 2:
----------
Session altered.
NAME SAL
---------- ----------
ap 12,53
piet 89,7
SQL> ALTER SESSION SET NLS_NUMERIC_CHARACTERS='.,';
Session altered.
NAME SAL
---------- ----------
ap 12.53
piet 89.7
priority:
---------
1. expliciet in SQL
2. ALTER SESSION
3. environment variable
4. init.ora
Applications can check the session, instance, and database NLS parameters by
querying
the following data dictionary views:
NLS_SESSION_PARAMETERS shows the NLS parameters and their values for the session
that is querying
the view. It does not show information about the character set.
NLS_INSTANCE_PARAMETERS shows the current NLS instance parameters that have been
explicitly set
and the values of the NLS instance parameters.
NLS_DATABASE_PARAMETERS shows the values of the NLS parameters that were used when
the database was created.
Example:
--------
NAME SAL
---------- ----------
ap 12,53
piet 89,7
NAME SAL
---------- ----------
ap 12.53
piet 89.7
Session altered.
2 rows created.
NCHAR, NVARCHAR2 and NCLOB columns. Your current value for the
NLS_NCHAR_CHARACTERSET can be found
with this select: select value from NLS_DATABASE_PARAMETERS where
parameter='NLS_NCHAR_CHARACTERSET';
You cannot have more than 2 charactersets defined in Oracle:
The NLS_CHARACTERSET is used for CHAR, VARCHAR2, CLOB columns;
The NLS_NCHAR_CHARACTERSET is used for NCHAR, NVARCHAR2, NCLOB columns.
NLS_NCHAR_CHARACTERSET is defined when the database is created and specified with
the
CREATE DATABASE command. The NLS_NCHAR_CHARACTERSET defaults to AL16UTF16 if
nothing is specified.
There are three datatypes which can store data in the national character set:
If you use N-types, DO use the (N'...') syntax when coding it so that Literals
are
denoted as being in the national character set by prepending letter 'N', for
example:
On a 9i database created without (!) the "sample" shema you will see these rows
(or less) returned:
OWNER TABLE_NAME
------------------------------ ------------------------------
SYS ALL_REPPRIORITY
SYS DBA_FGA_AUDIT_TRAIL
SYS DBA_REPPRIORITY
SYS DEFLOB
SYS STREAMS$_DEF_PROC
SYS USER_REPPRIORITY
SYSTEM DEF$_LOB
SYSTEM DEF$_TEMP$LOB
SYSTEM REPCAT$_PRIORITY
9 rows selected.
These SYS and SYSTEM tables may contain data if you are using:
If you do have created the database with the DBCA and included
the sample shema then you will see typically:
OWNER TABLE_NAME
------------------------------------------------------------
OE BOMBAY_INVENTORY
OE PRODUCTS
OE PRODUCT_DESCRIPTIONS
OE SYDNEY_INVENTORY
OE TORONTO_INVENTORY
PM PRINT_MEDIA
SYS ALL_REPPRIORITY
SYS DBA_FGA_AUDIT_TRAIL
SYS DBA_REPPRIORITY
SYS DEFLOB
SYS STREAMS$_DEF_PROC
SYS USER_REPPRIORITY
SYSTEM DEF$_LOB
SYSTEM DEF$_TEMP$LOB
SYSTEM REPCAT$_PRIORITY
15 rows selected.
The OE and PM tables contain just sample data and can be dropped if needed.
- If you have more tables then the SYS / SYSTEM tables listed in point 3)
(and they are also not the "sample" tables) then there are two possible cases:
* Again, the next to points are *only* relevant when you DO have n-type USER
data *
Then your will need to export your data and drop it before upgrading.
We recommend that you follow this note:
Note 159657.1
<http://metalink.oracle.com/metalink/plsql/showdoc?db=NOT&id=159657.1> Complete
Upgrade Checklist for Manual Upgrades from 8.X / 9.0.1 to Oracle9i
For more info about the National Character Set in Oracle8 see Note 62107.1
<http://metalink.oracle.com/metalink/plsql/showdoc?db=NOT&id=62107.1>
That may happen if you have not set the ORA_NLS33 environment parameter correctly
to the 9i Oracle_Home during the upgrade.
Note 77442.1
<http://metalink.oracle.com/metalink/plsql/showdoc?db=NOT&id=77442.1> ORA_NLS
(ORA_NLS32, ORA_NLS33, ORA_NLS10) Environment Variables explained.
6) Can I change the AL16UTF16 to UTF8 / I hear that there are problems with
AL16UTF16.
----------------------------------------------------------------------------------
----
a) If you do *not* use N-types then there is NO problem at all with AL16UTF16
because you are simply not using it and we strongly advice you the keep
the default AL16UTF16 NLS_NCHAR_CHARACTERSET.
b) If you *do* use N-types then there will be a problem with 8i clients and
lower accessing the N-type columns (note that you will NOT have a problem
selecting from "normal" non-N-type columns).
More info about that is found there:
Note 140014.1
<http://metalink.oracle.com/metalink/plsql/showdoc?db=NOT&id=140014.1> ALERT
Oracle8/8i to Oracle9i/10g using New "AL16UTF16" National Character Set
Note 236231.1
<http://metalink.oracle.com/metalink/plsql/showdoc?db=NOT&id=236231.1> New
Character Sets Not Supported For Use With Developer 6i And Older Versions
This is one of the 2 reasons why you should use UTF8 as NLS_NCHAR_CHARACTERSET.
If you are NOT using N-type columns with pre-9i clients then there is NO reason
to go to UTF8.
c) If you want to change to UTF8 because you are using transportable tablespaces
from 8i database
then check if are you using N-types in the 8i database that are included in the
tablespaces that you are transporting.
If not, then leave it to AL16UTF16 and log a tar for the solution of the ORA-
19736
and refer to this document.
d) You are in one of the 2 situations where it's really needed to change from
AL16UTF16 to UTF8,
log a tar so that we can assist you.
provide:
1) the output from:
2) a CSSCAN output
IMPORTANT:
Please *DO* install the version 1.2 or higher from TechNet for you version.
http://technet.oracle.com/software/tech/globalization/content.html
and use this.
copy all scripts and executables found in the zip file you downloaded
to your oracle_home overwriting the old versions.
Then run csminst.sql using these commands and SQL statements:
cd $ORACLE_HOME/rdbms/admin
set oracle_sid=<your SID>
sqlplus "sys as sysdba"
SQL>set TERMOUT ON
SQL>set ECHO ON
SQL>spool csminst.log
SQL> START csminst.sql
Upload the 3 resulting files and the output of the select while creating the tar
important:
Do NOT use the N_SWITCH.SQL script, this will corrupt you NCHAR data !!!!!!
7) Is the AL32UTF8 problem the same as the AL16UTF16 / do I need the same patches?
----------------------------------------------------------------------------------
No, they may look similar but are 2 different issues.
If you are not using N-types then keep the default AL16UTF16 or use UTF8,
it doesn't matter if you don't use the types.
There is one condition in which this "limitation" can have a undisired affect,
when you are importing an Oracle8i Transportable Tablespace into Oracle9i
you can run into a ORA-19736 (as wel with AL16UTF16 as with UTF8).
In that case log a TAR, refer to this note and ask to assign the TAR to the
NLS/globalization team. That team can then assist you to work around this
issue.
As clearly stated in
Note 158577.1
<http://metalink.oracle.com/metalink/plsql/showdoc?db=NOT&id=158577.1>
NLS_LANG Explained (How does Client-Server Character Conversion Work?)
point "1.2 What is this NLS_LANG thing anyway?"
* NLS_LANG is used to let Oracle know what characterset you client's OS is USING
so that Oracle can do (if needed) conversion from the client's characterset to
the
database characterset.
UTF8 is possible so that you can use it (when needed) for 8.x backwards
compatibility.
In all other conditions AL16UTF16 is the preferred and best value.
AL16UTF16 has the same unicode revision as AL23UTF8,
so there is no need for AL32UTF8 as NLS_NCHAR_CHARACTERSET.
11) I have the message "( possible ncharset conversion )" during import.
------------------------------------------------------------------------
- But even in the case that you use N-types like NCHAR or NCLOB then this is not a
problem:
* the database will convert from the "old" NCHAR characterset to the new one
automatically.
(and - unlike the "normal" characterset - the NLS_LANG has no impact on this
conversion
during exp/imp)
* AL16UTF16 or UTF8 (the only 2 possible values in 9i) are unicode characterset
and so
can store any character... So no data loss is to be expected.
12) Can i use AL16UTF16 as NLS_CHARACTERSET ?
----------------------------------------------
13) I'm inserting <special character> in a Nchar or Nvarchar2 col but it comes
back as ? or ? ...
----------------------------------------------------------------------------------
----------------
Note 260893.1
<http://metalink.oracle.com/metalink/plsql/showdoc?db=NOT&id=260893.1>
Unicode character sets in the Oracle database
This is not true for (N)CLOB, they are both encoded a internal fixed-width Unicode
character set
Note 258114.1
<http://metalink.oracle.com/metalink/plsql/showdoc?db=NOT&id=258114.1>
Possible action for CLOB/NCLOB storage after 10g upgrade
so they will use the same amount of disk space.
For a single-byte character set encoding, the character and byte length are
the same. However, multi-byte character set encodings do not correspond to
the bytes, making sizing the column more difficult.
Hence the reason why CHAR semantics was introduced. However, we still have some
physical underlying byte based limits and development has choosen to allow the
full usage
of the underlying limits. This results in the following table giving the
maximum amount
of CHARarcters occupying the MAX datalength that can be stored for a cer
datatype in 9i and up.
The MAX colum is the MAXIMUM amount of CHARACTERS that can be stored
occupying the MAXIMUM data len seen that UTF8 and AL32UTF8 are VARRYING
charactersets this means that a string of X chars can be X to X*3 (or X*4 for
AL32) bytes.
The MIN col is the maximum size that you can *define* and that Oracle can store
if all data
is the MINIMUM datalength (1 byte for AL32UTF8 and UTF8) for that characet.
N-types (NVARCHAR2, NCHAR) are *always* defined in CHAR semantics, you cannot
define them in BYTE.
This means that if you try to store more then 666 characters
that occupy 3 bytes in UTF8 in a CHAR UTF8 colum you still will get a
ORA-01401: inserted value too large for column
(or from 10g onwards: ORA-12899: value too large for column )
error, even if you have defined the colum as CHAR (2000 CHAR)
so here it might be a good idea to define that column as NCHAR
that will raise the MAX to 1000 char's ...
Note 144808.1
<http://metalink.oracle.com/metalink/plsql/showdoc?db=NOT&id=144808.1> Examples
and limits of BYTE and CHAR semantics usage
* You might have some problems with older clients if using AL16UTF16
see point 6) b) in this note
* Be sure that you use (AL32)UTF8 as NLS_CHARACTERSET , otherwise you will run
into
point 13 of this note.
* Do not expect a higher *performance* by using AL16UTF16, it might be faster
on some systems, but that has more to do with I/O then with the database kernel.
* If you use N-types, DO use the (N'...') syntax when coding it so that Literals
are
denoted as being in the national character set by prepending letter 'N', for
example:
16) I have a message running DBUA (Database Upgrade Assistant) about NCHAR type
when upgrading from 8i .
AL16UTF16
The default Oracle character set for the SQL NCHAR data type, which is used for
the national character set.
It encodes Unicode data in the UTF-16 encoding.
AL32UTF8
An Oracle character set for the SQL CHAR data type, which is used for the database
character set.
It encodes Unicode data in the UTF-8 encoding.
Unicode
Unicode is a universal encoded character set that allows you information from any
language to be stored
by using a single character set. Unicode provides a unique code value for every
character, regardless
of the platform, program, or language.
Unicode database
A database whose database character set is UTF-8.
Unicode datatype
A SQL NCHAR datatype (NCHAR, NVARCHAR2, and NCLOB). You can store Unicode
characters in columns
of these datatypes even if the database character set is not Unicode.
UTFE
A Unicode 3.0 UTF-8 Oracle database character set with 6-byte supplementary
character support.
It is used only on EBCDIC platforms.
UTF8
The UTF8 Oracle character set encodes characters in one, two, or three bytes.
It is for ASCII-based platforms. The UTF8 character set supports Unicode 3.0.
Although specific supplementary characters were not assigned code points in
Unicode until
version 3.1, the code point range was allocated for supplementary characters in
Unicode 3.0.
Supplementary characters are treated as two separate, user-defined characters that
occupy 6 bytes.
UTF-8
The 8-bit encoding of Unicode. It is a variable-width encoding. One Unicode
character can
be 1 byte, 2 bytes, 3 bytes, or 4 bytes in UTF-8 encoding. Characters from the
European scripts
are represented in either 1 or 2 bytes. Characters from most Asian scripts are
represented in
3 bytes. Supplementary characters are represented in 4 bytes.
UTF-16
The 16-bit encoding of Unicode. It is an extension of UCS-2 and supports the
supplementary characters
defined in Unicode 3.1 by using a pair of UCS-2 code points.
One Unicode character can be 2 bytes or 4 bytes in UTF-16 encoding.
Characters (including ASCII characters) from European scripts and most Asian
scripts are
represented in 2 bytes. Supplementary characters are represented in 4 bytes.
wide character
A fixed-width character format that is useful for extensive text processing
because it allows data to be processed in consistent, fixed-width chunks. Wide
characters are intended to support internal character processing
+------------+---------+-----------------+
| Charset | RDBMS | Unicode version |
+------------+---------+-----------------+
| AL24UTFFSS | 7.2-8.1 | 1.1 |
| | | |
| UTF8 | 8.0-10g | 2.1 (8.0-8.1.7) |
| | | 3.0 (8.1.7-10g) |
| | | |
| UTFE | 8.0-10g | 2.1 (8.0-8.1.7) |
| | | 3.0 (8.1.7-10g) |
| | | |
| AL32UTF8 | 9.0-10g | 3.0 (9.0) |
| | | 3.1 (9.2) |
| | | 3.2 (10.1) |
| | | |
| AL16UTF16 | 9.0-10g | 3.0 (9.0) |
| | | 3.1 (9.2) |
| | | 3.2 (10.1) |
+------------+---------+-----------------+
AL24UTFFSS
AL24UTFFSS was the first Unicode character set supported by Oracle. Is was
introduced in Oracle 7.2. The AL24UTFFSS encoding scheme was based on the
Unicode 1.1 standard, which is now obsolete. AL24UTFFSS has been de-supported
from Oracle9i. The migration path for existing AL24UTFFSS databases is to
upgrade the database to 8.0 or 8.1, then upgrade the character set to UTF8
before upgrading the database further to 9i or 10g.
[NOTE:234381.1]
<http://metalink.oracle.com/metalink/plsql/ml2_documents.showDocument?p_id=234381.
1&p_database_id=NOT> Changing AL24UTFFSS to UTF8 - AL32UTF8 with ALTER DATABASE
CHARACTERSET
UTF8
UTF8 was the UTF-8 encoded character set in Oracle8 and 8i. It followed the
Unicode 2.1 standard between Oracle 8.0 and 8.1.6, and was upgraded to Unicode
version 3.0 for versions 8.1.7, 9i and 10g. To maintain compatibility with
existing installations this character set will remain at Unicode 3.0 in future
Oracle releases. Although specific supplementary characters were not assigned
to Unicode until version 3.1, the allocation for these characters were already
defined in 3.0. So if supplementary characters are inserted in a UTF8 database,
it will not corrupt the actual data inside the database. They will be treated as
2 separate undefined characters, occupying 6 bytes in storage. We recommend that
customers switch to AL32UTF8 for full supplementary character support.
UTFE
This is the UTF8 database character set for the EDCDIC platforms. It has the
same properties as UTF8 on ASCII based platforms. The EBCDIC Unicode
transformation format is documented in Unicode Technical Report #16 UTF-EBCDIC.
Which can be found at http://www.unicode.org/unicode/reports/tr16/
AL32UTF8
This is the UTF-8 encoded character set introduced in Oracle9i. AL32UTF8 is the
database character set that supports the latest version (3.2 in 10g) of the
Unicode standard. It also provides support for the newly defined supplementary
characters. All supplementary characters are stored as 4 bytes.
AL32UTF8 was introduced because when UTF8 was designed (in the times of Oracle8)
there was no concept of supplementary characters, therefore UTF8 has a maximum
of 3 bytes per character. Changing the design of UTF8 would break backward
compatibility, so a new character set was introduced. The introduction of
surrogate pairs should mean that no significant architecture changes are needed
in future versions of the Unicode standard, so the plan is to keep enhancing
AL32UTF8 as necessary to support future version of the Unicode standard, for
example work is now underway to make sure we support Unicode 4.0 in AL32UTF8
in the release after 10.1.
AL16UTF16
This is the first UTF-16 encoded character set in Oracle. It was introduced in
Oracle9i as the default national character set (NLS_NCHAR_CHARACTERSET).
AL16UTF16 supports the latest version (3.2 in 10g) of the Unicode standard.
It also provides support for the newly defined supplementary characters.
All supplementary characters are stored as 4 bytes.
As with AL32UTF8, the plan is to keep enhancing AL16UTF16 as
necessary to support future version of the Unicode standard.
AL16UTF16 cannot be used as a database character set (NLS_CHARACTERSET),
only as the national character set (NLS_NCHAR_CHARACTERSET).
The database character set is used to identify and to hold SQL,
SQL metadata and PL/SQL source code. It must have either single byte 7-bit ASCII
or single byte EBCDIC as a subset, whichever is native to the deployment
platform. Therefore, it is not possible to use a fixed-width, multi-byte
character set (such as AL16UTF16) as the database character set.
Trying to create a database with AL16UTF16 a characterset in 9i and up will give
"ORA-12706: THIS CREATE DATABASE CHARACTER SET IS NOT ALLOWED".
Further reading
---------------
All the above information is taken from the white paper "Oracle Unicode database
support". The paper itself contains much more information and is available from:
http://otn.oracle.com/tech/globalization/pdf/TWP_Unicode_10gR1.pdf
References
----------
The following URLs contain a complete list of hex values and character
descriptions for every Unicode character:
Unicode Version 3.2: http://www.unicode.org/Public/3.2-Update/UnicodeData-
3.2.0.txt
Unicode Version 3.1: http://www.unicode.org/Public/3.1-Update/UnicodeData-
3.1.0.txt
Unicode Version 3.0: http://www.unicode.org/Public/3.0-Update/UnicodeData-
3.0.0.txt
Unicode Versions 2.x:
http://www.unicode.org/unicode/standard/versions/enumeratedversions.html
Unicode Version 1.1: http://www.unicode.org/Public/1.1-Update/UnicodeData-
1.1.5.txt
A description of the file format can be found at:
http://www.unicode.org/Public/UNIDATA/UnicodeData.html
For a glossarry of unicode terms, see:
http://www.unicode.org/glossary/
On above locations you can find the unicode standard, all characters are there
referenced with their UCS-2 codepoint
Note 1:
-------
I should have clarified : the jdbc drivers don't support these 6-bytes
utf8 surrogate pairs. That's the reason why we introduced al32utf8 as
one of the native character set (ascii, isolatin1, utf8, al32utf8, ucs2,
al24utffss).
Note 2:
-------
> AL32UTF8
> The AL32UTF8 character set encodes characters in one to three bytes.
> Surrogate
> pairs require four bytes. It is for ASCII-based platforms.
>
> UTF8
> The UTF8 character set encodes characters in one to three bytes. Surrogate
> pairs
> require six bytes. It is for ASCII-based platforms.
>
> AL32UTF8
> ---------
> Advantages
> ----------
> 1. Surrogate pair Unicode characters
> are stored in the standard 4 bytes
> representation, and there is no
> data conversion upon retrieval
> and insertion of those surrogate
> characters. Also, the storage for
> those characters requires less disk
> space than that of the same
> characters encoded in UTF8.
>
> Disadvantages
> -------------
> 1. You cannot specify the length of SQL CHAR
> types in the number of characters (Unicode
> code points) for surrogate characters. For
> example, surrogate characters are treated as
> one code point rather than the standard of two
> code points.
> 2. The binary order for SQL CHAR columns is
> different from that of SQL NCHAR columns
> when the data consists of surrogate pair
> Unicode characters. As a result, CHAR columns
> NCHAR columns do not always have the same
> sort for identical strings.
>
> UTF8
> ----
> Advantages
> ----------
> 1. You can specify the length of SQL
> CHAR types as a number of
> characters.
> 2. The binary order on the SQL CHAR
> columns is always the same as
> that of the SQL NCHAR columns
> when the data consists of the same
> surrogate pair Unicode characters.
> As a result, CHAR columns and
> NCHAR columns have the same
> sort for identical strings.
>
> Disadvantages
> -------------
> 1. Surrogate pair Unicode characters are stored
> as 6 bytes instead of the 4 bytes defined by the
> Unicode standard. As a result, Oracle has to
> convert data for those surrogate characters.
>
> I dont understand the 1st disadvantage of AL32UTF8 encoding !! If surrogate
> characters are considered 1 codepoint, then if I declare a CHAR column as of
> length 40 characters (codepoints) , then I can enter 40 surrogate
> characters.
Note 3:
-------
Note 4:
-------
Note 5:
-------
Hi Tom,
We migrated our DB 8.1.7 to 9.2.In 8.1.7 we used UTF8 character set.It remains
same in 9.2.
We know that Oracle 9.2 doesn't have UTF8 but AL32UTF8.
Can we keep this UTF8 or have to change to AL32UTF8.
If we need to change, may we do it by :
alter database character set AL32UTF8
or
we must use exp/imp utility?
Regards
Followup:
what do you mean -- utf8 is still a valid character set?
Note 6:
-------
Hi Tom,
We are migrating from oracle 8.1.6 to oracle 9 R2. We have about 14 oracle
instance. All instances have WE8ISO88591P1
character set. Our company is expanding globally so we are thinking to use
unicode character set with oracle 9.
I have few questions on this issue.
5) What will be the size of the database? Our production DB size is currently
50GB. What it would be in unicode?
Thanks
Your plsql routines may will have to change -- your data model may well have to
change.
You'll find that in utf, european characters (except ascii -- 7bit data) all
take 2 bytes. That varchar2(80) you have in your database? It might only hold
40 characters of eurpean data (or even less of other kinds of data). It is 80
bytes (you can use the new 9i syntax varchar2( N char ) -- it'll allocate in
characters, not bytes).
So, you could find your 80 character description field cannot hold 80
characters.
You might find that x := a || b; fails -- with string to long in your plsql code
due to the increased size.
You might find that your string intensive routines run slower (substr(x,1,80) is
no longer byte 1 .. byte 80 -- Oracle has to look through the string to find
where characters start and stop -- it is more complex)
chr(10) and chr(13) should work find, they are simple ASCII.
On clob -- same impact as on varchar2, same issues.
Your database could balloon to 200gb, but it will be somewhere between 50 and
200. As unicode is a VARYING WIDTH encoding scheme, it is impossible to be
precise -- it is not a fixed width scheme, so we don't know how big your strings
will get to be.
Rowid's: Every table row has an internal rowid which contains information about
object_id, block_id, file#.
Also you can query on the "logical" number rownum.
ID NAME
--------- --------------------
1 joop
2 gerrit
ROWNUM
---------
1
2
ROWID
------------------
AAAI92AAQAAAFXbAAA
AAAI92AAQAAAFXbAAB
- DBMS_ROWID:
DBMS_ROWID.
format: OOOOOOFFFBBBBBRRRR
000000=object_id
FFF=relative datafile number
BBBBB=block_id
RRR=row in block
DBMS_ROWID EXAMPLES:
--------------------
SELECT DBMS_ROWID.ROWID_TO_EXTENDED(ROWID,null,null,0),
DBMS_ROWID.ROWID_TO_RESTRICTED(ROWID,0), rownum
FROM CHARLIE.XYZ;
SELECT dbms_rowid.rowid_block_number(rowid)
FROM emp
WHERE ename = 'KING';
SELECT dbms_rowid.rowid_block_number(rowid)
FROM TCMLOGDBUSER.EVENTLOG
WHERE id = 5;
This example returns the ROWID for a row in the EMP table, extracts the data
object number
FROM the ROWID, using the ROWID_OBJECT function in the DBMS_ROWID package, then
displays the object number:
DECLARE
object_no INTEGER;
row_id ROWID;
BEGIN
SELECT ROWID INTO row_id FROM TCMLOGDBUSER.EVENTLOG
WHERE id=5;
object_no := dbms_rowid.rowid_object(row_id);
dbms_output.put_line('The obj. # is '|| object_no);
END;
/
OWNER
------------------------------
OBJECT_NAME
-----------------------------------------------------------
SUBOBJECT_NAME OBJECT_ID DATA_OBJECT_ID
------------------------------ ---------- --------------
OBJECT_TYPE CREATED LAST_DDL_ TIMESTAMP
------------------ --------- --------- -------------------
STATUS T G S
------- - - -
TCMLOGDBUSER
EVENTLOG
28954 28954
TABLE 05-DEC-04 05-DEC-04 2004-12-05:22:26:10
VALID N N N
To access the non-Oracle data store using generic connectivity, the agent works
with an ODBC driver. Oracle8i provides support for the ODBC driver interface.
The driver that you use must be on the same machine as the agent.
The non-Oracle data stores can reside on the same machine as Oracle8i or a
different machine.
Agent processes are usually started when a user session makes its first
non-Oracle system access through a database link. These connections are made using
Oracle's remote data access software, Oracle Net Services, which enables both
client-server and server-server communication. The agent process continues to run
until the user session is disconnected or the database link is explicitly closed.
Oracle has Generic Connectivity agents for ODBC and OLE DB that enable you to use
ODBE and OLEDB drivers to access non-Oracle systems that have an ODBC or an OLE DB
interface.
Setup:
------
1. HS datadictonary
-------------------
To install the data dictionary tables and views for Heterogeneous Services, you
must run a script
that creates all the Heterogeneous Services data dictionary tables, views, and
packages.
On most systems the script is called caths.sql and resides in
$ORACLE_HOME/rdbms/admin.
------------------------------------------------------------------------------
tnsnames examples:
Sybase_sales= (DESCRIPTION=
(ADDRESS=(PROTOCOL=tcp)
(HOST=dlsun206) -- local machine
(PORT=1521)
)
(CONNECT_DATA = (SERVICE_NAME=SalesDB)
)
(HS = OK)
)
TNSNAMES.ORA hsmsql =
(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = tcp)(host=winhost)(port=1521)) ) -- local
machine
(CONNECT_DATA =
(SID = msql)
) -- needs to match the sid in
listener.ora.
(HS=OK)
)
)
TG4MSQL.WORLD =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = ukp15340)(PORT = 1528) )
(CONNECT_DATA = (SID = tg4msql)
)
(HS = OK)
)
-------------------------------------------------------------------------------
listener.ora examples:
LISTENER =
(ADDRESS_LIST =
(ADDRESS= (PROTOCOL=tcp)
(HOST = dlsun206)
(PORT = 1521)
)
)
...
SID_LIST_LISTENER =
(SID_LIST =
(SID_DESC = (SID_NAME=SalesDB)
(ORACLE_HOME=/home/oracle/megabase/9.0.1)
(PROGRAM=tg4mb80)
(ENVS=LD_LIBRARY_PATH=non_oracle_system_lib_directory)
)
)
LISTENER.ORA
LISTENER = (DESCRIPTION_LIST =
(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = TCP)(HOST = winhost)(PORT = 1521)) ) )
Create the Initialization file. Oracle supplies a sample initialization file named
INITMSQL.ORA
# HS init parameters
#
HS_FDS_CONNECT_INFO = msql <= odbc data_source_name
HS_FDS_TRACE_LEVEL = 0 <= trace levels 0 - 4 (4 is verbose)
HS_FDS_TRACE_FILE_NAME = hsmsql.trc <= trace file name #
# Environment variables required for the non-Oracle system #
#set <envvar>=<value>
HS_FDS_SHAREABLE_NAME
Default value:
none
Range of values:
not applicable
HS_FDS_SHAREABLE_NAME:
Specifies the full path name to the ODBC library. This parameter is required when
you are
using generic connectivity to access data from an ODBC provider on a UNIX machine.
Common Errors:
--------------
AGTCTL.exe = ORA-28591 unable to access parameter file, ORA-28592 agent SID not
set
agentctl
hsodbc.exe =
caths.sql
SET AGTCTL_ADMIN=\OPT\ORACLE\ORA81\HS\ADMIN
Error: ORA-28592 Text: agent control utility: agent SID not set
---------------------------------------------------------------------------
Cause: The agent needs to know the value of the AGENT_SID parameter before it
can process any commands. If it does not have a value for AGENT_SID
then all commands will fail.
Action: Issue the command SET AGENT_SID <value> and then retry the command
that failed.
Error:
------
fix:
Set the HS_FDS_TRACE_FILE_NAME to a filename:
HS_FDS_TRACE_FILE_NAME = test.log
or comment it out:
#HS_FDS_TRACE_FILE_NAME
Error: ORA-02085
----------------
HS_FDS_CONNECT_INFO = <SystemDSN_name>
HS_FDS_TRACE_LEVEL = 0
HS_FDS_TRACE_FILE_NAME = c:\hs.log
HS_DB_NAME = exhsodbc -- case sensitive
HS_DB_DOMAIN = ch.oracle.com -- case sensitive
ERROR: ORA-02085
----------------
LD_LIBRARY_PATH=/u06/home/oracle/support/network/ODBC/lib
f the LD_LIBRARY_PATH does not contain the path to the ODBC library, a
dd the ODBC library path and start the listener with this environment.
When the listener launches the agent hsodbc, the agent inherits the
environment from the listener and needs to have the ODBC library path in order
to access the ODBC shareable file. The shareable file is defined in
the init<sid>.ora file located in the $ORACLE_HOME/hs/admin directory.
HS_FDS_SHAREABLE_NAME=/u06/home/oracle/support/network/ODBC/lib/libodbc.so
Note 1:
-------
Oracle trace events are useful for debugging the Oracle database server. The
following two examples
are simply to demonstrate syntax. Refer to later notes on this page for an
explanation of what these
particular events do.
Events can be activated by either adding them to the INIT.ORA parameter file. E.g.
The alter session method only affects the user's current session, whereas changes
to the INIT.ORA file will
affect all sessions once the database has been restarted.
The following events are frequently used by DBAs and Oracle Support to diagnose
problems:
10046 trace name context forever, level 4
Trace SQL statements and show bind variables in trace output.
- The following list of events are examples only. They might be version specific,
so please call Oracle before using them:
10210 trace name context forever, level 10
10211 trace name context forever, level 10
10231 trace name context forever, level 10
These events prevent database block corruptions
ALTER SESSION SET EVENTS '1652 trace name errorstack level 1 ';
or
alter system set events '1652 trace name errorstack level 1 ';
alter system set events '1652 trace name errorstack off ';
Note 2:
-------
This document describes the different types of Oracle EVENT that exist to help
customers and Oracle Support Services when investigating Oracle RDBMS related
issues.
The information held here is of use to Oracle DBAs, developers and Oracle
Support Services.
[NOTE:75713.1] <ml2_documents.showDocument?p_id=75713.1&p_database_id=NOT>
"Important Customer information about
using Numeric Events"
Setting EVENTS
--------------
How you set an event depends on the nature of the event and the circumstances
at the time. As stated above, specific information on how you set a given event
should be provided by Oracle Support Services or the Support related article
that is suggesting the use of a given event.
Most events can be set using more than one of the following methods :
o As INIT parameters
o In the current session
o From another session using a Debug tool
INIT Parameters
~~~~~~~~~~~~~~~
Syntax:
Reference:
Current Session
~~~~~~~~~~~~~~~
Syntax:
o ORADEBUG
o ORAMBX (VMS only)
ORADEBUG :
========
Syntax:
Reference:
[NOTE:29786.1] <ml2_documents.showDocument?p_id=29786.1&p_database_id=NOT>
"SUPTOOL: ORADEBUG 7.3+ (Server Manager/SQLPLUS Debug Commands)"
[NOTE:1058210.6] <ml2_documents.showDocument?p_id=1058210.6&p_database_id=NOT>
"HOW TO ENABLE SQL TRACE FOR ANOTHER SESSION USING ORADEBUG"
[NOTE:29062.1] <ml2_documents.showDocument?p_id=29062.1&p_database_id=NOT>
"SUPTOOL: ORAMBX (VMS) - Quick Reference"
This note will not enter into additional details on these tools.
EVENT Categories
----------------
The most commonly used events fall into one of four categories :
For example:
ALTER SESSION SET EVENTS 'IMMEDIATE trace name ERRORSTACK level 3';
The on-error dump Event is similar to the immediate dump Event with the
difference being that the trace output is only produced when the given
error occurs.
You can use virtually any standard Oracle error to trigger this type of
event.
For example, an ORA-942 "table or view does not exist" error does not include
the name of the problem table or view. When this is not obvious from the
application (due to its complexity), then it can be difficult to investigate
the source of the problem. However, an On-Error dump against the 942 error can
help narrow the search.
For example:
For example:
Summary
-------
EVENT usage and syntax can be very complex and due to the possible impact on
the database, great care should be taken when dealing with them.
RELATED DOCUMENTS
-----------------
[NOTE:75713.1] <ml2_documents.showDocument?p_id=75713.1&p_database_id=NOT>
Important Customer information about using Numeric Events
[NOTE:21235.1] <ml2_documents.showDocument?p_id=21235.1&p_database_id=NOT>
EVENT: 10262 "Do not check for memory leaks"
[NOTE:21154.1] <ml2_documents.showDocument?p_id=21154.1&p_database_id=NOT>
EVENT: 10046 "enable SQL statement tracing (including binds/waits)"
[NOTE:160178.1] <ml2_documents.showDocument?p_id=160178.1&p_database_id=NOT> How
to set EVENTS in the SPFILE
[NOTE:1058210.6] <ml2_documents.showDocument?p_id=1058210.6&p_database_id=NOT> HOW
TO ENABLE SQL TRACE FOR ANOTHER SESSION USING ORADEBUG
[NOTE:29786.1] <ml2_documents.showDocument?p_id=29786.1&p_database_id=NOT>
SUPTOOL: ORADEBUG 7.3+ (Server Manager/SQLPLUS Debug Commands)
[NOTE:29062.1] <ml2_documents.showDocument?p_id=29062.1&p_database_id=NOT>
SUPTOOL: ORAMBX (VMS) - Quick Reference
======================
22. DBA% and v$ views
======================
NLS:
----
VIEW_NAME OWNER
------------------------------ ------------------------------
NLS_DATABASE_PARAMETERS SYS
NLS_INSTANCE_PARAMETERS SYS
NLS_SESSION_PARAMETERS SYS
DBA:
----
VIEW_NAME OWNER
------------------------------ ------------------------------
DBA_2PC_NEIGHBORS SYS
DBA_2PC_PENDING SYS
DBA_ALL_TABLES SYS
DBA_ANALYZE_OBJECTS SYS
DBA_ASSOCIATIONS SYS
DBA_AUDIT_EXISTS SYS
DBA_AUDIT_OBJECT SYS
DBA_AUDIT_SESSION SYS
DBA_AUDIT_STATEMENT SYS
DBA_AUDIT_TRAIL SYS
DBA_CACHEABLE_OBJECTS SYS
DBA_CACHEABLE_TABLES SYS
DBA_CACHEABLE_TABLES_BASE SYS
DBA_CATALOG SYS
DBA_CLUSTERS SYS
DBA_CLUSTER_HASH_EXPRESSIONS SYS
DBA_CLU_COLUMNS SYS
DBA_COLL_TYPES SYS
DBA_COL_COMMENTS SYS
DBA_COL_PRIVS SYS
DBA_CONSTRAINTS SYS
DBA_CONS_COLUMNS SYS
DBA_CONTEXT SYS
DBA_DATA_FILES SYS
DBA_DB_LINKS SYS
DBA_DEPENDENCIES SYS
DBA_DIMENSIONS SYS
DBA_DIM_ATTRIBUTES SYS
DBA_DIM_CHILD_OF SYS
DBA_DIM_HIERARCHIES SYS
DBA_DIM_JOIN_KEY SYS
DBA_DIM_LEVELS SYS
DBA_DIM_LEVEL_KEY SYS
DBA_DIRECTORIES SYS
DBA_DMT_FREE_SPACE SYS
DBA_DMT_USED_EXTENTS SYS
DBA_ERRORS SYS
DBA_EXP_FILES SYS
DBA_EXP_OBJECTS SYS
DBA_EXP_VERSION SYS
DBA_EXTENTS SYS
DBA_FREE_SPACE SYS
DBA_FREE_SPACE_COALESCED SYS
DBA_FREE_SPACE_COALESCED_TMP1 SYS
DBA_FREE_SPACE_COALESCED_TMP2 SYS
DBA_FREE_SPACE_COALESCED_TMP3 SYS
DBA_IAS_CONSTRAINT_EXP SYS
DBA_IAS_GEN_STMTS SYS
DBA_IAS_GEN_STMTS_EXP SYS
DBA_IAS_OBJECTS SYS
DBA_IAS_OBJECTS_BASE SYS
DBA_IAS_OBJECTS_EXP SYS
DBA_IAS_POSTGEN_STMTS SYS
DBA_IAS_PREGEN_STMTS SYS
DBA_IAS_SITES SYS
DBA_IAS_TEMPLATES SYS
DBA_INDEXES SYS
DBA_INDEXTYPES SYS
DBA_INDEXTYPE_OPERATORS SYS
DBA_IND_COLUMNS SYS
DBA_IND_EXPRESSIONS SYS
DBA_IND_PARTITIONS SYS
DBA_IND_SUBPARTITIONS SYS
DBA_INTERNAL_TRIGGERS SYS
DBA_JAVA_POLICY SYS
DBA_JOBS SYS
DBA_JOBS_RUNNING SYS
DBA_LIBRARIES SYS
DBA_LMT_FREE_SPACE SYS
DBA_LMT_USED_EXTENTS SYS
DBA_LOBS SYS
DBA_LOB_PARTITIONS SYS
DBA_LOB_SUBPARTITIONS SYS
DBA_METHOD_PARAMS SYS
DBA_METHOD_RESULTS SYS
DBA_MVIEWS SYS
DBA_MVIEW_AGGREGATES SYS
DBA_MVIEW_ANALYSIS SYS
DBA_MVIEW_DETAIL_RELATIONS SYS
DBA_MVIEW_JOINS SYS
DBA_MVIEW_KEYS SYS
DBA_NESTED_TABLES SYS
DBA_OBJECTS SYS
DBA_OBJECT_SIZE SYS
DBA_OBJECT_TABLES SYS
DBA_OBJ_AUDIT_OPTS SYS
DBA_OPANCILLARY SYS
DBA_OPARGUMENTS SYS
DBA_OPBINDINGS SYS
DBA_OPERATORS SYS
DBA_OUTLINES SYS
DBA_OUTLINE_HINTS SYS
DBA_PARTIAL_DROP_TABS SYS
DBA_PART_COL_STATISTICS SYS
DBA_PART_HISTOGRAMS SYS
DBA_PART_INDEXES SYS
DBA_PART_KEY_COLUMNS SYS
DBA_PART_LOBS SYS
DBA_PART_TABLES SYS
DBA_PENDING_TRANSACTIONS SYS
DBA_POLICIES SYS
DBA_PRIV_AUDIT_OPTS SYS
DBA_PROFILES SYS
DBA_QUEUES SYS
DBA_QUEUE_SCHEDULES SYS
DBA_QUEUE_TABLES SYS
DBA_RCHILD SYS
DBA_REFRESH SYS
DBA_REFRESH_CHILDREN SYS
DBA_REFS SYS
DBA_REGISTERED_SNAPSHOTS SYS
DBA_REGISTERED_SNAPSHOT_GROUPS SYS
DBA_REPAUDIT_ATTRIBUTE SYS
DBA_REPAUDIT_COLUMN SYS
DBA_REPCAT SYS
DBA_REPCATLOG SYS
DBA_REPCAT_REFRESH_TEMPLATES SYS
DBA_REPCAT_TEMPLATE_OBJECTS SYS
DBA_REPCAT_TEMPLATE_PARMS SYS
DBA_REPCAT_TEMPLATE_SITES SYS
DBA_REPCAT_USER_AUTHORIZATIONS SYS
DBA_REPCAT_USER_PARM_VALUES SYS
DBA_REPCOLUMN SYS
DBA_REPCOLUMN_GROUP SYS
DBA_REPCONFLICT SYS
DBA_REPDDL SYS
DBA_REPFLAVORS SYS
DBA_REPFLAVOR_COLUMNS SYS
DBA_REPFLAVOR_OBJECTS SYS
DBA_REPGENERATED SYS
DBA_REPGENOBJECTS SYS
DBA_REPGROUP SYS
DBA_REPGROUPED_COLUMN SYS
DBA_REPGROUP_PRIVILEGES SYS
DBA_REPKEY_COLUMNS SYS
DBA_REPOBJECT SYS
DBA_REPPARAMETER_COLUMN SYS
DBA_REPPRIORITY SYS
DBA_REPPRIORITY_GROUP SYS
DBA_REPPROP SYS
DBA_REPRESOLUTION SYS
DBA_REPRESOLUTION_METHOD SYS
DBA_REPRESOLUTION_STATISTICS SYS
DBA_REPRESOL_STATS_CONTROL SYS
DBA_REPSCHEMA SYS
DBA_REPSITES SYS
DBA_RGROUP SYS
DBA_ROLES SYS
DBA_ROLE_PRIVS SYS
DBA_ROLLBACK_SEGS SYS
DBA_RSRC_CONSUMER_GROUPS SYS
DBA_RSRC_CONSUMER_GROUP_PRIVS SYS
DBA_RSRC_MANAGER_SYSTEM_PRIVS SYS
DBA_RSRC_PLANS SYS
DBA_RSRC_PLAN_DIRECTIVES SYS
DBA_RULESETS SYS
DBA_SEGMENTS SYS
DBA_SEQUENCES SYS
DBA_SNAPSHOTS SYS
DBA_SNAPSHOT_LOGS SYS
DBA_SNAPSHOT_LOG_FILTER_COLS SYS
DBA_SNAPSHOT_REFRESH_TIMES SYS
DBA_SOURCE SYS
DBA_STMT_AUDIT_OPTS SYS
DBA_SUBPART_COL_STATISTICS SYS
DBA_SUBPART_HISTOGRAMS SYS
DBA_SUBPART_KEY_COLUMNS SYS
DBA_SUMMARIES SYS
DBA_SUMMARY_AGGREGATES SYS
DBA_SUMMARY_DETAIL_TABLES SYS
DBA_SUMMARY_JOINS SYS
DBA_SUMMARY_KEYS SYS
DBA_SYNONYMS SYS
DBA_SYS_PRIVS SYS
DBA_TABLES SYS
DBA_TABLESPACES SYS
DBA_TAB_COLUMNS SYS
DBA_TAB_COL_STATISTICS SYS
DBA_TAB_COMMENTS SYS
DBA_TAB_HISTOGRAMS SYS
DBA_TAB_MODIFICATIONS SYS
DBA_TAB_PARTITIONS SYS
DBA_TAB_PRIVS SYS
DBA_TAB_SUBPARTITIONS SYS
DBA_TEMP_FILES SYS
DBA_TRIGGERS SYS
DBA_TRIGGER_COLS SYS
DBA_TS_QUOTAS SYS
DBA_TYPES SYS
DBA_TYPE_ATTRS SYS
DBA_TYPE_METHODS SYS
DBA_UNUSED_COL_TABS SYS
DBA_UPDATABLE_COLUMNS SYS
DBA_USERS SYS
DBA_USTATS SYS
DBA_VARRAYS SYS
DBA_VIEWS SYS
V_$:
----
VIEW_NAME OWNER
------------------------------ ------------------------------
V_$ACCESS SYS
V_$ACTIVE_INSTANCES SYS
V_$AQ SYS
V_$AQ1 SYS
V_$ARCHIVE SYS
V_$ARCHIVED_LOG SYS
V_$ARCHIVE_DEST SYS
V_$ARCHIVE_PROCESSES SYS
V_$BACKUP SYS
V_$BACKUP_ASYNC_IO SYS
V_$BACKUP_CORRUPTION SYS
V_$BACKUP_DATAFILE SYS
V_$BACKUP_DEVICE SYS
V_$BACKUP_PIECE SYS
V_$BACKUP_REDOLOG SYS
V_$BACKUP_SET SYS
V_$BACKUP_SYNC_IO SYS
V_$BGPROCESS SYS
V_$BH SYS
V_$BSP SYS
V_$BUFFER_POOL SYS
V_$BUFFER_POOL_STATISTICS SYS
V_$CIRCUIT SYS
V_$CLASS_PING SYS
V_$COMPATIBILITY SYS
V_$COMPATSEG SYS
V_$CONTEXT SYS
V_$CONTROLFILE SYS
V_$CONTROLFILE_RECORD_SECTION SYS
V_$COPY_CORRUPTION SYS
V_$DATABASE SYS
V_$DATAFILE SYS
V_$DATAFILE_COPY SYS
V_$DATAFILE_HEADER SYS
V_$DBFILE SYS
V_$DBLINK SYS
V_$DB_CACHE_ADVICE SYS
V_$DB_OBJECT_CACHE SYS
V_$DB_PIPES SYS
V_$DELETED_OBJECT SYS
V_$DISPATCHER SYS
V_$DISPATCHER_RATE SYS
V_$DLM_ALL_LOCKS SYS
V_$DLM_CONVERT_LOCAL SYS
V_$DLM_CONVERT_REMOTE SYS
V_$DLM_LATCH SYS
V_$DLM_LOCKS SYS
V_$DLM_MISC SYS
V_$DLM_RESS SYS
V_$DLM_TRAFFIC_CONTROLLER SYS
V_$ENABLEDPRIVS SYS
V_$ENQUEUE_LOCK SYS
V_$EVENT_NAME SYS
V_$EXECUTION SYS
V_$FAST_START_SERVERS SYS
V_$FAST_START_TRANSACTIONS SYS
V_$FILESTAT SYS
V_$FILE_PING SYS
V_$FIXED_TABLE SYS
V_$FIXED_VIEW_DEFINITION SYS
V_$GLOBAL_BLOCKED_LOCKS SYS
V_$GLOBAL_TRANSACTION SYS
V_$HS_AGENT SYS
V_$HS_PARAMETER SYS
V_$HS_SESSION SYS
V_$INDEXED_FIXED_COLUMN SYS
V_$INSTANCE SYS
V_$INSTANCE_RECOVERY SYS
V_$KCCDI SYS
V_$KCCFE SYS
V_$LATCH SYS
V_$LATCHHOLDER SYS
V_$LATCHNAME SYS
V_$LATCH_CHILDREN SYS
V_$LATCH_MISSES SYS
V_$LATCH_PARENT SYS
V_$LIBRARYCACHE SYS
V_$LICENSE SYS
V_$LOADCSTAT SYS
V_$LOADISTAT SYS
V_$LOADPSTAT SYS
V_$LOADTSTAT SYS
V_$LOCK SYS
V_$LOCKED_OBJECT SYS
V_$LOCKS_WITH_COLLISIONS SYS
V_$LOCK_ACTIVITY SYS
V_$LOCK_ELEMENT SYS
V_$LOG SYS
V_$LOGFILE SYS
V_$LOGHIST SYS
V_$LOGMNR_CONTENTS SYS
V_$LOGMNR_DICTIONARY SYS
V_$LOGMNR_LOGS SYS
V_$LOGMNR_PARAMETERS SYS
V_$LOG_HISTORY SYS
V_$MAX_ACTIVE_SESS_TARGET_MTH SYS
V_$MLS_PARAMETERS SYS
V_$MTS SYS
V_$MYSTAT SYS
V_$NLS_PARAMETERS SYS
V_$NLS_VALID_VALUES SYS
V_$OBJECT_DEPENDENCY SYS
V_$OBSOLETE_PARAMETER SYS
V_$OFFLINE_RANGE SYS
V_$OPEN_CURSOR SYS
V_$OPTION SYS
V_$PARALLEL_DEGREE_LIMIT_MTH SYS
V_$PARAMETER SYS
V_$PARAMETER2 SYS
V_$PQ_SESSTAT SYS
V_$PQ_SLAVE SYS
V_$PQ_SYSSTAT SYS
V_$PQ_TQSTAT SYS
V_$PROCESS SYS
V_$PROXY_ARCHIVEDLOG SYS
V_$PROXY_DATAFILE SYS
V_$PWFILE_USERS SYS
V_$PX_PROCESS SYS
V_$PX_PROCESS_SYSSTAT SYS
V_$PX_SESSION SYS
V_$PX_SESSTAT SYS
V_$QUEUE SYS
V_$RECOVERY_FILE_STATUS SYS
V_$RECOVERY_LOG SYS
V_$RECOVERY_PROGRESS SYS
V_$RECOVERY_STATUS SYS
V_$RECOVER_FILE SYS
V_$REQDIST SYS
V_$RESERVED_WORDS SYS
V_$RESOURCE SYS
V_$RESOURCE_LIMIT SYS
V_$ROLLNAME SYS
V_$ROLLSTAT SYS
V_$ROWCACHE SYS
V_$ROWCACHE_PARENT SYS
V_$ROWCACHE_SUBORDINATE SYS
V_$RSRC_CONSUMER_GROUP SYS
V_$RSRC_CONSUMER_GROUP_CPU_MTH SYS
V_$RSRC_PLAN SYS
V_$RSRC_PLAN_CPU_MTH SYS
V_$SESSION SYS
V_$SESSION_CONNECT_INFO SYS
V_$SESSION_CURSOR_CACHE SYS
V_$SESSION_EVENT SYS
V_$SESSION_LONGOPS SYS
V_$SESSION_OBJECT_CACHE SYS
V_$SESSION_WAIT SYS
V_$SESSTAT SYS
V_$SESS_IO SYS
V_$SGA SYS
V_$SGASTAT SYS
V_$SHARED_POOL_RESERVED SYS
V_$SHARED_SERVER SYS
V_$SORT_SEGMENT SYS
V_$SORT_USAGE SYS
V_$SQL SYS
V_$SQLAREA SYS
V_$SQLTEXT SYS
V_$SQLTEXT_WITH_NEWLINES SYS
V_$SQL_BIND_DATA SYS
V_$SQL_BIND_METADATA SYS
V_$SQL_CURSOR SYS
V_$SQL_SHARED_CURSOR SYS
V_$SQL_SHARED_MEMORY SYS
V_$STATNAME SYS
V_$SUBCACHE SYS
V_$SYSSTAT SYS
V_$SYSTEM_CURSOR_CACHE SYS
V_$SYSTEM_EVENT SYS
V_$SYSTEM_PARAMETER SYS
V_$SYSTEM_PARAMETER2 SYS
V_$TABLESPACE SYS
V_$TARGETRBA SYS
V_$TEMPFILE SYS
V_$TEMPORARY_LOBS SYS
V_$TEMPSTAT SYS
V_$TEMP_EXTENT_MAP SYS
V_$TEMP_EXTENT_POOL SYS
V_$TEMP_PING SYS
V_$TEMP_SPACE_HEADER SYS
V_$THREAD SYS
V_$TIMER SYS
V_$TRANSACTION SYS
V_$TRANSACTION_ENQUEUE SYS
V_$TYPE_SIZE SYS
V_$VERSION SYS
V_$WAITSTAT SYS
V_$_LOCK SYS
==========
23 TUNING:
==========
1. init.ora settings
--------------------
background_dump_dest = /var/opt/oracle/SALES/bdump
control_files = ( /oradata/arc/control/ctrl1SALES.ctl
, /oradata/temp/control/ctrl2SALES.ctl
, /oradata/rbs/control/ctrl3SALES.ctl)
db_block_size = 16384
db_name = SALES
db_block_buffers = 17500
db_block_checkpoint_batch = 16
db_files = 255
db_file_multiblock_read_count = 10
license_max_users = 170
#core_dump_dest = /var/opt/oracle/SALES/cdump
core_dump_dest = /oradata/rbs/cdump
distributed_transactions = 40
dml_locks = 1000
job_queue_processes = 2
log_archive_buffers = 20
log_archive_buffer_size = 256
log_archive_dest = /oradata/arc
log_archive_format = arcSALES_%s.arc
log_archive_start = true
log_buffer = 163840
log_checkpoint_interval = 1250
log_checkpoint_timeout = 1800
log_simultaneous_copies = 4
max_dump_file_size = 100240
max_enabled_roles = 50
oracle_trace_enable = true
open_cursors = 2000
open_links = 20
processes = 200
remote_os_authent = true
rollback_segments = (r1, r2, r3, rbig,rbig2)
sequence_cache_entries = 30
sequence_cache_hash_buckets = 23
shared_pool_size = 750M
sort_area_retained_size = 15728640
sort_area_size = 15728640
sql_trace = false
timed_statistics = true
resource_limit = true
user_dump_dest = /var/opt/oracle/SALES/udump
utl_file_dir = /var/opt/oracle/utl
utl_file_dir = /var/opt/oracle/utl/frontend
3. STATSPACK:
-------------
Available as of 8.1.6
installation:
- connect internal
- @$ORACLE_HOME/rdbms/admin/statscre.sql
It will create user PERFSTAT who ownes the new statistics tables
You will be prompted for TEMP and DEFAULT tablespaces
Gather statistices:
- connect perfstat/perfstat
- execute statspack.snap
Create report:
- connect perfstat/perfstat
- @ORACLE_HOME/rdbms/admin/statsrep.sql
This will ask for beginning snapshot id and ending snapshot id.
Then you can enter the filename for the report.
4. QUERIES:
-----------
SELECT (1-(pr.value/(dbg.value+cg.value)))*100
FROM v$sysstat pr, v$sysstat dbg, v$sysstat cg
WHERE pr.name = 'physical reads'
AND dbg.name = 'db block gets'
AND cg.name = 'consistent gets';
SELECT (req.value*5000)/entries.value
FROM v$sysstat req, v$sysstat entries
WHERE req.name ='redo log space requests'
AND entries.name='redo entries';
Overview memory:
How often an object has to be reloaded into the cache once it has been loaded
-- report 1.
exec dbms_output.put_line('===================================================');
exec dbms_output.put_line('SECTION 2: TABLESPACES, DATAFILES, ROLLBACK SEGS');
exec dbms_output.put_line('===================================================');
exec dbms_output.put_line(' ');
exec dbms_output.put_line('---------------------------------------------------');
exec dbms_output.put_line('2.1 FREE/USED SPACE OF TABLESPACES RIGHT NOW:');
exec dbms_output.put_line(' ');
exec dbms_output.put_line('---------------------------------------------------');
exec dbms_output.put_line('3.4 DATABASE BUFFERS HIT RATIO:');
exec dbms_output.put_line(' ');
SELECT (1-(pr.value/(dbg.value+cg.value)))*100
FROM v$sysstat pr, v$sysstat dbg, v$sysstat cg
WHERE pr.name = 'physical reads'
AND dbg.name = 'db block gets'
AND cg.name = 'consistent gets';
SELECT (req.value*5000)/entries.value
FROM v$sysstat req, v$sysstat entries
WHERE req.name ='redo log space requests'
AND entries.name='redo entries';
SELECT OBJECT_ID,SESSION_ID,USERNAME,OSUSER,PROCESS,LOCKMODE,
OBJECT_NAME, to_char(DATUM, 'DD-MM-YYYY;HH24:MI')
FROM PROJECTS.LOCKLIST
WHERE DATUM > SYSDATE-2
ORDER BY DATUM;
exec dbms_output.put_line('---------------------------------------------------');
exec dbms_output.put_line('---------------------------------------------------');
exec dbms_output.put_line('END REPORT 1');
exec dbms_output.put_line('Thanks a lot for reading this report !!!');
exit
/
========
24 RMAN:
========
$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$
$$$$$
===============
24.1: RMAN 10g:
===============
10g example:
------------
RMAN> exit
RMAN> run {
2> backup database plus archivelog;
3> delete noprompt obsolete;
4> }
If the controlfiles and online redo logs are still present a whole database
recovery can be achieved
by running the following script:
run {
shutdown immediate; # use abort if this fails
startup mount;
restore database;
recover database;
alter database open;
}
This will result in all datafiles being restored then recovered. RMAN will apply
archive logs
as necessary until the recovery is complete. At that point the database is opened.
If the tempfiles are still present you can issue a command like like the following
for each of them:
run {
sql 'ALTER TABLESPACE users OFFLINE IMMEDIATE';
restore tablespace users;
recover tablespace users;
sql 'ALTER TABLESPACE users ONLINE';
}
run {
allocate channel dev1 type 'sbt_tape';
sql "ALTER TABLESPACE tbs_1 OFFLINE IMMEDIATE";
restore tablespace tbs_1;
recover tablespace tbs_1;
sql "ALTER TABLESPACE tbs_1 ONLINE";
}
run {
allocate channel dev1 type disk;
allocate channel dev2 type 'sbt_tape';
sql "ALTER TABLESPACE tbs_1 OFFLINE IMMEDIATE";
set newname for datafile 'disk7/oracle/tbs11.f'
to 'disk9/oracle/tbs11.f';
restore tablespace tbs_1;
switch datafile all;
recover tablespace tbs_1;
sql "ALTER TABLESPACE tbs_1 ONLINE";
}
As you would expect, RMAN allows incomplete recovery to a specified time, SCN or
sequence number:
run {
shutdown immediate;
startup mount;
set until time 'Nov 15 2000 09:00:00';
# set until scn 1000; # alternatively, you can specify SCN
# set until sequence 9923; # alternatively, you can specify log sequence number
restore database;
recover database;
alter database open resetlogs;
}
The incomplete recovery requires the database to be opened using the RESETLOGS
option.
In a disaster situation where all files are lost you can only recover to the last
SCN in the archived redo logs.
Beyond this point the recovery would have to make reference to the online redo
logs which are not present.
Disaster recovery is therefore a type of incomplete recovery. To perform disaster
recovery connect to RMAN:
startup nomount;
restore controlfile;
alter database mount;
ARCHIVELOG_CHANGE#-1
--------------------
1048438
1 row selected.
run {
set until scn 1048438;
restore database;
recover database;
alter database open resetlogs;
}
If the "until scn" were not set the following type of error would be produced once
a redo log was referenced:
RMAN-00571: ===========================================================
RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ===============
RMAN-00571: ===========================================================
RMAN-03002: failure of recover command at 03/18/2003 09:33:19
RMAN-06045: media recovery requesting unknown log: thread 1 scn 1048439
With the database open all missing tempfiles must be replaced:
The recovered database will be registered in the catalog as a new incarnation. The
current incarnation
can be listed and altered using the following commands:
list incarnation;
reset database to incarnation x;Lists And Reports
RMAN has extensive listing and reporting functionality allowing you to monitor you
backups and maintain
the recovery catalog. Here are a few useful commands:
The SWITCH command is the RMAN equivalent of the SQL statement ALTER DATABASE
RENAME FILE.
# When the database is open, run the following SQL statement to force Oracle to
switch out of
the current log and archive it as well as all other unarchived logs:
ALTER SYSTEM ARCHIVE LOG CURRENT;
# When the database is mounted, open, or closed, you can run the following SQL
statement to force Oracle
to archive all noncurrent redo logs:
ALTER SYSTEM ARCHIVE LOG ALL;
=============
LIST COMMAND:
=============
List commands query the catalog or control file, to determine which backups or
copies are available.
List commands provide for basic information.
Report commands can provide for much more detail.
The primary purpose of the LIST command is to determine which backups are
available. For example, you can list:
. Backups and proxy copies of a database, tablespace, datafile, archived redo log,
or control file
. Backups that have expired
. Backups restricted by time, path name, device type, tag, or recoverability
. Incarnations of a database
By default, RMAN lists backups by backup, which means that it serially lists each
backup or proxy copy
and then identifies the files included in the backup. You can also list backups by
file.
By default, RMAN lists in verbose mode. You can also list backups in a summary
mode if the verbose mode
generates too much output.
LIST BACKUP; # lists backup sets, image copies, and proxy copies
LIST BACKUPSET; # lists only backup sets and proxy copies
LIST COPY; # lists only disk copies
Example:
By default the LIST output is detailed, but you can also specify that RMAN display
the output in summarized form.
Specify the desired objects with the listObjectList or recordSpec clause. If you
do not specify an object,
then LIST BACKUP displays all backups.
After connecting to the target database and recovery catalog (if you use one),
execute LIST BACKUP,
specifying the desired objects and options. For example:
LIST BACKUP SUMMARY; # lists backup sets, proxy copies, and disk copies
You can also specify the EXPIRED keyword to identify those backups that were not
found during a crosscheck:
================
Report commands:
================
RMAN>report schema;
-- REPORT COMMAND:
-- ---------------
Reports which database files require backup because they have been affected by
some NOLOGGING operation
such as a direct-path insert
You can report backup sets, backup pieces and datafile copies that are obsolete,
that is, not needed
to meet a specified retention policy, by specifying the OBSOLETE keyword. If you
do not specify any
other options, then REPORT OBSOLETE displays the backups that are obsolete
according to the current
retention policy, as shown in the following example:
RMAN> REPORT OBSOLETE;
In the simplest case, you could crosscheck all backups on disk, tape or both,
using any one
of the following commands:
The REPORT SCHEMA command lists and displays information about the database files.
After connecting RMAN to the target database and recovery catalog (if you use
one), issue REPORT SCHEMA
as shown in this example:
RMAN displays backups that are obsolete according to those retention policies,
regardless of the actual configured retention policy.
When you execute the BACKUP command in RMAN, you create one or more backup sets or
image copies. By default,
RMAN creates backup sets regardless of whether the destination is disk or a media
manager.
An image copy is an exact copy of a single datafile, archived redo log file, or
control file.
Image copies are not stored in an RMAN-specific format. They are identical to the
results of copying a file
with operating system commands. RMAN can use image copies during RMAN restore and
recover operations,
and you can also use image copies with non-RMAN restore and recovery techniques.
To create image copies and have them recorded in the RMAN repository, run the RMAN
BACKUP AS COPY command
(or, alternatively, configure the default backup type for disk as image copies
using
CONFIGURE DEVICE TYPE DISK BACKUP TYPE TO COPY before performing a backup).
A database server session is used to create the copy, and the server session also
performs actions such as
validating the blocks in the file and recording the image copy in the RMAN
repository.
You can also use an operating system command such as the UNIX dd command to create
image copies,
though these will not be validated, nor are they recorded in the RMAN repository.
You can use the CATALOG command
to add image copies created with native operating system tools in the RMAN
repository.
If you run a RESTORE command, then by default RMAN restores a datafile or control
file to its original location
by copying an image copy backup to that location. Image copies are chosen over
backup sets because of the
extra overhead of reading through an entire backup set in search of files to be
restored.
However, if you need to restore and recover a current datafile, and if you have an
image copy of the datafile
available on disk, then you do not actually need to have RMAN copy the image copy
back to its old location.
You can instead have the database use the image copy in place, as a replacement
for the datafile to be restored.
The SWITCH command updates the RMAN repository indicate that the image copy should
now be treated as
the current datafile. Issuing the SWITCH command in this case is equivalent to
issuing the SQL statement
ALTER DATABASE RENAME FILE. You can then perform recovery on the copy.
RMAN can use image copies created by mechanisms outside of RMAN, such as native
operating system file copy commands
or third-party utilities that leave image copies of files on disk. These copies
are known as user-managed copies
or operating system copies.
The RMAN CATALOG command causes RMAN to inspect an existing image copy and enter
its metadata into the RMAN repository.
Once cataloged, these files can be used like any other backup with the RESTORE or
SWITCH commands.
Some sites store their datafiles on mirrored disk volumes, which permit the
creation of image copies by breaking
a mirror. After you have broken the mirror, you can notify RMAN of the existence
of a new user-managed copy,
thus making it a candidate for a backup operation. You must notify RMAN when the
copy is no longer available,
by using the CHANGE ... UNCATALOG command. In this example, before resilvering the
mirror (not including other
copies of the broken mirror), you must use a CHANGE ... UNCATALOG command to
update the recovery catalog
and indicate that this copy is no longer available.
RMAN can create backups on disk or a third-party media device such as a tape
drive. If you specify
DEVICE TYPE DISK, then your backups are created on disk, in the file name space of
the target instance
that is creating the backup. You can make a backup on any device that can store a
datafile.
To create backups on non-disk media, such as tape, you must use third-party media
management software,
and allocate channels with device types, such as SBT, that are supported by that
software.
There are several features of RMAN backups specific to backups of archived redo
logs.
Note:
RMAN issues an error if you attempt to run BACKUP AS COPY BACKUPSET.
The BACKUP BACKUPSET command uses the default disk channel to copy backup sets
from disk to disk.
To back up from disk to tape, you must either configure or manually allocate a
non-disk channel.
In this way, you ensure that all your backups exist on both disk and tape. You can
also duplex backups
of backup sets, as in this example:
You can also use BACKUP BACKUPSET to manage backup space allocation. For example,
to keep more recent backups
on disk and older backups only on tape, you can regularly run the following
command:
BACKUP DEVICE TYPE sbt BACKUPSET COMPLETED BEFORE 'SYSDATE-7' DELETE INPUT;
This command backs up backup sets that were created more than a week ago from disk
to tape, and then deletes
them from disk. Note that DELETE INPUT here is equivalent to DELETE ALL INPUT;
RMAN deletes all
existing copies of the backup set. If you duplexed a backup to four locations,
then RMAN deletes
all four copies of the pieces in the backup set.
Use the RMAN RESTORE command to restore the following types of files from disk or
other media:
Because a backup set is in a proprietary format, you cannot simply copy it as you
would a backup database file
created with an operating system utility; you must use the RMAN RESTORE command to
extract its contents.
In contrast, the database can use image copies created by the RMAN BACKUP AS COPY
command
without additional processing.
RMAN automates the procedure for restoring files. You do not need to go into the
operating system,
locate the backup that you want to use, and manually copy files into the
appropriate directories.
When you issue a RESTORE command, RMAN directs a server session to restore the
correct backups to either:
- The default location, overwriting the files with the same name currently there
- A new location, which you can specify with the SET NEWNAME command
To restore a datafile, either mount the database or keep it open and take the
datafile to be restored offline.
When RMAN performs a restore, it creates the restored files as datafile image
copies and records them
in the repository. The following table describes the behavior of the RESTORE, SET
NEWNAME, and SWITCH commands.
The generic steps for media recovery using RMAN are as follows:
-Place the database in the appropriate state: mounted or open. For example, mount
the database
when performing whole database recovery, or open the database when performing
online tablespace recovery.
-To perform incomplete recovery, use the SET UNTIL command to specify the time,
SCN,
or log sequence number at which recovery terminates. Alternatively, specify the
UNTIL clause
on the RESTORE and RECOVER commands.
-Restore the necessary files with the RESTORE command.
-Recover the datafiles with the RECOVER command.
-Place the database in its normal state. For example, open it or bring recovered
tablespaces online.
RESTORE DATABASE;
RECOVER DATABASE;
Although datafile media recovery is the principal form of recovery, you can also
use the RMAN BLOCKRECOVER
command to perform block media recovery. Block media recovery recovers an
individual corrupt datablock
or set of datablocks within a datafile. In cases when a small number of blocks
require media recovery,
you can selectively restore and recover damaged blocks rather than whole
datafiles.
For example, you may discover the following messages in a user trace file:
You can then specify the corrupt blocks in the BLOCKRECOVER command as follows:
BLOCKRECOVER
DATAFILE 7 BLOCK 3
DATAFILE 2 BLOCK 235;
>>> After a Database Restore and Recover, RMAN gives the error:
RMAN-00571: ===========================================================
RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ===============
RMAN-00571: ===========================================================
RMAN-03002: failure of backup command at 03/03/2008 11:13:06
RMAN-06059: expected archived log not found, lost of archived log compromises
recoverability
ORA-19625: error identifying file
/dbms/tdbaeduc/educroca/recovery/archive/arch_1_870_617116679.arch
ORA-27037: unable to obtain file status
IBM AIX RISC System/6000 Error: 2: No such file or directory
Note 1:
If you no longer have a particular archivelog file you can let RMAN catalog
know this by issuing the following command at the rman prompt after
connecting to the rman catalog and the target database -
This will check the archivelog folder and then make the catalog agree with
what is actually available.
Cause
the database incarnation that matches the resetlogs change# and time of the
mounted target database
control file is not the current incarnation of the database
Action
If "reset database to incarnation <key>" was used to make an old incarnation
current then restore the
target database from a backup that matches the incarnation and mount it. You will
need to do "startup nomount"
before you can restore the control file using RMAN.
Otherwise use "reset database to incarnation <key>" make the intended incarnation
current in the recovery catalog.
>>> Note about rman and tape sbt and recovery window:
Suppose you have a retention period defined in rman, like for example
CONFIGURE RETENTION POLICY TO REDUNDANCY 3
This means that 3 backups needs to be maintained by rman, and other backups are
considered "obsolete".
But those other backups beyond retention, are not expired or otherwise not usable.
If they are still present, you can use them in a recovery.
Besides this, it cannot be known beforehand how the tape subsystem will deal with
rman commands
like "delete obsolete". The tape subsystem has probably its own retention period,
and you need
much more details about all systems involved, before you know whats going on.
=============================================
24.1.3.2 ABOUT RMAN ERRORS / troubleshooting:
=============================================
Problem: If an archived redo is missing, you might get a message similar like
this:
RMAN-00571: ===========================================================
RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ===============
RMAN-00571: ===========================================================
RMAN-03002: failure of backup command at 03/05/2008 07:44:35
RMAN-06059: expected archived log not found, lost of archived log compromises
recoverability
ORA-19625: error identifying file
/dbms/tdbaeduc/educroca/recovery/archive/arch_1_817_617116679.arch
ORA-27037: unable to obtain file status
IBM AIX RISC System/6000 Error: 2: No such file or directory
Solution:
RMAN-06059: expected archived log not found, lost of archived log compromises
recoverability
If you can, you should bring back the missing archved redo logs to their original
location and name, and let rman back them up.
But if that is impossible, the workaround is to �crosscheck archivelog all�, like:
rman <<e1
connect target /
connect catalog username/password@catalog
run {
allocate channel c1 type disk ;
crosscheck archivelog all ;
release channel c1 ;
}
e1
Testcase: a 10g 10.2.0.3 shows after recovery with resetlogs the following
in v$archived_log. It looks as if it will stay there forever:
Q:
Do you really want to delete the above objects (enter YES or NO)? YES
RMAN-00571: ===========================================================
RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ===============
RMAN-00571: ===========================================================
RMAN-03009: failure of delete command on ORA_MAINT_SBT_TAPE_1 channel at
03/02/2005 16:27:06
ORA-27191: sbtinfo2 returned error
Additional information: 2
What in the world does "Additional information: 2" mean? I can't find
any more useful detail than this.
A:
Cause
sbtinfo2 returned an error. This happens while retrieving backup file information
from the media manager"s catalog.
Action
This error is returned from the media management software which is linked with
Oracle. There should be additional messages
which explain the cause of the error. This error usually requires contacting the
media management vendor.
A:
---> ORA-27191
John Clarke:
My guess is that "2" is an O/S return code, and in
/usr/sys/include/errno.h, you'll see that error# 2 is "no such file or
directory. Accompanied with ORA-27191, I'd guess that your problem is
that your tape library doesn't currently have the tape(s) loaded and/or
can't find them.
Mladen Gogala:
Additional information 2 means that OS returned status 2. That is a
"file not found" error. In plain Spanglish, you cannot
delete files from tape, only from the disk drives.
Niall Litchfield:
The source error is the ora-27191 error
(http://download-
west.oracle.com/docs/cd/B14117_01/server.101/b10744/e24280.htm#ORA-27191)
which suggests a tape library issue to me. You can search for RMAN
errors using the error search page as well
http://otn.oracle.com/pls/db10g/db10g.error_search?search=rman-03009, for example
A:
---> RMAN-03009
RMAN-03009: failure of delete command on ORA_MAINT_SBT_TAPE_1 channel at date/time
RMAN-03009: failure of allocate command on t1 channel at date/time
RMAN-03009: failure of backup command on t1 channel at date/time
etc..
-> Means most of the time that you have Media Management Library problems
-> Can also mean that there is a problem with backup destination (disk not found,
no space, tape not loaded etc..)
% sbttest
The program displays the list of possible arguments for the program:
The display also indicates the meaning of each argument. For example, following is
the description for two optional parameters:
Optional parameters:
-dbname specifies the database name which will be used by SBT
to identify the backup file. The default is "sbtdb"
-trace specifies the name of a file where the Media Management
software will write diagnostic messages.
Using the Utility
Use sbttest to perform a quick test of the media manager. The following table
explains how to interpret the output:
0
The program ran without error. In other words, the media manager is installed and
can accept a data stream and
return the same data when requested.
non-0
The program encountered an error. Either the media manager is not installed or it
is not configured correctly.
To use sbttest:
Make sure the program is installed, included in your system path, and linked with
Oracle by typing sbttest at the command line:
% sbttest
Execute the program, specifying any of the arguments described in the online
documentation. For example, enter the following
to create test file some_file.f and write the output to sbtio.log:
You can also test a backup of an existing datafile. For example, this command
tests datafile tbs_33.f of database PROD:
libobk.so could not be loaded. Check that it is installed properly, and that LD_
LIBRARY_PATH environment variable (or its equivalent on your platform) includes
the
directory where this file can be found. Here is some additional information on the
ERR 6: RMAN-12004
=================
Hi,
OR another errorstack
OR another errorstack
OR another errorstack
Have managed to create a job to backup my db, but I can't restore. I get the
following:
RMAN-03002: failure during compilation of command
RMAN-03013: command type: restore
RMAN-03006: non-retryable error occurred during execution of command: IRESTORE
RMAN-07004: unhandled exception during command execution on channel BackupTest
RMAN-10035: exception raised in RPC: ORA-19573: cannot obtain exclusive enqueue
for datafile 1
RMAN-10031: ORA-19583 occurred during call to
DBMS_BACKUP_RESTORE.RESTOREBACKUPPIECE
$$$$
ERR 7: ORA-27211
================
Q:
A:
had a remarkably similar experience a few months ago with Legato NetWorker and
performed all of the steps
you listed with the same results. The problem turned out to be very simple. The
SA installed the 64-bit version
of the Legato Networker client because it is a 64-bit server. However, we were
running a 32-bit version of Oracle on it.
Installing the 32-bit client solved the problem.
A:
A:
Details:
Overview:
The Oracle return code ORA-27211 implies a failure to load a shared object library
into process space.
Oracle Recovery Manager (RMAN) backups will fail with a message "ORA-27211: Failed
to load Media Management Library"
if the SBT_LIBRARY keyword is defined and points to an incorrect library name. The
SBT_LIBRARY keyword must be set
in the PARMS clause of the ALLOCATE CHANNEL statement in the RMAN script. This
keyword is not valid with the SEND command
and is new to Oracle 9i. If this value is set, it overrides the default search
path for the libobk library.
By default, SBT_LIBRARY is not set.
Troubleshooting:
The RMAN log file on the client will show the following error message:
RMAN-00571: ===========================================
RMAN-00569: ======= ERROR MESSAGE STACK FOLLOWS =======
RMAN-00571: ===========================================
RMAN-03009: failure of allocate command on ch00 channel at 05/21/2005 16:39:17
ORA-19554: error allocating device, device type: SBT_TAPE, device name:
ORA-27211: Failed to load Media Management Library
Additional information: 25
Resolution:
The Oracle return code ORA-27211 implies a failure to load a shared object library
into process space.
Oracle RMAN backups will fail with a message "ORA-27211: Failed to load Media
Management Library" if the SBT_LIBRARY keyword
is defined and points to an incorrect library name.
To manually set the SBT_LIBRARY path, follow the steps described below:
1. Modify the RMAN ALLOCATE CHANNEL statement in the backup script to reference
the HP-UX 11.23 library file directly:
PARMS='SBT_LIBRARY=/usr/openv/netbackup/bin/libobk.so'
Note: This setting would be added to each ALLOCATE CHANNEL statement. A restart of
the Oracle instance
is not needed for this change to take affect.
2. Run a test backup or wait for the next scheduled backup of the Oracle database
Note 1:
The Oracle docs note how to install and configure the dbms_backup_restore package:
declare
devtype varchar2(256);
done boolean;
begin
devtype:=dbms_backup_restore.deviceallocate( type=>'sbt_tape',
params=>'ENV=(OB2BARTYPE=Oracle8,OB2APPNAME=rdcs,OB2BARLIST=ORA_RDCS_WEEKLY)',
ident=>'t1');
dbms_backup_restore.restoresetdatafile;
dbms_backup_restore.restorecontrolfileto('D:\oracle\ora81\dbs\CTL1rdcs.ORA');
dbms_backup_restore.restorebackuppiece(
'ORA_RDCS_WEEKLY<rdcs_6222:596513521:1>.dbf', DONE=>done );
dbms_backup_restore.restoresetdatafile;
dbms_backup_restore.restorecontrolfileto('D:\DBS\RDCS\CTL2RDCS.ORA');
dbms_backup_restore.restorebackuppiece(
'ORA_RDCS_WEEKLY<rdcs_6222:596513521:1>.dbf', DONE=>done );
dbms_backup_restore.devicedeallocate('t1');
end;
DECLARE
devtype varchar2(256);
done boolean;
BEGIN
devtype := dbms_backup_restore.DeviceAllocate (type => '',ident => 'FUN');
dbms_backup_restore.RestoreSetDatafile;
dbms_backup_restore.RestoreDatafileTo(dfnumber => 1,toname =>
'D:\ORACLE_BASE\datafiles\SYSTEM01.DBF');
dbms_backup_restore.RestoreDatafileTo(dfnumber => 2,toname =>
'D:\ORACLE_BASE\datafiles\UNDOTBS.DBF');
--dbms_backup_restore.RestoreDatafileTo(dfnumber => 3,toname =>
'D:\ORACLE_BASE\datafiles\MYSPACE.DBF');
dbms_backup_restore.RestoreBackupPiece(done => done,handle =>
'D:\ORACLE_BASE\RMAN_BACKUP\MYDB_DF_BCK05H2LLQP_1_1', params => null);
dbms_backup_restore.DeviceDeallocate;
END;
/
Note 2:
-------
--restore controlfile
DECLARE
devtype varchar2(256);
done boolean;
BEGIN
devtype := dbms_backup_restore.DeviceAllocate(type => '',ident => 'FUN');
dbms_backup_restore.RestoresetdataFile;
dbms_backup_restore.RestoreControlFileto('D:\ORACLE_BASE\controlfiles\CONTROL01.CT
L');
dbms_backup_restore.RestoreBackupPiece('D:\ORACLE_BASE\Rman_Backup\MYDB_DF_BCK0BH1
JBVA_1_1',done => done);
dbms_backup_restore.RestoresetdataFile;
dbms_backup_restore.RestoreControlFileto('D:\ORACLE_BASE\controlfiles\CONTROL02.CT
L');
dbms_backup_restore.RestoreBackupPiece('D:\ORACLE_BASE\Rman_Backup\MYDB_DF_BCK0BH1
JBVA_1_1',done => done);
dbms_backup_restore.RestoresetdataFile;
dbms_backup_restore.RestoreControlFileto('D:\ORACLE_BASE\controlfiles\CONTROL03.CT
L');
dbms_backup_restore.RestoreBackupPiece('D:\ORACLE_BASE\Rman_Backup\MYDB_DF_BCK0BH1
JBVA_1_1',done => done);
dbms_backup_restore.DeviceDeallocate;
END;
/
--restore datafile
DECLARE
devtype varchar2(256);
done boolean;
BEGIN
devtype := dbms_backup_restore.DeviceAllocate (type => '',ident => 'FUN');
dbms_backup_restore.RestoreSetDatafile;
dbms_backup_restore.RestoreDatafileTo(dfnumber => 1,toname =>
'D:\ORACLE_BASE\datafiles\SYSTEM01.DBF');
dbms_backup_restore.RestoreDatafileTo(dfnumber => 2,toname =>
'D:\ORACLE_BASE\datafiles\UNDOTBS.DBF');
--dbms_backup_restore.RestoreDatafileTo(dfnumber => 3,toname =>
'D:\ORACLE_BASE\datafiles\MYSPACE.DBF');
dbms_backup_restore.RestoreBackupPiece(done => done,handle =>
'D:\ORACLE_BASE\RMAN_BACKUP\MYDB_DF_BCK05H2LLQP_1_1', params => null);
dbms_backup_restore.DeviceDeallocate;
END;
/
keys:
RMAN-00554
RMAN-04004
ORA-03135
ORA-3136
> ***********************************************************************
> Fatal NI connect error 12170.
>
> VERSION INFORMATION:
> TNS for IBM/AIX RISC System/6000: Version 10.2.0.3.0 - Production
> TCP/IP NT Protocol Adapter for IBM/AIX RISC System/6000: Version
10.2.0.3.0 - Production
> Oracle Bequeath NT Protocol Adapter for IBM/AIX RISC System/6000:
Version 10.2.0.3.0 - Production
> Time: 18-MAR-2008 23:01:43
> Tracing not turned on.
> Tns error struct:
> ns main err code: 12535
> TNS-12535: TNS:operation timed out
> ns secondary err code: 12606
> nt main err code: 0
> nt secondary err code: 0
> nt OS err code: 0
> Client address: (ADDRESS=(PROTOCOL=tcp)(HOST=57.232.4.123)(PORT=35844))
Note 1:
-------
Is a general error code. You must turn your attention the the codes underneath
this one.
For example:
RMAN-00571: ===========================================================
RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ===============
RMAN-00571: ===========================================================
RMAN-00554: initialization of internal recovery manager package failed
RMAN-06003: ORACLE error from target database:
ORA-00210: cannot open the specified control file
ORA-00202: control file: '/devel/dev02/dev10g/standbyctl.ctl'
RMAN-00571: ===========================================================
RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ===============
RMAN-00571: ===========================================================
RMAN-00554: initialization of internal recovery manager package failed
RMAN-04005: error from target database: ORA-01017: invalid
username/password;
Note 2:
-------
Note 1:
-------
Cause
No archive logs in the specified archive log range could be found.
Action
Check the archive log specifier.
Note 2:
-------
RMAN-20242: Specification does not match any archivelog in the recovery catalog.
Note 3:
-------
Q:
RMAN-20242: specification does not match any archive log in the recovery ca
Posted: Feb 12, 2008 7:52 AM Reply
A couple of archive log files were deleted from the OS. They still show up in the
list of archive logs in Enterprise Manager.
I want to fix this because now whenever I try to run a crosscheck command, I get
the message:
RMAN-20242: specification does not match any archive log in the recovery catalog
I also tried to uncatalog those files, but got the same message.
Thanks!
A:
hi,
from rman run the command
if ther archives are in this list they will show, then i think you should do a
regards
Note 4:
-------
The RMAN error number would be helpful, but this is a common problem - RMAN-20242
- and is addressed in detail in MetaLink notes.
Either the name specification (the one you entered) is wrong, or you could be
using mismatched versions
between RMAN and the database (don't know since you didn't provide any version
details).
Note 5:
-------
Q:
Hi there!
We are having problems with an Oracle backup. The compiling of the backup
command fails with the error message: RMAN-20242: specification does not
match any archivelog in the recovery catalog
But RMAN is only supposed to backup any archived logs that are there and
then insert them in the catalog...
Did anybody experience anything similar?
Thanks,
A:
If i ask rman to backup archivelogs that are more than 2days old and there are
none, thats not an error.
That is when i see it the most, now most companies will force a log switch after a
set amount of time during the day so in DR,
you dont lose days worth of redo that might still be hanging in a redo log if it
gets lost.
$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$
$$$$$
Test Case 1:
============
TEST10G:
startup mount pfile=c:\oracle\admin\test10g\pfile\init.ora
alter database archivelog;
archive log start;
alter database force logging;
alter database add supplemental log data;
alter database open;
commit;
commit;
SQL> select
CHECKPOINT_CHANGE#,CONTROLFILE_SEQUENCE#,ARCHIVE_CHANGE#,CURRENT_SCN,archivelog_ch
ange# from v$database;
DBMS_FLASHBACK.GET_SYSTEM_CHANGE_NUMBER()
-----------------------------------------
890599
SQL> select
CHECKPOINT_CHANGE#,CONTROLFILE_SEQUENCE#,ARCHIVE_CHANGE#,CURRENT_SCN,archivelog_ch
ange# from v$database;
SQL> select
file#,CHECKPOINT_CHANGE#,LAST_CHANGE#,OFFLINE_CHANGE#,ONLINE_CHANGE#,NAME from
v$datafile;
6 rows selected.
commit;
ID NAME
---------- ----------
3 test3
1 test1
2 test2
SQL> select
file#,CHECKPOINT_CHANGE#,LAST_CHANGE#,OFFLINE_CHANGE#,ONLINE_CHANGE#,NAME from
v$datafile;
6 rows selected.
SQL> select
CHECKPOINT_CHANGE#,CONTROLFILE_SEQUENCE#,ARCHIVE_CHANGE#,CURRENT_SCN,archivelog_ch
ange#
from v$database;
SQL> select
file#,CHECKPOINT_CHANGE#,LAST_CHANGE#,OFFLINE_CHANGE#,ONLINE_CHANGE#,NAME from
v$datafil
e;
6 rows selected.
....
1 149 882431 887780
1 150 887780 888889
1 151 888889 889090
1 152 889090 893499
1 153 893499 895665
1 154 895665 896834
1 155 896834 898275
1 156 898275 899008
END TESTCASE 1:
===============
$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$
$$$$$
----------------------------------
The V$RMAN_OUTPUT memory-only view shows the output of a currently executing RMAN
job, whereas the
V$RMAN_STATUS control file view indicates the status of both executing and
completed RMAN jobs.
The V$BACKUP_FILES provides access to the information used as the basis of the
LIST BACKUP and REPORT OBSOLETE commands.
V$RMAN_STATUS
V$BACKUP_FILES
v$archived_log
v$log_history
v$database;
You can also list backups by querying V$BACKUP_FILES and the RC_BACKUP_FILES
recovery catalog view.
These views provide access to the same information as the LIST BACKUPSET command.
----------------------------------
Enhanced Reporting: RESTORE PREVIEW
The PREVIEW option to the RESTORE command can now tell you which backups will be
accessed during a RESTORE operation.
----------------------------------
>> To run RMAN commands interactively, start RMAN and then type commands into the
command-line interface.
For example, you can start RMAN from the UNIX command shell and then execute
interactive commands as follows:
----------------------------------
----------------------------------
Run the CONFIGURE DEFAULT DEVICE TYPE command to specify a default device type for
automatic channels.
For example, you may make backups to tape most of the time and only occasionally
make a backup to disk.
In this case, configure channels for disk and tape devices, but make sbt the
default device type:
Now, RMAN will, by default, use sbt channels for backups. For example, if you run
the following command:
RMAN only allocates channels of type sbt during the backup because sbt is the
default device.
$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$
$$$$$
24.1 Introduction:
------------------
Recovery Manager (RMAN) is an Oracle tool that allows you to back up,
copy, restore, and recover datafiles, control files, and archived redo logs.
It is included with the Oracle server and does not require separate installation.
You can invoke RMAN as a command line utility from the operating system (O/S)
prompt
or use the GUI-based Enterprise Manager Backup Manager.
RMAN users "server sessions" to automate many of the backup and recovery tasks
that
were formerly performed manually. For example, instead of requiring you to
locate appropriate backups for each datafile, copy them to the correct place using
RMAN stores metadata about its backup and recovery operations in the recovery
catalog,
which is a centralized repository of information, or exclusively in the control
file.
Typically, the recovery catalog is stored in a separate database.
If you do not use a recovery catalog, RMAN uses the control file as its repository
of metadata.
!!!! But, for open backups, the database MUST BE in ARCHIVE MODE.
That's true for Oracle 8, 8i, 9i and 10g.
RMAN doesn't do a "begin backup". It is not necessary when you use RMAN.
RMAN does an intelligent copy of the database blocks (as opposed to a simple OS
copy) and it ensures we do not copy a fractured block. The whole purpose of the
begin backup (of the OS type of backup) is to record more info into the redo logs
in the event an OS copy
copies a "fractured block" - where the head and tail do not match (can happen
since we are WRITING to the database at the same time the backup would be
reading). When RMAN hits such a block -- it re-reads it to get a clean copy.
- You can call from unix, or cmd prompt, the RMAN utility:
$ rman
RMAN>
- Or you can give command line paramaters along with the rman call
RMAN uses two basic types of commands: stand-alone commands and job commands.
- The job commands always appear within the brackets of a run command.
- The stand-alone command can be issued right after the RMAN prompt.
RMAN> run {
2> allocate channel d1 type disk;
3> backup database;
4> }
RMAN> run {
allocate channel c1 type disk;
copy datafile 6 to 'F:\oracle\backups\oem01.cpy';
release channel c1;
}
RMAN> run {
allocate channel c1 type disk;
backup format 'F:\oracle\backups\oem01.rbu' ( datafile 6 );
release channel c1;
}
RMAN> run {
allocate channel c1 type 'sbt_tape';
restore database;
recover database;
}
You must allocate a 'channel" before you execute backup and recovery commands.
Each allocated channel establishes a connection from RMAN to a target database
by starting a server session on the instance. This server session performs
the backup and recovery operations.
Only one RMAN session communicates with the allocated server sessions.
You can allocate multiple channels, thus allowing a single RMAN command
to read or write multiple backups or image copies in parallel.
Thus, the number of channels that you allocate affects the degree of parallelism
within a command.
When backing up to tape you should allocate one channel for each physical device,
but when backing up to disk you can allocate as many channels
as necessary for maximum throughput.
The simplest way to determine whether RMAN encountered an error is to examine its
return code.
RMAN returns 0 to the operating system if no errors occurred, 1 otherwise.
For example, if you are running UNIX and using the C shell,
RMAN outputs the return code into a shell variable called $status.
The second easiest way is to search the Recovery Manager output for the
string RMAN-00569, which is the message number for the error stack banner.
All RMAN errors are preceded by this error message.
If you do not see an RMAN-00569 message in the output, then there are no errors.
You can type RMAN commands into a file, and then run the command file
by specifying its name on the command line.
The contents of the command file should be identical
to commands entered at the command line. Suppose the commandfile is
called 'b_whole_l0.rcv', then the rman call could be as in the following example:
Another example:
The RMAN repository is the collection of metadata about your target databases
that RMAN uses to conduct its backup, recovery, and maintenance operations.
You can either create a recovery catalog in which to store this information,
or let RMAN store it exclusively in the target database control file.
Although RMAN can conduct all major backup and recovery operations using
just the control file, some RMAN commands function only when you use a recovery
catalog.
The recovery catalog is maintained solely by RMAN; the target database never
accesses it directly. RMAN propagates information about the database structure,
archived redo logs, backup sets, and datafile copies
into the recovery catalog from the target database's control file.
-Datafile and archived redo log backup sets and backup pieces.
-Datafile copies.
-Archived redo logs and their copies.
-Tablespaces and datafiles on the target database.
-Stored scripts, which are named user-created sequences of RMAN and SQL commands.
The recovery catalog obtains crucial RMAN metadata from the target database
control file.
Resynchronization of the recovery catalog ensures that the metadata that RMAN
obtains
from the control file stays current.
rollback segments (only if the database is open), and online redo logs.
In a full resynchronization, RMAN updates all changed records, including schema
records.
When you issue certain commands in RMAN, the program automatically detects when it
needs
to perform a full or partial resynchronization and executes the operation as
needed.
You can also force a full resynchronization by issuing a 'resync catalog' command.
It is a good idea to run RMAN once a day or so and issue the resync catalog
command
to ensure that the catalog stays current.
Because the control file employs a circular reuse system,
backup and copy records eventually get overwritten.
To utilize tape storage for your database backups, RMAN requires a media manager.
A media manager is a utility that loads, labels,
and unloads sequential media such as tape drives for the purpose of backing up and
recovering data.
Note that Oracle does not need to connect to the media management
library (MML) software when it backs up to disk.
Software that is compliant with the MML interface enables an Oracle server session
24.5 Backups:
-------------
When you execute the backup command, you create one or more backup sets.
A backup set, which is a logical construction, contains one or more physical
backup pieces.
Backup pieces are operating system files that contain the backed up datafiles,
control files, or archived redo logs. You cannot split a file across different
backup sets
or mix archived redo logs and datafiles into a single backup set.
You can either let RMAN determine a unique name for the backup piece or use the
format parameter
to specify a name. If you do not specify a filename, RMAN uses the %U substitution
variable
to guarantee a unique name. The backup command provides substitution variables
that allow you to generate unique filenames.
$ ORACLE_SID=brdb;export ORACLE_SID
$rman
RMAN>connect target sys/password
RMAN .. connected
$rman
RMAN>connect catalog rman/rman
RMAN .. connected
$ ORACLE_SID=brdb;export ORACLE_SID
$rman
RMAN>connect target sys/password
RMAN .. connected
$ ORACLE_SID=brdb;export ORACLE_SID
In 8.1 and later, to setup the Recovery Catalog, use the create catalog command.
$ rman
RMAN>connect catalog rman/rman
28 rows selected.
8, 8i:
------
VIEW_NAME OWNER
------------------------------ -----
RC_ARCHIVED_LOG RMAN
RC_BACKUP_CONTROLFILE RMAN
RC_BACKUP_CORRUPTION RMAN
RC_BACKUP_DATAFILE RMAN
RC_BACKUP_PIECE RMAN
RC_BACKUP_REDOLOG RMAN
RC_BACKUP_SET RMAN
RC_CHECKPOINT RMAN
RC_CONTROLFILE_COPY RMAN
RC_COPY_CORRUPTION RMAN
RC_DATABASE RMAN
RC_DATABASE_INCARNATION RMAN
RC_DATAFILE RMAN
RC_DATAFILE_COPY RMAN
RC_LOG_HISTORY RMAN
RC_OFFLINE_RANGE RMAN
RC_PROXY_CONTROLFILE RMAN
RC_PROXY_DATAFILE RMAN
RC_REDO_LOG RMAN
RC_REDO_THREAD RMAN
RC_RESYNC RMAN
RC_STORED_SCRIPT RMAN
RC_STORED_SCRIPT_LINE RMAN
RC_TABLESPACE RMAN
24 rows selected.
10g:
----
SQL> select view_name from dba_views where view_name like '%RMAN%';
VIEW_NAME
------------------------------
V_$RMAN_CONFIGURATION
GV_$RMAN_CONFIGURATION
V_$RMAN_STATUS
V_$RMAN_OUTPUT
GV_$RMAN_OUTPUT
V_$RMAN_BACKUP_SUBJOB_DETAILS
V_$RMAN_BACKUP_JOB_DETAILS
V_$RMAN_BACKUP_TYPE
MGMT$HA_RMAN_CONFIG
RC_RMAN_OUTPUT
RC_RMAN_BACKUP_SUBJOB_DETAILS
RC_RMAN_BACKUP_JOB_DETAILS
RC_RMAN_BACKUP_TYPE
RC_RMAN_CONFIGURATION
RC_RMAN_STATUS
15 rows selected.
XXXX
RC_RMAN_OUTPUT
RC_BACKUP_FILES
RC_RMAN_BACKUP_SUBJOB_DETAILS
RC_RMAN_BACKUP_JOB_DETAILS
RC_BACKUP_SET_DETAILS
RC_BACKUP_PIECE_DETAILS
RC_BACKUP_COPY_DETAILS
RC_PROXY_COPY_DETAILS
RC_PROXY_ARCHIVELOG_DETAILS
RC_BACKUP_DATAFILE_DETAILS
RC_BACKUP_CONTROLFILE_DETAILS
RC_BACKUP_ARCHIVELOG_DETAILS
RC_BACKUP_SPFILE_DETAILS
RC_BACKUP_SET_SUMMARY
RC_BACKUP_DATAFILE_SUMMARY
RC_BACKUP_CONTROLFILE_SUMMARY
RC_BACKUP_ARCHIVELOG_SUMMARY
RC_BACKUP_SPFILE_SUMMARY
RC_BACKUP_COPY_SUMMARY
RC_PROXY_COPY_SUMMARY
RC_PROXY_ARCHIVELOG_SUMMARY
RC_UNUSABLE_BACKUPFILE_DETAILS
RC_RMAN_BACKUP_TYPE
RC_DATABASE
RC_DATABASE_INCARNATION
RC_RESYNC
RC_CHECKPOINT
RC_TABLESPACE
RC_DATAFILE
RC_TEMPFILE
RC_REDO_THREAD
RC_REDO_LOG
RC_LOG_HISTORY
RC_ARCHIVED_LOG
RC_BACKUP_SET
RC_BACKUP_PIECE
RC_BACKUP_DATAFILE
RC_BACKUP_CONTROLFILE
RC_BACKUP_SPFILE
RC_DATAFILE_COPY
RC_CONTROLFILE_COPY
RC_BACKUP_REDOLOG
RC_BACKUP_CORRUPTION
RC_COPY_CORRUPTION
RC_OFFLINE_RANGE
RC_STORED_SCRIPT
RC_STORED_SCRIPT_LINE
RC_PROXY_DATAFILE
RC_PROXY_CONTROLFILE
RC_RMAN_CONFIGURATION
RC_DATABASE_BLOCK_CORRUPTION
RC_PROXY_ARCHIVEDLOG
RC_RMAN_STATUS
53 rows selected.
Compatibility:
---------------
If you use an 8.1.6 RMAN executable to execute the "create catalog" command,
then the recovery catalog is created as a release 8.1.6 recovery catalog.
Compatibility=8.1.6
You cannot use the 8.1.6 catalog with a pre-8.1.6 release of the RMAN executable.
If you use an 8.1.6 RMAN executable to execute the "upgrade catalog" command,
then the recovery catalog is upgraded from a pre-8.1.6 release to a release 8.1.6
catalog.
Compatibility=8.0.4
The 8.1.6 catalog is backwards compatible with older releases of the RMAN
executable.
To view compatibility:
- The RMAN catalog schema version (tables/views) should be greater than or equal
to the catalog database version.
- The RMAN catalog is backwards compatible with target databases from earlier
releases.
- The versions of the RMAN executable and the target database should be the same
- RMAN cannot create release 8.1 or later catalog schemas in 8.0 catalog
databases.
- make tnsnames.ora OK
Since the catalogs database is an 8.1.7 database, connect to the 8.0.5 catalog
via 8.0.5 SQL*Plus.
$ sqlplus rman80/rman80@alias_to_rcat80
--> connect from the target machine to the 8.0.5 catalog.
SQL> @?/rdbms/admin/catrman.sql
Backup an 8.0.5 database with 8.0.5 RMAN into an 8.0.5 catalog in an 9.2.0 catalog
database.
Register:
---------
or
RMAN>register database
before registering:
SQL> select * from rman.db;
no rows selected
after registering:
SQL> select * from rman.db;
Unregister:
-----------
In SQL*Plus:
SQL>execute dbms_rcvcat.unregisterdatabase(1,2092303715)
If you have opened the target database with the 'RESETLOGS' option,
you have in fact created a new 'incarnation' of the database.
RMAN>reset database;
-- VALIDATE:
-- ---------
You can use the VALIDATE option of the BACKUP command to verify that database
files exist and are in the correct locations,
and have no physical or logical corruptions that would prevent RMAN from creating
backups of them.
When performing a BACKUP... VALIDATE, RMAN reads the files to be backed up in
their entirety, as it would during
a real backup. It does not, however, actually produce any backup sets or image
copies.
If the backup validation discovers corrupt blocks, then RMAN updates the
V$DATABASE_BLOCK_CORRUPTION view
with rows describing the corruptions. You can repair corruptions using block media
recovery, documented in
Oracle Database Backup and Recovery Advanced User's Guide. After a corrupt block
is repaired,
the row identifying this block is deleted from the view.
For example, you can validate that all database files and archived logs can be
backed up by running a command as follows:
The RMAN client displays the same output that it would if it were really backing
up the files.
If RMAN cannot validate the backup of one or more of the files, then it issues an
error message.
For example, RMAN may show output similar to the following:
RMAN-00571: ===========================================================
RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ===============
RMAN-00571: ===========================================================
RMAN-03002: failure of backup command at 08/29/2002 14:33:47
ORA-19625: error identifying file /oracle/oradata/trgt/arch/archive1_6.dbf
ORA-27037: unable to obtain file status
SVR4 Error: 2: No such file or directory
Additional information: 3
-- CONTROLFILE AUTOBACKUP
-- ----------------------
Because the filename for the autobackup uses a well-known format, RMAN can search
for it without access
to a repository, and then restore the server parameter file. After you have
started the instance with the
restored server parameter file, RMAN can restore the control file from an
autobackup. After you mount
the control file, the RMAN repository is available and RMAN can restore the
datafiles and find
the archived redo log.
If the autobackup feature is not set, then you must manually back up the control
file in one of the following ways:
Note:
If the control file block size is not the same as the block size for datafile 1,
then the control file
cannot be written into the same backup set as the datafile. RMAN writes the
control file into a backup set
by itself if the block size is different.
A manual backup of the control file is not the same as a control file autobackup.
In manual backups,
only RMAN repository data for backups within the current RMAN session is in the
control file backup,
and a manually backed-up control file cannot be automatically restored.
Example:
== XXX
RMAN> SET CONTROLFILE AUTOBACKUP FORMAT FOR DEVICE TYPE DISK TO 'controlfile_%F';
RMAN> BACKUP AS COPY DATABASE;
RMAN> RUN {
SET CONTROLFILE AUTOBACKUP FORMAT FOR DEVICE TYPE DISK TO '/tmp/%F.bck';
BACKUP AS BACKUPSET DEVICE TYPE DISK DATABASE;
}
24.12 Parallization:
--------------------
RMAN executes commands serially; that is, it completes the current command
before starting the next one. Parallelism is exploited only within the context
of a single command. Consequently, if you want 5 datafile copies,
issue a single copy command specifying all 5 copies rather than 5 separate copy
commands.
run {
allocate channel c1 type disk;
allocate channel c2 type disk;
allocate channel c3 type disk;
allocate channel c4 type disk;
allocate channel c5 type disk;
copy datafile 22 to '/dev/prod/backup1/prod_tab5_1.dbf';
copy datafile 23 to '/dev/prod/backup1/prod_tab5_2.dbf';
copy datafile 24 to '/dev/prod/backup1/prod_tab5_3.dbf';
copy datafile 25 to '/dev/prod/backup1/prod_tab5_4.dbf';
copy datafile 26 to '/dev/prod/backup1/prod_tab6_1.dbf';
}
run {
allocate channel c1 type disk;
allocate channel c2 type disk;
allocate channel c3 type disk;
allocate channel c4 type disk;
allocate channel c5 type disk;
copy datafile 5 to '/dev/prod/backup1/prod_tab5_1.dbf',
datafile 23 to '/dev/prod/backup1/prod_tab5_2.dbf',
datafile 24 to '/dev/prod/backup1/prod_tab5_3.dbf',
datafile 25 to '/dev/prod/backup1/prod_tab5_4.dbf',
datafile 26 to '/dev/prod/backup1/prod_tab6_1.dbf';
}
Examples:
RMAN> run {
2> allocate channel c1 type disk;
3> copy datafile 1 to 'df1.bak';
4> }
RMAN> run
{ allocate channel c1 type disk;
backup tablespace users
including current controlfile; }
RMAN> run {
2> allocate channel c1 type disk;
3> backup tablespace system;
4> }
RMAN>
This example backs up the tablespace to its default backup location, which is
port-specific:
on UNIX systems the location is $ORACLE_HOME/dbs. Because you do not specify the
format parameter,
RMAN automatically assigns the backup a unique filename.
If the database is in ARCHIVELOG mode, then the target database can be open or
closed;
you do not need to close the database cleanly (although Oracle recommends
you do so that the backup is consistent).
RMAN> run {
2> allocate channel c1 type disk;
3> backup tablespace users;
4> }
You can either let RMAN determine a unique name for the backup piece or use
the format parameter to specify a name. If you do not specify a filename,
RMAN uses the %U substitution variable to guarantee a unique name.
The backup command provides substitution variables that allow you to generate
unique filenames.
Use the backupSpec clause to list what you want to back up as well as specify
other useful options. The number and size of backup sets depends on:
The filesperset parameter, which limits the number of files for a backup set.
The setsize parameter, which limits the overall size in bytes of a backup set.
The most important rules in the algorithm for backup set creation are:
Each allocated channel that performs work in the backup job--that is,
that is not idle--generates at least one backup set.
By default, this backup set contains one backup piece.
RMAN always tries to divide the backup load so that all allocated channels have
roughly
the same amount of work to do.
The maximum upper limit for the number of files per backup set is determined by
the
filesperset parameter of the backup command.
The maximum upper limit for the size in bytes of a backup set is determined by the
The filesperset parameter limits the number of files that can go in a backup set.
The default value of this parameter is calculated by RMAN as follows:
RMAN compares the value 64 to the rounded-up ratio of number of files / number of
channels,
nd sets filesperset to the lower value. For example, if you back up 70 files with
one channel,
RMAN divides 70/1, compares this value to 64, and sets filesperset to 64
because it is the lowest value.
The number of backup sets produced by RMAN is the rounded-up ratio of number of
datafiles / filesperset. For example, if you back up 70 datafiles and filesperset
is 64,
then RMAN produces 2 backup sets.
setsize: Sets the maximum size in bytes of the backup set without
specifying a limit to the number of files in the set.
filesperset: Sets a limit to the number of files in the backup set without
specifying a maximum size in bytes of the set.
4. Examples:
------------
Other Examples:
---------------
To write the output to a log file, specify the file at startup. For example,
enter:
Optionally, use the set duplex command to create multiple identical backupsets.
run {
allocate channel ch1 type disk;
backup database;
sql 'ALTER SYSTEM ARCHIVE LOG CURRENT'; # archives current redo log as well
as
# all unarchived logs
}
Optionally, use the format parameter to specify a filename for the backup piece.
For example, enter:
run {
allocate channel ch1 type disk;
backup database
format '/oracle/backup/%U'; # %U generates a unique filename
}
Optionally, use the tag parameter to specify a tag for the backup. For example,
enter:
run {
allocate channel ch1 type 'sbt_tape';
backup database
tag = 'weekly_backup'; # gives the backup a tag identifier
}
This script backs up the database and the archived redo logs:
RMAN> run {
allocate channel ch1 type disk;
allocate channel ch2 type disk;
backup database;
sql 'ALTER SYSTEM ARCHIVE LOG ALL';
backup archivelog all;
}
RMAN> run {
allocate channel ch1 type disk;
allocate channel ch2 type disk;
backup format 'i:\backup\full_db.bck' (database);
sql 'ALTER SYSTEM ARCHIVE LOG CURRENT';
backup archivelog all;
}
- Backup tablespace:
--------------------
run {
allocate channel ch1 type disk;
allocate channel ch2 type disk;
allocate channel ch3 type disk;
backup filesperset = 3
tablespace inventory, sales
include current controlfile;
}
- Backup datafiles:
-------------------
run {
allocate channel ch1 type disk;
backup
(datafile 1,2,3,4,5,6
filesperset 3)
datafilecopy '/oracle/copy/tbs_1_c.f';
}
RMAN> run {
allocate channel c1 type disk;
copy datafile 6 to 'F:\oracle\backups\oem01.cpy';
release channel c1;
}
RMAN> run {
allocate channel c1 type disk;
backup format 'F:\oracle\backups\oem01.rbu' ( datafile 6 );
release channel c1;
}
RMAN> run {
allocate channel ch1 type disk;
allocate channel ch2 type disk;
allocate channel ch3 type disk;
backup
(datafile 1,2,3 filesperset = 1 channel ch1)
(datafilecopy '/oracle/copy/cf.f' filesperset = 2 channel ch2)
(archivelog from logseq 100 until logseq 102 thread 1 filesperset = 3
channel ch3);
}
To back up archived logs, issue backup archivelog with the desired filtering
options:
run {
allocate channel ch1 type 'sbt_tape';
backup archivelog all # Backs up all archived redo logs.
delete input; # Optionally, delete the input logs
}
You can also specify a range of archived redo logs by time, SCN, or log sequence
number.
This example backs up all archived logs created more than 7 and less than 30 days
ago:
run {
allocate channel ch1 type disk;
backup archivelog
from time 'SYSDATE-30' until time 'SYSDATE-7';
}
- Incremental backups:
----------------------
run {
allocate channel ch1 type disk;
backup
incremental level = 0
database;
}
run {
allocate channel ch1 type disk;
backup
incremental level = 1
database;
}
Further examples:
------------------
Your database has to be in archive log mode for this script to work
RMAN> run {
2> # backup the database to disk
3> allocate channel d1 type disk;
4> backup
5> full
6> tag full_db
7> format '/backups/db_%t_%s_p%p'
8> (database);
9> release channel d1;
10> }
----
This script will backup all archive logs. Your database has to be
in archive log mode for this script to work.
RMAN> run {
2> allocate channel d1 type disk;
3> backup
4> format '/backups/log_t%t_s%s_p%p'
5> (archivelog all);
6> release channel d1;
7> }
----
resync catalog;
run {
allocate channel c1 type disk;
copy datafile 1 to 'C:\rman1.dbf';
copy datafile 2 to 'C:\rman2.dbf';
copy datafile 3 to 'C:\rman3.dbf';
copy datafile 4 to 'C:\rman4.dbf';
copy datafile 5 to 'C:\rman5.dbf';
}
exit
echo exiting after successful hot backup using RMAN
-----
run {
sql 'alter database close';
allocate channel d1 type disk;
backup full
tag full_offline_backup
format 'c:\backup\db_t%t_s%s_p%p'
(database);
release channel d1;
sql 'alter database open';
}
5. Complete Examples:
---------------------
***************************************************************
L=0 BACKUP
run {
allocate channel d1 type disk;
backup
incremental level = 0
tag db_whole_l0
format 'i:\backup\l0_%d_t%t_s%s_p%p' (database);
sql 'ALTER SYSTEM ARCHIVE LOG CURRENT';
backup
format 'i:\backup\log_%d_t%t_s%s_p%p' (archivelog all);
}
or
run {
allocate channel d1 type disk;
allocate channel d2 type disk;
backup
incremental level = 0
tag db_whole_l0
format 'i:\backup\l0_%d_t%t_s%s_p%p' (database channel d1);
sql 'ALTER SYSTEM ARCHIVE LOG CURRENT';
backup
format 'i:\backup\log_%d_t%t_s%s_p%p' (archivelog all channel d2);
}
L=1 BACKUP
run {
allocate channel d1 type disk;
backup
incremental level = 1
tag db_whole_l1
format 'i:\backup\l1_%d_t%t_s%s_p%p' (database);
sql 'ALTER SYSTEM ARCHIVE LOG CURRENT';
backup
format 'i:\backup\log_%d_t%t_s%s_p%p' (archivelog all);
}
*****************************************************************
*************************************************************
6. Third Party:
---------------
You can use rman in combination with third party storage managers.
In this case, rman is used with a MML library and possibly some API
that uses it's own configuration files, for example:
backup.scr script:
run
{
allocate channel t1 type 'sbt_tape' parms
'ENV=(TDPO_OPTFILE=c:\RMAN\scripts\tdpo.opt)';
allocate channel t2 type 'sbt_tape' parms
'ENV=(TDPO_OPTFILE=c:\RMAN\scripts\tdpo.opt)';
backup
filesperset 5
format 'df_%t_%s_%p'
(database);
run {
allocate channel d1 type 'sbt_tape' connect 'internal/manager@scdb2' parms
'ENV=(TDPO_OPTFILE=/usr/tivoli/tsm/client/oracle/bin64/tdpo.opt)';
allocate channel d2 type 'sbt_tape' connect 'internal/manager@scdb1' parms
'ENV=(TDPO_OPTFILE=/usr/tivoli/tsm/client/oracle/bin64/tdpo.opt)';
backup
format 'ctl_t%t_s%s_p%p'
tag cf
(current controlfile);
backup
full
filesperset 8
format 'db_t%t_s%s_p%p'
tag fulldb
(database);
release channel d1;
release channel d2;
}
The PARMS parameter sends instructions to the media manager. For example, the
following
vendor-specific PARMS setting instructs the media manager to back up to
a volume pool called oracle_tapes:
PARMS='ENV=(NSR_DATA_VOLUME_POOL=oracle_tapes)'
parms='ENV=(DSMO_FS=oracle)'
Another example:
RUN
{
ALLOCATE CHANNEL c1 DEVICE TYPE sbt
PARMS='ENV=(NSR_SERVER=tape_srv,NSR_GROUP=oracle_tapes)';
}
If you do not receive an error message, then Oracle successfully l
oaded the shared library. However, channel allocation can fail with the ORA-27211
error:
run
{
allocate channel for delete type 'sbt_tape' parms
'ENV=(TDPO_OPTFILE=c:\RMAN\scripts\tdpo.opt)';
To schedule scripts:
--------------------
orcschedppim.cmd
rem ==================================================
rem orcsched.cmd
rem ==================================================
rem ==================================================
rem set rman executable
rem ==================================================
set ora_exe=d:\oracle\ora81\bin\rman
rem ==================================================
rem set script and log directory
rem ==================================================
rem set ora_script_dir=d:\oracle\scripts\
set ora_script_dir=c:\progra~1\tivoli\tsm\agentoba\
rem ==================================================
rem run the backup script
rem ==================================================
bkdbppim.scr
run
{
allocate channel t1 type 'sbt_tape' parms
'ENV=(TDPO_OPTFILE=C:\Progra~1\Tivoli\TSM\AgentOBA\tdpoppim.opt)';
allocate channel t2 type 'sbt_tape' parms
'ENV=(TDPO_OPTFILE=C:\Progra~1\Tivoli\TSM\AgentOBA\tdpoppim.opt)';
backup
filesperset 5
format 'df_%t_%s_%p'
(database);
------------------------------------
Remarks:
--------
- Old Way
- New Way
allocate channel for maintenance type 'sbt_tape' parms
'ENV=(TDPO_OPTFILE=/opt/tivoli/tsm/client/oracle/bin/tdpo.opt)'
Contents of tdpo.opt
DSMI_ORC_CONFIG /opt/tivoli/tsm/client/oracle/bin/dsm.opt
DSMI_LOG /opt/tivoli/tsm/client/oracle/bin/tdpoerror.log
TDPO_FS rman_fs
TDPO_NODE tora
*TDPO_OWNER
TDPO_PSWDPATH /opt/tivoli/tsm/client/oracle/bin
*TDPO_DATE_FMT 1
*TDPO_NUM_FMT 1
*TDPO_TIME_FMT 1
*TDPO_MGMT_CLASS2 mgmtclass2
*TDPO_MGMT_CLASS3 mgmtclass3
*TDPO_MGMT_CLASS4 mgmtclass4
7. Recovery:
------------
Restore the tablespace or datafile with the RESTORE command, and recover it with
the RECOVER command.
(Use configured channels, or if desired, use a RUN block and allocate channels to
improve performance
of the RESTORE and RECOVER commands.)
If RMAN reported no errors during the recovery, then bring the tablespace back
online:
Use the RMAN restore command to restore datafiles, control files, or archived redo
logs
from backup sets or image copies.
RMAN restores backups from disk or tape, but image copies only from disk.
- The default location, which overwrites the files with the same name.
- A new location specified by the set newname command.
If you do not specify set newname commands for the datafiles during a restore job,
RMAN> run {
allocate channel c1 type 'sbt_tape';
restore database;
recover database;
}
run {
set until logseq 5 thread 1;
allocate auxiliary channel dupdb1 type disk;
duplicate target database to dupdb;
Example 1:
----------
RMAN> run
2 {
3 set until time '23-DEC-2006 13:45:00';
4 restore database;
5 recover database;
6 }
Example 2:
----------
To recover the database until a specified time, SCN, or log sequence number:
After connecting to the target database and, optionally, the recovery catalog
database,
ensure that the database is mounted. If the database is open, shut it down and
then mount it:
SHUTDOWN IMMEDIATE;
STARTUP MOUNT;
Determine the time, SCN, or log sequence that should end recovery. For example, if
you discover
that a user accidentally dropped a tablespace at 9:02 a.m., then you can recover
to 9 a.m.
--just before the drop occurred. You will lose all changes to the database made
after that time.
You can also examine the alert.log to find the SCN of an event and recover to a
prior SCN.
Alternatively, you can determine the log sequence number that contains the
recovery termination SCN,
and then recover through that log. For example, query V$LOG_HISTORY to view the
logs that you have archived.
RUN
{
SET UNTIL TIME 'Nov 15 2002 09:00:00';
# SET UNTIL SCN 1000; # alternatively, specify SCN
# SET UNTIL SEQUENCE 9923; # alternatively, specify log sequence number
RESTORE DATABASE;
RECOVER DATABASE;
}
If recovery was successful, then open the database and reset the online logs:
ALTER DATABASE OPEN RESETLOGS;
Moving the Target Database to a New Host with the Same File System
------------------------------------------------------------------
A media failure may force you to move a database by restoring a backup from
one host to another. You can perform this procedure so long as you have
a valid backup and a recovery catalog or control file.
Because your restored database will not have the online redo logs of your
production database,
you will need to perform incomplete recovery up to the lowest SCN of the most
recently
archived redo log in each thread and then open the database with the RESETLOGS
option.
Copy the initialization parameter file for HOST_A to HOST_B using an operating
system utility.
Connect to the HOST_B target instance and HOST_A recovery catalog. For example,
enter:
startup nomount
Restore and mount the control file. Execute a run command with the following sub-
commands:
run {
allocate channel ch1 type disk;
restore controlfile;
alter database mount;
}
Start SQL*Plus and use the following query to determine the necessary SCN:
SELECT min(scn)
FROM (SELECT max(next_change#) scn
FROM v$archived_log
GROUP BY thread#);
Set the SCN for recovery termination using the value obtained from the previous
step.
run {
set until scn = 500; # use appropriate SCN for incomplete recovery
allocate channel ch1 type 'sbt_tape';
restore database;
recover database;
alter database open resetlogs;
}
Moving the Target Database to a New Host with a different File System
---------------------------------------------------------------------
Follow the procedure as above, but now use the 'set newname' command.
run {
set until scn 500; # use appropriate SCN for incomplete recovery
allocate channel ch1 type disk;
set newname for datafile 1 to '/disk1/%U'; # rename each datafile manually
set newname for datafile 2 to '/disk1/%U';
set newname for datafile 3 to '/disk1/%U';
set newname for datafile 4 to '/disk1/%U';
set newname for datafile 5 to '/disk1/%U';
set newname for datafile 6 to '/disk2/%U';
set newname for datafile 7 to '/disk2/%U';
set newname for datafile 8 to '/disk2/%U';
set newname for datafile 9 to '/disk2/%U';
set newname for datafile 10 to '/disk2/%U';
alter database mount;
restore database;
switch datafile all; # points the control file to the renamed datafiles
recover database;
alter database open resetlogs;
}
Warning:
Restoring a tablespace:
-----------------------
run {
allocate channel ch1 type disk;
restore tablespace data_big;
}
run {
allocate channel ch1 type disk;
recover tablespace data_big;
}
RMAN> run {
2> allocate channel d1 type disk;
3> sql "alter tablespace users offline immediate";
4> restore datafile 5;
5> recover datafile 5;
6> sql "alter tablespace users online";
7> release channel d1;
8> }
RMAN> run {
allocate channel ch1 type disk;
restore database;
recover database;
alter database open resetlogs;
}
run {
# allocate at least one auxiliary channel of type disk or tape
allocate auxiliary channel dupdb1 type 'sbt_tape';
. . .
# set new filenames for the datafiles
set newname for datafile 1 TO '$ORACLE_HOME/dbs/dupdb_data_01.f';
set newname for datafile 2 TO '$ORACLE_HOME/dbs/dupdb_data_02.f';
. . .
# issue the duplicate command
duplicate target database to dupdb
# create at least two online redo log groups
logfile
group 1 ('$ORACLE_HOME/dbs/dupdb_log_1_1.f',
'$ORACLE_HOME/dbs/dupdb_log_1_2.f') size 200K,
group 2 ('$ORACLE_HOME/dbs/dupdb_log_2_1.f',
'$ORACLE_HOME/dbs/dupdb_log_2_2.f') size 200K;
}
PROBLEM 1.
----------
RMAN-20242: Specification does not match any archivelog in the recovery catalog.
PROBLEM 2.
----------
RMAN-06089: archived log xyz not found or out of sync with catalog
PROBLEM 3.
----------
fix:
PROBLEM 4.
----------
Problem Explanation:
Solution Description:
1. Be part of the operating system DBA group with respect to the target
database. This means that you have the ability to CONNECT INTERNAL
to the trget database without a password.
- or -
2. Have a password file setup. This requires the use of the "orapwd" command
and the initialization parameter "remote_login_passwordfile". See Chapter 1
of the Oracle8(TM) Server Administrator's Guide, Release 8.0 for details.
Note that changes to the password file will not take affect until after
the database is shutdown and restarted.
PROBLEM 5.
---------
RMAN cannot connect to the target database through a multi-threaded server (MTS)
dispatcher:
it requires a dedicated server process
Create a net service name in the tnsnames.ora file that connects to the non-shared
SID.
For example, enter:
inst1_ded =
(description=
(address=(protocol=tcp)(host=inst1_host)(port1521))
(connect_data=(service_name=inst1)(server=dedicated))
)
PROBLEM 6.
---------
2. Attempts to load the default media management library. The filename of the
default library
is operating system specific. On UNIX, the library filename is
$ORACLE_HOME/lib/libobk.so,
with the extension name varying according to platform: .so, .sl, .a, and so forth.
If Oracle is unable to locate the MML library,then RMAN issues an ORA-27211 error
and exits.
==========================
25. UPGRADE AND MIGRATION:
==========================
25.1 Version and release numbers:
---------------------------------
Upgrade: move upwarde from one release in the same version to a higher release
within the same base version, for example 8.1.6 -> 8.1.7
Migration: move to a different version, for example 7.4.3 -> 8.1.5
Patches : bugfixes
Patchset : smaller patches combined to latest patchset
Example version:
8.1.6.2 ->
8=version,1=release number,6=maintenance release number,2=patch number
- exp/imp
- MIG Migration Utility
- ODMA Oracle Data Migration Assistant
init_sql_files
lm_domains
lm_non_fault_tolerant
parallel_default_max_scans
parallel_default_scansize
sequence_cache_hash_buckets
serializable
session_cached_cursors
v733_plans_enabled
compatible
snapshot_refresh_interval -> job_queue_interval
snapshot_refresh_process -> job_queue_processes
db_writers -> dbwr_io_slaves
user_dump_dest, background_dump_dest, ifile
- exp/imp
- Migration utility
- ODMA
$ cd $ORACLE_HOME/bin
$ odma
Then it will ask you to confirm both the old and new ORACLE_HOME.
It will also ask for the location of the init.ora file.
Backup and shutdown the 8.1.6 database, and stop the listener
=====================
26. Some info on Rdb:
=====================
Rdb is most often seen on Digtal unix, or OpenVMS VAX, or OpenVMS alpha,
but there exists a port to NT / 2000 as well.
Samples directory:
------------------
Invoking SQL:
--------------
$ SQL
SQL>
- In digital unix:
$ SQL
SQL>
Attach to database:
-------------------
SQL>exit
$
or
SQL>DISCONNECT DEFAULT;
SQL>
SQL>EDIT
...
EXIT
$ SQL_DATABASE /usr/fieldman/dbs/mf_personnel
SHOW Statements:
----------------
Single file:
- a database root file which contains all user data and information
about the status of all database operations.
- a snapshot file (.snp file) which contains copies of rows (before images) that
are beiing modified by users updating the database.
Multifile:
- a database root file which contains information about the status of all database
operations.
- a storage area file, .rda file, for the system tables (RDB$SYSTEM)
- one or more .rda files for user data.
- snapshot files for each .rda file and for the database root file.
$ SQL
SQL> CREATE DATABASE FILENAME mf_personnel_test
cont> ALIAS MF_PERS
cont> RESERVE 6 JOURNALS
cont> RESERVE 15 STORAGE AREAS
cont> DEFAULT STORAGE AREA default_area
cont> SYSTEM INDEX COMPRESSION IS ENABLED
cont> CREATE STORAGE AREA default_area FILENAME default_area
cont> CREATE STORAGE AREA RDB$SYSTEM FILENAME pers_system_area;
Datatypes:
----------
Rdb Oracle
--------------------------------------------------
---------------
The current driver version is 3.00.02.05 which
doesnt work, and the older driver version (which does
work) is 2.10.17.00 (DriverConf1 outputs attached).
---------------
I am trying to run a DTS job to import data from an Oracle 7.3 RDB (DEC) platform
into SLQ Server 2000.
I have an odbc connection set up and I am using it in MS Access 2000 to view the
table that I want to import.
When I create the job in SQL Server, I can preview the data and everything looks
fine, as in the Access table,
but when I try and run the job I get an:
[ORACLE][ODBC]Function Sequence Error
error message. Any experience with these type of errors and RDB.
Thanks,
John Campbell
This can - I understand - occur where the version of the ODBC drivers on the NT
box with SQL Server running
is incompatible with the services running on the VMS box.
I can't remember the various numbers I'm afraid (or even where I found the stuff -
it was some time ago).
We're running VMS 7.2-1 and Oracle 7.3 and found that this produced a similar
error with the most recent version
of the Oracle ODBC Drivers for RdB - but we have no problems running the v2.10
drivers (v2.10.17 to be exact).
HTH
---------------
JInitiator:
-----------
Oracle heeft deze standaard aangepast, specifiek gericht op het uitvoeren van
Webforms.
Deze aanpassingen houden verband met stabiliteit (bugfixes) en performance
verbetering,
zoals JAR file caching, incremental JAR file loading en applet caching. Met behulp
van JInitiator
kunnen Oracle Forms in een browser (Webforms) worden uitgevoerd.
JInitiator is g��n JVM, maar een extensie op de JVM standaard, waarmee Oracle
Webforms
op een stabiele �n ondersteunde wijze in een browser kunnen worden uitgevoerd.
JInitiator is alleen beschikbaar voor het Windows platform. Op dit moment is het
niet mogelijk
om Webforms uit te voeren in de standaard Microsoft JVM. Jinitiator zal in de
volgende release
niet meer terugkeren. Webforms wordt gecertificeerd op de standaard Java Plugin.
De Microsoft JVM conformeert zich ook aan deze standaard (g��n certificatie),
waardoor Webforms
op termijn in een standaard Microsoft Internet Explorer browser uitgevoerd zal
kunnen worden.
Dit kan echter pas met zekerheid gesteld worden na grondig testen.
Installatie JInitiator
JInitiator wordt bij het eerste gebruik automatisch gedownload vanaf de
Application Server.
Overigens kan de JInitiator ook handmatig worden ge�nstalleerd op de client
machines.
============================
28. Some info on IFS
============================
9.0.2
=====
9.0.3
=====
In version 9.0.3, CM SDK runs in conjunction with Oracle9i Application Server and
an Oracle9i database.
The Oracle Content Management SDK (Oracle CM SDK) is the new name for the product
formerly known as the
Oracle Internet File System (Oracle 9iFS). This new naming is official as of
version 9.0.3.
Oracle CM SDK runs in conjunction with Oracle9i Application Server and an Oracle9i
database.
Written entirely in Java, Oracle CM SDK is an extensible content management system
with file server convenience.
The Oracle 9i database stores all content that comprises the filesystem,
from the files themselves to metadata like owners and group information.
On most occasions, 9iFS stores the files contents as LOB's in the database.
Tools:
------
- Import/Export utility
The Import/Export utility exports Oracle 9iFS objects (content and users)
into an export file.
Domain:
-------
Repository:
-----------
Commands:
---------
Stop IFS:
StartIfs902.bat
===============
D:\ora902\9ifs\bin\ifsstartoc4j.bat
start D:\ora902\9ifs\bin\ifslaunchdc.bat
start D:\ora902\9ifs\bin\ifslaunchdomain.bat
D:\ora902\9ifs\bin\ifsstartdomain -s myifshost:53140 ifssys
echo "iFS 902 started"
- Home:
Oracle 9iFS requires an Oracle 9.0.2 home, which means you must install and
configure
Oracle9i Application Server, Release 2 in an Oracle home separate from that of the
database.
The Oracle home can be on the same machine (resources allowing), or on a different
machine.
Installation and configuration of Oracle 9iFS starts from the Oracle Universal
Installer,
the graphical user interface wizard that copies all necessary software to the
Oracle home
on the target machine.
The Oracle 9iFS Configuration tool launches automatically at the end of the Oracle
Universal Installer process
and guides you through the process of identifying the Oracle database to be used
for the
Oracle Internet File System schema; selecting the type of authentication to use
(native Oracle 9iFS credential manager or Oracle Internet Directory for credential
management);
and various other configuration tasks. The specific configuration tasks vary,
depending on the type
of deployment (new Oracle 9iFS domain vs. additional Oracle 9iFS nodes, for
example)
ORACLE_HOME\ifs\cmsdk\bin\ifsca.bat
- connect to database:
- Directory service:
Select either CMSDK Directory Service or Oracle Internet Directory Service for
user authentication.
http://hostname.mycompany.com:7778/cmsdk/admin
copy /ifs/clients/cmdline/win32
to a local directory.
============================
28. Some info on 9iAS rel. 2
============================
9iAS is not just a webserver. A webserver is only part of the 9iAS system. 9iAS
offers OC4J
(Oracle Containers for J2EE), portals, webserver and webcache, and
BusinessIntelligence and other components.
OC4J:
-----
The "core" of the AS (thus the application part), is the OC4J architecture. The
OC4J infrastructure supports
EJB, JSP and Servlet applications. Developers can write J2EE applications, like
EJB, Servlet and JSP applications,
that will run on 9iAS.
OC4J itself is written in Java and runs on a Java virtual machine.
BusinessIntelligence:
---------------------
A set of services and client applications that make reports and all types of
analysis possible.
For example, the 'Oracle Reports service' , an application in the middle tier,
uses a queue for
submitted client requests. These request might create reports of a Datawarehouse
in a
Customer database etc...
28.1.1 Components:
------------------
Note:
The Oracle 9iAS 9.0.2 Concepts and the 9iAS Install guides mentions 3 install
types,
but the Admin guide Rel. 9.0.2 mentions 4 install types.
The fourth additional one is "Unified Messaging". This Enables you to integrate
different
types of messages into a single framework.
It includes all of the components available in the Business Intelligence and Forms
install type.
The J2EE and Web Cache install type does not require Oracle9iAS Infrastructure.
You can install single or multiple instances of Oracle9iAS install types, J2EE and
Web Cache, Portal and Wireless,
and Business Intelligence and Forms, on the same host, which is not a very
realistic scenarion.
Multiple instances of different Oracle9iAS install types, can use one instance of
Oracle9iAS Infrastructure,
and this could be a realistic scenario.
SSO is required for "Portal and Wireless" and "Business Intelligence and Forms"
install types.
Also required for application server clustering with J2EE and Web Cache install
type.
Oracle9iAS Discoverer
Oracle9iAS Personalization
If you configure any of these components during installation, their setup and
configuration will not be
complete at the end of installation. You need to take additional steps to install
and tune a customer database,
load schemas into the database, and finish configuring the component to use the
customer database.
Multiple instances of Oracle9iAS install types (J2EE and Web Cache, Business
Intelligence and Forms,
and Portal and Wireless) must be installed in separate Oracle homes on the same
computer.
You must install Oracle9iAS Infrastructure in its own Oracle home directory,
preferably on a separate host.
The Oracle9iAS installation cannot exist in the same Oracle home as the Oracle9iAS
Infrastructure installation.
If you have an existing Oracle Net listener and an Oracle9i database, then proceed
The Oracle Enterprise Manager console provides a wider view of your Oracle
environment,
beyond Oracle9iAS. Use the Console to automatically discover and manage databases,
The Console and its related components are installed with the Oracle Management
Server
as part of the Oracle9iAS Infrastructure installation option.
The Console is part of the Oracle Management Server component of the Oracle9iAS
Infrastructure.
The Management Server, the Console, and Oracle Agent are installed
on the Oracle9iAS Infrastructure host, along with the other infrastructure
components.
On Windows systems, use the Services control panel to start and stop the
management server.
The name of the service is in the following format:
OracleORACLE_HOMEManagementServer
For example:
OracleOraHome902ManagementServer
You can verify the Enterprise Manager Web site is started by pointing your browser
to the Web site URL.
For example:
http://hostname:1810
get console http://hostname:1810 http://127.0.0.1:1810
get welcome http://hostname:7777
To start or stop the Enterprise Manager Web site on Windows, use the Services
control panel.
The name of the service is in the following format:
OracleORACLE_HOMEEMwebsite
Or
Start the Enterprise Manager Web site
Example Services:
Oracleias902Discoverer
Oracleias902ProcessManager
Oracleias902WebCache
Oracleias902WebCacheAdmin
Oracleinfra902Agent = Agent for Management Server
Oracleinfra902EMWebsite = Enterprise Manager Web site
Oracleinfra902InternetDirectory_iasdb
Oracleinfra902ManagementServer = OEM Management Server
Oracleinfra902ProcessManager
OracleOraHome901TNSListener = just the Listener
OracleServiceIASDB = infra structure db
OracleServiceO901 = regular customer db
Sites:
------
Services:
---------
C:\ora10g\product\10.2.0\db_1\NETWORK\ADMIN>
Usage::
emctl start|stop|status
emctl reload | upload
emctl set credentials [<Target_name>[:<Target_Type>]]
emctl gencertrequest
emctl installcert [-ca|-cert] <certificate base64 text file>
emctl set ssl test|on|off|password [<old password> <new password>]
emctl set password <old password> <new password>
emctl authenticate <pwd>
emctl switch home [-silent <new_home>]
emctl config <options>
emctl status
C:\temp>emctl status
EMD is up and running : 200 OK
D:\temp>oemctl
"Syntax: OEMCTL START OMS "
" OEMCTL STOP OMS <EM Username>/<EM Password>"
" OEMCTL STATUS OMS <EM Username>/<EM Password>[@<OMS-HostName>]"
" OEMCTL PING OMS "
" OEMCTL START PAGING [BootHost Name] "
" OEMCTL STOP PAGING [BootHost Name] "
" OEMCTL ENABLE EVENTHANDLER"
" OEMCTL DISABLE EVENTHANDLER"
" OEMCTL EXPORT EVENTHANDLER <filename>"
" OEMCTL IMPORT EVENTHANDLER <filename>"
" OEMCTL DUMP EVENTHANDLER"
" OEMCTL IMPORT REGISTRY <filename> <Rep Username>/<Rep Password>@<RepAlias>"
" OEMCTL EXPORT REGISTRY <Rep Username>/<Rep Password>@<RepAlias>"
" OEMCTL CONFIGURE RWS"
The Console and Management Server are installed as part of the Oracle9iAS
Infrastructure.
In most cases, you install the Infrastructure on a dedicated host that can be used
to
centrally manage multiple application server instances. The Infrastructure
includes
Oracle Internet Directory, Single Sign-On, the metadata repository, the
Intelligent Agent,
and Oracle Management Server.
You only need to run the Intelligent Agent if you are using Oracle Management
Server in your enterprise.
In order for Oracle Management Server to detect application server installations
on a host,
you must make sure the Intelligent Agent is started.
Note that one Intelligent Agent is started per host and must be started after
every system boot.
(UNIX) You can run the following commands in the Oracle home of the primary
installation
(the first installation on the host) to get status and start the Intelligent
Agent:
ORACLE_HOME/bin/agentctl status agent
ORACLE_HOME/bin/agentctl start agent
(Windows) You can check the status and start the Intelligent Agent using the
Services control panel.
The name of the service is in the following format:
start the Intelligent Agent in the Oracle home of the primary installation:
To ensure that you can make a full recovery from media failures,
you should perform regular backups of the following:
You should perform regular backups of all files in the Oracle home of each
application server
and infrastructure installation in your enterprise using your preferred method of
filesystem backup.
Oracle Internet Directory offers command-line tools for backing up and restoring
the Oracle Internet Directory schema and subtree.
The metadata repository is an Oracle9i Enterprise Edition Database that you can
back up and restore
using several different tools and operating system commands.
The customer databases can be backupped using any standard method, the same way
you would do
for any other 9iEE database.
Applications:
=============
- CGI
httpd -> CGI -> Reports Server
commandline:
rwserver server=machinename
http://missrv/rwservlet/help
(show help page with rwservlet command line arguments)
http://machine:port/reports/rwservlet/showjobs?server=server_name
(show a listing of the jobqueue)
IP:7778/reports/rwservlet/showenv
http://<hostname>:<port>/reports/rwservlet/getserverinfo?
http://<hostname>:<port>/reports/rwservlet/getserverinfo?authid=orcladmin/<passw
ord of ias_admin>
http://machinename/servlet/RWServlet/showmap?server=Rep60_servername
commandline:
rwserver server=machinename shutdown=normal/immediate authid=admin/password
reports_user/welcome1
ias_admin/welcome1
orcladmin /welcome1
Reports Servlet
url : http://missrv:7778/reports/rwservlet
em username : reports_user
em password : welcome1
reports store : d:\reports (change in registry, key is REPORTS_PATH)
- Reports Server configuration files:
ORACLE_HOME\reports\conf\server_name.conf
ORACLE_HOME\reports\dtd\rwserverconf.dtd
ORACLE_HOME\reports\conf\rwbuilder.conf
ORACLE_HOME\reports\conf\rwservlet.properties
$9ias_home\j2ee\OC4J_iFS_cmsdk\applications\brugpaneel\FrontOffice\WEB-
INF\classes.
Het gaat om de volgende bestanden:
Er wordt ook gebruik gemaakt van JDBC. De instellingen van deze connectie staan in
het bestand:
$9ias_home\j2ee\OC4J_iFS_cmsdk\applications\brugpaneel\META-INF\data-sources.xml
miskm.properties:
-----------------
# miskm.reports parameters are used in order to display reports that are built
# using Oracle Reports.
# The output of the the generated report (e.g html, pdf, etc.)
#miskm.reports.desformat=pdf
miskm.reports.desformat=rtf&mimetype=application/msword
ORACLE_HOME\reports\conf\server_name.conf
ORACLE_HOME\reports\dtd\rwserverconf.dtd
ORACLE_HOME\reports\conf\rwbuilder.conf
ORACLE_HOME\reports\conf\rwservlet.properties (inprocess or standallone)
reports_server_name.conf
cgicmd.dat
jdbcpds.conf
proxyinfo.xml
rwbuilder.conf
rwserver.template
rwservlet.properties
textpds.conf
xmlpds.conf in ORACLE_HOME/reports/conf
Reports Servlet 9i
Rapportages worden gemaakt met behulp van de Reports Builder en moeten worden
opgeslagen
in een directory op de applicatieserver (standaard is dit d:\reports).
Om de Reports Servlet te laten weten waar allemaal reports zijn opgeslagen dient
de registersleutel
van Windows REPORTS_PATH te worden uitgebreid met de directory waar de
rapportages zijn opgeslagen.
De servlet maakt gebruik van Oracle SSO en daarom dient een er een SSO gebruiker
aangemaakt te worden
die in staat is om gebruik te maken van de servlet:
1. Ga naar http://missrv.miskm.mindef.nl:7777/oiddas
2. Log in als de portal gebruiker (standaard portal/welcome1)
3. Maak een nieuwe gebruiker aan, bijvoorbeeld: reports_user.
4. Sta deze gebruiker de privilege: �Allow resource management for Oracle
Reports and Forms� toe.
5. Controleer of deze gebruiker overeenstemt met de sleutel:
miskm.reports.ssoauthid in het bestand miskm.properties
Oracle9iAS Single Sign-On enables users to login to Oracle9iAS and gain access to
those applications for which they
are authorized, without requiring them to re-enter a user name and password for
each application.
It is fully integrated with Oracle Internet Directory, which stores user
information. It supports LDAP-based
user and password management through OID.
http://servername:port/pls/orasso
Examples:
missrv.miskm.mindef.nl:1521:iasdb
In a start script, you may find commands like the following to start the OID
server:
%INFRA_BIN%\oidmon start
%INFRA_BIN%\oidctl server=oidldapd instance=1 start
In a stop script, you may notice the following commands to stop the OID server:
When oidctl is executed, it connects to the database as user ODSCOMMON and simply
inserts/updates rows
into a table ODS.ODS_PROCESS depending on the options used in the command. A row
is inserted if the START option
is used, and updated if the STOP or RESTART option is used. So there are no
processes started at this point,
and LDAP server is not started.
Both the listener/dispatcher process and server process are called oidldapd on
unix, and oidldapd.exe on NT.
Oidmon is also a process (called oidmon on unix, oidmon.exe/oidservice.exe on
windows).
To control the processes (servers) we need to have OID Monitor (oidmon) running.
This monitor is often called
daemon or guardian process as well. When oidmon is running, it periodically
connects to the database and reads
the ODS.ODS_PROCESS table in order to start/stop/restart related processes.
NOTE:
Because the only task oidctl has is to insert / update table ODS.ODS_PROCESS in
the database,
it's obvious that the database and listener have to be fully accessible when
oidctl is used.
Also, oidmon connects periodically to the database. So the database and listener
must be
accessible for oidmon to connect.
Oracle Universal Installer creates a file showing the port assignments during
installation of Oracle9iAS components.
This file is ORACLE_HOME\install\portlist.ini
It contains entries like the following default values:
The ID username and password are defined in Oracle Internet Directory as either
the:
The SSO schema is now 'ORASSO' and the ORASSO user is registered with OID after an
infra install.
THe default user is 'orcladmin' with a login of your ias_admin password.
EM Website: http://<hostname.domain>:<port>
(port 1810 assigned by default)
You will login using the 'ias_admin' username and the password you entered
You can access the Welcome Page by pointing your browser to the HTTP Server URL
for your installation.
For example, the default HTTP Server URL is:
http://hostname:7777
You can also go directly to the Oracle Enterprise Manager Web site using the
following instructions:
http://hostname:1810 http://
Depending upon the options you have installed, the Administration section of the
Oracle9iAS Instance Home Page
provides additional features that allow you to perform the following tasks:
To start or stop the Enterprise Manager Web site on Windows, use the Services
control panel.
The name of the service is in the following format:
OracleORACLE_HOMEEMwebsite
For example, if the name of the Oracle Home is OraHome902, the service name is:
OracleOraHome902EMWebsite
Navigate to the Instance Home Page. Select Preferences in the top right corner.
Enter the new password and new password confirmation. Click OK.
This resets the ias_admin password for all application server installations on
the host.
Enter the following command in the Oracle home of the primary installation
(the first installation on the host):
For example:
The console is a non Web, Java tool, and part of the 3-tier OMS architecture.
See also section 28.1.
The Oracle Enterprise Manager console provides a wider view of your Oracle
environment,
beyond Oracle9iAS. Use the Console to automatically discover and manage databases,
The Console and its related components are installed with the Oracle Management
Server
as part of the Oracle9iAS Infrastructure installation option.
The Console is part of the Oracle Management Server component of the Oracle9iAS
Infrastructure.
The Management Server, the Console, and Oracle Agent are installed
on the Oracle9iAS Infrastructure host, along with the other infrastructure
components.
The Console offers advanced management features, such as an Event system to notify
administrators
of changes in your environment and a Job system to automate standard and
repetitive tasks,
such as executing a SQL script or executing an operating system command.
The Console and Management Server are installed as part of the Oracle9iAS
Infrastructure.
Use the OEMCTL commandline tool for controlling OMS. See section 28.1.10.
Start Oracle HTTP Server and OC4J (the rest of the commands in this section should
be executed
in the Oracle home of the J2EE and Web Cache instance):
Start/Stop Enterprise:
----------------------
Start/Stop Instance:
--------------------
Start:
First you have started the infrastructure instance, and customer database
instance.
1. Preliminary:
The first step before starting an application server instance is to ensure that
the Enterprise Manager Web site
is running on the host. The Web site provides underlying processes required to run
an application server instance
and must be running even if you intend to use command-line tools to start your
instance.
There is one Enterprise Manager Web site per host. It resides in the primary
installation (or first installation)
on that host. The primary installation can be an application server installation
or an infrastructure.
This Web site usually listens on port 1810 and provides services to all
application server instances
and infrastructures on that host.
To verify the status of the Enterprise Manager Web site, run the following command
in the Oracle home of the
primary installation:
To start the Enterprise Manager Web site, run the following command in the Oracle
home of the primary installation:
You only need to run the Intelligent Agent if you are using Oracle Management
Server in your enterprise.
In order for Oracle Management Server to detect application server installations
on a host,
you must make sure the Intelligent Agent is started. Note that one Intelligent
Agent is started per host
and must be started after every system boot.
(UNIX) You can run the following commands in the Oracle home of the primary
installation
(the first installation on the host) to get status and start the Intelligent
Agent:
(Windows) You can check the status and start the Intelligent Agent using the
Services control panel.
The name of the service is in the following format:
OracleORACLE_HOMEAgent
You can start, stop, and restart all types of application server instances using
the
Instance Home Page on the Enterprise Manager Web site.
Or...
ORACLE_HOME\bin\webcachectl stop
ORACLE_HOME\dcm\bin\dcmctl stop
Start/Stop components:
----------------------
You can start, stop, and restart individual components using the Instance Home
Page or the component home page
on the Enterprise Manager Web site. You can also start and stop some components
using command-line tools.
Oracle HTTP Server
Start: ORACLE_HOME\dcm\bin\dcmctl start -ct ohs
Stop : ORACLE_HOME\dcm\bin\dcmctl stop -ct ohs
Web Cache
Start: ORACLE_HOME\bin\webcachectl start
Stop : ORACLE_HOME\bin\webcachectl stop
Reports
Start: ORACLE_HOME\bin\rwserver server=name
Stop : ORACLE_HOME\bin\rwserver server=name shutdown=yes
You cannot start or stop some components. The radio buttons in the Select column
on the Instance Home Page
are disabled for these components, and their component home pages do not have
Start, Stop, or Restart buttons.
Stop all middle-tier application server instances that use the infrastructure.
Stop Oracle Management Server and Intelligent Agent (optional)
Stop Web Cache (optional)
Stop OC4J instances
Stop Oracle HTTP Server
Stop Oracle Internet Directory
Stop the Metadata Repository
The next section describes how to start an infrastructure using command-line tools
on Windows.
Except where noted, all commands should be run in the Oracle home of the
infrastructure.
-- ---------------------------------------------------------------------
ORACLE_HOME\bin\lsnrctl start
You can set the ORACLE_SID system variable using the System Properties control
panel.
ORACLE_HOME\bin\sqlplus /nolog
sql> connect sys/password_for_sys as sysdba
sql> startup
sql> quit
-- ---------------------------------------------------------------------
- Start Oracle Internet Directory.
Make sure the ORACLE_SID is set to the metadata repository system identifier
(refer to previous step).
Start the Oracle Internet Directory monitor:
ORACLE_HOME\bin\oidmon start
where n is any instance number (1, 2, 3...) that is not in use. For example:
ORACLE_HOME\bin\oidctl server=oidldapd configset=0 instance=1 start
-- ---------------------------------------------------------------------
- Start the Enterprise Manager Web site.
Even though you are using command-line, the Web site is required because it
provides underlying support
for the command-line tools. The Web site must be started after every system
boot.
You can check the status and start the Enterprise Manager Web site using the
Services control panel.
The name of the service is in the following format: OracleORACLE_HOMEEMwebsite
You can also start the service using the following command line:
-- ---------------------------------------------------------------------
-Start Oracle HTTP Server.
Note that starting Oracle HTTP Server also makes Oracle9iAS Single Sign-On
available.
-- ---------------------------------------------------------------------
- Start the OC4J_DAS instance.
Note that the infrastructure instance contains other OC4J instances, such as
OC4J_home and OC4J_Demos,
but these do not need to be started; their services are not required and incur
unnecessary overhead.
-- ---------------------------------------------------------------------
-Start Web Cache (optional).
Web Cache is not configured in the infrastructure by default, but if you have
configured it, start it as follows:
ORACLE_HOME\bin\webcachectl start
-- ---------------------------------------------------------------------
- Start Oracle Management Server and Intelligent Agent (optional).
Perform these steps only if you have configured Oracle Management Server.
Start Oracle Management Server:
-- ---------------------------------------------------------------------
In order for Oracle Management Server to detect the infrastructure and any other
application server
installations on this host, you must make sure the Intelligent Agent is started.
Note that one Intelligent Agent
is started per host and must be started after every reboot.
You can check the status and start the Intelligent Agent using the Services
control panel.
The name of the service is in the following format:
OracleORACLE_HOMEAgent
Oracle HTTP Server contains the mod_plsql module, which provide support for
building PL/SQL-based
applications on the Web.
PL/SQL stored procedures retrieve data from a database and generate HTTP responses
containing data and code
to display in a Web browser.
In order to use mod_plsql you must install the PL/SQL Web Toolkit into a database
and create a
Database Access Descriptor (DAD) which provides mod_plsql with connection
information for the database.
31. Configuring HTTP Server, OC4J, and Web Cache:
--------------------------------------------------
You can use the OEM website in order to configure components as HTTP Server, OC4J,
and Web Cache,
or
you can manually edit configuration files.
If you edit Oracle HTTP Server or OC4J configuration files manually, instead of
using the Enterprise Manager Web site,
you must use the DCM command-line utility dcmctl to notify the DCM repository of
the changes. Otherwise,
your changes will not go into effect and will not be reflected in the Enterprise
Manager Web site.
- HTTP Server:
You can configure Oracle HTTP Server using the Oracle HTTP Server Home Page on the
Oracle Enterprise Manager Web site.
You can perform tasks such as modifying directives, changing log properties,
specifying a port for a listener,
modifying the document root directory, managing client requests, and editing
server configuration files.
You can access the Oracle HTTP Server Home Page in the Name column of the System
Components table on the Instance Home Page.
- OC4J:
You can configure Oracle9iAS Containers for J2EE (OC4J) using the Enterprise
Manager Web site.
You can use the Instance Home Page to create and delete OC4J instances, each of
which has its own OC4J Home Page.
You can use each individual OC4J Home Page to configure the corresponding OC4J
instance and its deployed applications.
Every application server instance has a default OC4J instance named OC4J_home.
You can create additional instances, each with a unique name, within an
application server instance.
To create a new OC4J instance:
- Navigate to the Instance Home Page on the Oracle Enterprise Manager Web site.
Scroll to the System Components section.
- Click Create OC4J Instance. This opens the Create OC4J Instance Page.
- In the Create OC4J Instance Page, type a unique instance name in the OC4J
instance name field. Click Create.
- A new OC4J instance is created with the name you provided.
- This OC4J instance shows up on the Instance Home Page in the System Components
section.
- The instance is initially in a stopped state and can be started any time after
creation.
Each OC4J instance has its own OC4J Home Page which allows you to configure global
services
and deploy applications to that instance.
---------------------------------------------
32.1 9iAS Rel. 2 most obvious config files:
---------------------------------------------
JServ:
------
jserv.conf
jserv.properties
zone.properties in ORACLE_HOME/Apache/Jserv/etc
mod_oradav:
-----------
moddav.conf in ORACLE_HOME/Apache/oradav/conf
mod_plsql:
----------
cache.conf
dads.conf in ORACLE_HOME/Apache/modplsql/conf
Oracle9iAS Discoverer:
----------------------
configuration.xml in
ORACLE_HOME/j2ee/OC4J_BI_Forms/applications/discoverer/web/WEB-INF/lib
viewer_config.xml in
ORACLE_HOME/j2ee/OC4J_BI_Forms/applications/discoverer/web/viewer_files
plus_config.xml in
ORACLE_HOME/j2ee/OC4J_BI_Forms/applications/discoverer/web/plus_files
portal_config.xml in
ORACLE_HOME/j2ee/OC4J_BI_Forms/applications/discoverer/web/portal
pref.txt in ORACLE_HOME/discoverer902/util
.reg_key.dc in ORACLE_HOME/discoverer902/bin/.reg
---------------------------------------------
32.2 9iAS Rel. 2 list of all .conf files:
---------------------------------------------
-- -------------------------------------------------------------------
-- BEGIN LISTING FROM AN REAL LIFE 9iAS rel. 9.0.2 Server:
-- -------------------------------------------------------------------
Directory of D:\ORACLE\ias902\Apache\Apache\conf
Directory of D:\ORACLE\ias902\Apache\Apache\conf\osso
Directory of D:\ORACLE\ias902\Apache\Jserv\conf
Directory of D:\ORACLE\ias902\Apache\jsp\conf
Directory of D:\ORACLE\ias902\Apache\modplsql\conf
Directory of D:\ORACLE\ias902\Apache\oradav\conf
Directory of D:\ORACLE\ias902\click\conf
Directory of D:\ORACLE\ias902\click\conf\templates
Directory of D:\ORACLE\ias902\dcm\config
Directory of D:\ORACLE\ias902\dcm\config\plugins\apache
Directory of D:\ORACLE\ias902\dcm\repository.install\dcm\config
Directory of D:\ORACLE\ias902\forms90\server
Directory of D:\ORACLE\ias902\ldap\das
Directory of D:\ORACLE\ias902\opmn\conf
Directory of D:\ORACLE\ias902\portal\conf
Directory of D:\ORACLE\ias902\RDBMS\demo
Directory of D:\ORACLE\ias902\reports\conf
Directory of D:\ORACLE\ias902\ultrasearch\webapp\config
Directory of D:\ORACLE\ias902\xdk\admin
Directory of D:\ORACLE\infra902\Apache\Apache\conf
Directory of D:\ORACLE\infra902\Apache\Apache\conf\osso
Directory of D:\ORACLE\infra902\Apache\Jserv\conf
Directory of D:\ORACLE\infra902\Apache\jsp\conf
Directory of D:\ORACLE\infra902\Apache\modplsql\conf
04/23/2003 08:23p 842 cache.conf
04/23/2003 08:23p 1,485 dads.conf
04/23/2003 08:23p 1,606 plsql.conf
3 File(s) 3,933 bytes
Directory of D:\ORACLE\infra902\Apache\oradav\conf
Directory of D:\ORACLE\infra902\dcm\config
Directory of D:\ORACLE\infra902\dcm\config\plugins\apache
Directory of D:\ORACLE\infra902\dcm\repository.install\dcm\config
Directory of D:\ORACLE\infra902\ldap\das
Directory of D:\ORACLE\infra902\oem_webstage
Directory of D:\ORACLE\infra902\opmn\conf
Directory of D:\ORACLE\infra902\RDBMS\demo
Directory of D:\ORACLE\infra902\sqlplus\admin
Directory of D:\ORACLE\infra902\sso\conf
Directory of D:\ORACLE\infra902\ultrasearch\webapp\config
04/23/2003 08:23p 324 ultrasearch.conf
1 File(s) 324 bytes
Directory of D:\ORACLE\infra902\xdk\admin
Directory of D:\ORACLE\ora901\Apache\Apache\conf
Directory of D:\ORACLE\ora901\Apache\Jserv\conf
Directory of D:\ORACLE\ora901\Apache\jsp\conf
Directory of D:\ORACLE\ora901\Apache\modose\conf
Directory of D:\ORACLE\ora901\Apache\modplsql\cfg
Directory of D:\ORACLE\ora901\BC4J
Directory of D:\ORACLE\ora901\oem_webstage
Directory of D:\ORACLE\ora901\rdbms\demo
Directory of D:\ORACLE\ora901\sqlplus\admin
Directory of D:\ORACLE\ora901\ultrasearch\jsp\admin\config
05/02/2001 08:26p 10,681 mod__ose.conf
1 File(s) 10,681 bytes
Directory of D:\ORACLE\ora901\xdk\admin
You can deploy J2EE applications using the OC4J Home Page on the Enterprise
Manager Web site.
To navigate to an OC4J Home Page, do the following:
-Navigate to the Instance Home Page where the OC4J instance resides.
Scroll to the System Components section.
-Select the OC4J instance in the Name column. This opens the OC4J Home Page for
that OC4J instance.
Clicking Deploy EAR File or Deploy WAR File starts the deployment wizard, which
deploys the application
to the OC4J instance and binds any Web application to a URL context.
-- Web applications
The Web applications module (WAR files) includes servlets and JSP pages.
-- EJB applications
The EJB applications module (EJB JAR files) includes Enterprise JavaBeans
(EJBs).
Now archive the JAR and WAR files that belong to an enterprise Java application
into an EAR file
for deployment to OC4J. The J2EE specifications define the layout for an EAR file.
<appname>-
|--META_INF
| |
| -----application.xml
|
|--EJB JAR file
|
|--WEB WAR file
|
|--Client JAR file
|
When you deploy an application within a WAR file, the application.xml file is
created
for the Web application.
When you deploy an application within an EAR file, you must create the
application.xml
file within the EAR file.
Thus, deploying a WAR file is an easier method for deploying a Web application.
-------------
34. Errors:
-------------
OPMN stands for 'oracle process management notification' and is Oracle's 'high
availability' system.
OPMN monitors processes and brings them up again automatically if they go down.
It is started when you start enterprise manager website with emctl start from the
prompt
in the infrastructure oracle home, and doing this starts 2 opmn processes for each
oracle home.
OPMN consists of two components - Oracle Process Manager and Oracle Notification
System.
DCM stands for 'distributed component management' and is the framework by which
all
IAS R2 components hang together. DCM is a layer that ensures that if something is
changed in one components,
others like Enterprise Manager are made aware as well. It is not a process as
such,
but rather a generic term for a framework and utilities.
It is controlled directly with the dcmctl command.
DMS Dynamic Monitoring Services . These processes are started when you start ohs.
DMS basically gathers information on components.
Jserv Jserv works in much the same way as R1 except oracle components no longer
use this servlet architecture,
but use oc4j instead.
mod_oradav oradav allows web folders to be shared with clients e.g. PC's and
accessed as if they were NT folders.
OC4J_DAS is used by Portal for the management of users and groups. You access this
via http://machine:port/oiddas
============================
PART 1: GENERAL 9iAS ERRORS:
============================
sample targets.xml:
- <Targets>
- <Target TYPE="oracle_webcache" NAME="ias902dev.missrv.miskm.mindef.nl_Web Cache"
DISPLAY_NAME="Web Cache">
<Property NAME="HTTPPort" VALUE="7778" />
<Property NAME="logFileName" VALUE="webcache.log" />
<Property NAME="authrealm" VALUE="Oracle Web Cache Administrator" />
<Property NAME="AdminPort" VALUE="4003" />
<Property NAME="HTTPProtocol" VALUE="http" />
<Property NAME="logFileDir" VALUE="/sysman/log" />
<Property NAME="HTTPMachine" VALUE="missrv.miskm.mindef.nl" />
<Property NAME="HTTPQuery" VALUE="" />
<Property NAME="controlFile" VALUE="d:\oracle\ias902/bin/webcachectl.exe" />
<Property NAME="MonitorPort" VALUE="4005" />
<Property NAME="HTTPPath" VALUE="/" />
<Property NAME="authpwd" VALUE="98574abda4f0a0cadcfe3e420f09854b"
ENCRYPTED="TRUE" />
<Property NAME="authuser" VALUE="98574abda4f0a0cadcfe3e420f09854b"
ENCRYPTED="TRUE" />
- <CompositeMembership>
<MemberOf TYPE="oracle_ias" NAME="ias902dev.missrv.miskm.mindef.nl"
ASSOCIATION="null" />
</CompositeMembership>
</Target>
+ <Target TYPE="oracle_clkagtmgr"
NAME="ias902dev.missrv.miskm.mindef.nl_Clickstream" DISPLAY_NAME="Clickstream
Collector" ON_HOST="missrv.miskm.mindef.nl">
- <CompositeMembership>
<MemberOf TYPE="oracle_ias" NAME="ias902dev.missrv.miskm.mindef.nl" />
</CompositeMembership>
</Target>
..
..
- <Target TYPE="oracle_repserv"
NAME="ias902dev.missrv.miskm.mindef.nl_Reports:rep_missrv"
DISPLAY_NAME="Reports:rep_missrv" VERSION="1.0" ON_HOST="missrv.miskm.mindef.nl">
<Property NAME="OracleHome" VALUE="d:\oracle\ias902" />
<Property NAME="UserName" VALUE="repadmin" />
<Property NAME="Servlet"
VALUE="http://missrv.miskm.mindef.nl:7778/reports/rwservlet" />
<Property NAME="Server" VALUE="rep_missrv" />
<Property NAME="Password" VALUE="ced9a541f77e7df6" ENCRYPTED="TRUE" />
<Property NAME="host" VALUE="missrv.miskm.mindef.nl" />
- <CompositeMembership>
<MemberOf TYPE="oracle_ias" NAME="ias902dev.missrv.miskm.mindef.nl"
ASSOCIATION="null" />
</CompositeMembership>
</Target>
</Target>
- <Target TYPE="oracle_ifs" NAME="iFS_missrv.miskm.mindef.nl:1521:o901:IFSDP">
<Property NAME="DomainName" VALUE="ifs://missrv.miskm.mindef.nl:1521:o901:IFSDP"
/>
<Property NAME="IfsRootHome" VALUE="d:\oracle\ias902\ifs" />
<Property NAME="SysadminUsername" VALUE="system" />
<Property NAME="SysadminPassword" VALUE="973dc46d050ca537" ENCRYPTED="TRUE" />
<Property NAME="IfsHome" VALUE="d:\oracle\ias902\ifs\cmsdk" />
<Property NAME="SchemaPassword" VALUE="daeffdd4f05cd456" ENCRYPTED="TRUE" />
- <CompositeMembership>
<MemberOf TYPE="oracle_ias" NAME="ias902dev.missrv.miskm.mindef.nl" />
</CompositeMembership>
</Target>
The above file stores amongst other things, the encrypted passwords that EM uses
for access to components.
Search for oracle_portal, oracle_repserv etc. Although encrypted, you can change
these to be a password
in Englidh as long as you flag it ENCRYPTED=FALSE. This should only be done for
specific bug problems
as recommended by oracle support.
Do not change these passwords for any other reason!!
The following is a list of things to check when there appears to be a problem with
targets.xml.
1. Check the permissions on the active targets.xml file and restart all the
infrastructure components
(database, listener, oid, emctl in that order).
The targets.xml file should be owned by the user who installed 9iAS and who
starts emctl.
Accidentally starting emctl as root recreates the targets.xml under root
ownership.
Fix this by changing ownership on targets.xml and restarting emctl.
3. Check whether the hosts file and targets.xml have matching hostnames,
and whether both have fully qualified hostnames.
b. Copy $ORACLE_HOME/sysman/emd/discoveredTargets.xml to
$ORACLE_HOME/sysman/emd/targets.xml,
although it may not be complete if additional targets were installed following
installation.
c. Check the amount of disk space available. See Bug 2508930 - TARGETS.XML IS
EMPTY IF WE HAVE NO DISK SPACE.
When installing both the infrastructure and a mid-tier on the same server (in
different homes),
the installation of the infrastructure creates the emtab file pointing to its
own home.
During installation of the mid-tier, the mid-tier installation routine uses
the emtab file
pointing to the infrastructure home so it knows where to write configuration
information
required for the infrastructure EM Website, so it can see not only information
concerning itself
but also information related to the mid-tier.
The EM Web Site is launched as a J2EE application. The configuration files consist
of many XML files
and properties files. Here are some of those files:
targets.xml
emd.properties
logging.properties
iasadmin.properties
A problem that often seems to happen when Oracle 9iAS 9.0.2 crashes is that you
can't seem
to restart OID using OIDCTL.
For example, a situation might arise when a server is bounced without 9iAS being
shut down cleanly.
When you reboot the PC, and use DCMCTL to check the status of the OC4J instances
prior to starting them,
you get the following error message:
C:\ocs_onebox\infra\dcm\bin>dcmctl getState -V
ADMN-202026
A problem has occurred accessing the Oracle9iAS infrastructure database.
Base Exception:
oracle.ias.repository.schema.SchemaException:Unable to connect to Directory Server
:javax.naming.CommunicationException: markr.plusconsultancy.co.
uk:4032 [Root exception is java.net.ConnectException: Connection refused: connect]
Please, refer to the base exception for resolution, or call Oracle support.
Or, when you watch an ias start script, at the point oid get started, you will see
which should startup an OID instance. However, sometimes this fails to work and
you get the error message:
What actually happens behind the scenes is that a row is inserted or updated in
the ODS.ODS_PROCESS table
that contains the instance name (which must be unique), the process ID, and a flag
called 'state',
which has three values - 0,1,2 and 3 which stand for stop, start, running and
restart. A second process, OIDMON,
polls the ODS.ODS_PROCESS table and when it finds a row with state=0, it reads the
pid and stops the process.
When it finds a state=1, oidmon starts a new process and updates pid with a new
process id. With state=2,
oidmon reads the pid, and checks that the process with the same pid is running. If
it's not, oidmon starts
a new process and updates the pid. Lastly, with state=3, oidmon reads the pid,
stops the process, starts a new one
and updates the pid accordingly. If oidmon can't start the server for some reason,
it retries 10 times, and if
still unsuccessful, it deletes the row from the ODS.ODS_PROCESS table. Therefore,
OIDCTL only inserts or updates
state information, and OIDMON reads rows from ODS.ODS_PROCESS, and performs
specified tasks based on the value of
the state column.
This all works fine except when 9iAS crashes; when this happens, OIDMON exits but
the OIDLDAPD processes are
not killed, and in addition, stray rows are often left in the ODS.ODS_PROCESS
table that are detected when you try
to restart the oidldapd instance after a reboot.
1. Kill any stray OIDLDAPD processes still running (if you haven't rebooted the
server since the crash)
2. Delete any rows in the ODS.ODS_PROCESS table
$INFRA_ORACLE_HOME/network/admin/ldap.ora
Sample:
DEFAULT_ADMIN_CONTEXT = ""
DIRECTORY_SERVERS= (missrv.miskm.mindef.nl:4032:4031)
DIRECTORY_SERVER_TYPE = OID
There are different times when this error can occur. But, it basically occurs when
a
change to the system has been done. This can be after a reboot or a crash, but
there is
a difference on the machine before and after the occurance.
It is usually a network configuration change that has caused the problem.
When you try to start the Oracle HTTP Server, the following error might appear in
the opmn logs:
"Syntax error on line 6 of OH/Apache/Apache/conf/mod_osso.conf: Unable to
deobfuscate the SSO server config file,
OH/Apache/Apache/conf/osso/osso.conf, error Bad padding pattern detected in the
last block."
Most of the Mid-Tier components will fail to connect to the Infrastructure, and
will give the following error:
"oracle.ias.repository.schema.SchemaException:Password could not be retrieved"
Possible solution:
1. Start Infrastructure DB
2. Start the Infrastructure OID
3. Include $ORACLE_HOME/lib in the LD_LIBRARY_PATH, SHLIB_PATH, or LIBPATH
environment variable,
depending on your platform.
-For AIX LIBPATH=$ORACLE_HOME/lib:$ORACLE_HOME/lib64:$LIBPATH; export LIBPATH
4. Run the command to reset the iAS password. Please use the SAME password, as we
are not attempting
to change the password you enter when signing onto EM. That is done with the emctl
utility.
This command changes it internally, and we want to re-instate the current
obfuscated password:
5. Use the showPassword utility to obtain the password for the orasso user.
Then, re-register the listener, being sure to add this information to the ossoreg
command in Step 6:
-schema orasso
-pass ReplaceWithPassword
NOTE: The following command will not work on 9iAS 9.0.2.0.x, unless a patched
dcm.jar
has previously been applied with a patch (or 9.0.2.1). Since this cannot be run on
previous versions,
just proceed to step 8.
7. Run following commands on the machine where the change occurred, (not the
associated Mid-Tiers):
a. Solaris
i. $ORACLE_HOME/dcm/bin/dcmctl resetHostInformation
ii. $ORACLE_HOME/bin/emctl set password <previous_password>
b. NT
i. Make sure the Oracle9iAS is stopped
ii. Edit %ORACLE_HOME%\sysman\j2ee\config\jazn-data.xml
iii.Search for �ias_admin�
iv. Replace obfuscated text between <credentials> and </credentials> with
"!<password>"
where "<password>" is the password.
Example: <credentials>!welcome1</credentials>
v. Save the file.
This is what was originally failing. After successfully starting OHS, You may want
to take a backup
of the deobfuscated information as described in Note215955.1.
3.1
---
Hi,
We have an 9IAS (9.0.2) Infrastructure and Middle Tier
instance running on ONE Box (Win2k),thing we fine until
while trying to implement the Single Sigon after
making the changes as instructed in Note:199072.1
we stopped the HTTP Server so that change could take
effect,but every since we have stopped the HTTP Server
we couldn't gain access to the Middle Instance from the
EM WEB SITE the page just hangs......on the other hand
the INFRASTRUCTURE instance is working fien.We even tried
starting the HTTP server through the DCM UTILITY the following was
the message
Content-Type: text/html
Response: 0 of 1 processes started.
Check opmn log files such as ipm.log and ons.log for detailed.".
Resolve the indicated problem at the Oracle9iAS instance where it occurred
thenresync the instance
Remote Execute Exception 806212
oracle.ias.sysmgmt.exception.ProcessMgmtException: OPMN operation failure
at oracle.ias.sysmgmt.clustermanagement.OpmnAgent.validateOperation(Unknown
Source)
at oracle.ias.sysmgmt.clustermanagement.OpmnAgent.startOHS(Unknown Source)
at oracle.ias.sysmgmt.clustermanagement.StartInput.execute(Unknown Source)
at oracle.ias.sysmgmt.clustermanagement.ClusterManager.execute(Unknown Source)
at oracle.ias.sysmgmt.task.ClusterManagementAdapter.execute(Unknown Source)
at oracle.ias.sysmgmt.task.TaskMaster.execute(Unknown Source)
at oracle.ias.sysmgmt.task.TaskMasterReceiver.process(Unknown Source)
at oracle.ias.sysmgmt.task.TaskMasterReceiver.handle(Unknown Source)
at oracle.ias.sysmgmt.task.TaskMasterReceiver.run(Unknown Source)
Regards
Ishaq Baig
Hello,
There should be some errors generated in the error_log file, please post these
errors
in your next reply. You may want to review the following notes:
Also, I noticed that you have listed your 9iAS version as 9.0.2, did you apply the
latest patchsets before implementing the changes?
If not, you will need to apply the patchsets first before making the changes.
Please review..
Thank you,
Rod
Oracle Technical Support
3.2
---
When I use the EM website to access the components of my 9i App server, the
response time is very slow.
It takes 2 or 3 minutes to go from screen to another. I have found information on
this forum that others
are experiencing the same problem. The response from Oracle support has been that
this is a known problem
and there is a bug, 2756262, which is to be fixed in 9.0.4. However, I cannot find
any information on when
this release will be available. It seems to keep getting pushed back. Does anyone
know a release date?
Has anyone requested a backport of this fix to an earlier release? Thanks for any
response.
The base architecture is being redesign. Due to the redesign, backports are not
being accepted.
Thanks for the reply Kathy. I will look forward to the redesign since the current
product is pretty much useless.
As do we.
Note:244161.1
Subject: Explanation of IAS_ADMIN and ORCLADMIN Accounts
Type: BULLETIN
Status: PUBLISHED
PURPOSE
-------
To provide an explanation for the IAS_ADMIN and ORCLADMIN accounts that are
established with Oracle9i Application Server (9iAS) Release 2 (9.0.2.x).
There are two users that can create some confusion: ias_admin and orcladmin.
However, the interaction is more or less internally managed. You log into the EM
Website with ias_admin, but use the orcladmin password after initially installing
9iAS. So when changing the orcladmin password, you may not get the results
intended with the ias_admin login.
But, if the obfuscation gets skewed, we found you sometimes need to reinstate
the password obfuscation between the two with the resetiASpasswd script. This
assumes the same password is used, and no resulting changes are noted. The
*change* occurred internally. These changes, and methods, can cause some
confusion.
You can actually change the EM Website login separately with the emctl utility.
Or, change the orcladmin username separately, depending on how your want
to manage this.
IAS_ADMIN Account
-----------------
In EM 9.0.2 and 9.0.3, you will need to use the IAS_ADMIN account to access the
EM Website Home Page. This account is not known within the database or to the
Oracle Management Server. Instead, it is a new account used only for access to
the 9iAS Administration (EM) Web Site. The following note can be used to
supplement the Documentation and Release Notes dealing with modifying this
password:
[NOTE:204182.1]
<http://metalink.oracle.com/metalink/plsql/ml2_documents.showDocument?p_id=204182.
1&p_database_id=NOT>
How to Change the IAS_ADMIN password for Enterprise Manager
NOTE:
If you change the IAS_ADMIN password (as described in Note:204182.1),
the ORCLADMIN password does not change.
ORCLADMIN Account
-----------------
To reset (not change) the ORCLADMIN password, you must run the script,
ResetiASpasswd.sh.
Note:
There is a resetiASpasswd.bat on Windows, to be used the same way.
If you suspect that the encryption is skewed, use the SAME password, to *reset*
this. If you desire to change the password you enter when signing onto EM, use
the emctl utility, (as described in Note:204182.1).
If you actually want to change the ORCLADMIN password, you should use the
Oracle Directory Manager, to modify this super user.
- Select a server. The group of tab pages for that server appear in the right
pane.
- Select the System Passwords tab. This page displays the current user names
and passwords for each type of user. Note that passwords are not displayed
in the password fields.
SUMMARY
-------
Is the goal to reset the internally encrypted ias_admin password, change the
actual orcladmin password, or just change the password when logging onto EM?
Thats the main question to ask.
1.
To reset the internally encrypted ias_admin password, use the resetiASpasswd
script, and use the same password as previously given.
2.
To change the orcladmin password, it is best to use the Oracle Directory Manager.
Please see the Oracle Internet Directory Administrator's Guide for more
information.
3.
Change the EM website or emctl password:
Within the EM Web Site...Preferences link...top right-hand side of the screen.
Or, on command line, using emctl.
RELATED DOCUMENTS
-----------------
[NOTE:234712.1]
<http://metalink.oracle.com/metalink/plsql/ml2_documents.showDocument?p_id=234712.
1&p_database_id=NOT> Managing Schemas of the 9iAS Release 2 Metadata Repository
[NOTE:253149.1]
<http://metalink.oracle.com/metalink/plsql/ml2_documents.showDocument?p_id=253149.
1&p_database_id=NOT> Resetting the Single Sign-On password for ORCLADMIN
fix: During installation a random password is generated for the ORASSO database
schema.
You need to look up this password in the Oracle Internet Directory.
The following text is taken from the Interoperability Patch Readme
(a patch that was mandatory for 9.0.2.0.0 but is no longer needed for 9.0.2.0.1):
If you do not know the password for the orasso schema, you can use the following
procedure
to determine the password: Note: Do not use the "alter user" SQL command to change
the orasso password.
If you need to change the orasso password, use Enterprise Manager so that it can
propagate the password
to all components that need to access orasso.
prompt> $ORACLE_HOME/bin/oidadmin
Log into the oidadmin tool using the OID administrator account (cn=orcladmin) for
the Infrastructure installation.
Username: cn=orcladmin
Password: administrator_password
Server : host running Oracle Internet Directory and port number where Oracle
Internet Directory
is listening
The administrator password is the same as the ias_admin password.
The default port for Oracle Internet Directory is 389 (without SSL).
Navigate the Single Sign-On schema (orasso) entry using the administration tool.
the infrastructure instances would have an ORASSO schema entry, but only one of
them is actually being used.
Note:205984.1
Subject: Windows Script to Determine orasso Password in 9iAS Release 2 (9.0.2)
Type: BULLETIN
Status: PUBLISHED
PURPOSE
-------
The showPassword utility was developed to avoid having to use the oidadmin
tool to look up various OID passwords, by using ldapsearch with Oracle9i
Application Server (9iAS) Release 2 (9.0.2).
8<8<8<8<8<8<8<8<8<8<8<8<8<8<8<8<8<8<8<8<8<8<8<8<8<8<
set OIDHOST=bldel18.in.oracle.com
set OIDPORT=4032
if "%1"== "" goto cont
if "%2"== "" goto cont
ldapsearch -h %OIDHOST% -p %OIDPORT% -D "cn=orcladmin" -w "%1" -b "cn=IAS
Infrastructure
Databases,cn=IAS,cn=Products,cn=OracleContext" -s sub "orclResourceName=%2"
orclpasswordattribute
goto :end
:cont
echo Correct Syntax is
echo showpassword.bat orcladminpassword username
:end
8<8<8<8<8<8<8<8<8<8<8<8<8<8<8<8<8<8<8<8<8<8<8<8<8<8<
2. Edit the script and update with your own hostname and OID port
OIDHOST=bldel18.in.oracle.com
OIDPORT=4032
3. Ensure that you have ldapsearch from the correct ORACLE_HOME in the PATH
5. Run the script, and enter the schema name as: orasso, and the password value
is shown.
For example:
(all ONE line...may be easier to copy/paste from Notepad)
----------------------------------------------------------------
5.1 From metalink:
a) StartInfrastructure.bat:
REM ####################################################
REM ####################################################
REM ## Script to start Infrastructure ##
REM ## ##
REM ####################################################
REM ####################################################
REM ##
REM ## Set environment variables for Infrastructure
REM ####################################################
set ORACLE_HOME=D:\IAS90201I
set ORACLE_SID=IASDB
set PATH=%ORACLE_HOME%\bin;%ORACLE_HOME%\dcm\bin;%ORACLE_HOME%\opmn\bin;%PATH%;
REM #####################################################
REM ## Start Oracle Internet Directory processes
REM #####################################################
echo .....Starting %ORACLE_HOME% Internet Directory ......
oidmon start
oidctl server=oidldapd instance=1 start
timeout 20
REM #####################################################
REM ## Start Oracle HTTP Server and OC4J processes
REM #####################################################
echo .....Starting OHS and OC4J processes.......
call dcmctl start -ct ohs
call dcmctl start -ct oc4j
REM #####################################################
REM ## Check OHS and OC4J processes are running
REM #####################################################
echo .....Checking OHS and OC4J status.....
call dcmctl getstate -v
pause
REM ####################################################
b) StartMidTier.bat:
REM ####################################################
REM ####################################################
REM ## Script to start MidTier ##
REM ## ##
REM ####################################################
REM ####################################################
REM ##
REM ## Set environment variables for Midtier
REM ####################################################
set ORACLE_HOME=D:\IAS90201J
set PATH=%ORACLE_HOME%\bin;%ORACLE_HOME%\dcm\bin;%ORACLE_HOME%\opmn\bin;%PATH%;
REM #####################################################
REM ## Start Oracle HTTP Server and OC4J processes
REM #####################################################
echo .....Starting OHS and OC4J processes.......
call dcmctl start -ct ohs
call dcmctl start -ct oc4j
REM #####################################################
REM ## Check OHS and OC4J processes are running
REM #####################################################
echo .....Checking OHS and OC4J status.....
call dcmctl getstate -v
REM ####################################################
REM ## Start Webcache
REM ####################################################
echo .....Starting Webcache..........
webcachectl start
REM ####################################################
REM ## Start Enterprise Manager Website
REM ####################################################
echo .....Starting EM Website.....
net start Oracleias90201iEMWebsite
echo ....Done
pause
REM ####################################################
c) StopMidTier.bat:
REM ####################################################
REM ####################################################
REM ## Script to stop Midtier ##
REM ## ##
REM ####################################################
REM ####################################################
REM ##
REM ## Set environment variables for Midtier
REM ####################################################
set ORACLE_HOME=D:\IAS90201J
set PATH=%ORACLE_HOME%\bin;%ORACLE_HOME%\dcm\bin;%ORACLE_HOME%\opmn\bin;%PATH%;
REM ####################################################
REM ## Stop Enterprise Manager Website
REM ####################################################
echo .....Stopping EM Website.....
net stop Oracleias90201iEMWebsite
REM ####################################################
REM ## Stop Webcache
REM ####################################################
echo .....Stopping %ORACLE_HOME% Webcache..........
webcachectl stop
REM ####################################################
REM ## Stop Oracle HTTP Server and OC4J processes
REM ####################################################
echo .....Stopping %ORACLE_HOME% OHS and OC4J........
dcmctl shutdown
echo ....Done
pause
REM ####################################################
d)StopInfrastructure.bat:
REM ####################################################
REM ####################################################
REM ## Script to stop Infrastructure ##
REM ## ##
REM ####################################################
REM ####################################################
REM ##
REM ## Set environment variables for Infrastructure
REM ####################################################
set ORACLE_HOME=D:\IAS90201I
set ORACLE_SID=IASDB
set PATH=%ORACLE_HOME%\bin;%ORACLE_HOME%\dcm\bin;%ORACLE_HOME%\opmn\bin;%PATH%;
set EM_ADMIN_PWD=<your_pwd>
REM ####################################################
REM ## Stop Enterprise Manager Website
REM ####################################################
echo .....Stopping EM Website.....
call emctl stop
REM ####################################################
REM ## Stop Oracle HTTP Server and OC4J processes
REM ####################################################
echo .....Stopping %ORACLE_HOME% OHS and OC4J........
call dcmctl shutdown
REM #####################################################
REM ## Stop Oracle Internet Directory processes
REM #####################################################
echo .....Stopping %ORACLE_HOME% Internet Directory ......
oidctl server=oidldapd configset=0 instance=1 stop
timeout 20
oidmon stop
echo ....Done
pause
REM #####################################################
----------------------------------------------------------------
5.2 Our scripts:
Starting:
=========
@ECHO OFF
TITLE Startup all
REM **********************************************************
REM Adjust the following values
set ORACLE_BASE=D:\oracle
set IAS_HOME=%ORACLE_BASE%\ias902
set IAS_BIN=%IAS_HOME%\bin
set INFRA_HOME=%ORACLE_BASE%\infra902
set INFRA_BIN=%INFRA_HOME%\bin
REM **********************************************************
echo **********************************************************
echo Parameters used are:
echo ORACLE_BASE = %ORACLE_BASE%
echo IAS_HOME = %IAS_HOME%
echo IAS_BIN = %IAS_BIN%
echo INFRA_HOME = %INFRA_HOME%
echo INFRA_BIN = %INFRA_BIN%
echo **********************************************************
echo **********************************************************
echo "Starting up infra"
echo **********************************************************
echo **********************************************************
echo "Done kickin' up infra!"
echo **********************************************************
echo.
echo **********************************************************
echo "Starting all mid tier services..."
echo **********************************************************
%IAS_HOME%\opmn\bin\opmnctl startall
echo **********************************************************
echo "Done starting up mid tier!"
echo **********************************************************
pause
Stopping:
=========
@ECHO OFF
TITLE Shutdown all
REM **********************************************************
REM Adjust the following values
set ORACLE_BASE=D:\oracle
set IAS_HOME=%ORACLE_BASE%\ias902
set IAS_BIN=%IAS_HOME%\bin
set INFRA_HOME=%ORACLE_BASE%\infra902
set INFRA_BIN=%INFRA_HOME%\bin
REM **********************************************************
echo **********************************************************
echo Parameters used are:
echo ORACLE_BASE = %ORACLE_BASE%
echo IAS_HOME = %IAS_HOME%
echo IAS_BIN = %IAS_BIN%
echo INFRA_HOME = %INFRA_HOME%
echo INFRA_BIN = %INFRA_BIN%
echo **********************************************************
echo **********************************************************
echo "Shutting down mid tier..."
echo **********************************************************
echo "Stopping all mid tier services..."
%IAS_HOME%\opmn\bin\opmnctl stopall
echo **********************************************************
echo "Done shutting down mid tier!"
echo **********************************************************
echo.
echo **********************************************************
echo "Shutting down Infrastructure..."
echo **********************************************************
echo **********************************************************
echo "Done shutting down infra!"
echo **********************************************************
pause
Starting BI:
============
@echo off
title Starting Oracle Reports
rem ********************************************************************
set IAS_HOME=d:\oracle\ias902
set IAS_BIN=%IAS_HOME%\bin
rem ********************************************************************
echo ********************************************************************
echo Parameters used:
echo.
echo IAS_HOME = %IAS_HOME%
echo IAS_BIN = %IAS_BIN%
echo ********************************************************************
echo.
echo ********************************************************************
echo Bringing up OC4J_BI_Forms (Business Intelligence/Forms)
echo ********************************************************************
call %IAS_HOME%\dcm\bin\dcmctl start -co OC4J_BI_Forms -v
timeout 5
pause
Starting CMSDK:
===============
@echo off
title Starting Oracle CM SDK 9.0.3.1.
rem ********************************************************************
set IAS_HOME=d:\oracle\ias902
set IAS_BIN=%IAS_HOME%\bin
rem ********************************************************************
echo ********************************************************************
echo Parameters used:
echo.
echo IAS_HOME = %IAS_HOME%
echo IAS_BIN = %IAS_BIN%
echo ********************************************************************
echo.
echo ********************************************************************
echo Bringing up Domain Controller, note default password is: ifsdp
echo ********************************************************************
call %IAS_HOME%\ifs\cmsdk\bin\ifsctl start
echo Done bringing up Domain Controller
echo.
echo ********************************************************************
echo Bringing up OC4J Instance...
echo ********************************************************************
call %IAS_HOME%\dcm\bin\dcmctl start -co OC4J_iFS_cmsdk -v
timeout 5
pause
Note:207208.1
Subject: Warning: Stop EMD Before Using DCMCTL Utility
Type: BULLETIN
Status: PUBLISHED
PURPOSE
-------
Issue a warning for the use of the dcmctl utility when administering the Oracle9i
Application Server (9iAS) Release 2 (9.0.2.0.x). There is now a Patch available
which
resolves the issue of running DCM and EM at the same time.
DCMCTL RESTRICTIONS
-------------------
1.
Do not use dcmctl while EMD (Enterprise Manager Console/Website) is running.
The dcmctl utility is issuing DCM commands to control the state of components
in 9iAS. The same is done from the EMD, which is generally reachable at the
following URLs:
http://yourserver:1810/emd/console
http://yourserver:1810/
When the dcmctl utility is used while EMD is running, this may cause out-of-sync
problems with your 9iAS instance. This is caused by only one DCM daemon being
available to 'listen' to requests.
Stop EMD:
$ emctl stop
Issue your command with dcmctl
When you are done, restart EMD:
$ emctl start
2.
If an Infrastructure and Mid-Tier(s) are installed on same server, EM must be
stopped when issuing dcmctl from either the Infrastructure or a Mid-tier
directories.
This is because EM is common to all 9iAS instances on the server. Stopping
multiple
instances of EM across multiple servers is not neccessary. The DCM/EM concurrency
conflict will only come into play with instances on a given machine.
3.
Do not issue multiple DCM commands at once, and do not issue a DCM command
while one might still be running.
4.
If you start a component with DCM, it is recommended to also stop it with DCM.
If you start a component with the EM Website, it is recommended stop it with
the EM Website.
SOLUTION
--------
9. MISCELLANEOUS:
=================
If you change the PORT for the repository database, discoverer is affected -
update the port
for discodemo in tnsnames.ora.
Example 1:
----------
set OIDHOST=bldel18.in.oracle.com
set OIDPORT=4032
if "%1"== "" goto cont
if "%2"== "" goto cont
ldapsearch -h %OIDHOST% -p %OIDPORT% -D "cn=orcladmin" -w "%1" -b "cn=IAS
Infrastructure
Databases,cn=IAS,cn=Products,cn=OracleContext" -s sub "orclResourceName=%2"
orclpasswordattribute
goto :end
:cont
echo Correct Syntax is
echo showpassword.bat orcladminpassword username
:end
Example 2:
----------
On a simple 9iAS webcache/j2ee installation, you might try the following command:
F:\oracle\ias902\dcm\bin>dcmctl getstate -V
===========================================================================
1 home oc4j Up True
2 HTTP Server ohs Up True
3 OC4J_Demos oc4j Up True
4 OC4J_iFS_cmsdk oc4j Up True
dcmctl getstate -ct ohs - show status of ohs of the current instance ONLY.
|----------------------------------|
|Machine A |
| |
| |-----------------------------| |
| |Instance A | |
| | - Cluster manager | |
| | - Distributed Lock Manager | |
| | - OS Shared Disk Driver | |--------------
| ----------------------------- | |
|----------------------------------| |
| |
| interconnect ------------
| | Shared |
|----------------------------------| | Disk |
|Machine B | | Subsystem|
| | ------------
| |-----------------------------| | |
| |Instance B | | |
| | - Cluster manager | | |
| | - Distributed Lock Manager | | |
| | - OS Shared Disk Driver | |---------------
| ----------------------------- |
|----------------------------------|
Note 1:
-------
Local Clustering Definition
Local cluster is defined as two or more physical machines (nodes) that share
common disk storage
and logical IP address. Clustered nodes exchange cluster information over
heartbeat link(s).
Cluster software collects information and checks the situation on both nodes. On
error condition,
software will execute a predefined script and switch the clustered services over
to a secondary machine.
Oracle instance, as one of clustered services, will be switched off together with
listener process,
and restarted on the secondary (surviving) node.
HA Oracle Agent
HA Oracle Agent software controls Oracle database activity on Sun Cluster nodes.
The agent performs
fault checking using two processes on the local node and two process on the remote
node by querying
V$SYSSTAT table for active sessions. If the database has no active sessions, HA
Agent will open
a test transaction (connect and execute in serial create, insert, update, drop
table commands).
Return error codes from HA Agent have been validated against a special action file
on location.
/etc/opt/SUNWscor/haoracle_config_V1:
Note 2:
-------
The DATAGUARD manual mentions that you can use ORACLE FAIL SAFE on the windows
platform, but the ORACLE FAIL SAFE documentation doesn't say squat about
DATAGUARD or how to configure for it. Is there any documentation of this
subject that you can refer me to?
and we said...
The two (data guard & failsafe) are complimentary but somewhat orthogonal here.
data guard is a disaster recovery solution. It is for when the room the data
center is in "goes away" for whatever reason.
Data guard wants the machines to be independent (no clusters) of eachother and
separated by some geographic distance.
Failsafe will give you automated failover. As long as the data center exists,
that database is up.
With data guard -- you do not WANT automated failover (many *think* they do but
you don't). Do you really want your DR solution to kick in due to a WAN
failure? No, not really. For DR to take over, you want a human to say "yup,
data center burnt to the ground, lets head for the mountains". You do not want
the DR site to kick in because "it thinks the primary site is gone" -- you need
to tell it "the primary site is gone". In a cluster -- the machines are very
aware of eachother and automated failover is "safe"
Note 3: terms:
--------------
Note 4:
-------
FAQ RAC:
Real Application Clusters
General RAC
Is it supported to install CRS and RAC as different users. (09-SEP-04)
I have changed my spfile with alter system set <parameter_name> =....
scope=spfile. The spfile is on
ASM storage and the database will not start. (18-APR-04)
Is it difficult to transition from Single Instance to RAC? (18-JUL-05)
What are the dependencies between OCFS and ASM in Oracle10g ? (05-MAY-05)
What software is necessary for RAC? Does it have a separate installation CD to
order? (05-MAY-05)
Do we have to have Oracle RDBMS on all nodes? (02-APR-04)
What kind of HW components do you recommend for the interconnect? (02-APR-04)
Is rcp and/or rsh required for normal RAC operation ? (06-NOV-03)
Are there any suggested roadmaps for implementing a new RAC installation? (26-NOV-
02)
What is Cache Fusion and how does this affect applications? (26-NOV-02)
Can I use iSCSI storage with my RAC cluster? (13-JUL-05)
Can I use RAC in a distributed transaction processing environment? (16-JUN-05)
Is it a good idea to add anti-virus software to my RAC cluster? (31-JAN-05)
When configuring the NIC cards and switch for a GigE Interconnect should it be set
to FULL or Half duplex in RAC? (05-NOV-04)
What would you recomend to customer, Oracle clusterware or Vendor Clusterware
(I.E. MC Service Guard, HACMP, Sun Cluster, Veritas etc.) with Oracle Database 10g
Real Application Clusters? (21-OCT-04)
What is Standard Edition RAC? (01-SEP-04)
High Availability
If I use Services with Oracle Database 10g, do I still need to set up Load
Balancing ? (16-JUN-05)
Why do we have a Virtual IP (VIP) in 10g? Why does it just return a dead
connection when its primary node fails? (12-MAR-04)
I am receiving an ORA-29740 error. What should I do? (02-DEC-02)
Can RMAN backup Real Application Cluster databases? (26-NOV-02)
What is Server-side Transparent Application Failover (TAF) and how do I use it?
(07-JUL-05)
What is CLB_GOAL and how should I set it? (16-JUN-05)
Can I use TAF and FAN/FCF? (16-JUN-05)
What clients provide integration with FAN and FCF? (28-APR-05)
What are my options for load balancing with RAC? Why do I get an uneven number of
connections on my instances? (15-MAR-05)
Can our 10g VIP fail over from NIC to NIC as well as from node to node ? (10-DEC-
04)
Can I use ASM as mechanism to mirror the data in an Extended RAC cluster? (18-OCT-
04)
What does the Virtual IP service do? I understand it is for failover but do we
need a separate network card? Can we use the existing private/public cards? What
would happen if we used the public ip? (15-MAR-04)
What do the VIP resources do once they detect a node has failed/gone down? Are the
VIPs automatically acquired, and published, or is manual intervention required?
Are VIPs mandatory? (15-MAR-04)
Scalability
I am seeing the wait events 'ges remote message', 'gcs remote message', and/or
'gcs for action'. What should I do about these? (02-APR-04)
What are the changes in memory requirements from moving from single instance to
RAC? (02-DEC-02)
What is the Load Balancing Advisory? (16-JUN-05)
What is Runtime Connection Load Balancing? (16-JUN-05)
How do I enable the load balancing advisory? (16-JUN-05)
Manageability
How do I stop the GSD? (22-MAR-04)
How should I deal with space management? Do I need to set free lists and free list
groups? (16-JUN-03)
I was installing RAC and my Oracle files did not get copied to the remote node(s).
What went wrong? (26-NOV-02)
What is the Cluster Verification Utiltiy (cluvfy)? (16-JUN-05)
What versions of the database can I use the cluster verification utility (cluvfy)
with? (16-JUN-05)
What are the implications of using srvctl disable for an instance in my RAC
cluster? I want to have it available to start if I need it but at this time to not
want to run this extra instance for this database. (31-MAR-05)
Platform Specific
How many nodes can be had in an HP/Sun/IBM/Compaq/NT/Linux cluster? (21-OCT-04)
Is crossover cable supported as an interconnect with 9iRAC/10gRAC on any
platform ? (21-FEB-05)
Is it possible to run RAC on logical partitions (i.e. LPARs) or virtual separate
servers. (18-MAY-04)
Can the Oracle Database Configuration Assistant (DBCA) be used to create a
database with Veritas DBE / AC 3.5? (10-JAN-03)
How do I check RAC certification? (26-NOV-02)
Where I can find information about how to setup / install RAC on different
platforms ? (08-AUG-02)
Is Veritas Storage Foundation 4.0 supported with RAC? (05-OCT-04)
Platform Specific -- Linux
Is 3rd Party Clusterware supported on Linux such as Veritas or Redhat? (11-MAY-05)
In $ORACLE_HOME/dbs
. oraenv <instance_name>
startup nomount
Now edit the newly created pfile to change the parameter to something sensible.
Then:
shutdown immediate
startup
quit
--------------------------------------------------------------------------------
--------------------------------------------------------------------------------
--------------------------------------------------------------------------------
Are there any suggested roadmaps for implementing a new RAC installation?
Yes, Oracle Support recommends the following best practices roadmap to
successfully implement RAC:
--------------------------------------------------------------------------------
--------------------------------------------------------------------------------
Datafiles will need to be moved to either a clustered file system (CFS) or raw
devices so that all nodes can access it. Also, the MAXINSTANCES parameter in the
control file must be greater than or equal to number of instances you will start
in the cluster.
For more detailed information, please see Migrating from single-instance to RAC in
the Oracle Documentation
--------------------------------------------------------------------------------
--------------------------------------------------------------------------------
With Oracle Database 10g, RAC is an option of EE and available as part of SE.
Oracle provides Oracle Clusterware on its own CD included in the database CD pack.
Please check the certification matrix (Note 184875.1) or with the appropriate
platform vendor for more information.
--------------------------------------------------------------------------------
--------------------------------------------------------------------------------
--------------------------------------------------------------------------------
You will be installing and using Oracle Clusterware whether or not you use the
Vendor Clusterware. The question
you need to ask is whether the Vendor Clusterware gives you something that Oracle
Clusterware does not.
Is the RAC database on the same server as the application server? Are there any
other processes on the same server
as the database that you require Vendor Clusterware to fail over to another server
in the cluster if the server
it is running on fails? IF this is the case, you may want the vendor clusterware,
if not, why spend the extra money
when Oracle Clusterware supplies everything you need to for the clustered database
included with your RAC license.
Modified: 21-OCT-04 Ref #: ID-5968
--------------------------------------------------------------------------------
When configuring the NIC cards and switch for a GigE Interconnect should it be set
to FULL or Half duplex in RAC?
You've got to use Full Duplex, regardless of RAC or not, but for all network
communication. Half Duplex means you can only either send OR receive at the same
time.
Modified: 05-NOV-04 Ref #: ID-6048
--------------------------------------------------------------------------------
--------------------------------------------------------------------------------
--------------------------------------------------------------------------------
Why do we have a Virtual IP (VIP) in 10g? Why does it just return a dead
connection when its primary node fails?
Its all about availability of the application.
When a node fails, the VIP associated with it is supposed to be automatically
failed over to some other node. When this occurs, two things happen. (1) the new
node re-arps the world indicating a new MAC address for the address. For directly
connected clients, this usually causes them to see errors on their connections to
the old address; (2) Subsequent packets sent to the VIP go to the new node, which
will send error RST packets back to the clients. This results in the clients
getting errors immediately.
This means that when the client issues SQL to the node that is now down, or
traverses the address list while connecting, rather than waiting on a very long
TCP/IP time-out (~10 minutes), the client receives a TCP reset. In the case of
SQL, this is ORA-3113. In the case of connect, the next address in tnsnames is
used.
Without using VIPs, clients connected to a node that died will often wait a 10
minute TCP timeout period before getting an error.
As a result, you don't really have a good HA solution without using VIPs.
Modified: 12-MAR-04 Ref #: ID-4609
--------------------------------------------------------------------------------
If I use Services with Oracle Database 10g, do I still need to set up Load
Balancing ?
Yes, Services allow you granular definition of workload and the DBA can
dynamically define which instances provide the service. Connection Load Balancing
still needs to be set up to allow the user connections to be balanced across all
instances providing a service.
Modified: 16-JUN-05 Ref #: ID-6731
--------------------------------------------------------------------------------
--------------------------------------------------------------------------------
For more information on troubleshooting this error, see the following Metalink
note:
Note 219361.1
Troubleshooting ORA-29740 in a RAC Environment
--------------------------------------------------------------------------------
What does the Virtual IP service do? I understand it is for failover but do we
need a separate network card? Can we use the existing private/public cards? What
would happen if we used the public ip?
The 10g Virtual IP Address (VIP) exists on every RAC node for public network
communication. All client communication should use the VIPs in their TNS
connection descriptions. The TNS ADDRESS_LIST entry should direct clienst to VIPs
rather than using hostnames. During normal runtime, the behaviour is the same as
hostnames, however when the node goes down or is shutdown the VIP is hosted
elsewhere on the cluster, and does not accept connection requests. This results in
a silent TCP/IP error and the client fails immediately to the next TNS address. If
the network interface fails within the node, the VIP can be configured to use
alternate interfaces in the same node. The VIP must use the public interface
cards. There is no requirement to purchase additional public interface cards
(unless you want to take advantage of within-node card failover.)
Modified: 15-MAR-04 Ref #: ID-4636
--------------------------------------------------------------------------------
What do the VIP resources do once they detect a node has failed/gone down? Are the
VIPs automatically acquired, and published, or is manual intervention required?
Are VIPs mandatory?
When a node fails, the VIP associated with the failed node is automatically failed
over to one of the other nodes in the cluster. When this occurs, two things
happen:
The new node re-arps the world indicating a new MAC address for this IP address.
For directly connected clients, this usually causes them to see errors on their
connections to the old address;
Subsequent packets sent to the VIP go to the new node, which will send error RST
packets back to the clients. This results in the clients getting errors
immediately.
In the case of existing SQL conenctions, errors will typically be in the form of
ORA-3113 errors, while a new connection using an address list will select the next
entry in the list. Without using VIPs, clients connected to a node that died will
often wait for a TCP/IP timeout period before getting an error. This can be as
long as 10 minutes or more. As a result, you don't really have a good HA solution
without using VIPs.
Modified: 15-MAR-04 Ref #: ID-4638
--------------------------------------------------------------------------------
What are my options for load balancing with RAC? Why do I get an uneven number of
connections on my instances?
All the types of load balancing available currently (9i-10g) occur at connect
time.
This means that it is very important how one balances connections and what these
connections do on a long term basis.
Since establishing connections can be very expensive for your application, it is
good programming practice to connect once and stay connected. This means one needs
to be careful as to what option one uses. Oracle Net Services provides load
balancing or you can use external methods such as hardware based or clusterware
solutions.
The following options exist:
Random
Either client side load balancing or hardware based methods will randomize the
connections to the instances.
On the negative side this method is unaware of load on the connections or even if
they are up meaning they might cause waits on TCP/IP timeouts.
Load Based
Server side load balancing (by the listener) redirects connections by default
depending on the RunQ length of each of the instances. This is great for short
lived connections. Terrible for persistent connections or login storms. Do not use
this method for connections from connection pools or applicaton servers
Session Based
Server side load balancing can also be used to balance the number of connections
to each instance. Session count balancing is method used when you set a listener
parameter, prefer_least_loaded_node_listener-name=off. Note listener name is the
actual name of the listener which is different on each node in your cluster and by
default is listener_nodename.
Session based load balancing takes into account the number of sessions connected
to each node and then distributes ne connections to balance the number of sessions
across the different nodes.
Modified: 15-MAR-05 Ref #: ID-4940
--------------------------------------------------------------------------------
Can I use ASM as mechanism to mirror the data in an Extended RAC cluster?
Yes, but it cannot replicate everything that needs replication.
ASM works well to replicate any object you can put in ASM. But you cannot put the
OCR or Voting Disk in ASM.
In 10gR1 they can either be mirrored using a different mechanism (which could then
be used instead of ASM) or the OCR needs to be restored from backup and the Voting
Disk can be recreated.
In the future we are looking at providing Oracle redundancy for both.
Modified: 18-OCT-04 Ref #: ID-5948
--------------------------------------------------------------------------------
Can our 10g VIP fail over from NIC to NIC as well as from node to node ?
Yes the 10g VIP implementation is capable from failing over within a node from NIC
to NIC and back if the failed NIC is back online again, and also we fail over
between nodes. The NIC to NIC failover is fully redundant if redundant switches
are installed.
Modified: 10-DEC-04 Ref #: ID-6348
--------------------------------------------------------------------------------
--------------------------------------------------------------------------------
--------------------------------------------------------------------------------
What is Server-side Transparent Application Failover (TAF) and how do I use it?
Oracle Database 10g Release 2, introduces server-side TAF when using services.
After you create a service, you can use the dbms_service.modify_service pl/sql
procedure to define the TAF policy for the service. Only the basic method is
supported. Note this is different than the TAF policy (traditional client TAF)
that is supported by srvctl and EM Services page. If your service has a server
side TAF policy defined, then you do not have to encode TAF on the client
connection string. If the instance where a client is connected, fails, then the
connection will be failed over to another instance in the cluster that is
supporting the service. All restrictions of TAF still apply.
NOTE: both the client and server must be 10.2 and aq_ha_notifications must be set
to true for the service.
Sample code to modify service:
execute dbms_service.modify_service (service_name => 'gl.us.oracle.com' -
, aq_ha_notifications => true -
, failover_method => dbms_service.failover_method_basic -
, failover_type => dbms_service.failover_type_select -
, failover_retries => 180 -
, failover_delay => 5 -
, clb_goal => dbms_service.clb_goal_long);
--------------------------------------------------------------------------------
I am seeing the wait events 'ges remote message', 'gcs remote message', and/or
'gcs for action'. What should I do about these?
These are idle wait events and can be safetly ignored. The 'ges remote message'
might show up in a 9.0.1 statspack report as one of the top wait events. To have
this wait event not show up you can add this event to the
PERFSTAT.STATS$IDLE_EVENT table so that it is not listed in Statspack reports.
--------------------------------------------------------------------------------
What are the changes in memory requirements from moving from single instance to
RAC?
If you are keeping the workload requirements per instance the same, then about 10%
more buffer cache and 15% more shared pool is needed. The additional memory
requirement is due to data structures for coherency management. The values are
heuristic and are mostly upper bounds. Actual esource usage can be monitored by
querying current and maximum columns for the gcs resource/locks and ges
resource/locks entries in V$RESOURCE_LIMIT.
But in general, please take into consideration that memory requirements per
instance are reduced when the same user population is distributed over multiple
nodes. In this case:
Assuming the same user population N number of nodes M buffer cache for a single
system then
Thus for example with a M=2G & N=2 & no extra memory for failed-over users
=( 2G / 2 ) + (( 2G / 2 )) *0.10
=1G + 100M
--------------------------------------------------------------------------------
--------------------------------------------------------------------------------
--------------------------------------------------------------------------------
--------------------------------------------------------------------------------
$ gsdctl stop
--------------------------------------------------------------------------------
How should I deal with space management? Do I need to set free lists and free list
groups?
Manually setting free list groups is a complexity that is no longer required.
We recommend using Automatic Segment Space Management rather than trying to manage
space manually. Unless you are migrating from an earlier database version with OPS
and have already built and tuned the necessary structures, Automatic Segment Space
Management is the preferred approach.
Automatic Segment Space Management is NOT the default, you need to set it.
--------------------------------------------------------------------------------
I was installing RAC and my Oracle files did not get copied to the remote node(s).
What went wrong?
First make sure the cluster is running and is available on all nodes. You should
be able to see all nodes
when running an 'lsnodes -v' command.
If lsnodes shows that all members of the cluster are available, then you may have
an rcp/rsh problem on Unix
or shares have not been configured on Windows.
You can test rcp/rsh on Unix by issuing the following from each node:
On Windows, ensure that each node has administrative access to all these
directories within the Windows environment by running the following at the command
prompt:
More information can be found in the Step-by-Step RAC notes available on Metalink.
To find these search Metalink for 'Step-by-Step Installation of RAC'.
--------------------------------------------------------------------------------
What are the implications of using srvctl disable for an instance in my RAC
cluster? I want to have it available
to start if I need it but at this time to not want to run this extra instance for
this database.
During node reboot, any disabled resources will not be started by the Clusterware,
therefore this instance
will not be restarted. It is recommended that you leave the vip, ons,gsd enabled
in that node. For example,
VIP address for this node is present in address list of database services, so a
client connecting to these services
will still reach some other database instance providing that service via listener
redirection. J
ust be aware that by disabling an Instance on a node, all that means is that the
instance itself is not starting.
However, if the database was originally created with 3 instances, that means there
are 3 threads of redo.
So, while the instance itself is disabled, the redo thread is still enabled, and
will occasionally cause
log switches. The archived logs for this 'disabled' instance would still be needed
in any potential database
recovery scenario. So, if you are going to disable the instance through srvctl,
you may also want to consider
disabling the redo thread for that instance.
srvctl disable instance -d orcl -i orcl2
--------------------------------------------------------------------------------
--------------------------------------------------------------------------------
What versions of the database can I use the cluster verification utility (cluvfy)
with?
The cluster verification utility is release with Oracle Database 10g Release 2 but
can also be used with Oracle Database 10g Release 1.
Modified: 16-JUN-05 Ref #: ID-6852
--------------------------------------------------------------------------------
Sun: 8
HP UX: 16
HP Tru64: 8
IBM AIX:
--------------------------------------------------------------------------------
Where I can find information about how to setup / install RAC on different
platforms ?
There is a roadmap for implementing Real Application Clusters' available at:
There are also Step-by-Step notes available for each platform available on the
Metalink 'Top Tech Docs' for RAC:
--------------------------------------------------------------------------------
--------------------------------------------------------------------------------
Note 184875.1
How To Check The Certification Matrix for Real Application Clusters
Please note that certifications for Real Application Clusters are performed
against the Operating System and Clusterware versions. The corresponding system
hardware is offered by System vendors and specialized Technology vendors. Some
system vendors offer pre-installed, pre-configured RAC clusters. These are
included below under the corresponding OS platform selection within the
certification matrix.
--------------------------------------------------------------------------------
With Oracle 9i RAC Release 2 (Oracle 9.2), DBCA can be used to create databases on
a cluster filesystem. If the ORACLE_HOME is stored on the cluster filesystem, the
tool will work directly. If ORACLE_HOME is on local drives on each system, and the
customer wishes to place database files onto a cluster file system, they must
invoke DBCA as follows: dbca -datafileDestination /oradata where /oradata is on
the CFS filesystem. See 9iR2 README and bug 2300874 for more info.
--------------------------------------------------------------------------------
Detailed Reasons:
1) cross-cabling limits the expansion of RAC to two nodes
2) cross-cabling is unstable:
a) Some NIC cards do not work properly with it.
b) Instability. We have seen different problems e.g.. ORA-29740 at
configurations using crossover cable, and other errors.
Due to the benefits and stability provided by a switch, and their afforability,
this is the only supported configuration.
--------------------------------------------------------------------------------
--------------------------------------------------------------------------------
--------------------------------------------------------------------------------
--------------------------------------------------------------------------------
After installing patchset 9013 and patch_2313680 on Linux, the startup was very
slow
Please carefully read the following new information about configuring Oracle
Cluster Management on Linux, provided as part of the patch README:
[5000(msec) is hardcoded]
If CPU utilization in your system is high and you experience unexpected node
reboots, check the wdd.log file. If there are any 'ping came too late' messages,
increase the value of the above parameters.
--------------------------------------------------------------------------------
Yes, OCFS (Oracle Cluster Filesystem) is now available for Linux. The following
Metalink note has information for obtaining the latest version of OCFS:
Note 238278.1 - How to find the current OCFS version for Linux
--------------------------------------------------------------------------------
Where can I find more information about hangcheck-timer module on Linux ? And how
do we configure hangcheck-timer module ?
In releases 9.2.0.2.0 and later, Oracle recommends using a new I/O fencing model
-- HangCheck-Timer module. Hangcheck-Timer
module monitors the Linux kernel for long operating system hangs that could affect
the reliability of a RAC node. You can configure hangcheck-timer module using 3
parameters -- hangcheck_tick, hangcheck_margin and MissCount.
--------------------------------------------------------------------------------
Can RAC 10g and 9i RAC be installed and run on the same physical Linux cluster?
Yes - CRS / CSS and oracm can coexist.
Modified: 20-DEC-04 Ref #: ID-4408
--------------------------------------------------------------------------------
Is the hangcheck timer still needed with Oracle Database 10g RAC?
YES! The hangcheck-timer module monitors the Linux kernel for extended operating
system hangs that could affect the reliability
of the RAC node ( I/O fencing) and cause database corruption. To verify the
hangcheck-timer module is running on every node:
as root user:
/sbin/lsmod | grep hangcheck
If the hangcheck-timer module is not listed enter the following command as the
root user:
To ensure the module is loaded every time the system reboots, verify that the
local system startup file (/etc/rc.d/rc.local) contains the command above.
For additional information please review the Oracle RAC Install and Configuration
Guide (5-41).
--------------------------------------------------------------------------------
--------------------------------------------------------------------------------
--------------------------------------------------------------------------------
Does RAC run faster with Sun-cluster or Veritas cluster-ware? (these being
alternatives with Sun hardware) Is there some clusterware that would make RAC run
faster?
RAC scalability and performance are independent of the clusterware. However, we
recommend that the customer uses a very
fast memory based interconnect if one wants to optimize the performance. For
Example, Sun can use FireLink, a very fast proprietary interconnect which is more
optimal for RAC, while Veritas is limited to using Gigabit Ethernet.
Starting with 10g there will be an alternative to SunCluster and Veritas Cluster
than this is Oracle CRS/CSS.
--------------------------------------------------------------------------------
- 10g RAC + HMP + Itanium, "Oracle has no plans and will likely never
support RAC over HMP on IPF."
--------------------------------------------------------------------------------
Does the Oracle Cluster File System (OCFS) support network access through NFS or
Windows Network Shares?
No, in the current release the Oracle Cluster File System (OCFS) is not supported
for use by network access approaches like NFS or Windows Network Shares.
Modified: 27-JAN-05 Ref #: ID-4122
--------------------------------------------------------------------------------
My customer wants to understand what type of disk caching they can use with their
Windows RAC Cluster, the install guide tells them to disable disk caching?
If the write cache identified is local to the node then that is bad for RAC. If
the cache is visible to all nodes as a 'single cache', typically in the storage
array, and is also 'battery backed' then that is OK.
Modified: 31-MAR-05 Ref #: ID-6670
--------------------------------------------------------------------------------
Can I run my 9i RAC and RAC 10g on the same Windows cluster?
Yes but the 9i RAC database must have the 9i Cluster Manager and you must run
Oracle Clusterware for the Oracle Database 10g. 9i Cluster Manager can coexsist
with Oracle Clusterware 10g.
Modified: 01-JUL-05 Ref #: ID-6889
--------------------------------------------------------------------------------
"If you are not using HACMP, you must use a GPFS file system to store the Oracle
CRS files" ==>
this is a documentation bug and this will be fixed with 10.1.0.3
-----
in order to allow AIX to access the devices from more than one node
simultaneously.
Use the /dev/rhdisk devices (character special) for the crs and voting disk and
change the attribute with the command
chdev -l hdiskn -a reserve_lock=no
(for ESS, EMC, HDS, CLARiiON, and MPIO-capable devices you have to do an chdev -l
hdiskn -a reserve_policy=no_reserve)
--------------------------------------------------------------------------------
Can I run Oracle RAC 10g on my IBM Mainframe Sysplex environment (z/OS)?
YES! There is no separate documentation for RAC on z/OS. What you would call
"clusterware" is built in to the OS
and the native file systems are global. IBM z/OS documentation explains how to set
up a Sysplex Cluster;
once the customer has done that it is trivial to set up a RAC database. The few
steps involved are covered
in in Chapter 14 of the Oracle for z/OS System Admin Guide, which you can read
here. There is also an Install Guide
for Oracle on z/OS ( here) but I don't think there are any RAC-specific steps in
the installation. By the way,
RAC on z/OS does not use Oracle's clusterware (CSS/CRS/OCR).
Modified: 07-JUL-05 Ref #: ID-6910
--------------------------------------------------------------------------------
--------------------------------------------------------------------------------
--------------------------------------------------------------------------------
What is the optimal migration path to be used while migrating the E-Business suite
to RAC?
Following is the recommended and most optimal path to migrate you E-Business suite
to RAC environment:
2. Use Clustered File System for all data base files or migrate all database files
to raw devices. (Use dd for Unix or ocopy for NT)
5. In step 4, install RAC option while installing Oracle9i and use Installer to
perform install for all the nodes.
Reference Documents:
Oracle E-Business Suite Release 11i with 9i RAC: Installation and Configuration :
Metalink Note# 279956.1
E-Business Suite 11i on RAC : Configuring Database Load balancing & Failover:
Metalink Note# 294652.1
Oracle E-Business Suite 11i and Database - FAQ : Metalink# 285267.1
--------------------------------------------------------------------------------
--------------------------------------------------------------------------------
If your processing requirements are extreme and your testing proves you must
partition your workload in order to reduce internode communications, you can use
Profile Options to designate that sessions for certain applications
Responsibilities are created on a specific middle tier server. That middle tier
server would then be configured to connect to a specific database instance.
To determine the correct partitioning for your installation you would need to
consider several factors like number of concurrent users, batch users, modules
used, workload characteristics etc.
--------------------------------------------------------------------------------
--------------------------------------------------------------------------------
--------------------------------------------------------------------------------
We also recommend you configure the forms error URL to identify a fallback middle
tier server for Forms processes, if no router is available to accomplish switching
across servers.
--------------------------------------------------------------------------------
--------------------------------------------------------------------------------
--------------------------------------------------------------------------------
--------------------------------------------------------------------------------
What files can I put on Linux OCFS?
For optimal performance, you should only put the following files on Linux OCFS:
- Datafiles
- Control Files
- Redo Logs
- Archive Logs
- Shared Configuration File (OCR)
- Quorum / Voting File
- SPFILE
--------------------------------------------------------------------------------
For SVM you need Solaris 9 9/04 (Solaris 9 update 7),SVM Patch 116669-03(this is
required SUN patch), Sun Cluster 3.1 Update 3, Oracle 9.2.0.5 + Oracle patch
3366258
For SharedQFS you need Solaris 9 04/03 and above or Solaris 8 02/02 and above, QFS
4.2, Sun Cluster 3.1 Update 2 or above, Oracle 9.2.0.5 + Oracle patch 3566420
Differently, Sun GFS (Global File System) is only supported for Oracle binary and
archive logs only, but NOT for database files.
Modified: 19-JAN-05 Ref #: ID-6128
--------------------------------------------------------------------------------
Is Red Hat GFS(Global File System) is certified by Oracle for use with Real
Application Clusters?
Sistina Cluster Filesystem is not part of the standard RedHat kernel and therefore
is not certified under
the unbreakable Linux but falls under a kernel extension. This however, does not
mean that Oracle RAC is
not certified with it. As a fact, Oracle RAC does not certify against a filesystem
per se, but certifies
against an operating system. If, as is the case with Sistina filesystem, the
filesystem is certified with
the operating system, this only means that the combination does not fall under the
unbreakable Linux combination
and Oracle does not provide direct support and fix the filesystem in case of an
error. Customer will have to contact
the filesystem provider for support.
Modified: 22-NOV-04 Ref #: ID-6228
--------------------------------------------------------------------------------
How to move the OCR location ?
- stop the CRS stack on all nodes using "init.crs stop" - Edit
/var/opt/oracle/ocr.loc on all nodes and set up ocrconfig_loc=new OCR device -
Restore from one of the automatic physical backups using ocrconfig -restore. - Run
ocrcheck to verify. - reboot to restart the CRS stack. - additional information
can be found at http://st-
doc.us.oracle.com/10/101/rac.101/b10765/storage.htm#i1016535
Modified: 24-MAR-04 Ref #: ID-4728
--------------------------------------------------------------------------------
--------------------------------------------------------------------------------
--------------------------------------------------------------------------------
--------------------------------------------------------------------------------
--------------------------------------------------------------------------------
During CRS installation, I am asked to define a private node name, and then on the
next screen asked to define which interfaces should be used as private and public
interfaces. What information is required to answer these questions?
The private names on the first screen determine which private interconnect will be
used by CSS.
Provide exactly one name that maps to a private IP address, or just the IP address
itself. If a logical name is used, then the IP address this maps to can be changed
subsequently, but if you IP address is specified CSS will always use that IP
address. CSS cannot use multiple private interconnects for its communication hence
only one name or IP address can be specified.
--------------------------------------------------------------------------------
Can I change the name of my cluster after I have created it when I am using Oracle
Database 10g Clusterware?
No, you must properly deinstall CRS and then re-install. To properly de-install
CRS, you MUST follow the directions in the Installation Guide Chapter 10. This
will ensure the ocr gets cleaned out.
Modified: 05-OCT-04 Ref #: ID-5890
--------------------------------------------------------------------------------
Can I change the public hostname in my Oracle Database 10g Cluster using Oracle
Clusterware?
Hostname changes are not supported in CRS, unless you want to perform a deletenode
followed by a new addnode operation.
Modified: 05-OCT-04 Ref #: ID-5892
--------------------------------------------------------------------------------
What should the permissions be set to for the voting disk and ocr when doing a RAC
Install?
The Oracle Real Application Clusters install guide is correct. It describes the
PRE INSTALL ownership/permission requirements for ocr and voting disk. This step
is needed to make sure that the CRS install succeeds. Please don't use those
values to determine what the ownership/permmission should be POST INSTALL. The
root script will change the ownership/permission of ocr and voting disk as part of
install. The POST INSTALL permissions will end up being : OCR - root:oinstall -
640 Voting Disk - oracle:oinstall - 644
Modified: 22-OCT-04 Ref #: ID-5988
--------------------------------------------------------------------------------
--------------------------------------------------------------------------------
--------------------------------------------------------------------------------
Does the hostname have to match the public name or can it be anything else?
When there is no vendor clusterware, only CRS, then the public node name must
match the host name. When vendor clusterware is present, it determines the public
node names, and the installer doesn't present an opportunity to change them. So,
when you have a choice, always choose the hostname.
Modified: 05-NOV-04 Ref #: ID-6050
--------------------------------------------------------------------------------
--------------------------------------------------------------------------------
--------------------------------------------------------------------------------
The automatic backup mechanism keeps upto about a week old copy. So, if you want
to retain a backup copy more than that, then you should copy that "backup" file to
some other name.
Unfortunately there are a couple of bugs regarding backup file manipulation, and
changing default backup dir on Windows. These will be fixed in 10.1.0.4. OCR
backup on Windows are absent. Only file in the backup directory is
temp.ocr which would be the last backup. You can restore this most recent backup
by using the command ocr -restore temp.ocr
If you want to take a logical copy of OCR at any time use : ocrconfig -export
, and use -import option to restore the contents back.
--------------------------------------------------------------------------------
--------------------------------------------------------------------------------
--------------------------------------------------------------------------------
--------------------------------------------------------------------------------
--------------------------------------------------------------------------------
Why is the home for Oracle Clusterware not recommended to be subdirectory of the
Oracle base directory?
If anyone other than root has write permissions to the parent directories of the
CRS home, then they can give themselves root escalations. This is a security
issue. The CRS home itself is a mix of root and non-root permissions, as
appropriate to the security requirements. Please follow the install docs about who
is your primary group and what other groups you need to create and be a member of.
--------------------------------------------------------------------------------
--------------------------------------------------------------------------------
Copyright �
9.6 JRE:
========
JRE:
----
- Jave Runtime Interpreter (jre): Similar to the Java Interpreter (java), but
intended for
end users who do not require all the development-related options available with
the java tool.
The PATH statement enables Windows to find the executables (javac, java, javadoc,
etc.)
from any current directory.
The CLASSPATH tells the Java virtual machine and other applications (which are
located in the
"jdk_<version>\bin" directory) where to find the class libraries, such as
classes.zip file
(which is in the lib directory).
Note 1:
-------
Suppose on a Solaris 5.9 machine with Oracle 9.2, we search for jre:
./opt/app/oracle/product/9.2/inventory/filemap/jdk/jre
./opt/app/oracle/product/9.2/jdk/jre
./opt/app/oracle/jre
./opt/app/oracle/jre/1.1.8/bin/sparc/native_threads/jre
./opt/app/oracle/jre/1.1.8/bin/jre
./opt/app/oracle/jre/1.1.8/jre_config.txt
./usr/j2se/jre
./usr/iplanet/console5.1/bin/base/jre
./usr/java1.2/jre
Suppose on a AIX 5.2 machine with Oracle 9.2, we search for jre:
./apps/oracle/product/9.2/inventory/filemap/jdk/jre
./apps/oracle/product/9.2/inventory/filemap/jre
./apps/oracle/product/9.2/jdk/jre
./apps/oracle/product/9.2/jre
./apps/oracle/oraInventory/filemap/apps/oracle/jre
./apps/oracle/oraInventory/filemap/apps/oracle/jre/1.3.1/jre
./apps/oracle/jre
./apps/oracle/jre/1.1.8/bin/jre
./apps/oracle/jre/1.1.8/bin/aix/native_threads/jre
./apps/oracle/jre/1.3.1/jre
./apps/ora10g/product/10.2/jdk/jre
./apps/ora10g/product/10.2/jre
./usr/java131/jre
./usr/idebug/jre
Note 2:
-------
DESCRIPTION
The jre command executes Java class files. The classname argument is the name of
the class to be executed.
Any arguments to be passed to the class must be placed after the classname on the
command line.
Class paths for the Solaris version of the jre tool can be specified using the
CLASSPATH environment variable
or by using the -classpath or -cp options. The Windows version of the jre tool
ignores the CLASSPATH
environment variable. For both Solaris and Windows, the -cp option is recommend
for specifying class paths
when using jre.
OPTIONS
-classpath path(s)
Specifies the path or paths that jre uses to look up classes. Overrides the
default or the CLASSPATH environment
variable if it is set. If more than one path is specified, they must be separated
by colons.
Each path should end with the directory containing the class file(s) to be
executed.
However, if a file to be executed is a zip or jar file, the path to that file must
end with the file's name.
Here is an example of an argument for -classpath that specifies three paths
consisting of the current directory
and two additional paths:
.:/home/xyz/classes:/usr/local/java/classes/MyClasses.jar
-cp path(s)
Prepends the specified path or paths to the base classpath or path given by the
CLASSPATH environment variable.
If more than one path is specified, they must be separated by colons. Each path
should end with the directory
containing the class file(s) to be executed. However, if a file to be executed is
a zip or jar file,
the path to that file must end with the file's name. Here is an example of an
argument for -cp that specifies
three paths consisting of the current directory and two additional paths:
.:/home/xyz/classes:/usr/local/java/classes/MyClasses.jar
-help
Print a usage message.
-mx x
Sets the maximum size of the memory allocation pool (the garbage collected heap)
to x.
The default is 16 megabytes of memory. x must be greater than or equal to 1000
bytes.
By default, x is measured in bytes. You can specify x in either kilobytes or
megabytes by appending the letter
"k" for kilobytes or the letter "m" for megabytes.
-ms x
Sets the startup size of the memory allocation pool (the garbage collected heap)
to x. The default is 1 megabyte
of memory. x must be > 1000 bytes.
By default, x is measured in bytes. You can specify x in either kilobytes or
megabytes by appending the letter
"k" for kilobytes or the letter "m" for megabytes.
-noasyncgc
Turns off asynchronous garbage collection. When activated no garbage collection
takes place unless
it is explicitly called or the program runs out of memory. Normally garbage
collection runs as an
asynchronous thread in parallel with other threads.
-noclassgc
Turns off garbage collection of Java classes. By default, the Java interpreter
reclaims space for unused
Java classes during garbage collection.
-nojit
Specifies that any JIT compiler should be ignored and instead invokes the default
Java interpreter.
-ss x
Each Java thread has two stacks: one for Java code and one for C code. The -ss
option sets the maximum stack size
that can be used by C code in a thread to x. Every thread that is spawned during
the execution of the program
passed to jre has x as its C stack size. The default units for x are bytes. The
value of x must be greater than
or equal to 1000 bytes.
You can modify the meaning of x by appending either the letter "k" for kilobytes
or the letter "m" for megabytes.
The default stack size is 128 kilobytes ("-ss 128k").
-oss x
Each Java thread has two stacks: one for Java code and one for C code. The -oss
option sets the maximum stack size
that can be used by Java code in a thread to x. Every thread that is spawned
during the execution of the program
passed to jre has x as its Java stack size. The default units for x are bytes. The
value of x must be greater
than or equal to 1000 bytes.
You can modify the meaning of x by appending either the letter "k" for kilobytes
or the letter "m" for megabytes.
The default stack size is 400 kilobytes ("-oss 400k").
-v, -verbose
Causes jre to print a message to stdout each time a class file is loaded.
-verify
Performs byte-code verification on the class file. Beware, however, that java
-verify does not perform
a full verification in all situations. Any code path that is not actually executed
by the interpreter
is not verified. Therefore, java -verify cannot be relied upon to certify class
files unless all code paths
in the class file are actually run.
-verifyremote
Runs the verifier on all code that is loaded into the system via a classloader.
verifyremote is the default
for the interpreter.
-noverify
Turns verification off.
-verbosegc
Causes the garbage collector to print out messages whenever it frees memory.
-DpropertyName=newValue
Defines a property value. propertyName is the name of the property whose value you
want to change and newValue
is the value to change it to. For example, this command line
% jre -Dawt.button.color=green ...
sets the value of the property awt.button.color to "green". jre accepts any number
of -D options on the command line.
ENVIRONMENT VARIABLES
CLASSPATH
You can use the CLASSPATH environment variable to specify the path to the class
file or files that you want to execute.
CLASSPATH consists of a colon-separated list of directories that contain the class
files to be executed. For example:
.:/home/xyz/classes
If the file to be executed is a zip file or a jar file, the path should end with
the file name. For example:
.:/usr/local/java/classes/MyClasses.jar
SEE ALSO
CLASSPATH
Note 3:
-------
Log on as root.
Insert the IBM Tivoli Access Manager for Solaris CD.
Install the IBM JRE 1.3.1 package:
pkgadd -d /cdrom/cdrom0/solaris -a /cdrom/cdrom0/solaris/pddefault SUNWj3rt
where -d /cdrom/cdrom0/solaris specifies the location of the package and -a
/cdrom/cdrom0/solaris/pddefault
specifies the location of the installation administration script.
##################################################################################
#
=========
30 LOBS:
=========
Note 1:
=======
A LOB is a Large Object. LOBs are used to store large, unstructured data, such as
video, audio,
photo images etc. With a LOB you can store up to 4 Gigabytes of data.
They are similar to a LONG or LONG RAW but differ from them in quite a few ways.
LOBs offer more features to the developer than a LONG or LONG RAW. The main
differences between
the data types also indicate why you would use a LOB instead of a LONG or LONG
RAW. These differences
include the following: -
� You can have more than one LOB column in a table, whereas you are restricted
to just one LONG
or LONG RAW column per table.
� When you insert into a LOB, the actual value of the LOB is stored in a
separate segment
(except for in-line LOBs) and only the LOB locator is stored in the row,
thus making it more
efficient from a storage as well as query perspective. With LONG or LONG
RAW, the entire data
is stored in-line with the rest of the table row.
� LOBs allow a random access to its data, whereas with a LONG you have to go
in for a sequential read
of the data from beginning to end.
� The maximum length of a LOB is 4 Gig as compared to a 2 Gig limit on LONG
� Querying a LOB column returns the LOB locator and not the entire value of
the LOB.
On the other hand, querying LONG returns the entire value contained within
the LONG column
You can have two categories of LOBs based on their location with respect to the
database. The categories
include internal LOBs and external LOBs. As the names suggest, internal LOBs are
stored within the database,
as table columns. External LOBs are stored outside the database as operating
system files.
Only a reference to the actual OS file is stored in the database. An internal LOB
can also be persistent
or temporary depending on the life of the internal LOB.
DBA_LOBS displays the BLOBs and CLOBs contained in all tables in the database.
BFILEs are stored outside the database,
so they are not described by this view. This view's columns are the same as those
in "ALL_LOBS".
NCLOB and CLOB, are both encoded a internal fixed-width Unicode character set.
The default value for this parameter is 10. That is, you can open a maximum of
10 files at the same time
per session if the default value is utilized. If you want to alter this limit,
the database administrator
can change the value of this parameter in the init.ora file. For example:
SESSION_MAX_OPEN_FILES=20
- LOB locators
Regardless of where the value of the internal LOB is stored, a locator is stored
in the row.
You can think of a LOB locator as a pointer to the actual location of the LOB
value. A LOB locator
is a locator to an internal LOB while a BFILE locator is a locator to an
external LOB.
When the term locator is used without an identifying prefix term, it refers to
both LOB locators and BFILE locators.
For internal LOBs, you can accomplish this by initializing the internal LOB to
empty in an
INSERT/UPDATE statement using the functions EMPTY_BLOB() for BLOBs or
EMPTY_CLOB() for CLOBs and NCLOBs.
For external LOBs, you can initialize the BFILE column to point to an external
file
by using the BFILENAME() function.
Note 2:
=======
Hello,
To find any performance comparison between BFILEs and BLOBs, the best
suggestion is to try a small scale test. One of the customer wrote that his rule
of thumb is that a small number
of large LOBs => bfile, and a large number of small LOBs => BLOB.
The BLOB datatype can store up to 4Gb of data. BLOBs can participate fully in
transactions.
Changes made to a BLOB value by the DBMS_LOB package, PL/SQL, or the OCI can be
committed or rolled back.
The BFILE datatype stores unstructured binary data (such as image files) in
operating-system files
outside the database. A BFILE column or attribute stores a file locator that
points to an external file
containing the data. BFILEs can also store up to 4Gb of data.
Howerver, BFILEs are read-only; you cannot modify them. They support only random
(not sequential) reads,
and they do not participate in transactions. The underlying operating system must
maintain the file integrity
and durability for BFILEs. The database administrator must ensure that the file
exists and that Oracle processes
have operating-system read permissions on the file.
Your application will have an impact on which is preferable. BFILEs will really
help if your application is
WEB based because you can access them through an annonymous FTP connect into the
browser by passing
the URL to the HTML. You can also do this through a regular BLOB, but this would
make you drag the
entire image through the Oracle server buffer cache everytime it is requested. The
separation of the backup
can be beneficial especially if the the image files are mostly static. This
reduces the backup volume of
the database itself. You also don't need a special program for loading them into
the database.
You just copy the files to the OS and run a DML statement to add them. This way
you also avoid the redo
created by inserting them as an internal BLOB.
On the other side of the coin, you will have to devise a file naming
convention/directory structure to prevent
overwriting the BFILE's.
You may want to do only one backup instead of both. With BLOBs, if you backup the
database,
you have everything needed. You won't be able to update a BFILE through the
database, you will always have to
make modifcations through the OS. LOB types can be replicated, but not BFILE.
To answer your question, it depends on how you want to use the data.
A LOB is stored in line by default if it is less than 3,960 bytes, whereas an out-
of-line LOB takes about
20 bytes per row. An inline LOB (i.e. one that is actually stored in the row) is
always logged, but an out-of-line
can be made non-logging. Preference is always to DISABLE STORAGE IN ROW, but if
your LOBs are actually very small,
and the way you use them is sufficiently special then you may want to store them
in line.
But if so, they could probably become simple varchar2(4000).
Note - the minimum size an out-of-line LOB can use is one Oracle block (plus a bit
of extra space in the LOBINDEX).
Thanks!
Kalpana
Oracle Technical Support
Note 3:
=======
Introduction
~~~~~~~~~~~~
This is a short note on the internal storage of LOBs. The information
here is intended to supplement the documentation and other notes
which describe how to use LOBS. The focus is on the storage characteristics
and configuration issues which can affect performance.
The note mainly discusses the first 3 types of LOB which as stored INTERNALLY
within the Oracle DBMS. BFILE's are pointers to external files and
are only mentioned briefly.
Examples of handling LOBs can be found in
[NOTE:47740.1] <ml2_documents.showDocument?p_id=47740.1&p_database_id=NOT>
Attributes
~~~~~~~~~~
There are many attributes associated with LOB columns. The aim here
is to cover the fundamental points about each of the main attributes.
The attributes for each LOB column are specified using the
"LOB (lobcolname) STORE AS ..." syntax.
SELECT
l.table_name as "TABLE",
l.column_name as "COLUMN",
l.segment_name as "SEGMENT",
l.index_name as "INDEX",
l.chunk as "CHUNKSIZE", l.LOGGING, l.IN_ROW, t.tablespace_name
FROM DBA_LOBS l, DBA_TABLES t
WHERE l.table_name=t.table_name AND
l.owner in ('VPOUSERDB','TRIDION_CM');
Storage Parameters
~~~~~~~~~~~~~~~~~~
By default LOB segments are created in the same tablespace as the
base table using the tablespaces default storage details. You can
specify the storage attributes of the LOB segments thus:
In 8.0 the LOB INDEX can be stored separately from the lob segment.
If a tablespace is specified for the LOB SEGMENT then the LOB INDEX
will be placed in the same tablespace UNLESS a different tablespace
is explicitly specified.
Unless you specify names for the LOB segments system generated names
are used.
If the lob value is greater than 3964 bytes then the LOB data is
stored in the LOB SEGMENT (ie: out of line). An out of line
LOB behaves as described under 'disable storage in row' except that
if its size shrinks to 3964 or less the LOB can again be stored
inline.
Both REDO and UNDO are written for in-line LOBS as they are part
of the normal row data.
The Lob Locator actually gives a key into the LOB INDEX which
contains a list of all blocks (or pages) that make up the LOB.
UNDO is only written for the column locator and LOB INDEX changes.
CHUNK size
~~~~~~~~~~
"STORE AS ( CHUNK bytes ) "
Can ONLY be specified at creation time.
In 8.0 values of CHUNK are in bytes and are rounded to the next
highest multiple of DB_BLOCK_SIZE without erroring.
Eg: If you specify a CHUNK of 3000 with a block size of 2K then
CHUNK is set to 4096 bytes.
PCTVERSION can prevent OLD pages being used and force the segment
to extend instead.
CACHE
~~~~~
"STORE AS ( CACHE )" or "STORE AS ( NOCACHE )"
This option can be changed after creation using:
ALTER TABLE tabname MODIFY LOB (lobname) ( CACHE );
or
ALTER TABLE tabname MODIFY LOB (lobname) ( NOCACHE );
With NOCACHE set (the default) reads from and writes to the
LOB SEGMENT occur using direct reads and writes. This means that
the blocks are never cached in the buffer cache and the the Oracle
shadow process performs the reads/writes itself.
The reads / writes show up under the wait events "direct path read"
and "direct path write" and multiple blocks can be read/written at
a time (provided the caller is using a large enough buffer size).
When set the CACHE option causes the LOB SEGMENT blocks to
be read / written via the buffer cache . Reads show up as
"db file sequential read" but unlike a table scan the blocks are
placed at the most-recently-used end of the LRU chain.
In-line LOBS are not affected by the CACHE option as they reside
in the actual table block (which is typically accessed via the buffer
cache any way).
The cache option can affect the amount of REDO generated for
out of line LOBS. With NOCACHE blocks are direct loaded and
so entire block images are written to the REDO stream. If CHUNK
is also set then enough blocks to cover CHUNK are written to REDO.
If CACHE is set then the block changes are written to REDO.
Eg: In the extreme case 'DISABLE STORAGE IN ROW NOCACHE CHUNK 32K'
would write redo for the whole 32K even if the LOB was only
5 characters long. CACHE would write a redo record describing the
5 byte change (taking about 100-200 bytes).
LOGGING
~~~~~~~
"STORE AS ( NOCACHE LOGGING )" or "STORE AS ( NOCACHE NOLOGGING )"
This option can be changed after creation but the LOGGING / NOLOGGING
attribute must be prefixed by the NOCACHE option. The CACHE option
implicitly enables LOGGING.
Performance Issues
~~~~~~~~~~~~~~~~~~~
Working with LOBs generally requires more than one round trip to the database.
The application first has to obtain the locator and only then can perform
operations against that locator. This is true for inline or out of line
LOBS.
The buffer size used to read / write the LOB can have a significant
impact on performance, as can the SQL*Net packet sizes.
Eg: With OCILobRead() a buffer size is specified for handling the LOB.
If this is small (say 2K) then there can be a round trip to the database
for each 2K chunk of the LOB. To make the issue worse the server will
only fetch the blocks needed to satisfy the current request so may
perform single block reads against the LOB SEGMENT. If however a larger
chunk size is used (say 32K) then the server can perform multiblock
operations and pass the data back in larger chunks.
BFILEs
~~~~~~
BFILEs are quite different to internal LOBS as the only real storage
issue is the space required for the inline locator. This is about 20 bytes
PLUS the length of the directory and filename elements of the BFILENAME.
The performance implications of the buffer size are the same as for internal
LOBS.
References
~~~~~~~~~~
[NOTE:162345.1] <ml2_documents.showDocument?p_id=162345.1&p_database_id=NOT>
LOBS - Storage, Read-consistency and Rollback
Note 4:
=======
Table created.
Again, the lob segment storage values do not impact the lob index.
4.Storage modifications of lobindex segment only
If you modify the storage values for the lob index segment only, nothing is
altered:
SQL> alter table t_lob
2 modify lob (document_blob)
3 (index (storage (next 70K pctincrease 70 maxextents 7)))
4 ;
Table altered.
SQL> select segment_name, segment_type, tablespace_name,
2 initial_extent, next_extent, pct_increase, max_extents
3 from user_segments;
If you attempt to modify the storage values of the lob index directly,
you get an error message:
SQL> alter index SYS_IL0000020297C00002$$ storage (pctincrease 20);
alter index SYS_IL0000020297C00002$$ storage (pctincrease 20)
*
ERROR at line 1:
ORA-22864: cannot ALTER or DROP LOB indexes
Migration from 7 to 9i
The "Oracle9i Database Migration Release 1 (9.0.1)" documentation states:
LOB Index Clause
If you used the LOB index clause to store LOB index data in a tablespace
separate from the tablespace used to store the LOB, the index data
is relocated to reside in the same tablespace as the LOB.
If you used Export/Import to migrate from Oracle7 to Oracle9i, the index
data was relocated automatically during migration. However, the index data
was not relocated if you used the Migration utility or the Oracle Data
Migration Assistant.
RELATED DOCUMENTS
-----------------
<Note:66431.1> LOBS - Storage, Redo and Performance Issues
<Bug:1353339> ALTER TABLE MODIFY DEFAULT ATTRIBUTES LOB DOES NOT UPDATE LOB INDEX
DEFAULT TS
<Bug:1864548> LARGE LOB INDEX SEGMENT SIZE
<Bug:747326> ALTER TABLE MODIFY LOB STORAGE PARAMETER DOES'T WORK
<Bug:1244654> UNABLE TO CHANGE STORAGE CHARACTERISTICS FOR LOB INDEXES
Note 5:
=======
Calculate sizes:
Example
-------
SQL> create table my_lob
2 (idx number null, a_lob clob null, b_lob blob null)
3 storage (initial 20k maxextents 121 pctincrease 0 )
4 lob (a_lob, b_lob) store as
5 ( storage ( initial 100k next 100K maxextents 999 pctincrease 0));
Table created.
SQL> select object_name,object_type,object_id from user_objects order by 2;
OBJECT_NAME OBJECT_TYPE OBJECT_ID
---------------------------------------- ------------------ ----------
SYS_LOB0000004017C00002$$ LOB 4018
SYS_LOB0000004017C00003$$ LOB 4020
MY_LOB TABLE 4017
SQL> select bytes, s.segment_name,s.segment_type
2 from dba_segments s
3 where s.segment_name='MY_LOB';
BYTES SEGMENT_NAME SEGMENT_TYPE
---------- ------------------------------ ------------------
65536 MY_LOB TABLE
SQL> select sum(bytes), s.segment_name, s.segment_type
2 from dba_lobs l, dba_segments s
3 where s.segment_type = 'LOBSEGMENT'
4 and l.table_name = 'MY_LOB'
5 and s.segment_name = l.segment_name
6 group by s.segment_name,s.segment_type;
SUM(BYTES) SEGMENT_NAME SEGMENT_TYPE
---------- ------------------------------ ------------------
131072 SYS_LOB0000004017C00002$$ LOBSEGMENT
131072 SYS_LOB0000004017C00003$$ LOBSEGMENT
Therefore the total size for the table MY_LOB is:
65536 (for the table) + 131072 (for CLOB segment) + 131072 (for BLOB segment)
=> 327680 bytes
Note 6:
=======
April 2004
APPENDIX
A.................................................................................
.... 13
LONG API access to LOB datatype............................................... 13
APPENDIX
B.................................................................................
.... 15
Migration from in-line to out-of-line (and out-of-line to in-line) storage 15
APPENDIX
C.................................................................................
.... 16
How LOB data is
stored.................................................................. 16
In-line LOB ? LOB size less than 3964 bytes............................. 16
In-line LOB ? LOB size = 3965 bytes (1 byte greater than 3964) 16
In-line LOB ? LOB size greater than 12 chunk addresses........... 17
Out-of-line LOBs ? All LOB sizes.............................................. 17
Executive Overview
This document gives a brief overview of Oracle?s LOB data structure, emphasizing
various storage parameter options
and describes scenarios where those storage parameters are best used. The purpose
of the latter is to help describe
the effects of readers select the appropriate LOB storage options. This paper
assumes that most customers load
LOB data once and retrieve many times (less than 10% of DML is update and delete),
so performance guidelines provided
here are for LOB loading.
LOBs were designed to efficiently store and retrieve large amounts of data. Small
LOBs (< 1MB) perform better
than LONGs for inserts, and have comparable performance on selects. Large LOBs
perform better than LONGs in general.
LOB Overview
Whenever a table containing a LOB column is created, two segments are created to
hold the specified LOB column.
These segments are of type LOBSEGMENT and LOBINDEX.
The LOBINDEX segment is used to access LOB chunks/pages that are stored in the
LOBSEGMENT segment.
The LOBSEGMENT and the LOBINDEX segments are stored in the same tablespace as the
table containing the LOB,
unless otherwise specified.[1]
This section defines the important storage parameters of a LOB column (or a LOB
attribute) - .
?fFor each definition we describe the effects of the parameter, and give
recommendations for on how to get
better performance and to avoid errors.
CHUNK
Definition
Points to Note
Recommendation
Choose a chunk size for optimal performance and minimum space wastage. For LOBs
that are less than 32K,
a chunk size that is 60% (or more) of the LOB size is a good starting point. For
LOBs larger than 32K,
choose a chunk size equal to the frequent update size.
In-line and Out-of-Line storage: ENABLE STORAGE IN ROW and DISABLE STORAGE IN ROW
Definition
LOB storage is said to be Inin-line when the LOB data is stored with the other
column data in the row.
A LOB can only be stored inline if its size is less than ~4000 bytes. For in-line
LOB data, space is allocated
in the table segment (the LOBINDEX and LOBSEGMENT segments are empty).
LOB storage is said to be out-of-line when the LOB data is stored , in CHUNK sized
blocks in the LOBSEGMENT segment,
separate from the other columns? data.
ENABLE STORAGE IN ROW allows LOB data to be stored in the table segment provided
it is less than ~4000 bytes.
DISABLE STORAGE IN ROW prevents LOB data from being stored in-line, regardless of
the size of the LOB.
Instead only a 20-byte LOB locator is stored with the other column data in the
table segment.
Points to Note
? In-line LOBs are subject to normal chaining and row migration rules
within Oracle. If you store a
3900 byte LOB in a row with 2K block size then the row will be chained
across two or more blocks.
Both REDO and UNDO are written for in-line LOBs as they are part of the
normal row data.
The CHUNK option does not affect in-line LOBs.
? With out-of-line storage, UNDO is written only for the LOB locator and
LOBINDEX changes.
No UNDO is generated for chunks/pages in the LOBSEGMENT. Consistent Read
is achieved by using
page versions (see the RETENTION or PCTVERSION options).
? When in-line LOB data is updated, and if the new LOB size is greater
than 3964 bytes, then it is
migrated and stored out-of-line. If this migrated LOB is updated again
and its size becomes less
than 3964 bytes, it is not moved back in-line (except when we use LONG
API for update).
Recommendation
Use ENABLE STORAGE IN ROW, except in cases where the LOB data is not retrieved as
much as other columns? data.
In this case, if the LOB data is stored out-of-line, the biggest gain is achieved
while performing full table scans,
as the operation does not retrieve the LOB?s data.
CACHE, NOCACHE
Definition
The CACHE storage parameter causes LOB data blocks to be read/written via the
buffer cache.
With the NOCACHE storage parameter, LOB data is read/written using direct
reads/writes. This means that the LOB data
blocks are never in the buffer cache and the Oracle server process performs the
reads/writes.
Points to Note
? With the CACHE option, LOB data reads show up as wait event ?db file
sequential read?, writes are performed
by the DBWR process. With the NOCACHE option, LOB data reads/writes show
up as wait events
direct path read (lob)?/?direct path write (lob)?. Corresponding
statistics are ?physical reads direct (lob)?
and ?physical writes direct (lob)?.
? In-line LOBs are not affected by the CACHE option as they reside with
the other column data,
which is typically accessed via the buffer cache.
? The CACHE option gives better read/write performance than the NOCACHE
option.
? The CACHE option for LOB columns is different from the CACHE option for
tables. This means that caution
is required otherwise the read of a large LOB can effectively flush the
buffer cache.
Recommendation
Enable caching, except for cases where caching LOBs would severely impact
performance for other online users,
by forcing these users to perform disk reads rather than getting cache hits.
Consistent Read (CR) on LOBs uses a different mechanism than that used for other
data blocks in Oracle.
Older versions of the LOB are retained in the LOB segment and CR is used on the
LOB index to access these
older versions (for in-line LOBs which are stored in the table segment, the
regular UNDO mechanism is used).
There are two ways to control how long older versions are maintained.
Definition
Points to Note
Recommendation
A high value for RETENTION or PCTVERSION may be needed to avoid ?snapshot too old?
errors in environments
with high concurrent read/write LOB access.
LOGGING, NOLOGGING
Definition
NOLOGGING: changes to LOB data (stored in LOBSEGMENTs) are not logged into the
redo logs, however in-line LOB
changes are still logged as normal.
Points to Note
Recommendation
Use NOLOGGING only when doing bulk loads or migrating from LONG to LOB.
Backup is recommended after bulk operations.
In the rest of the document, you will notice LOB API and LONG API methods being
referenced many times.
The difference between these APIs is as follows:
LOB API: the LOB data is accessed by first selecting the LOB locator.
LONG API: the LOB data is accessed without using the LOB locator.
Points to Note
Use array operations for LOB inserts
Scalability problem with LOB disable storage in row option
Problem scenario: 2 (or more) concurrent sqlldr processes trying to load LOB data
(LOB column defined with
DISABLE STORAGE IN ROW). Loading will run almost serially. Serialization point is
getting a CR copy of the LOBINDEX block.
Workaround: use ENABLE STORAGE IN ROW even for LOBs whose size is greater than
3964 bytes.
With ENABLE STORAGE IN ROW, we store the first 12 chunk addresses in the table row
and if the inserted LOB data size
can be addressed within these first 12 chunk addresses, then LOBINDEX is empty.
Generating a CR version of a table block
is more efficient and,,, in some cases, not required. This code path provides much
better scalability. Please note that
if LOB data is larger than 12 chunk addresses, then we may see CR contention with
the ENABLE STORAGE IN ROW option as well.
TAR 2760194.995 (UK) - LOADING SMALL (AVG LEN 1120) CLOB DATA INTO TABLE PRODUCES
MUCH CHAINING, WHY?
Problem scenario: in 10gR1 (and older releases), SQL*Loader uses OCILobWrite API
for LOB loading.
This leads to a row chaining problem, as described below:
Load 3 rows with LOB data size as 3700, 3000 and 3400 respectively.
SQL*Loader loads the LOB columns, first by inserting empty_blob, and second, by
writing the LOB data using the LOB locator.
In the first step, the average row length is pkey length + empty_blob length= 4 +
40 bytes = ~44 bytes.
Assuming that DB_BLOCK_SIZE=8192, these 3 rows can be inserted into one data
block.
In the second step, loading LOB data, the 1st row, 3700 bytes of LOB, and the 2nd
row, 3000 bytes of LOB, can be inserted
into the same block. However, for the 3rd row of LOB data, there is no space left
in that block, so the row must be chained.
Workaround: the first workaround could be to increase the value of PCTFREE. It may
help solve this problem,
but it unnecessarily wastes space. The second workaround is to write a loader
program using the LONG API method
(please note that an enhancement request against sqlldr component is filed for
this problem, and there is a plan
to fix it in the future release).
BUG 3297800 - SQLLDR MAY NEED TO USE LONG API INTERFACE FOR LOBS LESS THAN 2GB
Problem scenario: 2 (or more) concurrent sqlldr processes loading LOB data in
conventional mode. Using the LOB API method
for loading the LOB data in a single user environment may also cause a high number
of CR block creation to occur.
As mentioned earlier, loading the LOB data is performed in 2 steps. . In the first
step, sqlldr inserts empty_blob
for LOB columns. Then, with this LOB locator, the LOB data is written using an
OCILobWrite call.
In a multi-user loading environment, before OCILobWrite is invoked, if other
loading processes change the data block,
it may be required to examine the block and, if required, a CR version of the
block is created.
Workaround: None, other than writing a loader program using he LONG API method
BUG 3504487 - DBMS_LOB/OCILob* CALL RESOURCE USAGE IS NOT REPORTED, AS THEY ARE
NOT PART OF A CURSOR
Problem scenario: the work done using LOB API calls is not part of the cursor, so
reporting resource usage while
collecting statistics for the LOB workload, such as the CPU time or the elapsed
time, may not be accurate.
(We have already a table created as: CREATE TABLE foo (pkey NUMBER, bar BLOB);)
Declare
lob_loc blob;
buffer raw(32767);
lob_amt binary_integer := 16384;
begin
buffer := utl_raw.cast_to_raw(rpad('FF', 32767, 'FF'));
for j in 1..10000 loop
select bar into lob_loc from foo where pkey = j for update;
dbms_lob.write(lob_loc, lob_amt, 1, buffer );
commit;
end loop;
dbms_output.put_line ('Write test finished ');
end;
/
After executing the above PL/SQL, query V$SQL to measure cpu_time and elapsed time
resource usage.
SQL_TEXT
----------------------------------------------------------------------------------
--------------
CPU_TIME/1000000 ELAPSED_TIME/1000000
-------------------------- -----------------------------------
As you can see, the PL/SQL block took about 19.54 seconds in CPU time and 19.28
seconds in elapsed time respectively.
Out of 19.54 secondss , the SELECT statement contributed to 5.00 seconds, so the
remaining 14 seconds (approximately)
were spent in dbms_lob.write. This is not reported, because the work done by
dbms_lob.write is not part of a cursor.
Similarly OCILOB API calls were not part of a cursor as well.
Workaround: None
Reads/Writes are done one chunk at a time in synchronous way
BUG 3437770 - LOB DIRECT PATH READ/WRITES ARE LIMITED BY CHUNK SIZE
Problem scenario: The Oracle server process does NOCACHE LOB reads/writes using a
direct path mechanism.
The limitation here is that reads/writes are done one chunk at a time in a
synchronous way. Consider the example below:
Assuming CHUNK size=8K, DB_BLOCK_SIZE=2k, LOB data = 64K, 8 writes are done (each
doing 4 blocks of write at a time)
to load the entire LOB data, waiting for each write to complete before issuing
another write.
BUG 3437770 - LOB DIRECT PATH READ/WRITES ARE LIMITED BY CHUNK SIZE
This is probably due to the above limitation (reads/writes are done one chunk at
time in synchronous way)
Problem scenario: loading LOB data with the CACHE option will most likely fill up
even a large buffer cache.
Under this condition, a degradation in the load rate can be seen if the database
writer doesn?t keep up with
the foreground free buffer requests.
- use asynchronous I/O (if not possible, use multiple db writer processes)
The CACHE option will also force other online users to perform physical disk
reads.
This can be avoided by using multiple block sizes.
For example, keep online user objects in 4k (or 8k) block size tablespace and and
cached LOB data in 8kK (or 16k)
block size tablespace. Allocate the required amount of buffer cache for each block
sizes
(e.g. db_4k_block_buffer=500M, db_8k_block_buffer=2000M)
BUG 3324897 - LOBS LESS THAN 3964 BYTES ARE STORED OUT-OF-LINE WHILE LOADING USING
SQLLDR
Problem scenario: wWhen dealing with multi-byte character set, additional bytes
are required for CLOB data. This may cause
client side CLOB data of ~ 4000 bytes, being stored out-of-line in the database.
Workaround: None
Use array operations for LOB inserts
Problem scenario: given the large size of LOB data (compare to relational table
row size), blocks under
HWM are filled rapidly (under high concurrent load condition) and can cause HW
enqueue contention.
BUG 3429986 - CONVENTIONAL LOAD OF LOB FROM 2 RAC NODE DO NOT SCALE DUE TO LOG
FLUSH LATENCIES
Problem scenario: In a RAC environment, when loading LOB data into one partition,
you may notice contention on 1st level
bitmap and LOB header segment with ASSM. You may notice the same contention on a
single instance
(with a large number of CPUs) with a high number of concurrent loaders.
Workaround: loading into separate partitions will avoid this situation. If this is
not possible, use range-hash partition
instead of just range partitions. FREEPOOLS should help in this situation, but we
need to do more testing to see
the effect of this parameter.but didn?t provide any improvement in our testing.
BUG 3234751 - EXCESSIVE USAGE OF TEMP TS WHILE LOADING LOB USING SQLLDR IN
CONVENTIONAL MODE
BUG 3230541 - LOB LOADING USING SQLLDR DIRECT PATH SLOWER THAN CONVENTIONAL
APPENDIX A
APPENDIX A
Oracle provides transparent access to LOBs from applications that use LONG and
LONG RAW datatypes. If your application
uses DML (INSERT, UPDATE, DELETE) statements from OCI or PL/SQL (PRO*C etc) for
LONG or LONG RAW data, no application
changes are required after the column is converted to a LOB.
For example, you can SELECT a CLOB into a character variable, or a BLOB into a RAW
variable. You can define a CLOB column
as SQLT_CHR or a BLOB column as SQLT_BIN and select the LOB data directly into a
CHARACTER or RAW buffer without selecting
out the locator first.
set serveroutput on
declare
in_buf raw(32767);
out_buf raw(32767);
out_pkey number;
begin
in_buf := utl_raw.cast_to_raw (rpad('FF', 32767, 'FF'));
end;
/
That works.
There are few things customer should note when doing the LONG to LOB migration.
This alter table migration statement runs
serially in 9i. i (what about 8i,10g). Indexes need to be rebuilt and statistics
recollected.
After the LONG to LOB migration, the above PL/SQL block will work without any
modifications.
Advanced LOB features may require the use of the LOB API, described in the Oracle
Documentation[2]
APPENDIX B
If a change to the in-line LOB data makes it larger than 3964 bytes, then it is
automatically moved out of table segment
and stored out-of-line. If during future operations, the LOB data shrinks to under
3964 bytes, it will remain out-of-line.
Consider a scenario where you used the LONG API to update the LOB datatype
[..]
begin
in_buf := utl_raw.cast_to_raw (rpad('FF', 3964, 'FF'));
insert into foo values (1, in_buf) ;
commit;
[..]
Above LOB is stored in-line, update the LOB to a size more than 3964 bytes
[..]
in_buf := utl_raw.cast_to_raw (rpad('FF', 4500, 'FF'));
update foo set bar=buffer where pkey=1;
commit;
[..]
After the update LOB is stored out-of-line, now update the LOB to a size smaller
than 3964 bytes
[..]
in_buf := utl_raw.cast_to_raw (rpad('FF', 3000, 'FF'));
update foo set bar=buffer where pkey=1;
commit;
[..]
When using the LONG API for update, the older LOB is deleted (or space is
reclaimed as per RETENTION or PCTVERSION setting)
and a new LOB is created, with a new LOB locator. This is different from using LOB
API, where DML on LOB is possible only
using the LOB locator (the LOB locator doesn?t change)
APPENDIX C
The purpose of this section is to differentiate how the ENABLE STORAGE IN ROW
option is different from the
DISABLE STORAGE IN ROW option for LOB data size greater than 3964 bytes. It also
highlights customers when LOBINDEX
is really used (following example scenarios assume Solaris OS and Oracle 9204 32
bit version)..
declare
inbuf raw(3964);
begin
inbuf := utl_raw.cast_to_raw(rpad('FF', 3964, 'FF'));
insert into foo values (1, NULL);
insert into foo values (2, EMPTY_BLOB() );
insert into foo values (3, inbuf );
commit;
end;
/
Pkey=1
Bar=0 byte (nothing is stored)
Pkey=2
Bar=36 byte (10 byte metadata + 10 byte LobId + 16 byte Inode)
Pkey=3
Bar=4000 byte (36 byte + 3964 byte of LOB data, nothing stored in LOBINDEX and
LOBSEGMENT
In-line LOB ? LOB size = 3965 bytes (1 byte greater than 3964)
LOB is defined as in-line, but actual data is greater than 3964 bytes, so moved
out ? please note this is different from
LOB being defined as out-of-line.
[..]
inbuf := utl_raw.cast_to_raw(rpad('FF', 3965, 'FF'));
insert into foo values (4, inbuf );
[..]
Foo table row
Pkey=4
Bar=40 bytes (36 byte + 4 byte for one chunk RDBA). Using this RDBA, we directly
access LOB data in LOBSEGMENT.
Nothing stored in LOBINDEX
With in-line LOB option, we store the first 12 chunk addresses in the table row.
This takes 84 bytes (36+4*12) of size
in table row. LOBs that are less than 12 chunks in size will not have entries in
the LOBINDEX if
ENABLE STORAGE IN ROW is used
[..]
inbuf := utl_raw.cast_to_raw(rpad('FF', 32767, 'FF'));
insert into foo values (5, inbuf );
[..]
Here, we are inserting 32767 bytes of LOB data, given our chunk
size of 2k, we need approximately 16 blocks (32767/2048). So we store first 12
chunk RDBAs in table row and the rest in LOBINDEX
Pkey=5
Bar=84 bytes (36 byte + 4*12 byte for first 12 chunk RDBA). Using this RDBA, we
directly
access 12 LOB chunks in LOBSEGMENT. Then using the LobId, we lookup LOBINDEX to
get rest of the LOB chunk RDBAs.
With out-of-line LOB option, only LOB locator is stored in table row. Using LOB
locator, we lookup LOBINDEX and find the range
of chunk RDBAs, using this RDBAs we read LOB data from LOBSEGMENT
[..]
inbuf := utl_raw.cast_to_raw(rpad('FF', 20, 'FF'));
insert into foo values (6, inbuf );
[..]
Oracle Corporation
World Headquarters
500 Oracle Parkway
Redwood Shores, CA 94065
U.S.A.
Worldwide Inquiries:
Phone: +1.650.506.7000
Fax: +1.650.506.7200
www.oracle.com
--------------------------------------------------------------------------------
[1] In Oracle8i, users can specify storage parameters for LOB index, but from
Oracle9i Database onwards,
specifying storage parameters for a LOB index is ignored without any error and
the index is stored
in the same tablespace as the LOB segment, with an Oracle generated index
name.
--------------------------------------------------------------------------------
Copyright � 2005, Oracle. All rights reserved. Legal Notices and Terms of Use.
Note 7:
=======
The TO_LOB function is provided in Oracle 8.1.x to convert LONG and LONG RAW
datatypes to CLOB and BLOB datatypes respectively.
Note: When a LOB is stored in a table, the data (LOB VALUE) and a pointer to
the data called a LOB LOCATOR, are stored separately. The data may be stored
along with the locator in the table itself or in a separate table. The LOB
clause in the create table command can be used to specify whether an attempt
should be made to store data in the main table or a separate one. The LOB
clause may also be used to specify a separate tablespace and storage clause
for both the LOB table and its associated index.
Example:
Table created.
1 row created.
Example:
Table created.
1 row created.
C2
-----------------------------------------------
This is some long data to be migrated to a CLOB
References:
===========
The following INSERT statement populates story with the character string 'JFK
interview',
sets flsub, frame and sound to an empty value, sets photo to NULL, and
initializes music to point to the file 'JFK_interview' located under the logical
directory
'AUDIO_DIR' (see the CREATE DIRECTORY command in the Oracle8i Reference. Character
strings are inserted
using the default character set for the instance.
Similarly, the LOB attributes for the Map_typ column in Multimedia_tab can be
initialized to NULL
or set to empty as shown below. Note that you cannot initialize a LOB object
attribute with a literal.
SELECTing a LOB
Performing a SELECT on a LOB returns the locator instead of the LOB value. In the
following PL/SQL fragment
you select the LOB locator for story and place it in the PL/SQL locator variable
Image1 defined
in the program block. When you use PL/SQL DBMS_LOB functions to manipulate the LOB
value, you refer
to the LOB using the locator.
DECLARE
Image1 BLOB;
ImageNum INTEGER := 101;
BEGIN
SELECT story INTO Image1 FROM Multimedia_tab
WHERE clip_id = ImageNum;
DBMS_OUTPUT.PUT_LINE('Size of the Image is: ' ||
DBMS_LOB.GETLENGTH(Image1));
/* more LOB routines */
END;
DECLARE
Image1 BLOB;
ImageNum INTEGER := 101;
BEGIN
SELECT content INTO Image1 FROM binaries2
WHERE id = 1211;
DBMS_OUTPUT.PUT_LINE('Size of the Image is: ' ||
DBMS_LOB.GETLENGTH(Image1));
/* more LOB routines */
END;
/
The EMPTY_BLOB function returns an empty locator of type BLOB (binary large
object).
The specification for the EMPTY_BLOB function is:
DECLARE
my_photo BLOB := EMPTY_BLOB;
BEGIN
Use EMPTY_BLOB to initialize a BLOB to "empty." Before you can work with a BLOB,
either to reference it
in SQL DML statements such as INSERTs or to assign it a value in PL/SQL, it must
contain a locator.
It cannot be NULL. The locator might point to an empty BLOB value, but it will be
a valid BLOB locator.
The EMPTY_CLOB function returns an empty locator of type CLOB. The specification
for the EMPTY_CLOB function is:
DECLARE
the_big_novel CLOB := EMPTY_CLOB;
BEGIN
Use EMPTY_CLOB to initialize a CLOB to "empty". Before you can work with a CLOB,
either to reference it
in SQL DML statements such as INSERTs or to assign it a value in PL/SQL, it must
contain a locator.
It cannot be NULL. The locator might point to an empty CLOB value, but it will be
a valid CLOB locator.
30.2.3 DBMS_LOB
---------------
DECLARE
Image1 BLOB;
ImageNum INTEGER := 101;
BEGIN
SELECT content INTO Image1 FROM binaries2
WHERE id = 1211;
DBMS_OUTPUT.PUT_LINE('Size of the Image is: ' ||
DBMS_LOB.GETLENGTH(Image1));
/* more LOB routines */
END;
/
DBMS_LOB
The DBMS_LOB package provides subprograms to operate on BLOBs, CLOBs, NCLOBs,
BFILEs, and temporary LOBs.
You can use DBMS_LOB to access and manipulation specific parts of a LOB or
complete LOBs.
DBMS_LOB can read and modify BLOBs, CLOBs, and NCLOBs; it provides read-only
operations for BFILEs.
The bulk of the LOB operations are provided by this package.
Example:
Load Text Files to CLOB then Write Back Out to Disk - (PL/SQL)
Overview
- Load_CLOB_From_XML_File:
This PL/SQL procedure loads an XML file on disk to a CLOB column using a BFILE
reference variable.
Notice that I use the new PL/SQL procedure DBMS_LOB.LoadCLOBFromFile(),
introduced in Oracle 9.2,
that handles uploading to a multi-byte UNICODE database.
- Write_CLOB_To_XML_File:
This PL/SQL procedure writes the contents of the CLOB column in the database
piecewise
back to the file system.
DatabaseInventoryBig.xml:
After downloading the above XML file, create all Oracle database objects:
Table dropped.
Table created.
Directory created.
dest_clob CLOB;
src_clob BFILE := BFILENAME('EXAMPLE_LOB_DIR',
'DatabaseInventoryBig.xml');
dst_offset number := 1 ;
src_offset number := 1 ;
lang_ctx number := DBMS_LOB.DEFAULT_LANG_CTX;
warning number;
BEGIN
DBMS_OUTPUT.ENABLE(100000);
-- -----------------------------------------------------------------------
-- THE FOLLOWING BLOCK OF CODE WILL ATTEMPT TO INSERT / WRITE THE CONTENTS
-- OF AN XML FILE TO A CLOB COLUMN. IN THIS CASE, I WILL USE THE NEW
-- DBMS_LOB.LoadCLOBFromFile() API WHICH *DOES* SUPPORT MULTI-BYTE
-- CHARACTER SET DATA. IF YOU ARE NOT USING ORACLE 9iR2 AND/OR DO NOT NEED
-- TO SUPPORT LOADING TO A MULTI-BYTE CHARACTER SET DATABASE, USE THE
-- FOLLOWING FOR LOADING FROM A FILE:
--
-- DBMS_LOB.LoadFromFile(
-- DEST_LOB => dest_clob
-- , SRC_LOB => src_clob
-- , AMOUNT => DBMS_LOB.GETLENGTH(src_clob)
-- );
--
-- -----------------------------------------------------------------------
-- -------------------------------------
-- OPENING THE SOURCE BFILE IS MANDATORY
-- -------------------------------------
DBMS_LOB.OPEN(src_clob, DBMS_LOB.LOB_READONLY);
DBMS_LOB.LoadCLOBFromFile(
DEST_LOB => dest_clob
, SRC_BFILE => src_clob
, AMOUNT => DBMS_LOB.GETLENGTH(src_clob)
, DEST_OFFSET => dst_offset
, SRC_OFFSET => src_offset
, BFILE_CSID => DBMS_LOB.DEFAULT_CSID
, LANG_CONTEXT => lang_ctx
, WARNING => warning
);
DBMS_LOB.CLOSE(src_clob);
COMMIT;
END;
/
SQL> @load_clob_from_xml_file.sql
Procedure created.
clob_loc CLOB;
buffer VARCHAR2(32767);
buffer_size CONSTANT BINARY_INTEGER := 32767;
amount BINARY_INTEGER;
offset NUMBER(38);
file_handle UTL_FILE.FILE_TYPE;
directory_name CONSTANT VARCHAR2(80) := 'EXAMPLE_LOB_DIR';
new_xml_filename CONSTANT VARCHAR2(80) := 'DatabaseInventoryBig_2.xml';
BEGIN
DBMS_OUTPUT.ENABLE(100000);
-- ----------------
-- GET CLOB LOCATOR
-- ----------------
SELECT xml_file INTO clob_loc
FROM test_clob
WHERE id = 1001;
-- --------------------------------
-- OPEN NEW XML FILE IN WRITE MODE
-- --------------------------------
file_handle := UTL_FILE.FOPEN(
location => directory_name,
filename => new_xml_filename,
open_mode => 'w',
max_linesize => buffer_size);
amount := buffer_size;
offset := 1;
-- ----------------------------------------------
-- READ FROM CLOB XML / WRITE OUT NEW XML TO DISK
-- ----------------------------------------------
WHILE amount >= buffer_size
LOOP
DBMS_LOB.READ(
lob_loc => clob_loc,
amount => amount,
offset => offset,
buffer => buffer);
UTL_FILE.PUT(
file => file_handle,
buffer => buffer);
END LOOP;
END;
/
SQL> @write_clob_to_xml_file.sql
Procedure created.
ID LENGTH
---------- ----------
1001 41113
First we create a Java stored procedure that accepts a file name and a BLOB as
parameters:
// Get the optimum buffer size and use this to create the read/write buffer
int size = myBlob.getBufferSize();
byte[] buffer = new byte[size];
int length = -1;
};
/
Next we publish the Java call specification so we can access it via PL/SQL:
EXEC Dbms_Java.Grant_Permission( -
'SCHEMA-NAME', -
'java.io.FilePermission', -
'<<ALL FILES>>', -
'read ,write, execute, delete');
DECLARE
v_blob BLOB;
BEGIN
SELECT col1
INTO v_blob
FROM tab1;
ExportBlob('c:\MyBlob',v_blob);
END;
/
Finally we import the file into a BLOB datatype and insert it into the table:
DECLARE
v_bfile BFILE;
v_blob BLOB;
BEGIN
INSERT INTO tab1 (col1)
VALUES (empty_blob())
RETURN col1 INTO v_blob;
COMMIT;
END;
/
Hope this helps. Regards Tim...
Finally we import the file into a CLOB datatype and insert it into the table:
DECLARE
v_bfile BFILE;
v_clob CLOB;
BEGIN
INSERT INTO tab1 (col1)
VALUES (empty_clob())
RETURN col1 INTO v_clob;
COMMIT;
END;
/
Hope this helps. Regards Tim...
Note 5:
-------
and we said...
Yes, the following example is cut and pasted from the SQL Reference Manual, the
CREATE TABLE command:
CREATE TABLE lob_tab (col1 BLOB, col2 CLOB) STORAGE (INITIAL 512 NEXT 256)
LOB (col1, col2) STORE AS
(TABLESPACE lob_seg_ts
STORAGE (INITIAL 6144 NEXT 6144)
CHUNK 4
NOCACHE LOGGING
INDEX (TABLESPACE lob_index_ts
STORAGE (INITIAL 256 NEXT 256)
)
);
The table will be stored in the users default tablespace with (INITIAL 512 NEXT
256). The actual lob data will be in LOB_SEG_TS with (INITIAL 6144 NEXT 6144).
The lob index built on the pages constituting the lob will be stored in yet a
3'rd tablespace -- lob_index_ts with (INITIAL 256 NEXT 256).
Reviews
GOTO a page to Bookmark Review | Bottom | Top
lob storage recovery May 07, 2004
Reviewer: bob from PA
Tom,
If the LOB tablespace is not backed up, can the table data (a different
tablespace) be recovered in a failure scenario?
I know with TSPITR the process validates that no objects cross tablespaces that
are not included in the set being recovered with the TSPITR check/validate
funcion. This doesn't mean the tablespace won't be recovered in the auxiliary
db, it just means the automated process won't continue through to export the
objects, and re-import unless you pass the check. (or at least that was what
happened in the test I ran).
I am just curious about what would happen to this table if its lob tablespace
was lost and non-recoverable. can just the regular data be recovered
Followup:
well, it's going to be problematic as the lob locators will point to "garbage".
You cannot really TSPITR a table with lobs without doing the *same* to the lob
segments.
You'd have to sort of update the lobs to NULL and pull it manually -- but then I
would ask "why have the lobs in the first place, must not be very important"?
so yes, we'd be able to get the scalar data back (complete recovery would be
best here), update the lob to null and go forward with that.
30.3.1:
-------
Purpose
============
- The purpose of this article is to provide a script to solve errors
ORA-1578 / ORA-26040 when a lob block is accessed by a sql statement.
- Note that the data inside the corrupted lob blocks is not salvageable.
This procedure will update the lob column with an empty lob to avoid errors
ORA-1578 / ORA-26040.
- dbverify for the datafile that produces the errors fails with:
Example:
The dba can be used to get the relative file number and block number:
DBMS_UTILITY.DATA_BLOCK_ADDRESS_FILE(54528484)
----------------------------------------------
13
Block Number:
DBMS_UTILITY.DATA_BLOCK_ADDRESS_BLOCK(54528484)
-----------------------------------------------
2532
Cause
==========
- LOB segment has been defined as NOLOGGING
- LOB Blocks were marked as corrupted by Oracle after a datafile restore /
recovery.
owner=SCOTT
segment_name=SYS_LOB0000029815C00006$$
segment_type=LOBSEGMENT
table_name = EMP
column_name = EMPLOYEE_ID_LOB
Fix
======
1. Identify the table rowid's referencing the corrupted lob segment blocks by
running the following plsq script:
set concat #
declare
error_1578 exception;
pragma exception_init(error_1578,-1578);
n number;
begin
for cursor_lob in (select rowid r, &&lob_column from
&table_owner.&table_with_lob) loop
begin
n:=dbms_lob.instr(cursor_lob.&&lob_column,hextoraw('8899')) ;
exception
when error_1578 then
insert into corrupted_data values (cursor_lob.r);
commit;
end;
end loop;
end;
/
undefine lob_column
rem ********************* Script ends here ********************
2. Update the lob column with empty lob to avoid ORA-1578 and ORA-26040:
Reference
==============
Note 290161.1 - The Gains and Pains of Nologging Operations
30.3.2:
-------
I have discovered that a lob index partition is set to NOLOGGING, how can I alter
this to LOGGING.
The lob is set to CACHE and LOGGING, the index def_logging is set to NONE
and the tablespace is set to LOGGING.
--------------------------------------------------------------------------------
You could find the system generated lobindex name and use the "alter index"
command.
Regards,
Rowena Serna
Oracle Corporation
-------------------------------------------------------------------------------
Using alter index on a lob segment index results in error ORA-22864 cannot ALTER
or DROP LOB indexes,
the solution I found was to alter the lob caching setting, even though dba_lobs
showed the CACHE and LOGGING
settings to be 'YES' by issuing the ALTER TABLE <tablename> MODIFY LOB(<lobname>)
(CACHE); command
all partitions of the associated index were changed to LOGGING. What threw me was
the CACHE and LOGGING settings
in dba_lobs already being set correctly, however resetting these again was the
key.
--------------------------------------------------------------------------------
Regards,
Rowena Serna
Oracle Corporation
Note 1:
-------
Note 2:
-------
Note 3:
-------
fix:
For LOBS, ensure that the extent size specification in the tablespace is least
three times the db_block_size.
For example:
If the db_block_size is 8192, then the extent size for the tablespace should be
at least 24576.
Explaination:
Certain objects may require larger extents by virtue of how they are built
internally (Example: an RBS requires at least four blocks and a LOB at least
three).
References:
<Bug:1186625>
SQL Reference Guide, Create Tablespace
Note 4:
-------
A new database was created and the data reimported into a tablespace with
1.7GB default initial extent size. The LOB storage outwith the table defaults
to the initial extent of the tablespace and this storage requirement could not
be fulfilled.
fix:
See also :
Note:1074731.6 ORA-01658 During 'Create Table' Statement
Note 5:
-------
Problem Description
-------------------
You are attempting to import a table that has CLOB datatype and you receive the
following errors:
IMP-00003: ORACLE error 959 encountered
ORA-00959: tablespace <tablespace_name> does not exist
Solution Description
--------------------
Create the table that has CLOB datatypes before the import, specifying tablespaces
TABLE_NAME TABLESPACE_NAME
------------------------------ ------------------------------
PX2000 TST
Step-6: Workaround is to extract the DDL from the dumpfile,change the tablespace
to target database. Create the table manually and import with ignore=y option
=================================================================================
=
% imp test/test file=px2000.dmp full=y show=y log=<logFile>
Step-7: Use the logFile to pre-create the table, then ignore object creation
errors.
==================================================================================
==
% imp test/test file=px2000.dmp full=y ignore=y
Explanation
-----------
For most of the DDL's (except for Partitioned tables,tables without CLOB
datatypes), i
mport will automatically create the objects to the users default tablespace if the
specified tablespace does not exist. DDL's with tables with CLOB datatypes and
partitioned tables
an IMP-00003 and ORA-00959 will result if the tablespace does not exists in target
database.
References ---------- [NOTE:1058330.6]
"IMP-00003 ORA-00959 ON IMPORT OF PARTITIONED TABLE" [BUG:1982168]
"IMP-3 / ORA-959 importing table with CLOB using IGNORE=Y into variable width
charset DB"
[BUG:2398272] "IMPORT TABLE WITH CLOB DATATYPE FAILS WITH IMP-3 AND ORA-959"
Oracle Utilites Manual
.
Note 6:
-------
Hi!
I'm having a problem here: I want to move a table with a LOB column (i.e. LOB
index segment)
to a different tablespace. In the beginning the table and the LOB segment were in
the USERS
tablespace.
I then exported the table using the EXP tool. Then I revoked the user's quota to
the
USERS tablespace and only gave him quota on the default tablespace.
Then I run IMP and import that LOB-table. The table gets recreated in the new
tablespace,
but the creation of the LOB index fails with an error message that I don't have
privileges
to write to the USERS tablespace.
How do I completey move the table and the LOB index segment to a new tablespace?
Thanks,
Helmut
Regards,
Ken Robinson
Oracle Server EE Analyst
Note 7.
-------
cause: The insert statement run when importing exceeds the default or
specified buffer size.
For import of tables containing LONG, LOB, BFILE, REF, ROWID, LOGICALROWID
or type columns, rows are inserted individually. The size of the buffer must be
large enough to contain the entire row inserted.
fix:
Increase the buffer size, and make sure that it is big enough to contain the
biggest row in the table(s) imported.
For example: imp system/manager file=test.dmp full=y log=test.log buffer=
10000000
Note 8:
-------
For tables with LOB columns, make sure the tablespace already exists in the
target database before the import is done.
Also, make sure the extent size is large enough.
Note 9:
-------
With imp/exp I hit a problem that on remote database users tablespace is called
'users', while on local it's 'users_data'. Now I have to go to documentation to
figure out if those stupid switches would save the day...
I wonder why export/import is not plain sqlplus statements where I can just
specify the right 'where' clause...
Followup:
Yes, when you deal with multi segment objects (tables with LOBS, partitioned
table, IOTs with overflows for example), using EXP/IMP is complicated if the
target database doesn't have the same tablespace structure. That is because the
CREATE statement contains many tablespaces and IMP will only "rewrite" the first
TABLESPACE in it (it will not put multi-tablespace objects into a single
tablespace, the object creation will fail of the tablespaces needed by that
create do not exist).
In temp.sql, you will have all of the DDL for indexes and tables. Simply delete
all index creates and uncomment any table creates you want. Then, you can
specify the tablespaces for the various components -- precreate the objects and
run imp with ignore=y. The objects will now be populated.
You are incorrect with the "schlobs" comment (both in spelling and in
conclusion).
Table created.
[email protected]> desc t
Name Null? Type
----------------------------------- -------- ------------------------
A NUMBER(38)
B BLOB
no rows selected
1 row created.
A DBMS_LOB.GETLENGTH(B)
---------- ---------------------
1 1000011
imp/exp can be plain sqlplus statements -- use indexfile=y (if you get my book,
I use this over and over in various places to get the DDL). In 9i, there is a
simple stored procedure interface as well.
Note 10:
--------
Tom
Without using the export import( show=y) Is there any query to find out in which
Tablespace the LOB column is stored
Thanks in advance
Followup:
select * from user_segments
Note 11:
--------
Action: Look up the Oracle message in the ORA message chapters of this manual,
and take appropriate action.
IMP-00020 long column too large for column buffer size (number)
Cause: The column buffer is too small. This usually occurs when importing LONG
data.
Action: Increase the insert buffer size 10,000 bytes at a time (for example).
Use this step-by-step approach because a buffer size that is too large may cause a
similar problem.
Cause: While producing the dump file, Export was unable to write the entire
contents of a LOB.
Import is therefore unable to reconstruct the contents of the LOB. The remainder
of the import
of the current table will be skipped.
Action: Delete the offending row in the exported database and retry the export.
Cause: The number of LOBS per row in the dump file is different than the number of
LOBS per row
in the table being populated.
Action: Modify the table being imported so that it matches the column attribute
layout
of the table that was exported.
Note 12:
--------
Note 13:
--------
Method 1:
=========
Method 2:
=======
Purpose
-------
The purpose of this article is to provide the syntax for altering the storage
parameters of a table that contains one or more LOB columns.
This article will be useful for Oracle DBSs, Developers, and Support Analysts.
This will rebuild the table segment. It does not affect any of the lob
segments associated with the lob columns which is the desired optimization.
If you want to change one or more of the physical attibutes of the table
containing
the lob, however no attributes of the lob columns are to be changed,
use the following syntax:
This will rebuild the table segment. It does not rebuild any of the lob
segments associated with the lob columns which is the desired optimization.
Note that this will also rebuild the table segment (although, in this case, in the
same tablespace and without changing the table segment physical attributes).
If a table containing a lob needs changes to both the table attributes as well
as the lob attributes then use the following syntax:
Explanation
-----------
The 'ALTER TABLE foo MODIFY LOB (lobcol) ...' syntax does not allow
for a change of tablespace
(TABLESPACE new_tbsp)
*
ORA-22853: invalid LOB storage option specification
You have to use the MOVE keyword instead as shown in the examples.
References
----------
Method 3:
=========
Move doesnt support Long datatypes. You can either convert them to LOBs and then
move
or do exp/imp of the table with the LONG column or create the table with LONG
in the locally managed tablespace and copy the data from the old table using
PL/SQL loop
or CTAS with to_lob in the locally managed tablespace..
SQL> desc t
Name Null? Type
----------------------------------------- -------- ----------------------------
X NUMBER(38)
Y LONG
-- You can create the new table in the Locally Managed tablespace
Table created.
-- Now you can drop the old table and rename the new table
-- Or you can move the LOB table to the locally managed tablespace
Table altered.
-- Or you can precreate the new table with LONG in the locally managed tablespace
and do exp/imp
Table renamed.
Table created.
SQL> desc t
Name Null? Type
----------------------------------------- -------- ----------------------------
X NUMBER(38)
Y LONG
Note 14:
--------
*Non-bfile columns of the table could be accessed but not the bfile
column.
Symptom(s)
~~~~~~~~~~
Diagnosis:
~~~~~~~~~~
-- create the exporting user schema and the table with bfile data--
SQL>connect system/manager
IMPORTING DATABASE:
ERROR:
ORA-22285: non-existent directory or file for GETLENGTH operation
ORA-06512: at "SYS.DBMS_LOB", line 547
Cause
~~~~~
The importing user lacks the read access on the corresponding directory/
directory alias.
Solution(s)
~~~~~~~~~~~
grant read access on the corressponding directory to the user who tries to
access the bfile table as below:
Once the read permission is granted ,the bfile column of the said table
is accessible since the corresponding directory (/alias) is accessible.
Refrences:
~~~~~~~~~~
[NOTE:66046.1] <ml2_documents.showDocument?p_id=66046.1&p_database_id=NOT>:
LOBs, Longs, and other Datatypes
Note 15:
--------
Symptoms
IMPORT OF TABLE WITH LOB GENERATES CORE DUMP
Cause
<Bug:3091499>
Error Details:
-------------
Since the LOB segments are usually very large, they are treated differently from
other columns. While other columns
can be guaranteed to give consistent reads, these columns are not. This is
because, it is difficult to manage
with LOB data rollback segments due to their size unlike other columns. So they do
not use rollback segments.
Usually only one copy exists, so the queries reading that column may not get
consistent reads while
other queries modify them. In these cases, the other queries will get "ORA-22924
snapshot too old" errors.
To maintain read consistency Oracle creates new LOB page versions every time a lob
changes. PCTVERSION is
the percentage of all used LOB data space that can be occupied by old versions of
LOB data pages. As soon as
old versions of LOB data pages start to occupy more than the PCTVERSION amount of
used LOB space,
Oracle tries to reclaim the old versions and reuse them. In other words,
PCTVERSION is the percent of used
LOB data blocks that is available for versioning old LOB data. The PCTVERSION can
be set to the percentage
of LOB's that are occasionally updated.
Often a table's a LOB column usually gets the data uploaded only once, but is read
multiple times.
Hence it is not necessary to keep older versions of LOB data. It is recommended
that this value be changed to "0".
By default PCTVERSION is set to 10%. So, most of the instances usually have it set
to 10%,
it must be set to 0% explicitly. The value can be changed any time in a running
system.
Use the following query to find out currently set value for PCTVERSION:
PCTVERSION
----------
10
PCTVERSION can be changed using the following SQL (it can be run anytime in a
running system):
Note 17: difference 9iR1 9iR2 with respect to Locally managed tablespace
------------------------------------------------------------------------
fix:
Note 18:
--------
ORA-00600: internal error code, arguments: [kkdoilsn1], [], [], [], [], [], [], []
or
ORA-00600: internal error code, arguments: [15265], [], [], [], [], [], [], []
description:
in a 9.2 database, a table with lob and indexsegments was moved to another
tablespace.
Explanation:
9202 2405258 Dictionary corruption / OERI:15265 from MOVE LOB to existing segment
name
2405258 Dictionary corruption / OERI:15265 from MOVE LOB to existing segment name
Bug 2405258 Dictionary corruption / OERI:15265 from MOVE LOB to existing segment
name
This note gives a brief overview of bug 2405258.
Affects:
Product (Component) Oracle Server (RDBMS)
Range of versions believed to be affected Versions >= 8 but < 10G
Versions confirmed as being affected 9.2.0.1
Platforms affected Generic (all / most platforms affected)
Fixed:
This issue is fixed in 9.2.0.2 (Server Patch Set) 10G Production Base Release
Symptoms:
Corruption (Dictionary) <javascript:taghelp('TAGS_CORR_DIC')>
Internal Error may occur (ORA-600) <javascript:taghelp('TAGS_OERI')>
ORA-600 [15265]
Related To:
Datatypes - LOBs (CLOB/BLOB/BFILE)
Description
Dictionary corruption / ORA-600 [15265] from MOVE LOB to
existing segment name.
Eg: ALTER TABLE mytab MOVE LOB (artist_bio)
STORE AS lobsegment (STORAGE(INITIAL 1M NEXT 1M));
corrupts the dictionary if "logsegment" already exists.
=====================
31. BLOCK CORRUPTION:
=====================
Note 1:
=======
-------------
BLOCK CORRUPTION
----------------
FREQUENTLY ASKED QUESTIONS
--------------------------
25-JAN-2000
CONTENTS
--------
1. What does the error ORA-01578 mean?
2. How to determine what object is corrupted?
3. What are the recovery options if the object is a table?
4. What are the recovery options if the object is an index?
5. What are the recovery options if the object is a rollback segment?
6. What are the recovery options if the object is a data dictionary object?
7. What methods are available to assist in pro-actively identifying corruption?
8. How can corruption be prevented?
9. What are the common causes of corruption?
Each formatted block on disk has a wrapper which consists of a block header
and footer. Unformatted blocks should be zero throughout. Whenever a block
is read into the buffer cache, the block wrapper information is checked for
validity. The checks include verifying that the block passed to Oracle by
the operating system is the block requested (data block address) and also
that certain information stored in the block header matches information
stored in the block footer in case of a split (fractured) block.
The following query will display the segment name, type, and owner:
Where <f> is the file number and <b> is the block number reported in the
ORA-01578 error message.
SEGMENT_NAME
SEGMENT_TYPE OWNER
---------------------------------------------------------------------------------
------------------
USERS
TABLE VPOUSERDB
If the table is a Data Dictionary table, you should contact Oracle Support
Services. The recommended recovery option is to restore the database from
backup.
[NOTE:28814.1] <ml2_documents.showDocument?p_id=28814.1&p_database_id=NOT>
contains information on how to handle ORA-1578 errors in Oracle7.
References:
-----------
[NOTE:28814.1] <ml2_documents.showDocument?p_id=28814.1&p_database_id=NOT>
TECH ORA-1578 and Data Block Corruption in Oracle7
If the object is an index which is not part of the data dictionary and the
base table does not contain any corrupt blocks, you can simply drop and
recreate the index.
If the index is a Data Dictionary index, you should contact Oracle Support
Services. The recommended recovery option is to restore the database from
backup. There is a possibility you might be able to drop the index and then
recreate it based on the original create SQL found in the administrative
scripts. Oracle Support Services will be able to make the determination as
to whether this is a viable option for you.
6. What are the recovery options if the object is a data dictionary object?
If the object is a Data Dictionary object, you should contact Oracle Support
Services. The recommended recovery option is to restore the database from
backup.
Export will read the blocks allocated to each table being exported and
report any potential block corruptions encountered.
References:
-----------
[NOTE:35512.1] <ml2_documents.showDocument?p_id=35512.1&p_database_id=NOT>
DBVERIFY - Database file Verification Utility (7.3.2 onwards)
References:
-----------
[NOTE:77587.1] <ml2_documents.showDocument?p_id=77587.1&p_database_id=NOT>
BLOCK CORRUPTIONS ON ORACLE AND UNIX
Note 2:
=======
Having encountered the Oracle data block corruption, we must firstly investigate
which database segment
(name and type) the corrupted block is allocated to. Chances are that the block
belongs either to an index
or to a table segment, since these two type of segments fill the major part of our
databases.
The following query will reveil the segment that holds the corrupted block
identified by
<filenumber> and <blocknumber> (which were given to you in the error message):
SELECT ds.*
FROM dba_segments ds, sys.uet$ e
WHERE ds.header_file=e.segfile#
and ds.header_block=e.segblock#
and e.file#=<filenumber>
and <blocknumber> between e.block# and e.block#+e.length-1;
If the segment turns out to be an index segment, then the problem can be very
quickly solved.
Since all the table data required for recreating the index is still accessable, we
can drop and recreate the index
(since the block will reformatted, when taken FROM the free-space list and reused
for the index).
If the segment turns out to be a table segment a number of options for solving the
problem are available:
The last option involves using SQL to SELECT as much data as possible FROM the
current
corrupted table segment and save the SELECTed rows into a new table.
SELECTing data that is stored in segment blocks that preceede the corrupted block
can be easily done using a full table scan (via a cursor).
Rows stored in blocks after the corrupted block cause a problem.
A full table scan will never reach these. However these rows can still be
fetched using rowids (single row lookups).
2.1 Table was indexed
Using an optimizer hint we can write a query that SELECTs the rows FROM the table
via an index scan (using rowid's), instead of via a full table scan.
Let's assume our table is named X with columns a, b and c. And table X is indexed
uniquely on columns a and b by index X_I, the query would look like:
We must now exclude the corrupt block FROM being accessed to avoid the
internal exception ORA-00600[01578]. Since the blocknumber is a substring
of the rowid ( ) this can very easily be achieved:
Since the index holds the actual column values of the indexed columns we could
also use the index to restore all indexed columns of rows that reside in the
corrupt block.
The following query,
retreives only indexed columns a and b FROM rows inside the corrupt block.
The optimizer will not access the table for this query.
It can retreive the column values using the index segment only.
Using this technique we are able to restore all indexed column values of the
rows inside the corrupt block, without accessing the corrupt block at all.
Suppose in our example that column c of table X was also indexed by index X_I2.
This enables us to completely restore rows inside the corrupt block.
And finally join the columns together using the restored rowid:
SELECT x1.a, x1.b, x2.c
FROM X_a_b x1, X_c x2
WHERE x1.rowkey=x2.rowkey;
In summary:
Indexes on the corrupted table segment can be used to restore all columns of all
rows
that are stored outside the corrupted data blocks.
Of rows inside the corrupted data blocks, only the columns that were indexed can
be restored.
We might even be able to use an old version of the table (via Import)
to further restore non-indexed columns of these records.
This situation should rarely occur since every table should have a primary key and
therefore a unique index.
However when no index is present, all rows of corrupted blocks should be
considered lost.
All other rows can be retrieved using rowid's.
Since there is no index we must build a rowid generator ourselves.
The SYS.UET$ table shows us exactly which extents (file#, startblock, endblock)
we need to inspect for possible rows of our table X.
If we make an estimate of the maximum number of rows per block for table X,
we can build a PL/SQL-loop that generates possible rowid's of records inside table
X.
By handling the 'invalid rowid' exception, and skipping the corrupted data block,
we can restore all rows except those inside the corrupted block.
declare
v_rowid varchar2(18);
v_xrec X%rowtype;
e_invalid_rowid exception;
pragma exception_init(e_invalid_rowid,-1410);
begin
The above code assumes that block id's never exceed 4 hexadecimal places.
A definition of the hex-function which is used in the above code can be found in
the appendix.
Note 3:
=======
Introduction
~~~~~~~~~~~~
This short article explains how to skip corrupt blocks on an object
either using the Oracle8i SKIP_CORRUPT table flag or the special
Oracle event number 10231 which is available in Oracle releases 7
through 8.1 inclusive.
The information here explains how to use these options.
From Oracle 7.2 onwards the event allows you to skip many forms of
media corrupt blocks in addition to soft corrupt blocks and so is
far more useful. It is still *NOT* guaranteed to work.
[NOTE:28814.1] <ml2_documents.showDocument?p_id=28814.1&p_database_id=NOT>
describes alternatives which can be used if this event
fails.
Oracle8i
~~~~~~~~
Connect as a DBA user and mark the table as needing to skip
corrupt blocks thus:
execute DBMS_REPAIR.SKIP_CORRUPT_BLOCKS('<schema>','<tablename>');
execute DBMS_REPAIR.SKIP_CORRUPT_BLOCKS('VPOUSERDB','USERS',
flags=>dbms_repair.noskip_flag);
Setting the event in a Session
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Connect to Oracle as a user with access to the corrupt table and
issue the command:
Make sure this appears next to any other EVENT= lines in the
init.ora file.
STARTUP
If the instance fails to start check the syntax
of the event parameter matches the above exactly.
Note the comma as it is important.
Select out the data from the table using a full table scan
operation.
Eg: Use a table level export
or create table as select.
Export Warning: If the table is very large then some versions of export
may not be able to write more than 2Gb of data to the
export file. See [NOTE:62427.1]
<ml2_documents.showDocument?p_id=62427.1&p_database_id=NOT> for general
information
on 2Gb limits in various Oracle releases.
- See if Oracle Support can extract any data from HEX dumps of the
corrupt block.
- It may be possible to salvage some data using Log Miner
Double check you have the SQL to rebuild the object and its indexes
etc..
.
Note 4: Analyze table validate structure:
=========================================
Vanaf de OS prompt kan het dbv utility gedraaid worden om een datafile
te onderzoeken.
Stap 1.
via ANALYZE TABLE ben je er achter gekomen dat van een table
een of meer blocks corrupt zijn.
Stap 2.
declare
begin
dbms_repair.admin_tables('REPAIR_TABLE, dbms_repair.repair_table,
dbms_repair.create_action, 'users');
end;
/
Stap 3.
begin
rpr_count:=0;
dbms_output.put_line('repair_block_count :'||to_char(rpr_count));
end;
/
Note 7:
=======
Tom,
How can I get more details of what data resides on this blocks? and being
'Logical' can they be recoverd without loosing that data at all?
Thanks,
Orlando
Followup:
select * from dba_extents
where file_id = 11
and 12357 between block_id an block_id+blocks-1;
Tom
SEGMENT_TYPE
----------------------------------------
TABLE
$ dbv file=/u03/oradata/emu/emu_data_large02.dbf \
blocksize=8192 logfile=/dbv.log
Any thoughts ?
Thanks
Note 6:
-------
DBVerify
ANALYZE .. VALIDATE STRUCTURE
DB_BLOCK_CHECKING.
DBMS_REPAIR.
Other Repair Methods.
DBVerify
DBVerify is an external utility that allows validation of offline datafiles.
In addition to offline datafiles it can be used to check the validity of backup
datafiles:
DB_BLOCK_CHECKING
When the DB_BLOCK_CHECKING parameter is set to TRUE Oracle performs a walk through
of the data
in the block to check it is self-consistent. Unfortunately block checking can add
between 1 and 10% overhead to the server. Oracle recommend setting this parameter
to TRUE
if the overhead is acceptable.
DBMS_REPAIR
Unlike the previous methods dicussed, the DBMS_REPAIR package allows you to detect
and
repair corruption. The process requires two administration tables to hold a list
of
corrupt blocks and index keys pointing to those blocks. These are created as
follows:
BEGIN
Dbms_Repair.Admin_Tables (
table_name => 'REPAIR_TABLE',
table_type => Dbms_Repair.Repair_Table,
action => Dbms_Repair.Create_Action,
tablespace => 'USERS');
Dbms_Repair.Admin_Tables (
table_name => 'ORPHAN_KEY_TABLE',
table_type => Dbms_Repair.Orphan_Table,
action => Dbms_Repair.Create_Action,
tablespace => 'USERS');
END;
/
With the administration tables built we are able to check the table of interest
using the
CHECK_OBJECT procedure:
SET SERVEROUTPUT ON
DECLARE
v_num_corrupt INT;
BEGIN
v_num_corrupt := 0;
Dbms_Repair.Check_Object (
schema_name => 'SCOTT',
object_name => 'DEPT',
repair_table_name => 'REPAIR_TABLE',
corrupt_count => v_num_corrupt);
Dbms_Output.Put_Line('number corrupt: ' || TO_CHAR (v_num_corrupt));
END;
/
At this point the currupt blocks have been detected, but are not marked as
corrupt.
The FIX_CORRUPT_BLOCKS procedure can be used to mark the blocks as corrupt,
allowing them
to be skipped by DML once the table is in the correct mode:
SET SERVEROUTPUT ON
DECLARE
v_num_fix INT;
BEGIN
v_num_fix := 0;
Dbms_Repair.Fix_Corrupt_Blocks (
schema_name => 'SCOTT',
object_name=> 'DEPT',
object_type => Dbms_Repair.Table_Object,
repair_table_name => 'REPAIR_TABLE',
fix_count=> v_num_fix);
Dbms_Output.Put_Line('num fix: ' || to_char(v_num_fix));
END;
/
Once the corrupt table blocks have been located and marked all indexes must be
checked to see
if any of their key entries point to a corrupt block. This is done using the
DUMP_ORPHAN_KEYS procedure:
SET SERVEROUTPUT ON
DECLARE
v_num_orphans INT;
BEGIN
v_num_orphans := 0;
Dbms_Repair.Dump_Orphan_Keys (
schema_name => 'SCOTT',
object_name => 'PK_DEPT',
object_type => Dbms_Repair.Index_Object,
repair_table_name => 'REPAIR_TABLE',
orphan_table_name=> 'ORPHAN_KEY_TABLE',
key_count => v_num_orphans);
Dbms_Output.Put_Line('orphan key count: ' || to_char(v_num_orphans));
END;
/
If the orphan key count is greater than 0 the index should be rebuilt.
The process of marking the table block as corrupt automatically removes it from
the freelists.
This can prevent freelist access to all blocks following the corrupt block.
To correct this the freelists must be rebuilt using the REBUILD_FREELISTS
procedure:
BEGIN
Dbms_Repair.Rebuild_Freelists (
schema_name => 'SCOTT',
object_name => 'DEPT',
object_type => Dbms_Repair.Table_Object);
END;
/
The final step in the process is to make sure all DML statements ignore the data
blocks
marked as corrupt. This is done using the SKIP_CORRUPT_BLOCKS procedure:
BEGIN
Dbms_Repair.Skip_Corrupt_Blocks (
schema_name => 'SCOTT',
object_name => 'DEPT',
object_type => Dbms_Repair.Table_Object,
flags => Dbms_Repair.Skip_Flag);
END;
/
The SKIP_CORRUPT column in the DBA_TABLES view indicates if this action has been
successful.
At this point the table can be used again but you will have to take steps to
correct any data
loss associated with the missing blocks.
Note 7:
-------
If you know the file number and the block number indicating the corruption, you
can salvage
the data in the corrupt table by selecting around the bad blocks.
Set event 10231 in the init.ora file to cause Oracle to skip software- and media-
corrupted blocks when performing full table scans:
Set event 10233 in the init.ora file to cause Oracle to skip software- and media-
corrupted blocks when performing index range scans:
Note 8:
-------
Detecting and reporting data block corruption using the DBMS_REPAIR package:
Note: Note that this event can only be used if the block "wrapper" is marked
corrupt.
Note that table names prefix with �REPAIR_� or �ORPAN_�. If the second variable is
1, it will create
�REAIR_key tables, if it is 2, then it will create �ORPAN_key tables.
In the following example we check the table employee for possible corruption�s
that belongs to the schema TEST.
Let�s assume that we have created our administration tables called REPAIR_ADMIN in
schema SYS.
If u select the EMP table now you still get the error ORA-1578.
Notice the verification of running the DBMS_REPAIR tool. You have lost some of
data. One main advantage of
this tool is that you can retrieve the data past the corrupted block. However we
have lost some data in the table.
If u see any records in ORPHAN_ADMIN table you have to drop and re-create the
index to avoid any inconsistencies
in your queries.
6. The last thing you need to do while using the DBMS_REPAIR package is to run the
NOTE
Setting events 10210, 10211, 10212, and 10225 can be done by adding the following
line for each event
in the init.ora file:
- When event 10210 is set, the data blocks are checked for corruption by checking
their integrity.
Data blocks that don't match the format are marked as soft corrupt.
- When event 10211 is set, the index blocks are checked for corruption by checking
their integrity.
Index blocks that don't match the format are marked as soft corrupt.
- When event 10212 is set, the cluster blocks are checked for corruption by
checking their integrity.
Cluster blocks that don't match the format are marked as soft corrupt.
- When event 10225 is set, the fet$ and uset$ dictionary tables are checked for
corruption
by checking their integrity. Blocks that don't match the format are marked as
soft corrupt.
- Set event 10231 in the init.ora file to cause Oracle to skip software- and
media-corrupted blocks
when performing full table scans:
- Set event 10233 in the init.ora file to cause Oracle to skip software- and
media-corrupted blocks
when performing index range scans:
To dump the Oracle block you can use below command from 8.x on words:
_CORRUPTED_ROLLBACK_SEGMENTS=(RBS_1, RBS_2)
DB_BLOCK_COMPUTE_CHECKSUM
The following V$ views contain information about blocks marked logically corrupt:
V$ BACKUP_CORRUPTION, V$COPY_CORRUPTION
When this parameter is set, while reading a block from disk to catch, oracle will
compute the checksum
again and compares it with the value that is in the block.
If they differ, it indicates that the block is corrupted on disk. Oracle makes the
block as corrupt and
signals an error. There is an overhead involved in setting this parameter.
DB_BLOCK_CACHE_PROTECT=�TRUE�
Oracle will catch stray writes made by processes in the buffer catch.
Obtain the datafile numbers and block numbers for the corrupted blocks. Typically,
you obtain this output
from the standard output, the alert.log, trace files, or a media management
interface.
For example, you may see the following in a trace file:
Note 9:
=======
***
Corrupt block relative dba: 0x00401ec1 (file 1, block 7873)
Fractured block found during buffer read
Data in bad block -
type: 16 format: 2 rdba: 0x00401ec1
last change scn: 0x0000.00007389 seq: 0x1 flg: 0x04
consistency value in tail: 0x23430601
check value in block header: 0x5684, computed block checksum: 0x396b
spare1: 0x0, spare2: 0x0, spare3: 0x0
***
Reread of rdba: 0x00401ec1 (file 1, block 7873) found same corrupted data
Nitin,
I would suggest you to relocate the system datafiles to a new location on disk and
see
if the corruption is removed. If the issue still persist ,then I would suggest you
to log a TAR
with Oracle Support for further research.
========================
32. iSQL*Plus and EM 10:
========================
32.1 iSQL*Plus:
===============
Note 1:
-------
lsnrctl start
emctl start dbconsole
isqlplusctl start
http://localhost:5561/isqlplus/
Note 2:
-------
Doc ID: Note:281946.1 Content Type: TEXT/X-HTML
Subject: How to Verify that iSQL*Plus 10i is Running and How to Restart the
Processes? Creation Date: 31-AUG-2004
Type: HOWTO Last Revision Date: 06-APR-2005
Status: PUBLISHED
The information in this document applies to:
SQL*Plus - Version: 10.1.0
Information in this document applies to any platform.
Goal
How to verify that iSQL*Plus 10i is running, and how to restart the processes?
Fix
How to Verify that iSQL*Plus is running?
=======================================
UNIX Platform
-------------------
Check whether the iSQL*Plus process is running by entering the following command:
Windows Platform
--------------------------
Check whether the iSQL*Plus process is running by opening the Windows services
dialog from the Control Panel and checking
the status of the iSQL*Plus service.
The iSQL*Plus service will be called "OracleOracle_Home_NameiSQL*Plus".
Windows Platform
--------------------------
Use the Windows service to start and stop iSQL*Plus.
The service is set to start automatically on installation and when the operating
system is started.
Note 3:
-------
If this URL does not display the iSQL*Plus log in page, check that iSQL*Plus has
been started
For more additional information about iSQL*Plus please check the following
Metalink notes:
Note 281947.1 How to Troubleshoot iSQLPlus 10i when it is not Starting on Unix?
Note 281946.1?How to Verify that iSQLPlus 10i is Running and How to Restart the
Processes?
Note 283114.1?How to connect as sysdba/sysoper through iSQL*Plus in Oracle 10g
Note 4:
-------
" target=_blankhttp://Hostname:Port/isqlplus/dba
To access the iSQL*Plus DBA URL, you must set up the OC4J user manager. You can
set up OC4J to use:
This document discusses how to set up the iSQL*Plus DBA URL to use the XML-based
provider. For information on how to set up the LDAP-based provider, see the
Oracle9iAS Containers for J2EE documentation.
The actions available to manage users for the iSQL*Plus DBA URL are:
1. Create users
2. List users
3. Grant the webDba role
4. Remove users
admin_password is the password for the iSQL*Plus DBA realm administrator user,
admin. The password for the admin user is set to 'welcome' by default. You should
change this password as soon as possible.
A JAZN shell option, and a command line option are given for all steps.
$JAVA_HOME/bin/java -Djava.
security.properties=$ORACLE_HOME/sqlplus/admin/iplus/provider -jar
$ORACLE_HOME/oc4j/j2ee/home/jazn.jar -user "iSQL*Plus DBA/admin" -password
admin_password -shell
To exit the JAZN shell, enter:
EXIT
Create Users
You can create multiple users who have access to the iSQL*Plus DBA URL. To create
a user from the JAZN shell, enter:
$JAVA_HOME/bin/java -Djava.
security.properties=$ORACLE_HOME/sqlplus/admin/iplus/provider -jar
$ORACLE_HOME/oc4j/j2ee/home/jazn.jar -user "iSQL*Plus DBA/admin" -password
admin_password -adduser "iSQL*Plus DBA" username password
username and password are the username and password used to log into the iSQL*Plus
DBA URL.
To create multiple users, repeat the above command for each user.
List Users
You can confirm that users have been created and added to the iSQL*Plus DBA realm.
To confirm the creation of a user using the JAZN shell, enter:
$JAVA_HOME/bin/java -Djava.
security.properties=$ORACLE_HOME/sqlplus/admin/iplus/provider -jar
$ORACLE_HOME/oc4j/j2ee/home/jazn.jar -user "iSQL*Plus DBA/admin" -password
admin_password -listusers "iSQL*Plus DBA"
The usernames you created are displayed.
$JAVA_HOME/bin/java -Djava.
security.properties=$ORACLE_HOME/sqlplus/admin/iplus/provider -jar
$ORACLE_HOME/oc4j/j2ee/home/jazn.jar -user "iSQL*Plus DBA/admin" -password
admin_password -grantrole webDba "iSQL*Plus DBA" username
Remove Users
To remove a user using the JAZN shell, enter:
$JAVA_HOME/bin/java -Djava.
security.properties=$ORACLE_HOME/sqlplus/admin/iplus/provider -jar
$ORACLE_HOME/oc4j/j2ee/home/jazn.jar -user "iSQL*Plus DBA/admin" -password
admin_password -remuser "iSQL*Plus DBA" username
Revoke the webDba Role
To revoke a user's webDba role from the JAZN shell, enter:
$JAVA_HOME/bin/java -Djava.
security.properties=$ORACLE_HOME/sqlplus/admin/iplus/provider -jar
$ORACLE_HOME/oc4j/j2ee/home/jazn.jar -user "iSQL*Plus DBA/admin" -password
admin_password -revokerole "iSQL*Plus DBA" username
Change User Passwords
To change a user's password from the JAZN shell, enter:
$JAVA_HOME/bin/java -Djava.
security.properties=$ORACLE_HOME/sqlplus/admin/iplus/provider -jar
$ORACLE_HOME/oc4j/j2ee/home/jazn.jar -user "iSQL*Plus DBA/admin" -password
admin_password -setpasswd "iSQL*Plus DBA" username old_password new_password
Test iSQL*Plus DBA Access
Test iSQL*Plus DBA access by entering the iSQL*Plus DBA URL in your web browser:
" target=_blankhttp://machine_name.domain:5560/isqlplus/dba
A dialog is displayed requesting authentication for the iSQL*Plus DBA URL. Log in
as the user you created above. You may need to restart iSQL*Plus for the changes
to take effect.
Help us improve our service. Please email us your comments for this document. .
Developers write applications compliant to the ODBC specification and use ODBC
drivers to access the database.
The ODBC driver communicates with the vendor's native API. Then, the native API
passes instructions
to another vendor-specific low-level API. Finally the wire protocol API
communicates with the database.
The wire protocol architecture eliminates the need for the database's native API
(for example, Net9),
so the driver communicates directly to the database through the database's own
wire level protocol.
This effectively removes an entire communication layer.
================================
33. ADDM and other 10g features:
================================
=========================
33.1 Flash_recovery_area:
=========================
Note 1:
-------
Recovery components of the database interact with the flash recovery area to
ensure that the database
is completely recoverable using files in the flash recovery area. The database
manages the disk space
in the flash recovery area, and when there is not sufficient disk space to create
new files,
the database creates more room automatically by deleting the minimum set of files
from flash recovery area
that are obsolete, backed up to tertiary storage, or redundant.
Note 2:
-------
Before any Flash Backup and Recovery activity can take place, the Flash Recovery
Area must be set up.
The Flash Recovery Area is a specific area of disk storage that is set aside
exclusively for retention
of backup components such as datafile image copies, archived redo logs, and
control file autobackup copies.
These features include:
Unified Backup Files Storage. All backup components can be stored in one
consolidated spot.
The Flash Recovery Area is managed via Oracle Managed Files (OMF), and it can
utilize disk
resources managed by Oracle Automated Storage Management (ASM). In addition, the
Flash Recovery Area
can be configured for use by multiple database instances if so desired.
Automated Disk-Based Backup and Recovery. Once the Flash Recovery Area is
configured, all backup components
(datafile image copies, archived redo logs, and so on) are managed automatically
by Oracle.
Disk Cache for Tape Copies. Finally, if your disaster recovery plan involves
backing up to alternate media,
the Flash Recovery Area can act as a disk cache area for those backup components
that are
eventually copied to tape.
Flashback Logs. The Flash Recovery Area is also used to store and manage flashback
logs, which are used
during Flashback Backup operations to quickly restore a database to a prior
desired state.
Sizing the Flash Recovery Area. Oracle recommends that the Flash Recovery Area
should be sized large enough
to include all files required for backup and recovery. However, if insufficient
disk space is available,
Oracle recommends that it be sized at least large enough to contain any archived
redo logs that have not yet
been backed up to alternate media.
initialization parameters:
Examples:
-----
-- Listing 2.2: Setting up the Flash Recovery Area - open database
-----
http://download.oracle.com/docs/cd/B19306_01/backup.102/b14192/toc.htm
Note 2:
-------
Initialization Parameters
Setting the location of the flashback
recovery area db_recovery_file_dest=/oracle/flash_recovery_area
Setting the size of the flashback
recovery area db_recovery_file_dest_size=2147483648
Setting the retention time for flashback files (in minutes) -- 2 days
db_flashback_retention_target=2880
Demo
conn / as sysdba
shutdown immediate;
-- 2 days
alter system set DB_FLASHBACK_RETENTION_TARGET=2880;
SELECT estimated_flashback_size
FROM gv$flashback_database_log;
As SYS
As UWCLASS
SELECT current_scn
FROM gv$database;
SELECT oldest_flashback_scn,
oldest_flashback_time
FROM gv$flashback_database_log;
create table t (
mycol VARCHAR2(20))
ROWDEPENDENCIES;
COMMIT;
COMMIT;
/*
FLASHBACK DATABASE TO TIMESTAMP (SYSDATE-1/24);
FLASHBACK DATABASE
TO TIMESTAMP to_timestamp('2002-11-11 16:00:00', 'YYYY-MM-DD HH24:MI:SS');
*/
conn uwclass/uwclass
shutdown immediate;
-- what happens
The error ora-16014 is the real clue for this problem. Once the archive
destination becomes full the location also becomes invalid. Normally Oracle does
not do a recheck to see if space has been made available.
-- then
shutdown abort;
startup
==========
33.2 ADDM:
==========
Note 1:
=======
For this it uses the Automatic Workload Repository ( hereafter called AWR),
a repository defined in the database to store database wide usage statistics
at fixed size intervals (60 minutes).
To use ADDM for advising on how to tune the instance and SQL, you need to
make sure that the AWR has been populated with at least 2 sets of
performance data. When the STATISTICS_LEVEL is set to TYPICAL or ALL
the database will automatically schedule the AWR
to be populated at 60 minute intervals.
The snapshots need be created before and after the action you wish to
examine. E.g. when examining a bad performing query, you need to have
performance data snapshots from the timestamps before the query was started
and after the query finished.
You may also change the frequency of the snapshots and the duration for which
they
are saved in the AWR. Use the DBMS_WORKLOAD_REPOSITORY package as in the
following example:
execute
DBMS_WORKLOAD_REPOSITORY.MODIFY_SNAPSHOT_SETTINGS(interval=>60,retention=>43200);
Example:
--------
You can use ADDM through the PL/SQL API and query the various advisory views
in SQL*Plus to examine how to solve performance issues.
The example is based on the SCOTT account executing the various tasks. To
allow SCOTT to both generate AWR snapshots and sumbit ADDM recommendation
jobs, he needs to be granted proper access:
CONNECT / AS SYSDBA
GRANT ADVISOR TO scott;
GRANT SELECT_CATALOG_ROLE TO scott;
GRANT EXECUTE ON dbms_workload_repository TO scott;
Furthermore, the buffer cache size (DB_CACHE_SIZE) has been reduced to 24M.
The example presented makes use of a table called BIGEMP, residing in the
SCOTT schema. The table (containing about 14 million rows) has been created
with:
CONNECT scott/tiger
CREATE TABLE bigemp AS SELECT * FROM emp;
ALTER TABLE bigemp MODIFY (empno NUMBER);
DECLARE
n NUMBER;
BEGIN
FOR n IN 1..18
LOOP
INSERT INTO bigemp SELECT * FROM bigemp;
END LOOP;
COMMIT;
END;
/
UPDATE bigemp SET empno = ROWNUM;
COMMIT;
Running this script will show which snapshots have been generated, asks for
the snapshot IDs to be used for generating the report, and will generate the
report containing the ADDM findings.
When you do not want to use the script, you need to submit and execute the
ADDM task manually. First, query DBA_HIST_SNAPSHOT to see which snapshots
have been created. These snapshots will be used by ADDM to generate
recommendations:
SELECT * FROM dba_hist_snapshot ORDER BY snap_id;
Mark the 2 snapshot IDs (such as the lowest and highest ones) for use in
generating recommendations.
Next, you need to submit and execute the ADDM task manually, using a script
similar to:
DECLARE
task_name VARCHAR2(30) := 'SCOTT_ADDM';
task_desc VARCHAR2(30) := 'ADDM Feature Test';
task_id NUMBER;
BEGIN
(1) dbms_advisor.create_task('ADDM', task_id, task_name, task_desc,
null);
(2) dbms_advisor.set_task_parameter('SCOTT_ADDM', 'START_SNAPSHOT', 1);
dbms_advisor.set_task_parameter('SCOTT_ADDM', 'END_SNAPSHOT', 3);
dbms_advisor.set_task_parameter('SCOTT_ADDM', 'INSTANCE', 1);
dbms_advisor.set_task_parameter('SCOTT_ADDM', 'DB_ID', 494687018);
(3) dbms_advisor.execute_task('SCOTT_ADDM');
END;
/
When the job has successfully completed, examine the recommendations made by
ADDM by calling the DBMS_ADVISOR.GET_TASK_REPORT() routine, like in:
SET LONG 1000000 PAGESIZE 0 LONGCHUNKSIZE 1000
COLUMN get_clob FORMAT a80
SELECT dbms_advisor.get_task_report('SCOTT_ADDM', 'TEXT', 'TYPICAL')
FROM sys.dual;
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
NO RECOMMENDATIONS AVAILABLE
NO RECOMMENDATIONS AVAILABLE
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
ADDITIONAL INFORMATION
----------------------
ADDM points out which events cause the performance problems to occur and
suggests directions to follow to fix these bottlenecks. The ADDM
recommendations show amongst others that the query on BIGEMP needs to be
examined; in this case it suggests to run the Segment Advisor to check
whether the data segment is fragmented or not; it also advices to check
the application logic involved in accessing the BIGEMP table. Furthermore,
it shows the system suffers from I/O problems (which is in this example
caused by not using SAME and placing all database files on a single disk
partition).
The findings are sorted descending by impact: the issues causing the
greatest performance problems are listed at the top of the report. Solving
these issues will result in the greatest performance benefits. Also, in the
last
section of the report ADDM indicates the areas that are not representing
a problem for the performance of the instance
In this example the database is rather idle. As such the Enterprise Manager
notification job (which runs frequently) is listed at the top. You need not
worry about this job at all.
Please notice that the output of the last query may differ depending on what
took place on your database at the time the ADDM recommendations were
generated.
RELATED DOCUMENTS
-----------------
Note 2:
=======
To determine which segments will benefit from segment shrink, you can invoke
Segment Advisor.
After the Segment Advisor has been invoked to give recommendations, the findings
are available
in BDA_ADVISOR_FINDINGS and DBA_ADVISOR_RECOMMENDATIONS.
declare
name varchar2(100);
desc varchar2(500);
obj_id number;
begin
name:='';
desc:='Check HR.EMPLOYEE';
DBMS_ADVISOR.CREATE_TASK('Segment Advisor', :task_id, name, descr, NULL);
DBMS_ADVISOR.CREATE_OBJECT(name,'TABLE','HR','EMPLOYEES', NULL,NULL,obj_id);
DBMS_ADVISOR.SET_TASK_PARAMETER(name,'RECOMMEND_ALL','TRUE');
DBMS_ADVISOR.EXECUTE_TASK(name);
end;
print task_id
TASK_ID
-------
6
In DBA_ADVISOR_ACTIONS, you can even find the exact SQL statement to shrink the
hr.employees segment.
==============================
34. ASM and RAC in Oracle 10g:
==============================
34.1 ASM
========
========
Note 1:
========
In addition to the normal database background processes like CKPT, DBWR, LGWR,
SMON, and PMON,
an ASM instance uses at least two additional background processes to manage data
storage operations.
The Rebalancer process, RBAL, coordinates the rebalance activity for ASM disk
groups,
and the Actual ReBalance processes, ARBn, handle the actual rebalance of data
extent movements.
There are usually several ARB background processes (ARB0, ARB1, and so forth).
Every database instance that uses ASM for file storage, will also need two new
processes.
The Rebalancer background process (RBAL) handles global opens of all ASM disks in
the ASM Disk Groups,
while the ASM Bridge process (ASMB) connects as a foreground process into the ASM
instance when the
regular database instance starts. ASMB facilitates communication between the ASM
instance and
the regular database, including handling physical file changes like data file
creation and deletion.
ASMB exchanges messages between both servers for statistics update and instance
health validation.
These two processes are automatically started by the database instance when a new
Oracle file type -
for example, a tablespace's datafile -- is created on an ASM disk group. When an
ASM instance mounts
a disk group, it registers the disk group and connect string with Group Services.
The database instance
knows the name of the disk group, and can therefore use it to locate connect
information for
the correct ASM instance.
========
Note 2:
========
For Oracle10g on Linux and Windows-based platforms, CRS co-exists with but does
not inter-operate
with vendor clusterware. You may use vendor clusterware for all UNIX-based
operating systems
except for Linux. Even though, many of the Unix platforms have their own
clusterware products,
you need to use the CRS software to provide the HA support services. CRS (cluster
ready services)
supports services and workload management and helps to maintain the continuous
availability of the services.
CRS also manages resources such as virtual IP (VIP) address for the node and the
global services daemon.
Note that the "Voting disks" and the "Oracle Cluster Registry", are regarded as
part of the CRS.
OCR:
The Oracle Cluster Registry (OCR) contains cluster and database configuration
information
for Real Application Clusters Cluster Ready Services (CRS), including the list of
nodes
in the cluster database, the CRS application, resource profiles, and the
authorizations for
the Event Manager (EVM). The OCR can reside in a file on a cluster file system or
on a shared raw device.
When you install Real Application Clusters, you specify the location of the OCR.
OCFS:
OCFS2 is the next generation of the Oracle Cluster File System for Linux. It is an
extent based,
POSIX compliant file system. Unlike the previous release (OCFS), OCFS2 is a
general-purpose
file system that can be used for shared Oracle home installations making
management of
Oracle Real Application Cluster (RAC) installations even easier. Among the new
features and benefits are:
Node and architecture local files using Context Dependent Symbolic Links (CDSL)
Network based pluggable DLM
Improved journaling / node recovery using the Linux Kernel "JBD" subsystem
Improved performance of meta-data operations (space allocation, locking, etc).
Improved data caching / locking (for files such as oracle binaries, libraries,
etc)
Though ASM appears to be the intended replacement for Oracle Cluster File System
(OCFS)
for the Real Applications Cluster (RAC).
ASM supports Oracle Real Application Clusters (RAC), so there is no need
for a separate Cluster LVM or a Cluster File System.
========
Note 3:
========
In the SQL statements that you use for creating database structures such as
tablespaces, redo log and
archive log files, and control files, you specify file location in terms of disk
groups.
Automatic Storage Management then creates and manages the associated underlying
files for you.
A disk group consists of a grouping of disks that are managed together as a unit.
These disks are referred
to as ASM disks. Files written on ASM disks are ASM files, whose names are
automatically generated
by Automatic Storage Management. You can specify user-friendly alias names for ASM
files,
but you must create a hierarchical directory structure for these alias names.
You can affect how Automatic Storage Management places files on disks by
specifying failure groups.
Failure groups define disks that share components, such that if one fails then
other disks sharing
the component might also fail. An example of what you might define as a failure
group would be a set
of SCSI disks sharing the same SCSI controller. Failure groups are used to
determine which ASM disks
to use for storing redundant data. For example, if two-way mirroring is specified
for a file,
then redundant copies of file extents must be stored in separate failure groups.
If you would take a look at the v$datafile, v$logfile, and v$controlfile of the
regular Database,
you would see information like in the following example:
1 +DATA1/rac0/datafile/system.256.1
2 +DATA1/rac0/datafile/undotbs.258.1
3 +DATA1/rac0/datafile/sysaux.257.1
4 +DATA1/rac0/datafile/users.259.1
5 +DATA1/rac0/datafile/example.269.1
+DATA1/rac0/controlfile/current.261.3
+DATA1/rac0/controlfile/current.260.3
Name Description
INSTANCE_TYPE Must be set to INSTANCE_TYPE = ASM.
Note: This is the only required parameter. All other parameters
take suitable defaults
for most environments.
DB_UNIQUE_NAME Unique name for this group of ASM instances within the cluster or
on a node.
Default: +ASM (Needs to be modified only if trying to run multiple ASM
instances on the same node)
Note: This parameter is dynamic and if you are using a server parameter file
(SPFILE), then you should
rarely need to manually alter this value. Automatic Storage Management
automatically adds a disk group
to this parameter when a disk group is successfully mounted, and automatically
removes a disk group that
is specifically dismounted. However, when using a traditional text initialization
parameter file,
remember to edit the initialization parameter file to add the name of any disk
group that you want automatically
mounted at instance startup, and remove the name of any disk group that you no
longer want automatically mounted.
-- ASM Views:
The ASM configuration can be viewed using the V$ASM_% views, which often contain
different information
depending on whether they are queried from the ASM instance, or a dependant
database instance.
V$ASM_CLIENT Shows which database instance(s) are using any ASM disk groups
that are being mounted by this ASM instance
V$ASM_DISK Lists each disk discovered by the ASM instance, including disks
that are not part of any ASM disk group
V$ASM_DISKGROUP Describes information about ASM disk groups mounted by the ASM
instance
V$ASM_FILE Lists each ASM file in every ASM disk group mounted by the ASM
instance
V$ASM_TEMPLATE Lists each template present in every ASM disk group mounted by
the ASM instance
The SQL statements introduced in this section are only available in an ASM
instance.
You must first start the ASM instance.
Example 1:
----------
/devices/diska1
/devices/diska2
/devices/diska3
/devices/diska4
/devices/diskb1
/devices/diskb2
/devices/diskb3
/devices/diskb4
The disks diska1 - diska4 are on a separate SCSI controller from disks diskb1 -
diskb4.
The following SQL*Plus session illustrates starting an ASM instance and creating a
disk group named dgroup1.
% SQLPLUS /NOLOG
SQL> CONNECT / AS SYSDBA
In this example, dgroup1 is composed of eight disks that are defined as belonging
to either
failure group controller1 or controller2. Since NORMAL REDUNDANCY level is
specified for the disk group,
then Automatic Storage Management provides redundancy for all files created in
dgroup1 according to the
attributes specified in the disk group templates.
For example, in the system default template shown in the table in "Managing Disk
Group Templates",
normal redundancy for the online redo log files (ONLINELOG template) is two-way
mirroring. This means that
when one copy of a redo log file extent is written to a disk in failure group
controller1, a mirrored copy
of the file extent is written to a disk in failure group controller2. You can see
that to support normal
redundancy level, at least two failure groups must be defined.
Since no NAME clauses are provided for any of the disks being included in the disk
group,
the disks are assigned the names of dgroup1_0001, dgroup1_0002, ..., dgroup1_0008.
Example 2:
----------
Example 3:
----------
At some point in using OUI in installing the software, and creating a database,
you will
see the following screen:
----------------------------------------------------
|SPECIFY Database File Storage Option |
| |
| o File system |
| Specify Database file location: ######### |
| |
| o Automatic Storage Management (ASM) |
| |
| o Raw Devices |
| |
| Specify Raw Devices mapping file: ########## |
----------------------------------------------------
Suppose that you have on a Linux machine the following raw disk devices:
/dev/raw/raw1 8GB
/dev/raw/raw2 8GB
/dev/raw/raw3 6GB
/dev/raw/raw4 6GB
/dev/raw/raw5 6GB
/dev/raw/raw6 6GB
Then you can choose ASM in the upper screen, and see the following screen, where
you can create the initial diskgroup and assign disks to it:
-----------------------------------------------------
| Configure Automatic Storage Management |
| |
| Disk Group Name: data1 |
| |
| Redundancy |
| o High o Normal o External |
| |
| Add member Disks |
| |-------------------------------- |
| | select Disk Path | |
| |[#] /dev/raw/raw1 | |
| |[#] /dev/raw/raw2 | |
| |[ ] /dev/raw/raw3 | |
| |[ ] /dev/raw/raw4 | |
| -------------------------------- |
| |
-----------------------------------------------------
Disk groups that are specified in the ASM_DISKGROUPS initialization parameter are
mounted automatically
at ASM instance startup. This makes them available to all database instances
running on the same node
as Automatic Storage Management. The disk groups are dismounted at ASM instance
shutdown.
Automatic Storage Management also automatically mounts a disk group when you
initially create it,
and dismounts a disk group if you drop it.
There may be times that you want to mount or dismount disk groups manually. For
these actions use
the ALTER DISKGROUP ... MOUNT or ALTER DISKGROUP ... DISMOUNT statement. You can
mount or dismount
disk groups by name, or specify ALL.
If you try to dismount a disk group that contains open files, the statement will
fail, unless you also
specify the FORCE clause.
Example
The following statement dismounts all disk groups that are currently mounted to
the ASM instance:
========
Note 4:
========
ASMLib is a support library for the Automatic Storage Management feature of Oracle
Database 10g.
This document is a set of tips for installing the Linux specific ASM library and
its assocated driver.
This library is provide to enable ASM I/O to Linux disks without the limitations
of the
standard Unix I/O API. The steps below are steps that the system administrator
must follow.
The ASMLib software is available from the Oracle Technology Network. Go to ASMLib
download page
and follow the link for your platform.
You will see 4-6 packages for your Linux platform.
-- Configuring ASMLib:
Now that the ASMLib software is installed, a few steps have to be taken by the
system administrator
to make the ASM driver available. The ASM driver needs to be loaded, and the
driver filesystem needs
to be mounted. This is taken care of by the initialization script,
"/etc/init.d/oracleasm".
Run the "/etc/init.d/oracleasm" script with the "configure" option. It will ask
for the user and group
that default to owning the ASM driver access point. If the database was running as
the 'oracle' user
and the 'dba' group, the output would look like this:
This will configure the on-boot properties of the Oracle ASM library
driver. The following questions will determine whether the driver is
loaded on boot and what permissions it will have. The current values
will be shown in brackets ('[]'). Hitting without typing an
answer will keep that current value. Ctrl-C will abort.
This should load the oracleasm.o driver module and mount the ASM driver
filesystem.
By selecting enabled = 'y' during the configuration, the system will always load
the module
and mount the filesystem on boot.
The automatic start can be enabled or disabled with the 'enable' and 'disable'
options
to /etc/init.d/oracleasm:
The system administrator has one last task. Every disk that ASMLib is going to be
accessing
needs to be made available. This is accomplished by creating an ASM disk. The
/etc/init.d/oracleasm script
is again used for this task:
Disk names are ASCII capital letters, numbers, and underscores. They must start
with a letter.
Disks that are no longer used by ASM can be unmarked as well:
When a disk is added to a RAC setup, the other nodes need to be notified about it.
Run the 'createdisk' command on one node, and then run 'scandisks' on every other
node:
ASMLib uses discovery strings to determine what disks ASM is asking for. The
generic Linux ASMLib
uses glob strings. The string must be prefixed with "ORCL:". Disks are specified
by name.
A disk created with the name "VOL1" can be discovered in ASM via the discovery
string "ORCL:VOL1".
Similarly, all disks that start with the string "VOL" can be queried with the
discovery string "ORCL:VOL*".
Disks cannot be discovered with path names in the discovery string. If the prefix
is missing,
the generic Linux ASMLib will ignore the discovery string completely, expecting
that it is intended
for a different ASMLib. The only exception is the empty string (""), which is
considered a full wildcard.
This is precisely equivalent to the discovery string "ORCL:*".
NOTE: Once you mark your disks with Linux ASMLib, Oracle Database 10g R1 (10.1)
OUI will not be able
to discover your disks. It is recommended that you complete a Software Only
install and then use DBCA
to create your database (or use the custom install).
========
Note 5:
========
The level of redundancy and the granularity of the striping can be controlled
using templates.
Default templates are provided for each file type stored by ASM, but additional
templates can be defined as needed.
Failure groups are defined within a disk group to support the required level of
redundancy.
For two-way mirroring you would expect a disk group to contain two failure groups
so individual files
are written to two locations.
The init.ora / spfile initialization parameters that are of specific interest for
an ASM instance are:
INSTANCE_TYPE - Set to ASM or RDBMS depending on the instance type. The default
is RDBMS.
DB_UNIQUE_NAME - Specifies a globally unique name for the database. This defaults
to +ASM but
must be altered if you intend to run multiple ASM instances.
ASM_POWER_LIMIT - The maximum power for a rebalancing operation on an ASM
instance. The valid values range
from 1 to 11, with 1 being the default. The higher the limit the
more resources are allocated
resulting in faster rebalancing operations. This value is also
used as the default
when the POWER clause is omitted from a rebalance operation.
ASM_DISKGROUPS - The list of disk groups that should be mounted by an ASM
instance during instance startup,
or by the ALTER DISKGROUP ALL MOUNT statement. ASM configuration
changes are automatically
reflected in this parameter.
ASM_DISKSTRING - Specifies a value that can be used to limit the disks considered
for discovery.
Altering the default value may improve the speed of disk group
mount time and the speed
of adding a disk to a disk group. Changing the parameter to a
value which prevents
the discovery of already mounted disks results in an error. The
default value is NULL
allowing all suitable disks to be considered.
Incorrect usage of parameters in ASM or RDBMS instances result in ORA-15021
errors.
To create an ASM instance first create a file called init+ASM.ora in the /tmp
directory
containing the following information.
INSTANCE_TYPE=ASM
export ORACLE_SID=+ASM
sqlplus / as sysdba
File created.
The ASM instance is now ready to use for creating and mounting disk groups.
To shutdown the ASM instance issue the following command.
SQL> shutdown
ASM instance shutdown
SQL>
Once an ASM instance is present disk groups can be used for the following
parameters
in database instances (INSTANCE_TYPE=RDBMS) to allow ASM file creation:
DB_CREATE_FILE_DEST
DB_CREATE_ONLINE_LOG_DEST_n
DB_RECOVERY_FILE_DEST
CONTROL_FILES
LOG_ARCHIVE_DEST_n
LOG_ARCHIVE_DEST
STANDBY_ARCHIVE_DEST
NORMAL - The ASM instance waits for all connected ASM instances and SQL sessions
to exit then shuts down.
IMMEDIATE - The ASM instance waits for any SQL transactions to complete then shuts
down.
It doesn't wait for sessions to exit.
TRANSACTIONAL - Same as IMMEDIATE.
ABORT - The ASM instance shuts down instantly.
Disk groups are created using the CREATE DISKGROUP statement. This statement
allows you to specify
the level of redundancy:
In addition failure groups and preferred names for disks can be defined. If the
NAME clause is omitted
the disks are given a system generated name like "disk_group_1_0001". The FORCE
option can be used
to move a disk from another disk group into this one.
Disks can be added or removed from disk groups using the ALTER DISKGROUP
statement.
Remember that the wildcard "*" can be used to reference disks so long as the
resulting string does not match
a disk already used by an existing disk group.
-- Add disks.
ALTER DISKGROUP disk_group_1 ADD DISK
'/devices/disk*3',
'/devices/disk*4';
-- Drop a disk.
ALTER DISKGROUP disk_group_1 DROP DISK diska2;
Disks can be resized using the RESIZE clause of the ALTER DISKGROUP statement.
The statement can be used to resize individual disks, all disks in a failure group
or all disks
in the disk group. If the SIZE clause is omitted the disks are resized to the size
of the disk returned by the OS.
Disk groups can be rebalanced manually using the REBALANCE clause of the ALTER
DISKGROUP statement.
If the POWER clause is omitted the ASM_POWER_LIMIT parameter value is used.
Rebalancing is only needed
when the speed of the automatic rebalancing is not appropriate.
Disk groups are mounted at ASM instance startup and unmounted at ASM instance
shutdown.
Manual mounting and dismounting can be accomplished using the ALTER DISKGROUP
statement as seen below.
Templates
Templates are named groups of attributes that can be applied to the files within a
disk group.
The following example show how templates can be created, altered and dropped.
-- Modify template.
ALTER DISKGROUP disk_group_1 ALTER TEMPLATE my_template ATTRIBUTES (COARSE);
-- Drop template.
ALTER DISKGROUP disk_group_1 DROP TEMPLATE my_template;Available attributes
include:
Directories
A directory heirarchy can be defined using the ALTER DISKGROUP statement to
support ASM file aliasing.
The following examples show how ASM directories can be created, modified and
deleted.
-- Create a directory.
ALTER DISKGROUP disk_group_1 ADD DIRECTORY '+disk_group_1/my_dir';
-- Rename a directory.
ALTER DISKGROUP disk_group_1 RENAME DIRECTORY '+disk_group_1/my_dir' TO
'+disk_group_1/my_dir_2';
-- Rename an alias.
ALTER DISKGROUP disk_group_1 RENAME ALIAS '+disk_group_1/my_dir/my_file.dbf'
TO '+disk_group_1/my_dir/my_file2.dbf';
-- Delete an alias.
ALTER DISKGROUP disk_group_1 DELETE ALIAS '+disk_group_1/my_dir/my_file.dbf';
Files
Files are not deleted automatically if they are created using aliases, as they are
not Oracle Managed Files (OMF),
or if a recovery is done to a point-in-time before the file was created. For these
circumstances
it is necessary to manually delete the files, as shown below.
ASM Views
The ASM configuration can be viewed using the V$ASM_% views, which often contain
different information
depending on whether they are queried from the ASM instance, or a dependant
database instance.
V$ASM_ALIAS Shows every alias for every disk group mounted by the ASM
instance
V$ASM_CLIENT Shows which database instance(s) are using any ASM disk groups
that are being mounted by this ASM instance
V$ASM_DISK Lists each disk discovered by the ASM instance, including disks
that are not part of any ASM disk group
V$ASM_DISKGROUP Describes information about ASM disk groups mounted by the ASM
instance
V$ASM_FILE Lists each ASM file in every ASM disk group mounted by the ASM
instance
V$ASM_TEMPLATE Lists each template present in every ASM disk group mounted by
the ASM instance
I was also able to query the following dynamic views against my database instance
to view the related ASM storage
components of that instance:
-- ASM Dynamic Views: FROM Database Instance Information
V$ASM_DISKGROUP Shows one row per each ASM disk group that's mounted by the
local ASM instance
V$ASM_DISK Displays one row per each disk in each ASM disk group that are
in use by the database instance
V$ASM_CLIENT Lists one row per each ASM instance for which the database
instance has any open ASM files
ASM Filenames
There are several ways to reference ASM file. Some forms are used during creation
and some for
referencing ASM files. The forms for file creation are incomplete, relying on ASM
to create the fully qualified name,
which can be retrieved from the supporting views. The forms of the ASM filenames
are summarised below.
RMAN> STARTUP NOMOUNTRestore the controlfile into the new location from the old
location.
RMAN> ALTER DATABASE MOUNT;Copy the database into the ASM disk group.
RMAN> BACKUP AS COPY DATABASE FORMAT '+disk_group';Switch all datafile to the new
ASM location.
RMAN> ALTER DATABASE OPEN;Create new redo logs in ASM and delete the old ones.
SQL> ALTER DATABASE ENABLE BLOCK CHANGE TRACKING;Form more information see:
Note 6:
=======
WARNING: Re-reading the partition table failed with error 16: Device or resource
busy.
The kernel still uses the old table.
The new table will be used at the next reboot.
Syncing disks.
SQL> startup
ASM instance started
6 rows selected.
6 rows selected.
Diskgroup created.
6 rows selected.
SQL> startup
ORACLE instance started.
NAME
--------------------------------------------------------------------------------
+ORADG/danaly/datafile/system.264.600016955
+ORADG/danaly/datafile/undotbs1.265.600016969
+ORADG/danaly/datafile/sysaux.266.600016977
+ORADG/danaly/datafile/users.268.600016987
Tablespace created.
NAME
---------------------------------------------------------------------------------
+ORADG/danaly/datafile/system.264.600016955
+ORADG/danaly/datafile/undotbs1.265.600016969
+ORADG/danaly/datafile/sysaux.266.600016977
+ORADG/danaly/datafile/users.268.600016987
+ORAG2/danaly/datafile/eygle.256.600137647
Connected to:
Oracle Database 10g Enterprise Edition Release 10.2.0.1.0 - Production
With the Partitioning, Oracle Label Security, OLAP and Data Mining Scoring Engine
options
Diskgroup altered.
============
Note 7: OMF
============
Tablespaces
Online redo log files
Control files
- DB_CREATE_FILE_DEST
Defines the location of the default file system directory where Oracle creates
datafiles
or tempfiles when no file specification is given in the creation operation. Also
used as the default
file system directory for online redo log and control files if
DB_CREATE_ONLINE_LOG_DEST_n is not specified.
- DB_CREATE_ONLINE_LOG_DEST_n
Defines the location of the default file system directory for online redo log
files and
control file creation when no file specification is given in the creation
operation. You can use this
initialization parameter multiple times, where n specifies a multiplexed copy of
the online redo log
or control file. You can specify up to five multiplexed copies
Example:
DB_CREATE_FILE_DEST = '/u01/oradata/payroll'
DB_CREATE_ONLINE_LOG_DEST_1 = '/u02/oradata/payroll'
DB_CREATE_ONLINE_LOG_DEST_2 = '/u03/oradata/payroll'
===========================================
Note 1: High Level Overview Oracle 10g RAC
===========================================
Cluster Ready Services, or CRS, is a new feature for 10g RAC. Essentially, it is
Oracle's own clusterware.
On most platforms, Oracle supports vendor clusterware; in these cases, CRS
interoperates with the vendor
clusterware, providing high availability support and service and workload
management. On Linux and Windows clusters,
CRS serves as the sole clusterware. In all cases, CRS provides a standard cluster
interface that is consistent
across all platforms.
CRS consists of four processes (crsd, occsd, evmd, and evmlogger) and two disks:
the Oracle Cluster Registry (OCR), and the voting disk.
CRS stores information about these resources in the OCR. If the information in the
OCR for one of these
resources becomes damaged or inconsistent, then CRS is no longer able to manage
that resource.
Fortunately, the OCR automatically backs itself up regularly and frequently.
RAC is "scale out" technology: just add commodity nodes to the system.
The key component is "cache fusion". Data are transferred from one node
to another via very fast interconnects.
Essential to 10g RAC is a "Shared Cache" technology.
Automatic Workload Repository (AWR) plays a role also. The Fast Application
Notification (FAN) mechanism
that is part of RAC, publishes events that describe the current service level
being provided
by each instance, to AWR. The load balancing advisory information is then used to
determine
the best instance to serve the new request.
. With RAC, ALL Instances of ALL nodes in a cluster, access a SINGLE database.
. But every instance has it's own UNDO tablespace, and REDO logs.
For application control and tools, it can be said that 10g RAC supports
- OEM Grid Control http://hostname:5500/em
OEM Database Control http://hostname:1158/em
- "svrctl" is a command line interface to manage the cluster configuration,
for example, starting and stopping all nodes in one command.
- Cluster Verification Utility (cluvfy) can be used for an installation and sanity
check.
- RAC is HA , High Availability, that will keep things Up and Running in one
site.
- Data Guard is DR, Disaster Recovery, and is able to mirror one site to another
remote site.
===========================================================
Note 2: 10g RAC processes, services, daemons and start stop
===========================================================
CRS consists of four processes (crsd, occsd, evmd, and evmlogger) and two disks:
the Oracle Cluster Registry (OCR), and the voting disk.
To start and stop CRS when the machine starts or shutdown, on unix there are rc
scripts in place.
You can also, as root, manually start, stop, enable or disable the services with:
/etc/init.d/init.crs start
/etc/init.d/init.crs stop
/etc/init.d/init.crs enable
/etc/init.d/init.crs disable
Or with
==============================================
Note 3: Installation notes 10g RAC on Windows
==============================================
> One private internet protocol (IP) address for each node to serve as the private
interconnect.
The following must be true for each private IP address:
> One public IP address for each node, to be used as the Virtual IP (VIP) address
for client connections
and for connection failover. The name associated with the VIP must be different
from the default host name.
This VIP must be associated with the same interface name on every node that is
part of your cluster.
In addition, the IP addresses that you use for all of the nodes that are part of a
cluster must be from
the same subnet.
> One public fixed hostname address for each node, typically assigned by the
system administrator
during operating system installation. If you have a DNS, then register both the
fixed IP and the VIP address
with DNS. If you do not have DNS, then you must make sure that the public IP and
VIP addresses for all
nodes are in each node's host file.
For example, with a two node cluster where each node has one public and one
private interface,
you might have the configuration shown in the following table for your network
interfaces,
where the hosts file is %SystemRoot%\system32\drivers\etc\hosts:
To enable VIP failover, the configuration shown in the preceding table defines the
public and VIP addresses
of both nodes on the same subnet, 143.46.43. When a node or interconnect fails,
then the associated VIP
is relocated to the surviving instance, enabling fast notification of the failure
to the clients connecting
through that VIP. If the application and client are configured with transparent
application failover options,
then the client is reconnected to the surviving instance.
To disable Windows Media Sensing for TCP/IP, you must set the value of the
DisableDHCPMediaSense parameter to 1
on each node. Disable Media Sensing by completing the following steps on each node
of your cluster:
Use Registry Editor (Regedt32.exe) to view the following key in the registry:
HKEY_LOCAL_MACHINE\System\CurrentControlSet\Services\Tcpip\Parameters
- External shared disks for storing Oracle Clusterware and database files.
The disk configuration options available to you are described in Chapter 3,
"Storage Pre-Installation Tasks".
Review these options before you decide which storage option to use in your RAC
environment. However, note
that when Database Configuration Assistant (DBCA) configures automatic disk
backup, it uses a
database recovery area which must be shared. The database files and recovery files
do not necessarily have
to be located on the same type of storage.
Determine the storage option for your system and configure the shared disk. Oracle
recommends that
you use Automatic Storage Management (ASM) and Oracle Managed Files (OMF), or a
cluster file system.
If you use ASM or a cluster file system, then you can also take advantage of OMF
and other Oracle Database 10g
storage features. If you use RAC on Oracle Database 10g Standard Edition, then you
must use ASM.
If you use ASM, then Oracle recommends that you install ASM in a separate home
from the
Oracle Clusterware home and the Oracle home.
When you install Oracle Clusterware or RAC, OUI copies the Oracle software onto
the node from which
you are running it. If your Oracle home is not on a cluster file system, then OUI
propagates the software
onto the other nodes that you have selected to be part of your OUI installation
session.
If the database files are stored on a cluster file system, then the recovery area
can also be shared through
the cluster file system.
If the database files are stored on an Automatic Storage Management (ASM) disk
group, then the recovery area
can also be shared through ASM.
If the database files are stored on raw devices, then you must use either a
cluster file system or ASM
for the recovery area.
Note:
ASM disk groups are always valid recovery areas, as are cluster file systems.
Recovery area files do not have
to be in the same location where datafiles are stored. For instance, you can store
datafiles on raw devices,
but use ASM for the recovery area.
Data files are not placed on NTFS partitions, because they cannot be shared.
Data files can be placed on Oracle Cluster File System (OCFS), on raw disks using
ASM, or on raw disks.
- Oracle Clusterware
You must provide OUI with the names of the nodes on which you want to install
Oracle Clusterware.
The Oracle Clusterware home can be either shared by all nodes, or private to each
node, depending
on your responses when you run OUI. The home that you select for Oracle
Clusterware must be different
from the RAC-enabled Oracle home.
Versions of cluster manager previous to Oracle Database 10g were sometimes
referred to as "Cluster Manager".
In Oracle Database 10g, this function is performed by a Oracle Clusterware
component known as
Cluster Synchronization Services (CSS). The OracleCSService, OracleCRService, and
OracleEVMService
replace the service known previous to Oracle Database 10g as OracleCMService9i.
Once you have installed Oracle Clusterware, you can use CVU by entering cluvfy
commands on the command line.
To use CVU before you install Oracle Clusterware, you must run the commands using
a command file available
on the Oracle Clusterware installation media. Use the following syntax to run a
CVU command run from the
installation media, where media is the location of the Oracle Clusterware
installation media and options
is a list of one or more CVU command options:
media\clusterware\cluvfy\runcluvfy.bat options
The following code example is of a CVU help command, run from a staged copy of the
Oracle Clusterware
directory downloaded from OTN into a directory called stage on your C: drive:
For a quick test, you can run the following CVU command that you would normally
use after you have completed
the basic hardware and software configuration:
Use the location of your Oracle Clusterware installation media for the media value
and a list of the nodes,
separated by commas, in your cluster for node_list. Expect to see many errors if
you run this command
before you or your system administrator complete the cluster pre-installation
steps.
On Oracle Real Application Clusters systems, each member node of the cluster must
have user equivalency
for the Administrative privileges account that installs the database. This means
that the administrative
privileges user account and password must be the same on all nodes.
where node_list is the names of the nodes in your cluster, separated by commas.
However, because you have
not yet installed Oracle Clusterware, you must execute the CVU command from the
installation media using a command
like the one following. In this example, the command checks the hardware and
operating system of a two-node
cluster with nodes named node1 and node2, using a staged copy of the installation
media in a directory called
stage on the C: drive:
You can omit the -verbose keyword if you do not wish to see detailed results
listed as CVU performs
each individual test.
The following example is a command, without the -verbose keyword, to check for the
readiness of the cluster
for installing Oracle Clusterware:
where node_name is the node name. If your installation will access drives in
addition to the C: drive, repeat
this command for every node in the cluster, substituting the drive letter for each
drive you plan to use.
For the installation to be successful, you must use the same user name and
password on each node in a cluster
or use a domain user name. If you use a domain user name, then log on under a
domain with a user name and password
to which you have explicitly granted local administrative privileges on all nodes.
Click Start, then click Settings, then Control Panel, then Administrative Tools,
then Computer Management,
then Device Manager, and then Disk drives
Expand the Disk drives and double-click the first drive listed
Under the Disk Properties tab for the selected drive, uncheck the option that
enables the write cache
Double-click each of the other drives listed in the Disk drives hive and disable
the write cache as described
in the previous step
Caution:
Any disks that you use to store files, including database files, that will be
shared between nodes,
must have write caching disabled.
To enable automounting:
c:\> diskpart
DISKPART> automount enable
Automatic mounting of new volumes enabled.
3.4 Reviewing Storage Options for Oracle Clusterware, Database, and Recovery
Files:
----------------------------------------------------------------------------------
-
This section describes supported options for storing Oracle Clusterware files,
Oracle Database software,
and database files.
1. Oracle Cluster File System (OCFS): The cluster file system Oracle provides for
the Windows and Linux communities.
If you intend to store Oracle Clusterware files on OCFS, then you must ensure that
OCFS volume sizes
are at least 500 MB each.
2. Raw storage: Raw logical volumes or raw partitions are created and managed by
Microsoft Windows
disk management tools or by tools provided by third party vendors.
Note that you must provide disk space for one mirrored Oracle Cluster Registry
(OCR) file,
and two mirrored voting disk files.
There are three ways to store Oracle Database and recovery files on shared disks:
2. Oracle Cluster File System (OCFS): Note that if you intend to use OCFS for your
database files,
then you should create partitions large enough for the database files when you
create partitions
for Oracle Clusterware
Note:
If you want to have a shared Oracle home directory for all nodes, then you must
use OCFS.
3. Raw storage: Note that you cannot use raw storage to store Oracle database
recovery files.
The storage option that you choose for recovery files can be the same as or
different to the option
you choose for the database files.
Remember to use the full path name and the runcluvfy.bat command on the
installation media and include
the list of nodes in your cluster, separated by commas, for the node_list. The
following example is for
a system with two nodes, node1 and node2, and the installation media on drive F:
If you want to check the shared accessibility of a specific shared storage type to
specific nodes
in your cluster, then use the following command syntax:
In the preceding syntax, the variable node_list is the list of nodes you want to
check, separated by commas,
and the variable storageID_list is the list of storage device IDs for the storage
devices managed by the
file system type that you want to check.
=====================================
Note 4: Installation on Redhat Linux
=====================================
192.168.2.0
------------------------------------------ public network
| |
| |
------------ -------------
|InstanceA |Private network |InstanceB |
| |Ethernet | |
| |--------------------| |
| |192.168.1.0 | |
| | | |
| |____________ | |
| | ----- -|--- | |
| |--|PWR| |PWR|----| |
| | ----- ----- | |
| | |_______________| |
| | | |
------------ -------------
| SCSI bus or Fible Channel |
------------------ --------------
Interconnect | |
| |
Fig 4.1 -----------
|Shared | - has Single DB on: ASM or OCFS or RAW
|Disk | - has OCR and Voting disk on: OCFS or RAW
(not ASM)
|Storage | - has Recovery area on: ASM or OCFS (not
RAW)
-----------
4.2.4 create oracle user and groups dba, oinstall on all nodes.
Make sure they all have the same UID and GUI.
4.2.5 Make sure the user oracle has an appropriate .profile or .bash_profile
4.2.6 Every node needs a private network connection and a public network
connection (at least
two networkcards).
Most out of the box kernel parameters (of RHELS 3,4,5) are set correctly for
Oracle
except a few.
You can check the most important parameters using the following command:
If some value should be changed, you can change the "/etc/sysctl.conf" file and
run the "/sbin/sysctl -p" command
to change the value immediately.
Every time the system boots, the init program runs the /etc/rc.d/rc.sysinit
script. This script contains
a command to execute sysctl using /etc/sysctl.conf to dictate the values passed to
the kernel.
Any values added to /etc/sysctl.conf will take effect each time the system boots.
4.2.8 make sure ssh and scp are working on all nodes without asking for a
password.
Use shh-keygen to arrange that.
Suppose you have the following 3 hosts, with their associated public and private
names:
public private
oc1 poc1
oc2 poc2
oc3 poc3
192.168.2.99 rhes30
192.168.2.166 oltp
192.168.2.167 mw
On all nodes, the shared disk devices should be accessible through the same
devices names.
Raw Device Name Physical Device Name Purpose
/dev/raw/raw1 /dev/sda1 ASM Disk 1: +DATA1
/dev/raw/raw2 /dev/sdb1 ASM Disk 1: +DATA1
/dev/raw/raw3 /dev/sdc1 ASM Disk 2: +RECOV1
/dev/raw/raw4 /dev/sdd1 ASM Disk 2: +RECOV1
/dev/raw/raw5 /dev/sde1 OCR Disk (on RAW device)
/dev/raw/raw6 /dev/sdf1 Voting Disk (on RAW device)
First install CRS in its own home directory, e.g. CRS10gHome, apart from the
Oracle home dir.
As Oracle user:
./runInstaller
---------------------------------------------------
| | Screen 1
|Specify File LOcations |
| |
|Source |
|Path: /install/crs10g/Disk1/stage/products.xml |
| |
|Destination |
|Name: CRS10gHome |
|Path: /u01/app/oracle/product/10.1.0/CRS10gHome |
| |
---------------------------------------------------
---------------------------------------------------
| | Screen 2
|Cluster Configuration |
| |
|Cluster Name: lec1 |
| |
| Public Node Name Private Node Name |
| --------------------------------------------- |
| |oc1 | p0c1 | |
| |-------------------------------------------- |
| |oc2 | p0c2 | |
| |-------------------------------------------- |
| |oc3 | poc3 | |
| |-------------------------------------------- |
---------------------------------------------------
---------------------------------------------------
| | Screen 3
|Private Interconnect Enforcement |
| |
| |
| |
| Interface Name Subnet Interface type |
| --------------------------------------------- |
| |eth0 |192.168.2.0 |Public | |
| |-------------------------------------------- |
| |eth1 |192.168.1.0 |Private | |
| |-------------------------------------------- |
| |
---------------------------------------------------
In the next screen, you specify /dev/raw/raw5 as the raw disk for the Oracle
Cluster Registry.
---------------------------------------------------
| | Screen 4
|Oracle Cluster Registry |
| |
|Specify OCR Location: /dev/raw/raw5 |
| |
---------------------------------------------------
---------------------------------------------------
| | Screen 5
|Voting Disk |
| |
|Specify Voting Disk: /dev/raw/raw6 |
| |
---------------------------------------------------
After this, you can continue with the other window, and see an "Install Summary"
screen.
Now you click "Install" and the installation begins.
Apart from the node you work on, the software will also be copied to the other
nodes as well.
After the installation is complete, you are once again prompted to run a script as
root
on each node of the Cluster.
This is the script "/u01/app/oracle/product/10.1.0/CRS10gHome/root.sh".
After finishing the CSR installation, you can verify that the installation
completed successfully
by running on any node the following command:
# cd /u01/app/oracle/product/10.1.0/CRS10gHome/bin
# olsnodes -n
oc1 1
oc2 2
oc3 3
You can install the database software into the same directory in each node.
With OCFS2, you might do one install in a common shared directory for all nodes.
Because CSR is already running, the OUI detects that, and because its cluster
aware, it
provides you with the options to install a clustered implementation.
You start the installation by running ./runInstaller as the oracle user on one
node.
For most part, it looks the same as a single-instance installation.
After the file location screen, that is source and destination, you will see this
screen:
---------------------------------------------------
| |
|Specify Hardware Cluster Installation Mode |
| |
| o Cluster installation mode |
| |
| Node name |
| --------------------------------------------- |
| | [] oc1 | |
| | [] oc2 | |
| | [] oc3 | |
| --------------------------------------------- |
| |
| o Local installation (non cluster) |
| |
|-------------------------------------------------|
Most of the time, you will do a "software only" installation, and create the
database later
with the DBCA.
For the first node only, after some time, the Virtual IP Configuration Assistant,
VIPCA, will start.
Here you can configure the Virtual IP adresses you will use for application
failover
and the Enterprise Manager Agent.
Here you will select the Virtual IP's for all nodes.
VIPCA only needs to run once per Cluster.
Launching the DBCA for installing a RAC database is much the same as launching
DBCA for a single instance.
If DBCA detects cluster software installed, it gives you the option to install a
RAC database
or a single instance.
as oracle user:
% dbca &
---------------------------------------------------
| |
|Welcome to the database configuration assistant |
| |
| |
| |
| o Oracle Real Application Cluster database |
| |
| o Oracle single instance database |
| |
|-------------------------------------------------|
After selecting RAC, the next screen gives you the option to select nodes:
---------------------------------------------------
| |
|Select the nodes on which you want to create |
|the cluster database. The local node oc1 will |
|always be used whether or not it is selected. |
| |
| Node name |
| --------------------------------------------- |
| | [] oc1 | |
| | [] oc2 | |
| | [] oc3 | |
| --------------------------------------------- |
| |
| |
|-------------------------------------------------|
In the next screens, you can choose the type of database (oltp, dw etc..), and all
other items, just like a single instance install.
At a cetain point, you can choose to use ASM diskgroups, flash-recovery area etc..
===========================================
Note 5. RAC tools an utilities.
===========================================
Suppose, using above example, that instance rac3 on node oc3, fails. Suppose that
you need to repair
the node (e.g. harddisk crash).
# cd /u01/app/oracle/product/10.1.0/CRS10gHome/bin
# ./olsnode -n
oc1 1
oc2 2
oc3 3
# cd ../install
# ./rootdeletenode.sh oc3,3
# cd ../bin
# ./olsnode -n
oc1 1
oc2 2
#
Suppose that you have repared host oc3. We now want to add it back into the
cluster.
Host oc3 has the OS newly installed, and its /etc/host file is just like it is on
the other nodes.
# ./addNode.sh
A graphical screen pops up, and you are able to add oc3 to the cluster.
Al CRS files are copied to the new node.
To start the services on the new node, you are then prompted to run
"rootaddnode.sh" on the active node
and "root.sh" on the new node.
# ./rootaddnode.sh
# ssh oc3
# cd /u01/app/oracle product/10.1.0/CRS10gHome
# ./root.sh
# lsnodes -v
# cd /u01/app/oracle/product/10.1.0/CRS10gHome/bin
# ./olsnodes -n
oc1 1
oc2 2
oc3 3
Example 3: using svrctl
-----------------------
srvctl must be run from the $ORACLE_HOME of the RAC you are administering.
The basic format of a srvctl command is
enable|disable|start|stop|relocate|status|add|remove|modify|getenv|setenv|
unsetenv|config
% svrctl -h
% svrctl command -h
% svrctl -V
-- Example 4. Stop the MYSID database: all its instances and all its services, on
all nodes.
The following command mounts all of the non-running instances, using the default
connection information:
-- Example 5. Stop the nodeapps on the myserver node. NB: Instances and services
also stop.
% srvctl stop nodeapps -n myserver
-- Example 6. Add the MYSID3 instance, which runs on the myserver node, to the
MYSID clustered database.
-- Example 8. To change the VIP (virtual IP) on a RAC node, use the command
-- Example 10. The following command and output show the expected configuration
for a three node
database called ORCL.
Debugging srvctl in 10g couldn't be easier. Simply set the SRVM_TRACE environment
variable.
% export SRVM_TRACE=true
A: just edit listener.ora on all concerned nodes and add entries ( the usual way).
srvctl will automatically make use of it.
For example
You can use SRVCTL to add, remove, enable, and disable an ASM instance as
described in the following procedure:
Use the following to add configuration information about an existing ASM instance:
% srvctl add asm -n node_name -i asm_instance_name -o oracle_home
The following command provides its own connection information to shut down the two
instances orcl3 and orcl4
using the IMMEDIATE option:
Clusterware can automatically start your RAC database when the system restarts.
You can use Automatic or Manual "policies", to control whether clusterware
restarts RAC.
-- Example 18.
-- More examples
Example 4: crsctl
-----------------
You can dynamically add and remove voting disks after installing Oracle RAC. Do
this using the following
commands where path is the fully qualified path for the additional voting disk.
Run the following command
as the root user to add a voting disk:
Run the following command as the root user to remove a voting disk:
Example 5: cluvfy
-----------------
For example, a script that verifies a cluster using cluvfy is named runcluvfy.sh
and is located on
the /clusterware/cluvfy directory in the installation area. This script unpacks
the utility, sets environment
variables and executes the verification command.
This command verifies that the hosts atlanta1, atlanta2 and atlanta3 are ready for
a clustered database
install of release 2.
The results of the command above check user and group equivalence across machines,
connectivity,
interface settings, system requirements like memory, disk space and kernel
settings and versions,
required Linux package existence and so on. Any problems are reported as errors,
all successful
checks are marked as passed.
Many other aspects of the cluster can be verified with this utility for Release 2
or Release 1.
Remember to use the full path name and the runcluvfy.bat command on the
installation media and include
the list of nodes in your cluster, separated by commas, for the node_list. The
following example is for
a system with two nodes, node1 and node2, and the installation media on drive F:
If you want to check the shared accessibility of a specific shared storage type to
specific nodes
in your cluster, then use the following command syntax:
In the preceding syntax, the variable node_list is the list of nodes you want to
check, separated by commas,
and the variable storageID_list is the list of storage device IDs for the storage
devices managed by the
file system type that you want to check.
=================================
Note 6: Example tnsnames.ora in RAC
=================================
Example 1:
----------
tnsnames.ora File
TEST =
(DESCRIPTION =
(LOAD_BALANCE = ON)
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = TCP)(HOST = testlinux1)(PORT = 1521))
(ADDRESS = (PROTOCOL = TCP)(HOST = testlinux2)(PORT = 1521)))
(CONNECT_DATA =
(SERVICE_NAME = TEST))))
TEST1 =
(DESCRIPTION =
(ADDRESS_LIST =
(LOAD_BALANCE = ON)
(ADDRESS = (PROTOCOL = TCP)(HOST = testlinux1)(PORT = 1521)))
(CONNECT_DATA =
(SERVICE_NAME = TEST)(INSTANCE_NAME = TEST1)))
TEST2 =
(DESCRIPTION =
(ADDRESS_LIST =
(LOAD_BALANCE = ON)
(ADDRESS = (PROTOCOL = TCP)(HOST = testlinux2)(PORT = 1521)))
(CONNECT_DATA =
(SERVICE_NAME = TEST)(INSTANCE_NAME = TEST2)))
EXTPROC_CONNECTION_DATA =
(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC)))
(CONNECT_DATA =
(SID=PLSExtProc)(PRESENTATION = RO)))
LISTENERS_TEST =
(ADDRESS = (PROTOCOL = TCP)(HOST = testlinux1)(PORT = 1521))
(ADDRESS = (PROTOCOL = TCP)(HOST = testlinux2)(PORT = 1521))
Example 2:
----------
Connect-Time Failover
From the clients end, when your connection fails at one node or service, you can
then do a look up
from your tnsnames.ora file and go on seeking a connection with the other
available node. Take this example
of our 4-node VMware ESX 3.x Oracle Linux Servers:
FOKERAC =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = nick01.wolga.com)(PORT = 1521))
(ADDRESS = (PROTOCOL = TCP)(HOST = nick02.wolga. com)(PORT = 1521))
(ADDRESS = (PROTOCOL = TCP)(HOST = brian01.wolga. com)(PORT = 1521))
(ADDRESS = (PROTOCOL = TCP)(HOST = brian02.wolga. com)(PORT = 1521))
(CONNECT_DATA =
(SERVICE_NAME = fokerac)
)
)
Here the first address in the list is tried at the client�s end. Should the
connection to nick01.wolga.nl fail,
then the next address, nick02.wolga.nl, will be tried. This phenomenon is called
connection-time failover.
You could very well have a 32-node RAC cluster monitoring the galactic system at
NASA and thus have all
those nodes typed in your tnsnames.ora file. Moreover, these entries do not
necessarily have to be part
of the RAC cluster. So it is possible that you are using Streams, Log Shipping or
Advanced Replication
to maintain your HA (High Availability) model. These technologies facilitate
continued processing of the
database by such a HA (High Availability) model in a non-RAC environment. In a RAC
environment we know
(and expect) the data to be the same across all nodes since there is only one
database.
Example 3:
----------
(CONNECT_DATA =
(SERVER = DEDICATED)
(SERVICE_NAME = fokerac.wolga.com)
(FAILOVER_MODE =
(TYPE = SELECT)
(METHOD = BASIC)
(RETRIES = 180)
(DELAY = 5)
)
)
==============================================
Note 7: Notes about Backup and Restore of RAC
==============================================
Run the following command to backup a voting disk. Perform this operation on every
voting disk
as needed where 'voting_disk_name' is the name of the active voting disk, and
'backup_file_name'
is the name of the file to which you want to backup the voting disk contents:
# dd if=voting_disk_name of=backup_file_name
When you use the dd command for making backups of the voting disk, the backup can
be performed while
the Cluster Ready Services (CRS) process is active; you do not need to stop the
crsd.bin process
before taking a backup of the voting disk.
Run the following command as the root user to remove a voting disk:
# dd if=backup_file_name of=voting_disk_name
Oracle Clusterware automatically creates OCR backups every 4 hours. At any one
time, Oracle Clusterware
always retains the latest 3 backup copies of the OCR that are 4 hours old, 1 day
old, and 1 week old.
You cannot customize the backup frequencies or the number of files that Oracle
Clusterware retains.
You can use any backup software to copy the automatically generated backup files
at least once daily
to a different device from where the primary OCR file resides. The default
location for generating backups
on Red Hat Linux systems is "CRS_home/cdata/cluster_name" where cluster_name is
the name of your cluster
and CRS_home is the home directory of your Oracle Clusterware installation.
In addition to using the automatically created OCR backup files, you should also
export the OCR contents
to a file before and after making significant configuration changes, such as
adding or deleting nodes
from your environment, modifying Oracle Clusterware resources, or creating a
database.
Exporting the OCR contents to a file lets you restore the OCR if your
configuration changes cause errors.
For example, if you have unresolvable configuration problems, or if you are unable
to restart your cluster database
after such changes, then you can restore your configuration by importing the saved
OCR content
from the valid configuration.
To export the contents of the OCR to a file, use the following command, where
backup_file_name is the name
of the OCR backup file you want to create:
In event of a failure, before you attempt to restore the OCR, ensure that the OCR
is unavailable.
Run the following command to check the status of the OCR:
# ocrcheck
If this command does not display the message 'Device/File integrity check
succeeded' for at least one copy
of the OCR, then both the primary OCR and the OCR mirror have failed. You must
restore the OCR from a backup.
-- Restoring the Oracle Cluster Registry from Automatically Generated OCR Backups
When restoring the OCR from automatically generated backups, you first have to
determine which backup file
you will use for the recovery.
To restore the OCR from an automatically generated backup on a Red Hat Linux
system:
# ocrconfig -showbackup
Note:
You must be logged in as the root user to run the ocrconfig command.
Review the contents of the backup using the following ocrdump command, where
file_name is the name
of the OCR backup file:
As the root user, stop Oracle Clusterware on all the nodes in your Oracle RAC
cluster by executing
the following command:
As the root user, restore the OCR by applying an OCR backup file that you
identified in step 1
using the following command, where file_name is the name of the OCR that you want
to restore.
Make sure that the OCR devices that you specify in the OCR configuration exist,
and that these OCR devices
are valid before running this command.
As the root user, restart Oracle Clusterware on all the nodes in your cluster by
restarting each node,
or by running the following command:
Use the Cluster Verify Utility (CVU) to verify the OCR integrity. Run the
following command,
where the -n all argument retrieves a list of all the cluster nodes that are
configured as part of your cluster:
To restore the previous configuration stored in the OCR from an OCR export file:
Place the OCR export file that you created previously with the ocrconfig -export
command in an accessible
directory on disk.
As the root user, stop Oracle Clusterware on all the nodes in your Oracle RAC
cluster by executing
the following command:
As the root user, restore the OCR data by importing the contents of the OCR export
file using the
following command, where file_name is the name of the OCR export file:
As the root user, restart Oracle Clusterware on all the nodes in your cluster by
restarting each node,
or by running the following command:
Use the CVU to verify the OCR integrity. Run the following command, where the -n
all argument retrieves
a list of all the cluster nodes that are configured as part of your cluster:
=================================
Note 8: Noticable items in 10g RAC
=================================
8.1 SPFILE:
-----------
*.OPEN_CURSORS=500
prod1.OPEN_CURSORS=1000
Note:
Note:
Before you shut down any processes that are monitored by Enterprise Manager Grid
Control, set a blackout in
Grid Control for the processes that you intend to shut down. This is necessary so
that the availability
records for these processes indicate that the shutdown was planned downtime,
rather than an unplanned system outage.
Shut down all Oracle RAC instances on all nodes. To shut down all Oracle RAC
instances for a database,
enter the following command, where db_name is the name of the database:
Shut down all ASM instances on all nodes. To shut down an ASM instance, enter the
following command,
where node is the name of the node where the ASM instance is running:
Stop all node applications on all nodes. To stop node applications running on a
node, enter the following command,
where node is the name of the node where the applications are running
Log in as the root user, and shut down the Oracle Clusterware or CRS process by
entering the following command
on all nodes:
Note:
Note:
If you shut down ASM instances, then you must first shut down all database
instances that use ASM,
even if these databases run from different Oracle homes.
Note:
Note:
Before you shut down any processes that are monitored by Enterprise Manager Grid
Control, set a blackout in
Grid Control for the processes that you intend to shut down. This is necessary so
that the availability records
for these processes indicate that the shutdown was planned downtime, rather than
an unplanned system outage.
Shut down all Oracle RAC instances on all nodes. To shut down all Oracle RAC
instances for a database,
enter the following command, where db_name is the name of the database:
Shut down all ASM instances on all nodes. To shut down an ASM instance, enter the
following command,
where node is the name of the node where the ASM instance is running:
Stop all node applications on all nodes. To stop node applications running on a
node, enter the following command,
where node is the name of the node where the applications are running
$ oracle_home/bin/srvctl stop nodeapps -n node
Log in as the root user, and shut down the Oracle Clusterware or CRS process by
entering the following command
on all nodes:
The CRSD manages the HA functionality by starting, stopping, and failing over the
application resources
and maintaining the profiles and current states in the Oracle Cluster Registry
(OCR) whereas the OCSSD
manages the participating nodes in the cluster by using the voting disk. The OCSSD
also protects against
the data corruption potentially caused by "split brain" syndrome by forcing a
machine to reboot.
>Linux:
# cat /etc/inittab
..
..
h1:35:respawn:/etc/init.d/init.evmd run > /dev/null 2>&1 </dev/null
h2:35:respawn:/etc/init.d/init.cssd fatal > /dev/null 2>&1 </dev/null
h3:35:respawn:/etc/init.d/init.crsd run > /dev/null 2>&1 </dev/null
correct order for stopping: Reverse order of startup. crsd should be shutdown
before
cssd and evmd. evmd should be shutdown before cssd.
init.crs stop:
init.crsd
init.evmd
init.cssd
init.crs start
init.cssd autostart|manualstart
-------------------------------------------
links:
http://dmx0201.nl.eu.abnamro.com:7900/wi
https://dmp0101.nl.eu.abnamro.com:1159/em
-------------------------------------------
============================
35. ORACLE STREAMS AND CDC:
============================
a)
http://www.oracle.com/gateways/
is the most complete. distributed query, distributed transactions -- 100%
functionality.
Lets you treat DB2 as if it were an Oracle instance for all intents and purposes.
b) generic connectivity. If you have ODBC on the SERVER (oracle server) and can
use that
to connect to DB2, you can use generic connectivity. Less functional then a)
http://asktom.oracle.com/pls/asktom/f?p=100:11:::::P11_QUESTION_ID:4406709207206
c) lastly, you can get their type4 (thin) jdbc (all java) drivers and load them
into
Oracle. Then, you can write a java stored procedure in Oracle that accesses DB2
over
jdbc.
-- Synchronous
-- Asynchronous
By taking advantage of the data sent to the redo log files, change data is
captured after a SQL statement
that performs a DML operation is committed. In this mode, change data is not
captured as part of the transaction
that is modifying the source table, and therefore has no effect on that
transaction.
Asynchronous Change Data Capture is available with Oracle Enterprise Edition only.
Asynchronous Change Data Capture is built on, and provides a relational interface
to, Oracle Streams.
See Oracle Streams Concepts and Administration for information on Oracle Streams.
- Change tables
With any CDC mode, change tables are involved.
A given change table contains the change data resulting from DML operations
performed on a
given source table. A change table consists of two things: the change data itself,
which is stored
in a database table, ; and the system metadata necessary to maintain the change
table,
which includes control columns.
The publisher specifies the source columns that are to be included in the change
table. Typically,
for a change table to contain useful data, the publisher needs to include the
primary key column
in the change table along with any other columns of interest to subscribers. For
example, suppose subscribers
are interested in changes that occur to the UNIT_COST and the UNIT_PRICE columns
in the sh.costs table.
If the publisher does not include the PROD_ID column in the change table,
subscribers will know only that
the unit cost and unit price of some products have changed, but will be unable to
determine for which products
these changes have occurred.
There are optional and required control columns. The required control columns are
always included
in a change table; the optional ones are included if specified by the publisher
when creating
the change table. Control columns are managed by Change Data Capture.
- Interface
Change Data Capture includes the DBMS_CDC_PUBLISH and DBMS_CDC_SUBSCRIBE packages,
which provide
easy-to-use publish and subscribe interfaces.
-- TASKS:
. Determines the source databases and tables from which the subscribers are
interested in viewing change data,
and the mode (synchronous or one of the asynchronous modes) in which to capture
the change data.
. Allows subscribers to have controlled access to the change data in the change
tables by using the
SQL GRANT and REVOKE statements to grant and revoke the SELECT privilege on
change tables for users
and roles. (Keep in mind, however, that subscribers use views, not change
tables directly, to access change data.)
The subscribers are consumers of the published change data. A subscriber performs
the following tasks:
. Create subscriptions
A subscription controls access to the change data from one or more source
tables of interest
within a single change set. A subscription contains one or more subscriber
views.
A subscriber view is a view that specifies the change data from a specific
publication in a subscription. The subscriber is restricted to seeing change data
that the publisher has published and has granted the subscriber access to use. See
"Subscribing to Change Data" for more information on choosing a method for
specifying a subscriber view.
. Notify Change Data Capture when ready to receive a set of change data
A subscription window defines the time range of rows in a publication that the
subscriber can currently
see in subscriber views. The oldest row in the window is called the low
boundary; the newest row
in the window is called the high boundary. Each subscription has its own
subscription window that applies
to all of its subscriber views.
. Notify Change Data Capture when finished with a set of change data
> Uses SELECT statements to retrieve change data from the subscriber views.
-- Other items:
Source Database
MODE CHANGE SOURCE Represented Associated Change Set
----------------------------------------------------------------------------------
-------------------
Synchronous Predefined SYNC_SOURCE Local Predefined
SYNC_SET and publisher-defined
Async Distr
HotLog Publisher-defined Remote Publisher-
defined. Change sets must all be
on the same staging database
Async AutoLog
online Publisher-defined Remote Publisher-
defined. There can only be one
change set in an AutoLog
online change source
Asynchronous
AutoLog archive Publisher-defined Remote Publisher-defined
USER_SUBSCRIBED_TABLES Describes the source tables to which the current user has
subscribed.
Asynchronous Change Data Capture uses an Oracle Streams configuration for each
change set.
This Streams configuration consists of a Streams capture process and a Streams
apply process,
with an accompanying queue and queue table. Each Streams configuration uses
additional processes,
parallel execution servers, and memory. For details about the Streams
architecture, see
Oracle Streams Concepts and Administration.
Oracle Streams capture and apply processes each have a parallelism parameter that
is used to improve performance.
When a publisher first creates a change set, its capture parallelism value and
apply parallelism value are each 1.
If desired, a publisher can increase one or both of these values using Streams
interfaces.
If Oracle Streams capture parallelism and apply parallelism values are increased
after change sets
are created, the DBA (or DBAs in the case of the Distributed HotLog mode) must
adjust
initialization parameter values accordingly. How these adjustments are made vary
slightly, depending on the
mode of Change Data Capture being employed, as described in the following
sections.
Examples below demonstrate how to obtain the current capture parallelism and apply
parallelism values
for change set CHICAGO_DAILY. By default, each parallelism value is 1, so the
amount by which a
given parallelism value has been increased is the returned value minus 1.
Example 1 Obtaining the Oracle Streams Capture Parallelism Value for a Change Set
Example 2 Obtaining the Oracle Streams Apply Parallelism Value for a Change Set
The staging database DBA must adjust the staging database initialization
parameters as described
in the following list to accommodate the parallel execution servers and other
processes and memory
required for Change Data Capture:
PARALLEL_MAX_SERVERS
For each change set for which Oracle Streams capture or apply parallelism values
were increased,
increase the value of this parameter by the increased Streams parallelism value.
For example, if the statement in Example 1 returns a value of 2, and the statement
in Example 2 returns
a value of 3, then the staging database DBA should increase the value of the
PARALLEL_MAX_SERVERS
parameter by (2-1) + (3-1), or 3 for the CHICAGO_DAILY change set. If the Streams
capture or apply parallelism
values have increased for other change sets, increases for those change sets must
also be made.
PROCESSES
For each change set for which Oracle Streams capture or apply parallelism values
were changed, increase
the value of this parameter by the sum of increased Streams parallelism values.
See the previous
list item, PARALLEL_MAX_SERVERS, for an example.
STREAMS_POOL_SIZE
For each change set for which Oracle Streams capture or apply parallelism values
were changed,
increase the value of this parameter by
(10MB * (the increased capture parallelism value)) + (1MB * increased apply
parallelism value).
For example, if the statement in Example 1 returns a value of 2, and the statement
in Example 2 returns
a value of 3, then the staging database DBA should increase the value of the
STREAMS_POOL_SIZE parameter by
(10 MB * (2-1) + 1MB * (3-1)), or 12MB for the CHICAGO_DAILY change set. If the
Oracle Streams capture or
apply parallelism values have increased for other change sets, increases for those
change sets must also be made.
See Oracle Streams Concepts and Administration for more information on Streams
capture parallelism
and apply parallelism values. See Oracle Database Reference for more information
about
database initialization parameters.
conn / as sysdba
-- *NIX only
define _editor=vi
/*
JOB_QUEUE_PROCESSES (current value) + 2
PARALLEL_MAX_SERVERS (current value) + (5 * (the number of change sets planned))
PROCESSES (current value) + (7 * (the number of change sets planned))
SESSIONS (current value) + (2 * (the number of change sets planned))
*/
shutdown immediate;
startup mount;
-- important
alter database force logging;
-- validate archivelogging
archive log list
SELECT force_logging
FROM dba_tablespaces;
desc dba_hist_streams_apply_sum
desc cdc_system$
SELECT *
FROM dba_streams_administrator;
-- system privs
GRANT create session TO cdcadmin;
GRANT create table TO cdcadmin;
GRANT create sequence TO cdcadmin;
GRANT create procedure TO cdcadmin;
GRANT dba TO cdcadmin;
-- role privs
GRANT execute_catalog_role TO cdcadmin;
GRANT select_catalog_role TO cdcadmin;
-- object privileges
GRANT execute ON dbms_cdc_publish TO cdcadmin;
GRANT execute ON dbms_cdc_subscribe TO cdcadmin; -- do also to HR
SELECT *
FROM dba_sys_privs
WHERE grantee = 'CDCADMIN';
SELECT username
FROM dba_users u, streams$_privileged_user s
WHERE u.user_id = s.user#;
SELECT *
FROM dba_streams_administrator;
connect hr/hr
desc employees
SELECT *
FROM employees;
SELECT table_name
FROM user_tables;
desc dba_capture_prepared_tables
dbms_capture_adm.prepare_table_instantiation(
table_name IN VARCHAR2,
supplemental_logging IN VARCHAR2 DEFAULT 'keys');
Note: This procedure performs the synchronization necessary for instantiating the
table at another database.
This procedure records the lowest SCN of the table for instantiation. SCNs
subsequent to the lowest SCN for an object
can be used for instantiating the object.
exec dbms_capture_adm.prepare_table_instantiation('HR.CDC_DEMO');
dbms_cdc_publish.create_change_set(
change_set_name IN VARCHAR2,
description IN VARCHAR2 DEFAULT NULL,
change_source_name IN VARCHAR2,
stop_on_ddl IN CHAR DEFAULT 'N',
begin_date IN DATE DEFAULT NULL,
end_date IN DATE DEFAULT NULL);
conn / as sysdba
desc cdc_change_sets$
dbms_cdc_publish.create_change_table(
owner IN VARCHAR2,
change_table_name IN VARCHAR2,
change_set_name IN VARCHAR2,
source_schema IN VARCHAR2,
source_table IN VARCHAR2,
column_type_list IN VARCHAR2,
capture_values IN VARCHAR2, -- BOTH, NEW, OLD
rs_id IN CHAR,
row_id IN CHAR,
user_id IN CHAR,
timestamp IN CHAR,
object_id IN CHAR,
source_colmap IN CHAR,
target_colmap IN CHAR,
options_string IN VARCHAR2);
BEGIN
dbms_cdc_publish.create_change_table('CDCADMIN', 'CDC_DEMO_CT', 'CDC_DEMO_SET',
'HR', 'CDC_DEMO',
'EMPLOYEE_ID NUMBER(6), FIRST_NAME VARCHAR2(20), LAST_NAME VARCHAR2(25), SALARY
NUMBER',
'BOTH', 'Y', 'Y', 'Y', 'N', 'N', 'Y', 'Y', ' TABLESPACE USERS pctfree 0 pctused
99');
END;
/
conn / as sysdba
desc cdc_change_tables$
conn cdcadmin/cdcadmin
Create Subscription
conn hr/hr
dbms_cdc_subscribe.create_subscription(
change_set_name IN VARCHAR2,
description IN VARCHAR2,
subscription_name IN VARCHAR2);
conn / as sysdba
dbms_cdc_subscribe.subscribe(
subscription_name IN VARCHAR2,
source_schema IN VARCHAR2,
source_table IN VARCHAR2,
column_list IN VARCHAR2,
subscriber_view IN VARCHAR2);
BEGIN
dbms_cdc_subscribe.subscribe('CDC_DEMO_SUB', 'HR', 'CDC_DEMO',
'EMPLOYEE_ID, FIRST_NAME, LAST_NAME, SALARY', 'CDC_DEMO_SUB_VIEW');
END;
/
desc user_subscriptions
dbms_cdc_subscribe.activate_subscription(
subscription_name IN VARCHAR2);
exec dbms_cdc_subscribe.activate_subscription('CDC_DEMO_SUB');
percent NUMBER;
BEGIN
--Step 1 Get the change (extend the window).
dbms_cdc_subscribe.extend_window('CDC_DEMO_SUB');
desc dba_hist_streams_apply_sum
SELECT *
FROM salary_history;
UPDATE cdc_demo
SET salary = salary+1
WHERE employee_id = 100;
COMMIT;
SELECT employee_id,first_name,last_name,salary
FROM cdc_demo_sub_view;
exec update_salary_history;
SELECT employee_id,first_name,last_name,salary
FROM cdc_demo_sub_view;
SELECT *
FROM salary_history;
-- Capture Cleanup
conn hr/hr
exec dbms_cdc_subscribe.drop_subscription('CDC_DEMO_SUB');
conn / as sysdba
conn hr/hr
conn / as sysdba
conn / as sysdba
-- *NIX only
define _editor=vi
/*
JOB_QUEUE_PROCESSES (current value) + 2
PARALLEL_MAX_SERVERS (current value) + (5 * (the number of change sets planned))
PROCESSES (current value) + (7 * (the number of change sets planned))
SESSIONS (current value) + (2 * (the number of change sets planned))
*/
shutdown immediate;
startup mount;
alter database archivelog;
-- important
alter database force logging;
-- validate archivelogging
archive log list
SELECT force_logging
FROM dba_tablespaces;
desc dba_hist_streams_apply_sum
desc cdc_system$
SELECT * FROM cdc_system$;
SELECT *
FROM dba_streams_administrator;
-- system privs
GRANT create session TO cdcadmin;
GRANT create table TO cdcadmin;
GRANT create sequence TO cdcadmin;
GRANT create procedure TO cdcadmin;
GRANT dba TO cdcadmin;
-- role privs
GRANT execute_catalog_role TO cdcadmin;
GRANT select_catalog_role TO cdcadmin;
-- object privileges
GRANT execute ON dbms_cdc_publish TO cdcadmin;
GRANT execute ON dbms_cdc_subscribe TO cdcadmin;
-- required for this demo but not by CDC
GRANT execute ON dbms_lock TO cdcadmin;
SELECT *
FROM dba_sys_privs
WHERE grantee = 'CDCADMIN';
SELECT username
FROM dba_users u, streams$_privileged_user s
WHERE u.user_id = s.user#;
SELECT *
FROM dba_streams_administrator;
desc employees
SELECT *
FROM employees;
SELECT table_name
FROM user_tables;
desc dba_capture_prepared_tables
dbms_capture_adm.prepare_table_instantiation(
table_name IN VARCHAR2,
supplemental_logging IN VARCHAR2 DEFAULT 'keys');
Note: This procedure performs the synchronization necessary for instantiating the
table at another database.
This procedure records the lowest SCN of the table for instantiation. SCNs
subsequent to the lowest SCN for an object
can be used for instantiating the object.
dbms_cdc_publish.create_change_set(
change_set_name IN VARCHAR2,
description IN VARCHAR2 DEFAULT NULL,
change_source_name IN VARCHAR2,
stop_on_ddl IN CHAR DEFAULT 'N',
begin_date IN DATE DEFAULT NULL,
end_date IN DATE DEFAULT NULL);
-- here is why
SELECT object_name, object_type
FROM user_objects
ORDER BY 2,1;
conn / as sysdba
desc cdc_change_sets$
dbms_cdc_publish.create_change_table(
owner IN VARCHAR2,
change_table_name IN VARCHAR2,
change_set_name IN VARCHAR2,
source_schema IN VARCHAR2,
source_table IN VARCHAR2,
column_type_list IN VARCHAR2,
capture_values IN VARCHAR2, -- BOTH, NEW, OLD
rs_id IN CHAR,
row_id IN CHAR,
user_id IN CHAR,
timestamp IN CHAR,
object_id IN CHAR,
source_colmap IN CHAR,
target_colmap IN CHAR,
options_string IN VARCHAR2);
BEGIN
dbms_cdc_publish.create_change_table('CDCADMIN', 'CDC_DEMO_CT', 'CDC_DEMO_SET',
'HR', 'CDC_DEMO',
'EMPLOYEE_ID NUMBER(6), FIRST_NAME VARCHAR2(20), LAST_NAME VARCHAR2(25), EMAIL
VARCHAR2(25),
PHONE_NUMBER VARCHAR2(20), HIRE_DATE DATE, JOB_ID VARCHAR2(10), SALARY NUMBER,
COMMISSION_PCT NUMBER,
MANAGER_ID NUMBER, DEPARTMENT_ID NUMBER', 'BOTH', 'N', 'N', 'N', 'N', 'N', 'N',
'Y', NULL);
END;
/
conn / as sysdba
desc cdc_change_tables$
Enable Capture
conn / as sysdba
conn cdcadmin/cdcadmin
dbms_cdc_publish.alter_change_set(
change_set_name IN VARCHAR2,
description IN VARCHAR2 DEFAULT NULL,
remove_description IN CHAR DEFAULT 'N',
enable_capture IN CHAR DEFAULT NULL,
recover_after_error IN CHAR DEFAULT NULL,
remove_ddl IN CHAR DEFAULT NULL,
stop_on_ddl IN CHAR DEFAULT NULL);
exec dbms_cdc_publish.alter_change_set(change_set_name=>'CDC_DEMO_SET',
enable_capture=> 'Y');
conn / as sysdba
Create Subscription
conn hr/hr
dbms_cdc_subscribe.create_subscription(
change_set_name IN VARCHAR2,
description IN VARCHAR2,
subscription_name IN VARCHAR2);
conn / as sysdba
dbms_cdc_subscribe.subscribe(
subscription_name IN VARCHAR2,
source_schema IN VARCHAR2,
source_table IN VARCHAR2,
column_list IN VARCHAR2,
subscriber_view IN VARCHAR2);
BEGIN
dbms_cdc_subscribe.subscribe('CDC_DEMO_SUB', 'HR', 'CDC_DEMO',
'EMPLOYEE_ID, FIRST_NAME, LAST_NAME, EMAIL, PHONE_NUMBER, HIRE_DATE, JOB_ID,
SALARY,
COMMISSION_PCT, MANAGER_ID, DEPARTMENT_ID',
'CDC_DEMO_SUB_VIEW');
END;
/
desc user_subscriptions
dbms_cdc_subscribe.activate_subscription(
subscription_name IN VARCHAR2);
exec dbms_cdc_subscribe.activate_subscription('CDC_DEMO_SUB');
CURSOR cur IS
SELECT *
FROM (
SELECT 'I' opt, cscn$, rsid$, employee_id, job_id, department_id, 0 old_salary,
salary new_salary, commit_timestamp$
FROM cdc_demo_sub_view
WHERE operation$ = 'I '
UNION ALL
SELECT 'D' opt, cscn$, rsid$, employee_id, job_id, department_id, salary
old_salary,
0 new_salary, commit_timestamp$
FROM cdc_demo_sub_view
WHERE operation$ = 'D '
UNION ALL
SELECT 'U' opt , v1.cscn$, v1.rsid$, v1.employee_id, v1.job_id,
v1.department_id,
v1.salary old_salary, v2.salary new_salaryi, v1.commit_timestamp$
FROM cdc_demo_sub_view v1, cdc_demo_sub_view v2
WHERE v1.operation$ = 'UO' and v2.operation$ = 'UN'
AND v1.cscn$ = v2.cscn$
AND v1.rsid$ = v2.rsid$
AND ABS(v1.salary - v2.salary) > 0)
ORDER BY cscn$, rsid$;
percent NUMBER;
BEGIN
-- Get the next set of changes to the HR.CDC_DEMO source table
dbms_cdc_subscribe.extend_window('CDC_DEMO_SUB');
conn cdcadmin/cdcadmin
dbms_lock.sleep(sleep_time);
slept := slept+sleep_time;
END LOOP;
-- additional wait time for changes to become available to subscriber view
dbms_lock.sleep(60);
RETURN return_msg;
END wait_for_changes;
/
COMMIT;
Validate Capture
-- Expecting 94 rows to appear in the change table CDCADMIN.CDC_DEMO_CT. This
first
-- capture may take a few minutes. Later captures should be substantially faster.
conn cdcadmin/cdcadmin
Another Test
conn hr/hr
/* The wait_for_changes function having indicated the changes have been populated
apply the changes
to the salary_history table */
exec update_salary_history;
conn hr/hr
exec update_salary_history
Capture Cleanup
conn hr/hr
exec dbms_cdc_subscribe.drop_subscription('CDC_DEMO_SUB');
conn / as sysdba
conn cdcadmin/cdcadmin
SELECT COUNT(*)
FROM user_objects;
conn hr/hr
conn / as sysdba
-- Connect up as scott
conn scott/tiger
-- Create Table
CREATE TABLE scott.classes
(
class_id NUMBER,
class_title VARCHAR2(30),
class_instructor VARCHAR2(30),
class_term_code VARCHAR2(6),
class_credits NUMBER,
CONSTRAINT PK_classes PRIMARY KEY (class_id )
);
commit;
execute dbms_logmnr_cdc_subscribe.get_subscription_handle -
(CHANGE_SET => 'SYNC_SET', -
DESCRIPTION => 'Changes to classes table', -
SUBSCRIPTION_HANDLE => :subhandle);
execute dbms_logmnr_cdc_subscribe.subscribe -
(subscription_handle => :subhandle, -
source_schema => 'scott', -
source_table => 'classes', -
column_list => 'class_id, class_title, class_instructor, class_term_code,
class_credits');
execute dbms_logmnr_cdc_subscribe.activate_subscription -
(SUBSCRIPTION_HANDLE => :subhandle);
commit;
execute dbms_logmnr_cdc_subscribe.extend_window -
(subscription_handle => :subhandle);
execute dbms_logmnr_cdc_subscribe.prepare_subscriber_view -
(SUBSCRIPTION_HANDLE => :subhandle, -
SOURCE_SCHEMA => 'scott', -
SOURCE_TABLE => 'classes', -
VIEW_NAME => :viewname);
print viewname
-- This little trick will move the bind variable :viewname into the
-- substitution variable named subscribed_view
COLUMN myview new_value subscribed_view noprint
SELECT :viewname myview FROM dual;
-- Examine the actual change data. You could also look at the table in a
-- browser such as TOAD for easier viewing.
SELECT * FROM &subscribed_view;
Note 6:
=======
DBMS_CDC_PUBLISH:
Change Data Capture captures and publishes only committed data. Oracle Change Data
Capture identifies
new data that has been added to, updated in, or removed from relational tables,
and publishes the change data
in a form that is usable by subscribers.
Typically, a Change Data Capture system has one publisher who captures and
publishes changes for any number
of Oracle relational source tables. The publisher then provides subscribers
(applications or individuals)
with access to the published data.
Note 7:
=======
The publisher user creates one or more change tables for each source table to be
published,
specifies which columns should be included, and specifies the combination of
before and after images
of the change data to capture.
To have more control over the physical properties and tablespace properties of the
change tables,
the publisher can set the options_string field of the
dbms_cdc_publish.create_change_table procedure.
The options_string field can contain any option available on the CREATE TABLE
statement.
The following script creates a change table on the staging database that captures
changes made to
a source table in the source database. The example uses the sample table
pl.project_history.
BEGIN
DBMS_CDC_PUBLISH.CREATE_CHANGE_TABLE(
owner => 'cdcproj',
change_table_name => 'PROJ_HIST_CT',
change_set_name => 'PROJECT_DAILY',
source_schema => 'PL',
source_table => 'PROJ_HISTORY',
column_type_list => 'EMPLOYEE_ID NUMBER(6),START_DATE DATE, END_DATE DATE,
PROJ_ID VARCHAR2(10), DEPARTMENT_ID NUMBER(4)',
capture_values => 'both',
rs_id => 'y',
row_id => 'n',
user_id => 'n',
timestamp => 'n',
object_id => 'n',
source_colmap => 'n',
target_colmap => 'y',
options_string => NULL);
END;
/
This example statement creates a change table named proj_hist_ct, within change
set project_daily.
The column_type_list parameter is used to identify the columns captured by the
change table.
Remember that the source_schema and source_table parameters identify the schema
and source table
that reside in the source database, not the staging database.
Note 8: Example using streams (1)
=================================
http://blogs.ittoolbox.com/oracle/guide/archives/oracle-streams-configuration-
change-data-capture-13501
I have been playing with Oracle Streams again lately. My goal is to capture
changes in 10g and send them
to a 9i database.
Below is the short list for setting up Change Data Capture using Oracle Streams.
These steps are mostly
from the docs with a few tweaks I have added. This entry only covers setting up
the local capture and apply.
I'll add the propagation to 9i later this week or next weekend.
First the set up: we will use the HR account's Employee table. We'll capture all
changes to the Employee table
and insert them into an audit table. I'm not necessarily saying this is the way
you should audit your
database but it makes a nice example.
I'll also add a monitoring piece to capture process. I want to be able to see
exactly what is being captured
when it is being captured.
You will need to have sysdba access to follow along with me. Your database must
also be in archivelog mode.
The changes are picked up from the redo log.
The first step is to create out streams administrator. I will follow the
guidelines from the oracle docs
exactly for this:
- Connect as sysdba:
sqlplus / as sysdba
- Create the streams tablespace (change the name and/or location to suit):
I haven't quite figured out why, but we need to grant our administrator DBA privs.
I think this is a bad thing.
There is probably a work around where I could do some direct grants instead but I
haven't had time
to track those down.
BEGIN
SYS.DBMS_STREAMS_AUTH.GRANT_ADMIN_PRIVILEGE(
grantee => 'strmadmin',
grant_privileges => true);
END;
/
conn hr/hr
- We also need to create the employee_audit table. Note that I am adding three
columns in this table
that do not exist in the employee table.
- Grant all access to the audit table to the streams admin user:
conn strmadmin/strmadmin
We can create a logging table. You would NOT want to do this in a high-volume
production system. I am doing this
to illustrate user defined monitoring and show how you can get inside the capture
process.
Unlike AQ, where you have to create a separate table, this step creates the queue
and the underlying ANYDATA table.
BEGIN
DBMS_STREAMS_ADM.SET_UP_QUEUE(
queue_table => 'strmadmin.streams_queue_table',
queue_name => 'strmadmin.streams_queue');
END;
/
- This just defines that we want to capture DML and not DDL.
BEGIN
DBMS_STREAMS_ADM.ADD_TABLE_RULES(
table_name => 'hr.employee',
streams_type => 'capture',
streams_name => 'capture_emp',
queue_name => 'strmadmin.streams_queue',
include_dml => true,
include_ddl => false,
inclusion_rule => true);
END;
/
- Tell the capture process that we want to know who made the change:
BEGIN
DBMS_CAPTURE_ADM.INCLUDE_EXTRA_ATTRIBUTE(
capture_name => 'capture_emp',
attribute_name => 'username',
include => true);
END;
/
- We also need to tell Oracle where to start our capture. Change the
source_database_name to match your database.
DECLARE
iscn NUMBER; -- Variable to hold instantiation SCN value
BEGIN
iscn := DBMS_FLASHBACK.GET_SYSTEM_CHANGE_NUMBER();
DBMS_APPLY_ADM.SET_TABLE_INSTANTIATION_SCN(
source_object_name => 'hr.employee',
source_database_name => 'test10g',
instantiation_scn => iscn);
END;
/
DBMS_FLASHBACK.GET_SYSTEM_CHANGE_NUMBER()
-----------------------------------------
8854917
And the fun part! This is where we define our capture procedure. I'm taking this
right from the docs
but I'm adding a couple steps.
BEGIN
-- Access the LCR
rc := in_any.GETOBJECT(lcr);
-- Get the object command type
command := lcr.GET_COMMAND_TYPE();
-- I am inserting the XML equivalent of the LCR into the monitoring table.
insert into streams_monitor (txt_msg) values (command ||
DBMS_STREAMS.CONVERT_LCR_TO_XML(in_any) );
-- Set the new values to the old values for update and delete
IF command IN ('DELETE', 'UPDATE') THEN
-- Get the old values in the row LCR
old_values := lcr.GET_VALUES('old');
-- Set the old values in the row LCR to the new values in the row LCR
lcr.SET_VALUES('new', old_values);
-- Set the old values in the row LCR to NULL
lcr.SET_VALUES('old', NULL);
END IF;
BEGIN
DBMS_APPLY_ADM.SET_DML_HANDLER(
object_name => 'hr.employee',
object_type => 'TABLE',
operation_name => 'UPDATE',
error_handler => false,
user_procedure => 'strmadmin.emp_dml_handler',
apply_database_link => NULL,
apply_name => NULL);
END;
/
BEGIN
DBMS_APPLY_ADM.SET_DML_HANDLER(
object_name => 'hr.employee',
object_type => 'TABLE',
operation_name => 'DELETE',
error_handler => false,
user_procedure => 'strmadmin.emp_dml_handler',
apply_database_link => NULL,
apply_name => NULL);
END;
/
This tells streams, yet again, that we in fact do want to capture changes. The
second calls tells streams
where to put the info. Change the source_database_name to match your database.
DECLARE
emp_rule_name_dml VARCHAR2(30);
emp_rule_name_ddl VARCHAR2(30);
BEGIN
DBMS_STREAMS_ADM.ADD_TABLE_RULES(
table_name => 'hr.employee',
streams_type => 'apply',
streams_name => 'apply_emp',
queue_name => 'strmadmin.streams_queue',
include_dml => true,
include_ddl => false,
source_database => 'test10g',
dml_rule_name => emp_rule_name_dml,
ddl_rule_name => emp_rule_name_ddl);
DBMS_APPLY_ADM.SET_ENQUEUE_DESTINATION(
rule_name => emp_rule_name_dml,
destination_queue_name => 'strmadmin.streams_queue');
END;
/
BEGIN
DBMS_APPLY_ADM.SET_PARAMETER(
apply_name => 'apply_emp',
parameter => 'disable_on_error',
value => 'n');
END;
/
BEGIN
DBMS_APPLY_ADM.START_APPLY(
apply_name => 'apply_emp');
END;
/
BEGIN
DBMS_CAPTURE_ADM.START_CAPTURE(
capture_name => 'capture_emp');
END;
/
sqlplus hr/hr
UPDATE hr.employee
SET salary=5999
WHERE employee_id=206;
COMMIT;
It takes a few seconds for the data to make it to the logs and then back into the
system to be appled.
Run this query until you see data (remembering that it is not instantaneous):
Then you can log back into the streams admin account:
sqlplus strmadmin/strmadmin
View the XML LCR that we inserted during the capture process:
That's it! It's really not that much work to capture and apply changes. Of course,
it's a little bit
more work to cross database instances, but it's not that much.
Keep an eye out for a future entry where I do just that.
One of the things that amazes me is how little code is required to accomplish
this. The less code I have to write,
the less code I have to maintain.
Thank care,
LewisC
The entry builds directly on my last entry, Oracle Streams Configuration: Change
Data Capture.
This entry will show you how to propagate the changes you captured in that entry
to a 9i database.
NOTE #1: I would recommend that you run the commands and make sure the last entry
works for you
before trying the code in this entry. That way you will need to debug as few
moving parts as possible.
NOTE #2: I have run this code windows to windows, windows to linux, linux to
solaris and solaris to solaris.
The only time I had any problem at all was solaris to solaris. If you run into
problems with propagation
running but not sending data, shutdown the source database and restart it. That
worked for me.
NOTE #3: I have run this code 10g to 10g and 10g to 9i. It works without change
between them.
NOTE #4: If you are not sure of the exact name of your database (including
domain), use global_name,
i.e. select * from global_name;
NOTE #5: Streams is not available with XE. Download and install EE. If you have 1
GB or more of RAM on your PC,
you can download EE and use the DBCA to run two database instances. You do not
physically need two machines
to get this to work.
NOTE #6: I promise this is the last note. Merry Christmas and/or Happy Holidays!
As I mentioned above, you need two instances for this. I called my first instance
ORCL (how creative!)
and I called my second instance SECOND. It works for me!
ORCL will be my source instance and SECOND will be my target instance. You should
already have the CDC code
from the last article running in ORCL.
ORCL must be in archivelog mode to run CDC. SECOND does not need archivelog mode.
Having two databases
running on a single PC in archivelog mode can really beat up a poor IDE drive.
You already created your streams admin user in ORCL so now do the same thing in
SECOND. The code below is mostly
the same code that you ran on ORCL. I made a few minor changes in case you are
running both instances on a single PC:
sqlplus / as sysdba
create tablespace streams_second_tbs datafile 'c:\temp\stream_2_tbs.dbf' size 25M
reuse autoextend on maxsize unlimited;
Connect as strmadmin. You need to create an AQ table, AQ queue and then start the
queue.
That's what the code below does.
BEGIN
DBMS_AQADM.CREATE_QUEUE_TABLE(
queue_table => 'lrc_emp_t',
queue_payload_type => 'sys.anydata',
multiple_consumers => TRUE,
compatible => '8.1');
DBMS_AQADM.CREATE_QUEUE(
queue_name => 'lrc_emp_q',
queue_table => 'lrc_emp_t');
DBMS_AQADM.START_QUEUE (
queue_name => 'lrc_emp_q');
END;
/
You also need to create a database link. You have to have one from ORCL to SECOND
but for debugging,
I like a link in both. So, while you're in SECOND, create a link:
Log into ORCL as strmadmin and run the exact same command there. Most of the setup
for this is exactly
the same between the two instances.
Ok, now we have running queues in ORCL and SECOND. While you are logged into ORCL,
you will create a propagation
schedule. You DO NOT need to run this in SECOND.
BEGIN
DBMS_STREAMS_ADM.ADD_TABLE_PROPAGATION_RULES(
table_name => 'hr.employees',
streams_name => 'orcl_2_second',
source_queue_name => 'strmadmin.lrc_emp_q',
destination_queue_name => '[email protected]',
include_dml => true,
include_ddl => FALSE,
source_database => 'orcl.world');
END;
/
This tells the database to take the data in the local lrc_emp_q and send it to the
named destination queue.
We're almost done with the propagation now. We just need to change the code we
wrote in the last article
in our DML handler. Go back and review that code now.
We are going to modify the EMP_DML_HANDLER so that we get an enqueue block just
above the execute statement:
DECLARE
enqueue_options DBMS_AQ.enqueue_options_t;
message_properties DBMS_AQ.message_properties_t;
message_handle RAW(16);
recipients DBMS_AQ.aq$_recipient_list_t;
BEGIN
recipients(1) := sys.aq$_agent(
'anydata_subscriber',
'[email protected]',
NULL);
message_properties.recipient_list := recipients;
DBMS_AQ.ENQUEUE(
queue_name => 'strmadmin.lrc_emp_q',
enqueue_options => enqueue_options,
message_properties => message_properties,
payload => anydata.convertObject(lcr),
msgid => message_handle);
EXCEPTION
WHEN OTHERS THEN
insert into streams_monitor (txt_msg)
values ('Anydata: ' || DBMS_UTILITY.FORMAT_ERROR_STACK );
END;
The declaration section above created some variable required for an enqueue. We
created a subscriber
(that's the name of the consumer). We will use that name to dequeue the record in
the SECOND instance.
I put the exception handler there in case there are any problems with our enqueue.
That's all it takes. Insert some records into the HR.employees table and commit
them.
Then log into strmadmin@second and select * from the lrc_emp_t table. You should
have as many records
there as you inserted.
There are not a lot of moving parts so there aren't many things that will go
wrong. Propagation is where
I have the most troubles. You can query DBA_PROPAGATION to see if you have any
propagation errors.
That's it for moving the data from 10g to 9i. In my next article, I will show you
how to dequeue
the data and put it into the employee_audit table on the SECOND side.
A change table is required for each source table. The publisher uses the procedure
This procedure adds columns to, or drops columns from, an existing change table.
EXECUTE sys.DBMS_CDC_SUBSCRIBE.DROP_SUBSCRIBER_VIEW( \
SUBSCRIPTION_HANDLE =>:subhandle, \
SOURCE_SCHEMA =>'scott', \
SOURCE_TABLE => 'emp');
You Asked
I am looking for specific example of setting up streams for bi-directional schema
level
replication. What are your thoughts on using Oracle Streams to implement active-
active
configuration of databases for high availability?
Thanks,
Pratap
and we said...
replication is for replication.
I would not consider replication for HA in any circumstance. Data Guard is the
feature
you are looking for.
Thanks
Anandhi
the problem is you have to design your entire system from day 1 to be replicated
since when you
"failover" (lose the ability to connect to db1) there will be QUEUED transactions
that have not yet
taken place on db2 (eg: your users will say "hey, I know i did that already and do
it all over
again") when db1 "recovers" it'll push its transactions and db2 will push its
transactions. bamm
-- update conflicts.
they are not to be confused - you cannot replicate 3rd party applications like
Oracle Apps, people
soft, SAP, etc. You cannot replication most custom developed applications without
major
design/coding efforts.
and yes, when failover is to take place, you want a human deciding that. failover
is something
that happens in minutes, it is in response to a disaster (hence the name DR). It
is a fire, an
unrecoverable situation. You do not want to failover because a system blue
screened (wait for it
to reboot). You do not want to failover some people but not others (as would
happen with db1, db2
and siteA, siteB if siteA cannot route to db1 but can route to db2 but siteB can
still route to db1
- bummer, now you have transactions taking place on BOTH and unless you designed
the systems to be
"replicatable" you are in a hole world of hurt)
DR is something you want a human to be involved in. They need to pull the
trigger.
Hi Tom,
can you please provide a classification of streams and change data capture.
I guess the main difference is that streams covers event capture, transport
(transformation) and
consumption. CDC only the capture.
But if you consider only event capture, are there technical differences between
streams and change
data capture? What was the main reason to made CDC as a separate product?
thx
Jaromir
http://www.db-nemec.com
Hi Tom,
Is Oracle advanced queuing(AQ) is renamed as Oracle Stream in 10g?
Thanks
Table created.
1 row created.
SQL>
SQL> insert into t values ( sys.anyData.convertDate(sysdate) );
1 row created.
SQL>
SQL> insert into t values ( sys.anyData.convertVarchar2('hello world') );
1 row created.
SQL> commit;
Commit complete.
TYPENAME
--------------------------------------------------------------------------------
SYS.NUMBER
SYS.DATE
SYS.VARCHAR2
X()
--------------------------------------------------------------------------------
ANYDATA()
ANYDATA()
ANYDATA()
GETDATA
--------------------
5
19-MAR-02
hello world
thread 1:
---------
Now, given that all the necessary settings have been done (see the data
warehousing guide
for a comprehensive example) your end users can query:
select deptno, sum(sal) from emp where deptno in ( 10, 20) group by deptno;
and the database engine will rewrite the query to go against the precomputed
rollup, not
the details -- giving you the answer in a fraction of the time it would normally
take.
thread 2:
---------
Note:
thread 3:
---------
The following statement creates the primary-key materialized view on the table emp
located on a remote database.
Note: When you create a materialized view using the FAST option you will need to
create a view log
on the master tables(s) as shown below:
SQL> CREATE MATERIALIZED VIEW LOG ON emp;
Materialized view log created.
thread 4:
---------
DBMS_MVIEW.REFRESH
DBMS_MVIEW.REFRESH_ALL_MVIEWS
DBMS_MVIEW.REFRESH_DEPENDENT
Note 10:
========
/*********************************************************************************
* @author : Chandar
* @version : 1.0
*
* Name of the Application : SetupStreams.sql
* Creation/Modification History :
*
* Chandar 02-Feb-2003 Created
*
* Overview of Script:
* This SQL scripts sets up the streams for bi-directional replication between two
* databases. Replication is set up for the table named tabone in strmuser schema
* created by the script in both the databases.
* Ensure that you have created a streams administrator before executing this
script.
* The script StreamsAdminConfig.sql can be used to create a streams administrator
* and configure it.
* After running this script you can use AddTable.sql script to add another active
* table to streams environment.
**********************************************************************************
*/
----------------------------------------------------------------------------------
-
-- get TNSNAME , SYS password and streams admin user details for both the
databases
----------------------------------------------------------------------------------
-
PROMPT
-- TNSNAME for database 1
ACCEPT db1 PROMPT 'Enter TNS Name of first database :'
PROMPT
-- SYS password for database 1
ACCEPT syspwddb1 PROMPT 'Enter password for sys user of first database :'
PROMPT
-- Streams administrator username for database 1
ACCEPT strm_adm_db1 PROMPT 'Enter username for streams admin of first database :'
PROMPT
-- Streams administrator password for database 1
ACCEPT strm_adm_pwd_db1 PROMPT 'Enter password for streams admin on first database
:'
PROMPT
-- TNSNAME for database 2
PROMPT
-- SYS password for database 2
ACCEPT syspwddb2 PROMPT 'Enter password for sys user of second database :'
PROMPT
-- Streams administrator username for database 2
ACCEPT strm_adm_db2 PROMPT 'Enter username for streams admin of second database :'
PROMPT
PROMPT
PROMPT Connecting as SYS user to database 1
CONN strmuser/strmuser@&db1
-- create a sample table named tabone for which the replication will be set up
PROMPT
PROMPT Creating table tabone
ALTER TABLE tabone ADD SUPPLEMENTAL LOG GROUP tabone_log_group ( id,name) ALWAYS;
------------------------------------
-- Repeat above steps for database 2
------------------------------------
PROMPT Connecting as SYS user to database2
CONN strmuser/strmuser@&db2
-- create a sample table named tabone for which the replication will be set up
PROMPT
PROMPT Creating table tabone
ALTER TABLE tabone ADD SUPPLEMENTAL LOG GROUP tabone_log_group ( id,name) ALWAYS;
----------------------------------------------------------------------------------
-- Set up replication for table tabone from database 1 to database 2 using streams
----------------------------------------------------------------------------------
conn &strm_adm_db1/&strm_adm_pwd_db1@&db1
-- create and set up streams queue at database 1
PROMPT
PROMPT Creating streams queue
BEGIN
DBMS_STREAMS_ADM.SET_UP_QUEUE(
queue_table => 'strmuser_queue_table',
queue_name => 'strmuser_queue',
queue_user => 'strmuser');
END;
/
-- Add table propagation rules for table tabone to propagate captured changes
-- from database 1 to database 2
BEGIN
DBMS_STREAMS_ADM.ADD_TABLE_PROPAGATION_RULES(
-- create a capture process and add table rules for table tabone to capture the
-- changes made to tabone in database 1
PROMPT Creating capture process at database 1 and adding table rules for table
tabone.
BEGIN
DBMS_STREAMS_ADM.ADD_TABLE_RULES(
table_name => 'strmuser.tabone',
streams_type => 'capture',
streams_name => 'capture_db1',
DECLARE
sql_command VARCHAR2(200);
BEGIN
sql_command :='CREATE DATABASE LINK ' ||:site2|| ' CONNECT TO'||
'&strm_adm_db2 IDENTIFIED BY &strm_adm_pwd_db2 USING ''&db2''';
EXECUTE IMMEDIATE sql_command;
END;
/
conn &strm_adm_db2/&strm_adm_pwd_db2@&db2
PROMPT
PROMPT Setting instantiation SCN for table tabone at database 2
BEGIN
DBMS_APPLY_ADM.SET_TABLE_INSTANTIATION_SCN(source_object_name =>
'strmuser.tabone',
source_database_name => :site1,
instantiation_scn => :scn);
END;
/
BEGIN
DBMS_STREAMS_ADM.SET_UP_QUEUE(
queue_table => 'strmuser_queue_table',
queue_name => 'strmuser_queue',
queue_user => 'strmuser');
END;
/
-- create an apply process and add table rules for table tabone to apply
-- any changes propagated from database 1
PROMPT Creating Apply process at database 2 and adding table rules for table
tabone
BEGIN
DBMS_STREAMS_ADM.ADD_TABLE_RULES(
table_name => 'strmuser.tabone',
streams_type => 'apply',
streams_name => 'apply_db2',
queue_name => '&strm_adm_db2..strmuser_queue',
include_dml => true,
include_ddl => true,
source_database => :site1);
END;
/
BEGIN
DBMS_APPLY_ADM.START_APPLY(
apply_name => 'apply_db2');
END;
/
conn &strm_adm_db1/&strm_adm_pwd_db1@&db1
PROMPT
PROMPT Starting the capture process at database 1
BEGIN
DBMS_CAPTURE_ADM.START_CAPTURE(
capture_name => 'capture_db1');
END;
/
COMMIT;
EXECUTE DBMS_LOCK.SLEEP(35);
----------------------------------------------------------------------------------
-
-- Set up replication for table tabone from database 2 to database 1 using streams
----------------------------------------------------------------------------------
-
conn &strm_adm_db2/&strm_adm_pwd_db2@&db2
PROMPT
PROMPT Selecting rows from tabone at database 2 to see if changes are propagated
PROMPT
PROMPT Setting up bi-directional replication of table tabone
PROMPT
PROMPT Creating database link from database 2 to database 1
DECLARE
sql_command varchar2(200);
BEGIN
sql_command :='CREATE DATABASE LINK ' ||:site1|| ' CONNECT TO'||
'&strm_adm_db1 IDENTIFIED BY &strm_adm_pwd_db1 USING ''&db1''';
EXECUTE IMMEDIATE sql_command;
END;
/
-- Add table propagation rules for table tabone to propagate capture changes
-- from database 2 to database 1
BEGIN
DBMS_STREAMS_ADM.ADD_TABLE_PROPAGATION_RULES(
table_name =>'strmuser.tabone',
streams_name => 'db2_to_db1_prop',
source_queue_name => '&strm_adm_db2..strmuser_queue',
-- create a capture process and add table rules for table tabone to
-- capture the changes made to tabone in database 2
PROMPT Creating capture process at database 2 and adding table rules
for table tabone
BEGIN
DBMS_STREAMS_ADM.ADD_TABLE_RULES(
table_name => 'strmuser.tabone',
streams_type => 'capture',
streams_name => 'capture_db2',
queue_name => '&strm_adm_db2..strmuser_queue',
include_dml => true,
include_ddl => true);
END;
/
CONN &strm_adm_db1/&strm_adm_pwd_db1@&db1
PROMPT
PROMPT Setting instantiation SCN for tabone at database 2
BEGIN
DBMS_APPLY_ADM.SET_TABLE_INSTANTIATION_SCN(source_object_name =>
'strmuser.tabone',
source_database_name => :site2,
instantiation_scn => :scn);
END;
/
-- create an apply process and add table rules for table tabone to apply
-- any changes propagated from database 2
PROMPT Creating apply process at database 1 and adding table rules for tabone
BEGIN
DBMS_STREAMS_ADM.ADD_TABLE_RULES(
table_name => 'strmuser.tabone',
streams_type => 'apply',
streams_name => 'apply_db1',
queue_name => '&strm_adm_db1..strmuser_queue',
include_dml => true,
include_ddl => true,
source_database => :site2);
END;
/
BEGIN
DBMS_APPLY_ADM.START_APPLY(
apply_name => 'apply_db1');
END;
/
CONN &strm_adm_db2/&strm_adm_pwd_db2@&db2;
PROMPT
PROMPT Starting the capture process at database 2
BEGIN
DBMS_CAPTURE_ADM.START_CAPTURE(
capture_name => 'capture_db2');
END;
/
COMMIT;
EXECUTE DBMS_LOCK.SLEEP(35);
CONN &strm_adm_db1/&strm_adm_pwd_db1@&db1
Note 11:
========
The Data Propagator replication engine uses a change-capture mechanism and a log
to replicate data between a source system
and a target system. A capture process running on the source system captures
changes as they occur in the source tables
and stores them temporarily in the change data tables. The database administrator
of the source database must ensure
that the Data Propagator capture process is active on the source system. The apply
process reads the change data tables
and applies the changes to the target tables.
You can create a Data Propagator subscription with the DB2 Everyplace XML
Scripting tool. In DB2 Everyplace Version 8.2, you cannot create
or configure Data Propagator subscriptions by using the DB2� Everyplace� Sync
Server Administration Console. You can use the DB2 Everyplace
Sync Server Administration Console only to view and assign Data Propagator
subscriptions to subscription sets.
All the Data Propagator subscriptions use the Data Propagator replication engine.
When capturing changes to the change data tables, the capture process that is
running on both the source system and the mirror system
will consume processor resources and input/output resources. As a result of this
additional load on the source system,
replication competes with the source applications for system resources.
Additionally, with the Data Propagator engine,
the number of moves that the changed data has to make between the tables in the
mirror system is higher than with the JDBC engine.
As a result, the mirror database requires a substantially larger logging space
than the JDBC replication engine.
Capacity planners should balance the needs of the replication tasks and source
application to determine the size of the source system accordingly.
-How the Data Propagator replication engine handles data changes to the source
system
When the source application changes a table in the source system, the changes are
synchronized Data Propagator replication
engine first captures the changes, synchronizes them to the mirror system, and
then applies them to the
target system (the mobile device).
-How the Data Propagator replication engine handles data changes to the client
sys9tem
When the client application on the mobile device changes a table in the client
system, the Data Propagator replication engine
first synchronizes the changes to the mirror system, captures them, and then
applies them to the source system.
--------------------------------------------------------------------------------
Obviously your values for N1 will not match the values above, but you should see
that somehow the data you inserted into
your table was not the value that was finally committed, so what's going on ?
Why on earth, you say, would Oracle produce such a wierd function - and how on
earth do they stop it from costing a
fortune in processing time.
To answer the first question think replication. Back to the days of 7.0.9, when a
client asked me to build a system
which used asynchronous replication between London and New York; eventually I
persuaded him this was not a good idea,
especially on early release software when the cost to the business of an error
would be around $250,000 per shot;
nevertheless I did have to demonstrate that in principal it was possible. The
biggest problem, though, was guaranteeing
that transactions were applied at the remote site in exactly the same order that
they had been committed at the
local site; and this is precisely where Oracle uses userenv('commitscn').
Each time a commit hits the database, the SCN is incremented, so each transaction
is 'owned' by an SCN and no two transactions
can belong to a single SCN - ultimately the SCN generator is the single-thread
through which all the database must pass
and be serialised. Although there is a small arithmetical quirk that the value of
the userenv('commitscn') is changed to one
less than the actual SCN used to commit the transaction, nevertheless each
transaction gets a unique, correctly ordered value
for the function. If you have two transactions, the one with the lower value of
userenv('commitscn') is guaranteeably
the one that committed first.
So how does Oracle ensure that the cost of using this function is not prohbitive.
Well you need to examine Oracle errors
1735 and 1721 in the $ORACLE_HOME/rdbms/admin/mesg/oraus.msg file.
You may only use userenv('commitscn') to update exactly one column of one row in a
transaction, or insert exactly
one value for one row in a transaction, and (just to add that final touch of
peculiarity) the column type has to be
an unconstrained number type otherwise the subsequent change does not take place.
--------------------------------------------------------------------------------
Given this strange function, here's the basis of what you have to do to write your
own replication code:
If you now transport the changed data to the remote site, using the commit_id to
send the transactions
in the correct order, and the sequence_id to find the correct items of data, most
of your problems are over.
(Although you still have some messy details which are again left as an exercise.)
Note 13:
========
Hi,
Oracle streams capture process is not capturing any updates made on table for
which capture & apply
process are configured.
Capture process & apply process are running fine showing enabled as status & no
error. But,
No new records are captured in �streams_queue_table� when I update record in
table, which is configured for
capturing changes.
This setup was working till I got �ORA-01341: LogMiner out-of-memory� error in
alert.log file.
I guess logminer is not capturing the updates from redo log.
Current Alert log is showing following lines for logminer init process
LOGMINER: Parameters summary for session# = 1
LOGMINER: Number of processes = 3, Transaction Chunk Size = 1
LOGMINER: Memory Size = 10M, Checkpoint interval = 10M
We can clearly see reader, builder & preparer process are not starting after I got
Out of memory exception
in log miner.
*
ERROR at line 1:
>>ORA-01307: no LogMiner session is currently active
ORA-06512: at "SYS.DBMS_LOGMNR", line 76
ORA-06512: at line 1
*
ERROR at line 1:
>>ORA-01356: active logminer sessions found
ORA-06512: at "SYS.DBMS_LOGMNR_D", line 232
ORA-06512: at line 1
When I tried stopping logminer exception was �no logminer session is active�, But
when I tried
to setup tablespace exception was �active logminer sessions found�. I am not sure
how to resolve this issue.
Thanks
Posts: 25
From: Brazil
Registered: 6/19/06
Re: Oracle stream not working as Logminer is down
Posted: Dec 19, 2007 3:34 AM in response to: sgurusam Reply
To stop the persistent LogMiner session you must stop the capture process.
However, I think your problem is more related to a lack of RAM space instead of
tablespace
(i. e, disk) space. Try to increase the size of the SGA allocated to LogMiner, by
setting
capture parameter _SGA_SIZE. I can see you are using the default of 10M, which may
be not enough for your case.
Of course, you will have to increase the values of init parameters
streams_pool_size, sga_target/sga_max_size
accordingly, to avoid other memory problems.
begin
DBMS_CAPTURE_ADM.set_parameter('<name of capture process','_SGA_SIZE','100');
end;
/
Posts: 68
Registered: 1/16/08
Re: Oracle stream not working as Logminer is down
Posted: Jan 21, 2008 5:55 AM in response to: ilidioj Reply
Posts: 68
Registered: 1/16/08
Re: Oracle stream not working as Logminer is down
Posted: Jan 21, 2008 5:56 AM in response to: anoopS Reply
The best way is to write a function for clearing up the archivelogs and schedule
it at regular intervals
to avoid these kind of errors.
Note 14:
========
> I have set up asyncronous hotlog change data capture from a 9iR2 mainframe
> oracle database to an AIX 10gR2 database. The mainframe process didn't work
> and put the capture into Abended status.
>
> *** SESSION ID:(21.175) 2006-08-01 17:28:51.777
> error 10010 in STREAMS process
> ORA-10010: Begin Transaction
> ORA-00308: cannot open archived log '//'EDB.RL11.ARCHLOG.T1.S5965.DBF''
> ORA-04101: OS/390 implementation layer error
> ORA-04101, FUNC=LOCATE , RC=8, RS=C5C7002A, ERRORID=1158
> ::OPIRIP: Uncaught error 447. Error stack::ORA-00447: fatal error in
> background
> A-00308: cannot open archived log '//'EDB.RL11.ARCHLOG.T1.S5965.DBF''
> ORA-04101: OS/390 implementation layer error
> ORA-04101, FUNC=LOCATE , RC=8, RS=C5C7002A, ERRORID=1158
>
> This is because I had lower case characters in the log file format in the
> init.ora on the mainframe. The actual log file that was created was a
> completely different name.
>
> I shut down the database and fixed the init.ora. Switched the log file. I
> dropped all the objects that I created for CDC. I recreated the capture and
> altered the start scn of the capture to the current log which I found by
> running: select to_char(max(first_change#)) from v$log;
>
> I created the other objects, but when I run
> dbms_cdc_publish.alter_hotlog_change_source to enable, it immediately changes
> the capture from disabled to abended status, and gives me the same error
> message as above.
>
> How do I get the capture out of abended status, and how do I get it to NOT
> try to find the old archive log file (which isn't there anyways)?
>
Any help would be greatly appreciated!
==================================================================================
============
Note 15: Async CDC extended TEST:
==================================================================================
============
Purpose: Test Async CDC Hotlog and solve errors
1. long running txn detected
2. stop of capture
Date : 26/02/2008
DB : 10.2.0.3
------------------------------------------------------------------------
SOURCE TABLE OWNER: ALBERT
SOURCE TABLE : PERSOON
PUBLISHER : publ_cdc
CDC_SET : CDC_DEMO_SET
SUBSCRIBER : subs_cdc
CHANGE TABLE : CDC_PERSOON
CHANGE_SOURCE : SYNC_SOURCE
------------------------------------------------------------------------
set ORACLE_HOME=C:\ora10g\product\10.2.0\db_1
Init:
-- specific:
TEST10G:
startup mount pfile=c:\oracle\admin\test10g\pfile\init.ora
TEST10G2:
startup mount pfile=c:\oracle\admin\test10g2\pfile\init.ora
-- common:
alter database archivelog;
archive log start;
alter database force logging;
alter database add supplemental log data;
alter database open;
/*
JOB_QUEUE_PROCESSES (current value) + 2
PARALLEL_MAX_SERVERS (current value) + (5 * (the number of change sets planned))
PROCESSES (current value) + (7 * (the number of change sets planned))
SESSIONS (current value) + (2 * (the number of change sets planned))
*/
------------------------------------------------------------------------
Admin Queries:
connect / as sysdba
SELECT
SET_NAME,CHANGE_SOURCE_NAME,BEGIN_SCN,END_SCN,CAPTURE_ENABLED,PURGING,QUEUE_NAME
FROM CHANGE_SETS;
SELECT EQ_NAME,EQ_TYPE,TOTAL_WAIT#,FAILED_REQ#,CUM_WAIT_TIME,REQ_DESCRIPTION
FROM V_$ENQUEUE_STATISTICS WHERE CUM_WAIT_TIME>0 ;
SELECT set_name,capture_name,queue_name,queue_table_name,capture_enabled
FROM cdc_change_sets$;
SELECT set_name,capture_name,capture_enabled
FROM cdc_change_sets$;
SELECT username
FROM dba_users u, streams$_privileged_user s
WHERE u.user_id = s.user#;
SELECT r.SOURCE_DATABASE,r.SEQUENCE#,r.NAME,r.DICTIONARY_BEGIN,r.DICTIONARY_END
FROM DBA_REGISTERED_ARCHIVED_LOG r, DBA_CAPTURE c
WHERE c.CAPTURE_NAME = 'CDC$C_CHANGE_SET_ALBERT' AND r.CONSUMER_NAME =
c.CAPTURE_NAME;
------------------------------------------------------------------------
Initial:
-- TS
- USERS:
-- GRANTS:
GRANT create session TO albert;
GRANT create table TO albert;
GRANT create sequence TO albert;
GRANT create procedure TO albert;
GRANT connect TO albert;
GRANT resource TO albert;
-- object privileges
GRANT execute ON dbms_cdc_publish TO publ_cdc;
GRANT execute ON dbms_cdc_subscribe TO publ_cdc;
GRANT execute ON dbms_lock TO publ_cdc;
execute dbms_streams_auth.grant_admin_privilege('publ_cdc');
SQL> SELECT *
2 FROM dba_streams_administrator;
USERNAME
------------------------------
publ_cdc
------------------------------------------------------------------------
CDC:
====
-- CREATE CHANGE_SET
DBMS_FLASHBACK.GET_SYSTEM_CHANGE_NUMBER()
-----------------------------------------
608789
DBMS_FLASHBACK.GET_SYSTEM_CHANGE_NUMBER()
-----------------------------------------
608879
Note:
SQL>
SQL> SELECT set_name, CAPTURE_ENABLED, BEGIN_SCN, END_SCN,LOWEST_SCN,CAPTURE_ERROR
2 FROM cdc_change_sets$;
SQL>
SQL> SELECT subscription_name, handle, set_name, username, earliest_scn,
description
2 FROM cdc_subscribers$;
no rows selected
BEGIN
dbms_cdc_publish.create_change_table('publ_cdc', 'CDC_PERSOON', 'CDC_DEMO_SET',
'ALBERT', 'PERSOON', 'userid number, name varchar(30), lastname varchar(30)',
'BOTH', 'Y', 'Y', 'Y', 'Y', 'N', 'N', 'Y', 'TABLESPACE TS_CDC');
END;
/
The publisher can use this procedure for asynchronous and synchronous Change Data
Capture.
However, the default values for the following parameters are the only supported
values
for synchronous change sets: begin_date, end_date, and stop_on_ddl.
SQL> BEGIN
2 dbms_cdc_publish.create_change_table('publ_cdc', 'CDC_PERSOON',
'CDC_DEMO_SET',
3 'ALBERT', 'PERSOON', 'userid number, name varchar(30), lastname varchar(30)',
4 'BOTH', 'Y', 'Y', 'Y', 'Y', 'N', 'N', 'Y', 'TABLESPACE TS_CDC');
5 END;
6 /
exec dbms_cdc_publish.drop_change_table('publ_cdc','CDC_PERSOON','Y');
SET_NAME CAPTURE_NAME C
------------------------------ ------------------------------ -
SYNC_SET Y
CDC_DEMO_SET CDC$C_CDC_DEMO_SET N
exec dbms_cdc_publish.alter_change_set(change_set_name=>'CDC_DEMO_SET',
enable_capture=> 'Y');
SET_NAME CAPTURE_NAME C
------------------------------ ------------------------------ -
SYNC_SET Y
CDC_DEMO_SET CDC$C_CDC_DEMO_SET Y
..........
SQL>
SQL> SELECT subscription_name, handle, set_name, username, earliest_scn,
description
2 FROM cdc_subscribers$;
no rows selected
Note:
If you want to drop a subscription, use:
DBMS_CDC_SUBSCRIBE.DROP_SUBSCRIPTION(subscription_name IN VARCHAR2);
DBMS_CDC_SUBSCRIBE.DROP_SUBSCRIPTION('SUBSCRIPTION_ALBERT');
BEGIN
dbms_cdc_subscribe.subscribe('CDC_DEMO_SUB', 'ALBERT', 'PERSOON',
'userid, name, lastname', 'CDC_DEMO_SUB_VIEW');
END;
/
SQL> BEGIN
2 dbms_cdc_subscribe.subscribe('CDC_DEMO_SUB', 'ALBERT', 'PERSOON',
3 'userid, name, lastname', 'CDC_DEMO_SUB_VIEW');
4 END;
5 /
SET_NAME SUBSCRIPTION_NAME S
------------------------------ ------------------------------ -
CDC_DEMO_SET CDC_DEMO_SUB N
exec dbms_cdc_subscribe.activate_subscription('CDC_DEMO_SUB');
SET_NAME SUBSCRIPTION_NAME S
------------------------------ ------------------------------ -
CDC_DEMO_SET CDC_DEMO_SUB A
SQL> commit;
Commit complete.
1 row created.
SQL> commit;
Commit complete.
exec dbms_cdc_subscribe.extend_window('CDC_DEMO_SUB');
exec dbms_cdc_subscribe.extend_window('CDC_DEMO_SUB');
exec dbms_cdc_subscribe.purge_window('CDC_DEMO_SUB');
no rows selected
no rows selected
1 row created.
SQL> commit;
SQL> commit;
Commit complete.
6 rows selected.
A redo log file used by Change Data Capture must remain available on the staging
database until Change Data Capture
has captured it. However, it is not necessary that the redo log file remain
available until the Change Data Capture
subscriber is done with the change data.
To determine which redo log files are no longer needed by Change Data Capture for
a given change set,
the publisher alters the change set's Streams capture process, which causes
Streams to perform some internal
cleanup and populates the DBA_LOGMNR_PURGED_LOG view. The publisher follows these
steps:
Uses the following query on the staging database to get the three SCN values
needed to determine an
appropriate new first_scn value for the change set, CHICAGO_DAILY:
85 rows selected.
Dinsdag 16.00:
1 row created.
SQL> commit;
8 rows selected.
Dinsdag 20.00h:
Dinsdag 21.20h
1 row created.
Woe 08.00h
>>>>>>>>>>>>>> conn subs_cdc/subs_cdc
8 rows selected.
no rows selected
SOURCE_SCHEMA_NAME SOURCE_TABLE_NAME
------------------------------ -------------------------
ALBERT PERSOON
Woe 08.30:
1 row created.
SQL> commit;
Commit complete.
no rows selected
Woe 8.45:
1 row created.
No commit done
12.15 COMMIT
12.30
1 row created.
No COMMIT
13:02:38 2008
C001: long running txn detected, xid: 0x000a.019.000001a2
13:12:38 2008
C001: long running txn detected, xid: 0x000a.019.000001a2
13:22:40 2008
C001: long running txn detected, xid: 0x000a.019.000001a2
COMMIT
13:26:25 2008
C001: long txn committed, xid: 0x000a.019.000001a2
13.29:
Table created.
1 row created.
SQL> commit;
Commit complete.
13.46:
1 row created.
SQL>
NO COMMIT
1 row created.
SQL> commit;
12 rows selected.
6 rows selected.
6 rows selected.
6 rows selected.
6 rows selected.
SQL>
===============================================================================
TEST CASE: Export CDC objects from DATABASE TEST10G to DATABASE TEST10G2
===============================================================================
===============================================================================
PROBLEMS:
=========
Cause
An archivelog that should have been deleted was not as it was required by Streams
or Data Guard.
The next message identifies the archivelog.
Action
This is an informational message. The archivelog can be deleted after it is no
longer needed.
See the documentation for Data Guard to alter the set of active Data Guard
destinations.
See the documentation for Streams to alter the set of active streams.
Also handled.
3. ORA-00600: internal error code, arguments: [knlcLoop-200], [], [], [], [], [],
[], []
----------------------------------------------------------------------------------
------
On AIX:
SQL> /
> /dbms/tdbaaccp/accptrid/admin/dump/bdump/accptrid_c001_1499336.trc
> Oracle Database 10g Enterprise Edition Release 10.2.0.3.0 - 64bit Production
> With the Partitioning, OLAP and Data Mining options
> ORACLE_HOME = /dbms/tdbaaccp/ora10g/home
> System name: AIX
> Node name: pl003
> Release: 3
> Version: 5
> Machine: 00CB560D4C00
> Instance name: accptrid
> Redo thread mounted by this instance: 1
> Oracle process number: 23
> Unix process pid: 1499336, image: oracle@pl003 (C001)
>
> *** 2008-02-28 10:49:04.501
> *** SERVICE NAME:(SYS$USERS) 2008-02-28 10:49:04.488
> *** SESSION ID:(195.1286) 2008-02-28 10:49:04.488
> KnlcLoop: priorCkptScn currentCkptScn
> 0x0000.00926d84 0x0000.00927073
> knlcLoop: buf_txns_knlcctx:1:: lowest bufLcrScn:0x0000.00926cca
> knlcPrintCharCachedTxn:xid: 0x000b.005.000001ac
> *** 2008-02-28 10:49:04.501
> ksedmp: internal or fatal error
> ORA-00600: internal error code, arguments: [knlcLoop-200], [], [], [], [],
[], [], []
> OPIRIP: Uncaught error 447. Error stack:
> ORA-00447: fatal error in background process
> ORA-00600: internal error code, arguments: [knlcLoop-200], [], [], [], [],
[], [], []
==================================================================================
============
END OF Async CDC extended TEST:
==================================================================================
============
exec dbms_cdc_subscribe.extend_window('CHANGE_SET_ALBERT');
exec dbms_cdc_subscribe.purge_window('CHANGE_SET_ALBERT');
exec DBMS_CDC_PUBLISH.DROP_CHANGE_SET('CHANGE_SET_ALBERT');
exec dbms_capture_adm.abort_table_instantiation('HR.CDC_DEMO');
=============
26 X$ TABLES:
=============
Listed below are some of the important subsystems in the Oracle kernel. This table
might help you to read those dreaded
trace files and internal messages. For example, if you see messages like this, you
will at least know where they come from:
Kernel Subsystems:
OPI Oracle Program Interface
KK Compilation Layer - Parse SQL, compile PL/SQL
KX Execution Layer - Bind and execute SQL and PL/SQL
K2 Distributed Execution Layer - 2PC handling
NPI Network Program Interface
KZ Security Layer - Validate privs
KQ Query Layer
RPI Recursive Program Interface
KA Access Layer
KD Data Layer
KT Transaction Layer
KC Cache Layer
KS Services Layer
KJ Lock Manager Layer
KG Generic Layer
KV Kernel Variables (eg. x$KVIS and X$KVII)
S or ODS Operating System Dependencies
select *
from SYS.X$KSPPI
where substr(KSPPINM,1,1) = '_';
The following query displays parameter names with their current value:
Oracle's x$ Tables
See also: Speculation of X$ Table Names
x$ tables are the sql interface to viewing oracle's memory in the SGA. The names
for the x$ tables can be queried with
Information on buffer headers. Contains a record (the buffer header) for each
block in the buffer cache. This select statement lists
how many blocks are Available, Free and Being Used.
x$bufqm
x$class_stat
x$context
x$globalcontext
x$hofp
x$hs_session
The x$kc... tables
x$kcbbhs
x$kcbmmav
x$kcbsc
x$kcbwait
x$kcbwbpd
Buffer pool descriptor, the base table for v$buffer_pool. How is the buffer cache
split between the default, the recycle and the keep buffer pool.
x$kcbwds
Set descriptor, see also x$kcbwbpd The column id can be joined with
v$buffer_pool.id. The column bbwait corresponds to the buffer busy waits wait
event. Information on working set buffers addr can be joined with x$bh.set_ds.
set_id will be between lo_setid and hi_setid in v$buffer_pool for the relevant
buffer pool.
x$kccal
x$kccbf
x$kccbi
x$kccbl
x$kccbp
x$kccbs
x$kcccc
x$kcccf
x$kccdc
x$kccdi
x$kccdl
x$kccfc
x$kccfe
x$kccfn
x$kccic
x$kccle
Controlfile logfile entry. Use
select max(lebsz) from x$kccle
to find out the size of a log block. The log block size is the unit for the
following init params: log_checkpoint_interval, _log_io_size, and
max_dump_file_size.
x$kcclh
x$kccor
x$kcccp
Checkpoint Progress:
The column cpodr_bno displays the current redo block number. Multiplied with the
OS Block Size (usually 512), it returns the amount of bytes of redo currently
written to the redo logs. Hence, this number is reset at each log switch. k$kcccp
can (together with x$kccle) be used to monitor the progress of the writing of
online redo logs. The following query does this.
select
le.leseq "Current log sequence No",
100*cp.cpodr_bno/le.lesiz "Percent Full",
cp.cpodr_bno "Current Block No",
le.lesiz "Size of Log in Blocks"
from
x$kcccp cp,
x$kccle le
where
LE.leseq =CP.cpodr_seq
and bitand(le.leflg,24)=8;
bitand(le.leflg,24)=8 makes sure we get the current log group How much redo is
written by Oracle uses a variation of this SQL statement to track how much redo is
written by different DML Statements.
x$kccrs
x$kccrt
x$kccsl
x$kcctf
x$kccts
x$kcfio
x$kcftio
x$kckce
x$kckty
x$kclcrst
x$kcrfx
x$kcrmf
x$kcrmx
x$kcrralg
x$kcrrarch
x$kcrrdest
x$kcrrdstat
x$kcrrms
x$kcvfh
x$kcvfhmrr
x$kcvfhonl
x$kcvfhtmp
x$kdnssf
The x$kg... tables
KG stands for kernel generic
x$kghlu
This view shows one row per shared pool area. If there's a java pool, an
additional row is displayed.
x$kgicc
x$kgics
x$kglcursor
x$kgldp
x$kgllk
This table lists all held and requested library object locks for all sessions. It
is more complete than v$lock. The column kglnaobj displays the first 80 characters
of the name of the object.
select
kglnaobj, kgllkreq
from
x$kgllk x join v$session s on
s.saddr = x.kgllkses;
kgllkreq = 0 means, the lock is held, while kgllkreq > 0 means that the lock is
requested.
x$kglmem
x$kglna
x$kglna1
x$kglob
Library Cache Object
x$kglsim
x$kglst
x$kgskasp
x$kgskcft
x$kgskcp
x$kgskdopp
x$kgskpft
x$kgskpp
x$kgskquep
x$kjbl
x$kjbr
x$kjdrhv
x$kjdrpcmhv
x$kjdrpcmpf
x$kjicvt
x$kjilkft
x$kjirft
x$kjisft
x$kjitrft
x$kksbv
x$kkscs
x$kkssrd
x$klcie
x$klpt
x$kmcqs
x$kmcvc
x$kmmdi
x$kmmrd
x$kmmsg
x$kmmsi
x$knstacr
x$knstasl
x$knstcap
x$knstmvr
x$knstrpp
x$knstrqu
x$kocst
The x$kq... tables
x$kqfco
This table has an entry for each column of the x$tables and can be joined with
x$kqfta. The column kqfcosiz indicates the size (in bytes?) of the columns.
select
t.kqftanam "Table Name",
c.kqfconam "Column Name",
c.kqfcosiz "Column Size"
from
x$kqfta t,
x$kqfco c
where
t.indx = c.kqfcotab
x$kqfdt
x$kqfsz
x$kqfta
It seems that all x$table names can be retrieved with the following query.
select kqftanam from x$kqfta;
This table can be joined with x$kqfco which contains the columns for the tables:
select
t.kqftanam "Table Name",
c.kqfconam "Column Name"
from
x$kqfta t,
x$kqfco c
where
t.indx = c.kqfcotab
x$kqfvi
x$kqfvt
x$kqlfxpl
x$kqlset
x$kqrfp
x$kqrfs
x$kqrst
x$krvslv
x$krvslvs
x$krvxsv
The x$ks... tables
KS stands for kernel services.
x$ksbdd
x$ksbdp
x$ksfhdvnt
x$ksfmcompl
x$ksfmelem
x$ksfmextelem
x$ksfmfile
x$ksfmfileext
x$ksfmiost
x$ksfmlib
x$ksfmsubelem
x$ksfqp
x$ksimsi
x$ksled
x$kslei
x$ksles
x$kslld
x$ksllt
x$ksllw
x$kslwsc
x$ksmfs
x$ksmfsv
This SGA map.
x$ksmge
x$ksmgop
x$ksmgsc
x$ksmgst
x$ksmgv
x$ksmhp
x$ksmjch
x$ksmjs
x$ksmlru
Memory least recently used Whenever a select is performed on x$ksmlru, its content
is reset! This table show which memory allocations in the shared pool caused the
throw out of the biggest memory chunks since it was last queried.
x$ksmls
x$ksmmem
This 'table' seems to allow to address (that is read (write????)) every byte in
the SGA. Since the size of the SGA equals the size of select sum(value) from
v$sga, the following query must return 0 (at least on a four byte architecture.
Don't know about 8 bytes.)
select
(select sum(value) from v$sga ) -
(select 4*count(*) from x$ksmmem) "Must be Zero!"
from
dual;
x$ksmsd
x$ksmsp
x$ksmsp_nwex
x$ksmspr
x$ksmss
x$ksolsfts
x$ksolsstat
x$ksppcv
x$ksppcv2
Contains the value kspftctxvl for each parameter found in x$ksppi. Determine if
this value is the default value with the column kspftctxdf.
x$ksppi
This table contains a record for all documented and undocumented (starting with an
underscore) parameters. select ksppinm from x$ksppi to show the names of all
parameters. Join indx+1 with x$ksppcv2.kspftctxpn.
x$ksppo
x$ksppsv
x$ksppsv2
x$kspspfile
x$ksqeq
x$ksqrs
x$ksqst
Enqueue management statistics by type. ksqstwat: The number of wait for the
enqueue statistics class.
ksqstwtim: Cumulated waiting time. This column is selected when
v$enqueue_stat.cum_wait_time is selected. The types of classes are: BL Buffer
Cache Management
CF Controlfile Transaction
CI Cross-instance call invocation
CU Bind Enqueue
DF Datafile
DL Direct Loader index creation
DM Database mount
DP ???
DR Distributed Recovery
DX Distributed TX
FB acquired when formatting a range of bitmap blocks far ASSM segments. id1=ts#,
id2=relative dba
FS File Set
IN Instance number
IR Instance Recovery
IS Instance State
IV Library cache invalidation
JD Something to do with dbms_job
JQ Job queue
KK Redo log kick
LA..LP Library cache lock
MD enqueue for Change data capture materialized view log (gotten internally for
DDL on a snapshot log) id1=object# of the snapshot log.
MR Media recovery
NA..NZ Library cache pin
PF Password file
PI Parallel slaves
PR Process startup
PS Parallel slave synchronization
SC System commit number
SM SMON
SQ Sequence number enqueue
SR Synchronized replication
SS Sort segment
ST Space management transaction
SV Sequence number value
SW Suspend writes enqueue gotten when someone issues alter system suspend|resume
TA Transaction recovery
UL User defined lock
UN User name
US Undo segment, serialization
WL Redo log being written
XA Instance attribute lock
XI Instance registration lock
XR Acquired for alter system quiesce restricted
x$kstex
x$ksull
x$ksulop
x$ksulv
x$ksumysta
x$ksupr
x$ksuprlat
x$ksurlmt
x$ksusd
Contains a record for all statistics.
x$ksuse
x$ksusecon
x$ksusecst
x$ksusesta
x$ksusgif
x$ksusgsta
x$ksusio
x$ksutm
x$ksuxsinst
x$ktadm
x$targetrba
x$ktcxb
The SGA transaction table.
x$ktfbfe
x$ktfthc
x$ktftme
x$ktprxrs
x$ktprxrt
x$ktrso
x$ktsso
x$ktstfc
x$ktstssd
x$kttvs
Lists save undo for each tablespace: The column kttvstnm is the name of the
tablespace that has saved undo. The column is null otherwise.
x$kturd
x$ktuxe
Kernel transaction, undo transaction entry
x$kvis
Has (among others) a row containing the db block size:
select kvisval from x$kvis where kvistag = 'kcbbkl'
x$kvit
x$kwddef
x$kwqpd
x$kwqps
x$kxfpdp
x$kxfpns
x$kxfpsst
x$kxfpys
x$kxfqsrow
x$kxsbd
x$kxscc
x$kzrtpd
x$kzspr
x$kzsrt
x$le
Lock element: contains an entry for each PCM lock held for the buffer cache. x$le
can be left outer joined to x$bh on le_addr.
x$le_stat
x$logmnr_callback
x$logmnr_contents
x$logmnr_dictionary
x$logmnr_logfile
x$logmnr_logs
x$logmnr_parameters
x$logmnr_process
x$logmnr_region
x$logmnr_session
x$logmnr_transaction
x$nls_parameters
x$option
x$prmsltyx
x$qesmmiwt
x$qesmmsga
x$quiesce
x$uganco
x$version
x$xsaggr
x$xsawso
x$xssinfo
A perlscript to find x$ tables
#!/usr/bin/perl -w
use strict;
open O, ("/appl/oracle/product/9.2.0.2/bin/oracle");
open F, (">x");
my $l;
my $p = ' ' x 40;
my %x;
while (read (O,$l,10000)) {
$l = $p.$l;
$p = substr ($l,-40);
}
===============
27 OTHER STUFF:
===============
Use DBMS_METADATA.GET_DDL()
Examples:
If there is a task in Oracle for which the wheel has been reinvented many times,
it is that of generating database object DDL. There are numerous scripts floating
in different forums doing the same thing. Some of them work great, while others
work only until a specific version. Sometimes the DBAs prefer to create the
scripts themselves. Apart from the testing overhead, these scripts require
substantial insight into the data dictionary. As new versions of the database are
released, the scripts need to be modified to fit the new requirements.
Starting from Oracle 9i Release 1, the DBMS_METADATA package has put an official
end to all such scripting effort. This article provides a tour of the reverse
engineering features of the above package, with a focus on generating the creation
DDL of existing database objects. The article also has a section covering the
issue of finding object dependencies.
A set of functions that can be used with SQL. This is known as the browsing
interface. The functions in the browsing interface are GET_DDL, GET_DEPENDENT_DDL,
GET_GRANTED_DDL
A set of functions that can be used in PLSQL, which is in fact a superset of (1).
They support filtering, and optional turning on and turning off of some clause in
the DDL. The flexibilities provided by the programmer interface are rarely
required. For general use the browsing interface is sufficient - more so if the
programmer knows SQL well.
GET_DDL
Version, model and transform take the default values "COMPATIBLE", "ORACLE", and
"DDL" - further discussion of these is not in the scope of this article.
object_type can be any of the object types given in Table 8 below. Table 1 shows a
simple usage of the GET_DDL function to get all the tables of a schema. This
function can only be used to fetch named objects, that is, objects with type N or
S in Table 8. We will see in a later section how the "/" at the end of the DDL can
be turned on by default.
Version, model and transform take the default values "COMPATIBLE", "ORACLE" and
"DDL", and are not discussed futher. object_count takes the default of 10000 and
can be left like that for most cases.
Version, model and transform take the default values "COMPATIBLE", "ORACLE" and
"DDL", and need no further discussion.
object_count takes the default of 10000, and can be left like that for most cases.
grantee is the user who is granting the object_types. The object types that can
work in GET_GRANTED_DDL are the ones with type G in Table 8. Table 3 shows a
simple usage of the GET_GRANTED_DDL function.
OPEN
SET_FILTER
SET_COUNT
GET_QUERY
SET_PARSE_ITEM
ADD_TRANSFORM
SET_TRANSFORM_PARAM
FETCH_xxx
CLOSE
To make use of this interface one must write a PLSQL block. Considering the fact
that several CLOB columns are involved, this is not simple. However, the next
section shows how to use the SET_TRANSFORM_PARM function in SQLPLUS in order to
perform most of the jobs done by this interface. If one adds simple SQL skills to
it, the programmatic interface can be bypassed in almost all cases. To get details
of the programmatic interface, the reader should refer to the documentation.
Using the SET_TRANSFORM_PARAM function in SQL Session
This function determines how the output of the DBMS_METADATA is displayed. The
general syntax is
SET_TRANSFORM_PARAM(transform_handle, name, value).
Table 4 shows how to get the DDL of tables not containing the word LOG in a good
indented form and with SQL Terminator without a storage clause.
SQL> execute
DBMS_METADATA.SET_TRANSFORM_PARAM(DBMS_METADATA.SESSION_TRANSFORM,'STORAGE',false)
;
SQL> execute
DBMS_METADATA.SET_TRANSFORM_PARAM(DBMS_METADATA.SESSION_TRANSFORM,'PRETTY',true);
SQL> execute
DBMS_METADATA.SET_TRANSFORM_PARAM(DBMS_METADATA.SESSION_TRANSFORM,'SQLTERMINATOR',
true);
SQL>
Thus we see how a DDL requirement even with some filtering condition and a
formatting requirement was met by the SQL browsing interface along with
SET_SESSION_TRANSFORM.
PRETTY (all objects) - If TRUE, format the output with indentation and line feeds.
Defaults to TRUE.
FORCE (VIEW) - If TRUE, use the FORCE keyword in the CREATE VIEW statement.
Defaults to TRUE.
The object views of the Oracle metadata model implement security as follows:
Non-privileged users can see the metadata only of their own objects.
SYS and users with SELECT_CATALOG_ROLE can see all objects.
Non-privileged users can also retrieve object and system privileges granted to
them or by them to others. This also includes privileges granted to PUBLIC.
If callers request objects they are not privileged to retrieve, no exception is
raised; the object is simply not retrieved.
If non-privileged users are granted some form of access to an object in someone
else's schema, they will be able to retrieve the grant specification through the
Metadata API, but not the object's actual metadata.
Column Description
------ -----------
OWNER Owner of the object
NAME Name of the object
TYPE Type of object
REFERENCED_OWNER Owner of the parent object
REFERENCED_NAME Type of parent object
REFERENCED_TYPE Type of referenced object
REFERENCED_LINK_NAME Name of the link to the parent object (if remote)
SCHEMAID ID of the current schema
DEPENDENCY_TYPE Whether the dependency is a REF dependency (REF) or not
(HARD)
Table 7 below shows how to use the above view to get the dependencies. The example
shows a case where we might want to drop the procedure CHECK_SAL, but we would
like to find any objects dependent on it. The query below shows that a TRIGGER
named SALARY_TRIGGER is dependent on it.
CONCLUSION
This article is intended to give the minimum effort answer to elementary and
intermediate level object dependency related issues. For advanced object
dependency issues, this article points to the solution. As Oracle keeps on
upgrading its versions, it is clear that they will be upgrading the DBMS_METADATA
interface and ALL_DEPENDENCIES view along with it. The solutions developed along
those lines will persist.
connect system/manager
drop user revrun cascade;
drop user revrun_user cascade;
drop user revrun_admin cascade;
connect revrun/revrun
Rem grants...
Rem indexes...
Rem triggers
create or replace procedure check_sal( salary in number) as
begin
return; -- Demo code
end;
/
=============
11g Features:
=============
Note 1:
-------