<?xml version="1.0" encoding="GB2312"?>
<rss version="2.0">
<channel>
<title>Friends Life and Oracle</title>
<link>http://www.eygle.com/blog/</link>
<description>eygle的Oracle Blog，提供Oracle技术研究及深入探讨，同时记录个人爱好及生活历程。</description>
<copyright>Copyright 2006</copyright>
<lastBuildDate>Wed, 22 Nov 2006 13:26:06 +0800</lastBuildDate>
<generator>http://www.movabletype.org/?v=3.33</generator>
<docs>http://blogs.law.harvard.edu/tech/rss</docs> 

<item>
<title>如何在sqlldr中倒入多字符分隔符文件</title>
<description><![CDATA[<p>今天有朋友询问：<br />
我们...应用系统很多，它们之间要交换很多数据，目前是以文本方式交换，问题是文本的分隔符号是（|+|），为三个字符，主要是避免数据的混淆.....</p>

<p>这样的文件能够用sqlldr导入么?</p>

<p>我测试了一下，试验证明是可以的，sqlldr支持多字符分隔符文件导入。<br />
首先看我的数据文件和控制文件:<br />
<blockquote>[oracle@jumper tmp]$ cat data.ctl <br />
load data<br />
into table TEST<br />
fields terminated by "|+|"<br />
(<br />
        T_ID,<br />
        T_VOL<br />
)<br />
[oracle@jumper tmp]$ cat data.txt <br />
20021228000000|+|00120000<br />
20021228000000|+|00130000<br />
20021228000000|+|00140000<br />
20021||8000000|+|00140000<br />
20021++8000000|+|00140000</blockquote><br />
创建测试表:<br />
<blockquote>[oracle@jumper tmp]$ sqlplus eygle/eygle</p>

<p>SQL*Plus: Release 9.2.0.4.0 - Production on Tue Nov 21 13:21:16 2006</p>

<p>Copyright (c) 1982, 2002, Oracle Corporation.  All rights reserved.</p>

<p><br />
Connected to:<br />
Oracle9i Enterprise Edition Release 9.2.0.4.0 - Production<br />
With the Partitioning option<br />
JServer Release 9.2.0.4.0 - Production</p>

<p>SQL> create table test<br />
  2  (T_ID      varchar2(20),<br />
  3   T_VOL     varchar2(20)<br />
  4  );</p>

<p>Table created.</p>

<p>SQL> exit<br />
Disconnected from Oracle9i Enterprise Edition Release 9.2.0.4.0 - Production<br />
With the Partitioning option<br />
JServer Release 9.2.0.4.0 - Production</blockquote></p>

<p>加载数据:<br />
<blockquote>[oracle@jumper tmp]$ sqlldr eygle/eygle control=data.ctl data=data.txt </p>

<p>SQL*Loader: Release 9.2.0.4.0 - Production on Tue Nov 21 13:23:53 2006</p>

<p>Copyright (c) 1982, 2002, Oracle Corporation.  All rights reserved.</p>

<p>Commit point reached - logical record count 5<br />
[oracle@jumper tmp]$ sqlplus eygle/eygle</p>

<p>SQL*Plus: Release 9.2.0.4.0 - Production on Tue Nov 21 13:23:57 2006</p>

<p>Copyright (c) 1982, 2002, Oracle Corporation.  All rights reserved.</p>

<p><br />
Connected to:<br />
Oracle9i Enterprise Edition Release 9.2.0.4.0 - Production<br />
With the Partitioning option<br />
JServer Release 9.2.0.4.0 - Production</p>

<p>SQL> select * from test;</p>

<p>T_ID                 T_VOL<br />
-------------------- --------------------<br />
20021228000000       00120000<br />
20021228000000       00130000<br />
20021228000000       00140000<br />
20021||8000000       00140000<br />
20021++8000000       00140000</p>

<p>SQL> exit<br />
Disconnected from Oracle9i Enterprise Edition Release 9.2.0.4.0 - Production<br />
With the Partitioning option<br />
JServer Release 9.2.0.4.0 - Production</blockquote></p>

<p>只作了简单验证，不知道复杂情况会不会有问题。</p>

<p>-The End-<br />
</p>]]></description>
<link>http://www.eygle.com/archives/2006/11/sqlldr_multi_separator.html</link>
<guid>http://www.eygle.com/archives/2006/11/sqlldr_multi_separator.html</guid>
<category>HowTo</category>
<pubDate>Wed, 22 Nov 2006 13:26:06 +0800</pubDate>
</item>
<item>
<title>如何更改监听器日志文件名称</title>
<description><![CDATA[<p>今天一个数据库的监听器日志出了点问题，用set log_file命令重新定位一个日志文件得以解决。</p>

<p>发现以下两个命令很有用:</p>

<blockquote>LSNRCTL&gt; set current_listener &lt;listener name&gt; <BR>LSNRCTL&gt; set log_file &lt;sid name&gt;.log <BR></blockquote>

<p>使用set current_listener可以访问非缺省监听器，使用set log_file更改名称后，原来有问题的日志文件可以清除或实现日志重定位:<br />
<blockquote><P>[oracle@jumper admin]$ lsnrctl </P><br />
<P>LSNRCTL for Linux: Version 9.2.0.4.0 - Production on 10-NOV-2006 16:54:16</P><br />
<P>Copyright (c) 1991, 2002, Oracle Corporation.&nbsp; All rights reserved.</P><br />
<P>Welcome to LSNRCTL, type "help" for information.</P><br />
<P>LSNRCTL&gt; set current_listener LISTENER1<BR>Current Listener is LISTENER1<BR>LSNRCTL&gt; set log_file<BR>Parameter Value: a.log<BR>Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=IPC)(KEY=EXTPROC)))<BR>LISTENER1 parameter "log_file" set to a.log<BR>The command completed successfully<BR>LSNRCTL&gt; status<BR>Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=IPC)(KEY=EXTPROC)))<BR>STATUS of the LISTENER<BR>------------------------<BR>Alias&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; LISTENER1<BR>Version&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; TNSLSNR for Linux: Version 9.2.0.4.0 - Production<BR>Start Date&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 10-NOV-2006 16:54:12<BR>Uptime&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 0 days 0 hr. 2 min. 6 sec<BR>Trace Level&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; off<BR>Security&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; OFF<BR>SNMP&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; OFF<BR>Listener Parameter File&nbsp;&nbsp; /opt/oracle/product/9.2.0/network/admin/listener.ora<BR>Listener Log File&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; /opt/oracle/product/9.2.0/network/log/a.log<BR>Listening Endpoints Summary...<BR>&nbsp; (DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=EXTPROC)))<BR>&nbsp; (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=172.16.33.11)(PORT=1521)))<BR>Services Summary...<BR>Service "PLSExtProc" has 1 instance(s).<BR>&nbsp; Instance "PLSExtProc", status UNKNOWN, has 1 handler(s) for this service...<BR>Service "conner" has 1 instance(s).<BR>&nbsp; Instance "conner", status UNKNOWN, has 1 handler(s) for this service...<BR>Service "eygle" has 1 instance(s).<BR>&nbsp; Instance "eygle", status UNKNOWN, has 1 handler(s) for this service...<BR>The command completed successfully<BR>LSNRCTL&gt; </P></blockquote></p>

<p>如果需要将这个修改永久化，需要使用save_config命令保存一下：<br />
<blockquote>LSNRCTL> save_config<br />
Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=IPC)(KEY=EXTPROC)))<br />
Saved LISTENER1 configuration parameters.<br />
Listener Parameter File   /opt/oracle/product/9.2.0/network/admin/listener.ora<br />
Old Parameter File   /opt/oracle/product/9.2.0/network/admin/listener.bak<br />
The command completed successfully</blockquote></p>

<p>此时listener.ora文件会被增加如下记录：<br />
<blockquote>[oracle@jumper oracle]$ tail -5 /opt/oracle/product/9.2.0/network/admin/listener.ora</p>

<p><br />
#----ADDED BY TNSLSNR 14-NOV-2006 16:39:12---<br />
LOG_FILE_LISTENER1 = a.log<br />
#--------------------------------------------</blockquote></p>

<p>记录一下。</p>

<p>-The End-<br />
</p>]]></description>
<link>http://www.eygle.com/archives/2006/11/lsnrctl_set_logfile.html</link>
<guid>http://www.eygle.com/archives/2006/11/lsnrctl_set_logfile.html</guid>
<category>Case</category>
<pubDate>Fri, 10 Nov 2006 17:33:35 +0800</pubDate>
</item>
<item>
<title>如何通过DB link进行远程过程或函数调用</title>
<description><![CDATA[<p>有朋友在<a href="http://www.eygle.com/gbook/reply.php?gbid=18932">留言板问</a>:如何通过动态sql远程调用包里面的函数，并返回值。</p>

<p>我简单做了一个例子，实现以上要求.<br />
首先进行适当授权：<br />
<blockquote>[oracle@jumper oracle]$ sqlplus "/ as sysdba"</p>

<p>SQL*Plus: Release 9.2.0.4.0 - Production on Tue Nov 7 21:07:56 2006</p>

<p>Copyright (c) 1982, 2002, Oracle Corporation.  All rights reserved.</p>

<p><br />
Connected to:<br />
Oracle9i Enterprise Edition Release 9.2.0.4.0 - Production<br />
With the Partitioning option<br />
JServer Release 9.2.0.4.0 - Production</p>

<p>SQL> grant create public database link to eygle;</p>

<p>Grant succeeded.<br />
SQL> grant all on dbms_flashback to eygle;</p>

<p>Grant succeeded.</blockquote></p>

<p>建立DB Link:<br />
<blockquote>SQL> connect eygle/eygle<br />
Connected.<br />
SQL> create public database link hsbill using 'hsbill';</p>

<p>Database link created.</p>

<p>SQL> select db_link from dba_db_links;</p>

<p>DB_LINK<br />
---------------------------------------------------<br />
HSBILL</p>

<p>SQL> select * from dual@hsbill;</p>

<p>D<br />
-<br />
X</blockquote></p>

<p>此后可以尝试使用DB Link进行远程和本地执行:</p>

<p>SQL> set serveroutput on<br />
SQL> set feedback off<br />
SQL> declare<br />
  2  r_gname    varchar2(40);<br />
  3  l_gname    varchar2(40);<br />
  4  begin<br />
  5     execute immediate<br />
  6     'select GLOBAL_NAME from global_name@hsbill' into r_gname;<br />
  7     dbms_output.put_line('gname of remote:'||r_gname);<br />
  8     select GLOBAL_NAME into l_gname from global_name;<br />
  9     dbms_output.put_line('gname of locald:'||l_gname);<br />
 10  end;<br />
 11  /<br />
gname of remote:HSBILL.HURRAY.COM.CN<br />
gname of locald:EYGLE</p>

<p>远程Package或Function调用也可以随之实现:</p>

<p>SQL> declare<br />
  2  r_scn      number;<br />
  3  l_scn      number;<br />
  4  begin<br />
  5     execute immediate<br />
  6     'select dbms_flashback.GET_SYSTEM_CHANGE_NUMBER@hsbill from dual' into r_scn;<br />
  7     dbms_output.put_line('scn of remote:'||r_scn);<br />
  8  end;<br />
  9  /<br />
scn of remote:18992092687</p>

<p>SQL> </p>

<p>-The End-</p>]]></description>
<link>http://www.eygle.com/archives/2006/11/db_link_remote_function.html</link>
<guid>http://www.eygle.com/archives/2006/11/db_link_remote_function.html</guid>
<category>HowTo</category>
<pubDate>Tue, 07 Nov 2006 21:36:37 +0800</pubDate>
</item>
<item>
<title>如何启动DataGuard的备用数据库</title>
<description><![CDATA[<p>一大早来到公司，打开邮箱，发现收到了一堆的报警邮件，一个Standby数据库Down掉了。</p>

<p>登陆检查主库，警告日志记录了错误信息:<br />
<blockquote>*** 2006-10-30 07:32:10.614<br />
kcrrfail: dest:2 err:12560 force:0<br />
ORA-12560: TNS:protocol adapter error<br />
*** 2006-10-30 07:34:10.615<br />
Error 12541 connecting to destination LOG_ARCHIVE_DEST_2 standby host 'bmarksb'<br />
Error 12541 attaching to destination LOG_ARCHIVE_DEST_2 standby host 'bmarksb'<br />
Heartbeat failed to connect to standby 'bmarksb'. Error is 12541.<br />
*** 2006-10-30 07:34:10.615<br />
kcrrfail: dest:2 err:12541 force:0<br />
ORA-12541: TNS:no listener<br />
*** 2006-10-30 07:36:10.615<br />
Error 12541 connecting to destination LOG_ARCHIVE_DEST_2 standby host 'bmarksb'<br />
Error 12541 attaching to destination LOG_ARCHIVE_DEST_2 standby host 'bmarksb'<br />
Heartbeat failed to connect to standby 'bmarksb'. Error is 12541.</blockquote></p>

<p>马上登陆从库主机，手工启动备用数据库：<br />
<blockquote>[oracle@wapcom2 bdump]$ sqlplus "/ as sysdba"</p>

<p>SQL*Plus: Release 9.2.0.6.0 - Production on Mon Oct 30 08:17:24 2006</p>

<p>Copyright (c) 1982, 2002, Oracle Corporation.  All rights reserved.</p>

<p>Connected to an idle instance.</p>

<p>SQL> startup nomount;<br />
ORACLE instance started.</p>

<p>Total System Global Area  470881780 bytes<br />
Fixed Size                   452084 bytes<br />
Variable Size             167772160 bytes<br />
Database Buffers          301989888 bytes<br />
Redo Buffers                 667648 bytes<br />
SQL> alter database mount standby database;</p>

<p>Database altered.</p>

<p>SQL> alter database recover managed standby database disconnect from session;</p>

<p>Database altered.</p>

<p>SQL> exit<br />
Disconnected from Oracle9i Enterprise Edition Release 9.2.0.6.0 - Production<br />
With the Partitioning, OLAP and Oracle Data Mining options<br />
JServer Release 9.2.0.6.0 - Production<br />
[oracle@wapcom2 bdump]$ lsnrctl start</blockquote></p>

<p>观察从库的日志信息，发现归档可以自动应用:<br />
<blockquote>[oracle@wapcom2 bdump]$ tail -f alert_bmark.log<br />
Standby Database mounted.<br />
Completed: alter database mount standby database<br />
Mon Oct 30 08:19:23 2006<br />
alter database recover managed standby database disconnect from session<br />
Attempt to start background Managed Standby Recovery process<br />
MRP0 started with pid=12<br />
MRP0: Background Managed Standby Recovery process started<br />
Media Recovery Waiting for thread 1 seq# 5151<br />
Mon Oct 30 08:19:29 2006<br />
Completed: alter database recover managed standby database di<br />
Mon Oct 30 08:22:58 2006<br />
Media Recovery Log /opt/oracle/oradata/bmark/stdarch/1_5151.arc<br />
Media Recovery Log /opt/oracle/oradata/bmark/stdarch/1_5152.arc<br />
Media Recovery Log /opt/oracle/oradata/bmark/stdarch/1_5153.arc<br />
Media Recovery Log /opt/oracle/oradata/bmark/stdarch/1_5154.arc<br />
Media Recovery Log /opt/oracle/oradata/bmark/stdarch/1_5155.arc<br />
Media Recovery Waiting for thread 1 seq# 5156</blockquote></p>

<p>再检查原因，发现原来是主机出现问题，在夜间不断重起：<br />
<blockquote>-bash-2.05b$ last |grep reboot<br />
reboot   system boot  2.4.21-15.ELsmp  Mon Oct 30 08:10          (02:14)    <br />
reboot   system boot  2.4.21-15.ELsmp  Mon Oct 30 07:51          (02:32)    <br />
reboot   system boot  2.4.21-15.ELsmp  Mon Oct 30 07:38          (02:45)    <br />
reboot   system boot  2.4.21-15.ELsmp  Mon Oct 30 07:35          (02:48)    <br />
reboot   system boot  2.4.21-15.ELsmp  Mon Oct 30 07:21          (03:02)    <br />
reboot   system boot  2.4.21-15.ELsmp  Mon Oct 30 07:18          (03:05)    <br />
reboot   system boot  2.4.21-15.ELsmp  Mon Oct 30 06:39          (03:44)    <br />
reboot   system boot  2.4.21-15.ELsmp  Mon Oct 30 06:37          (03:46)    <br />
reboot   system boot  2.4.21-15.ELsmp  Mon Oct 30 06:32          (03:51)    <br />
reboot   system boot  2.4.21-15.ELsmp  Mon Oct 30 06:03          (04:21)    <br />
reboot   system boot  2.4.21-15.ELsmp  Mon Oct 30 01:48          (08:36)    <br />
reboot   system boot  2.4.21-15.ELsmp  Mon Oct 30 01:23          (09:01)    <br />
reboot   system boot  2.4.21-15.ELsmp  Mon Oct 30 00:39          (09:44)    </blockquote></p>

<p>初步看来是硬件出现了故障，<a href="http://www.eygle.com/archives/2006/10/system_tbs_io_corruption.html">最近</a>的硬件故障极为频繁，年底也到了<a href="http://www.eygle.com/archives/2006/01/backup_is_most_important.html">事故多发期</a>。<br />
提醒大家也多多注意。</p>

<p>参考文档：<br />
<a href="http://www.eygle.com/ha/dataguard-step-by-step.htm">http://www.eygle.com/ha/dataguard-step-by-step.htm</a></p>

<p>-The End-<br />
</p>]]></description>
<link>http://www.eygle.com/archives/2006/10/start_dataguard_db.html</link>
<guid>http://www.eygle.com/archives/2006/10/start_dataguard_db.html</guid>
<category>Case</category>
<pubDate>Mon, 30 Oct 2006 10:57:20 +0800</pubDate>
</item>
<item>
<title>UTL_INADDR包获取ip地址的内部原理</title>
<description><![CDATA[<p>今天有朋友在MSN上问我如何获得已经连接用户的IP地址。</p>

<p>我们知道，通过SYS_CONTEXT函数可以获得这部分信息，当前用户的ip等信息可以通过如下命令轻易获取：</p>

<blockquote>SQL> select sys_context('userenv','host') from dual;

<p>SYS_CONTEXT('USERENV','HOST')<br />
--------------------------------------------------------------------------------<br />
WORKGROUP\GQGAI</p>

<p>SQL> select sys_context('userenv','ip_address') from dual;</p>

<p>SYS_CONTEXT('USERENV','IP_ADDR<br />
--------------------------------------------------------------------------------<br />
172.16.34.20</blockquote></p>

<p>可是如果我们希望获取其它session的地址信息等，通过SYS_CONTEXT函数就只能通过LOGON触发器来完成。</p>

<p>而如果没有触发器记录，则我们可以通过UTL_INADDR Package来实现。<br />
我们看一下UTL_INADDR包获取ip等信息的实现原理。</p>

<p>我们在数据库中进行如下查询：<br />
<blockquote>[oracle@jumper oracle]$ sqlplus "/ as sysdba"</p>

<p>SQL*Plus: Release 9.2.0.4.0 - Production on Wed Oct 25 11:24:22 2006</p>

<p>Copyright (c) 1982, 2002, Oracle Corporation.  All rights reserved.</p>

<p><br />
Connected to:<br />
Oracle9i Enterprise Edition Release 9.2.0.4.0 - Production<br />
With the Partitioning option<br />
JServer Release 9.2.0.4.0 - Production</p>

<p>SQL> !<br />
[oracle@jumper oracle]$ ps -ef|grep sql<br />
oracle   14700 14663  1 11:24 pts/0    00:00:00 sqlplus            <br />
oracle   14732 14702  0 11:24 pts/0    00:00:00 grep sql<br />
[oracle@jumper oracle]$ ps -ef|grep LO<br />
oracle   14701 14700  0 11:24 ?        00:00:00 oracleeygle (DESCRIPTION=(LOCAL=YES)(ADDRESS=(PROTOCOL=beq)))<br />
oracle   14734 14702  0 11:24 pts/0    00:00:00 grep LO<br />
[oracle@jumper oracle]$ exit<br />
exit</p>

<p>SQL> SELECT UTL_INADDR.get_host_address('www.anysql.net') from dual;</p>

<p>UTL_INADDR.GET_HOST_ADDRESS('WWW.ANYSQL.NET')<br />
---------------------------------------------------------------------<br />
208.113.151.109</blockquote></p>

<p>在Linux中我们通过strace跟踪这个进程，可以得到以下堆栈信息:<br />
<blockquote>[oracle@jumper oracle]$ strace -p 14701<br />
Process 14701 attached - interrupt to quit<br />
read(7, "\0\313\0\0\6\0\0\0\0\0\3^\10a\200\0\0\0\0\0\0@\342\22\10"..., 2064) = 203<br />
gettimeofday({1161746697, 269895}, NULL) = 0<br />
getrusage(RUSAGE_SELF, {ru_utime={0, 30000}, ru_stime={0, 10000}, ...}) = 0<br />
getrusage(RUSAGE_SELF, {ru_utime={0, 40000}, ru_stime={0, 10000}, ...}) = 0<br />
gettimeofday({1161746697, 270542}, NULL) = 0<br />
gettimeofday({1161746697, 270670}, NULL) = 0<br />
getrusage(RUSAGE_SELF, {ru_utime={0, 40000}, ru_stime={0, 10000}, ...}) = 0<br />
getrusage(RUSAGE_SELF, {ru_utime={0, 40000}, ru_stime={0, 10000}, ...}) = 0<br />
gettimeofday({1161746697, 271614}, NULL) = 0<br />
gettimeofday({1161746697, 271748}, NULL) = 0<br />
getrusage(RUSAGE_SELF, {ru_utime={0, 40000}, ru_stime={0, 10000}, ...}) = 0<br />
getrusage(RUSAGE_SELF, {ru_utime={0, 40000}, ru_stime={0, 10000}, ...}) = 0<br />
gettimeofday({1161746697, 272347}, NULL) = 0<br />
gettimeofday({1161746697, 272699}, NULL) = 0<br />
getrusage(RUSAGE_SELF, {ru_utime={0, 40000}, ru_stime={0, 10000}, ...}) = 0<br />
gettimeofday({1161746697, 272989}, NULL) = 0<br />
gettimeofday({1161746697, 273140}, NULL) = 0<br />
gettimeofday({1161746697, 273273}, NULL) = 0<br />
getrusage(RUSAGE_SELF, {ru_utime={0, 40000}, ru_stime={0, 10000}, ...}) = 0<br />
gettimeofday({1161746697, 273771}, NULL) = 0<br />
gettimeofday({1161746697, 275526}, NULL) = 0<br />
getpid()                                = 14701<br />
open("/etc/resolv.conf", O_RDONLY)      = 12<br />
fstat64(12, {st_mode=S_IFREG|0644, st_size=46, ...}) = 0<br />
mmap2(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0xb6fba000<br />
read(12, "search hurray.com.cn\nnameserver "..., 4096) = 46<br />
read(12, "", 4096)                      = 0<br />
close(12)                               = 0<br />
munmap(0xb6fba000, 4096)                = 0<br />
socket(PF_UNIX, SOCK_STREAM, 0)         = 12<br />
connect(12, {sa_family=AF_UNIX, path="/var/run/.nscd_socket"}, 110) = -1 ENOENT (No such file or directory)<br />
close(12)                               = 0<br />
open("/etc/host.conf", O_RDONLY)        = 12<br />
fstat64(12, {st_mode=S_IFREG|0644, st_size=17, ...}) = 0<br />
mmap2(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0xb6fba000<br />
read(12, "order hosts,bind\n", 4096)    = 17<br />
read(12, "", 4096)                      = 0<br />
close(12)                               = 0<br />
munmap(0xb6fba000, 4096)                = 0<br />
futex(0xb71a1a20, FUTEX_WAKE, 2147483647) = 0<br />
open("/etc/hosts", O_RDONLY)            = 12<br />
fcntl64(12, F_GETFD)                    = 0<br />
fcntl64(12, F_SETFD, FD_CLOEXEC)        = 0<br />
fstat64(12, {st_mode=S_IFREG|0644, st_size=175, ...}) = 0<br />
mmap2(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0xb6fba000<br />
read(12, "# Do not remove the following li"..., 4096) = 175<br />
read(12, "", 4096)                      = 0<br />
close(12)                               = 0<br />
munmap(0xb6fba000, 4096)                = 0<br />
open("/opt/oracle/product/9.2.0/lib/libnss_dns.so.2", O_RDONLY) = -1 ENOENT (No such file or directory)<br />
open("/lib/tls/libnss_dns.so.2", O_RDONLY) = -1 ENOENT (No such file or directory)<br />
open("/lib/i686/libnss_dns.so.2", O_RDONLY) = -1 ENOENT (No such file or directory)<br />
open("/lib/libnss_dns.so.2", O_RDONLY)  = 12<br />
read(12, "\177ELF\1\1\1\0\0\0\0\0\0\0\0\0\3\0\3\0\1\0\0\0\240\16"..., 512) = 512<br />
fstat64(12, {st_mode=S_IFREG|0755, st_size=18632, ...}) = 0<br />
old_mmap(NULL, 17100, PROT_READ|PROT_EXEC, MAP_PRIVATE, 12, 0) = 0xb6fb6000<br />
old_mmap(0xb6fba000, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED, 12, 0x3000) = 0xb6fba000<br />
close(12)                               = 0<br />
open("/opt/oracle/product/9.2.0/lib/libresolv.so.2", O_RDONLY) = -1 ENOENT (No such file or directory)<br />
open("/lib/tls/libresolv.so.2", O_RDONLY) = -1 ENOENT (No such file or directory)<br />
open("/lib/i686/libresolv.so.2", O_RDONLY) = -1 ENOENT (No such file or directory)<br />
open("/lib/libresolv.so.2", O_RDONLY)   = 12<br />
read(12, "\177ELF\1\1\1\0\0\0\0\0\0\0\0\0\3\0\3\0\1\0\0\0\320(\0"..., 512) = 512<br />
fstat64(12, {st_mode=S_IFREG|0755, st_size=76508, ...}) = 0<br />
old_mmap(NULL, 73604, PROT_READ|PROT_EXEC, MAP_PRIVATE, 12, 0) = 0xb6fa4000<br />
old_mmap(0xb6fb3000, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED, 12, 0xf000) = 0xb6fb3000<br />
old_mmap(0xb6fb4000, 8068, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_ANONYMOUS, -1, 0) = 0xb6fb4000<br />
close(12)                               = 0<br />
socket(PF_INET, SOCK_DGRAM, IPPROTO_IP) = 12<br />
connect(12, {sa_family=AF_INET, sin_port=htons(53), sin_addr=inet_addr("208.113.151.109")}, 28) = 0<br />
send(12, "\324#\1\0\0\1\0\0\0\0\0\0\3www\5anysql\3com\0\0\1\0\1", 31, 0) = 31<br />
gettimeofday({1161746697, 286025}, NULL) = 0<br />
poll([{fd=12, events=POLLIN, revents=POLLIN}], 1, 5000) = 1<br />
ioctl(12, FIONREAD, [74])               = 0<br />
recvfrom(12, "\324#\201\200\0\1\0\1\0\1\0\0\3www\5anysql\3com\0\0\1\0"..., 1024, 0, <br />
{sa_family=AF_INET, sin_port=htons(53), sin_addr=inet_addr("208.113.151.109")}, [16]) = 74<br />
close(12)                               = 0<br />
gettimeofday({1161746697, 290245}, NULL) = 0<br />
getrusage(RUSAGE_SELF, {ru_utime={0, 40000}, ru_stime={0, 20000}, ...}) = 0<br />
getrusage(RUSAGE_SELF, {ru_utime={0, 40000}, ru_stime={0, 20000}, ...}) = 0<br />
gettimeofday({1161746697, 291553}, NULL) = 0<br />
write(10, "\2\275\0\0\6\0\0\0\0\0\20\31\266\344\217\3700\320\341S"..., 701) = 701<br />
read(7, "\0\215\0\0\6\0\0\0\0\0\3^\t@\0\0\0\1\0\0\0\0\0\0\0\0\0"..., 2064) = 141<br />
gettimeofday({1161746697, 294898}, NULL) = 0<br />
getrusage(RUSAGE_SELF, {ru_utime={0, 40000}, ru_stime={0, 20000}, ...}) = 0<br />
getrusage(RUSAGE_SELF, {ru_utime={0, 40000}, ru_stime={0, 20000}, ...}) = 0<br />
gettimeofday({1161746697, 295496}, NULL) = 0<br />
getrusage(RUSAGE_SELF, {ru_utime={0, 40000}, ru_stime={0, 20000}, ...}) = 0<br />
gettimeofday({1161746697, 295847}, NULL) = 0<br />
gettimeofday({1161746697, 295981}, NULL) = 0<br />
lseek(9, 1024, SEEK_SET)                = 1024<br />
read(9, "\30\0$\0007\0@\0J\0V\0`\0i\0t\0~\0\232\0\245\0\320\0\330"..., 512) = 512<br />
lseek(9, 47104, SEEK_SET)               = 47104<br />
read(9, "\f\0^\5\0\0P\0x\5\0\0\214\0y\5\0\0\250\0z\5\0\0\313\0{"..., 512) = 512<br />
gettimeofday({1161746697, 297024}, NULL) = 0<br />
write(10, "\0\202\0\0\6\0\0\0\0\0\4\1\0\0\0\1\1\0\0\0{\5\0\0\0\0\1"..., 130) = 130<br />
read(7,  <unfinished ...><br />
Process 14701 detached</blockquote></p>

<p>在这个信息中，我们注意到Oracle顺序访问了如下文件来完成地址定位：<br />
<blockquote>open("/etc/resolv.conf", O_RDONLY)      = 12<br />
open("/etc/host.conf", O_RDONLY)        = 12<br />
open("/etc/hosts", O_RDONLY)            = 12</blockquote></p>

<p>首先获取域名解析服务器，在根据host.conf文件确定解析顺序，因为缺省hosts文件优先，又继续读取/etc/hosts文件。</p>

<p>如果hosts文件存在解析关系，则返回信息；如果不存在，则继续问询DNS服务器，获得解析地址，如果不能解析，则会出错：<br />
<blockquote>SQL> select UTL_INADDR.get_host_address('www.a.com') from dual;<br />
select UTL_INADDR.get_host_address('www.a.com') from dual<br />
       *<br />
ERROR at line 1:<br />
ORA-29257: host www.a.com unknown<br />
ORA-06512: at "SYS.UTL_INADDR", line 35<br />
ORA-06512: at "SYS.UTL_INADDR", line 40<br />
ORA-06512: at line 1</blockquote><br />
也就是说，UTL_INADDR的数据获取已经不依赖于数据库信息了，而SYS_CONTEXT的信息获取仍然来自数据库内部。</p>

<p>这就是UTL_INADDR包的工作原理。</p>

<p>-The End-</p>]]></description>
<link>http://www.eygle.com/archives/2006/10/how_to_getip_address.html</link>
<guid>http://www.eygle.com/archives/2006/10/how_to_getip_address.html</guid>
<category>HowTo</category>
<pubDate>Thu, 26 Oct 2006 11:30:06 +0800</pubDate>
</item>
<item>
<title>Oracle HowTo:查询Oracle各组件的版本信息</title>
<description><![CDATA[<p>有朋友在ITPUB上<a href="http://www.itpub.net/showthread.php?threadid=645200">提问</a>，如何查询Oracle各组件的版本信息。</p>

<p>其实这个问题，最好的方法是用<a href="http://www.eygle.com/internal/Use.Opatch.apply.Interim.Patch.htm">opatch</a>工具，可以查询得到详细的安装组件版本。<br />
这个可以参考我的网站链接:<br />
<a href="http://www.eygle.com/internal/Use.Opatch.apply.Interim.Patch.htm">http://www.eygle.com/internal/Use.Opatch.apply.Interim.Patch.htm</a></p>

<p>这里想说说其他的几个视图。有朋友提到了v$version 和 product_component_version 两个视图。<br />
我们来看一下这两者有意思的关系.</p>

<p>首先看看两者的输出:<br />
<blockquote>SQL> select * from PRODUCT_COMPONENT_VERSION;</p>

<p>PRODUCT                        VERSION              STATUS<br />
------------------------------ -------------------- ----------<br />
NLSRTL                         9.2.0.4.0            Production<br />
Oracle9i Enterprise Edition    9.2.0.4.0            Production<br />
PL/SQL                         9.2.0.4.0            Production<br />
TNS for Linux:                 9.2.0.4.0            Production</p>

<p>SQL> select * from v$version;</p>

<p>BANNER<br />
----------------------------------------------------------------<br />
Oracle9i Enterprise Edition Release 9.2.0.4.0 - Production<br />
PL/SQL Release 9.2.0.4.0 - Production<br />
CORE    9.2.0.3.0       Production<br />
TNS for Linux: Version 9.2.0.4.0 - Production<br />
NLSRTL Version 9.2.0.4.0 - Production</blockquote></p>

<p>似乎不同，是么？<br />
那我们再来看看这两者的来源，可以借用一下sqlplus的autotrace功能:<br />
<blockquote>SQL> set autotrace trace explain<br />
SQL> select * from v$version;</p>

<p>Execution Plan<br />
----------------------------------------------------------<br />
   0      SELECT STATEMENT Optimizer=CHOOSE<br />
   1    0   FIXED TABLE (FULL) OF 'X$VERSION'</p>

<p></p>

<p>SQL> select * from PRODUCT_COMPONENT_VERSION;</p>

<p>Execution Plan<br />
----------------------------------------------------------<br />
   0      SELECT STATEMENT Optimizer=CHOOSE<br />
   1    0   VIEW OF 'PRODUCT_COMPONENT_VERSION'<br />
   2    1     SORT (UNIQUE)<br />
   3    2       UNION-ALL<br />
   4    3         FIXED TABLE (FULL) OF 'X$VERSION'<br />
   5    3         FIXED TABLE (FULL) OF 'X$VERSION'</blockquote></p>

<p>我们可以发现，这两者都来自底层表x$version，也就是说这两个视图同源，只不过展现有所不同而已。</p>

<p>查询一下x$version的基本信息:<br />
<blockquote>SQL> col indx for 9999<br />
SQL> col inst_id for 99<br />
SQL> select * from x$version;</p>

<p>ADDR      INDX INST_ID BANNER<br />
-------- ----- ------- ----------------------------------------------------------------<br />
B701CDCC     0       1 Oracle9i Enterprise Edition Release 9.2.0.4.0 - Production<br />
B701CDCC     1       1 PL/SQL Release 9.2.0.4.0 - Production<br />
B701CDCC     2       1 CORE     9.2.0.3.0       Production<br />
B701CDCC     3       1 TNS for Linux: Version 9.2.0.4.0 - Production<br />
B701CDCC     4       1 NLSRTL Version 9.2.0.4.0 - Production</blockquote></p>

<p>v$version显然是较为单纯的View，那么PRODUCT_COMPONENT_VERSION经过怎样的处理呢？<br />
我们看一下这个视图的创建语句，学习一下Oracle的SQL技术：<br />
<blockquote>CREATE OR REPLACE VIEW SYS.product_component_version (product, VERSION,<br />
                                                      status)<br />
AS<br />
   (SELECT SUBSTR (banner, 1, INSTR (banner, 'Version') - 1),<br />
           SUBSTR (banner,<br />
                   INSTR (banner, 'Version') + 8,<br />
                   INSTR (banner, ' - ') - (INSTR (banner, 'Version') + 8)<br />
                  ),<br />
           SUBSTR (banner, INSTR (banner, ' - ') + 3)<br />
      FROM v$version<br />
     WHERE INSTR (banner, 'Version') > 0<br />
       AND (   (INSTR (banner, 'Version') < INSTR (banner, 'Release'))<br />
            OR INSTR (banner, 'Release') = 0<br />
           ))<br />
   UNION<br />
   (SELECT SUBSTR (banner, 1, INSTR (banner, 'Release') - 1),<br />
           SUBSTR (banner,<br />
                   INSTR (banner, 'Release') + 8,<br />
                   INSTR (banner, ' - ') - (INSTR (banner, 'Release') + 8)<br />
                  ),<br />
           SUBSTR (banner, INSTR (banner, ' - ') + 3)<br />
      FROM v$version<br />
     WHERE INSTR (banner, 'Release') > 0<br />
       AND INSTR (banner, 'Release') < INSTR (banner, ' - '))</blockquote></p>

<p>很多东西只要深入一点点，就能发现问题的本质。<br />
是不是很好玩呢?</p>

<p>-The End-</p>]]></description>
<link>http://www.eygle.com/archives/2006/10/oracle_howt_find_version.html</link>
<guid>http://www.eygle.com/archives/2006/10/oracle_howt_find_version.html</guid>
<category>HowTo</category>
<pubDate>Tue, 10 Oct 2006 09:59:03 +0800</pubDate>
</item>
<item>
<title>Oracle HowTo:使用DBMS_UTILITY转换Block地址</title>
<description><![CDATA[<p>很多时候，我们可以从Oracle的Trace文件中获得Block的DBA（Data Block Address），有时候需要对这个地址进行转换才能得到相应的Block地址。</p>
<p>有的trace文件中已经包含了地址转换，例如:&nbsp;</p>
<table>
    <tbody>
        <tr>
            <td width="500" bgcolor="#999999">Start dump data blocks tsn: 4 file#: 4 minblk 465 maxblk 465<br />buffer tsn: 4 rdba: 0x010001d1 (4/465)</td>
        </tr>
    </tbody>
</table>
<p>而有时候trace文件里只包含一个RDBA，比如上周我们遇到的一个案例：</p>
<table>
    <tbody>
        <tr>
            <td width="500" bgcolor="#999999">oer 8102.2 - obj# 111465, rdba: 0x08811ba3<br />kdk key 8102.2:<br />&nbsp; ncol: 2, len: 15<br />&nbsp; key: (15):&nbsp; 07 78 6a 08 1f 01 14 15 06 06 00 00 06 00 73<br />&nbsp; mask: (4096):</td>
        </tr>
    </tbody>
</table>
<p>这里的Rdba我们怎样才能转换为文件号和数据块号呢?</p>
<p>通过手工转换，可以参考如下文章：</p>
<p><a href="http://www.eygle.com/archives/2004/08/how_to_convert_rdba.html">http://www.eygle.com/archives/2004/08/how_to_convert_rdba.html</a></p>
<p>Oracle同时提供一个系统包 dbms_utility 可以用于对RDBA进行转换。</p>
<p>注意，对于上面的 rdba: 0x08811ba3，首先要做一个16进制到10进制的转换，转换方法参考: </p>
<p><a href="http://www.eygle.com/archives/2004/06/oracle_howto_convert.html">http://www.eygle.com/archives/2004/06/oracle_howto_convert.html</a></p>
<p>下面我们使用dbms_utility 来进行转换：</p>
<table>
    <tbody>
        <tr>
            <td width="500" bgcolor="#999999">
            <p>SQL&gt; variable file# number<br />SQL&gt; variable block# number<br />SQL&gt; execute :file#:=dbms_utility.data_block_address_file(to_number('8811ba3','xxxxxxx'));</p>
            <p>PL/SQL procedure successfully completed.</p>
            <p>SQL&gt; execute :block#:=dbms_utility.data_block_address_block(to_number('8811ba3','xxxxxxx'));</p>
            <p>PL/SQL procedure successfully completed.</p>
            <p>SQL&gt; print file#</p>
            <p>&nbsp;&nbsp;&nbsp;&nbsp; FILE#<br />----------<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 34</p>
            <p>SQL&gt; print block#</p>
            <p>&nbsp;&nbsp;&nbsp; BLOCK#<br />----------<br />&nbsp;&nbsp;&nbsp;&nbsp; 72611</p>
            </td>
        </tr>
    </tbody>
</table>
<p>这样就可以通过dba_extents获得相关对象信息。</p>
<p>当然这里oer 8102.2 的信息已经告诉我们，出问题的是一个索引：&nbsp;</p>
<table>
    <tbody>
        <tr>
            <td width="500" bgcolor="#999999">$ oerr ora 8102<br />08102, 00000, &quot;index key not found, obj# %s, dba %s (%s)&quot;<br />// *Cause:&nbsp; Internal error: possible inconsistency in index<br />// *Action:&nbsp; Send trace file to your customer support representative, along<br />//&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; with information on reproducing the error</td>
        </tr>
    </tbody>
</table>
<p>-The End-</p>
<p>&nbsp;</p>]]></description>
<link>http://www.eygle.com/archives/2006/09/how_to_use_dbms_utility.html</link>
<guid>http://www.eygle.com/archives/2006/09/how_to_use_dbms_utility.html</guid>
<category>HowTo</category>
<pubDate>Mon, 04 Sep 2006 15:10:59 +0800</pubDate>
</item>
<item>
<title>Oracle HowTo:如何使用Leading提示改变表连接方式</title>
<description><![CDATA[<p>在多表联合查询中,当<a href="http://www.eygle.com/archives/2006/02/oracle_ordered_hints_usage.html">使用Ordered提示改变SQL执行计划</a>之后,通常我们很难再次控制结果集中进一步Join的顺序.</p>
<p>这时候我们可以使用Oracle提供的另外一个Hints: Leading 提示.</p>
<p>这个Hints在Oracle9i中的含义为:</p>
<blockquote dir="ltr" style="MARGIN-RIGHT: 0px">
<p class="BP">The <code><font face="新宋体">LEADING</font></code> hint causes Oracle to use the specified table as the first table in the join order.</p>
<p class="BP">If you specify two or more <code><font face="新宋体">LEADING</font></code> hints on different tables, then all of them are ignored. If you specify the <code><font face="新宋体">ORDERED</font></code> hint, then it overrides all <code><font face="新宋体">LEADING</font></code> hints.</p>
</blockquote>
<p class="BP" dir="ltr">通过Leading 和 use_hash 提示连用,我们可以巧妙的影响SQL中表和结果集的Join顺序.</p>
<p class="BP" dir="ltr">我们通过如下示例看一下这个提示是如何影响SQL执行的:</p>
<table>
    <tbody>
        <tr>
            <td width="500" bgcolor="#999999">
            <pre>SQL&gt; SELECT /*+ leading(t_max) use_hash(t_max t_middle) */ COUNT (*)<br />&nbsp; 2&nbsp;&nbsp;&nbsp; FROM t_small, t_max, t_middle<br />&nbsp; 3&nbsp; WHERE t_small.object_id = t_middle.object_id<br />&nbsp; 4&nbsp; AND t_middle.object_id = t_max.object_id<br />&nbsp; 5&nbsp; /</pre>
            <pre>Execution Plan<br />----------------------------------------------------------<br />&nbsp;&nbsp; 0&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; SELECT STATEMENT Optimizer=CHOOSE (Cost=262 Card=1 Bytes=12)<br />&nbsp;&nbsp; 1&nbsp;&nbsp;&nbsp; 0&nbsp;&nbsp; SORT (AGGREGATE)<br />&nbsp;&nbsp; 2&nbsp;&nbsp;&nbsp; 1&nbsp;&nbsp;&nbsp;&nbsp; HASH JOIN (Cost=262 Card=400 Bytes=4800)<br />&nbsp;&nbsp; 3&nbsp;&nbsp;&nbsp; 2&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; HASH JOIN (Cost=225 Card=113776 Bytes=910208)<br />&nbsp;&nbsp; 4&nbsp;&nbsp;&nbsp; 3&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; TABLE ACCESS (FULL) OF 'T_MAX' (Cost=151 Card=113792 Bytes=455168)<br />&nbsp;&nbsp; 5&nbsp;&nbsp;&nbsp; 3&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; TABLE ACCESS (FULL) OF 'T_MIDDLE' (Cost=39 Card=28447 Bytes=113788)<br />&nbsp;&nbsp; 6&nbsp;&nbsp;&nbsp; 2&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; TABLE ACCESS (FULL) OF 'T_SMALL' (Cost=2 Card=100 Bytes=400)&nbsp;</pre>
            </td>
        </tr>
    </tbody>
</table>
<p>我们看到,通过这两个Hints的联合使用,该查询首先对T_MAX和T_MIDDLE表进行HASH JOIN,再以这个结果集同T_SMALL进行HASH JION.</p>]]></description>
<link>http://www.eygle.com/archives/2006/02/use_leading_hints_change_sql_explain.html</link>
<guid>http://www.eygle.com/archives/2006/02/use_leading_hints_change_sql_explain.html</guid>
<category>SQL.PLSQL</category>
<pubDate>Sun, 26 Feb 2006 12:21:45 +0800</pubDate>
</item>
<item>
<title>Oracle HowTo:如何获得数据库的DBID</title>
<description><![CDATA[<p>在进行数据库恢复的过程中,很多时候我们需要知道Oracle数据库的DBID,通常有以下几种方法可以获得数据库的DBID.</p>
<p>1.查询v$database获得</p>
<p>由于DBID在控制文件和数据文件中都存在记录,所以如果能够mount数据库就可以查询v$database视图获得.&nbsp;</p>
<table>
    <tbody>
        <tr>
            <td width="500" bgcolor="#999999">
            <pre>SQL&gt; alter database mount;</pre>
            <pre>Database altered.</pre>
            <pre>SQL&gt; select dbid from v$database;</pre>
            <pre>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; DBID<br />----------<br />3152029224</pre>
            <pre>SQL&gt; &nbsp;</pre>
            </td>
        </tr>
    </tbody>
</table>
<p>2.在nomount状态时</p>
<p>如果数据库配置了<a href="http://www.eygle.com/faq/Oracle9i.New.Feature.Spfile.04.htm">自动控制文件备份</a>(Oracle9i),并且名称是缺省的,那么我们可以从自动备份文件获得DBID.&nbsp;</p>
<table>
    <tbody>
        <tr>
            <td width="500" bgcolor="#999999">
            <pre>[oracle@jumper dbs]$ cd $ORACLE_HOME/dbs<br />[oracle@jumper dbs]$ ll c-*<br />-rw-r----- 1 oracle dba 3375104 Dec 21 11:13 c-3152029224-20051221-00<br />-rw-r----- 1 oracle dba 3358720 Jan 21 14:03 c-3152029224-20060121-00<br />-rw-r----- 1 oracle dba 3358720 Jan 21 14:08 c-3152029224-20060121-01</pre>
            </td>
        </tr>
    </tbody>
</table>
<p>这里的3152029224就是DBID.</p>]]></description>
<link>http://www.eygle.com/archives/2006/02/oracle_howto_get_oracle_dbid.html</link>
<guid>http://www.eygle.com/archives/2006/02/oracle_howto_get_oracle_dbid.html</guid>
<category>HowTo</category>
<pubDate>Sun, 05 Feb 2006 22:43:22 +0800</pubDate>
</item>
<item>
<title>Oracle HowTo:如何更改数据库的SCN?</title>
<description><![CDATA[<p>很多时候,我们需要调整数据库系统的SCN值,有的是为了恢复的需要,如为了解决<a href="http://www.eygle.com/archives/2005/12/oracle_diagnostics_howto_deal_2662_error.html">ORA-600 2662错误</a>.</p>
<p>而以下修改纯属无聊:</p>
<p>1.通过oradebug修改SCN</p>
<table>
    <tbody>
        <tr>
            <td width="500" bgcolor="#999999">
            <pre>[oracle@jumper oracle]$ sqlplus &quot;/ as sysdba&quot;</pre>
            <pre>SQL*Plus: Release 9.2.0.4.0 - Production on Wed Dec 21 10:33:35 2005</pre>
            <pre>Copyright (c) 1982, 2002, Oracle Corporation.&nbsp; All rights reserved.</pre>
            <pre><br />Connected to:<br />Oracle9i Enterprise Edition Release 9.2.0.4.0 - Production<br />With the Partitioning option<br />JServer Release 9.2.0.4.0 - Production</pre>
            <pre>SQL&gt; col a for 999999999999999<br />SQL&gt; select CHECKPOINT_CHANGE# a from v$datafile;</pre>
            <pre>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; A<br />---------------<br />&nbsp;&nbsp; 107374358304<br />&nbsp;&nbsp; 107374358304<br />&nbsp;&nbsp; 107374358304</pre>
            <pre>SQL&gt; <strong>oradebug setmypid</strong><br />Statement processed.<br />SQL&gt; <strong>oradebug DUMPvar SGA kcsgscn_<br /></strong>kcslf kcsgscn_ [5000BC68, 5000BC88) = 00000019 0002F97F 00004979 <br />00000000 00000000 00000000 00000000 5000B948<br />SQL&gt; <strong>oradebug poke 0x5000BC69 4 8<br /></strong>BEFORE: [5000BC68, 5000BC70) = 00000019<br />AFTER:&nbsp; [5000BC68, 5000BC70) = 00000819</pre>
            </td>
        </tr>
    </tbody>
</table>
<p>2.确认更改</p>
<p>
<table>
    <tbody>
        <tr>
            <td width="500" bgcolor="#999999">
            <pre>SQL&gt; select dbms_flashback.get_system_change_number a from dual;</pre>
            <pre>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; A<br />----------------<br />&nbsp;&nbsp; 8903467399681</pre>
            <pre>SQL&gt; oradebug DUMPvar SGA kcsgscn_<br />kcslf kcsgscn_ [5000BC68, 5000BC88) = 00000819 0002FA0C 00004A75 <br />00000000 00000000 00000000 00000000 5000B948<br />SQL&gt; <br />SQL&gt; alter system checkpoint;</pre>
            <pre>System altered.</pre>
            <pre>SQL&gt; select CHECKPOINT_CHANGE# a from v$datafile;</pre>
            <pre>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; A<br />----------------<br /><strong>&nbsp;&nbsp; 8903467399867</strong><br />&nbsp;&nbsp; 8903467399867<br />&nbsp;&nbsp; 8903467399867</pre>
            </td>
        </tr>
    </tbody>
</table>
</p>
<p>3.此时无法正常关闭数据库</p>
<p>Oracle会检测到异常:</p>
<table>
    <tbody>
        <tr>
            <td width="500" bgcolor="#999999">
            <pre>SQL&gt; shutdown immediate;<br />ORA-00600: internal error code, arguments: [kfhsls_02], [20], [1], [], [], [], [], []&nbsp;</pre>
            </td>
        </tr>
    </tbody>
</table>]]></description>
<link>http://www.eygle.com/archives/2006/01/oracle_howto_change_scn.html</link>
<guid>http://www.eygle.com/archives/2006/01/oracle_howto_change_scn.html</guid>
<category>HowTo</category>
<pubDate>Tue, 17 Jan 2006 14:08:17 +0800</pubDate>
</item>
<item>
<title>Oracle HowTo:How to get Oracle SCN?</title>
<description><![CDATA[<p>之前简单的介绍过一下<a href="http://www.eygle.com/faq/How.To.Get.Current.SCN.of.Database.htm">如何获得当前数据库的SCN值</a>,主要可以通过两种方式:</p>
<p>1.在Oracle9i及以上版本中</p>
<p>可以使用dbms_flashback.get_system_change_number来获得</p>
<table>
    <tbody>
        <tr>
            <td width="500" bgcolor="#999999">
            <pre>SQL&gt; select dbms_flashback.get_system_change_number from dual;</pre>
            <pre>GET_SYSTEM_CHANGE_NUMBER<br />------------------------<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 2982184</pre>
            </td>
        </tr>
    </tbody>
</table>
<p><a name="x$ktuxe"></a>2.在Oracle9i之前</p>
<p>可以通过查询x$ktuxe获得最接近当前系统scn值</p>
<p><strong>&nbsp;X$KTUXE-------------[K]ernel [T]ransaction [U]ndo Transa[x]tion [E]ntry (table)</strong></p>
<p>
<table>
    <tbody>
        <tr>
            <td width="500" bgcolor="#999999">
            <pre>SQL&gt; select max(ktuxescnw*power(2,32)+ktuxescnb) from x$ktuxe;</pre>
            <pre>MAX(KTUXESCNW*POWER(2,32)+KTUXESCNB)<br />------------------------------------<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 2980613&nbsp;</pre>
            </td>
        </tr>
    </tbody>
</table>
</p>
<p>3.通过oradebug获取</p>
<p>以前在<a href="http://l2g32003.home4u.china.com/">l2g32003</a>的站点上看到使用oradebug<a href="http://l2g32003.home4u.china.com/other/scn.html">获取SCN</a>的方法,转引在这里:</p>
<p>
<table>
    <tbody>
        <tr>
            <td width="500" bgcolor="#999999">
            <pre>[oracle@neirong oracle]$ sqlplus &quot;/ as sysdba&quot;</pre>
            <pre>SQL*Plus: Release 9.2.0.4.0 - Production on Wed Dec 21 21:04:24 2005</pre>
            <pre>Copyright (c) 1982, 2002, Oracle Corporation.&nbsp; All rights reserved.</pre>
            <pre>Connected to:<br />Oracle9i Enterprise Edition Release 9.2.0.4.0 - Production<br />With the Partitioning, OLAP and Oracle Data Mining options<br />JServer Release 9.2.0.4.0 - Production</pre>
            <pre>SQL&gt; col a for 999999999999<br />SQL&gt; oradebug setmypid<br />Statement processed.<br />SQL&gt; oradebug DUMPvar SGA kcsgscn_<br />kcslf kcsgscn_ [1200BC68, 1200BC88) = 0000<strong>0003 BA84F392</strong> 00071266 00000000 00000000 00000000 00000000 1200B948<br />SQL&gt; select to_number('3BA84F392','xxxxxxxxxxxx') a from dual;</pre>
            <pre>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; A<br />-------------<br />&nbsp; 16014177170</pre>
            <pre>SQL&gt; select dbms_flashback.get_system_change_number a from dual;</pre>
            <pre>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; A<br />-------------<br />&nbsp; 16014177255</pre>
            <pre>SQL&gt; </pre>
            </td>
        </tr>
    </tbody>
</table>
</p>]]></description>
<link>http://www.eygle.com/archives/2006/01/oracle_howto_get_scn.html</link>
<guid>http://www.eygle.com/archives/2006/01/oracle_howto_get_scn.html</guid>
<category>HowTo</category>
<pubDate>Fri, 06 Jan 2006 20:51:59 +0800</pubDate>
</item>
<item>
<title>Oracle HowTo: How to deal with Ora-600 4193 error</title>
<description><![CDATA[<p>在解决<a href="http://www.eygle.com/archives/2005/12/oracle_diagnostics_howto_deal_2662_error.html">2662</a>错误之后，经常会出现Ora-00600 4193错误，经常可以在alert文件中看到的错误号类似:</p>
<blockquote>Fri Dec 16 22:37:27 2005<br />Errors in file /opt/oracle/admin/conner/bdump/conner_smon_22817.trc:<br />ORA-00604: error occurred at recursive SQL level 1<br />ORA-00607: Internal error occurred while making a change to a data block<br />ORA-00600: internal error code, arguments: [4193], [1171], [1187], [], [], [], [], []<br />Fri Dec 16 23:28:40 2005<br />Errors in file /opt/oracle/admin/conner/bdump/conner_smon_22817.trc:<br />ORA-00600: internal error code, arguments: [4193], [1171], [1187], [], [], [], [], []</blockquote>

<p>4193错误通常是因为恢复时redo与undo不一致所导致。</p>
<p>Oracle的解释如下:</p>
<blockquote dir="ltr" style="MARGIN-RIGHT: 0px">
<p><strong>&nbsp; While backing out an undo record (i.e. at the time of rollback) we found a&nbsp; transaction id mis-match indicating either a corruption in the rollback&nbsp;&nbsp; segment or corruption in an object which the rollback segment is trying to&nbsp; apply undo records on.</strong></p>
<p><strong>&nbsp; <em>This would indicate a corrupted rollback segment</em>.</strong></p>
</blockquote>
<p>检查具体的Trace文件，可以发现类似如下错误：</p>
<table>
    <tbody>
        <tr>
            <td width="500" bgcolor="#999999">
            <pre>*** 2005-12-16 20:54:53.496<br />ksedmp: internal or fatal error<br />ORA-00600: internal error code, arguments: [4193], [1171], [1187], [], [], [], [], []<br />Current SQL statement for this session:<br />UPDATE SMON_SCN_TIME SET SCN_WRP=:1, SCN_BAS=:2, TIME_MP=:3, TIME_DP=:4 <br />WHERE TIME_MP = :5&nbsp; AND&nbsp;&nbsp; THREAD = :6&nbsp; AND&nbsp;&nbsp; ROWNUM &lt;= 1</pre>
            </td>
        </tr>
    </tbody>
</table>]]></description>
<link>http://www.eygle.com/archives/2005/12/oracle_howto_deal_with_ora600_4137_error.html</link>
<guid>http://www.eygle.com/archives/2005/12/oracle_howto_deal_with_ora600_4137_error.html</guid>
<category>HowTo</category>
<pubDate>Fri, 30 Dec 2005 14:25:14 +0800</pubDate>
</item>
<item>
<title>Oracle HowTo:如何强制刷新Buffer Cache</title>
<description><![CDATA[<p>很多时候，为了排除Cache对于测试的影响，我们常常需要手动刷新Buffer Cache，以促使Oracle重新执行物理访问。我曾经在<a href="http://www.eygle.com/faq/db_file_multiblock_read_count&amp;OracleIO.htm">使用 db_file_multiblock_read_count测试Oracle在不同系统中的IO能力</a>一文中用到这个方法，在Itpub上也有朋友<a href="http://www.itpub.net/showthread.php?threadid=314670">问</a>到，今天整理一下并作简要说明。</p>
<p>在Oracle9i里，Oracle提供了一个内部事件，用以强制刷新Buffer Cache，其语法为:</p>
<p><strong>alter session set events 'immediate trace name flush_cache level 1';</strong></p>
<p>或者:</p>
<p><strong>alter session set events = 'immediate trace name flush_cache';</strong></p>
<p>类似的也可以使用alter system系统级设置:</p>
<p><strong>alter system set events = 'immediate trace name flush_cache';</strong></p>
<p>在Oracle10g中，Oracle提供一个新的特性，可以通过如下命令刷新Buffer Cache:</p>
<p><strong>alter system flush buffer_cache;</strong></p>
<p>我们通过试验来看一下刷新Cache的作用:</p>
<p><br /></p>]]></description>
<link>http://www.eygle.com/archives/2005/12/oracle_howto_flush_buffer_cache.html</link>
<guid>http://www.eygle.com/archives/2005/12/oracle_howto_flush_buffer_cache.html</guid>
<category>HowTo</category>
<pubDate>Thu, 22 Dec 2005 23:29:51 +0800</pubDate>
</item>
<item>
<title>How to maintain Oracle10g Recyclebin?</title>
<description><![CDATA[<p>从Oracle10g开始，Oracle引入了<a href="http://www.eygle.com/archives/2005/03/eoaoracle10giaa.html">flashback drop的新特性</a>，这个新特性，允许你从当前数据库中恢复一个被drop了的对象。在执行drop操作时，现在Oracle不是真正删除它，而是将该对象自动将放入回收站。对于一个对象的删除，其实仅仅就是简单的重令名操作。</p>
<p><br />所谓的回收站，是一个虚拟的容器，用于存放所有被删除的对象。在回收站中，被删除的对象将占用创建时的同样的空间，你甚至还可以对已经删除的表查询，也可以利用flashback功能来恢复它， 这个就是flashback drop功能。</p>
<p>这个功能虽然可以极大的简化误drop导致的恢复操作，但是长时间的积累可能会导致大量的空间占用(虽然Oracle具有自己的清理机制)，很多时候我们需要手工介入去清理回收站。本文主要介绍清理回收站的几种方法.</p>
<p>&nbsp;1.大量累计的空间占用</p>
<table>
    <tbody>
        <tr>
            <td width="500" bgcolor="#999999">
            <pre>Connected to Oracle Database 10g Enterprise Edition Release 10.1.0.3.0 <br />Connected as SYS</pre>
            <pre><br />SQL&gt; col owner for a12<br />SQL&gt; select owner,object_name,CREATETIME,DROPTIME from dba_recyclebin<br />&nbsp; 2&nbsp; order by droptime<br />&nbsp; 3&nbsp; /</pre>
            <pre>OWNER&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; OBJECT_NAME&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; CREATETIME&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; DROPTIME<br />------------ ------------------------------ ------------------- -------------------<br />COMMON&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; BIN$AHsQ+pi+Kb/gRAADumkBdQ==$0 2005-08-29:16:42:19 2005-09-11:15:36:17<br />COMMON&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; BIN$AHsQ+pi9Kb/gRAADumkBdQ==$0 2005-08-29:16:42:19 2005-09-11:15:36:17<br />PDA&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; BIN$AdEb4zqqUcTgRAADumkBdQ==$0 2005-09-05:10:31:01 2005-09-28:15:40:39<br />......<br />BJLAIS_RUN&nbsp;&nbsp; BIN$BtkGRT0dSwfgRAADumkBdQ==$0 2005-11-30:10:54:07 2005-12-01:16:13:17<br />BJLAIS_RUN&nbsp;&nbsp; BIN$BtkGRT0cSwfgRAADumkBdQ==$0 2005-11-30:10:54:07 2005-12-01:16:13:17</pre>
            <pre>750 rows selected</pre>
            <pre>SQL&gt; </pre>
            </td>
        </tr>
    </tbody>
</table>
<p>2.不同用户在回收站的对象</p>
<table>
    <tbody>
        <tr>
            <td width="500" bgcolor="#999999">
            <pre>SQL&gt; select owner,count(*) from dba_recyclebin group by owner;&nbsp;&nbsp; </pre>
            <pre>OWNER&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; COUNT(*)<br />-------------------- ----------<br />BJLAIS_RUN&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 44<br />COMMON&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 8<br />MMSBLOG&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 618<br />MMSHAWA_RUN&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 2<br />PDA&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 8<br />RING_RUN&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 70</pre>
            <pre>6 rows selected.</pre>
            </td>
        </tr>
    </tbody>
</table>
<p>3.我们可以指定删除某些特定对象</p>
<p>
<table>
    <tbody>
        <tr>
            <td width="500" bgcolor="#999999">
            <p>SQL&gt; purge table common.T_SERVICE_CODE_INFO;</p>
            <p>Table purged.</p>
            </td>
        </tr>
    </tbody>
</table>
</p>
<p>4.指定清除某个表空间的所有回收站对象</p>
<p>
<table>
    <tbody>
        <tr>
            <td width="500" bgcolor="#999999">
            <pre>SQL&gt; purge tablespace common;</pre>
            <pre>Tablespace purged.</pre>
            <pre>SQL&gt; select owner,count(*) from dba_recyclebin group by owner;&nbsp;&nbsp; </pre>
            <pre>OWNER&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; COUNT(*)<br />-------------------- ----------<br />BJLAIS_RUN&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 44<br />MMSBLOG&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 618<br />MMSHAWA_RUN&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 2<br />PDA&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 8<br />RING_RUN&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 70</pre>
            </td>
        </tr>
    </tbody>
</table>
</p>
<p>5.以SYSDBA身份可以清除所有回收站对象</p>
<p>
<table>
    <tbody>
        <tr>
            <td width="500" bgcolor="#999999">
            <p><font face="Courier New">SQL&gt; purge dba_recyclebin;</font></p>
            <p><font face="Courier New">DBA Recyclebin purged.</font></p>
            <p><font face="Courier New">SQL&gt; select owner,count(*) from dba_recyclebin group by owner;&nbsp;&nbsp; </font></p>
            <p><font face="Courier New">no rows selected</font><br /></p>
            </td>
        </tr>
    </tbody>
</table>
</p>
<p>6.禁用recyclebin</p>
<p>&nbsp;</p>]]></description>
<link>http://www.eygle.com/archives/2005/12/how_to_maintain_10g_recyclebin.html</link>
<guid>http://www.eygle.com/archives/2005/12/how_to_maintain_10g_recyclebin.html</guid>
<category>HowTo</category>
<pubDate>Mon, 12 Dec 2005 15:45:15 +0800</pubDate>
</item>
<item>
<title>Oracle HowTo:如何判断Oracle数据库安装的操作系统</title>
<description><![CDATA[<p>有朋友问到这样一个问题:如何远程判断Oracle数据库的安装平台.</p>

<p>我想到的一个方法是,通过查询v$version视图来得到:<br />
1.Windows平台的输出<br />
<blockquote>SQL> select * from v$version;</p>

<p>BANNER<br />
----------------------------------------------------------------<br />
Oracle9i Enterprise Edition Release 9.2.0.6.0 - Production<br />
PL/SQL Release 9.2.0.6.0 - Production<br />
CORE    9.2.0.6.0       Production<br />
<strong>TNS for 32-bit Windows: Version 9.2.0.6.0 - Production</strong><br />
NLSRTL Version 9.2.0.6.0 - Production</blockquote></p>

<p>2.Linux平台输出<br />
<blockquote>SQL> select * from v$version;</p>

<p>BANNER<br />
----------------------------------------------------------------<br />
Oracle9i Enterprise Edition Release 9.2.0.4.0 - Production<br />
PL/SQL Release 9.2.0.4.0 - Production<br />
CORE    9.2.0.3.0       Production<br />
<strong>TNS for Linux: Version 9.2.0.4.0 - Production</strong><br />
NLSRTL Version 9.2.0.4.0 - Production</blockquote></p>

<p>3.Solaris平台的输出<br />
<blockquote>SQL> select * from v$version;</p>

<p>BANNER<br />
----------------------------------------------------------------<br />
Oracle9i Enterprise Edition Release 9.2.0.4.0 - <strong>64bit</strong> Production<br />
PL/SQL Release 9.2.0.4.0 - Production<br />
CORE    9.2.0.3.0       Production <br />
<strong>TNS for Solaris: Version 9.2.0.4.0 - Production</strong><br />
NLSRTL Version 9.2.0.4.0 - Production</blockquote></p>

<p>4.AIX平台的输出(感谢brucewoo提供的AIX上输出)</p>

<blockquote>SQL> select * from v$version;

<p>BANNER<br />
----------------------------------------------------------------<br />
Oracle9i Enterprise Edition Release 9.2.0.5.0 - 64bit Production<br />
PL/SQL Release 9.2.0.5.0 - Production<br />
CORE 9.2.0.6.0 Production<br />
<strong>TNS for IBM/AIX RISC System/6000: Version 9.2.0.5.0 - Production</strong><br />
NLSRTL Version 9.2.0.5.0 - Production</blockquote></p>

<p>5.HPUX上的输出(感谢tom.shew的提供)<br />
<blockquote>SQL> select * from v$version;</p>

<p>BANNER<br />
----------------------------------------------------------------<br />
Oracle9i Enterprise Edition Release 9.2.0.6.0 - 64bit Production<br />
PL/SQL Release 9.2.0.6.0 - Production<br />
CORE 9.2.0.6.0 Production</p>

<p><strong>TNS for HPUX: Version 9.2.0.6.0 - Production</strong><br />
NLSRTL Version 9.2.0.6.0 - Production</blockquote></p>]]></description>
<link>http://www.eygle.com/archives/2005/12/oracle_howto_know_oracle_install_os.html</link>
<guid>http://www.eygle.com/archives/2005/12/oracle_howto_know_oracle_install_os.html</guid>
<category>HowTo</category>
<pubDate>Sun, 04 Dec 2005 02:00:09 +0800</pubDate>
</item>


</channel>
</rss>