sky's profileDBA日记PhotosBlogListsMore Tools Help

DBA日记

日出东海落西山,喜也一天,愁也一天,遇事不钻牛角尖,人也舒坦,心也舒坦,常与朋友聊聊天,古也聊聊,今也聊聊,不是神仙,胜似神仙,快乐每一天!
6/18/2009

RAC节点一挂起,日志报pmon failed to accuire latch

 

hpux+10.2.0.4RAC

数据库挂起

alert日志如下:

Thu Jun 18 03:28:17 2009
Thread 2 advanced to log sequence 3758 (LGWR switch)
  Current log# 5 seq# 3758 mem# 0: /dev/vg6_dss_data03/rredo212
  Current log# 5 seq# 3758 mem# 1: /dev/vg6_dss_data04/rredo222
Thu Jun 18 09:19:25 2009
PMON failed to acquire latch, see PMON dump
Thu Jun 18 09:20:27 2009
PMON failed to acquire latch, see PMON dump
Thu Jun 18 09:21:30 2009
PMON failed to acquire latch, see PMON dump
Thu Jun 18 09:22:59 2009
PMON failed to acquire latch, see PMON dump
Thu Jun 18 09:24:01 2009
PMON failed to acquire latch, see PMON dump
Thu Jun 18 09:25:03 2009
PMON failed to acquire latch, see PMON dump
Thu Jun 18 09:26:06 2009
PMON failed to acquire latch, see PMON dump
Thu Jun 18 09:27:09 2009
PMON failed to acquire latch, see PMON dump
Thu Jun 18 09:28:12 2009
PMON failed to acquire latch, see PMON dump
Thu Jun 18 09:36:39 2009
Errors in file /oracle/app/oracle/admin/jldw/bdump/jldw2_q000_5811.trc:
ORA-00018: 超出最大会话数
Thu Jun 18 09:37:01 2009
Errors in file /oracle/app/oracle/admin/jldw/bdump/jldw2_q000_7101.trc:
ORA-00018: 超出最大会话数
………………………………………………………
………………………………………………………
PMON failed to acquire latch, see PMON dump
Thu Jun 18 10:26:44 2009
PMON failed to acquire latch, see PMON dump
Thu Jun 18 10:26:49 2009
>>> WAITED TOO LONG FOR A ROW CACHE ENQUEUE LOCK! pid=131
System State dumped to trace file /oracle/app/oracle/admin/jldw/bdump/jldw2_q002_4466.trc
Thu Jun 18 10:28:29 2009
PMON failed to acquire latch, see PMON dump
Thu Jun 18 10:30:04 2009
>>> WAITED TOO LONG FOR A ROW CACHE ENQUEUE LOCK! pid=885
System State dumped to trace file /oracle/app/oracle/admin/jldw/udump/jldw2_ora_10341.trc
Thu Jun 18 10:30:10 2009
PMON failed to acquire latch, see PMON dump

 

/oracle/app/oracle/admin/jldw/bdump/jldw2_q000_5811.trc
Oracle Database 10g Enterprise Edition Release 10.2.0.4.0 - 64bit Production
With the Partitioning, Real Application Clusters, OLAP, Data Mining
and Real Application Testing options
ORACLE_HOME = /oracle/app/oracle/product/10.2.0/db10g
System name:    HP-UX
Node name:      jldss2
Release:        B.11.31
Version:        U
Machine:        ia64
Instance name: jldw2
Redo thread mounted by this instance: 2
Oracle process number: 20
Unix process pid: 5811, image: oracle@jldss2 (q000)

*** 2009-06-18 09:36:39.162
*** SERVICE NAME:(SYS$BACKGROUND) 2009-06-18 09:36:39.161
*** SESSION ID:(1628.3) 2009-06-18 09:36:39.161
KSV 18 error in slave process
*** 2009-06-18 09:36:39.162
ORA-00018: 超出最大会话数
OPIRIP: Uncaught error 447. Error stack:
ORA-00447: fatal error in background process
ORA-00018: maximum number of sessions exceeded
~

/oracle/app/oracle/admin/jldw/udump/jldw2_ora_10341.trc
Oracle Database 10g Enterprise Edition Release 10.2.0.4.0 - 64bit Production
With the Partitioning, Real Application Clusters, OLAP, Data Mining
and Real Application Testing options
ORACLE_HOME = /oracle/app/oracle/product/10.2.0/db10g
System name:    HP-UX
Node name:      jldss2
Release:        B.11.31
Version:        U
Machine:        ia64
Instance name: jldw2
Redo thread mounted by this instance: 2
Oracle process number: 885
Unix process pid: 10341, image: oracle@jldss2

*** 2009-06-18 10:30:04.901
*** SERVICE NAME:(SYS$USERS) 2009-06-18 10:30:04.900
*** SESSION ID:(1628.199) 2009-06-18 10:30:04.900
>>> WAITED TOO LONG FOR A ROW CACHE ENQUEUE LOCK! <<<
row cache enqueue: session: c00000023ee7f110, mode: N, request: X
===================================================
SYSTEM STATE
------------
System global information:
     processes: base c00000023e864db0, size 1500, cleanup c00000023e8c77f0
     allocation: free sessions c00000023ba51890, free calls 0000000000000000

………………………………………………………
………………………………………………………

AST_Q:
PENDING_Q:
GRANTED_Q:
----------------------------------------
SO: c00000023ef54ec0, type: 3, owner: c00000023b8d6b70, flag: INIT/-/-/0x00
(call) sess: cur c00000023ee7dba8, rec c00000023be95418, usr c00000023ee7dba8; depth: 0
   ----------------------------------------
   SO: c00000023ef58638, type: 3, owner: c00000023ef54ec0, flag: INIT/-/-/0x00
   (call) sess: cur c00000023be95418, rec c00000023be95418, usr c00000023ee7dba8; depth: 1
   ----------------------------------------
   SO: c00000023be95418, type: 4, owner: c00000023ef54ec0, flag: INIT/-/-/0x00
   (session) sid: 1633 trans: 0000000000000000, creator: 0000000000000000, flag: (2) -/REC -/-/-/-/-/-
             DID: 0000-0000-00000000, short-term DID: 0000-0000-00000000
             txn branch: 0000000000000000
             oct: 0, prv: 0, sql: c00000023d7e47a0, psql: c00000023d7e47a0, user: 0/SYS
   temporary object counter: 0
   ----------------------------------------
   SO: c0000001585b1ec8, type: 50, owner: c00000023ef54ec0, flag: INIT/-/-/0x00
   row cache enqueue: count=1 session=c00000023ee7dba8 object=c00000023cd495a8, mode=S
   savepoint=0x5
   row cache parent object: address=c00000023cd495a8 cid=7(dc_users)
   hash=b0e2d11f typ=11 transaction=0000000000000000 flags=00000002
   own=c00000023cd49678[c000000158800c30,c00000022e71a820] wat=c00000023cd49688[c00000023cd49688,c00000023cd49688] mode=S
   status=VALID/-/-/-/-/-/-/-/-
   request=N release=FALSE flags=0
   instance lock id=QH a2279543 5fd5248a
   set=0, complete=FALSE
   set=1, complete=FALSE
   set=2, complete=FALSE
   data=
   00000042 00044457 5f560000 00000000 00000000 00000000 00000000 00000000
   00000000 00103732 32443042 33323241 41453231 35330000 00000000 00000000
   00000000 00164445 4641554c 545f434f 4e53554d 45525f47 524f5550 00000000
   00000000 0000000a 00000003 00000000 00000101 786d0401 0d181e00 00000000
   00000000 00000000 00000000 00000000 00000000 00000000
----------------------------------------
SO: c00000022e5c2820, type: 16, owner: c00000023b8d6b70, flag: INIT/-/-/0x00
(osp req holder)

虽然bug的版本差点,不过看现象差不多。重启节点2后正常。

Subject:
Potential reasons for "WAITED TOO LONG FOR A ROW CACHE ENQUEUE LOCK! "

Doc ID:
278316.1
Type:
BULLETIN

Modified Date :
31-JAN-2008
Status:
PUBLISHED

*************************************************************
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

Suggest potential reasons behind "WAITED TOO LONG FOR A ROW CACHE ENQUEUE LOCK! "

SCOPE & APPLICATION

DBAs and Support Engineers

Potential reasons for "WAITED TOO LONG FOR A ROW CACHE ENQUEUE LOCK! "

When Row cache contention occurs, if the enqueue cannot be gotten within a certain time period,
a trace file will be generated in the <Parameter:user_dump_dest> location with some trace details.
The trace file tends to contain the words:
  >> WAITED TOO LONG FOR A ROW CACHE ENQUEUE LOCK! <<
in it at the start.
This trace can provide some useful information for diagnosing the cause of the contention.
It is possible to check the row cache enqueue trace to determine which enqueue has the contention: For example:
...
>> WAITED TOO LONG FOR A ROW CACHE ENQUEUE LOCK! <<
row cache enqueue: session: 70000001b542d48, mode: N, request: S
  row cache parent object: address=700000036f27628 cid=0(dc_tablespaces)
  hash=a6840aa5 typ=9 transaction=0 flags=00008000
...

The trace will often contain a systemstate dump, although most useful information is in the header section. Typically a session holding the row cache resource will either be on cpu or blocked by another session. If it is on cpu then errorstacks are likely to be required to diagnose, unless tuning can be done to reduce the enqueue hold time. Remember that on a multi node system (RAC) the holder may be on another node and so multiple systemstates from each node will be required.

For each enqueue type, there are a limited number of operations that require each enqueue.
DC_TABLESPACES
Probably the most likely is allocation of new extents. If extent sizes are set low then the application may constantly be requesting new extents and causing contention. Do you have objects with small extent sizes that are rapidly growing? (You may be able to spot these by looking for objects with large numbers of extents). Check the trace for insert/update activity, check the objects inserted into for number of extents.
DC_SEQUENCES
Check for appropriate caching of sequences for the application requirements.
DC_USERS
Deadlock and resulting "WAITED TOO LONG FOR A ROW CACHE ENQUEUE LOCK!" can occur if a session issues a GRANT to a user, and that user is in the process of logging on to the database.
This is Bug 2615271, fixed in 9.2.0.6
DC_OBJECTS
Look for any object compilation activity which might require an exclusive lock and thus block online activity.
DC_SEGMENTS
This is likely to be down to segment allocation. Identify what the session holding the enqueue is doing and use errorstacks to diagnose.

RELATED DOCUMENTS

4/7/2009

expdp:ORA-39062: error creating master process DM00

发信人: boyli (sky), 信区: Database
标  题: [合集] expdp 问题
发信站: 水木社区 (Tue Apr  7 16:04:23 2009), 站内

☆─────────────────────────────────────☆
   xuebaowang (海风) 于  (Sat Apr  4 03:22:32 2009)  提到:

expdp 的时候报错:
ORA-31626: job does not exist
ORA-31637: cannot create job ZK_EXPDP for user ZK
ORA-06512: at "SYS.DBMS_SYS_ERROR", line 95
ORA-06512: at "SYS.KUPV$FT", line 1201
ORA-39062: error creating master process DM00
ORA-39107: Master process DM00 violated startup protocol. Master error:
ORA-06533: Subscript beyond count

网上搜说这样做:
alter system set streams_pool_size=10M scope=memory;
然后文章的作者搞定了;
但是我按照这个依然不行
请教 有没有哪位高人 知道这个还要怎么解决 多谢了


☆─────────────────────────────────────☆
   boyli (sky) 于  (Sat Apr  4 20:29:47 2009)  提到:

查了一下metalink,试试:
select * from dba_objects where object_name='ZK';
看看有啥东西?

很可能是个bug
查一下alert,看是不是有其他错误出现
【 在 xuebaowang (海风) 的大作中提到: 】
: expdp 的时候报错:
: ORA-31626: job does not exist
: ORA-31637: cannot create job ZK_EXPDP for user ZK
: ...................



☆─────────────────────────────────────☆
   xuebaowang (海风) 于  (Sun Apr  5 07:34:31 2009)  提到:

zk 下 有9K多的对象
metalink是什么 才疏学浅 还望赐教
【 在 boyli (sky) 的大作中提到: 】
: 查了一下metalink,试试:
: select * from dba_objects where object_name='ZK';
: 看看有啥东西?
: ...................



☆─────────────────────────────────────☆
   boyli (sky) 于  (Sun Apr  5 20:29:49 2009)  提到:

是名字等于‘ZK’的对象
有人说和用户同名的同义词会导致这个问题(个案)
metalink是oracle官方技术支持网站,已经发现的问题都会有文档
需要授权才能访问
【 在 xuebaowang (海风) 的大作中提到: 】
: zk 下 有9K多的对象
: metalink是什么 才疏学浅 还望赐教




☆─────────────────────────────────────☆
   xuebaowang (海风) 于  (Tue Apr  7 14:41:30 2009)  提到:

受教了
zk下竟然有个名字是zk的函数
真服了
再次感谢大侠
【 在 boyli (sky) 的大作中提到: 】
: 是名字等于‘ZK’的对象
: 有人说和用户同名的同义词会导致这个问题(个案)
: metalink是oracle官方技术支持网站,已经发现的问题都会有文档
: ...................



☆─────────────────────────────────────☆
   boyli (sky) 于  (Tue Apr  7 15:01:41 2009)  提到:

问题解决了?
【 在 xuebaowang (海风) 的大作中提到: 】
: 受教了
: zk下竟然有个名字是zk的函数
: 真服了
: ...................



☆─────────────────────────────────────☆
   xuebaowang (海风) 于  (Tue Apr  7 15:43:56 2009)  提到:

恩 我drop掉这个function 然后 再搞 就OK了
【 在 boyli (sky) 的大作中提到: 】
: 问题解决了?
3/25/2009

RAC节点报GES: Potential blocker (pid=373) on resource TX-0x370008-0x147

环境:10.2.0.1 RAC
         RHEL 5.2

用户发现系统性能下降厉害,检查日志发现:

节点2报错:

Tue Mar 24 17:16:44 2009
GES: Potential blocker (pid=373) on resource TX-0x370008-0x147;
enqueue info in file /u01/app/oracle/admin/jldb/udump/jldb2_ora_24975.trc and D
IAG trace file
Tue Mar 24 17:20:41 2009
GES: Potential blocker (pid=7664) on resource TX-0x490011-0x2a;
enqueue info in file /u01/app/oracle/admin/jldb/bdump/jldb2_lmd0_29076.trc and DIAG trace file

trc文件中内容如下

*** 2009-03-23 21:24:58.021
user session for deadlock lock 0x1807f86f0
  pid=217 serial=431 audsid=89970 user: 64/JLDBCS
  O/S info: user: Administrator, term: unknown, ospid: , machine: APP3
            program: JDBC Thin Client
  application name: JDBC Thin Client, hash value=0
  Current SQL Statement:

update multisalvationobject mso set mso_order  = :"SYS_B_0", mso_sign   = :"SYS_B_1", mso_time   = sysdate, mso_emp    = :"SYS_B_2", mso_result = :"SYS_B_3", mso.mso_money =(select o.tempmoney from opttemp o where o.sign = :"SYS_B_4" and mso.mso_ot_id=o.tempid) where  exists (select tempid from opttemp o where o.sign = :"SYS_B_5" and so.mso_ot_id=tempid ) and mso.sb_id = :"SYS_B_6" and mso.st_id= :"SYS_B_7" and mso.mso_objecttype = :"SYS_B_8" and mso.mso_flag = :"SYS_B_9"

Global blockers dump start:---------------------------------
DUMP LOCAL BLOCKER/HOLDER: block level 5 res [0x620020][0x15],[TX]
----------resource 0x0x16cb8cdc8----------------------
resname       : [0x620020][0x15],[TX]
Local node    : 1
dir_node      : 1
master_node   : 1
hv idx        : 9
hv last r.inc : 6
current inc   : 12
hv status     : 0
hv master     : 0
open options  : dd
grant_bits    : KJUSERNL KJUSEREX
grant mode    : KJUSERNL  KJUSERCR  KJUSERCW  KJUSERPR  KJUSERPW  KJUSEREX
count         : 1         0         0         0         0         1
val_state     : KJUSERVS_NOVALUE
valblk        : 0x00000000000000000000000000000000 .
access_node   : 1
vbreq_state   : 0
state         : x0
resp          : 0x16cb8cdc8
On Scan_q?    : N
Total accesses: 77
Imm.  accesses: 58
Granted_locks : 1
Cvting_locks  : 1
value_block:  00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
GRANTED_Q :
lp 0x1807f85a0 gl KJUSEREX rp 0x16cb8cdc8 [0x620020][0x15],[TX]
  master 1 gl owner 0x18ada82e0 possible pid 12343 xid DB000-0002-00000008 bast
0 rseq 1 mseq 0 history 0x14951495
  open opt KJUSERDEADLOCK
CONVERT_Q:
lp 0x1807f86f0 gl KJUSERNL rl KJUSEREX rp 0x16cb8cdc8 [0x620020][0x15],[TX]
  master 1 gl owner 0x183db6e80 possible pid 11575 xid D9000-0002-0000002F bast
0 rseq 1 mseq 0 history 0x1495149a
  convert opt KJUSERGETVALUE
----------enqueue 0x0x1807f85a0------------------------
lock version     : 309
Owner node       : 1
grant_level      : KJUSEREX
req_level        : KJUSEREX
bast_level       : KJUSERNL
notify_func      : (nil)
resp             : 0x16cb8cdc8
procp            : 0x1801090e8

.................
kjdrchkdrm: found an RM request in the request queue

同时,另外一个节点报:

Tue Mar 24 17:26:41 2009
Global Enqueue Services Deadlock detected. More info in file
/u01/app/oracle/admin/jldb/bdump/jldb1_lmd0_11622.trc.
Tue Mar 24 17:28:04 2009
Global Enqueue Services Deadlock detected. More info in file


trace文件内容:

*** 2009-03-23 11:23:17.051
user session for deadlock lock 0x17f6c90a8
  pid=362 serial=3 audsid=86656 user: 64/JLDBCS
  O/S info: user: Administrator, term: unknown, ospid: , machine: APP3
            program: JDBC Thin Client
  application name: JDBC Thin Client, hash value=0
  Current SQL Statement:
  delete multisalvationobject ss  where ss.mso_order= :"SYS_B_0" and exists (sel
ect :"SYS_B_1" from family f where f.f_familyid = ss.mso_ot_id and f.on_no like
:"SYS_B_2" )
ENQUEUE DUMP REQUEST: from 1.22126 on [0x2f0029][0x10a],[TX] for reason 3 mtype
0
DUMP LOCAL BLOCKER/HOLDER: block level 5 res [0x2f0029][0x10a],[TX]
----------resource 0x0x16dab1890----------------------
resname       : [0x2f0029][0x10a],[TX]
Local node    : 0
dir_node      : 1
master_node   : 1
hv idx        : 7
hv last r.inc : 6
current inc   : 8
hv status     : 0
hv master     : 0
open options  : dd
Held mode     : KJUSERNL
Cvt mode      : KJUSEREX
Next Cvt mode : KJUSERNL
msg_seq       : 0x1
res_seq       : 3
grant_bits    : KJUSERNL
grant mode    : KJUSERNL  KJUSERCR  KJUSERCW  KJUSERPR  KJUSERPW  KJUSEREX
count         : 1         0         0         0         0         0
val_state     : KJUSERVS_NOVALUE
valblk        : 0x00000000000000000000000000000000 .
access_node   : 1
vbreq_state   : 0
state         : x8
resp          : 0x16dab1890
On Scan_q?    : N
Total accesses: 73
Imm.  accesses: 62
Granted_locks : 0
Cvting_locks  : 1
value_block:  00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
GRANTED_Q :
CONVERT_Q:
lp 0x17f6c90a8 gl KJUSERNL rl KJUSEREX rp 0x16dab1890 [0x2f0029][0x10a],[TX]
  master 1 gl owner 0x18ad7ab00 possible pid 32590 xid 16A000-0001-00000002 bast
0 rseq 3 mseq 0 history 0x1495149a
  convert opt KJUSERGETVALUE
----------enqueue 0x0x17f6c90a8------------------------
lock version     : 3709
Owner node       : 0
grant_level      : KJUSERNL
req_level        : KJUSEREX
bast_level       : KJUSERNL
notify_func      : (nil)
group lock owner : 0x18ad7ab00
possible pid     : 32590
xid              : 16A000-0001-00000002
dd_time          : 74.0 secs
dd_count         : 3
timeout          : 0.0 secs
On_timer_q?      : N
On_dd_q?         : Y
lock_state       : OPENING CONVERTING
Open Options     : KJUSERDEADLOCK
Convert options  : KJUSERGETVALUE
History          : 0x1495149a
Msg_Seq          : 0x0
res_seq          : 3
valblk           : 0x00000000000000000000000000000000 .
DUMP LOCAL BLOCKER: initiate state dump for
  possible owner[362.32590]
Submitting asynchronized dump request [28]
Global blockers dump start:---------------------------------
DUMP LOCAL BLOCKER/HOLDER: block level 5 res [0x2f0029][0x10a],[TX]
----------resource 0x0x16dab1890----------------------
resname       : [0x2f0029][0x10a],[TX]
Local node    : 0
dir_node      : 1
master_node   : 1
hv idx        : 7
hv last r.inc : 6
current inc   : 8
hv status     : 0
hv master     : 0
open options  : dd
Held mode     : KJUSERNL
Cvt mode      : KJUSEREX
Next Cvt mode : KJUSERNL
msg_seq       : 0x1
res_seq       : 3
grant_bits    : KJUSERNL
grant mode    : KJUSERNL  KJUSERCR  KJUSERCW  KJUSERPR  KJUSERPW  KJUSEREX
count         : 1         0         0         0         0         0
val_state     : KJUSERVS_NOVALUE
valblk        : 0x00000000000000000000000000000000 .
access_node   : 1
vbreq_state   : 0
state         : x8
resp          : 0x16dab1890
On Scan_q?    : N
Total accesses: 75
Imm.  accesses: 63
Granted_locks : 0
Cvting_locks  : 1
value_block:  00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
GRANTED_Q :
CONVERT_Q:
lp 0x17f6c90a8 gl KJUSERNL rl KJUSEREX rp 0x16dab1890 [0x2f0029][0x10a],[TX]
  master 1 gl owner 0x18ad7ab00 possible pid 32590 xid 16A000-0001-00000002 bast
0 rseq 3 mseq 0 history 0x1495149a
  convert opt KJUSERGETVALUE
----------enqueue 0x0x17f6c90a8------------------------

metalink上查询了trace文件中很多关键字,出来都是为解决的bug信息。

因为只有这个模块会报错,所以考虑调整这个模块的性能,希望能减少死锁的发生。昨天做了如下工作:

1. 删除opttemp表内遗留的错误数据(80多万条),并在sign列上加索引
2. 在mso表上增加索引2个
       完成以上工作,update 语句的执行计划不错,希望今天不会再次出现该问题.
11/14/2008

rhel5+ocfs2安装rac时,报PROT-1错误

运行root.sh时,报如下错误:
 PROT-1: Failed to initialize ocrconfig
Failed to upgrade Oracle Cluster Registry configuration

查看$CRS_HOME/logs/hostname/client/*.log,可以看到:
 Oracle Database 10g CRS Release 10.2.0.1.0 Production Copyright 1996, 
  2005 Oracle.  All rights reserved.
 2005-07-11 12:30:29.809: [ OCRCONF][3086915264]ocrconfig starts...
 2005-07-11 12:30:29.810: [ OCRCONF][3086915264]Upgrading OCR data
 2005-07-11 12:30:29.811: [  OCROSD][3086915264]utstoragetype: 
  /ocfs/ocr_disk1 is on FS type 1952539503. Not supported.

提示不支持ocfs2做ocr和votingdisk。
ocfs2就是为rac开发的,不可能不支持,所以一定是遗漏了什么。

查看手册,原来ocfs2给redolog、dafafile、controlfile、ocr、votingdisk等使用时,需要在mount时加上datavolume选项:

mount -t ocfs2 -o datavolume /dev/emcpowera /oracluster

 

运行vipca也报错了,网上找到了解决办法:

在oracle2上执行root.sh时,会提示一个错误,关于vipca无法执行的。于是乎,我手动运行/oracle/product/10.2.0/crs/bin/vipca,结果又告诉我找不到libpthread.so.0。晕~~

你也应该遇到吧!! 别急这是个bug,我们这样来解决:

[root@oracle2 ~]vi /oracle/product/10.2.0/crs/bin/vipca
JREDIR=/oracle/product/10.2.0/crs/jdk/jre/    #把最后/的去掉,改为:

JREDIR=/oracle/product/10.2.0/crs/jdk/jre


LD_ASSUME_KERNEL=2.4.19                      

export LD_ASSUME_KERNEL                       fi                           #找到这部分,改为:

LD_ASSUME_KERNEL=2.4.19                      

export LD_ASSUME_KERNEL                       fi                      
unset LD_ASSUME_KERNEL

现在再运行vipca试试,什么?又出现个错误?

是不是类似下面的错误:

Error 0(Native: listNetInterfaces:[3])
   [Error 0(Native: listNetInterfaces:[3])]

阿弥佗佛,压住火气,这样来解决:

[root@oracle2 bin]# ./oifcfg iflist
eth1 10.0.0.0
eth0 192.168.162.0
[root@oracle2 bin]# ./oifcfg setif -global eth0/192.168.162.0:public
[root@oracle2 bin]# ./oifcfg setif -global eth1/10.0.0.0:cluster_interconnect
[root@oracle2 bin]# ./oifcfg getif
eth0 192.168.162.0 global public
eth1 10.0.0.0 global cluster_interconnect


10/30/2008

OCM过了

Dearxxx,
Congratulations! on the successful completion of the Oracle DBA 10g Certified Master practicum.
You are now a member of an elite group of Oracle professionals. You will receive your Oracle DBA 10g Certified Master fulfillment kit that includes a congratulations letter, OCM certificate, OCM ID card, and denim OCM shirt to the mailing address mentioned in your Oracle DBA 10g OCM Hands-on course requirement Form.
Address : xxxxxxxxxxxxxxxx,
Changchun City Jilin Province
China
mobile phone:xxxxxxxxxxx/ (86)0431xxxxxxxx
Shirt Size: L
Please feel free to contact the OCP team at ocpexam_ww@oracle.com if you have questions.
Kind regards,
Oracle Certification Program

10/27/2008

时区引起的agent start failed。

-bash-2.05b$ ./emctl start agent
Oracle Enterprise Manager 10g Release 10.2.0.1.0. 
Copyright (c) 1996, 2005 Oracle Corporation.  All rights reserved.
Starting agent ..... failed.
The agentTZRegion value in /u01/app/oracle/OracleHomes/agent10g/sysman/config/emd.properties is not in agreement with what agent thinks it should be.Please verify your environment to make sure that TZ setting has not changed since the last start of the agent.
If you modified the timezone setting in the environment, please stop the agent and exectute 'emctl resetTZ agent' and also execute the script mgmt_target.set_agent_tzrgn(<agent_name>, <new_tz_rgn>) to get the value propagated to repository.
Consult the log files in: /u01/app/oracle/OracleHomes/agent10g/sysman/log

-bash-2.05b$ ./emdctl validateTZ agent PST8PDT
tzOffset for PST8PDT is -480(min), but agent is runnning with tzOffset -420(min)
trying again after waiting for 1 sec to account for daylight transition
tzOffset for PST8PDT is -480(min), but agent is runnning with tzOffset -420(min)

查看sysman/config/emd.properties里面,时区设置的也是PST8PDT

可以用这个下面命令解决:

export TZ=GMT (用MDT也可以,PST8PDT不行,其他没尝试)

这时emd.properties里面的agentTZRegion=GMT,原先是PST8PDT.
emctl resetTZ agent
emctl start agent

10/14/2008

ocm考试出师不利

终于考完了ocm考试了,不过考得并不好
据老师说,ocm考试做了调整,我们是调整后的全球第一期考生。不知道是不是这个原因,第一天上午一直无法进行考试,下午才开始考,考试一直到晚上10点多才结束。
 
还是准备不足,在两个最容易的地方出了问题
1.安装图形界面时,安装程序死掉了,不相应鼠标键盘输入,看日志也没有进展
   监考老师也不能给出解决办法,只是答应向美国那边如实反应情况。
   没办法只好杀掉进程,然后用grid control自带的低版本数据库安装了grid control,但是因为时间很紧张,在收集成绩时,emrep数据库还没有建成。
   这给后续章节带来了隐患,比如后续的传输表空间因为版本兼容性无法完成(exp/expdp都无法完成)
  但是老师说,从采分点来看,这个章节我得了一半以上的分。
2.在更为容易的data guard章节,又再次遇到故障,图形界面配置dataguard失败。第二次虽然成功了,但是但是在做了一部分题目后,又出现了后台进程异常终止的问题。
这样,在三个使用图形界面的章节,grid control、rac、data gurad,除了rac完美成功外,其他都不好。
3.最郁闷的是在dw章节,居然少做了半道题,直到快结束了才发现,最后还是没有完成。不过这个章节其他题目自我感觉还不错。
 
其他章节感觉还成,但是也有没复习到的,有些没有很好理解题目意图,给的答案并不是最佳方案。
除了出问题的gc和dg章节,其他章节都在规定时间内完成了
 
 
8/1/2008

oracle10g的flashback database

需要启动flash recovery area,才能使用flashback database
在mount状态执行alter database flashback on;打开flashback database功能。
在mount状态执行flashback database to scn/timestamp语句闪回数据库。然后用resetlogs模式打开数据库。

SQL> create spfile from pfile;

File created.

SQL> startup
ORACLE instance started.

Total System Global Area  801112064 bytes
Fixed Size                  1221972 bytes
Variable Size             432016044 bytes
Database Buffers          360710144 bytes
Redo Buffers                7163904 bytes
Database mounted.
Database opened.
SQL> alter system set DB_RECOVERY_FILE_DEST_SIZE=20G scope=spfile;

System altered.

SQL>  alter system set DB_RECOVERY_FILE_DEST_SIZE=20G scope=both;

System altered.

SQL> alter system set db_recovery_file_dest=/u01/app/oracle/flash_recovery_area scope=both;
alter system set db_recovery_file_dest=/u01/app/oracle/flash_recovery_area scope=both
                                        *
ERROR at line 1:
ORA-02065: illegal option for ALTER SYSTEM

SQL> alter system set db_recovery_file_dest='/u01/app/oracle/flash_recovery_area' scope=both;

System altered.

SQL> alter database flashback on;
alter database flashback on
*
ERROR at line 1:
ORA-38759: Database must be mounted by only one instance and not open.

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

Total System Global Area  801112064 bytes
Fixed Size                  1221972 bytes
Variable Size             432016044 bytes
Database Buffers          360710144 bytes
Redo Buffers                7163904 bytes
Database mounted.
SQL> alter database flashback on;

Database altered.

SQL>

10g的recyclebin

1.启用&关闭回收站
   10gR1:_recyclebin=true/false (隐含参数)
   10gR2:   recyclebin=on/on  (常规动态参数)

2.视图  recyclebin,dba_recyclebin,user_recyclebin;

3.flashback table功能
   flashback table t1 to before drop rename to t2;

4.限制条件
    undo_management=auto
    删除user时,user下的表不会放到recyclebin中
    删除cluster时,cluster的成员表不会放到recyclebin中
    删除type时,相关的对象不会放到recyclebin中。

5.清除recyclebin中的对象。
   purge table BIN$jsleilx392mk2=293$0;
   purge table table_name;
   purge tablespace tbs1;
   purge recyclebin;( as sysdba)

7/24/2008

emagent.trc报 ERROR-400|ORA-01801,oms和agent无法通信

oms突然显示agent无法连接,查emagent.log显示启动成功,有emagent.trc产生,报如下错误:


2006-08-24 11:17:48,140 [SeverityLoad https://qehtmp08.server.ha.org.hk:3872/emd/main/] ERROR
eml.XMLLoader markFileAsError.854 - Error repeated 346 times: ERROR-400|ORA-01801: date format is
too long for internal buffer

2006-08-24 11:17:48,187 [SeverityLoad https://qehtmp08.server.ha.org.hk:3872/emd/main/] ERROR
eml.XMLLoader markFileAsError.854 - Error repeated 347 times: ERROR-400|ORA-01801: date format is
too long for internal buffer

 
可以尝试重启emrep数据库。如果不解决,给数据库打这个补丁。
3944226 RDBMS Server: Patch
APPSST: ORA-01801: DATE FORMAT IS TOO LONG FOR INTERNAL BUFFER
7/10/2008

分区表主键如何使用分区索引?

主键索引失效,rebuild太慢了
打算建立分区索引时才意识到以前没做过这样的工作
表是在添加primary key时自动生成的索引,并不会进行分区
于是查资料,找到这篇文章
文章中心就一句话:现在需要建立主键的列上创建一个分区索引,然后添加主键,oracle会自动选用这个索引作为主键的索引。
 
PURPOSE  
   This article gives examples of how to create primary key partitioned  
   indexes.  
   
SCOPE & APPLICATION  
   For users trying to create primary key partitioned indexes.  
   
   
How To Create Primary Key Partitioned Indexes:  
==============================================  
   
Example:  
   
SQL> -- Create partitioned table TEST_A  
SQL>  
SQL>  CREATE TABLE test_a (col1 number, col2 number, col3 varchar2(20))  
   2   PARTITION BY RANGE (col1, col2)  
   3   (partition part_test_a_1 values less than (10, 100),  
   4    partition part_test_a_2 values less than (20, 200),  
   5    partition part_test_a_3 values less than (30, 300),  
   6    partition part_test_a_4 values less than (40, 400));  
   
Table created.  
   
   
SQL> -- Create partitioned table TEST_B  
SQL>  
SQL>  CREATE TABLE test_b (col1 number, col2 number, col3 varchar2(20))  
   2   PARTITION BY RANGE (col1, col2)  
   3   (partition part_test_b_1 values less than (10, 100),  
   4    partition part_test_b_2 values less than (20, 200),  
   5    partition part_test_b_3 values less than (30, 300),  
   6    partition part_test_b_4 values less than (40, 400));  
   
Table created.  
   
   
SQL> -- Create a non-unique local partitioned index, IX_TEST_A,  
SQL> -- on TEST_A  
SQL>  
SQL>  CREATE INDEX ix_test_a ON test_a(col1, col2)  
   2   LOCAL  
   3   (partition ix_test_a_1,  
   4    partition ix_test_a_2,  
   5    partition ix_test_a_3,  
   6    partition ix_test_a_4);  
   
Index created.  
   
   
SQL> -- Create a unique global partitioned index, IX_TEST_B,  
SQL> -- on TEST_B  
SQL>  
SQL>  CREATE UNIQUE INDEX ix_test_b1 ON test_b(col1, col2)  
   2   GLOBAL PARTITION BY RANGE (col1, col2)  
   3   (partition ix_test_b1_1 values less than (20, 200),  
   4    partition ix_test_b1_2 values less than (maxvalue, maxvalue));  
   
Index created.  
   
   
SQL> -- Add a primary key constraint, PK_TEST_A, to TEST_A  
SQL>  
SQL> ALTER TABLE test_a ADD CONSTRAINT pk_test_a  
2    PRIMARY KEY (col2, col1);  
   
Table altered.  
   
   
SQL> -- Attempt to drop index IX_TEST_A; note the following error...  
SQL>  
SQL> DROP INDEX ix_test_a;  
drop index ix_test_a  
*  
ERROR at line 1:  
ORA-02429: cannot drop index used for enforcement of unique/primary key  
   
   
SQL> -- Attempt to create a second index, IX_TEST_B2 on TEST_B  
SQL> -- using the same columns used to partition IX_TEST_B1.  
SQL> -- Note the following error...  
SQL>  
SQL>  CREATE INDEX ix_test_b2 ON test_b(col1, col2)  
   2   LOCAL;  
create index ix_test_b2 on test_b(col1, col2)  
                 *  
ERROR at line 1:  
ORA-01408: such column list already indexed  
   
   
SQL> -- Add a primary key constraint, PK_TEST_B, to TEST_B  
SQL>  
SQL>  ALTER TABLE test_b ADD CONSTRAINT pk_test_b  
   2   PRIMARY KEY (col1, col2);  
   
Table altered.  
   
   
SQL> -- Attempt to drop index IX_TEST_B1; note the following error...  
SQL>  
SQL> DROP INDEX ix_test_b1;  
drop index ix_test_b1  
*  
ERROR at line 1:  
ORA-02429: cannot drop index used for enforcement of unique/primary key  
   
   
SQL> -- A listing of the indexes and their associated partitions.  
SQL>  
SQL>  SELECT index_name, partition_name, status  
   2   FROM user_ind_partitions  
   3   ORDER BY index_name, partition_name;  
   
INDEX_NAME     PARTITION_NAME  STATUS  
-----------    --------------- --------  
IX_TEST_A      IX_TEST_A_1     USABLE  
IX_TEST_A      IX_TEST_A_2     USABLE  
IX_TEST_A      IX_TEST_A_3     USABLE  
IX_TEST_A      IX_TEST_A_4     USABLE  
   
IX_TEST_B1     IX_TEST_B1_1    USABLE  
IX_TEST_B1     IX_TEST_B1_2    USABLE  
   
6 rows selected.  
   
   
SQL> -- Drop the primary key constraint from TEST_A  
SQL>  
SQL> ALTER TABLE test_a DROP CONSTRAINT pk_test_a;  
   
Table altered.  
   
   
SQL> -- Drop the primary key constraint from TEST_B  
SQL>  
SQL> ALTER TABLE test_b DROP CONSTRAINT pk_test_b;  
   
Table altered.  
   
   
SQL> -- A listing of the indexes and their associated partitions.  
SQL> -- Note that while IX_TEST_A, the non-unique local partitioned  
SQL> -- index, remains and has a status of USABLE.  
SQL> -- IX_TEST_B, the unique global partitioned index, has been  
SQL> -- dropped.  
SQL>  
SQL>  SELECT index_name, partition_name, status  
   2   FROM user_ind_partitions  
   3   ORDER BY index_name, partition_name;  
   
INDEX_NAME       PARTITION_NAME                 STATUS  
---------------  --------------                 --------  
   
IX_TEST_A        IX_TEST_A_1                   USABLE  
IX_TEST_A        IX_TEST_A_2                   USABLE  
IX_TEST_A        IX_TEST_A_3                   USABLE  
IX_TEST_A        IX_TEST_A_4                   USABLE  
   
   
The primary key uses the underlying index if the index is built using   
the same columns as defined in the primary key.  This is consistent   
without regard to whether the index was created as a unique or non-unique  
index, or if it is a global or local partioned index.  It is important   
to note that while in the example a primary key was established on a   
non-unique index, this will only occur if the values within the index   
are in fact unique.  Attempting to enable a primary key constraint when   
duplicate values are present within the index will result in the   
following error:  
   
"ORA-02437: cannot enable (STEELY.PK_TEST_B) - primary key violated."  
   
Two indexes cannot be created using the same ordered columns.  This was  
demonstrated above when attempting to create a second index on table   
TEST_B.  This resulted in the following error:   
   
"ORA-01408: such column list already indexed."   
   
However, changing the order of the columns will permit the creation of   
additional indexes using the same columns.  
   
Contrary to the previous note, the column order for index IX_TEST_A and   
the definition for the primary key PK_TEST_A were reversed. Yet the   
primary key still used IX_TEST_A as the underlying index.  
   
When dropping a primary key constraint from a table, the corresponding   
index is also dropped if the index was created as a UNIQUE index. This   
behavior is consistent for both LOCAL as well as GLOBAL partitioned   
indexes.  
   
To receive the full benefits of partitioning, users/DBA must use the   
STORAGE clause when creating partitioned tables/indices. 
6/27/2008

oms10.2.0.1+rhel4遇到bug,报ora-14400

事情过去了,日志没有了,简单记录一下:
metalink一下,是oracle的bug,按要求分析了sysman,重新整理了partitiion,也不行。
ora-14400是解决了,但是其他的问题接种而来。
metalink了一下没有信息,应用服务器分析起来太复杂,干脆把gridcontrol升级到10gR3了。
 

informatica:pcsf_46008

informatica安装完成好几天了,最近太忙,一直没用。
今天yyfx系统培训的时候LHM说pc的power designer无法连接服务器,报如下错误:
Unable to get repositories for domain Domain_jl2
Error:【PCSF_46008】Cannot connect to domain[Domain_jl2]to
look up service[coreservices/DomainConfigurationService].

尝试配置一下,和LHM遇到的错误一样。查到一篇文章http://www.dwway.com/bbs/showthread.php?t=20289,看了看没什么帮助。google了一下国外的文章,也没解决问题。只是知道了这个错误号一般和网络之类的问题有关。

检查windows firewall、网络端口等,都没有问题。
按理说市场占有率这么高的产品,不应该出这么低级的错误啊 ,正抓狂呢

发现原来hosts文件写的不对,informatica要求hosts里制定的服务器主机名必须和服务器真实主机名一致,而不是随便写一个,解析出IP就可以。

host改成 10.*.*.* jl2,搞定。

5/13/2008

当爹了

2008年5月5日9:20分,成功升级老婆给我生了一个9斤2两的男孩

 

 出生一小时

出生一小时.

 

 出生第三天

 出生第四天

 

 出生第五天

2/27/2008

importvg 时,cfgmgr无法找到pv id

Oa系统安装时遇到的现象
aix+fastT。
2号机:imporgvg报错(过去太久了,不记得错误号了),然后rmdev -dl hdisk3,再执行cfgmgr,输出正常。

lspv发现已经找到hdisk3,不过没有现实pvid。尝试多次仍然不成功。后无意中发现cfgmgr找到pvid了。一直没找到原因。

现在知道了,因为1号机当时vg没有正常varyoff,导致vg被锁,所以2号机cfgmgr得不到pv id。只要在1号机重新varyonvg,再varyoffvg,2号机就正常了。

Character Semantics and Globalization ----9i的一个新特性,一直没注意过。。。

内容摘要:
9i以前,字符类型长度最终转换成一定数量的bytes。这带来一个问题就是对于不同语言,比如英语和汉语,同一个字段可存储的字符数不同。
为了解决这个问题,9i引入了以下三种varchar2的定义方式。

  1. VARCHAR2(20)
  2. VARCHAR2(20 BYTE)
  3. VARCHAR2(20 CHAR)

1表示使用NLS_LENGTH_SEMANTICS 参数指定的varchar2定义方式(默认是byte)
2表示定义varchar2时,长度使用byte,不管这个列能存储多少个字符。例子中,如果存ascii码能存20,存中文只能存10个。
3表示定义varchar2时,长度使用char,不管这些字符是由多少bytes组成的。例子中,不管ascii还是unicode,都能存20个。当然最后占用的byte是不一样的。

这些特性对char,nvarchar2,nchar同样适用

需要特别提一下,substr,length,instr对unicode有不同版本。使用时需要注意。

文中还特别提到,如何在byte  semantics 和character semantics 中切换一个schema的数据,步骤如下:

  • Export the schema.
  • Issue an ALTER SYSTEM SET NLS_LENGTH_SEMANTICS=CHAR SCOPE=BOTH command on the target database.
  • Stop and restart the instance so that the parameter change takes effect.
  • Drop the original schema.
  • Recreate the original schema and its tables (you can use import's show=Y option to get the CREATE TABLE statements). Columns in the recreated tables will use character semantics, because that's now the default.
  • Import the schema into the target database using the IGNORE=Y import option.
  • ******************************************************

    Technology SQL

    Globalize with Character Semantics

    By Jonathan Gennick

    Character semantics help enable globalization and enhance code portability.

    -------------------------------------------------------------------------------------------------------------------------

    Globalization is a big word that refers to the practice of developing applications that work seamlessly across languages and cultures. The need for such applications is growing, driven in part by ever-larger transnational corporations and in part by a global internet that makes it possible for a user in, say, Iqaluit to run an application against a database that might be hosted in Dnipropetrovs'k.

    One of the first issues you run up against when building a global application is the need to represent characters from more than one language. Ukrainians, for example, might prefer to see Dnipropetrovs'k in its Cyrillic form. When you develop an application to support multiple languages, it's increasingly likely that you'll end up using a multibyte character set. Unicode UTF-8, or one of the other Unicode character sets, is a likely choice.

    Working with multibyte character sets can present some special challenges, especially if, like me, you've grown up using single-byte character sets such as US7ASCII. Look no further than Listing 1 for an example of what you might run into when you take an application developed under the implicit assumption of a single-byte character set and port it to a Unicode UTF-8 environment.

    Listing 1 shows two different lengths for an ostensibly fixed-length character string. If you're used to thinking of CHAR variables (or database columns) as fixed-length strings, you'll need to readjust your world view. Why? Because there's a disconnect between characters and bytes, which I'll be exploring throughout this article. I'll also introduce Oracle9i's new support for character semantics. Seemingly simple on the surface, character semantics eliminate this disconnect and can make it tremendously easy to convert existing applications and database schemas to use multibyte character sets.

    Bytes Versus Characters

    Is "a" a byte or a character? Is there a difference? In the western world, with our simple alphabets and single-byte character sets, we've long been accustomed to thinking of bytes and characters as being one and the same. We often don't distinguish between the two as we should. We look at a declaration such as CHAR(3), and we see that as a three-character string. But there is a distinction to be made: a byte is a unit of storage, whereas a character is a symbol used in a language or system of writing. The declaration of CHAR(3) shown in Listing 1 resulted in a 3-byte string, which may or may not hold three characters.

    Working with multibyte character sets when your declarations and string functions all operate in terms of bytes can be a bit of a challenge. Listing 1, for example, was generated on a database that used Unicode UTF-8 (AL32UTF8) as the database character set. The variable x was declared as CHAR(3), which resulted in an allocation of three bytes. When the single-byte value a was assigned to x, the other two bytes were padded with spaces (a space is also a single byte), and thus the resulting string was three characters long. When the two-byte character was assigned to x, only one byte remained to be padded with a single space. The result? A two-character-long string that happened to be using three bytes of storage.

    Character Semantics

    Recognizing the confusion surrounding bytes versus characters, Oracle formalized the distinction between byte and character semantics when it released Oracle9i Database. Rather than being forced to declare strings in terms of bytes and then work with them in terms of characters, you can choose whether to declare strings in terms of characters or bytes. You can write declarations such as the following:

    x CHAR(3 BYTE)
    x CHAR(3 CHAR)
    

    The first of these declarations explicitly declares x as a 3-byte CHAR variable (or it could be a database column). The second explicitly declares x as a three-character CHAR variable. How much storage will be allocated for those three characters? That depends on the underlying character set. The general rule is that Oracle9i Database will look at the maximum number of bytes per character used by the underlying character set and will multiply that value by the number of characters specified in your declaration. In the case of Unicode UTF-8, three bytes will be allocated for each character, so a declaration of CHAR(3 CHAR) results in an allocation of nine bytes.

    Declaring a variable or column in terms of bytes is referred to as using byte semantics. Declaring a variable or column in terms of characters is referred to as using character semantics.

    The BYTE and CHAR qualifiers can also be applied to VARCHAR2 declarations:

    x VARCHAR2(3 BYTE)
    
    x VARCHAR2(3 CHAR)
    

    However, you cannot specify the BYTE and CHAR qualifiers for NCHAR and NVARCHAR2 declarations. Neither of the following declarations is valid:

    x NCHAR(3 BYTE)
    x NVARCHAR2(3 CHAR)
    
    

    In Oracle9i Database, declarations of NCHAR and NVARCHAR2 variables and columns are always in terms of characters. Thus, there's no need for the BYTE and CHAR qualifiers in such declarations.

    Why Bother?

    If a declaration of CHAR(3 CHAR) results in an allocation of nine bytes when using Unicode UTF-8 as the database character set, why not use CHAR(9 BYTE) or simply CHAR(9)? Are there reasons to bother with character semantics and the CHAR qualifier? The answer is yes; I think there are some compelling reasons to use character semantics. In fact, I'd go so far as to argue that you should use character semantics as your default allocation method.

    When working with character strings, you do almost everything in terms of characters. In the western world, when you declare a string as CHAR(3), you usually do that because you want to put three characters into it. When you compute the length of a string, it's usually to find the number of characters in it. When you take the substring of a string, you want a substring of complete characters; you don't want only part of a multibyte character. When you search a string to see whether it contains a substring, you are typically looking for a substring of characters, not of random bytes. Given all this, it makes sense to extend the concept of working with characters all the way back to the beginning, to the initial declaration of the string.

    Using byte semantics, when you move an application from US7ASCII to UTF-8 in order to support characters from different languages, your CHAR(3) strings may or may not hold three characters, depending on which three characters you happen to be storing at any given time. Under those circumstances, your application will likely fail in short order. You would then need to go through all your PL/SQL source code and all your CREATE TABLE statements and adjust all of your character string declarations to accommodate the new character set. That's not only a huge amount of unnecessary work, it's also a huge opportunity to make mistakes, thereby introducing bugs into what used to be a working application.

    There's a better way: declare character variables using character semantics rather than byte semantics. A declaration of CHAR(3 CHAR) will support a maximum of three characters regardless of which character set you end up using. A CHAR(3 CHAR) variable will hold three characters when you use US7ASCII, and it will still hold exactly three characters when you convert your application to Unicode UTF-8. Thus, using character semantics greatly increases the portability of your applications and your database schemas.

    The issue of exact length is an interesting one. A declaration of CHAR(3 CHAR) will always support a maximum of three characters, regardless of the number of bytes used to represent those characters. Use a declaration of CHAR(9 BYTE) to allow for up to three Unicode UTF-8 characters, and you'll find that the string will often hold more than three characters. Listing 2 illustrates this. Whether this is a problem or not depends on your application. It's more of a problem with CHAR variables than with VARCHAR2 variables, because CHAR variables are always padded with spaces to fill out their maximum length. Thus, when mixing byte semantics with multibyte character sets, CHAR variables suddenly appear to be variable-length. Using character semantics eliminates all that confusion. Listing 3 uses character semantics to declare x as a fixed, three-character string. The underlying character set is still UTF-8, but you really don't need to be concerned with knowing that. Using character semantics guarantees you a three-character string regardless of character set, so the string is consistently padded to exactly three characters, not bytes, in length.

    Length Semantics and String Functions

    Oracle supports several built-in functions that operate on characters within a string. These functions are:

    • INSTR. Searches a string for a specified sequence of characters.
    • LENGTH. Returns the number of characters in a string.
    • SUBSTR. Returns a specified portion, or substring, of a string.

    Your choice of character or byte semantics affects only the declaration of a PL/SQL variable or a database column. Regardless of how you declare a variable or a column, in Oracle9i the INSTR, LENGTH, and SUBSTR functions always operate in terms of characters. You've seen this already in the operation of the LENGTH function. In Listings 1, 2 and 3, LENGTH always returned the number of characters in the string—never the number of bytes. Listing 4 provides an even more comprehensive example of how these functions operate. UTF-8 is still the character set. The string ãa is two characters long but consumes three bytes because ã is a two-byte character in UTF-8. The INSTR function finds the letter a in the second character position, even though the bytecode for that letter occupies the third byte. As before, LENGTH returns the number of characters in the string (2). SUBSTR(x,1,1) actually returns two bytes of the string, because the first character happens to be a two-byte character.

    It's good that INSTR, LENGTH, and SUBSTR operate in terms of characters. You can take an application using these functions and install that application on a database using a different character set—it doesn't matter what that character set is—and all your application's calls to these functions will still provide sane, sensible, and correct results.

    There are times, however, when you do actually need to work with strings as sequences of bytes rather than characters. For this reason, Oracle provides the functions INSTRB, LENGTHB, and SUBSTRB, which are shown in Listing 5. Note the suffix B on all these function names, which indicates that these functions operate in terms of bytes, not characters. Other than this difference, the three functions are identical to their non-B counterparts.

    Character Semantics Default

    If all Oracle did was add the ability to use CHAR(3 CHAR) rather than CHAR(3), that would be good, but you'd still have your work cut out for you when converting existing applications and schemas to UTF-8 or some other multibyte character set. Instead of being faced with the task of expanding CHAR(3) to CHAR(9), you'd be faced with the equally dismal task of changing all CHAR(3)s to CHAR(3 CHAR)s. Fortunately, Oracle9i Database provides the ability to set the default character semantics on either the session or instance level using the NLS_LENGTH_SEMANTICS parameter.

    To convert an existing schema and its associated data from byte semantics and a single-byte character set to character semantics and a multibyte character set, such as UTF-8, you need only follow these steps: [The following steps have been corrected since the magazine was printed.]

    1. Export the schema.
    2. Issue an ALTER SYSTEM SET NLS_LENGTH_SEMANTICS=CHAR SCOPE=BOTH command on the target database.
    3. Stop and restart the instance so that the parameter change takes effect.
    4. Drop the original schema.
    5. Recreate the original schema and its tables (you can use import's show=Y option to get the CREATE TABLE statements). Columns in the recreated tables will use character semantics, because that's now the default.
    6. Import the schema into the target database using the IGNORE=Y import option.

    Because step 2 changed the default length semantics from byte semantics to character semantics, any CHAR or VARCHAR2 declarations encountered during the import will be interpreted as if the CHAR qualifier was specified. For example, CHAR(3) will be interpreted as CHAR(3 CHAR). The ability to set the default-length semantics on an instance-wide or session basis enables you to easily convert existing schema definitions or PL/SQL code to use character semantics without the need to tediously go through and add the CHAR qualifier to all your declarations.

    Note: This process applies only to schemas composed entirely of tables. If your schema includes stored PL/SQL code, you'll need to recompile all that code to use character semantics. If your schema includes object types, you should precreate those types in step 5. Be sure to run a test conversion before attempting to convert a production schema.

    Next Steps

    READ
    about Unicode
    unicode.org

    You can check the current value of NLS_LENGTH_SEMANTICS at any time by querying the NLS_INSTANCE_PARAMETERS and NLS_SESSION_PARAMETERS views. Changing the ?arameter does not affect any existing column or variable definitions. Columns declared using byte semantics will not be changed simply by changing the parameter. The parameter affects only new column or variable definitions.

    Be aware that converting a schema to use a multibyte character set may involve more work than simply rebuilding the schema and recompiling any PL/SQL code to use character semantics. For example, you'll need to look at any external programs, such as those written in C++ or Java, because they may need to be adjusted to handle the multibyte data now coming from the database. Due diligence is still required.

    The NLS_LENGTH_SEMANTICS parameter gives you the option of switching to character semantics globally or on a column-by-column basis. To introduce character semantics on a column-by-column basis, leave NLS_LENGTH_SEMANTICS at its default value of BYTE, and use the CHAR qualifier when declaring variables and columns. Change the default when it makes sense to make a wholesale change—for example, when you are developing a brand-new schema and application.

    Conclusion

    Newly introduced in Oracle9i Database, character semantics makes it much easier than before to work with multibyte character sets. No longer must you declare variables and columns in terms of bytes and then try to keep straight the number of characters such variables and columns will hold. Using character semantics eliminates that confusion by allowing you to work consistently in terms of characters.

    Jonathan Gennick (Jonathan@Gennick.com) is an experienced Oracle DBA and an Oracle Certified Professional. He likes to explore new Oracle technologies and recently completed work on the Oracle SQL*Plus Pocket Reference, Second Edition (O'Reilly & Associates, 2002).

    UNICODE STRING FUNCTIONS

    There are variations of the INSTR, LENGTH, and SUBSTR functions designed specifically for working with Unicode. Looking at the LENGTH function, you'll find the LENGTHC, LENGTH2, and LENGTH4 functions for Unicode.

    These functions distinguish between Unicode characters, Unicode code points, and Unicode code units. A code point is the numeric value corresponding to an entry in a Unicode encoding table, and often, but not always, to a Unicode character. For example, 0x00E3 is the code point for the letter "ã". However, that same letter can also be expressed using the code point 0x0061 (for "a") followed by the code point 0x0303 (for "˜").

    The standard LENGTH function will interpret code point 0x0061 followed by code point 0x0303 as two separate characters. The LENGTHC function, because it is designed for use with Unicode, will recognize that in Unicode, 0x0061 followed by 0x0303 really represents just one character.

    The term code unit refers to the actual representation of a Unicode code point. For example, the UTF-8 representation of the code point 0x0061 is the single byte 0x61. That one byte is a code unit. The UTF-16 representation of 0x0061 is the two bytes 0x0061, and those two bytes form one code unit. Sometimes a single code point is large enough that it needs to be represented as multiple code units. For example, the code point 0x1D11E, which represents the musical symbol G-clef (available at http://www.unicode.org/charts/PDF/U1D100.pdf), is represented in UTF-16 using two code units: 0xD834 followed by 0xDD1E. Neither value by itself is a code point. Only together do these two code units represent a single code point.

    The LENGTH2 and LENGTH4 functions enable you to distinguish between code units and code points. LENGTH2 returns the number of code units in a Unicode string. LENGTH4 returns the number of code points in a Unicode string.

    The Unicode function variants of the INSTR and SUBSTR function families parallel the Unicode variants of the LENGTH function. Just as there are LENGTHC, LENGTH2, and LENGTH4 Unicode functions, there are also INSTRC, INSTR2, INSTR4, SUBSTRC, SUBSTR2, and SUBSTR4 Unicode functions.

    1/16/2008

    aix5.3+hacmp5.3配置过程中遇到的几个问题

    1.共享的vg,需要在建立的时候选择concurrent 兼容模式。建立完成后,需要能使用varyonvg -c oravg在两边同时能挂载。否则会出现哪边ha先启动,vg就被后启动的ha里面的varyonvg命令踢掉的情况。

    2.oravg在oadb1创建后,在oadb2上import时,需要制定和oadb1上一样的major number。否则同步时会报错。

    3.同步时报错

    ERROR: Service adapter oadb1_serv on network net_ether_01 is on the same subnet as at least one of the communication interfaces on this network.Service labels must be on a different subnet when the network is configured
    根据错误提示,boot ip和service ip不能在同一个网段。
    google之,发现使用IP Aaddress Takeover via alias方式时,boot和service不能在同一个网段;而使用5.1以前的传统方式IPAT va Rep,boot和service就没有这个限制。
    在smitty hacmp--->Extended Configuration--->Extended Topology Configuration--->Configure Hacmp Networks--->Change/Show a Network in the Hacmp Cluster选项里,把Enable IP Address Takeover via IP Aliases改成no,再同步就没问题了。

    12/25/2007

    遭遇 Oracle 中国“最严重”故障

    20号晚上,加完班刚到家,就接到了一个来自吉林的电话,说数据库起不来了。

    据了解,数据库为920X,hp-ux,rac
    据说是hpux突然找不到vg,然后hp的工程师又手工恢复了vg信息。

    但是数据启动报错,提示ora-201,ora-202,ora-210的意思是控制文件和oracle不兼容
    出现这个问题有两个原因:
    1.compitible参数设置错误
    2.控制文件损坏
    尝试从spfile里面创建pfile,结果pfile为空。进一步判断spfile损坏了。
    寻找建库时使用pfile,启用数据库,错误一样。分别使用不同的控制文件,也同样是这两个错误。

    因为控制文件没有备份,好在alert是完整的,于是从alert里提取数据库的文件名称,手工创建controlfile,结果发现回滚表空间的数据文件无法加到控制文件中,用dbv验证,证实这两个文件已经损坏了。同时损坏的还有一些其他的数据文件。

    去掉这些文件,创建控制文件成功,用新控制文件启动数据库,open数据库时,提示需要media recovery。因为回滚表空间已经坏了,media recovery已经变成了 mission impossible了。

    因为控制文件和回滚表空间同时损坏,这个数据库要修复已经很难了。

    能想到的就是加_corrupt_rollback_segments参数强制打开数据库,然后尝试exp数据了。

    因为责任原因,这个操作负责这个系统的工程师不敢尝试。

    最后oracle派了现场工程师,不过好像到目前未知,结论是一样的。现在正在搭建临时环境,恢复10月份的数据,并把故障库的裸设备进行备份,备份成功后,才能尝试强制打开数据库。

    事已至此,已经没什么说的了。不过还是要从故障为什么发生中学到点什么吧。
    这次故障,是由于没有给阵列划分zone,导致某厂家(dt)的技术人员在工作时,没有使用划分给他的磁盘,而使用了oravg的磁盘导致的。这个vg是oracle建库时使用的,redolog,unto、control、spfile、默认表空间等都在这个vg上。

    据说这是oracle在国内遇到的最严重的一次故障......

    10/23/2007

    XManager远程登录Red Hat Enterprise Linux ( RHEL3 )

    XManager远程登录Red Hat Enterprise Linux ( RHEL3 ) 1 打开 /etc/inittab文件,将 runlevel 变为5, 即id:5:initdefault: 如果原来就是5,则不用修改。 2 打开 /etc/X11/gdm/gdm.conf文件 找到 [xdmcp] 部分,将 Enabled 选项设为true或1。 Enable = 1 3.关闭防火墙。 4.gdm-restart
    10/18/2007

    rhel 重新配置分辨率

    vmware:一开始尝试用rhel自带的工具修改分辨率,不成功。尝试修改/etc/XFreeConfig,也不行。

    查了一堆文档,也没解决。后来发现运行一下vmware tools自带的vmware-config-tools.pl,重新配置x就可以了

    在第二块硬盘上安装了rhel3asu8.同样只能使用800×600×16位色或者1024×768×256色。用得我这个郁闷啊

    无论怎么调整都不行。后来发现原来是限制默认的集成显卡现存为1m了,根本支持不了更高的分辨率,修改后,使用redhat-config-xfree68配置就可以了。想想在vmware里使用这个命令无法提高分辨率应该也是同样的原因。

    10/11/2007

    aix上c程序的内存限制

    aix上c程序编译的时候,默认是有内存使用限制的。如果程序使用内存很大,有些程序会报类似内存不足,然后产生core dump。
    至于什么样的程序报错,什么样的程序不报错就不知道了。
    可以通过给cc编译器增加参数的方式修改内存限制,参数为 cc -.....  -q maxmem=-1
    -1表示没有限制。

    Visual Age C++ compiler reference.pdf

    今天zf问我的这个问题,让我想起来刚参加工作的时候(不记得是02年末还是03年初了),我们作为服务商,进行系统和数据库的安装;dt负责应用程序开发。
    当时就遇到了这个问题,我和齐哥在现场。分析问题时,无非系统、数据库、或者应用的问题。可是因为客户和dt现场人员关系比较好,无论我们怎么分析问题、怎么解释,客户都认为问题出在我们这里,而dt没有问题,其实dt的理由只有一条:同样的程序在其他地市的机器上运行正常,所以在这里有问题,就不会是程序的问题。。折腾了大概有1周多,也没解决问题,我甚至找同学专门写了一个大量分配内存的c程序,也运行正常。
    期间客户多次给我们老总打电话,投诉我们两个,说我们俩技术不行,让公司把我们撤回来,最后我们两个部门的经理都到了现场协调关系,但是并没有让我们撤走。
    最后还是我们帮dt找到问题的原因,加了这个参数就好了。
    虽然问题解决了,可是我们背了那么久的黑锅并没拿下来,报告写得轻描淡写,客户的上级单位(其实也是我们的上级单位)看到报告后甚至都不知道问题其实并不出在我们这里,只是觉得事情过去了,没有必要再追究而已。

    Unable to access Cluster API when upgrade to 9204 on linux Itanuim


    Please check the following:
    1)You are installing the Oracle9i patch set 9.2.0.4.0 on an Oracle Real Applications Clusters environment,then you must install the Oracle Universal Installer 2.2.0.18.0 on all nodes on
    the cluster before installing the patch set.
    2) If the Oracle Universal Installer was installed with the base release of Oracle9i, then create the following symbolic link
    % cd $ORACLE_BASE/oui/bin/linux
    % ln -s libclntsh.so.9.0 libclntsh.so
    Also check the size of the libclntsh.so.9.0 on both nodes.
    3) Check the size of the file svrm.jar. For example:
    $ORACLE_HOME/jlib
    -rw-r--r-- 1386814 Aug 4 04:05 srvm.jar
    4) Make sure you are using Oracle Universal Installer 2.2.0.18.0. from the ORACLE_HOME/oui
    directory.
    5) Make sure JRE 1.4.2 is available on your system.
    6) Check if ORACM on the clusters are running.
    7) Check if lsnodes can be executed without any problem
    When the above is correct, you can press the continue button instead of cancel, and you will able
    to patch your RAC environment without any problem.

     

    step 7,lsnodes failed in graphical mode,but successed in SecureCRT.
    both mode using the same .profile
    then check the output of command :$env
    I found that there was no "LD_LIBRARY_PATH=/u01/app/oracle/product/9.2.0/db_1/lib" in xmanager.
    try $export LD_LIBRARY_PATH=/u01/app/oracle/product/9.2.0/db_1/lib
    then upgrading successed.

    ora-444 ora-7446


    SQL> startup nomount

    pfile="/u01/app/oracle/admin/orc/scripts/init.ora";
    ORA-00444: background process "LMD0" failed while starting
    ORA-07446: sdnfy: bad value '' for parameter .


     


     进程无法读写bdump、cdump、udump、alert.log会导致这个问题asfd
    cd $ORACLE_BASE/admin/sid
    mkdir bdump cdump udump

    aix下查找硬盘型号

    lscfg -vl hdisk0

    aix-lscfg-hdisk

    lscfg命令可以看到硬盘容量368400mb,FRU、PART NUMBER等信息。据此可以准备备件。

    查看配置试用prtconf

    aix-prtconf1
    aix-prtconf2

    在Itanium平台rhel上如何升级到9208

    摘自README

    Linux Itanium

    How to install Oracle RDBMS version 9.2.0.8

    To install 9.2.0.2 and then 9.2.0.8 on Linux Itanium, do the following :
    [1]. Set the environment variable LD_ASSUME_KERNEL=2.4.19

    [2]. Download Patch 5390952 and run the supplied OUI to install Montecito JDK and JRE into the new 9.2 home

    • Unzip the patch
    • Start OUI from Patch 5390952 and install JDK into the new 9.2 home
    • Start OUI from Patch 5390952 and install JRE into the new 9.2 home
    • Download the 9.2.0.2 RDBMS CD's to local disk - the CD's should be unzipped at the same directory level and be called "Disk1", "Disk2" etc.
    • Edit <path>/Disk1/install/linux/oraparam.ini and change JRE_LOCATION to point to $ORACLE_HOME/jre/1.4.2

    [3]. Install 9.2.0.2 into the new 9.2 home by running OUI (./runInstaller) from <path>/Disk1

    [4]. At the root.sh stage, do the following before running root.sh :

    • Change directory to the ORACLE_HOME
    • Run the command "rm JRE" to remove the symbolic link
    • Run the command "ln -s $ORACLE_HOME/jre/1.4.2 JRE" to link the JRE to the Montecito JRE installed in step 2
    • Run the commands "cd $ORACLE_HOME/jre/1.4.2/bin" and then the command "ln -s java jre"

    [5]. Run root.sh

    [6]. Start OUI from the 9.2.0.8 patchset (Patch 4547809) with jreLoc option

    ./runInstaller -jreLoc $ORACLE_HOME/JRE/