Howto–Enable Oracle XA transaction support

June 19, 2008 | 9:42 pm分类:Uncategorized | 标签: | 137 views

If we want to enable oracle XA transaction support at our Oracle database, consider the following:

Make sure that the V$XATRANS$ view and the DBA_PENDING_TRANSACTIONS view have been created in our Oracle database. If this view does not exist, the Oracle system administrator must create it by running the Oracle-supplied script named "xaview.sql". This file can be found in the $ORACLE_HOME/rdbms/admn folder. This SQL script must be executed as the Oracle user "SYS".
The Oracle system administrator must grant SELECT access to the public for the DBA_PENDING_TRANSACTIONS view.

Example log:

[oracle@vongates505:/opt/oracle]
[F3DC]~$ sqlplus /nolog

SQL*Plus: Release 10.2.0.3.0 - Production on Fri Jun 20 11:50:30 2008

Copyright (c) 1982, 2006, Oracle.  All Rights Reserved.

SQL> conn / as sysdba
Connected.
SQL> !
$ ll $ORACLE_HOME/rdbms/admin/ |grep -i xaview
-rw-r–r–   1 oracle     dba           1754 Aug 16  1998 xaview.sql
$ exit

SQL> @?/rdbms/admin/xaview.sql
DROP VIEW v$xatrans$
*
ERROR at line 1:
ORA-00942: table or view does not exist
DROP VIEW v$pending_xatrans$
*
ERROR at line 1:
ORA-00942: table or view does not exist

 

View created.
View created.

SQL>
SQL> create or replace public synonym V$XATRANS$
  2    for SYS.V$XATRANS$;

Synonym created.

SQL> conn vongates/vongates
Connected.
SQL> select count(*) from v$xatrans$;

  COUNT(*)
———-
         0

SQL>

WP–upgrade to 2.5.0中文版

June 19, 2008 | 6:42 am分类:WordPress | 标签: | 63 views

因为没有自己玩这个玩意,只能先找文章来读,原来一切是这么简单哇.以后要学装一下plugins了,一步一步走吧.先用putty远程logon dreamhost的主机,然后原来blog的目录备份一下,我想数据库也应该做一下备份的.但是现在还没有在意到这步,就webftp上传download好的wordpress250.zip档,自动unzip后,就有一个wordpress的目录,delete掉原blog目录中的全部内容,然后自制wordpress目录中的全部内容到这里来,再copy一个原来备份好的we-configure.php到当前blog的上当中就可以了.然后直接进入管理页面会提示升级数据,就一切OK了,

Tips–vi设置(set)选项(zt)

June 18, 2008 | 2:01 am分类:Oracle, Unix | 标签: | 85 views

选项                  描述
:set all    查看所有set选项
:set        显示当前set设置
:filetype on  通过$VIMRUNTIME/filetype.vim.打开文件类型检测
ai/noai      自动缩进,新行与前面的行保持—致的自动空格/不自动空格(缺省)
aw/noaw      自动写,转入shell或使用:n编辑其他文件时, 当前的缓冲区被写入/不写
flash/noflash  在出错处闪烁但不呜叫(缺省)/使用呜叫而不闪烁
ic/noic      在查询及模式匹配时忽赂大小写/不忽略大小写(缺省)
lisp/nolist   在编辑lisp程序时设置自动空格以便排列文本/按前一行自动设置空格
magic/nomagic  在进行模式匹配时使用全部的特殊宁符/将特殊宁符只限制于"^”和“$”
mesg/nomesg   允许/不允许其他用户向终端上写东西
nu/nonu      屏幕左边显示行号/不显示行号(缺省)
ro/noro      只读,除非明确设置为:w,否则不允许对文件改动/普通读/写模式
remap/noremap  允许将宏直接映射到已经编辑好的命令行中(缺省)/求宏定义明确
showmatch    显示括号配对,当键入“]”“)”时,高亮度显示匹配的括号/缺省不高亮
showmode    处于文本输入方式时加亮按钮条中的模式指示器/缺省不指示当前模式
ts=n       将TAB键的跨度设置为n个宁符间距,缺省为8
warn/nowarn   对文本进行了新的修改后,离开shell时系统给出显示(缺省)
ws/nows      在搜索时如到达文件尾则绕回文件头继续搜索
wrap/nowrap   长行显示自动折行
wm=n       保留空边,n为显示的最右边留出的空白边的字符数
si        smart indent 括号自动对齐
fe=prc      设置汉字整字处理
augroup      显示已存在auto命令组
nobackup    取消自动备份
encoding=prc  设置汉字处理,否则backspace删除半个汉字
cindent      设置C格式缩进,缩进量是通过shiftwidth的值,而不是通过tabstop的值
cino=string   string定义了特殊需求的cindent行为

Tips–How to configure Asynchronous i/o on HP-UX(zt)

June 17, 2008 | 10:10 pm分类:Oracle | 标签: | 281 views
Subject: HP-UX: Asynchronous i/o
  Doc ID : Note:139272.1 Type: BULLETIN
  Last Revision Date: 21-JUL-2004 Status: PUBLISHED

PURPOSE
——-

The purpose of this document is to discuss the implementation of
asynchronous i/o (aio) on HP-UX, specifically to enable aio for the Oracle
RDBMS Server.

SCOPE & APPLICATION
——————-

This note is intended for DBAs and Support Personnel.

1.0 Introduction
================
On HP-UX, when the Oracle datafiles reside on a filesystem, then the DBWR
process(es) make synchronous writes to these datafiles. This means that each
write must return with a ’succesful completion’ before the next write is
issued. This serial operation can lead to a i/o bottleneck. There are two ways
to counteract this:
  a. configure multiple DBWR processes
  b. use asynchronous i/o

Before deciding on one of these two options, it should be noted that on HP-UX,
aio is *only* possible on a raw device. Put in another way, aio *cannot* be used
on a filesystem.

Multiple DBWRs can be used on a filesystem.

It is not recommended to use both multiple DBWRs and aio.

2.0 Configuring asynchronous i/o
================================
aio requires configuration of both Oracle and HP-UX

2.1 HP-UX Configuration
———————–
a. create the /dev/async character device
   % /sbin/mknod /dev/async c 101 0×0
   % chown oracle:dba /dev/async
   % chmod 660 /dev/async

   If the device does not exist, then ENODEV (Err #19) is returned when the device
   is accessed:
   Async driver not configured  : errno=19

   If the permissions are incorrect, then EACCES (Err #13) is returned:
   Async driver not configured  : errno=13

b. configure the async driver in the kernel
   Using SAM
     -> Kernel Configuration
        -> Drivers
           -> the driver is called ‘asyncdsk’
   Generate new kernel
   Reboot

c. set max_async_ports
   Using SAM
     -> Kernel Configuration
        -> Configurable Parameters
           -> max_async_ports

   max_async_ports limits the maximum number of processes that can concurrently
   use /dev/async. Set this parameter to the sum of
     ‘processes’ from init.ora + number of background processes

   The background processes started at instance startup will open /dev/async
   twice.

   If max_async_ports is reached, subsequent processes will use synchronous i/o.

d. set aio_max_ops
   Using SAM
     -> Kernel Configuration
        -> Configurable Parameters
           -> aio_max_ops

   aio_max_ops limits the maximum number of asynchronous i/o operations that
   can be queued at any time. Set this parameter to the default value (2048),
   and monitor over time (use glance).

e. if HP-UX patch PHKL_22126 (or one that supersedes it) is installed, then
   see Section 3.0

2.2 Oracle Configuration
————————
The following init.ora parameters are required.

a. pre 7.3.0
   no init.ora parameters required
b. 7.3.X
   use_async_io = TRUE
c. 8.X
   disk_asynch_io = TRUE     

3.0 Implications of HP-UX Patch PHKL_22126
==========================================

This patch is called:
PHKL_22126: s700_800 11.00 VM,async,hyperfabric

The HP-UX patch description says:
 The effective user ID of the process calling async driver,
 typically called by a process for database applications such
 as Oracle, must be a superuser or the user must
 be a member of a group that has the MLOCK privilege.

In essence, aio will not work for Oracle, unless the dba group has the MLOCK
privilege.

To check if a group has the MLOCK privilege, execute:
 % /usr/bin/getprivgrp <group-name>

If the dba group is not listed, then set it:
 % /usr/sbin/setprivgrp <group-name> MLOCK

Note, the next reboot will clear this privilege. To automate this at startup,
create /etc/privgroup with the entry
 dba MLOCK

This can be tested with
 % /usr/sbin/setprivgrp -f /etc/privgroup
See ‘man 1m setprivgrp’ for more information.

If the MLOCK privilege is not granted to the dba group, then instance startup
will exhibit the following:

a. prior to 8.1.7, each background and shadow process will dump a trace file
   with the following:

   Ioctl ASYNC_CONFIG error, errno = 1

   errno 1 is EPERM (Not super-user).

   Such trace files may be found in
      $ORACLE_HOME/rdbms/log
      background_dump_dest
      user_dump_dest 

   Additionally, a tusc of instance startup will show the following for
   each background process:
   [16044] open("/dev/async", O_RDWR, 01760) ……………. = 14
   …
   [16044] ioctl(14, 0×80106101, 0×7f7f51b0) ……………. ERR#1 EPERM

   Similar output will be given for a tusc of a shadow process.

   The instance does start, but i/o is synchronous

b. in 8.1.7, the instance will not start, and will error with:
   SVRMGR> startup
   ORA-00445: background process "PMON" did not start after 120 seconds

   See Note 133007.1
 for the alert on this.

c. in 9.0.1, the behaviour is similar to pre-8.1.7, in that trace files with
   the following are dumped:

   Ioctl ASYNC_CONFIG error, errno = 1

   Additionally, the following is also seen:

   Ioctl ASYNC_ADDSEG error, errno = 1

   The instance does start, but i/o is synchronous.

4.0 Checking that Asynchronous i/o is being used
================================================
Async i/o is being used if both the following are true:
  a. /dev/async is open by DBWR
  b. the relevant init.ora partameter is set (see Section 2.2)
  c. the datafiles are on raw devices
To check if /dev/async is open by DBWR, do one of:
    i. % fuser /dev/async
   ii. % lsof -p <dbwr pid>
         lsof can be downloaded from ftp://vic.cc.purdue.edu/pub/tools/unix/lsof
  iii. use glance/gpm to check files opened by DBWR

NB - Oracle server processes (background and foreground) will attempt to open
     /dev/async if the async driver is enabled in the HP-UX kernel, regardless
     of init.ora settings.

If (a), (b)and (c) are true, and i/o is still perceived to be synchronous, attach
to DBWR with tusc, and check that write calls to /dev/async are not returning an
error. The file descriptor for /dev/async will be needed, which can be retrieved
using lsof.

5.0 The fs_async kernel parameter
=================================
The kernel parameter fs_async can be set to allow asynchronous writes to file
systems. However, write calls can return without the data being physically
written to disk (the write sits in the UNIX buffer cache). The data in question
is file-system metadata such as free space lists, blocks and inodes.
A system crash would potentially lose this data, and leave the filesystem in an
inconsistent state, causing database corruption.

Oracle still opens files with the O_DSYNC flag (see ‘tusc’ snipet
below), which insists that writes are physically written:
open("/oracle/datafiles/system01.dbf", O_RDWR|O_LARGEFILE|O_DSYNC, 0) = 19

In summary, fs_async is ignored for datafiles(due to open() with O_DSYNC).
However, filesystem metadata may be lost, potentially causing datafile
corruption.

Oracle does not recommend setting fs_async to ‘1′.

Settings:
  fs_async=0 Do not use async writes to file systems
  fs_async=1 Do async writes to file systems

RELATED DOCUMENTS
—————–
Note 174487.1
 - ALERT:HP-UX: RDBMS May Not Start if Async Disk Driver is
                  Configured
Note 133007.1
 - ALERT: HP/UX: 8.1.7 RDBMS will not start if the async disk
                  driver is configured

Tips–File ‘/dev/async’ not present : errno=2

June 17, 2008 | 10:07 pm分类:Oracle | 标签: | 123 views

今天建一个HP-UX 11.11下建10.2.0.3测试环境给开发Team,完成设定后查看dump目录,发现有大量的trace文件,内容完全相同,只是对应的进程不同,其中主要就是 File ‘/dev/async’ not present : errno=2 ,从这里就可以看出问题出在异步IO上,查看Metalink是10.2.0.2~10.2.0.3的Bug 5359528,因为我用的文件系统,并且为测试环境,就暂时通过设定数据库的参数DISK_ASYNCH_IO=false,并且重启instance来enable它.

Applies to:
Oracle Server - Enterprise Edition - Version: 10.2.0.2 to 10.2.0.3
HP-UX PA-RISC (64-bit)

Symptoms
After upgrading a database to 10.2.0.2 or 10.2.0.3 on HPUX PA-RISC 64-bit systems, several trace files are generated with the error message:

"File ‘/dev/async’ not present : errno=2"

You do not have async I/O enabled or configured at OS level and do not intend to enable or configure it.

Cause
Starting from Oracle10g, async I/O is enabled by default (even if the OS is not configured for it). This is based on the value of the DISK_ASYNCH_IO parameter in the database initialization parameter file. The default value is TRUE.

If DISK_ASYNCH_IO is true and async IO is not configured at the OS level (i.e. the /dev/async file is not present or writable by the oracle user) then a trace file is generated with the message "File ‘/dev/async’ not present : errno=2"

Solution
To avoid these trace files you need to set DISK_ASYNCH_IO=false in the init.ora file (or spfile) and restart the instance.

References
Bug 5359528 - /DEV/ASYNC FILE CAUSES TRACE AFTER UPGRADE TO 10.2.0.2 ON HP-UX

EXP–10gR2 exp 9iR2的数据遇到 component ‘SET_NO_OUTLINES’ must be declared

June 15, 2008 | 10:31 pm分类:Oracle | 标签: | 521 views

今天做的个Windows上的一个小库的升级测试,因为数据量不大,在10gR2的服务器上就直接用exp来导出9i中的数据,结果报了个component ‘SET_NO_OUTLINES’ must be declared,大概猜一下是因为版本的问题,查一下metalink后,我的猜测还真的对了,具体说明如下,最后先到9iR2的服务器上把数据导出来.再传到10gR2的服务器上来完成此作业.

Applies to:

Oracle Server - Enterprise Edition - Version: 10.2.0.1.0
This problem can occur on any platform.

Symptoms

While trying to export 9.2.0.6 database with 10.2.0.1.0 Exp utility
receive following errors:-

Export: Release 10.2.0.1.0 - Production on Tue Oct 25 17:11:46 2005
Copyright (c) 1982, 2005, Oracle. All rights reserved.
EXP-00056: ORACLE error 6550 encountered
ORA-06550: line 1, column 41:
PLS-00302: component ‘SET_NO_OUTLINES’ must be declared
ORA-06550: line 1, column 15:
PL/SQL: Statement ignored
EXP-00000: Export terminated unsuccessfully

Cause

Use of Higher Version Export utility (10.2.0.1) on Lower version database(9.2.0.6).

This problem occurs when using 10.2 Exp utility for 10.1,9.2,8.1.7 databases.

Solution

As per compatibility Matrix,You need to use the export utility of the lower version of source and target database.

Please Refer to Basic Compatibility Section in Note 132904.1

Tips–How to remove another owner job or db-link

June 15, 2008 | 3:49 pm分类:Oracle | 标签: | 86 views

在Oracle数据库中,如果我们没有job 或db link 所有者的密码的时候,将无法删除指定的job或db-link,当指定的所有者有正在运行的应用的时,我们则不能通过修改密码的方式来做,下面提供一种变向的管里方式,也就通过. EXECUTE IMMEDIATE 来完成,看下面的例子(移除typsti所有者下的job和db-link)
 

1.Create a procedure(db_user.run) owned by the user that does an execute immediate command

create procedure <db_user>.run(statement in varchar) as begin execute immediate statement; end;

2.call the <db_user>.run procedure

for example:

SQL> CONN SYSTEM/PASSWORD

SQL> select job,log_user from dba_jobs where log_user=’TYPSTI’;

JOB LOG_USER
———- ——————————
141 TYPSTI
142 TYPSTI

SQL> create procedure TYPSTI.run(statement in varchar) as
2 begin
3 execute immediate statement;
4 end;
5 /

Procedure created

SQL> exec TYPSTI.run(’begin dbms_job.remove(141); end;’) ;

PL/SQL procedure successfully completed

SQL> select job,log_user from dba_jobs where log_user=’TYPSTI’;

JOB LOG_USER
———- ——————————
142 TYPSTI

SQL> COMMIT;

Commit complete

SQL> SELECT OWNER,DB_LINK FROM DBA_DB_LINKS;

OWNER DB_LINK
—————————— ———————
TYPSTI O10TST

SQL> exec TYPSTI.run(’DROP DATABASE LINK O10TST;’) ;

begin TYPSTI.run(’DROP DATABASE LINK O10TST;’); end;

ORA-00911: invalid character
ORA-06512: at “TYPSTI.RUN”, line 1
ORA-06512: at line 1

SQL> exec TYPSTI.run(’DROP DATABASE LINK O10TST’) ;

PL/SQL procedure successfully completed

SQL>

Vongates blog starting

June 15, 2008 | 3:33 pm分类:Eassy | 标签: | 86 views

this blog is study notes of vongates