<?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>天道酬勤 &#187; raw</title>
	<atom:link href="http://www.ochef.net/tag/raw/feed" rel="self" type="application/rss+xml" />
	<link>http://www.ochef.net</link>
	<description>Oracle and My Life</description>
	<lastBuildDate>Mon, 09 Jan 2012 05:39:00 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>AIX下使用 raw 创建 non-rac 的ASM</title>
		<link>http://www.ochef.net/2009/11/aix-using-raw-create-a-non-rac-of-the-asm.html</link>
		<comments>http://www.ochef.net/2009/11/aix-using-raw-create-a-non-rac-of-the-asm.html#comments</comments>
		<pubDate>Thu, 12 Nov 2009 08:52:16 +0000</pubDate>
		<dc:creator>ochef</dc:creator>
				<category><![CDATA[Database]]></category>
		<category><![CDATA[aix]]></category>
		<category><![CDATA[ASM]]></category>
		<category><![CDATA[non-rac]]></category>
		<category><![CDATA[raw]]></category>

		<guid isPermaLink="false">http://www.ochef.net/?p=692</guid>
		<description><![CDATA[这几天反反复复的折腾ASM for AIX，深刻体会到书到用时方恨少，故作此文记录之。说来惭愧，学习RAC的时候没彻底搞清CRS、CSS、CLUSTERWARE之间的关系；学习ASM的时候没搞清在NON-RAC for AIX环境下的LV和RAW设备。在AIX上安装NON-RAC选用ASM作为存储的10.2的数据库，先是遇到CSS服务启不来，接着是在ASM创建磁盘组的时候发现不了raw设备，一切原于我没有明白AIX下raw设备是如何使用的，不同平台之间意义是不一样的，照葫芦画瓢是行不通的。废话少说，入正题，以下这段内容来自：http://bbs.chinaunix.net/archiver/?tid-1090407.html thesix’s said 在AIX里，每个LVM设备支持两种操作方式，分别被抽象为 Block Device （块设备）和 Character Device （字符设备），其中Character Device 又被称为 Raw Device （原因往下看）：比如： # ls -l /dev/*hdisk0 brw&#8212;&#8212;-   1 root     system       22,  2 May 15 2007  hdisk0 crw&#8212;&#8212;-   2 root     system       22,  2 May 15 2007  rhdisk0 # ls -l /dev/*hd3 brw-rw&#8212;-   1 root     system       10,  7 May 15 [...]<table class="wumii-related-items" cellspacing="0" cellpadding="2" border="0" width="100%" style="clear: both;">
    
    <tr>
        <td ><b><font size="-1"  style="display: block !important; padding: 20px 0 5px !important;">您可能也喜欢：</font></b></td>
    </tr>
    
            <tr>
                <td style="margin: 0 !important; padding: 0 !important; line-height: 20px !important;">
                    <img border="0" src="http://static.wumii.com/images/widget/widget_solidPoint.gif">
                    <a target="_blank" style="text-decoration: none !important;" href="http://app.wumii.com/ext/redirect?url=http%3A%2F%2Fwww.ochef.net%2F2010%2F03%2Faix-network-buffer-parameter-is-set-to-rise-to-rac-failures.html&from=http%3A%2F%2Fwww.ochef.net%2F2009%2F11%2Faix-using-raw-create-a-non-rac-of-the-asm.html">
                        <font size="-1" color="#333333" style="line-height: 1.65em; font-size: 12px !important;">AIX network buffer参数设置引起RAC故障</font>
                    </a>
                </td>
            </tr>
            <tr>
                <td style="margin: 0 !important; padding: 0 !important; line-height: 20px !important;">
                    <img border="0" src="http://static.wumii.com/images/widget/widget_solidPoint.gif">
                    <a target="_blank" style="text-decoration: none !important;" href="http://app.wumii.com/ext/redirect?url=http%3A%2F%2Fwww.ochef.net%2F2009%2F11%2Fconfigure-the-css-on-non-rac-trace-it-linuxunix.html&from=http%3A%2F%2Fwww.ochef.net%2F2009%2F11%2Faix-using-raw-create-a-non-rac-of-the-asm.html">
                        <font size="-1" color="#333333" style="line-height: 1.65em; font-size: 12px !important;">Configure the CSS on Non-RAC &amp; Trace It (LinuxUnix)</font>
                    </a>
                </td>
            </tr>
            <tr>
                <td style="margin: 0 !important; padding: 0 !important; line-height: 20px !important;">
                    <img border="0" src="http://static.wumii.com/images/widget/widget_solidPoint.gif">
                    <a target="_blank" style="text-decoration: none !important;" href="http://app.wumii.com/ext/redirect?url=http%3A%2F%2Fwww.ochef.net%2F2009%2F07%2Faix-stories.html&from=http%3A%2F%2Fwww.ochef.net%2F2009%2F11%2Faix-using-raw-create-a-non-rac-of-the-asm.html">
                        <font size="-1" color="#333333" style="line-height: 1.65em; font-size: 12px !important;">AIX的那些事儿</font>
                    </a>
                </td>
            </tr>
            <tr>
                <td style="margin: 0 !important; padding: 0 !important; line-height: 20px !important;">
                    <img border="0" src="http://static.wumii.com/images/widget/widget_solidPoint.gif">
                    <a target="_blank" style="text-decoration: none !important;" href="http://app.wumii.com/ext/redirect?url=http%3A%2F%2Fwww.ochef.net%2F2009%2F04%2Finstall-oracle-10g-rac-on-rhel4u7.html&from=http%3A%2F%2Fwww.ochef.net%2F2009%2F11%2Faix-using-raw-create-a-non-rac-of-the-asm.html">
                        <font size="-1" color="#333333" style="line-height: 1.65em; font-size: 12px !important;">Install Oracle 10g RAC on RHEL4U7</font>
                    </a>
                </td>
            </tr>
    
    <tr>
        <td  align="right">
            <a style="text-decoration: none !important;" href="http://www.wumii.com/widget/relatedItems" target="_blank" title="无觅相关文章插件">
                <font size="-1" color="#bbbbbb" style="display: block !important; font-family: arial !important; padding: 5px 0 !important; font-size: 12px !important; color: #bbb !important;">无觅</font>
            </a>
        </td>
    </tr>
</table>]]></description>
			<content:encoded><![CDATA[<p>这几天反反复复的折腾ASM for AIX，深刻体会到书到用时方恨少，故作此文记录之。说来惭愧，学习RAC的时候没彻底搞清CRS、CSS、CLUSTERWARE之间的关系；学习ASM的时候没搞清在NON-RAC for AIX环境下的LV和RAW设备。在AIX上安装NON-RAC选用ASM作为存储的10.2的数据库，先是遇到CSS服务启不来，接着是在ASM创建磁盘组的时候发现不了raw设备，一切原于我没有明白AIX下raw设备是如何使用的，不同平台之间意义是不一样的，照葫芦画瓢是行不通的。废话少说，入正题，以下这段内容来自：<a href="http://bbs.chinaunix.net/archiver/?tid-1090407.html">http://bbs.chinaunix.net/archiver/?tid-1090407.html</a> <strong>thesix’s said</strong></p>
<blockquote><p>在AIX里，每个LVM设备支持两种操作方式，分别被抽象为 Block Device （块设备）和 Character Device （字符设备），其中Character Device 又被称为 Raw Device （原因往下看）：比如：</p>
<p># ls -l /dev/*hdisk0</p>
<p>brw&#8212;&#8212;-   1 root     system       22,  2 May 15 2007  hdisk0</p>
<p><span style="color: #ff0000;">crw&#8212;&#8212;-   2 root     system       22,  2 May 15 2007  rhdisk0</span></p>
<p># ls -l /dev/*hd3</p>
<p>brw-rw&#8212;-   1 root     system       10,  7 May 15 2007  /dev/hd3</p>
<p><span style="color: #ff0000;">crw-rw&#8212;-   1 root     system       10,  7 May 15 2007  /dev/rhd3</span></p>
<p>这里文件属性开头的&#8217;c'字母代表Character, 文件名开头的&#8217;r'字母代表Raw。</p>
<p>字符设备支持不定长的数据传输 (data transfers of arbitrary sizes)，最小一个字节（但绝不是每次只能传一个字节或字符！），LVM和存储设备的单次最大I/O只受 LTG (logical track group) 大小的限制，缺省为128KB，可修改。</p>
<p>块设备只能做定长的数据传输，数据必须经过 &#8216;kernel buffer cache&#8217;。这个以512-byte block 为单位的buffer cache是传统的块设备的缓存，千万不要和文件系统的缓存混为一谈！这样的存取方式不仅效率低，而且带来诸多问题，严重影响大数据量传输的性能，所以现代操作系统中几乎不用块设备的方式进行高速存储设备的数据存取。</p>
<p>数据库建议直接使用裸设备，意指避开文件系统和文件系统的缓存管理，直接和字符设备打交道。</p>
<p>（注意：文件系统一定是建在字符设备上的，不可能建到块设备上）</p>
<p>这样做的好处主要是三个：</p>
<p>1. 实现每个I/O的代码大大减少：filesystem 和 virtual memory for filesystem 的代码都规避了。</p>
<p>2. 避免了重复缓存造成的内存浪费（数据库和文件系统都有自己的数据缓存）。</p>
<p>3. 避免了文件锁的问题：文件系统里的文件不能同时被多个进程或线程更新。</p>
<p>坏处也有：</p>
<p>1. 失去了通过对普通文件进行管理的易用性。</p>
<p>2. 不能利用文件系统的 Readahead 的功能，顺序读的速度可能做不到最优</p>
<p>自从有了DIO和CIO之后，基于文件系统的数据库性能得以大大提高。CIO是最接近与裸设备的一种基于文件系统的数据库运行方式，因为它解决了两个问题：</p>
<p>没有文件缓存（就是裸设备优势之2.）;</p>
<p>没有文件锁（就是裸设备优势之3.）。</p>
<p>它保持了文件的可见性，所以不存在裸设备劣势之1。</p>
<p>当然DIO和CIO同样不支持Readahead。</p>
<p>综上所述：</p>
<p>-          字符设备和块设备是对同一个物理设备的两种不同的存储方式的抽象。</p>
<p>-          裸设备这个感念是针对其上有无文件系统来说的，和字符及块设备在概念上没有任何实质联系；</p>
<p>-          块设备的block buffer机制和文件系统的缓存是两回事；</p>
<p>-          块设备在现代操作系统中基本没有任何用途。</p>
<p>-          数据库用裸设备或文件系统mount with CIO, 结合AIO （异步I/O），可以达到最佳I/O性能</p>
<p>（在AIX 新版本中raw LV 和 CIO FS 均支持 AIO Fast Path ）；</p>
<p>注：相关概念或称谓在不同的操作系统中可能不尽相同，但原理是一样的。</p></blockquote>
<p>现在看看我的环境：（AIX5310 + ORA10.2.0.4.0）</p>
<p>1. 创建可扩展的VG</p>
<p># mkvg -S -y datavg hdisk1</p>
<p>2. 创建LV，使用raw设备</p>
<p># mklv -y lv_dg1 -t raw datavg 40 (pp size 128MB)</p>
<p># mklv -y lv_dg2 -t raw datavg 40</p>
<p># mklv -y lv_flashback -t raw datavg 16</p>
<p>3. 修改属主、权限</p>
<p># chown oracle:dba /dev/*lv_dg*</p>
<p># chown oracle:dba /dev/rlv_flashback</p>
<p># chmod 660 /dev/*lv_dg*</p>
<p># chmod 660 /dev/rlv_flashback</p>
<p>4. 检查</p>
<p># ls -al /dev/rlv*</p>
<p>crw-rw&#8212;-    1 oracle   dba          42,  1 Nov 12 12:36 /dev/rlv_dg1</p>
<p>crw-rw&#8212;-    1 oracle   dba          42,  2 Nov 12 12:37 /dev/rlv_dg2</p>
<p>crw-rw&#8212;-    1 oracle   dba          42,  3 Nov 12 12:37 /dev/rlv_flashback</p>
<p>做完这些，在ASM创建磁盘组的时候指定相应路径 /dev/rlv_* 即可。</p>
<p><img class="alignnone size-full wp-image-693" title="asm_aix" src="http://www.ochef.net/wp-content/uploads/2009/11/asm_aix.jpg" alt="asm_aix" width="550" height="326" /></p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
</pre></td><td class="code"><pre class="sql" style="font-family:monospace;">SQL<span style="color: #66cc66;">&gt;</span>select group_number<span style="color: #66cc66;">,</span>name<span style="color: #66cc66;">,</span>state <span style="color: #993333; font-weight: bold;">FROM</span> v$asm_diskgroup;
&nbsp;
GROUP_NUMBER     NAME                  STATE
&nbsp;
<span style="color: #808080; font-style: italic;">------------    --------------------- -----------</span>
&nbsp;
<span style="color: #cc66cc;">1</span>                 DG1                   CONNECTED
&nbsp;
<span style="color: #cc66cc;">2</span>                 DG2                   MOUNTED
&nbsp;
<span style="color: #cc66cc;">3</span>                 DG_FLASHBACK          CONNECTED</pre></td></tr></table></div>

<p>-The End-</p>
<table class="wumii-related-items" cellspacing="0" cellpadding="2" border="0" width="100%" style="clear: both;">
    
    <tr>
        <td ><b><font size="-1"  style="display: block !important; padding: 20px 0 5px !important;">您可能也喜欢：</font></b></td>
    </tr>
    
            <tr>
                <td style="margin: 0 !important; padding: 0 !important; line-height: 20px !important;">
                    <img border="0" src="http://static.wumii.com/images/widget/widget_solidPoint.gif">
                    <a target="_blank" style="text-decoration: none !important;" href="http://app.wumii.com/ext/redirect?url=http%3A%2F%2Fwww.ochef.net%2F2010%2F03%2Faix-network-buffer-parameter-is-set-to-rise-to-rac-failures.html&from=http%3A%2F%2Fwww.ochef.net%2F2009%2F11%2Faix-using-raw-create-a-non-rac-of-the-asm.html">
                        <font size="-1" color="#333333" style="line-height: 1.65em; font-size: 12px !important;">AIX network buffer参数设置引起RAC故障</font>
                    </a>
                </td>
            </tr>
            <tr>
                <td style="margin: 0 !important; padding: 0 !important; line-height: 20px !important;">
                    <img border="0" src="http://static.wumii.com/images/widget/widget_solidPoint.gif">
                    <a target="_blank" style="text-decoration: none !important;" href="http://app.wumii.com/ext/redirect?url=http%3A%2F%2Fwww.ochef.net%2F2009%2F11%2Fconfigure-the-css-on-non-rac-trace-it-linuxunix.html&from=http%3A%2F%2Fwww.ochef.net%2F2009%2F11%2Faix-using-raw-create-a-non-rac-of-the-asm.html">
                        <font size="-1" color="#333333" style="line-height: 1.65em; font-size: 12px !important;">Configure the CSS on Non-RAC &amp; Trace It (LinuxUnix)</font>
                    </a>
                </td>
            </tr>
            <tr>
                <td style="margin: 0 !important; padding: 0 !important; line-height: 20px !important;">
                    <img border="0" src="http://static.wumii.com/images/widget/widget_solidPoint.gif">
                    <a target="_blank" style="text-decoration: none !important;" href="http://app.wumii.com/ext/redirect?url=http%3A%2F%2Fwww.ochef.net%2F2009%2F07%2Faix-stories.html&from=http%3A%2F%2Fwww.ochef.net%2F2009%2F11%2Faix-using-raw-create-a-non-rac-of-the-asm.html">
                        <font size="-1" color="#333333" style="line-height: 1.65em; font-size: 12px !important;">AIX的那些事儿</font>
                    </a>
                </td>
            </tr>
            <tr>
                <td style="margin: 0 !important; padding: 0 !important; line-height: 20px !important;">
                    <img border="0" src="http://static.wumii.com/images/widget/widget_solidPoint.gif">
                    <a target="_blank" style="text-decoration: none !important;" href="http://app.wumii.com/ext/redirect?url=http%3A%2F%2Fwww.ochef.net%2F2009%2F04%2Finstall-oracle-10g-rac-on-rhel4u7.html&from=http%3A%2F%2Fwww.ochef.net%2F2009%2F11%2Faix-using-raw-create-a-non-rac-of-the-asm.html">
                        <font size="-1" color="#333333" style="line-height: 1.65em; font-size: 12px !important;">Install Oracle 10g RAC on RHEL4U7</font>
                    </a>
                </td>
            </tr>
    
    <tr>
        <td  align="right">
            <a style="text-decoration: none !important;" href="http://www.wumii.com/widget/relatedItems" target="_blank" title="无觅相关文章插件">
                <font size="-1" color="#bbbbbb" style="display: block !important; font-family: arial !important; padding: 5px 0 !important; font-size: 12px !important; color: #bbb !important;">无觅</font>
            </a>
        </td>
    </tr>
</table>]]></content:encoded>
			<wfw:commentRss>http://www.ochef.net/2009/11/aix-using-raw-create-a-non-rac-of-the-asm.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

