<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Chanel [K] &#187; Oracle11gR2</title>
	<atom:link href="http://www.dbform.com/html/tag/oracle11gr2/feed" rel="self" type="application/rss+xml" />
	<link>http://www.dbform.com</link>
	<description>面朝大海，春暖花开</description>
	<lastBuildDate>Tue, 31 Aug 2010 05:32:23 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0.1</generator>
		<item>
		<title>How to create ASM filesystem in Oracle 11gR2</title>
		<link>http://www.dbform.com/html/2010/1255.html</link>
		<comments>http://www.dbform.com/html/2010/1255.html#comments</comments>
		<pubDate>Thu, 12 Aug 2010 11:38:17 +0000</pubDate>
		<dc:creator>kamus</dc:creator>
				<category><![CDATA[Oracle Database]]></category>
		<category><![CDATA[ASM]]></category>
		<category><![CDATA[Oracle11gR2]]></category>

		<guid isPermaLink="false">http://www.dbform.com/?p=1255</guid>
		<description><![CDATA[<p>本文描述如何创建ACFS文件系统，前提要求： 1. Oracle 11gR2数据库 2. 已经安装Grid Infrastructure，单机即可（但是ACFS在Oracle Restart环境中会有些限制，详见【备注1】） 3. 已经创建了ASM实例以及ASM磁盘组，实例中ASM实例名儿+ASM，磁盘组为ORADG</p> SQL&#62; alter diskgroup oradg add volume acfsvol size 1G; alter diskgroup oradg add volume acfsvol size 1G * ERROR at line 1: ORA-15032: not all alterations performed ORA-15221: ASM operation requires compatible.asm of 11.2.0.0.0 or higher <p>如上的错误表示如果要在ASM磁盘组上创建ACFS Volume，必须要求ASM磁盘组的属性COMPATIBLE.ASM在11.2以上。 如果ASM磁盘组是使用asmca图形化工具创建的，那么compatible.asm默认设置就已经为11.2，但如果是使用CREATE DISKGROUP这个SQL命令创建的，那么默认设置则为10.1，需要手动修改。</p> SQL&#62; alter diskgroup oradg <span style="color:#777"> . . . &#8594; Read More: <a href="http://www.dbform.com/html/2010/1255.html">How to create ASM filesystem in Oracle 11gR2</a></span>]]></description>
			<content:encoded><![CDATA[<p>本文描述如何创建ACFS文件系统，前提要求：<br />
1. Oracle 11gR2数据库<br />
2. 已经安装Grid Infrastructure，单机即可（但是ACFS在Oracle Restart环境中会有些限制，详见【备注1】）<br />
3. 已经创建了ASM实例以及ASM磁盘组，实例中ASM实例名儿+ASM，磁盘组为ORADG</p>
<pre class="brush: sql;">SQL&gt; alter diskgroup oradg add volume acfsvol size 1G;
alter diskgroup oradg add volume acfsvol size 1G
*
ERROR at line 1:
ORA-15032: not all alterations performed
ORA-15221: ASM operation requires compatible.asm of 11.2.0.0.0 or higher</pre>
<p>如上的错误表示如果要在ASM磁盘组上创建ACFS Volume，必须要求ASM磁盘组的属性COMPATIBLE.ASM在11.2以上。<br />
如果ASM磁盘组是使用asmca图形化工具创建的，那么compatible.asm默认设置就已经为11.2，但如果是使用CREATE DISKGROUP这个SQL命令创建的，那么默认设置则为10.1，需要手动修改。</p>
<pre class="brush: sql; toolbar: false;">SQL&gt; alter diskgroup oradg set attribute 'COMPATIBLE.ASM'='11.2';</pre>
<p>如果要创建ACFS Volume，还必须要求ASM磁盘组的COMPATIBLE.ADVM属性也在11.2以上，此属性默认为空。</p>
<pre class="brush: sql;">SQL&gt; alter diskgroup oradg set attribute 'compatible.advm'='11.2';
alter diskgroup oradg set attribute 'compatible.advm'='11.2'
*
ERROR at line 1:
ORA-15032: not all alterations performed
ORA-15242: could not set attribute compatible.advm
ORA-15238: 11.2 is not a valid value for attribute compatible.advm
ORA-15477: cannot communicate with the volume driver

SQL&gt; host oerr ora 15477
15477, 00000, &quot;cannot communicate with the volume driver&quot;
// *Cause:  An attempt was made to communicate with the volume driver.
// *Action: Check that the ASM volume driver is loaded. If so, check the alert
//          log to identify the reason for failure and take necessary action
//          to prevent such failures in the future.
//</pre>
<p>如上的错误表示ASM volume driver没有加载。需要使用root用户手工加载。</p>

<div class="wp_syntax"><div class="code"><pre class="shell" style="font-family:monospace;"># /app/grid/bin/acfsload start -s</pre></div></div>

<p>然后再次修改ASM磁盘组的COMPATIBLE.ADVM属性，并创建ACFS Volume。</p>
<pre class="brush: sql;">SQL&gt; alter diskgroup oradg set attribute 'compatible.advm'='11.2';

Diskgroup altered.

SQL&gt; alter diskgroup oradg add volume acfsvol size 1G;

Diskgroup altered.

SQL&gt; select VOLUME_DEVICE from V$ASM_VOLUME where VOLUME_NAME='ACFSVOL';

VOLUME_DEVICE
--------------------------------------------------------------------------------
/dev/asm/acfsvol-351</pre>
<p>创建并注册文件系统，然后使用mount.acfs命令挂载文件系统，以下命令需要用root用户执行。</p>

<div class="wp_syntax"><div class="code"><pre class="shell" style="font-family:monospace;"># mkdir -p /app/oracle/acfsmounts/oradg_acfsvol 
# /sbin/mkfs -t acfs -n ACFSVOL1 /dev/asm/acfsvol-351
mkfs.acfs: version                   = 11.2.0.1.0.0
mkfs.acfs: on-disk version           = 39.0
mkfs.acfs: volume                    = /dev/asm/acfsvol-351
mkfs.acfs: volume size               = 1073741824
mkfs.acfs: Format complete.
# /sbin/acfsutil registry -a -f /dev/asm/acfsvol-351 /app/oracle/acfsmounts/oradg_acfsvol
acfsutil registry: mount point /app/oracle/acfsmounts/oradg_acfsvol successfully added to Oracle Registry
# mount.acfs -o all
#df -k | grep acfs
/dev/asm/acfsvol-351   1048576     39192   1009384   4% /app/oracle/acfsmounts/oradg_acfsvol
# chown oracle:dba /app/oracle/acfsmounts/oradg_acfsvol</pre></div></div>

<p>创建成功以后，可以用oracle用户在该文件系统下创建测试文件。</p>

<div class="wp_syntax"><div class="code"><pre class="shell" style="font-family:monospace;">$ dd if=/dev/zero of=/app/oracle/acfsmounts/oradg_acfsvol/testfile bs=8192 count=100
100+0 records in
100+0 records out
819200 bytes (819 kB) copied, 0.0270009 seconds, 30.3 MB/s
$ ls -l /app/oracle/acfsmounts/oradg_acfsvol/testfile
-rw-r--r-- 1 oracle dba 819200 Aug 12 19:18 /app/oracle/acfsmounts/oradg_acfsvol/testfile</pre></div></div>

<p>查看ACFS文件系统信息。</p>

<div class="wp_syntax"><div class="code"><pre class="shell" style="font-family:monospace;"># /sbin/acfsutil info fs 
/app/oracle/acfsmounts/oradg_acfsvol
    ACFS Version: 11.2.0.1.0.0
    flags:        MountPoint,Available
    mount time:   Thu Aug 12 19:06:33 2010
    volumes:      1
    total size:   1073741824
    total free:   968667136
    primary volume: /dev/asm/acfsvol-351
        label:                 ACFSVOL1
        flags:                 Primary,Available,ADVM
        on-disk version:       39.0
        allocation unit:       4096
        major, minor:          252, 179713
        size:                  1073741824
        free:                  968667136
        ADVM diskgroup         ORADG
        ADVM resize increment: 268435456
        ADVM redundancy:       unprotected
        ADVM stripe columns:   4
        ADVM stripe width:     131072
    number of snapshots:  0
    snapshot space usage: 0</pre></div></div>

<p>在ASM卷被打开的时候，无法直接shutdown ASM实例，会报ORA-15487错误。</p>
<pre class="brush: sql; toolbar: false;">SQL&gt; shutdown immediate
ORA-15487: cannot shutdown the ASM instance with an open ASM volume</pre>
<p>可以使用umount命令卸载ACFS文件系统。</p>

<div class="wp_syntax"><div class="code"><pre class="shell" style="font-family:monospace;"># /bin/umount -t acfs -a</pre></div></div>

<p>如果挂载文件系统时报错，那么可能是因为ACFS Volume没有激活，Volume的状态可以从V$ASM_VOLUME.STATE字段获得，显示为“ENABLED”才表示已激活。</p>

<div class="wp_syntax"><div class="code"><pre class="shell" style="font-family:monospace;"># mount.acfs /dev/asm/acfsvol-351 /app/oracle/acfsmounts/oradg_acfsvol
mount.acfs: CLSU-00100: Operating System function: open64 (/dev/asm/acfsvol-351) failed with error data: 2
mount.acfs: CLSU-00101: Operating System error message: No such file or directory
mount.acfs: CLSU-00103: error location: OOF_1
mount.acfs: ACFS-02017: Failed to open volume /dev/asm/acfsvol-351. Verify the volume exists.</pre></div></div>

<p>如果Volume状态显示为DISABLE，可以使用如下命令，激活Volume。</p>
<pre class="brush: sql; toolbar: false;">SQL&gt;alter diskgroup ORADG enable volume 'ACFSVOL';</pre>
<p>本文创建使用的是SQL命令行方式创建ACFS卷，用asmcmd也可以完成，可以参看<a href="http://download.oracle.com/docs/cd/E11882_01/server.112/e10500/asmfs_util.htm">官方文档</a> | <a href="http://surachartopun.com/2009/09/asm-dvm-acfs-by-command-lines.html">Surachart的文章</a>。</p>
<p>而如果选用图像化界面的话，可以用asmca或者OEM来完成，下图是asmca界面，在其中查看命令行写法也很方便。</p>
<p><a href="http://www.dbform.com/wp-content/uploads/2010/08/mwsnap580.jpg"><img src="http://www.dbform.com/wp-content/uploads/2010/08/mwsnap580.jpg" alt="" title="asmca" width="666" height="566" class="alignnone size-full wp-image-1256" /></a></p>
<p>【备注1】<br />
在当前版本的Oracle Restart环境（也就是Standalone Grid Infrastructure）中，以下操作不会自动运行。<br />
1. 加载Oracle ACFS drivers<br />
2. 加载存在于ACFS mount registry中的Oracle ACFS文件系统</p>
<p>应对于第一个问题，我们可以通过以下方法让操作系统在启动的时候自动加载Oracle ACFS drivers。</p>
<p>创建/etc/init.d/acfsload文件，让其在操作系统启动时自动运行。</p>

<div class="wp_syntax"><div class="code"><pre class="shell" style="font-family:monospace;"># cat /etc/init.d/acfsload
#!/bin/sh
# chkconfig: 2345 30 21
# description: Load Oracle ACFS drivers at system boot
/app/grid/bin/acfsload start -s
&nbsp;
# chmod u+x /etc/init.d/acfsload
# chkconfig --add  acfsload
# chkconfig --list  acfsload   
acfsload        0:off   1:off   2:on    3:on    4:on    5:on    6:off</pre></div></div>

<p>对于第二个问题，由于ACFS文件系统能够正确加载，必须要求ASM实例启动成功，并且相应的ASM磁盘组正确加载，这份依赖性在集群环境中是通过创建Oracle ACFS registry resource (ora.registry.acfs)来实现的，但是在Standalone环境中，我们无法保证这份依赖性，因此只能通过创建以下脚本用root用户手动挂载ACFS文件系统（如果你们有更好的方法请告诉我）。</p>

<div class="wp_syntax"><div class="code"><pre class="shell" style="font-family:monospace;"># cat /usr/local/sbin/mountacfs 
su - grid -c &quot;asmcmd volenable -G oradg -a&quot;
mount.acfs -o all</pre></div></div>

]]></content:encoded>
			<wfw:commentRss>http://www.dbform.com/html/2010/1255.html/feed</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Installing Oracle11gR2 on Solaris10</title>
		<link>http://www.dbform.com/html/2010/1165.html</link>
		<comments>http://www.dbform.com/html/2010/1165.html#comments</comments>
		<pubDate>Mon, 07 Jun 2010 08:53:41 +0000</pubDate>
		<dc:creator>kamus</dc:creator>
				<category><![CDATA[Oracle Database]]></category>
		<category><![CDATA[Oracle11gR2]]></category>
		<category><![CDATA[Solaris]]></category>

		<guid isPermaLink="false">http://www.dbform.com/?p=1165</guid>
		<description><![CDATA[<p>实际上Oracle11gR2真的在安装上花了不少心思，虽然目前在除了Linux平台的其它操作系统上都还有这样那样的小问题，但是确实已经很方便了。</p> <p>如果要在Solaris10中安装Oracle11gR2的单机数据库，只需要以下简单的步骤。</p> <p>1. 保证/tmp文件系统大于1G 在Soalris10中默认/tmp使用的是swap空间，因此在安装操作系统的时候给swap足够大的空间，比如4G或者8G</p> <p>2. 添加组和用户（只需要最简单的dba组）</p> # groupadd dba # useradd -g dba -d /export/home/oracle -m oracle <p>3. 修改操作系统内核参数（只需要修改shmmax，这里修改为4G）</p> # projadd -U oracle -K \ &#34;project.max-shm-memory=(priv,4096MB,deny)&#34; user.oracle <p>4. 使用磁盘c1t1d0和c1t2d0创建zfs文件系统（ZFS非常方便，自动mount，不再需要修改vfstab文件）</p> # zpool create orapool c1t1d0 c1t2d0 # zfs set mountpoint=/oracle orapool <p>5. runInstaller</p> <p>6. 安装完毕以后再去设置oracle用户的.profile环境变量</p> ]]></description>
			<content:encoded><![CDATA[<p>实际上Oracle11gR2真的在安装上花了不少心思，虽然目前在除了Linux平台的其它操作系统上都还有这样那样的小问题，但是确实已经很方便了。</p>
<p>如果要在Solaris10中安装Oracle11gR2的单机数据库，只需要以下简单的步骤。</p>
<p>1. 保证/tmp文件系统大于1G<br />
在Soalris10中默认/tmp使用的是swap空间，因此在安装操作系统的时候给swap足够大的空间，比如4G或者8G</p>
<p>2. 添加组和用户（只需要最简单的dba组）</p>

<div class="wp_syntax"><div class="code"><pre class="shell" style="font-family:monospace;"># groupadd dba
# useradd -g dba -d /export/home/oracle -m oracle</pre></div></div>

<p>3. 修改操作系统内核参数（只需要修改shmmax，这里修改为4G）</p>

<div class="wp_syntax"><div class="code"><pre class="shell" style="font-family:monospace;"># projadd -U oracle -K \
  &quot;project.max-shm-memory=(priv,4096MB,deny)&quot; user.oracle</pre></div></div>

<p>4. 使用磁盘c1t1d0和c1t2d0创建zfs文件系统（ZFS非常方便，自动mount，不再需要修改vfstab文件）</p>

<div class="wp_syntax"><div class="code"><pre class="shell" style="font-family:monospace;"># zpool create orapool c1t1d0 c1t2d0
# zfs set mountpoint=/oracle orapool</pre></div></div>

<p>5. runInstaller</p>
<p>6. 安装完毕以后再去设置oracle用户的.profile环境变量</p>
]]></content:encoded>
			<wfw:commentRss>http://www.dbform.com/html/2010/1165.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Tips for Installing Oracle11gR2 RAC on AIX 6.1</title>
		<link>http://www.dbform.com/html/2010/1148.html</link>
		<comments>http://www.dbform.com/html/2010/1148.html#comments</comments>
		<pubDate>Tue, 01 Jun 2010 16:04:05 +0000</pubDate>
		<dc:creator>kamus</dc:creator>
				<category><![CDATA[Oracle Database]]></category>
		<category><![CDATA[Oracle11gR2]]></category>
		<category><![CDATA[RAC]]></category>

		<guid isPermaLink="false">http://www.dbform.com/?p=1148</guid>
		<description><![CDATA[<p>不准备写一篇完整的Installation Guide，安装光盘中自带的pdf文档已经足够。本文只是总结一些在安装过程中碰到的问题或者说应该要注意的要点。</p> <p>1. 如下命令的软件包需要配全，通常在安装完操作系统以后就应该已经都有了。</p> lslpp -l bos.adt.base bos.adt.lib bos.adt.libm bos.perf.libperfstat \ bos.perf.perfstat bos.perf.proctools rsct.basic.rte rsct.compat.clients.rte xlC.aix61.rte <p>2. 安装文档中提到的fix即使不存在也不影响安装。</p> # instfix -i -k &#34;IZ41855 IZ51456 IZ52319&#34; There was no data for IZ41855 in the fix database. All filesets for IZ51456 were found. There was no data for IZ52319 in the fix database. <p>3. 11gR2 RAC自带CTSS时间同步服务，因此安装文档中要求禁用NTP，但是在安装过程中最后检查的时候，仍然会报NTP服务无法使用，可以直接忽略。 <span style="color:#777"> . . . &#8594; Read More: <a href="http://www.dbform.com/html/2010/1148.html">Tips for Installing Oracle11gR2 RAC on AIX 6.1</a></span>]]></description>
			<content:encoded><![CDATA[<p>不准备写一篇完整的Installation Guide，安装光盘中自带的pdf文档已经足够。本文只是总结一些在安装过程中碰到的问题或者说应该要注意的要点。</p>
<p>1. 如下命令的软件包需要配全，通常在安装完操作系统以后就应该已经都有了。</p>

<div class="wp_syntax"><div class="code"><pre class="shell" style="font-family:monospace;">lslpp -l bos.adt.base bos.adt.lib bos.adt.libm bos.perf.libperfstat \
 bos.perf.perfstat bos.perf.proctools rsct.basic.rte rsct.compat.clients.rte xlC.aix61.rte</pre></div></div>

<p>2. 安装文档中提到的fix即使不存在也不影响安装。</p>

<div class="wp_syntax"><div class="code"><pre class="shell" style="font-family:monospace;"># instfix -i -k &quot;IZ41855 IZ51456 IZ52319&quot;
    There was no data for IZ41855 in the fix database.
    All filesets for IZ51456 were found.
    There was no data for IZ52319 in the fix database.</pre></div></div>

<p>3. 11gR2 RAC自带CTSS时间同步服务，因此安装文档中要求禁用NTP，但是在安装过程中最后检查的时候，仍然会报NTP服务无法使用，可以直接忽略。<br />
<a href="http://www.dbform.com/wp-content/uploads/2010/06/mwsnap534.jpg"><img src="http://www.dbform.com/wp-content/uploads/2010/06/mwsnap534-300x226.jpg" alt="" title="Ignore" width="300" height="226" class="alignnone size-medium wp-image-1151" /></a></p>
<p>4. 11gR2 RAC安装中对于用户和用户组的建议可以说比以前复杂很多，不再仅仅是oinstall和dba这两个用户组。为了方便我们仍然可以只创建oinstall和dba这两个用户组，但是建议按照安装文档中描述的那样创建grid和oracle这两个用户，用grid用户安装Grid Infrastructure，用oracle用户安装RAC。</p>
<p>5. 11gR2中OCR和Voting是可以放置在ASM磁盘组中，因此实际上在整个数据库环境中，应该会存在至少三个ASM Disk Group，也就是crsdg（用于GRID使用）、datadg（数据库数据文件）、fradg（闪回区）。这里需要特别注意，所有磁盘组都是用grid用户执行asmca来创建的（当然你可以用create diskgroup命令创建），而最后数据库实例是以oracle用户启动的，也就是oracle用户也必须有读写磁盘组中disk的权限。</p>
<p>假设我们的环境中有rhdisk2、rhdisk3、rhdisk4三个LUN分别对应crsdg、datadg和fradg，那么建议做如下的权限设置：</p>

<div class="wp_syntax"><div class="code"><pre class="shell" style="font-family:monospace;">chown grid:oinstall /dev/rhdisk2
chown grid:oinstall /dev/rhdisk3
chown grid:oinstall /dev/rhdisk4
chmod 660 /dev/rhdisk3
chmod 660 /dev/rhdisk4
&nbsp;
# ls -l /dev/rhdisk*
crw-------    1 grid     oinstall     23,  3 Jun 01 16:23 /dev/rhdisk2
crw-rw----    1 grid     oinstall     23,  4 Jun 01 16:13 /dev/rhdisk3
crw-rw----    1 grid     oinstall     23,  2 Jun 01 16:13 /dev/rhdisk4</pre></div></div>

<p>6. 新增的SCAN VIP其实可有可无，特别对于不会频繁增删数据库节点的环境，个人觉得几乎无用。而且实际上，SCAN VIP和SCAN VIP LISTENER的切换操作十分缓慢，在我的测试中relocate scan的操作大概需要花费2分钟才能完成，不确认是不是我个人的配置问题。</p>
<p>SCAN VIP也同样是绑定在RAC环境中的某个节点上。如下SCAN VIP则是绑定在dbserver2中的public网卡上，可以看到public网卡上总共有3个IP，一个是实IP，一个是VIP，一个是SCAN VIP。</p>

<div class="wp_syntax"><div class="code"><pre class="shell" style="font-family:monospace;"># crs_stat -t|grep scan
ora....N1.lsnr ora....er.type ONLINE    ONLINE    dbserver2 
ora.scan1.vip  ora....ip.type ONLINE    ONLINE    dbserver2 
&nbsp;
# srvctl config scan_listener
SCAN Listener LISTENER_SCAN1 exists. Port: TCP:1521
&nbsp;
# srvctl config scan
SCAN name: crs-scan.cnrmall.com, Network: 1/192.168.255.0/255.255.255.0/en0
SCAN VIP name: scan1, IP: /crs-scan.cnrmall.com/192.168.255.250
&nbsp;
# netstat -in
Name  Mtu   Network     Address           ZoneID    Ipkts Ierrs    Opkts Oerrs  Coll
en0   1500  link#2      0.21.5e.48.e4.60       -    96331     0    47140     0     0
en0   1500  192.168.255 192.168.255.225        -    96331     0    47140     0     0
en0   1500  192.168.255 192.168.255.235        -    96331     0    47140     0     0
en0   1500  192.168.255 192.168.255.250        -    96331     0    47140     0     0
en1   1500  link#3      0.21.5e.48.e4.61       -   342409     0   293503     0     0
en1   1500  172.16      172.16.0.2             -   342409     0   293503     0     0
lo0   16896 link#1                             -   103667     0   103678     0     0
lo0   16896 127         127.0.0.1              -   103667     0   103678     0     0
lo0   16896 ::1                                0   103667     0   103678     0     0</pre></div></div>

<p>7. SCAN VIP在Oracle安装文档的建议中是需要配置在DNS服务器中，实际上也可以使用/etc/hosts文件，并且除却SCAN VIP之外的public ip、vip、private ip也仍然都是可以跟以前一样，配置在/etc/hosts文件中。</p>
<p>8. 安装11gR2 RAC要求必须配置ssh用户对等性，以前配置rsh的方式现在已经无法通过安装检查。OUI中提供了自动配置ssh用户对等性的按钮，因此无需再事先手动配置。<br />
<a href="http://www.dbform.com/wp-content/uploads/2010/06/mwsnap520.jpg"><img src="http://www.dbform.com/wp-content/uploads/2010/06/mwsnap520-300x226.jpg" alt="" title="SSH Conectivity" width="300" height="226" class="alignnone size-medium wp-image-1149" /></a></p>
<p>需要注意的是：该功能完全针对Linux环境进行的开发，因此在AIX环境中，需要事先作如下操作：</p>

<div class="wp_syntax"><div class="code"><pre class="shell" style="font-family:monospace;">ln -s /usr/bin/ksh /bin/bash
mkdir -p /usr/local/bin
ln -s /usr/bin/ssh-keygen /usr/local/bin/ssh-keygen</pre></div></div>

<p>在配置对等性时，OUI会使用/bin/bash，而AIX默认是没有bash的，因此需要将ksh软链接到bash（当然你也可以安装bash包）。<br />
同样，OUI会使用/usr/local/bin/ssh-keygen产生对等性密钥，而AIX中在安装了OpenSSH以后，ssh-keygen命令默认是存储在/usr/bin中，因此也需要做link。</p>
<p>9. 在成功安装完Grid Infrastructure之后，运行cluvf命令可能会报错。</p>

<div class="wp_syntax"><div class="code"><pre class="shell" style="font-family:monospace;"># cluvfy comp nodeapp -verbose
&nbsp;
ERROR: 
CRS is not installed on any of the nodes
Verification cannot proceed</pre></div></div>

<p>并且，在碰到这样的错误之后，也无法安装RAC，会碰到如下错误：</p>

<div class="wp_syntax"><div class="code"><pre class="shell" style="font-family:monospace;">[INS-35354] The system on which you are attempting to install Oracle RAC is not part of a valid cluster.</pre></div></div>

<p>也就是无论是cluvf命令还是OUI，都认为这个机器上没有安装CRS，并不是在一个集群环境中。但是实际上运行crsctl check crs命令是完全正常的。</p>
<p>这个错误的解决方法可以参看<strong>Metalink Note [ID 798203.1]</strong>，大体上来说就是在安装Grid Infrastructure的时候，inventory.xml文件中丢掉了CRS=&#8221;true&#8221;字样，这无疑是安装程序的bug。需要手工detachHome再attachHome。</p>
<p>10. 11gR2 RAC在CRS资源部分做了很多改动，创建完RAC数据库以后的默认资源比以前多了不少。</p>

<div class="wp_syntax"><div class="code"><pre class="shell" style="font-family:monospace;"># crs_stat -t
Name           Type           Target    State     Host        
------------------------------------------------------------
ora.CRSDG.dg   ora....up.type ONLINE    ONLINE    dbserver1   
ora.DATADG.dg  ora....up.type ONLINE    ONLINE    dbserver1   
ora.FRADG.dg   ora....up.type ONLINE    ONLINE    dbserver1   
ora....ER.lsnr ora....er.type ONLINE    ONLINE    dbserver1   
ora....N1.lsnr ora....er.type ONLINE    ONLINE    dbserver2   
ora.asm        ora.asm.type   ONLINE    ONLINE    dbserver1   
ora.dbcnr.db   ora....se.type ONLINE    ONLINE    dbserver2   
ora....SM1.asm application    ONLINE    ONLINE    dbserver1   
ora....R1.lsnr application    ONLINE    ONLINE    dbserver1   
ora....er1.gsd application    OFFLINE   OFFLINE               
ora....er1.ons application    ONLINE    ONLINE    dbserver1   
ora....er1.vip ora....t1.type ONLINE    ONLINE    dbserver1   
ora....SM2.asm application    ONLINE    ONLINE    dbserver2   
ora....R2.lsnr application    ONLINE    ONLINE    dbserver2   
ora....er2.gsd application    OFFLINE   OFFLINE               
ora....er2.ons application    ONLINE    ONLINE    dbserver2   
ora....er2.vip ora....t1.type ONLINE    ONLINE    dbserver2   
ora.eons       ora.eons.type  ONLINE    ONLINE    dbserver1   
ora.gsd        ora.gsd.type   OFFLINE   OFFLINE               
ora....network ora....rk.type ONLINE    ONLINE    dbserver1   
ora.oc4j       ora.oc4j.type  ONLINE    ONLINE    dbserver2   
ora.ons        ora.ons.type   ONLINE    ONLINE    dbserver1   
ora.scan1.vip  ora....ip.type ONLINE    ONLINE    dbserver2</pre></div></div>

<p>启动数据库实例以后，可以看到11gR2的后台进程已经增加到了43个，说实话，我很怀念简单的Oracle8i。</p>

<div class="wp_syntax"><div class="code"><pre class="shell" style="font-family:monospace;"># ps -ef|grep ora_ | grep -v grep
  oracle  364656       1   0 17:01:17      -  0:00 ora_mark_dbcnr1 
  oracle  540722       1   0 17:01:17      -  0:03 ora_mmnl_dbcnr1 
  oracle  561184       1   0 18:07:34      -  0:00 ora_q003_dbcnr1 
  oracle  643244       1   0 17:01:17      -  0:01 ora_mmon_dbcnr1 
  oracle  651360       1   0 17:01:16      -  0:00 ora_asmb_dbcnr1 
  oracle  655494       1   0 17:01:16      -  0:00 ora_rbal_dbcnr1 
  oracle  663680       1   1 17:01:13      -  0:06 ora_lmd0_dbcnr1 
  oracle  667794       1   0 17:01:12      -  0:00 ora_pmon_dbcnr1 
  oracle  671832       1   0 17:01:12      -  0:01 ora_diag_dbcnr1 
  oracle  675932       1   0 17:01:16      -  0:00 ora_smon_dbcnr1 
  oracle  679962       1   0 17:01:12      -  0:00 ora_gen0_dbcnr1 
  oracle  696414       1   0 17:01:16      -  0:00 ora_dbw0_dbcnr1 
  oracle  708790       1   0 17:02:33      -  0:00 ora_qmnc_dbcnr1 
  oracle  716930       1   0 17:01:17      -  0:04 ora_lck0_dbcnr1 
  oracle  721124       1   0 17:01:16      -  0:00 ora_mman_dbcnr1 
  oracle  725186       1   0 17:02:32      -  0:00 ora_gtx0_dbcnr1 
  oracle  729102       1   0 17:01:15      -  0:00 ora_lmhb_dbcnr1 
  oracle  737358       1   0 17:01:16      -  0:00 ora_reco_dbcnr1 
  oracle  745554       1   0 17:02:34      -  0:00 ora_q001_dbcnr1 
  oracle  749762       1   0 17:01:16      -  0:00 ora_lgwr_dbcnr1 
  oracle  753716       1   0 17:01:12      -  0:00 ora_ping_dbcnr1 
  oracle  766014       1   0 17:01:13      -  0:00 ora_psp0_dbcnr1 
  oracle  790688       1   0 17:01:13      -  0:00 ora_acms_dbcnr1 
  oracle  794780       1   0 17:01:12      -  0:02 ora_vktm_dbcnr1 
  oracle  815252       1   0 17:01:12      -  0:00 ora_dbrm_dbcnr1 
  oracle  819350       1   1 17:01:15      -  0:16 ora_lms1_dbcnr1 
  oracle  827642       1   0 17:02:36      -  0:01 ora_cjq0_dbcnr1 
  oracle  848054       1   0 17:02:30      -  0:00 ora_arc0_dbcnr1 
  oracle  856270       1   0 17:01:15      -  0:00 ora_rms0_dbcnr1 
  oracle  868590       1   0 17:25:42      -  0:00 ora_q002_dbcnr1 
  oracle  872622       1   0 17:01:15      -  0:16 ora_lms0_dbcnr1 
  oracle  901314       1   0 17:02:32      -  0:00 ora_arc3_dbcnr1 
  oracle  921600       1   0 18:07:17      -  0:00 ora_pz98_dbcnr1 
  oracle  925926       1   0 17:01:18      -  0:00 ora_rsmn_dbcnr1 
  oracle  929980       1   0 17:07:35      -  0:00 ora_smco_dbcnr1 
  oracle  942286       1   0 18:07:17      -  0:00 ora_pz99_dbcnr1 
  oracle  950274       1   0 17:02:32      -  0:00 ora_rcbg_dbcnr1 
  oracle  958498       1   0 17:02:31      -  0:00 ora_arc2_dbcnr1 
  oracle  974876       1   0 18:07:38      -  0:00 ora_w000_dbcnr1 
  oracle 1011914       1   0 17:01:16      -  0:01 ora_ckpt_dbcnr1 
  oracle 1052884       1   1 17:01:13      -  0:06 ora_lmon_dbcnr1 
  oracle 1069246       1   1 17:01:13      -  0:33 ora_dia0_dbcnr1 
  oracle 1110056       1   0 17:02:31      -  0:00 ora_arc1_dbcnr1 
# ps -ef|grep ora_ | grep -v grep | wc -l
      43
#</pre></div></div>

]]></content:encoded>
			<wfw:commentRss>http://www.dbform.com/html/2010/1148.html/feed</wfw:commentRss>
		<slash:comments>6</slash:comments>
		</item>
		<item>
		<title>Exp Empty Table in Oracle11gR2</title>
		<link>http://www.dbform.com/html/2010/1120.html</link>
		<comments>http://www.dbform.com/html/2010/1120.html#comments</comments>
		<pubDate>Thu, 22 Apr 2010 08:25:07 +0000</pubDate>
		<dc:creator>kamus</dc:creator>
				<category><![CDATA[Oracle Database]]></category>
		<category><![CDATA[Oracle RDBMS]]></category>
		<category><![CDATA[Oracle11gR2]]></category>

		<guid isPermaLink="false">http://www.dbform.com/?p=1120</guid>
		<description><![CDATA[<p>先来看一下例子。我们创建一张表T2。</p> SQL&#62; create table t2 (n number); Table created. SQL&#62; desc t2 Name Null? Type ----------------------------------------- -------- ---------------------------- N NUMBER <p>尝试使用exp将此表导出。</p> D:\Temp&#62;exp kamus/oracle tables=t2 &#160; Export: Release 11.2.0.1.0 - Production on Fri Apr 16 18:11:51 2010 &#160; Copyright (c) 1982, 2009, Oracle and/or its affiliates. All rights reserved. &#160; &#160; Connected to: Oracle Database <span style="color:#777"> . . . &#8594; Read More: <a href="http://www.dbform.com/html/2010/1120.html">Exp Empty Table in Oracle11gR2</a></span>]]></description>
			<content:encoded><![CDATA[<p>先来看一下例子。我们创建一张表T2。</p>
<pre class="brush: sql; light: true;">SQL&gt; create table t2 (n number);

Table created.

SQL&gt; desc t2
 Name                                      Null?    Type
 ----------------------------------------- -------- ----------------------------
 N                                                  NUMBER</pre>
<p>尝试使用exp将此表导出。</p>

<div class="wp_syntax"><div class="code"><pre class="shell" style="font-family:monospace;">D:\Temp&gt;exp kamus/oracle tables=t2
&nbsp;
Export: Release 11.2.0.1.0 - Production on Fri Apr 16 18:11:51 2010
&nbsp;
Copyright (c) 1982, 2009, Oracle and/or its affiliates.  All rights reserved.
&nbsp;
&nbsp;
Connected to: Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - 64bit Production
&nbsp;
With the Partitioning, Oracle Label Security, Data Mining and Real Application Testing opt
ions
Export done in ZHS16GBK character set and AL16UTF16 NCHAR character set
&nbsp;
About to export specified tables via Conventional Path ...
EXP-00011: KAMUS.T2 does not exist
Export terminated successfully with warnings.</pre></div></div>

<p>报错说这张表并不存在。这是让很多客户费解的地方，在测试库中创建应用的表结构，然后再将表结构exp到产品库中去，这是很多客户常用的方法，但是在11gR2中如果这些表是新创建的没有插入过任何一条记录，那么将会碰到上面这样的错误。</p>
<p>原因在于11gR2中的新功能 &#8211; Deferred Segment Creation（延迟段创建），默认情况下这个功能是启用的。</p>
<pre class="brush: sql; light: true;">SQL&gt; show parameter DEFERRED_SEGMENT_CREATION

NAME                                 TYPE                 VALUE
------------------------------------ -------------------- --------------------
deferred_segment_creation            boolean              TRUE</pre>
<p>延迟段创建的含义是当此新创建一个可能会有Segment的对象时（比如表、索引、物化视图等），如果这个对象中还没有任何记录需要消耗一个Extent，那么将不会在创建对象时自动创建Segment，这样做的好处无疑是在创建对象时大大提高了速度。</p>
<p>对于上例中的T2表，我们在创建结束就立刻检查DBA_SEGMENTS视图，会发现没有任何记录。</p>
<pre class="brush: sql; light: true;">SQL&gt; select segment_name from user_segments where segment_name='T2';

no rows selected</pre>
<p>而对于exp程序而言，当仅仅存在Object的定义而没有相应的Segment时，就会报出EXP-00011对象不存在的错误。</p>
<p>解决方法就很简单了，以下方法任选其一。</p>
<p>1. 设置DEFERRED_SEGMENT_CREATION为FALSE，这样创建对象时就会自动创建Segment</p>
<p>2. 在创建对象时，明确指定立刻创建Segment</p>
<pre class="brush: sql; light: true;">create table t2 (n number) SEGMENT CREATION IMMEDIATE;</pre>
<p>3. 使用expdp替代exp（Datapump本身就是Oracle10g以后的推荐工具）</p>

<div class="wp_syntax"><div class="code"><pre class="shell" style="font-family:monospace;">D:\Temp&gt;expdp kamus/oracle tables=t2
&nbsp;
Export: Release 11.2.0.1.0 - Production on Fri Apr 16 18:14:41 2010
&nbsp;
Copyright (c) 1982, 2009, Oracle and/or its affiliates.  All rights reserved.
&nbsp;
Connected to: Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - 64bit Production
&nbsp;
With the Partitioning, Oracle Label Security, Data Mining and Real Application Testing opt
ions
Starting &quot;KAMUS&quot;.&quot;SYS_EXPORT_TABLE_01&quot;:  kamus/******** tables=t2
Estimate in progress using BLOCKS method...
Processing object type TABLE_EXPORT/TABLE/TABLE_DATA
Total estimation using BLOCKS method: 0 KB
Processing object type TABLE_EXPORT/TABLE/TABLE
. . exported &quot;KAMUS&quot;.&quot;T2&quot;                                    0 KB       0 rows
Master table &quot;KAMUS&quot;.&quot;SYS_EXPORT_TABLE_01&quot; successfully loaded/unloaded
******************************************************************************
Dump file set for KAMUS.SYS_EXPORT_TABLE_01 is:
  D:\ORACLE\ADMIN\ORCL\DPDUMP\EXPDAT.DMP
Job &quot;KAMUS&quot;.&quot;SYS_EXPORT_TABLE_01&quot; successfully completed at 18:15:10</pre></div></div>

]]></content:encoded>
			<wfw:commentRss>http://www.dbform.com/html/2010/1120.html/feed</wfw:commentRss>
		<slash:comments>6</slash:comments>
		</item>
		<item>
		<title>How to Use Oracle Restart in Oracle 11gR2</title>
		<link>http://www.dbform.com/html/2010/1110.html</link>
		<comments>http://www.dbform.com/html/2010/1110.html#comments</comments>
		<pubDate>Thu, 15 Apr 2010 10:08:57 +0000</pubDate>
		<dc:creator>kamus</dc:creator>
				<category><![CDATA[Oracle Database]]></category>
		<category><![CDATA[Oracle RDBMS]]></category>
		<category><![CDATA[Oracle11gR2]]></category>

		<guid isPermaLink="false">http://www.dbform.com/?p=1110</guid>
		<description><![CDATA[<p>Oracle Restart是数据库组件监控方法向单实例数据库中的延展，之前srvctl命令可以用来管理RAC数据库中的各个组件，安装了Oracle Restart之后，对于单实例数据库组件（包括数据库实例，监听，ASM实例，ASM磁盘组，自建Service等）也可以使用srvctl命令来管理，同时Oracle会在这些组件发生意外关闭的时候自动重新启动。对于在Linux单机上安装的Oracle Instance，以前需要配置dbstart或者dbstop脚本来实现在操作系统起停时自动起停数据库实例的操作，现在通过Oracle Restart则无需这两个脚本了。</p> <p>详细文档请参看 About Oracle Restart。</p> <p>安装其实很简单，实际上没有单独安装Oracle Restart的过程，只需要安装Oracle Grid Infrastructure就可以，在安装的时候选择“仅安装网格基础结构软件”，我们的测试环境没有使用ASM，因此选择只安装软件可以跳过配置ASM的步骤。</p> <p>如何在Windows单机上测试ASM，感兴趣的朋友可以参看 &#8211; How to use Files in place of Real Disk Devices for ASM。</p> <p>我们是在创建完数据库之后再安装Grid Infrastructure的，因此还需要手工将数据库实例和监听加入Oracle Restart配置中，根据文档如果是在装完Grid Infrastructure之后再用netca创建监听，dbca创建数据库的话，将会自动加入Oracle Restart中，我个人没有测试。</p> <p>添加数据库实例：</p> srvctl add database -d orcl -o D:\oracle\product\11.2.0\dbhome_1 <p>检查配置情况：</p> D:\Temp&#62;srvctl config database -d orcl 数据库唯一名称: orcl 数据库名: Oracle 主目录: D:\oracle\product\11.2.0\dbhome_1 Oracle 用户: <span style="color:#777"> . . . &#8594; Read More: <a href="http://www.dbform.com/html/2010/1110.html">How to Use Oracle Restart in Oracle 11gR2</a></span>]]></description>
			<content:encoded><![CDATA[<p>Oracle Restart是数据库组件监控方法向单实例数据库中的延展，之前srvctl命令可以用来管理RAC数据库中的各个组件，安装了Oracle Restart之后，对于单实例数据库组件（包括数据库实例，监听，ASM实例，ASM磁盘组，自建Service等）也可以使用srvctl命令来管理，同时Oracle会在这些组件发生意外关闭的时候自动重新启动。对于在Linux单机上安装的Oracle Instance，以前需要配置dbstart或者dbstop脚本来实现在操作系统起停时自动起停数据库实例的操作，现在通过Oracle Restart则无需这两个脚本了。</p>
<p>详细文档请参看 <a href="http://download.oracle.com/docs/cd/E11882_01/server.112/e10595/restart001.htm#ADMIN12709">About Oracle Restart</a>。</p>
<p>安装其实很简单，实际上没有单独安装Oracle Restart的过程，只需要安装Oracle Grid Infrastructure就可以，在安装的时候选择“仅安装网格基础结构软件”，我们的测试环境没有使用ASM，因此选择只安装软件可以跳过配置ASM的步骤。</p>
<p>如何在Windows单机上测试ASM，感兴趣的朋友可以参看 &#8211; <a href="http://www.dbform.com/html/2009/573.html">How to use Files in place of Real Disk Devices for ASM</a>。</p>
<p>我们是在创建完数据库之后再安装Grid Infrastructure的，因此还需要手工将数据库实例和监听加入Oracle Restart配置中，根据文档如果是在装完Grid Infrastructure之后再用netca创建监听，dbca创建数据库的话，将会自动加入Oracle Restart中，我个人没有测试。</p>
<p>添加数据库实例：</p>

<div class="wp_syntax"><div class="code"><pre class="shell" style="font-family:monospace;">srvctl add database -d orcl -o D:\oracle\product\11.2.0\dbhome_1</pre></div></div>

<p>检查配置情况：</p>

<div class="wp_syntax"><div class="code"><pre class="shell" style="font-family:monospace;">D:\Temp&gt;srvctl config database -d orcl
数据库唯一名称: orcl
数据库名:
Oracle 主目录: D:\oracle\product\11.2.0\dbhome_1
Oracle 用户: system
Spfile:
域:
启动选项: open
停止选项: immediate
数据库角色: PRIMARY
管理策略: AUTOMATIC
磁盘组:
服务:</pre></div></div>

<p>检查数据库实例状态：</p>

<div class="wp_syntax"><div class="code"><pre class="shell" style="font-family:monospace;">D:\Temp&gt;srvctl status database -d orcl
数据库正在运行。</pre></div></div>

<blockquote><p>注意：如果在添加数据库实例之前数据库实例已经启动了，那么需要重新启动一次数据库，Oracle Restart才能正确监视到数据库实例状态。</p></blockquote>
<p>添加监听：</p>

<div class="wp_syntax"><div class="code"><pre class="shell" style="font-family:monospace;">srvctl add listener -o D:\oracle\product\11.2.0\dbhome_1</pre></div></div>

<p>如果在添加监听的时候，监听已经启动，那么会遇到PRCN-2065错误，停止监听以后再次添加即可。</p>

<div class="wp_syntax"><div class="code"><pre class="shell" style="font-family:monospace;">D:\Temp&gt;srvctl add listener -o D:\oracle\product\11.2.0\dbhome_1
PRCN-2061 : 无法添加监听程序 ora.LISTENER.lsnr
PRCN-2065 : 端口 1521 在指定的节点上不可用
PRCN-2035 : 端口 1521 在节点或虚拟主机上不可用: Kamus-PC</pre></div></div>

<p>配置完毕以后，就可以通过srvctl命令起停数据库实例和监听了。</p>

<div class="wp_syntax"><div class="code"><pre class="shell" style="font-family:monospace;">srvctl start|stop database -d &lt;db_unique_name&gt;
srvctl start|stop listener [-l &lt;lsnr_name&gt;]</pre></div></div>

<p>可以通过crs_stat命令查看Oracle Restart管理的各个资源情况，这以前是我们查看Oracle Clusterware的方式。</p>

<div class="wp_syntax"><div class="code"><pre class="shell" style="font-family:monospace;">D:\Temp&gt;crs_stat -t
Name           Type           Target    State     Host
------------------------------------------------------------
ora....ER.lsnr ora....er.type ONLINE    ONLINE    kamus-pc
ora.cssd       ora.cssd.type  ONLINE    ONLINE    kamus-pc
ora.orcl.db    ora....se.type ONLINE    ONLINE    kamus-pc</pre></div></div>

<p>测试Oracle Restart的功能，我们可以在后台进程中直接杀死oracle.exe，可以观察到数据库实例立刻会重新启动。</p>
<blockquote><p>注意：所有在SQL*PLUS中发出的关闭数据库命令均不会导致Oracle Restart重启实例，包括shutdown abort。</p></blockquote>
<p>如果暂时不想用Oracle Restart管理某个资源，可以通过srvctl disable命令暂时禁用，需要的时候再enable即可。</p>

<div class="wp_syntax"><div class="code"><pre class="shell" style="font-family:monospace;">srvctl disable database -d orcl</pre></div></div>

<p>如果机器名称发生了改变，需要重新配置Oracle Restart，请参考<a href="https://support.oracle.com/CSP/main/article?cmd=show&#038;type=NOT&#038;doctype=HOWTO&#038;id=986740.1">Metalink Note [ID 986740.1]</a>。</p>
]]></content:encoded>
			<wfw:commentRss>http://www.dbform.com/html/2010/1110.html/feed</wfw:commentRss>
		<slash:comments>7</slash:comments>
		</item>
		<item>
		<title>Find waiter with Oradebug 11gR2</title>
		<link>http://www.dbform.com/html/2009/962.html</link>
		<comments>http://www.dbform.com/html/2009/962.html#comments</comments>
		<pubDate>Wed, 16 Dec 2009 06:55:11 +0000</pubDate>
		<dc:creator>kamus</dc:creator>
				<category><![CDATA[Oracle Database]]></category>
		<category><![CDATA[Oracle11gR2]]></category>

		<guid isPermaLink="false">http://www.dbform.com/?p=962</guid>
		<description><![CDATA[<p>原文链接自：Miladin Modrakovic’s Blog &#8211; Oraclue</p> <p>实际上，昨天刚有朋友问怎么找到TX enqueu的锁对象以及语句。在Oracle11gR2中我们可以使用oradebug unit_test per_session_find_one_waiter语句来进行简单的blocker定位。</p> <p>oradebug unit_test per_session_find_one_waiter的用法如下：</p> usage: oradebug unit_test per_session_find_one_waiter find_waiters_for=&#60;current_sess or all_local_sess&#62; wait_event=&#34;&#60;wait_event_name_to_search_for&#62;&#34; waiter_min_secs_blkd=&#60;secs&#62; min_results=&#60;num&#62; [ timeout_mins=&#60;mins - default is 10 mins&#62; ] <p>实际测试如下，还是测试简单的enq: TX &#8211; row lock contention等待事件。</p> <p>在第1个session中：</p> SQL&#62; create table t (n int primary key); Table created. SQL&#62; insert into t values(1); 1 row <span style="color:#777"> . . . &#8594; Read More: <a href="http://www.dbform.com/html/2009/962.html">Find waiter with Oradebug 11gR2</a></span>]]></description>
			<content:encoded><![CDATA[<p>原文链接自：<a href="http://oraclue.com/2009/10/29/find-waiter-with-oradebug-11gr2/">Miladin Modrakovic’s Blog &#8211; Oraclue</a></p>
<p>实际上，昨天刚有朋友问怎么找到TX enqueu的锁对象以及语句。在Oracle11gR2中我们可以使用<strong>oradebug unit_test per_session_find_one_waiter</strong>语句来进行简单的blocker定位。</p>
<p>oradebug unit_test per_session_find_one_waiter的用法如下：</p>

<div class="wp_syntax"><div class="code"><pre class="shell" style="font-family:monospace;">usage: 
  oradebug unit_test per_session_find_one_waiter
    find_waiters_for=&lt;current_sess or all_local_sess&gt;
    wait_event=&quot;&lt;wait_event_name_to_search_for&gt;&quot;
    waiter_min_secs_blkd=&lt;secs&gt;
    min_results=&lt;num&gt;
    [ timeout_mins=&lt;mins - default is 10 mins&gt; ]</pre></div></div>

<p>实际测试如下，还是测试简单的enq: TX &#8211; row lock contention等待事件。</p>
<p>在第1个session中：</p>
<pre class="brush: sql;">SQL&gt; create table t (n int primary key);

Table created.

SQL&gt; insert into t values(1); 

1 row created.

SQL&gt; commit;

Commit complete.

SQL&gt; update t set n=2 where n=1;

1 row updated.</pre>
<p>在第2个session中：</p>
<pre class="brush: sql; light: true;">SQL&gt; update t set n=3 where n=1;</pre>
<p>在第3个session中：</p>
<pre class="brush: sql; light: true;">SQL&gt; update t set n=4 where n=1;</pre>
<p>在另外一个session中用sysdba登陆，然后执行oradebug。</p>
<pre class="brush: sql;">SQL&gt; oradebug unit_test per_session_find_one_waiter find_waiters_for=all_local_sess wait_event=&quot;enq: TX - row lock contention&quot; waiter_min_secs_blkd=1 min_results=1
WAITERS_FOUND_BEGIN
(inst=1, sid=16, osid=30658) is blocking (inst=1, sid=17) for at least 501 secs
(inst=1, sid=17, osid=30668) is blocking (inst=1, sid=25) for at least 486 secs
WAITERS_FOUND_END</pre>
<p>从以上的输出中可以得知：<br />
1. sid=16的会话锁住了sid=17的会话，已经有至少501秒<br />
2. sid=17的会话锁住了sid=25的会话，已经有至少486秒</p>
<p>此时如果commit会话1，那么会话2和会话3的&#8221;enq: TX &#8211; row lock contention&#8221; 锁都会消失，但是两个会话都不会更新到任何记录，因为n=1的记录已经被会话1更新为n=2。</p>
<p>在目前的测试中，如果在oradebug中指定的wait_event在当前数据库中并不存在，那么oradebug命令将长时间没有反应，并最终报出ORA-00600的错误，这应该是bug，有望在今后的版本中得到修改。</p>
<pre class="brush: sql;">SQL&gt; oradebug unit_test per_session_find_one_waiter find_waiters_for=current_sess wait_event=&quot;enq: TX - row lock contention&quot; waiter_min_secs_blkd=1 min_results=1

ORA-00600: internal error code, arguments: [ksdhng:waiting_sessions_not_found], [enq: TX - row lock contention], [10], [10], [], [], [], [], [], [], [], []</pre>
]]></content:encoded>
			<wfw:commentRss>http://www.dbform.com/html/2009/962.html/feed</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Oracle Database Instance Startup Fails With Error ORA-27302 ORA-27301</title>
		<link>http://www.dbform.com/html/2009/960.html</link>
		<comments>http://www.dbform.com/html/2009/960.html#comments</comments>
		<pubDate>Wed, 16 Dec 2009 06:14:17 +0000</pubDate>
		<dc:creator>kamus</dc:creator>
				<category><![CDATA[Operating System]]></category>
		<category><![CDATA[Oracle Database]]></category>
		<category><![CDATA[Oracle11gR2]]></category>

		<guid isPermaLink="false">http://www.dbform.com/?p=960</guid>
		<description><![CDATA[<p>今天启动Oracle Enterprise Linux 5虚拟机中的Oracle11gR2数据库，但是报错。</p> &#91;oracle@dbserver ~&#93;$ sqlplus / AS sysdba &#160; SQL*Plus: Release 11.2.0.1.0 Production ON Wed Dec 16 13:28:44 2009 &#160; Copyright &#40;c&#41; 1982, 2009, Oracle. ALL rights reserved. &#160; Connected TO an idle instance. &#160; SQL&#62; startup ORA-27154: post/wait CREATE failed ORA-27300: OS system dependent operation:semget failed WITH STATUS: 28 ORA-27301: OS <span style="color:#777"> . . . &#8594; Read More: <a href="http://www.dbform.com/html/2009/960.html">Oracle Database Instance Startup Fails With Error ORA-27302 ORA-27301</a></span>]]></description>
			<content:encoded><![CDATA[<p>今天启动Oracle Enterprise Linux 5虚拟机中的Oracle11gR2数据库，但是报错。</p>

<div class="wp_syntax"><div class="code"><pre class="sql" style="font-family:monospace;"><span style="color: #66cc66;">&#91;</span>oracle@dbserver ~<span style="color: #66cc66;">&#93;</span>$ sqlplus <span style="color: #66cc66;">/</span> <span style="color: #993333; font-weight: bold;">AS</span> sysdba
&nbsp;
SQL<span style="color: #66cc66;">*</span>Plus: Release 11<span style="color: #66cc66;">.</span>2<span style="color: #66cc66;">.</span>0<span style="color: #66cc66;">.</span>1<span style="color: #66cc66;">.</span>0 Production <span style="color: #993333; font-weight: bold;">ON</span> Wed Dec <span style="color: #cc66cc;">16</span> <span style="color: #cc66cc;">13</span>:<span style="color: #cc66cc;">28</span>:<span style="color: #cc66cc;">44</span> <span style="color: #cc66cc;">2009</span>
&nbsp;
Copyright <span style="color: #66cc66;">&#40;</span>c<span style="color: #66cc66;">&#41;</span> <span style="color: #cc66cc;">1982</span><span style="color: #66cc66;">,</span> <span style="color: #cc66cc;">2009</span><span style="color: #66cc66;">,</span> Oracle<span style="color: #66cc66;">.</span>  <span style="color: #993333; font-weight: bold;">ALL</span> rights reserved<span style="color: #66cc66;">.</span>
&nbsp;
Connected <span style="color: #993333; font-weight: bold;">TO</span> an idle instance<span style="color: #66cc66;">.</span>
&nbsp;
SQL<span style="color: #66cc66;">&gt;</span> startup
ORA<span style="color: #66cc66;">-</span><span style="color: #cc66cc;">27154</span>: post<span style="color: #66cc66;">/</span>wait <span style="color: #993333; font-weight: bold;">CREATE</span> failed
ORA<span style="color: #66cc66;">-</span><span style="color: #cc66cc;">27300</span>: OS system dependent operation:semget failed <span style="color: #993333; font-weight: bold;">WITH</span> <span style="color: #993333; font-weight: bold;">STATUS</span>: <span style="color: #cc66cc;">28</span>
ORA<span style="color: #66cc66;">-</span><span style="color: #cc66cc;">27301</span>: OS failure message: No space <span style="color: #993333; font-weight: bold;">LEFT</span> <span style="color: #993333; font-weight: bold;">ON</span> device
ORA<span style="color: #66cc66;">-</span><span style="color: #cc66cc;">27302</span>: failure occurred at: sskgpsemsper</pre></div></div>

<p>sskgpsemsper函数可以很简单的猜测是跟semaphore有关，而ORA-27301则是No space left on device，那么很容易判断应该是操作系统内核参数中semaphore设置的问题。</p>

<div class="wp_syntax"><div class="code"><pre class="shell" style="font-family:monospace;">[root@dbserver ~]# /sbin/sysctl -a | grep sem
kernel.sem = 250        100     32      128</pre></div></div>

<p>而实际上，安装Oracle11gR2的semaphore需求是：<br />
semmsl：250<br />
semmns：32000<br />
semopm：100<br />
semmni：128</p>
<p>很明显semmns和semopm都不足。</p>

<div class="wp_syntax"><div class="code"><pre class="shell" style="font-family:monospace;">[root@dbserver ~]# /sbin/sysctl -w kernel.sem=&quot;250 32000 100 128&quot;
kernel.sem = 250 32000 100 128
[root@dbserver ~]# /sbin/sysctl -a | grep sem
kernel.sem = 250        32000   100     128
[root@dbserver ~]# echo &quot;kernel.sem = 250 32000 100 128&quot;  &gt;&gt; /etc/sysctl.conf
[root@dbserver ~]#</pre></div></div>

<p>重新启动数据库实例正常。</p>
]]></content:encoded>
			<wfw:commentRss>http://www.dbform.com/html/2009/960.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>About RAW Devices Not Supported in Oracle 11g release 2</title>
		<link>http://www.dbform.com/html/2009/918.html</link>
		<comments>http://www.dbform.com/html/2009/918.html#comments</comments>
		<pubDate>Mon, 30 Nov 2009 08:48:10 +0000</pubDate>
		<dc:creator>kamus</dc:creator>
				<category><![CDATA[Oracle Database]]></category>
		<category><![CDATA[Oracle11g]]></category>
		<category><![CDATA[Oracle11gR2]]></category>

		<guid isPermaLink="false">http://www.dbform.com/?p=918</guid>
		<description><![CDATA[<p>很早之前就有传闻Oracle12g（也许不是g）版本将不再支持裸设备。而这份声明在最新发布的Oracle11gR2中就已经有所体现。以下完全通过阅读文档而得，并非实践经验，各位自行取舍。</p> <p>Block and Raw Devices Not Supported with OUI With this release, OUI no longer supports installation of Oracle Clusterware files on block or raw devices. Install Oracle Clusterware files either on Automatic Storage Management diskgroups, or in a supported shared file system.</p> <p>不再支持将文件存储在裸设备上，但是仅仅局限于使用OUI图形界面创建数据库，那么命令行方式应该还是可以的。</p> <p>For new installations, OCR and voting disk files can be <span style="color:#777"> . . . &#8594; Read More: <a href="http://www.dbform.com/html/2009/918.html">About RAW Devices Not Supported in Oracle 11g release 2</a></span>]]></description>
			<content:encoded><![CDATA[<p>很早之前就有传闻Oracle12g（也许不是g）版本将不再支持裸设备。而这份声明在最新发布的Oracle11gR2中就已经有所体现。以下完全通过阅读文档而得，并非实践经验，各位自行取舍。</p>
<blockquote><p>Block and Raw Devices Not Supported with OUI<br />
With this release, OUI no longer supports installation of Oracle Clusterware files on<br />
block or raw devices. Install Oracle Clusterware files either on Automatic Storage<br />
Management diskgroups, or in a supported shared file system.</p></blockquote>
<p>不再支持将文件存储在裸设备上，但是仅仅局限于使用OUI图形界面创建数据库，那么命令行方式应该还是可以的。</p>
<blockquote><p>For new installations, OCR and voting disk files can be placed either on ASM, or on a<br />
cluster file system or NFS system. Installing Oracle Clusterware files on raw or block<br />
devices is no longer supported, unless an existing system is being upgraded.</p></blockquote>
<p>Oracle Clusterwae需要的OCR和Voting disk可以存储在ASM或者集群文件系统或者NFS中，对于全新安装，裸设备不再被支持，但是如果是升级而来的话（比如从10g升级到11g），仍然支持。</p>
<blockquote><p>Voting Disk Backup Procedure Change<br />
In prior releases, backing up the voting disks using a dd command was a required<br />
postinstallation task. With Oracle Clusterware release 11.2 and later, backing up and<br />
restoring a voting disk using the dd command is not supported.<br />
Backing up voting disks manually is no longer required, as voting disks are backed up<br />
automatically in the OCR as part of any configuration change and voting disk data is<br />
automatically restored to any added voting disks.</p></blockquote>
<p>之前Voting disk因为是存储在裸设备中的，因此备份需要使用dd命令来手动执行，在11gR2中，通过dd备份Voting disk不再被支持，同时，也无需通过任何方法手动备份Voting disk了，备份将自动进行。</p>
]]></content:encoded>
			<wfw:commentRss>http://www.dbform.com/html/2009/918.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>runfixup.sh &#8211; Oracle11gR2 Installation New Feature</title>
		<link>http://www.dbform.com/html/2009/881.html</link>
		<comments>http://www.dbform.com/html/2009/881.html#comments</comments>
		<pubDate>Mon, 28 Sep 2009 10:31:01 +0000</pubDate>
		<dc:creator>kamus</dc:creator>
				<category><![CDATA[Oracle Database]]></category>
		<category><![CDATA[Oracle11gR2]]></category>

		<guid isPermaLink="false">http://www.dbform.com/?p=881</guid>
		<description><![CDATA[<p>Oracle11gR2的安装界面跟之前版本比较起来有很大的不同，整体界面更加清新，更加简洁了，比较引人注意的是新的fixup脚本，在安装过程中，安装程序将会检查推荐的操作系统内核参数设置以及必须的软件包，对于不符合要求的部分将会自动生成runfixup.sh，安装人员只需要手动以root用户运行该脚本即可，不再需要像以前那样按照安装手册去自行调整了。</p> <p>在我的安装中，使用的是Oracle Enterprise Linux 5 U3，安装完操作系统之后，没有做任何修改的检查结果如下图。</p> <p></p> <p>点击&#8221;Fix &#038; Check Again&#8221;按钮之后，弹出的窗口显示了runfixup.sh的生成位置。</p> <p></p> <p>在以root用户运行runfixup.sh。</p> [root@dbserver CVU_11.2.0.1.0_oracle]# ./runfixup.sh Response file being used is :./fixup.response Enable file being used is :./fixup.enable Log file location: ./orarun.log Setting Kernel Parameters... kernel.sem = 250 32000 100 128 fs.file-max = 6815744 net.ipv4.ip_local_port_range = 9000 65500 net.core.rmem_default = 262144 net.core.wmem_default = 262144 <span style="color:#777"> . . . &#8594; Read More: <a href="http://www.dbform.com/html/2009/881.html">runfixup.sh &#8211; Oracle11gR2 Installation New Feature</a></span>]]></description>
			<content:encoded><![CDATA[<p>Oracle11gR2的安装界面跟之前版本比较起来有很大的不同，整体界面更加清新，更加简洁了，比较引人注意的是新的fixup脚本，在安装过程中，安装程序将会检查推荐的操作系统内核参数设置以及必须的软件包，对于不符合要求的部分将会自动生成runfixup.sh，安装人员只需要手动以root用户运行该脚本即可，不再需要像以前那样按照安装手册去自行调整了。</p>
<p>在我的安装中，使用的是Oracle Enterprise Linux 5 U3，安装完操作系统之后，没有做任何修改的检查结果如下图。</p>
<p><a href="http://www.flickr.com/photos/kamus/3962319526/" title="mwsnap446 by kamusis, on Flickr"><img src="http://farm3.static.flickr.com/2480/3962319526_17cb3d0032.jpg" width="500" height="376" alt="mwsnap446" /></a></p>
<p>点击&#8221;Fix &#038; Check Again&#8221;按钮之后，弹出的窗口显示了runfixup.sh的生成位置。</p>
<p><a href="http://www.flickr.com/photos/kamus/3961543229/" title="mwsnap447 by kamusis, on Flickr"><img src="http://farm3.static.flickr.com/2544/3961543229_c6345dde71.jpg" width="500" height="376" alt="mwsnap447" /></a></p>
<p>在以root用户运行runfixup.sh。</p>

<div class="wp_syntax"><div class="code"><pre class="shell" style="font-family:monospace;">[root@dbserver CVU_11.2.0.1.0_oracle]# ./runfixup.sh 
Response file being used is :./fixup.response
Enable file being used is :./fixup.enable
Log file location: ./orarun.log
Setting Kernel Parameters...
kernel.sem = 250 32000 100 128
fs.file-max = 6815744
net.ipv4.ip_local_port_range = 9000 65500
net.core.rmem_default = 262144
net.core.wmem_default = 262144
net.core.rmem_max = 4194304
net.core.wmem_max = 1048576
fs.aio-max-nr = 1048576
uid=501(oracle) gid=501(dba) groups=501(dba)</pre></div></div>

<p>之后点击上面窗口的“OK”按钮，安装程序重新检查后的结果。</p>
<p><a href="http://www.flickr.com/photos/kamus/3961543287/" title="mwsnap449 by kamusis, on Flickr"><img src="http://farm3.static.flickr.com/2518/3961543287_ab3d18fbc8.jpg" width="500" height="376" alt="mwsnap449" /></a></p>
<p>这些可以忽略，点击“Ignore All”之后，继续安装，一直到包括创建数据库，都不会出现任何问题。</p>
]]></content:encoded>
			<wfw:commentRss>http://www.dbform.com/html/2009/881.html/feed</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>About ASM and ACFS</title>
		<link>http://www.dbform.com/html/2009/873.html</link>
		<comments>http://www.dbform.com/html/2009/873.html#comments</comments>
		<pubDate>Thu, 10 Sep 2009 03:40:09 +0000</pubDate>
		<dc:creator>kamus</dc:creator>
				<category><![CDATA[Oracle Database]]></category>
		<category><![CDATA[Oracle11gR2]]></category>

		<guid isPermaLink="false">http://www.dbform.com/?p=873</guid>
		<description><![CDATA[<p>在Oracle11gR2中，推出了强劲的ACFS文件系统。</p> <p>那么目前ASM支持哪些文件类型，而ACFS又支持哪些文件类型呢？</p> <p>可以参看官方文档。</p> <p>简单地说，ASM仍旧着眼于支持所有Oracle Database需要的文件，包括数据文件、控制文件、归档日志文件、spfile、RMAN备份文件、Change Tracking文件、数据泵Dump文件以及OCR文件等。</p> <p>而ACFS和Oracle ADVM延展了ASM的支持范围，可以存储告警日志、跟踪文件、BFILEs大对象、还有影像、图片以及其它应用的普通文件。</p> <p>参看：How to create ASM filesystem in Oracle 11gR2</p> ]]></description>
			<content:encoded><![CDATA[<p>在Oracle11gR2中，推出了强劲的ACFS文件系统。</p>
<p>那么目前ASM支持哪些文件类型，而ACFS又支持哪些文件类型呢？</p>
<p>可以参看<a href="http://download.oracle.com/docs/cd/E11882_01/server.112/e10500/asmfiles.htm#g1030822">官方文档</a>。</p>
<p>简单地说，ASM仍旧着眼于支持所有Oracle Database需要的文件，包括数据文件、控制文件、归档日志文件、spfile、RMAN备份文件、Change Tracking文件、数据泵Dump文件以及OCR文件等。</p>
<p>而ACFS和Oracle ADVM延展了ASM的支持范围，可以存储告警日志、跟踪文件、BFILEs大对象、还有影像、图片以及其它应用的普通文件。</p>
<p>参看：<a href="http://www.dbform.com/html/2010/1255.html">How to create ASM filesystem in Oracle 11gR2</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.dbform.com/html/2009/873.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
