RMAN和数据库管道(PIPE)
Posted on March 21, 2010 - Filed Under Database | Leave a Comment
数据库管道(PIPE)是一种多SESSION间传递消息的机制,可以通过包DBMS_PIPE进行消息的发布和接收,主要用作外部服务消息接口,也可以用于多个独立进程之间的通讯。在Oracle EBS环境中,MRP的计算过程就用到了数据库管道技术。RMAN也可以通过数据库管道进行操作,通过管道接口,可以直接使用PL/SQL来操作RMAN行为并获得输出结果。通过数据库管道技术,可以设计出基于RMAN的第三方备份、恢复管理系统。 用于RMAN的必须是私有管道,这是出于安全考虑。私有管道有如下限制: 各SESSION用户(USERID)必须和管道创建者一致 存储过程的执行权限和管道创建者(USERID)一致 用户必须通过SYSDBA角色连接到数据库 RMAN拥有两个私有管道,一个用于接收,一个用于发布。在启动RMAN时可以通过PIPE参数指定管道名称(此处为ABC),比如: [oradba@localhost ~]$ rman PIPE ABC TARGET / TIMEOUT 60 Recovery Manager: Release 11.2.0.1.0 – Production on Sun Mar 21 16:43:28 2010 Copyright (c) 1982, 2009, Oracle and/or its affiliates. All rights reserved. 该进程会等待DBMS_PIPE传入指令,如果60秒后无任何指令传入,则自动退出。若不加TIMEOUT参数,则RMAN会一直等待指令传入。 RMAN会自动打开两个私有管道,ORA$RMAN_ABC_IN和ORA$RMAN_ABC_OUT,前者用于接收消息,后者用于发布消息,消息类型都是VARCHAR2。第一次启用时,RMAN会自动初始化这两个管道,如果需要在启动RMAN之前就存入指令,则需要首先手工使用DBMS_PIPE.CREATE_PIPE创建管道。 l_status := dbms_pipe.create_pipe(pipename =>l_pipename,private => true); private 参数必须为true,否则默认会创建公共管道,无法用于RMAN。 发布指令到RMAN: DECLARE l_status INT; BEGIN dbms_pipe.pack_message(‘show [...]
connect by
Posted on February 24, 2009 - Filed Under Database | Leave a Comment
对于层级结构的数据,connect by是个非常好用的东西。今天在查询组织层次结构的时候(根据一个部门列出所有下属部门)发现里面还有个小陷阱。原始的语句如下: SELECT pos.organization_id_child, pos.d_child_name, pos.organization_id_parent, pos.d_parent_name, LEVEL, sys_connect_by_path(pos.d_child_name, ‘/’) path FROM per_org_structure_elements_v pos WHERE pos.org_structure_version_id = 65 — 注意这里 START WITH pos.organization_id_child = 133 CONNECT BY PRIOR pos.organization_id_child = pos.organization_id_parent; 由于组织层次结构有版本控制,所以这里使用WHERE条件筛选当前的层次结构,但是结果中却出来很多同样level的重复数据。尝试换用如下SQL: SELECT pos.organization_id_child, pos.d_child_name, pos.organization_id_parent, pos.d_parent_name, LEVEL, sys_connect_by_path(pos.d_child_name, ‘/’) path FROM (SELECT * FROM per_org_structure_elements_v p WHERE p.org_structure_version_id = 65) pos START WITH pos.organization_id_child [...]
ORA-00600: kwqidrdq: loop
Posted on February 12, 2009 - Filed Under Database, Workflow | Leave a Comment
在新克隆的应用环境中启用Workflow Deferred Agent Listener总是错误,错误信息为: [Feb 12, 2009 3:34:45 PM CST]:1234424085866:Thread[inboundThreadGroup1,5,inboundThreadGroup]:0:-1:test.domain.com.cn:10.0.0.2:-1:-1:ERROR:[SVC-GSM-WFALSNRSVC-12681-10002 : oracle.apps.fnd.wf.bes.AgentListenerProcessor.read()]:Could not executeUpdate() on { CALL WF_EVENT.LISTEN ( p_agent_name => :1, p_wait => :2, p_correlation => :3, p_deq_condition => null, p_message_count => :4, p_max_error_count => :5 )} -> java.sql.SQLException: ORA-00600: internal error code, arguments: [kwqidrdq: loop], [0], [0], [0], [0], [], [], [] ORA-06512: [...]
stackx
Posted on June 5, 2008 - Filed Under Database | Leave a Comment
Stackx (Metalink: 362791.1) 是用于分析core文件的shell脚本,可用于IBM AIX, Intel Linux (RedHat and SuSE), HP-UX (10.* and 11.*), HP Tru64 和 Sun Solaris (2.5 – 2.10)环境。
当应用程序产生错误时(比如访问禁止的内存区域)可能会被操作系统强行终止并产生core文件,里面包含程序调用的相关函数。stackx从该二进制文件中读取相关的stack trace信息,并形成可读的文本。
下面是在Solaris的示例:
######################################################################
stackx core / stack trace extraction utility
version 1.1 (c) 2005, 2006 Oracle Corp. all rights reserved.
Reporting: Thu Jun 5 08:48:46 CST 2008
Machine : SunOS mytest 5.10 Generic_118833-03 sun4u sparc SUNW,Sun-Fire-V890
CPU Bits : 32
Core file: ../core
Core date: Jun 3 16:42
Tool(s) : /usr/bin/pstack /usr/bin/pmap /usr/bin/pflags
Program : f60webmx
Core extraction section follows
######################################################################
core '../core' of 29359: f60webmx webfile=5,180,test_9008_MYTEST
fef60fd8 ixncwst_WriteString (f98e78, fa6508, 0, 1, 100, f98e78) + 4
(省略 N 字)
000887bc main (2, ffbfb76c, 8000, de1ff0, 64,
+ 188
0008860c _start (0, 0, 0, 0, 0, 0) + dc
######################################################################
PMAP OUTPUT
core '../core' of 29359: f60webmx webfile=5,180,test_9008_MYTEST
00010000 4032K r-x-- /u01/test/myappl/fnd/11.5.0/bin/f60webmx
(省略 N 字)
FF3F0000 8K rwx-- /lib/ld.so.1
FFBEC000 80K rwx-- [ stack ]
total 72264K
######################################################################
PFLAGS OUTPUT
core '../core' of 29359: f60webmx webfile=5,180,test_9008_MYTEST
data model = _ILP32 flags = MSACCT|MSFORK
/1: flags = 0
sigmask = 0xffffbefc,0x0000ffff cursig = SIGSEGV
######################################################################
stackx done.
Trace Analyzer
Posted on November 15, 2007 - Filed Under Database | Leave a Comment
对于非技术人员来讲,做Trace也是件麻烦事,很多人不知Trace为何物,更不懂tkprof这种简单但不经培训便毫无头绪的东西。 Oracle提供一种更方便的方式,可以直接用SQL达到tkprof才能实现的功能。对于EBS用户来讲,这个工具提供更具针对性的内容。它以HTML格式输出tkprof所能提供的所有信息,更具可读性,适合对单个事务性能进行分析。 下载见Metalink: 224270.1
Change windows hostname
Posted on October 9, 2007 - Filed Under Database | Leave a Comment
Step 1 – Create Hosts Entry for Old Hostname add entry to the file WINNT\system32\drivers\etc\hosts Step 2 – Uninstall Enterprise Manager Console emca -deconfig dbcontrol db -repos drop Step 3 – Stop All Oracle Services Step 4 – Update listener.ora and tnsnames.ora with the new Hostname Step 5 – Rename Host and Restart DELETE THE [...]
