﻿<?xml version="1.0" encoding="utf-8" standalone="yes"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:trackback="http://madskills.com/public/xml/rss/module/trackback/" xmlns:wfw="http://wellformedweb.org/CommentAPI/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/"><channel><title>博客园-打对了</title><link>http://www.cnblogs.com/zyk/</link><description>宇宙和生命从哪里来?又要到哪里去呢?</description><language>zh-cn</language><lastBuildDate>Wed, 19 Nov 2008 10:23:32 GMT</lastBuildDate><pubDate>Wed, 19 Nov 2008 10:23:32 GMT</pubDate><ttl>60</ttl><item><title>闪回查询,9i,10G到11G的不断增强</title><link>http://www.cnblogs.com/zyk/archive/2008/02/20/1075502.html</link><dc:creator>知道得越多知道的越少</dc:creator><author>知道得越多知道的越少</author><pubDate>Wed, 20 Feb 2008 10:57:00 GMT</pubDate><guid>http://www.cnblogs.com/zyk/archive/2008/02/20/1075502.html</guid><wfw:comment>http://www.cnblogs.com/zyk/comments/1075502.html</wfw:comment><comments>http://www.cnblogs.com/zyk/archive/2008/02/20/1075502.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.cnblogs.com/zyk/comments/commentRss/1075502.html</wfw:commentRss><trackback:ping>http://www.cnblogs.com/zyk/services/trackbacks/1075502.html</trackback:ping><description><![CDATA[<P>9i开始,oracle推出了闪回查询的功能,即可能查询和恢复历史数据,<BR>依赖于回滚段,受undo_retention参数的控制,只能查询一定时间段以内的历史数据,并且回滚段没有被新的事务覆盖.<BR>10g中,对闪回查询做了较大改进，不再局限于闪回查询，还可用于恢复错误的DDL(Drop)操作、闪回表、闪回数据库等,增加了闪回恢复区(Flashback recovery area)的新特性.<BR>它依赖于flashback Log闪回日志,受db_flashback_retention_target等参数的控制<BR>而11G中又进行了增强,增加了闪回数据存档库的概念,闪回数据可以存放到单独的表空间,不依赖归档日志,<BR>并且更加灵活方便,不同的表可以制定不同的闪回存储策略,而且通过表空间方式来管理,更便于维护闪回数据.<BR>下面以一个例子来说明.</P>
<P>CREATE TABLESPACE zlflashback<BR>DATAFILE 'D:\APP\ADMINISTRATOR\ORADATA\ORCL\zlflashback.dbf'<BR>SIZE 10M AUTOEXTEND ON;</P>
<P>Create Flashback Archive fla_zltab Tablespace zlflashback Retention 1 Month;<BR>alter table 病人信息 flashback archive fla_zltab;</P>
<P>SQL&gt; insert into 病人信息(病人id,姓名) values(1,'巴基斯');<BR>1 row inserted<BR>SQL&gt; commit;<BR>Commit Complete<BR>SQL&gt; update 病人信息 set 姓名='卡巴基斯' where 病人id=1;<BR>1 row Updated<BR>SQL&gt; commit;<BR>Commit Complete<BR>SQL&gt; set time on;<BR>17:12:09 SQL&gt; delete 病人信息 where 病人id=1;<BR>1 row deleted<BR>17:12:29 SQL&gt; commit;</P>
<P>SQL&gt;Select * From 病人信息 <BR>As Of Timestamp To_Timestamp('02/20/2008 17:12:09', 'mm/dd/yyyy hh24:mi:ss') <BR>Where 病人id = 1;<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 病人ID 姓名<BR>------------------- --------------------<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 1 卡巴基斯</P>
<P>查看闪回事务<BR>Select * From flashback_transaction_query Where table_name='病人信息'<BR>查看有哪些闪回归档库<BR>Select * From dba_flashback_archive;<BR>查看哪些表使用了闪回归档<BR>Select * From User_Flashback_Archive_Tables</P>
<P>参考文档:http://www.oracle.com/technology/global/cn/pub/articles/oracle-database-11g-top-features/11g-transactionmanagement.html<BR>注意,该文档这两个表名有错,flashback_archives,user_flashback_archived_tables<BR></P><img src ="http://www.cnblogs.com/zyk/aggbug/1075502.html?type=1" width = "1" height = "1" /><br><br><a href="http://news.cnblogs.com/n/43607/" target="_blank">[新闻]后“开放”平台时代</a><br/><a href="http://www.cnblogs.com" target="_blank">博客园首页</a>&nbsp;<a href="http://space.cnblogs.com" target="_blank">社区</a>&nbsp;<a href="http://news.cnblogs.com" target="_blank">新闻频道</a>&nbsp;<a href="http://space.cnblogs.com/group.htm" target="_blank">小组</a>&nbsp;<a href="http://space.cnblogs.com/q" target="_blank">博问</a>&nbsp;<a href="http://wz.cnblogs.com/" target="_blank">网摘</a>&nbsp;<a href="http://space.cnblogs.com/ing" target="_blank">闪存</a>]]></description></item><item><title>归档日志充满的问题解决</title><link>http://www.cnblogs.com/zyk/archive/2007/11/01/946270.html</link><dc:creator>知道得越多知道的越少</dc:creator><author>知道得越多知道的越少</author><pubDate>Thu, 01 Nov 2007 15:02:00 GMT</pubDate><guid>http://www.cnblogs.com/zyk/archive/2007/11/01/946270.html</guid><wfw:comment>http://www.cnblogs.com/zyk/comments/946270.html</wfw:comment><comments>http://www.cnblogs.com/zyk/archive/2007/11/01/946270.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.cnblogs.com/zyk/comments/commentRss/946270.html</wfw:commentRss><trackback:ping>http://www.cnblogs.com/zyk/services/trackbacks/946270.html</trackback:ping><description><![CDATA[<SPAN style="FONT-SIZE: 10.5pt; FONT-FAMILY: 宋体; mso-fareast-theme-font: minor-fareast; mso-hansi-theme-font: minor-fareast; mso-bidi-font-family: 'Times New Roman'; mso-ascii-font-family: 'Times New Roman'; mso-font-kerning: 1.0pt; mso-ansi-language: EN-US; mso-fareast-language: ZH-CN; mso-bidi-language: AR-SA">
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt; TEXT-INDENT: 21pt"><SPAN style="FONT-FAMILY: 宋体; mso-bidi-font-size: 10.5pt; mso-fareast-theme-font: minor-fareast; mso-hansi-theme-font: minor-fareast; mso-ascii-font-family: 'Times New Roman'">在配置流复制环境时，将数据库配置为归档模式后，在执行流配置时卡住了，查日志文件发现是日志文件无法归档，于是手工强制归档，出现了如下错误：</SPAN><SPAN lang=EN-US style="FONT-FAMILY: 'Times New Roman','serif'; mso-bidi-font-size: 10.5pt; mso-fareast-theme-font: minor-fareast; mso-fareast-font-family: 宋体"><?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" /><o:p></o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt"><I style="mso-bidi-font-style: normal"><SPAN lang=EN-US style="FONT-FAMILY: 'Times New Roman','serif'; mso-bidi-font-size: 10.5pt; mso-fareast-theme-font: minor-fareast; mso-fareast-font-family: 宋体">SQL&gt; archive log next<o:p></o:p></SPAN></I></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt"><I style="mso-bidi-font-style: normal"><SPAN lang=EN-US style="FONT-FAMILY: 'Times New Roman','serif'; mso-bidi-font-size: 10.5pt; mso-fareast-theme-font: minor-fareast; mso-fareast-font-family: 宋体">ORA-16014: </SPAN></I><I style="mso-bidi-font-style: normal"><SPAN style="FONT-FAMILY: 宋体; mso-bidi-font-size: 10.5pt; mso-fareast-theme-font: minor-fareast; mso-hansi-theme-font: minor-fareast; mso-ascii-font-family: 'Times New Roman'">日志</SPAN></I><I style="mso-bidi-font-style: normal"><SPAN lang=EN-US style="FONT-FAMILY: 'Times New Roman','serif'; mso-bidi-font-size: 10.5pt; mso-fareast-theme-font: minor-fareast; mso-fareast-font-family: 宋体"> 3 </SPAN></I><I style="mso-bidi-font-style: normal"><SPAN style="FONT-FAMILY: 宋体; mso-bidi-font-size: 10.5pt; mso-fareast-theme-font: minor-fareast; mso-hansi-theme-font: minor-fareast; mso-ascii-font-family: 'Times New Roman'">的序列号</SPAN></I><I style="mso-bidi-font-style: normal"><SPAN lang=EN-US style="FONT-FAMILY: 'Times New Roman','serif'; mso-bidi-font-size: 10.5pt; mso-fareast-theme-font: minor-fareast; mso-fareast-font-family: 宋体"> 127 </SPAN></I><I style="mso-bidi-font-style: normal"><SPAN style="FONT-FAMILY: 宋体; mso-bidi-font-size: 10.5pt; mso-fareast-theme-font: minor-fareast; mso-hansi-theme-font: minor-fareast; mso-ascii-font-family: 'Times New Roman'">未归档</SPAN></I><I style="mso-bidi-font-style: normal"><SPAN lang=EN-US style="FONT-FAMILY: 'Times New Roman','serif'; mso-bidi-font-size: 10.5pt; mso-fareast-theme-font: minor-fareast; mso-fareast-font-family: 宋体">, </SPAN></I><I style="mso-bidi-font-style: normal"><SPAN style="FONT-FAMILY: 宋体; mso-bidi-font-size: 10.5pt; mso-fareast-theme-font: minor-fareast; mso-hansi-theme-font: minor-fareast; mso-ascii-font-family: 'Times New Roman'">没有可用的目的地</SPAN></I><I style="mso-bidi-font-style: normal"><SPAN lang=EN-US style="FONT-FAMILY: 'Times New Roman','serif'; mso-bidi-font-size: 10.5pt; mso-fareast-theme-font: minor-fareast; mso-fareast-font-family: 宋体"><o:p></o:p></SPAN></I></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt"><I style="mso-bidi-font-style: normal"><SPAN lang=EN-US style="FONT-FAMILY: 'Times New Roman','serif'; mso-bidi-font-size: 10.5pt; mso-fareast-theme-font: minor-fareast; mso-fareast-font-family: 宋体">ORA-00312: </SPAN></I><I style="mso-bidi-font-style: normal"><SPAN style="FONT-FAMILY: 宋体; mso-bidi-font-size: 10.5pt; mso-fareast-theme-font: minor-fareast; mso-hansi-theme-font: minor-fareast; mso-ascii-font-family: 'Times New Roman'">联机日志</SPAN></I><I style="mso-bidi-font-style: normal"><SPAN lang=EN-US style="FONT-FAMILY: 'Times New Roman','serif'; mso-bidi-font-size: 10.5pt; mso-fareast-theme-font: minor-fareast; mso-fareast-font-family: 宋体">3</SPAN></I><I style="mso-bidi-font-style: normal"><SPAN style="FONT-FAMILY: 宋体; mso-bidi-font-size: 10.5pt; mso-fareast-theme-font: minor-fareast; mso-hansi-theme-font: minor-fareast; mso-ascii-font-family: 'Times New Roman'">线程</SPAN></I><I style="mso-bidi-font-style: normal"><SPAN lang=EN-US style="FONT-FAMILY: 'Times New Roman','serif'; mso-bidi-font-size: 10.5pt; mso-fareast-theme-font: minor-fareast; mso-fareast-font-family: 宋体">1</SPAN></I><I style="mso-bidi-font-style: normal"><SPAN lang=EN-US style="FONT-FAMILY: 宋体; mso-bidi-font-size: 10.5pt; mso-ascii-theme-font: minor-fareast; mso-fareast-theme-font: minor-fareast; mso-hansi-theme-font: minor-fareast">: 'D:\ORACLE\PRODUCT\10.2.0\ORADATA\TEST\REDO03.LOG'<o:p></o:p></SPAN></I></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt; TEXT-INDENT: 21pt"><SPAN style="FONT-FAMILY: 宋体; mso-bidi-font-size: 10.5pt; mso-fareast-theme-font: minor-fareast; mso-hansi-theme-font: minor-fareast; mso-ascii-font-family: 'Times New Roman'">于时检查归档文件的参数</SPAN><SPAN lang=EN-US style="FONT-FAMILY: 'Times New Roman','serif'; mso-bidi-font-size: 10.5pt; mso-fareast-theme-font: minor-fareast; mso-fareast-font-family: 宋体">log_archive_dest</SPAN><SPAN style="FONT-FAMILY: 宋体; mso-bidi-font-size: 10.5pt; mso-fareast-theme-font: minor-fareast; mso-hansi-theme-font: minor-fareast; mso-ascii-font-family: 'Times New Roman'">，</SPAN><SPAN lang=EN-US style="FONT-FAMILY: 'Times New Roman','serif'; mso-bidi-font-size: 10.5pt; mso-fareast-theme-font: minor-fareast; mso-fareast-font-family: 宋体">db_recovery_file_dest</SPAN><SPAN style="FONT-FAMILY: 宋体; mso-bidi-font-size: 10.5pt; mso-fareast-theme-font: minor-fareast; mso-hansi-theme-font: minor-fareast; mso-ascii-font-family: 'Times New Roman'">，没有发现问题，又检查了文件夹的</SPAN><SPAN lang=EN-US style="FONT-FAMILY: 'Times New Roman','serif'; mso-bidi-font-size: 10.5pt; mso-fareast-theme-font: minor-fareast; mso-fareast-font-family: 宋体">NTFS</SPAN><SPAN style="FONT-FAMILY: 宋体; mso-bidi-font-size: 10.5pt; mso-fareast-theme-font: minor-fareast; mso-hansi-theme-font: minor-fareast; mso-ascii-font-family: 'Times New Roman'">权限，也没有问题。又执行下面的归档命令发现：</SPAN><SPAN lang=EN-US style="FONT-FAMILY: 'Times New Roman','serif'; mso-bidi-font-size: 10.5pt; mso-fareast-theme-font: minor-fareast; mso-fareast-font-family: 宋体"><o:p></o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt"><I style="mso-bidi-font-style: normal"><SPAN lang=EN-US style="FONT-FAMILY: 'Times New Roman','serif'; mso-bidi-font-size: 10.5pt; mso-fareast-theme-font: minor-fareast; mso-fareast-font-family: 宋体">SQL&gt; archive log all<o:p></o:p></SPAN></I></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt"><I style="mso-bidi-font-style: normal"><SPAN lang=EN-US style="FONT-FAMILY: 'Times New Roman','serif'; mso-bidi-font-size: 10.5pt; mso-fareast-theme-font: minor-fareast; mso-fareast-font-family: 宋体">ORA-16020: </SPAN></I><I style="mso-bidi-font-style: normal"><SPAN style="FONT-FAMILY: 宋体; mso-bidi-font-size: 10.5pt; mso-fareast-theme-font: minor-fareast; mso-hansi-theme-font: minor-fareast; mso-ascii-font-family: 'Times New Roman'">可用的目的地少于由</SPAN></I><I style="mso-bidi-font-style: normal"><SPAN lang=EN-US style="FONT-FAMILY: 'Times New Roman','serif'; mso-bidi-font-size: 10.5pt; mso-fareast-theme-font: minor-fareast; mso-fareast-font-family: 宋体"> LOG_ARCHIVE_MIN_SUCCEED_DEST </SPAN></I><I style="mso-bidi-font-style: normal"><SPAN style="FONT-FAMILY: 宋体; mso-bidi-font-size: 10.5pt; mso-fareast-theme-font: minor-fareast; mso-hansi-theme-font: minor-fareast; mso-ascii-font-family: 'Times New Roman'">指定的数量</SPAN></I><I style="mso-bidi-font-style: normal"><SPAN lang=EN-US style="FONT-FAMILY: 'Times New Roman','serif'; mso-bidi-font-size: 10.5pt; mso-fareast-theme-font: minor-fareast; mso-fareast-font-family: 宋体"><o:p></o:p></SPAN></I></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt"><SPAN lang=EN-US style="FONT-FAMILY: 'Times New Roman','serif'; mso-bidi-font-size: 10.5pt; mso-fareast-theme-font: minor-fareast; mso-fareast-font-family: 宋体"><SPAN style="mso-tab-count: 1">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN></SPAN><SPAN style="FONT-FAMILY: 宋体; mso-bidi-font-size: 10.5pt; mso-fareast-theme-font: minor-fareast; mso-hansi-theme-font: minor-fareast; mso-ascii-font-family: 'Times New Roman'">到后来，数据库重启后根本打不开了，只能启动到</SPAN><SPAN lang=EN-US style="FONT-FAMILY: 'Times New Roman','serif'; mso-bidi-font-size: 10.5pt; mso-fareast-theme-font: minor-fareast; mso-fareast-font-family: 宋体">Mout</SPAN><SPAN style="FONT-FAMILY: 宋体; mso-bidi-font-size: 10.5pt; mso-fareast-theme-font: minor-fareast; mso-hansi-theme-font: minor-fareast; mso-ascii-font-family: 'Times New Roman'">状态。</SPAN><SPAN lang=EN-US style="FONT-FAMILY: 'Times New Roman','serif'; mso-bidi-font-size: 10.5pt; mso-fareast-theme-font: minor-fareast; mso-fareast-font-family: 宋体"><o:p></o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt"><I style="mso-bidi-font-style: normal"><SPAN lang=EN-US style="FONT-FAMILY: 'Times New Roman','serif'; mso-bidi-font-size: 10.5pt; mso-fareast-theme-font: minor-fareast; mso-fareast-font-family: 宋体">SQL&gt; alter database open;<o:p></o:p></SPAN></I></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt"><I style="mso-bidi-font-style: normal"><SPAN lang=EN-US style="FONT-FAMILY: 'Times New Roman','serif'; mso-bidi-font-size: 10.5pt; mso-fareast-theme-font: minor-fareast; mso-fareast-font-family: 宋体">alter database open<o:p></o:p></SPAN></I></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt"><I style="mso-bidi-font-style: normal"><SPAN lang=EN-US style="FONT-FAMILY: 'Times New Roman','serif'; mso-bidi-font-size: 10.5pt; mso-fareast-theme-font: minor-fareast; mso-fareast-font-family: 宋体">*<o:p></o:p></SPAN></I></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt"><I style="mso-bidi-font-style: normal"><SPAN style="FONT-FAMILY: 宋体; mso-bidi-font-size: 10.5pt; mso-fareast-theme-font: minor-fareast; mso-hansi-theme-font: minor-fareast; mso-ascii-font-family: 'Times New Roman'">第</SPAN></I><I style="mso-bidi-font-style: normal"><SPAN lang=EN-US style="FONT-FAMILY: 'Times New Roman','serif'; mso-bidi-font-size: 10.5pt; mso-fareast-theme-font: minor-fareast; mso-fareast-font-family: 宋体"> 1 </SPAN></I><I style="mso-bidi-font-style: normal"><SPAN style="FONT-FAMILY: 宋体; mso-bidi-font-size: 10.5pt; mso-fareast-theme-font: minor-fareast; mso-hansi-theme-font: minor-fareast; mso-ascii-font-family: 'Times New Roman'">行出现错误</SPAN></I><I style="mso-bidi-font-style: normal"><SPAN lang=EN-US style="FONT-FAMILY: 'Times New Roman','serif'; mso-bidi-font-size: 10.5pt; mso-fareast-theme-font: minor-fareast; mso-fareast-font-family: 宋体">:<o:p></o:p></SPAN></I></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt"><I style="mso-bidi-font-style: normal"><SPAN lang=EN-US style="FONT-FAMILY: 'Times New Roman','serif'; mso-bidi-font-size: 10.5pt; mso-fareast-theme-font: minor-fareast; mso-fareast-font-family: 宋体">ORA-16014: </SPAN></I><I style="mso-bidi-font-style: normal"><SPAN style="FONT-FAMILY: 宋体; mso-bidi-font-size: 10.5pt; mso-fareast-theme-font: minor-fareast; mso-hansi-theme-font: minor-fareast; mso-ascii-font-family: 'Times New Roman'">日志</SPAN></I><I style="mso-bidi-font-style: normal"><SPAN style="FONT-FAMILY: 'Times New Roman','serif'; mso-bidi-font-size: 10.5pt; mso-fareast-theme-font: minor-fareast; mso-fareast-font-family: 宋体"> <SPAN lang=EN-US>3 </SPAN></SPAN></I><I style="mso-bidi-font-style: normal"><SPAN style="FONT-FAMILY: 宋体; mso-bidi-font-size: 10.5pt; mso-fareast-theme-font: minor-fareast; mso-hansi-theme-font: minor-fareast; mso-ascii-font-family: 'Times New Roman'">的序列号</SPAN></I><I style="mso-bidi-font-style: normal"><SPAN style="FONT-FAMILY: 'Times New Roman','serif'; mso-bidi-font-size: 10.5pt; mso-fareast-theme-font: minor-fareast; mso-fareast-font-family: 宋体"> <SPAN lang=EN-US>127 </SPAN></SPAN></I><I style="mso-bidi-font-style: normal"><SPAN style="FONT-FAMILY: 宋体; mso-bidi-font-size: 10.5pt; mso-fareast-theme-font: minor-fareast; mso-hansi-theme-font: minor-fareast; mso-ascii-font-family: 'Times New Roman'">未归档，</SPAN></I><I style="mso-bidi-font-style: normal"><SPAN style="FONT-FAMILY: 'Times New Roman','serif'; mso-bidi-font-size: 10.5pt; mso-fareast-theme-font: minor-fareast; mso-fareast-font-family: 宋体"> </SPAN></I><I style="mso-bidi-font-style: normal"><SPAN style="FONT-FAMILY: 宋体; mso-bidi-font-size: 10.5pt; mso-fareast-theme-font: minor-fareast; mso-hansi-theme-font: minor-fareast; mso-ascii-font-family: 'Times New Roman'">没有可用的目的地</SPAN></I><I style="mso-bidi-font-style: normal"><SPAN lang=EN-US style="FONT-FAMILY: 'Times New Roman','serif'; mso-bidi-font-size: 10.5pt; mso-fareast-theme-font: minor-fareast; mso-fareast-font-family: 宋体"><o:p></o:p></SPAN></I></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt"><I style="mso-bidi-font-style: normal"><SPAN lang=EN-US style="FONT-FAMILY: 'Times New Roman','serif'; mso-bidi-font-size: 10.5pt; mso-fareast-theme-font: minor-fareast; mso-fareast-font-family: 宋体">ORA-00312: </SPAN></I><I style="mso-bidi-font-style: normal"><SPAN style="FONT-FAMILY: 宋体; mso-bidi-font-size: 10.5pt; mso-fareast-theme-font: minor-fareast; mso-hansi-theme-font: minor-fareast; mso-ascii-font-family: 'Times New Roman'">联机日志</SPAN></I><I style="mso-bidi-font-style: normal"><SPAN style="FONT-FAMILY: 'Times New Roman','serif'; mso-bidi-font-size: 10.5pt; mso-fareast-theme-font: minor-fareast; mso-fareast-font-family: 宋体"> <SPAN lang=EN-US>3 </SPAN></SPAN></I><I style="mso-bidi-font-style: normal"><SPAN style="FONT-FAMILY: 宋体; mso-bidi-font-size: 10.5pt; mso-fareast-theme-font: minor-fareast; mso-hansi-theme-font: minor-fareast; mso-ascii-font-family: 'Times New Roman'">线程</SPAN></I><I style="mso-bidi-font-style: normal"><SPAN lang=EN-US style="FONT-FAMILY: 'Times New Roman','serif'; mso-bidi-font-size: 10.5pt; mso-fareast-theme-font: minor-fareast; mso-fareast-font-family: 宋体"> 1:<o:p></o:p></SPAN></I></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt"><I style="mso-bidi-font-style: normal"><SPAN lang=EN-US style="FONT-FAMILY: 'Times New Roman','serif'; mso-bidi-font-size: 10.5pt; mso-fareast-theme-font: minor-fareast; mso-fareast-font-family: 宋体">’ D:\ORACLE\PRODUCT\10.2.0\ORADATA\TEST\REDO03.LOG’</SPAN></I><SPAN lang=EN-US style="FONT-FAMILY: 'Times New Roman','serif'; mso-bidi-font-size: 10.5pt; mso-fareast-theme-font: minor-fareast; mso-fareast-font-family: 宋体"><o:p></o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt; TEXT-INDENT: 21pt"><SPAN style="FONT-FAMILY: 宋体; mso-bidi-font-size: 10.5pt; mso-fareast-theme-font: minor-fareast; mso-hansi-theme-font: minor-fareast; mso-ascii-font-family: 'Times New Roman'">查看警告日志文件中发现的错误，怀疑是空间不够，于是修改了参数</SPAN><SPAN lang=EN-US style="FONT-FAMILY: 'Times New Roman','serif'; mso-bidi-font-size: 10.5pt; mso-fareast-theme-font: minor-fareast; mso-fareast-font-family: 宋体">db_recovery_file_dest_size</SPAN><SPAN style="FONT-FAMILY: 宋体; mso-bidi-font-size: 10.5pt; mso-fareast-theme-font: minor-fareast; mso-hansi-theme-font: minor-fareast; mso-ascii-font-family: 'Times New Roman'">，由</SPAN><SPAN lang=EN-US style="FONT-FAMILY: 'Times New Roman','serif'; mso-bidi-font-size: 10.5pt; mso-fareast-theme-font: minor-fareast; mso-fareast-font-family: 宋体">1G</SPAN><SPAN style="FONT-FAMILY: 宋体; mso-bidi-font-size: 10.5pt; mso-fareast-theme-font: minor-fareast; mso-hansi-theme-font: minor-fareast; mso-ascii-font-family: 'Times New Roman'">改为</SPAN><SPAN lang=EN-US style="FONT-FAMILY: 'Times New Roman','serif'; mso-bidi-font-size: 10.5pt; mso-fareast-theme-font: minor-fareast; mso-fareast-font-family: 宋体">2G</SPAN><SPAN style="FONT-FAMILY: 宋体; mso-bidi-font-size: 10.5pt; mso-fareast-theme-font: minor-fareast; mso-hansi-theme-font: minor-fareast; mso-ascii-font-family: 'Times New Roman'">，仍然不够，改为</SPAN><SPAN lang=EN-US style="FONT-FAMILY: 'Times New Roman','serif'; mso-bidi-font-size: 10.5pt; mso-fareast-theme-font: minor-fareast; mso-fareast-font-family: 宋体">3G</SPAN><SPAN style="FONT-FAMILY: 宋体; mso-bidi-font-size: 10.5pt; mso-fareast-theme-font: minor-fareast; mso-hansi-theme-font: minor-fareast; mso-ascii-font-family: 'Times New Roman'">后，执行归档正常了。</SPAN><SPAN lang=EN-US style="FONT-FAMILY: 'Times New Roman','serif'; mso-bidi-font-size: 10.5pt; mso-fareast-theme-font: minor-fareast; mso-fareast-font-family: 宋体"><o:p></o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt"><SPAN lang=EN-US style="FONT-FAMILY: 'Times New Roman','serif'; mso-bidi-font-size: 10.5pt; mso-fareast-theme-font: minor-fareast; mso-fareast-font-family: 宋体"><SPAN style="mso-tab-count: 1">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN></SPAN><SPAN style="FONT-FAMILY: 宋体; mso-bidi-font-size: 10.5pt; mso-fareast-theme-font: minor-fareast; mso-hansi-theme-font: minor-fareast; mso-ascii-font-family: 'Times New Roman'">感到很奇怪，归档日志所在的盘，可用空间不止</SPAN><SPAN lang=EN-US style="FONT-FAMILY: 'Times New Roman','serif'; mso-bidi-font-size: 10.5pt; mso-fareast-theme-font: minor-fareast; mso-fareast-font-family: 宋体">3G</SPAN><SPAN style="FONT-FAMILY: 宋体; mso-bidi-font-size: 10.5pt; mso-fareast-theme-font: minor-fareast; mso-hansi-theme-font: minor-fareast; mso-ascii-font-family: 'Times New Roman'">，已用的归档日志删除后也很少，是什么原因导致</SPAN><SPAN lang=EN-US style="FONT-FAMILY: 'Times New Roman','serif'; mso-bidi-font-size: 10.5pt; mso-fareast-theme-font: minor-fareast; mso-fareast-font-family: 宋体">Oracle</SPAN><SPAN style="FONT-FAMILY: 宋体; mso-bidi-font-size: 10.5pt; mso-fareast-theme-font: minor-fareast; mso-hansi-theme-font: minor-fareast; mso-ascii-font-family: 'Times New Roman'">认为归档所需的空间不够呢</SPAN><SPAN lang=EN-US style="FONT-FAMILY: 'Times New Roman','serif'; mso-bidi-font-size: 10.5pt; mso-fareast-theme-font: minor-fareast; mso-fareast-font-family: 宋体">?<o:p></o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt"><SPAN lang=EN-US style="FONT-FAMILY: 'Times New Roman','serif'; mso-bidi-font-size: 10.5pt; mso-fareast-theme-font: minor-fareast; mso-fareast-font-family: 宋体"><SPAN style="mso-tab-count: 1">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN></SPAN><SPAN style="FONT-FAMILY: 宋体; mso-bidi-font-size: 10.5pt; mso-fareast-theme-font: minor-fareast; mso-hansi-theme-font: minor-fareast; mso-ascii-font-family: 'Times New Roman'">分析警告日志文件发现有下面的信息：</SPAN><SPAN lang=EN-US style="FONT-FAMILY: 'Times New Roman','serif'; mso-bidi-font-size: 10.5pt; mso-fareast-theme-font: minor-fareast; mso-fareast-font-family: 宋体"><o:p></o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt"><SPAN lang=EN-US style="FONT-FAMILY: 'Times New Roman','serif'; mso-bidi-font-size: 10.5pt; mso-fareast-theme-font: minor-fareast; mso-fareast-font-family: 宋体"><SPAN style="mso-tab-count: 1">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN><I style="mso-bidi-font-style: normal">Errors in file g:\oracle\product\10.2.0\db_1\admin\orcl\bdump\orcl_arc1_5188.trc:<o:p></o:p></I></SPAN></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt"><I style="mso-bidi-font-style: normal"><SPAN lang=EN-US style="FONT-FAMILY: 'Times New Roman','serif'; mso-bidi-font-size: 10.5pt; mso-fareast-theme-font: minor-fareast; mso-fareast-font-family: 宋体">ORA-19815: WARNING: db_recovery_file_dest_size of 2147483648 bytes is 100.00% used, and has 0 remaining bytes available.<o:p></o:p></SPAN></I></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt"><SPAN lang=EN-US style="FONT-FAMILY: 'Times New Roman','serif'; mso-bidi-font-size: 10.5pt; mso-fareast-theme-font: minor-fareast; mso-fareast-font-family: 宋体"><SPAN style="mso-tab-count: 1">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN></SPAN><SPAN style="FONT-FAMILY: 宋体; mso-bidi-font-size: 10.5pt; mso-fareast-theme-font: minor-fareast; mso-hansi-theme-font: minor-fareast; mso-ascii-font-family: 'Times New Roman'">看来，确实</SPAN><SPAN lang=EN-US style="FONT-FAMILY: 'Times New Roman','serif'; mso-bidi-font-size: 10.5pt; mso-fareast-theme-font: minor-fareast; mso-fareast-font-family: 宋体">Oracle</SPAN><SPAN style="FONT-FAMILY: 宋体; mso-bidi-font-size: 10.5pt; mso-fareast-theme-font: minor-fareast; mso-hansi-theme-font: minor-fareast; mso-ascii-font-family: 'Times New Roman'">认为归档目录的空间满了，继续分析发现联机日志文件使用的是缺省尺寸</SPAN><SPAN lang=EN-US style="FONT-FAMILY: 'Times New Roman','serif'; mso-bidi-font-size: 10.5pt; mso-fareast-theme-font: minor-fareast; mso-fareast-font-family: 宋体">50M(Oracle 10G</SPAN><SPAN style="FONT-FAMILY: 宋体; mso-bidi-font-size: 10.5pt; mso-fareast-theme-font: minor-fareast; mso-hansi-theme-font: minor-fareast; mso-ascii-font-family: 'Times New Roman'">的缺省大小</SPAN><SPAN lang=EN-US style="FONT-FAMILY: 'Times New Roman','serif'; mso-bidi-font-size: 10.5pt; mso-fareast-theme-font: minor-fareast; mso-fareast-font-family: 宋体">)</SPAN><SPAN style="FONT-FAMILY: 宋体; mso-bidi-font-size: 10.5pt; mso-fareast-theme-font: minor-fareast; mso-hansi-theme-font: minor-fareast; mso-ascii-font-family: 'Times New Roman'">，回想起有一段时间数据库是运行在归档模式的，这么大的联机日志归档，当然空间增长很快。</SPAN><SPAN lang=EN-US style="FONT-FAMILY: 'Times New Roman','serif'; mso-bidi-font-size: 10.5pt; mso-fareast-theme-font: minor-fareast; mso-fareast-font-family: 宋体"><o:p></o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt"><SPAN lang=EN-US style="FONT-FAMILY: 'Times New Roman','serif'; mso-bidi-font-size: 10.5pt; mso-fareast-theme-font: minor-fareast; mso-fareast-font-family: 宋体"><SPAN style="mso-tab-count: 1">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN></SPAN><SPAN style="FONT-FAMILY: 宋体; mso-bidi-font-size: 10.5pt; mso-fareast-theme-font: minor-fareast; mso-hansi-theme-font: minor-fareast; mso-ascii-font-family: 'Times New Roman'">于是，先重建联机日志文件，改为每个文件</SPAN><SPAN lang=EN-US style="FONT-FAMILY: 'Times New Roman','serif'; mso-bidi-font-size: 10.5pt; mso-fareast-theme-font: minor-fareast; mso-fareast-font-family: 宋体">5M</SPAN><SPAN style="FONT-FAMILY: 宋体; mso-bidi-font-size: 10.5pt; mso-fareast-theme-font: minor-fareast; mso-hansi-theme-font: minor-fareast; mso-ascii-font-family: 'Times New Roman'">。</SPAN><SPAN lang=EN-US style="FONT-FAMILY: 'Times New Roman','serif'; mso-bidi-font-size: 10.5pt; mso-fareast-theme-font: minor-fareast; mso-fareast-font-family: 宋体"><o:p></o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt"><SPAN lang=EN-US style="FONT-FAMILY: 'Times New Roman','serif'; mso-bidi-font-size: 10.5pt; mso-fareast-theme-font: minor-fareast; mso-fareast-font-family: 宋体"><SPAN style="mso-tab-count: 1">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN></SPAN><SPAN style="FONT-FAMILY: 宋体; mso-bidi-font-size: 10.5pt; mso-fareast-theme-font: minor-fareast; mso-hansi-theme-font: minor-fareast; mso-ascii-font-family: 'Times New Roman'">但是，归档日志是删除了的，占用的空间根本就没有</SPAN><SPAN lang=EN-US style="FONT-FAMILY: 'Times New Roman','serif'; mso-bidi-font-size: 10.5pt; mso-fareast-theme-font: minor-fareast; mso-fareast-font-family: 宋体">2G</SPAN><SPAN style="FONT-FAMILY: 宋体; mso-bidi-font-size: 10.5pt; mso-fareast-theme-font: minor-fareast; mso-hansi-theme-font: minor-fareast; mso-ascii-font-family: 'Times New Roman'">，</SPAN><SPAN lang=EN-US style="FONT-FAMILY: 'Times New Roman','serif'; mso-bidi-font-size: 10.5pt; mso-fareast-theme-font: minor-fareast; mso-fareast-font-family: 宋体">Oracle</SPAN><SPAN style="FONT-FAMILY: 宋体; mso-bidi-font-size: 10.5pt; mso-fareast-theme-font: minor-fareast; mso-hansi-theme-font: minor-fareast; mso-ascii-font-family: 'Times New Roman'">为什么认为空间不够呢？原来，</SPAN><SPAN lang=EN-US style="FONT-FAMILY: 'Times New Roman','serif'; mso-bidi-font-size: 10.5pt; mso-fareast-theme-font: minor-fareast; mso-fareast-font-family: 宋体">Oracle</SPAN><SPAN style="FONT-FAMILY: 宋体; mso-bidi-font-size: 10.5pt; mso-fareast-theme-font: minor-fareast; mso-hansi-theme-font: minor-fareast; mso-ascii-font-family: 'Times New Roman'">内部还记录了这些归档文件的信息，物理文件虽然删除了，但是文件相关的信息仍然在</SPAN><SPAN lang=EN-US style="FONT-FAMILY: 'Times New Roman','serif'; mso-bidi-font-size: 10.5pt; mso-fareast-theme-font: minor-fareast; mso-fareast-font-family: 宋体">Oracle</SPAN><SPAN style="FONT-FAMILY: 宋体; mso-bidi-font-size: 10.5pt; mso-fareast-theme-font: minor-fareast; mso-hansi-theme-font: minor-fareast; mso-ascii-font-family: 'Times New Roman'">数据库中，需要使用</SPAN><SPAN lang=EN-US style="FONT-FAMILY: 'Times New Roman','serif'; mso-bidi-font-size: 10.5pt; mso-fareast-theme-font: minor-fareast; mso-fareast-font-family: 宋体">Rman</SPAN><SPAN style="FONT-FAMILY: 宋体; mso-bidi-font-size: 10.5pt; mso-fareast-theme-font: minor-fareast; mso-hansi-theme-font: minor-fareast; mso-ascii-font-family: 'Times New Roman'">的命令来清除这些信息。</SPAN><SPAN lang=EN-US style="FONT-FAMILY: 'Times New Roman','serif'; mso-bidi-font-size: 10.5pt; mso-fareast-theme-font: minor-fareast; mso-fareast-font-family: 宋体"><o:p></o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt"><I style="mso-bidi-font-style: normal"><SPAN lang=EN-US style="FONT-FAMILY: 'Times New Roman','serif'; mso-bidi-font-size: 10.5pt; mso-fareast-theme-font: minor-fareast; mso-fareast-font-family: 宋体"><SPAN style="mso-tab-count: 1">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN>RMAN&gt;connect target /<o:p></o:p></SPAN></I></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt"><I style="mso-bidi-font-style: normal"><SPAN lang=EN-US style="FONT-FAMILY: 'Times New Roman','serif'; mso-bidi-font-size: 10.5pt; mso-fareast-theme-font: minor-fareast; mso-fareast-font-family: 宋体"><SPAN style="mso-tab-count: 1">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN>RMAN&gt;<SPAN class=javascript>crosscheck archivelog all<o:p></o:p></SPAN></SPAN></I></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt"><SPAN class=javascript><I style="mso-bidi-font-style: normal"><SPAN lang=EN-US style="FONT-FAMILY: 'Times New Roman','serif'; mso-bidi-font-size: 10.5pt; mso-fareast-theme-font: minor-fareast; mso-fareast-font-family: 宋体"><SPAN style="mso-tab-count: 1">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN></SPAN></I></SPAN><I style="mso-bidi-font-style: normal"><SPAN lang=EN-US style="FONT-FAMILY: 'Times New Roman','serif'; mso-bidi-font-size: 10.5pt; mso-fareast-theme-font: minor-fareast; mso-fareast-font-family: 宋体">RMAN&gt;<SPAN class=javascript> delete expired archivelog all<o:p></o:p></SPAN></SPAN></I></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt"><SPAN class=javascript><SPAN lang=EN-US style="FONT-FAMILY: 'Times New Roman','serif'; mso-bidi-font-size: 10.5pt; mso-fareast-theme-font: minor-fareast; mso-fareast-font-family: 宋体"><SPAN style="mso-tab-count: 1">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN></SPAN></SPAN><SPAN class=javascript><SPAN style="FONT-FAMILY: 宋体; mso-bidi-font-size: 10.5pt; mso-fareast-theme-font: minor-fareast; mso-hansi-theme-font: minor-fareast; mso-ascii-font-family: 'Times New Roman'">最后，再修改</SPAN></SPAN><SPAN lang=EN-US style="FONT-FAMILY: 'Times New Roman','serif'; mso-bidi-font-size: 10.5pt; mso-fareast-theme-font: minor-fareast; mso-fareast-font-family: 宋体">db_recovery_file_dest_size</SPAN><SPAN style="FONT-FAMILY: 宋体; mso-bidi-font-size: 10.5pt; mso-fareast-theme-font: minor-fareast; mso-hansi-theme-font: minor-fareast; mso-ascii-font-family: 'Times New Roman'">，改为</SPAN><SPAN lang=EN-US style="FONT-FAMILY: 'Times New Roman','serif'; mso-bidi-font-size: 10.5pt; mso-fareast-theme-font: minor-fareast; mso-fareast-font-family: 宋体">1G</SPAN><SPAN style="FONT-FAMILY: 宋体; mso-bidi-font-size: 10.5pt; mso-fareast-theme-font: minor-fareast; mso-hansi-theme-font: minor-fareast; mso-ascii-font-family: 'Times New Roman'">，执行强制归档，一切正常了。</SPAN><SPAN lang=EN-US style="FONT-FAMILY: 'Times New Roman','serif'; mso-bidi-font-size: 10.5pt; mso-fareast-theme-font: minor-fareast; mso-fareast-font-family: 宋体"><o:p></o:p></SPAN></P>
<P></SPAN>&nbsp;</P><img src ="http://www.cnblogs.com/zyk/aggbug/946270.html?type=1" width = "1" height = "1" /><br><br><a href="http://news.cnblogs.com/n/43606/" target="_blank">[新闻]李彦宏首次表态竞价排名问题:有错能改善莫大焉</a><br/><a href="http://www.cnblogs.com" target="_blank">博客园首页</a>&nbsp;<a href="http://space.cnblogs.com" target="_blank">社区</a>&nbsp;<a href="http://news.cnblogs.com" target="_blank">新闻频道</a>&nbsp;<a href="http://space.cnblogs.com/group.htm" target="_blank">小组</a>&nbsp;<a href="http://space.cnblogs.com/q" target="_blank">博问</a>&nbsp;<a href="http://wz.cnblogs.com/" target="_blank">网摘</a>&nbsp;<a href="http://space.cnblogs.com/ing" target="_blank">闪存</a>]]></description></item><item><title>ORA-12514: TNS: 监听程序当前无法识别连接描述符中请求的服务　问题解决</title><link>http://www.cnblogs.com/zyk/archive/2007/10/31/944667.html</link><dc:creator>知道得越多知道的越少</dc:creator><author>知道得越多知道的越少</author><pubDate>Wed, 31 Oct 2007 09:52:00 GMT</pubDate><guid>http://www.cnblogs.com/zyk/archive/2007/10/31/944667.html</guid><wfw:comment>http://www.cnblogs.com/zyk/comments/944667.html</wfw:comment><comments>http://www.cnblogs.com/zyk/archive/2007/10/31/944667.html#Feedback</comments><slash:comments>10</slash:comments><wfw:commentRss>http://www.cnblogs.com/zyk/comments/commentRss/944667.html</wfw:commentRss><trackback:ping>http://www.cnblogs.com/zyk/services/trackbacks/944667.html</trackback:ping><description><![CDATA[<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt"><SPAN lang=EN-US style="FONT-FAMILY: 宋体; mso-bidi-font-size: 10.5pt; mso-ascii-theme-font: minor-fareast; mso-fareast-theme-font: minor-fareast; mso-hansi-theme-font: minor-fareast; mso-bidi-font-weight: bold"><?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" /><o:p>&nbsp;</o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt"><SPAN lang=EN-US style="FONT-FAMILY: 宋体; mso-bidi-font-size: 10.5pt; mso-ascii-theme-font: minor-fareast; mso-fareast-theme-font: minor-fareast; mso-hansi-theme-font: minor-fareast; mso-bidi-font-weight: bold"><SPAN style="mso-tab-count: 1">&nbsp;&nbsp;&nbsp; </SPAN></SPAN><SPAN style="FONT-FAMILY: 宋体; mso-bidi-font-size: 10.5pt; mso-ascii-theme-font: minor-fareast; mso-fareast-theme-font: minor-fareast; mso-hansi-theme-font: minor-fareast; mso-bidi-font-weight: bold">近日在配置<SPAN lang=EN-US>Oracle 10G</SPAN>的流复制环境时，遇到一个问题，关闭数据库（<SPAN lang=EN-US>shutdown immediate</SPAN>）后，通过<SPAN lang=EN-US>SQL Plus</SPAN>连接数据库<SPAN lang=EN-US>:conn sys/his@orc0 as sysdba</SPAN>，出现如下错误：<SPAN lang=EN-US><o:p></o:p></SPAN></SPAN></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt"><SPAN lang=EN-US style="FONT-FAMILY: 宋体; mso-bidi-font-size: 10.5pt; mso-ascii-theme-font: minor-fareast; mso-fareast-theme-font: minor-fareast; mso-hansi-theme-font: minor-fareast; mso-bidi-font-weight: bold"><SPAN style="mso-tab-count: 1">&nbsp;&nbsp;&nbsp; </SPAN>ORA-12514: TNS: </SPAN><SPAN style="FONT-FAMILY: 宋体; mso-bidi-font-size: 10.5pt; mso-ascii-theme-font: minor-fareast; mso-fareast-theme-font: minor-fareast; mso-hansi-theme-font: minor-fareast; mso-bidi-font-weight: bold">监听程序当前无法识别连接描述符中请求的服务<SPAN lang=EN-US><o:p></o:p></SPAN></SPAN></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt"><SPAN style="FONT-FAMILY: 宋体; mso-bidi-font-size: 10.5pt; mso-ascii-theme-font: minor-fareast; mso-fareast-theme-font: minor-fareast; mso-hansi-theme-font: minor-fareast">通过重启服务的方式启动数据库，再次连接却能成功登录，也就是说在关闭数据库状态下无法连接服务器。<SPAN lang=EN-US><o:p></o:p></SPAN></SPAN></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt"><SPAN lang=EN-US style="FONT-FAMILY: 宋体; mso-bidi-font-size: 10.5pt; mso-ascii-theme-font: minor-fareast; mso-fareast-theme-font: minor-fareast; mso-hansi-theme-font: minor-fareast"><SPAN style="mso-tab-count: 1">&nbsp;&nbsp;&nbsp; </SPAN></SPAN><SPAN style="FONT-FAMILY: 宋体; mso-bidi-font-size: 10.5pt; mso-ascii-theme-font: minor-fareast; mso-fareast-theme-font: minor-fareast; mso-hansi-theme-font: minor-fareast">开始以为是系统环境变量<SPAN lang=EN-US>Oracle_SID</SPAN>的配置问题，因为机器有多个实例，一阵折腾后还是不能连接。后来查资料得知：<SPAN lang=EN-US><o:p></o:p></SPAN></SPAN></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt"><SPAN lang=EN-US style="FONT-FAMILY: 宋体; mso-bidi-font-size: 10.5pt; mso-ascii-theme-font: minor-fareast; mso-fareast-theme-font: minor-fareast; mso-hansi-theme-font: minor-fareast"><SPAN style="mso-tab-count: 1">&nbsp;&nbsp;&nbsp; </SPAN>Oracle9i</SPAN><SPAN style="FONT-FAMILY: 宋体; mso-bidi-font-size: 10.5pt; mso-ascii-theme-font: minor-fareast; mso-fareast-theme-font: minor-fareast; mso-hansi-theme-font: minor-fareast">以后，后台进程<SPAN lang=EN-US>PMON</SPAN>自动在监听器中注册在系统参数<SPAN lang=EN-US>SERVICE_NAMES</SPAN>中定义的服务名，<SPAN lang=EN-US>SERVICE_NAMES</SPAN>默认为<SPAN lang=EN-US>DB_NAME+DOMAIN_NAME</SPAN>。监听配置文件<SPAN lang=EN-US>listener.ora</SPAN>中可以不必指定监听的服务名。但是，当数据库处于关闭状态下<SPAN lang=EN-US>PMON</SPAN>进程没有启动，也就不会自动注册监听的实例名，所以使用<SPAN lang=EN-US>sqlplus sys/his@orc0 as sysdba </SPAN>会出现<SPAN lang=EN-US>ORA-12514</SPAN>错误。<SPAN lang=EN-US><o:p></o:p></SPAN></SPAN></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt; TEXT-INDENT: 21pt"><SPAN style="FONT-FAMILY: 宋体; mso-bidi-font-size: 10.5pt; mso-ascii-theme-font: minor-fareast; mso-fareast-theme-font: minor-fareast; mso-hansi-theme-font: minor-fareast">如果在<SPAN lang=EN-US>listener.ora</SPAN>文件中指定监听的实例名，则即使数据库处于关闭状态，仍然可以连接。<SPAN lang=EN-US><o:p></o:p></SPAN></SPAN></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt; TEXT-INDENT: 21pt"><SPAN lang=EN-US style="FONT-FAMILY: 宋体; mso-bidi-font-size: 10.5pt; mso-ascii-theme-font: minor-fareast; mso-fareast-theme-font: minor-fareast; mso-hansi-theme-font: minor-fareast">listener.ora<o:p></o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt; TEXT-INDENT: 21pt"><SPAN lang=EN-US style="FONT-FAMILY: 宋体; mso-bidi-font-size: 10.5pt; mso-ascii-theme-font: minor-fareast; mso-fareast-theme-font: minor-fareast; mso-hansi-theme-font: minor-fareast; mso-bidi-font-family: Arial">SID_LIST_LISTENER =<o:p></o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt; TEXT-INDENT: 21pt"><SPAN lang=EN-US style="FONT-FAMILY: 宋体; mso-bidi-font-size: 10.5pt; mso-ascii-theme-font: minor-fareast; mso-fareast-theme-font: minor-fareast; mso-hansi-theme-font: minor-fareast; mso-bidi-font-family: Arial"><SPAN style="mso-spacerun: yes">&nbsp; </SPAN>(SID_LIST =<o:p></o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt; TEXT-INDENT: 21pt"><SPAN lang=EN-US style="FONT-FAMILY: 宋体; mso-bidi-font-size: 10.5pt; mso-ascii-theme-font: minor-fareast; mso-fareast-theme-font: minor-fareast; mso-hansi-theme-font: minor-fareast; mso-bidi-font-family: Arial"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp; </SPAN>(SID_DESC =<o:p></o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt; TEXT-INDENT: 21pt"><SPAN lang=EN-US style="FONT-FAMILY: 宋体; mso-bidi-font-size: 10.5pt; mso-ascii-theme-font: minor-fareast; mso-fareast-theme-font: minor-fareast; mso-hansi-theme-font: minor-fareast; mso-bidi-font-family: Arial"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN>(SID_NAME = PLSExtProc)<o:p></o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt; TEXT-INDENT: 21pt"><SPAN lang=EN-US style="FONT-FAMILY: 宋体; mso-bidi-font-size: 10.5pt; mso-ascii-theme-font: minor-fareast; mso-fareast-theme-font: minor-fareast; mso-hansi-theme-font: minor-fareast; mso-bidi-font-family: Arial"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN>(ORACLE_HOME = G:\oracle\product\10.2.0\db_1)<o:p></o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt; TEXT-INDENT: 21pt"><SPAN lang=EN-US style="FONT-FAMILY: 宋体; mso-bidi-font-size: 10.5pt; mso-ascii-theme-font: minor-fareast; mso-fareast-theme-font: minor-fareast; mso-hansi-theme-font: minor-fareast; mso-bidi-font-family: Arial"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN>(PROGRAM = extproc)<o:p></o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt; TEXT-INDENT: 21pt"><SPAN lang=EN-US style="FONT-FAMILY: 宋体; mso-bidi-font-size: 10.5pt; mso-ascii-theme-font: minor-fareast; mso-fareast-theme-font: minor-fareast; mso-hansi-theme-font: minor-fareast; mso-bidi-font-family: Arial"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp; </SPAN>)<o:p></o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt; TEXT-INDENT: 21pt"><SPAN lang=EN-US style="FONT-FAMILY: 宋体; mso-bidi-font-size: 10.5pt; mso-ascii-theme-font: minor-fareast; mso-fareast-theme-font: minor-fareast; mso-hansi-theme-font: minor-fareast; mso-bidi-font-family: Arial"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp; </SPAN><B style="mso-bidi-font-weight: normal">(SID_DESC =<o:p></o:p></B></SPAN></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt; TEXT-INDENT: 21pt"><B style="mso-bidi-font-weight: normal"><SPAN lang=EN-US style="FONT-FAMILY: 宋体; mso-bidi-font-size: 10.5pt; mso-ascii-theme-font: minor-fareast; mso-fareast-theme-font: minor-fareast; mso-hansi-theme-font: minor-fareast; mso-bidi-font-family: Arial"><SPAN style="mso-tab-count: 1">&nbsp;&nbsp;&nbsp; </SPAN>(GLOBAL_DBNAME = ORCL)<o:p></o:p></SPAN></B></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt; TEXT-INDENT: 21pt"><B style="mso-bidi-font-weight: normal"><SPAN lang=EN-US style="FONT-FAMILY: 宋体; mso-bidi-font-size: 10.5pt; mso-ascii-theme-font: minor-fareast; mso-fareast-theme-font: minor-fareast; mso-hansi-theme-font: minor-fareast; mso-bidi-font-family: Arial"><SPAN style="mso-tab-count: 1">&nbsp;&nbsp;&nbsp; </SPAN>(ORACLE_HOME = G:\oracle\product\10.2.0\db_1)<SPAN style="mso-spacerun: yes">&nbsp;&nbsp; </SPAN><o:p></o:p></SPAN></B></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt; TEXT-INDENT: 21pt"><B style="mso-bidi-font-weight: normal"><SPAN lang=EN-US style="FONT-FAMILY: 宋体; mso-bidi-font-size: 10.5pt; mso-ascii-theme-font: minor-fareast; mso-fareast-theme-font: minor-fareast; mso-hansi-theme-font: minor-fareast; mso-bidi-font-family: Arial"><SPAN style="mso-tab-count: 1">&nbsp;&nbsp;&nbsp; </SPAN>(SID_NAME = ORCL)<o:p></o:p></SPAN></B></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt; TEXT-INDENT: 21pt"><B style="mso-bidi-font-weight: normal"><SPAN lang=EN-US style="FONT-FAMILY: 宋体; mso-bidi-font-size: 10.5pt; mso-ascii-theme-font: minor-fareast; mso-fareast-theme-font: minor-fareast; mso-hansi-theme-font: minor-fareast; mso-bidi-font-family: Arial"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp; </SPAN>)<o:p></o:p></SPAN></B></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt; TEXT-INDENT: 21pt"><SPAN lang=EN-US style="FONT-FAMILY: 宋体; mso-bidi-font-size: 10.5pt; mso-ascii-theme-font: minor-fareast; mso-fareast-theme-font: minor-fareast; mso-hansi-theme-font: minor-fareast; mso-bidi-font-family: Arial"><SPAN style="mso-spacerun: yes">&nbsp; </SPAN>)<o:p></o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt; TEXT-INDENT: 21pt"><SPAN lang=EN-US style="FONT-FAMILY: 宋体; mso-bidi-font-size: 10.5pt; mso-ascii-theme-font: minor-fareast; mso-fareast-theme-font: minor-fareast; mso-hansi-theme-font: minor-fareast; mso-bidi-font-family: Arial">LISTENER =<o:p></o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt; TEXT-INDENT: 21pt"><SPAN lang=EN-US style="FONT-FAMILY: 宋体; mso-bidi-font-size: 10.5pt; mso-ascii-theme-font: minor-fareast; mso-fareast-theme-font: minor-fareast; mso-hansi-theme-font: minor-fareast; mso-bidi-font-family: Arial"><SPAN style="mso-spacerun: yes">&nbsp; </SPAN>(DESCRIPTION_LIST =<o:p></o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt; TEXT-INDENT: 21pt"><SPAN lang=EN-US style="FONT-FAMILY: 宋体; mso-bidi-font-size: 10.5pt; mso-ascii-theme-font: minor-fareast; mso-fareast-theme-font: minor-fareast; mso-hansi-theme-font: minor-fareast; mso-bidi-font-family: Arial"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp; </SPAN>(DESCRIPTION =<o:p></o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt; TEXT-INDENT: 21pt"><SPAN lang=EN-US style="FONT-FAMILY: 宋体; mso-bidi-font-size: 10.5pt; mso-ascii-theme-font: minor-fareast; mso-fareast-theme-font: minor-fareast; mso-hansi-theme-font: minor-fareast; mso-bidi-font-family: Arial"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN>(ADDRESS = (PROTOCOL = TCP)(HOST = zyk)(PORT = 1521))<o:p></o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt; TEXT-INDENT: 21pt"><SPAN lang=EN-US style="FONT-FAMILY: 宋体; mso-bidi-font-size: 10.5pt; mso-ascii-theme-font: minor-fareast; mso-fareast-theme-font: minor-fareast; mso-hansi-theme-font: minor-fareast; mso-bidi-font-family: Arial"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp; </SPAN>)<o:p></o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt; TEXT-INDENT: 21pt"><SPAN lang=EN-US style="FONT-FAMILY: 宋体; mso-bidi-font-size: 10.5pt; mso-ascii-theme-font: minor-fareast; mso-fareast-theme-font: minor-fareast; mso-hansi-theme-font: minor-fareast; mso-bidi-font-family: Arial"><SPAN style="mso-spacerun: yes">&nbsp; </SPAN>)<o:p></o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt; TEXT-INDENT: 21pt"><SPAN lang=EN-US style="FONT-FAMILY: 宋体; mso-bidi-font-size: 10.5pt; mso-ascii-theme-font: minor-fareast; mso-fareast-theme-font: minor-fareast; mso-hansi-theme-font: minor-fareast; mso-bidi-font-family: Arial"><o:p>&nbsp;</o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt"><SPAN style="FONT-FAMILY: 宋体; mso-bidi-font-size: 10.5pt; mso-ascii-theme-font: minor-fareast; mso-fareast-theme-font: minor-fareast; mso-hansi-theme-font: minor-fareast">以上粗体部件为增加的内容，修改后重启监听服务后即可。<SPAN lang=EN-US><o:p></o:p></SPAN></SPAN></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt"><SPAN style="FONT-FAMILY: 宋体; mso-bidi-font-size: 10.5pt; mso-ascii-theme-font: minor-fareast; mso-fareast-theme-font: minor-fareast; mso-hansi-theme-font: minor-fareast">附：通过在<SPAN lang=EN-US>lsnrctl</SPAN>中输入<SPAN lang=EN-US>set display verbose</SPAN>，然后再通过命令<SPAN lang=EN-US>service</SPAN>查看，</SPAN><SPAN style="FONT-FAMILY: 宋体; mso-bidi-font-size: 10.5pt; mso-ascii-theme-font: minor-fareast; mso-fareast-theme-font: minor-fareast; mso-hansi-theme-font: minor-fareast; mso-bidi-font-family: Arial">服务状态为<SPAN lang=EN-US>READY</SPAN>表示<SPAN lang=EN-US>PMON</SPAN>自动注册的服务名，而<SPAN lang=EN-US>UNKNOWN</SPAN>则表示该服务是手工在<SPAN lang=EN-US>LISTENER.ORA</SPAN>中配置的数据库服务。<SPAN lang=EN-US><o:p></o:p></SPAN></SPAN></P><img src ="http://www.cnblogs.com/zyk/aggbug/944667.html?type=1" width = "1" height = "1" /><br><br><a href="http://news.cnblogs.com/n/43605/" target="_blank">[新闻]杨致远发表博客解释辞职原因</a><br/><a href="http://www.cnblogs.com" target="_blank">博客园首页</a>&nbsp;<a href="http://space.cnblogs.com" target="_blank">社区</a>&nbsp;<a href="http://news.cnblogs.com" target="_blank">新闻频道</a>&nbsp;<a href="http://space.cnblogs.com/group.htm" target="_blank">小组</a>&nbsp;<a href="http://space.cnblogs.com/q" target="_blank">博问</a>&nbsp;<a href="http://wz.cnblogs.com/" target="_blank">网摘</a>&nbsp;<a href="http://space.cnblogs.com/ing" target="_blank">闪存</a>]]></description></item><item><title>生成SQL记录集的一些数据</title><link>http://www.cnblogs.com/zyk/archive/2007/08/18/861283.html</link><dc:creator>知道得越多知道的越少</dc:creator><author>知道得越多知道的越少</author><pubDate>Sat, 18 Aug 2007 15:31:00 GMT</pubDate><guid>http://www.cnblogs.com/zyk/archive/2007/08/18/861283.html</guid><wfw:comment>http://www.cnblogs.com/zyk/comments/861283.html</wfw:comment><comments>http://www.cnblogs.com/zyk/archive/2007/08/18/861283.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.cnblogs.com/zyk/comments/commentRss/861283.html</wfw:commentRss><trackback:ping>http://www.cnblogs.com/zyk/services/trackbacks/861283.html</trackback:ping><description><![CDATA[<P>生成1-100的数字：select rownum from dual connect by rownum&lt;=100</P>
<P>生成10-100的数字：select rownum+(10-1) from dual connect by rownum&lt;=100-(10-1)</P>
<P>生成100以内的基数：select rownum*2-1 from dual connect by rownum&lt;=50</P>
<P>生成100以内的偶数：select rownum*2 from dual connect by rownum&lt;=50<BR><BR></P>
<P>生成100个随机数：Select Dbms_Random.random From dual connect by rownum&lt;=100</P><img src ="http://www.cnblogs.com/zyk/aggbug/861283.html?type=1" width = "1" height = "1" /><br><br><a href="http://news.cnblogs.com/n/43604/" target="_blank">[新闻]微软公布免费安全软件计划</a><br/><a href="http://www.cnblogs.com" target="_blank">博客园首页</a>&nbsp;<a href="http://space.cnblogs.com" target="_blank">社区</a>&nbsp;<a href="http://news.cnblogs.com" target="_blank">新闻频道</a>&nbsp;<a href="http://space.cnblogs.com/group.htm" target="_blank">小组</a>&nbsp;<a href="http://space.cnblogs.com/q" target="_blank">博问</a>&nbsp;<a href="http://wz.cnblogs.com/" target="_blank">网摘</a>&nbsp;<a href="http://space.cnblogs.com/ing" target="_blank">闪存</a>]]></description></item><item><title>导入的数据，删除约束后没有自动删除对应索引，重建约束出错</title><link>http://www.cnblogs.com/zyk/archive/2007/06/14/783435.html</link><dc:creator>知道得越多知道的越少</dc:creator><author>知道得越多知道的越少</author><pubDate>Thu, 14 Jun 2007 05:24:00 GMT</pubDate><guid>http://www.cnblogs.com/zyk/archive/2007/06/14/783435.html</guid><wfw:comment>http://www.cnblogs.com/zyk/comments/783435.html</wfw:comment><comments>http://www.cnblogs.com/zyk/archive/2007/06/14/783435.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.cnblogs.com/zyk/comments/commentRss/783435.html</wfw:commentRss><trackback:ping>http://www.cnblogs.com/zyk/services/trackbacks/783435.html</trackback:ping><description><![CDATA[<P>查了资料，有两种情况，一种Oracle 10G的一个BUG：3894962，但一直没有发布补丁。</P>
<P>Note:292096.1,Note:370633.1这两篇文章有介绍，当导出导入表的时候，如果有主键约束及索引，索引导入的时候没有和主键约束建立依赖，所以删除约束时，索引没有被删除。</P>
<P>另一种情况是Oracle 10G的一项改变,Note:309821.1</P>
<P>提供的解决办法就是加上删除索引的语法：alter table &lt; table &gt; drop constraint &lt; constraint &gt; <STRONG>drop index;<BR>注意：</STRONG>Drop index的语法是9i才支持的。</P>
<P></P>
<P>
<TABLE cellSpacing=6 cellPadding=0 width="80%" border=0>
<TBODY>
<TR>
<TD vAlign=top align=right>Subject: </TD>
<TD align=left colSpan=4><STRONG>Oracle 10G Does not Drop User Index Associated With Unique/Primary Key Constraints</STRONG></TD></TR>
<TR>
<TD>&nbsp;</TD>
<TD vAlign=top align=right><A href="https://metalink.oracle.com/help/usaeng/Search/search.html#file" target=_blank>Doc ID</A>: </TD>
<TD align=left><STRONG>Note:309821.1</STRONG></TD>
<TD vAlign=top align=right>Type: </TD>
<TD align=left><STRONG>PROBLEM</STRONG></TD></TR>
<TR>
<TD>&nbsp;</TD>
<TD vAlign=top align=right>Last Revision Date: </TD>
<TD align=left><STRONG>31-MAY-2005</STRONG></TD>
<TD vAlign=top align=right>Status: </TD>
<TD align=left><STRONG>MODERATED</STRONG></TD></TR></TBODY></TABLE>&lt;script language="JavaScript"&gt;&lt;/script&gt;</P>
<P></P>
<H3>The information in this document applies to: </H3>
<P>Oracle Server - Enterprise Edition - Version: 10.1.0.2 to 10.2.0.0<BR>This problem can occur on any platform.<BR></P>
<H3>Symptoms</H3>
<P>Drop constraint does not drop a associated index in 10G </P>
<H3>Cause</H3>
<P><BR>In 10g, a change was made to an internal function "atbdui" to not to drop the user index when the constraint using the index is dropped.</P>
<P>In 9i, this behavior is different the user index<BR>gets dropped when the constraint is dropped.</P>
<P>Select index_name,generated from dba_indexes where index_name='&lt; ;index_name &gt;';</P>
<P>Generated column would show 'Y' If the index is system generated.If 'N' ,it is user generated.</P>
<H3>Solution</H3>
<P><BR>This behaviour is because of the code changes made in 10G.</P>
<P>Use the workaround:</P>
<P>alter table &lt; table &gt; drop constraint &lt; constraint &gt; drop index;</P>
<P></P>
<P><STRONG>Note</STRONG></P>
<P>If the index is non unique, we can still use them for enforcing primary key constraints or unique constraints.</P>
<P>But dropping the constraint does not drop the non-unique index.<BR>This behaviour is seen from 8174 to 10.2.0.0.</P>
<P><STRONG>Sample Output</STRONG></P>
<P>SQL&gt; create table test( a number );</P>
<P>Table created.</P>
<P>SQL&gt; create index ind on test ( a );</P>
<P>Index created.</P>
<P>SQL&gt; alter table test add constraint c1_pk primary key(a) using index;</P>
<P>Table altered.</P>
<P>SQL&gt; select index_name from user_indexes where table_name='TEST';</P>
<P>INDEX_NAME<BR>------------------------------<BR>IND</P>
<P>SQL&gt; alter table test drop constraint c1_pk;</P>
<P>Table altered.</P>
<P>SQL&gt; select index_name from user_indexes where table_name='TEST';</P>
<P>INDEX_NAME<BR>------------------------------<BR>IND</P>
<P><STRONG></STRONG></P>
<H3>References</H3>
<P><A href="https://metalink.oracle.com/metalink/plsql/showdoc?db=NOT&amp;id=292096.1&amp;blackframe=1" target=_blank>Note 292096.1</A> - Encountering ora-00955 when trying to create primary key on an imported table in 10g<BR></P>
<P><B>Keywords</B> </P>
<P><FONT size=-1>'<A href="http://metalink.oracle.com/metalink/plsql/ml2_gui.handleSearchRequest?p_search=Submit&amp;p_text='KEYWORD:USING~INDEX'" target=_blank>USING~INDEX</A>' &nbsp; </FONT></P><img src ="http://www.cnblogs.com/zyk/aggbug/783435.html?type=1" width = "1" height = "1" /><br><br><a href="http://news.cnblogs.com/n/43603/" target="_blank">[新闻]《时代》：杨致远被Google玩弄于股掌之间？</a><br/><a href="http://www.cnblogs.com" target="_blank">博客园首页</a>&nbsp;<a href="http://space.cnblogs.com" target="_blank">社区</a>&nbsp;<a href="http://news.cnblogs.com" target="_blank">新闻频道</a>&nbsp;<a href="http://space.cnblogs.com/group.htm" target="_blank">小组</a>&nbsp;<a href="http://space.cnblogs.com/q" target="_blank">博问</a>&nbsp;<a href="http://wz.cnblogs.com/" target="_blank">网摘</a>&nbsp;<a href="http://space.cnblogs.com/ing" target="_blank">闪存</a>]]></description></item><item><title>如何取出某一用户的密码，再原封不动的改回去？  </title><link>http://www.cnblogs.com/zyk/archive/2007/06/14/783306.html</link><dc:creator>知道得越多知道的越少</dc:creator><author>知道得越多知道的越少</author><pubDate>Thu, 14 Jun 2007 03:52:00 GMT</pubDate><guid>http://www.cnblogs.com/zyk/archive/2007/06/14/783306.html</guid><wfw:comment>http://www.cnblogs.com/zyk/comments/783306.html</wfw:comment><comments>http://www.cnblogs.com/zyk/archive/2007/06/14/783306.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.cnblogs.com/zyk/comments/commentRss/783306.html</wfw:commentRss><trackback:ping>http://www.cnblogs.com/zyk/services/trackbacks/783306.html</trackback:ping><description><![CDATA[<P>下面这种方法在Oracle的SQL Reference文档中没有提到,关键字values是一个未公开的特性.</P>
<P>实现方法： <BR>SQL&gt; conn sys/oracle<BR>SQL&gt; select password from dba_users where username='USER1';(用户名大写)<BR>记录该用户在数据库存储的密码:035DFA98F036A771</P>
<P>SQL&gt; alter user USER1 identified by aaa;<BR>SQL&gt; conn user1/aaa<BR>SQL&gt; 执行你想要的操作...</P>
<P>SQL&gt; conn sys/oracle<BR>SQL&gt; alter user USER1 identified by values '035DFA98F036A771';</P>
<P>通过这种方式,管理员可以用某个用户的名字进行数据库操作.</P><img src ="http://www.cnblogs.com/zyk/aggbug/783306.html?type=1" width = "1" height = "1" /><br><br><a href="http://news.cnblogs.com/n/43603/" target="_blank">[新闻]《时代》：杨致远被Google玩弄于股掌之间？</a><br/><a href="http://www.cnblogs.com" target="_blank">博客园首页</a>&nbsp;<a href="http://space.cnblogs.com" target="_blank">社区</a>&nbsp;<a href="http://news.cnblogs.com" target="_blank">新闻频道</a>&nbsp;<a href="http://space.cnblogs.com/group.htm" target="_blank">小组</a>&nbsp;<a href="http://space.cnblogs.com/q" target="_blank">博问</a>&nbsp;<a href="http://wz.cnblogs.com/" target="_blank">网摘</a>&nbsp;<a href="http://space.cnblogs.com/ing" target="_blank">闪存</a>]]></description></item><item><title>几点对专用服务器与共享服务器差异的理解</title><link>http://www.cnblogs.com/zyk/archive/2007/06/05/771570.html</link><dc:creator>知道得越多知道的越少</dc:creator><author>知道得越多知道的越少</author><pubDate>Tue, 05 Jun 2007 01:24:00 GMT</pubDate><guid>http://www.cnblogs.com/zyk/archive/2007/06/05/771570.html</guid><wfw:comment>http://www.cnblogs.com/zyk/comments/771570.html</wfw:comment><comments>http://www.cnblogs.com/zyk/archive/2007/06/05/771570.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.cnblogs.com/zyk/comments/commentRss/771570.html</wfw:commentRss><trackback:ping>http://www.cnblogs.com/zyk/services/trackbacks/771570.html</trackback:ping><description><![CDATA[<DIV class=commentsbody>
<P>专用服务器</P>
<P>一个客户端连接对应一个服务器进程</P>
<P>共享服务器</P>
<P>多个客户端连接对应一个服务器进程，服务器端存在一个进程调度器来管理。</P>
<P>Oracle缺省用的是专用服务器模式，Oracle可以同时支持共享服务器和专用服务器模式，可以指定一个会话使用专用服务器，另一个会话使用共享服务器。</P>
<P>MTS具有以下一些缺点：</P>
<P>1) 共享服务器的代码路径比专用服务器长，所以它天生就比专用服务器慢。</P>
<P>2) 存在人为死锁的可能，因为它是串行的，只要一个连接阻塞，则该服务器进程上的所有用户都被阻塞，并且极可能死锁。</P>
<P>3) 存在独占事务的可能，因为如果一个会话的事务运行时间过长，它独占共享资源，其它用户只能等待，而专用服务器，每个客户端是一个会话。</P>
<P>4) 共享服务器模式限制了某些数据库特性，例如：不能单独启动和关闭实例，不能进行介质恢复，不能使用Log Miner，并且SQL_TRACE没有意义(因为是共享而不是当前会话的)。</P>
<P>MTS减少的内存实际上是专用服务器模式下每个用户连接到操作系统进程所需的内存，但它却使用SGA的Large_Pool来分配UGA，拆东墙补西墙，所减少的内存是很少的。</P>
<P>如果用户会话的连接和断开很频繁，数据库进程的创建和删除的开销会非常大，这种情况最好采用共享服务器模式(否则，应该使用连接池技术)。</P>
<P>如果客户端一次连接终身使用(会话生命周期内)，使用共享服务器模式的意义不大。因为大部分时间，一个会话就连接到一个服务器进程，无法共享服务器进程。</P></DIV><img src ="http://www.cnblogs.com/zyk/aggbug/771570.html?type=1" width = "1" height = "1" /><br><br><a href="http://news.cnblogs.com/n/43602/" target="_blank">[新闻]Mozilla即将结束对FireFox 2的支持</a><br/><a href="http://www.cnblogs.com" target="_blank">博客园首页</a>&nbsp;<a href="http://space.cnblogs.com" target="_blank">社区</a>&nbsp;<a href="http://news.cnblogs.com" target="_blank">新闻频道</a>&nbsp;<a href="http://space.cnblogs.com/group.htm" target="_blank">小组</a>&nbsp;<a href="http://space.cnblogs.com/q" target="_blank">博问</a>&nbsp;<a href="http://wz.cnblogs.com/" target="_blank">网摘</a>&nbsp;<a href="http://space.cnblogs.com/ing" target="_blank">闪存</a>]]></description></item><item><title>不同版本上Oracle的Sys用户授权能力</title><link>http://www.cnblogs.com/zyk/archive/2007/03/30/694315.html</link><dc:creator>知道得越多知道的越少</dc:creator><author>知道得越多知道的越少</author><pubDate>Fri, 30 Mar 2007 09:52:00 GMT</pubDate><guid>http://www.cnblogs.com/zyk/archive/2007/03/30/694315.html</guid><wfw:comment>http://www.cnblogs.com/zyk/comments/694315.html</wfw:comment><comments>http://www.cnblogs.com/zyk/archive/2007/03/30/694315.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.cnblogs.com/zyk/comments/commentRss/694315.html</wfw:commentRss><trackback:ping>http://www.cnblogs.com/zyk/services/trackbacks/694315.html</trackback:ping><description><![CDATA[<P>今天一同事发现在8i下,用sys用户登录,不能将用户A的对象权限直接授予用户B,如下语句会报没有限限的错:<BR>Grant Select On UserA.Table1 to UserB</P>
<P>后来,找了一个9i的数据库测试,发现没有报错.<BR>于是去查文档:Oracle Administrator's Guide,发现这项功能确实是9i以上的版本才增加的.<BR>通过查询权限视图,可以看到这种方式授权后,授权人仍然是UserA,相关于Sys转授.</P>
<P>8i的该文档上记录了需要先用UserA将Grant Option的权限给Sys后才能由Sys转授.<BR>先用UserA连接<BR>Grant Select On Table1 to Sys With Grant Option;<BR>然后,再用Sys连接<BR>Grant Select On UserA.Table1 to UserB;</P><img src ="http://www.cnblogs.com/zyk/aggbug/694315.html?type=1" width = "1" height = "1" /><br><br><a href="http://news.cnblogs.com/n/43601/" target="_blank">[新闻]IBM"走鹃"险胜"Cray Jaguar" 连任世界最快超级计算机</a><br/><a href="http://www.cnblogs.com" target="_blank">博客园首页</a>&nbsp;<a href="http://space.cnblogs.com" target="_blank">社区</a>&nbsp;<a href="http://news.cnblogs.com" target="_blank">新闻频道</a>&nbsp;<a href="http://space.cnblogs.com/group.htm" target="_blank">小组</a>&nbsp;<a href="http://space.cnblogs.com/q" target="_blank">博问</a>&nbsp;<a href="http://wz.cnblogs.com/" target="_blank">网摘</a>&nbsp;<a href="http://space.cnblogs.com/ing" target="_blank">闪存</a>]]></description></item><item><title>Oracle 10G重建EM DB Control.</title><link>http://www.cnblogs.com/zyk/archive/2007/02/05/640390.html</link><dc:creator>知道得越多知道的越少</dc:creator><author>知道得越多知道的越少</author><pubDate>Mon, 05 Feb 2007 03:05:00 GMT</pubDate><guid>http://www.cnblogs.com/zyk/archive/2007/02/05/640390.html</guid><wfw:comment>http://www.cnblogs.com/zyk/comments/640390.html</wfw:comment><comments>http://www.cnblogs.com/zyk/archive/2007/02/05/640390.html#Feedback</comments><slash:comments>2</slash:comments><wfw:commentRss>http://www.cnblogs.com/zyk/comments/commentRss/640390.html</wfw:commentRss><trackback:ping>http://www.cnblogs.com/zyk/services/trackbacks/640390.html</trackback:ping><description><![CDATA[<P>Oracle 10G R2重建EM DB Control.如果安装后没有修改过IP地址或机器名字,可以跳过下面1和2两步。<BR>1.drop configuration files and repository run :<BR>emca -deconfig dbcontrol db -repos drop </P>
<P>2. Logon SQLPLUS as user SYS or SYSTEM, and drop the sysman account and mangement objects:<BR>a. drop user sysman cascade;<BR>b. drop role MGMT_USER;<BR>c. drop user MGMT_VIEW cascade;<BR>d. drop public synonym MGMT_TARGET_BLACKOUTS;<BR>e. drop public synonym SETEMVIEWUSERCONTEXT;</P>
<P>3.Create configuration files and repository run <BR>emca -config dbcontrol db -repos create</P>
<P>创建EM时,提示的端口号,应为实例的断口号,比如1521,不是EM的端口号(比如1158)<BR>EM的端口号在这个文件中可以查到10.2.0\db_1\sysman\config\emca.properties<BR><BR>如果是在Vista操作系统上，则需要用管理员帐号或者关闭UAC功能，否则创建时会报错。<BR><BR>然后,进行em后,界面出来了,但报了一个错:<BR>java.lang.Exception: Exception in sending Request :: null<BR>很多功能不能用,提示重新登录.<BR>在Oracle论坛上查到了解决办法:<BR><A href="http://forums.oracle.com/forums/thread.jspa?threadID=320574&amp;tstart=0&amp;messageID=1374397">http://forums.oracle.com/forums/thread.jspa?threadID=320574&amp;tstart=0&amp;messageID=1374397</A><BR>找到下面的文件<BR>10.2.0\db_1\ZYKNET_ORC2\sysman\config\emd.properties<BR>其中的agentTZRegion缺省是GMT,改为你所在的时区即可,例如:<BR>agentTZRegion=Asia/Chungking<BR>关于时区的列表参考：10.2.0\db_1\sysman\admin\supportedtzs.lst<BR>然后，重启OracleDBConsole&lt;SID&gt;<BR></P><img src ="http://www.cnblogs.com/zyk/aggbug/640390.html?type=1" width = "1" height = "1" /><br><br><a href="http://news.cnblogs.com/n/43600/" target="_blank">[新闻]微软正式发布Exchange/SharePoint Online</a><br/><a href="http://www.cnblogs.com" target="_blank">博客园首页</a>&nbsp;<a href="http://space.cnblogs.com" target="_blank">社区</a>&nbsp;<a href="http://news.cnblogs.com" target="_blank">新闻频道</a>&nbsp;<a href="http://space.cnblogs.com/group.htm" target="_blank">小组</a>&nbsp;<a href="http://space.cnblogs.com/q" target="_blank">博问</a>&nbsp;<a href="http://wz.cnblogs.com/" target="_blank">网摘</a>&nbsp;<a href="http://space.cnblogs.com/ing" target="_blank">闪存</a>]]></description></item><item><title>对条件子句中带IN的SQL语句使用绑定变量</title><link>http://www.cnblogs.com/zyk/archive/2007/01/26/631522.html</link><dc:creator>知道得越多知道的越少</dc:creator><author>知道得越多知道的越少</author><pubDate>Fri, 26 Jan 2007 11:49:00 GMT</pubDate><guid>http://www.cnblogs.com/zyk/archive/2007/01/26/631522.html</guid><wfw:comment>http://www.cnblogs.com/zyk/comments/631522.html</wfw:comment><comments>http://www.cnblogs.com/zyk/archive/2007/01/26/631522.html#Feedback</comments><slash:comments>3</slash:comments><wfw:commentRss>http://www.cnblogs.com/zyk/comments/commentRss/631522.html</wfw:commentRss><trackback:ping>http://www.cnblogs.com/zyk/services/trackbacks/631522.html</trackback:ping><description><![CDATA[<P>使用绑定变量带来的好处不用多说，但是遇到SQL条件中条件值不固定的这类SQL在普通方式下就不能使用绑定变量，看到Tom网站上提供了一种可行的办法。<BR><BR>网上有不少的地方也提到了这种方法，那就是，先定义一个表类型，将个数不定的参数转换成这种表类型，再将查询结果传给IN子句，这样就可以实现了SQL语句中的绑定变量方式。<BR>例如：<BR>Select * From 病人费用记录 Where NO IN(Select * From Table(Cast(zlTools.f_Str2List ('A01,A02,A03') as zlTools. t_StrList)));<BR>Select * From 病人费用记录 Where NO IN(Select * From The(Select Cast(zlTools.f_Str2List ('A01,A02,A03') as zlTools. t_StrList) From Dual));<BR>Select A.* From 病人费用记录 A,Table(Cast(zlTools.f_Str2List ('A01,A02,A03') as zlTools. t_StrList)) B Where A.NO=B.Column_Value;</P>
<P>Oracle提供了一个包dbms_utility.comma_to_table可以将参数列表转换为一个类型表，但是由于结果是通过参数传出的,无法用于应用程序的SQL语句中。</P>
<P>于是,我们仍然选择通过创建SQL表类型和相关函数来实现,Type：t_StrList, t_NumList， 函数：f_Str2List, f_Num2List，如下:</P>
<P>Create Or Replace type zltools.t_StrList as table of varchar2(4000)<BR>/<BR>Create Or Replace Function zltools.f_Str2List(Str_In In Varchar2) Return zltools.t_StrList As<BR>&nbsp;v_Str&nbsp;&nbsp; Long Default Str_In || ',';<BR>&nbsp;v_Index Number;<BR>&nbsp;v_List&nbsp; zltools.t_StrList := zltools.t_StrList();<BR>--功能：将由逗号分隔的不带引号的字符序列转换为数据表<BR>--参数：Str_In如:G0000123,G0000124,G0000125...<BR>Begin<BR>&nbsp;Loop<BR>&nbsp;&nbsp;v_Index := Instr(v_Str, ',');<BR>&nbsp;&nbsp;Exit When(Nvl(v_Index, 0) = 0);<BR>&nbsp;&nbsp;v_List.Extend;<BR>&nbsp;&nbsp;v_List(v_List.Count) := Trim(Substr(v_Str, 1, v_Index - 1));<BR>&nbsp;&nbsp;v_Str := Substr(v_Str, v_Index + 1);<BR>&nbsp;End Loop;<BR>&nbsp;Return v_List;<BR>End;<BR>/<BR>Create Or Replace type zltools.t_NumList as table of number<BR>/<BR>Create Or Replace Function zltools.f_Num2List(Str_In In Varchar2) Return zltools.t_NumList As<BR>&nbsp;v_Str&nbsp;&nbsp; Long Default Str_In || ',';<BR>&nbsp;v_Index Number;<BR>&nbsp;v_List&nbsp; zltools.t_NumList := zltools.t_NumList();<BR>--功能：将由逗号分隔的数字序列转换为数据表<BR>--参数：Str_In如:73265,73266,73267....<BR>Begin<BR>&nbsp;Loop<BR>&nbsp;&nbsp;v_Index := Instr(v_Str, ',');<BR>&nbsp;&nbsp;Exit When(Nvl(v_Index, 0) = 0);<BR>&nbsp;&nbsp;v_List.Extend;<BR>&nbsp;&nbsp;v_List(v_List.Count) := To_Number(Trim(Substr(v_Str, 1, v_Index - 1)));<BR>&nbsp;&nbsp;v_Str := Substr(v_Str, v_Index + 1);<BR>&nbsp;End Loop;<BR>&nbsp;Return v_List;<BR>End;<BR>/</P>
<P>&nbsp;<BR>但是这种方法有一个问题：<BR>如果用户使用CBO,使用这种方式的SQL语句，不加处理的话一般(要根据具体SQL分析)会错误的使用Hash连接来产生执行计划，不能正确使用索引从而引发性能问题，<BR>因为Type Table不具备统计信息，在计算成本时，Oracle始终认为它有8168行，在基于成本的优化器模式下，多表连接时一般就会选择Hash连接，一般比使用索引的嵌套连接效率差。</P>
<P>目前，已知的解决办法有两种：<BR><A href="http://www.cnoug.org/viewthread.php?tid=1533&amp;highlight=DROP%2B%2BCONSTRAINT%2Bindex">http://www.cnoug.org/viewthread.php?tid=1533&amp;highlight=DROP%2B%2BCONSTRAINT%2Bindex</A><BR>1.&nbsp;对构造表的返回记录集加RowNum条件，通过子查询的实体化视图来改变执行计划，例如：<BR>select * from table(Cast(zlTools.f_Str2List (v_str) as zlTools.t_StrList)) where rownum&lt;5<BR>2.&nbsp;在SQL中加入优化器提示，例如：/*+ rule*/，或者/*+ ordered use_nl(t)*/，或者/*+ index(t ind_object_id)*/</P>
<P>第1种方式，需要对rownum的条件赋值，如果条件值采用动态的值，那么就达不到使用绑定变量的效果，如果采用固定值，有两种方案：<BR>一种是使用一个固定的极限值，例如：99999，另一种是使用绑定变量。<BR>试验结果见文末，这两种方式产生的执行计划采用了Hash连接，执行计划比不使用RowNum实体化视图更差。<BR>&nbsp;<BR>第2种方式，如果使用指定嵌套连接提示或指定索引提示则需要对每个SQL针对性处理，需要分析具体的SQL。所以，一般情况建议在SQL中使用/*+ rule*/提示来固定执行计划。</P>
<P><BR>--0.准备<BR>--先创建表类型及转换函数: t_StrList,f_Str2List和t_NumList,f_Num2List<BR>SQL&gt; alter session set optimizer_mode=all_rows;<BR>Session altered<BR>SQL&gt; var v_str varchar2(4000);<BR>SQL&gt; exec :v_str :='H0000005,H0000006,H0000007';</P>
<P>PL/SQL 过程已成功完成。</P>
<P><BR>--1.当类型表不使用Rownum实体化视图时，错误地采用了Hash连接的执行计划，产生了6575块逻辑读+6909块物理读<BR>SQL&gt; Select a.No, a.结算方式, Nvl(b.性质, 1) As 性质, a.金额, a.摘要, a.结算号码<BR>&nbsp; 2&nbsp; From (Select b.No, Decode(a.记录性质, 3, a.结算方式, Null) As 结算方式, a.摘要, a.结算号码, Sum<BR>(1 * a.冲预交) As 金额<BR>&nbsp; 3&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; From 病人预交记录 a,<BR>&nbsp; 4&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; (Select Distinct No, 结帐id<BR>&nbsp; 5&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; From 病人费用记录<BR>&nbsp; 6&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Where 记录性质 = 1 And No In (<BR>&nbsp; 7&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Select * From Table(Cast(f_Str2List(:v_str) as t_StrList)) <BR>&nbsp; 8&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ) And 记录状态 In (1, 3)) b<BR>&nbsp; 9&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Where a.结帐id = b.结帐id And a.记录性质 In (1, 11, 3) And Nvl(a.冲预交, 0) &lt;&gt; 0<BR>&nbsp;10&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Group By b.No, Decode(a.记录性质, 3, a.结算方式, Null), a.摘要, a.结算号码) a, 结算方式 b<BR>&nbsp;11&nbsp; Where a.结算方式 = b.名称(+);</P>
<P><BR>执行计划<BR>----------------------------------------------------------<BR>&nbsp;&nbsp; 0&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; SELECT STATEMENT Optimizer=ALL_ROWS (Cost=23 Card=1 Bytes=100)<BR>&nbsp;&nbsp; 1&nbsp;&nbsp;&nbsp; 0&nbsp;&nbsp; NESTED LOOPS (OUTER) (Cost=23 Card=1 Bytes=100)<BR>&nbsp;&nbsp; 2&nbsp;&nbsp;&nbsp; 1&nbsp;&nbsp;&nbsp;&nbsp; VIEW (Cost=22 Card=1 Bytes=75)<BR>&nbsp;&nbsp; 3&nbsp;&nbsp;&nbsp; 2&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; SORT (GROUP BY) (Cost=22 Card=1 Bytes=94)<BR>&nbsp;&nbsp; 4&nbsp;&nbsp;&nbsp; 3&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; VIEW (Cost=21 Card=1 Bytes=94)<BR>&nbsp;&nbsp; 5&nbsp;&nbsp;&nbsp; 4&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; SORT (UNIQUE) (Cost=21 Card=1 Bytes=149)<BR>&nbsp;&nbsp; 6&nbsp;&nbsp;&nbsp; 5&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; TABLE ACCESS (BY INDEX ROWID) OF '病人预交记录' (Cost=1 Card=1 Bytes=102)<BR>&nbsp;&nbsp; 7&nbsp;&nbsp;&nbsp; 6&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; NESTED LOOPS (Cost=19 Card=1 Bytes=149)<BR>&nbsp;&nbsp; 8&nbsp;&nbsp;&nbsp; 7&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; HASH JOIN (SEMI) (Cost=17 Card=4 Bytes=188)<BR>&nbsp;&nbsp; 9&nbsp;&nbsp;&nbsp; 8&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; INDEX (FAST FULL SCAN) OF '病人费用记录_UQ_NO' (UNIQUE) (Cost=4 Card=399 Bytes=17955)<BR>&nbsp; 10&nbsp;&nbsp;&nbsp; 8&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; COLLECTION ITERATOR (PICKLER FETCH) OF 'f_Str2List'<BR>&nbsp; 11&nbsp;&nbsp;&nbsp; 7&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; INDEX (RANGE SCAN) OF '病人预交记录_IX_结帐ID' (NON-UNIQUE)<BR>&nbsp; 12&nbsp;&nbsp;&nbsp; 1&nbsp;&nbsp;&nbsp;&nbsp; TABLE ACCESS (BY INDEX ROWID) OF '结算方式' (Cost=1 Card=1 Bytes=25)<BR>&nbsp; 13&nbsp;&nbsp; 12&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; INDEX (UNIQUE SCAN) OF '结算方式_UQ_名称' (UNIQUE)</P>
<P>统计信息<BR>----------------------------------------------------------<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 0&nbsp; recursive calls<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 0&nbsp; db block gets<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 6575&nbsp; consistent gets<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 6909&nbsp; physical reads<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 0&nbsp; redo size<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 720&nbsp; bytes sent via SQL*Net to client<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 372&nbsp; bytes received via SQL*Net from client<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 2&nbsp; SQL*Net roundtrips to/from client<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 2&nbsp; sorts (memory)<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 0&nbsp; sorts (disk)<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 3&nbsp; rows processed</P>
<P>--2.当类型表的查询条件中Rownum使用固定值时,正确地采用了嵌套连接的执行计划，仅仅产生了29块逻辑读<BR>SQL&gt; Select a.No, a.结算方式, Nvl(b.性质, 1) As 性质, a.金额, a.摘要, a.结算号码<BR>&nbsp; 2&nbsp; From (Select b.No, Decode(a.记录性质, 3, a.结算方式, Null) As 结算方式, a.摘要, a.结算号码, Sum<BR>(1 * a.冲预交) As 金额<BR>&nbsp; 3&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; From 病人预交记录 a,<BR>&nbsp; 4&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; (Select Distinct No, 结帐id<BR>&nbsp; 5&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; From 病人费用记录<BR>&nbsp; 6&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Where 记录性质 = 1 And No In (<BR>&nbsp; 7&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Select * From Table(Cast(f_Str2List(:v_str) as t_StrList)) Where Rownum&lt;4<BR>&nbsp; 8&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ) And 记录状态 In (1, 3)) b<BR>&nbsp; 9&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Where a.结帐id = b.结帐id And a.记录性质 In (1, 11, 3) And Nvl(a.冲预交, 0) &lt;&gt; 0<BR>&nbsp;10&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Group By b.No, Decode(a.记录性质, 3, a.结算方式, Null), a.摘要, a.结算号码) a, 结算方式 b<BR>&nbsp;11&nbsp; Where a.结算方式 = b.名称(+);</P>
<P><BR>执行计划<BR>----------------------------------------------------------<BR>&nbsp;&nbsp; 0&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; SELECT STATEMENT Optimizer=ALL_ROWS (Cost=23 Card=4 Bytes=400)<BR>&nbsp;&nbsp; 1&nbsp;&nbsp;&nbsp; 0&nbsp;&nbsp; NESTED LOOPS (OUTER) (Cost=23 Card=4 Bytes=400)<BR>&nbsp;&nbsp; 2&nbsp;&nbsp;&nbsp; 1&nbsp;&nbsp;&nbsp;&nbsp; VIEW (Cost=21 Card=4 Bytes=300)<BR>&nbsp;&nbsp; 3&nbsp;&nbsp;&nbsp; 2&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; SORT (GROUP BY) (Cost=21 Card=4 Bytes=376)<BR>&nbsp;&nbsp; 4&nbsp;&nbsp;&nbsp; 3&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; VIEW (Cost=20 Card=4 Bytes=376)<BR>&nbsp;&nbsp; 5&nbsp;&nbsp;&nbsp; 4&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; SORT (UNIQUE) (Cost=20 Card=4 Bytes=8596)<BR>&nbsp;&nbsp; 6&nbsp;&nbsp;&nbsp; 5&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; TABLE ACCESS (BY INDEX ROWID) OF '病人预交记录' (Cost=1 Card=1 Bytes=102)<BR>&nbsp;&nbsp; 7&nbsp;&nbsp;&nbsp; 6&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; NESTED LOOPS (Cost=17 Card=4 Bytes=8596)<BR>&nbsp;&nbsp; 8&nbsp;&nbsp;&nbsp; 7&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; NESTED LOOPS (Cost=13 Card=12 Bytes=24564)<BR>&nbsp;&nbsp; 9&nbsp;&nbsp;&nbsp; 8&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; VIEW OF 'VW_NSO_1' (Cost=11 Card=3 Bytes=6006)<BR>&nbsp; 10&nbsp;&nbsp;&nbsp; 9&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; COUNT (STOPKEY)<BR>&nbsp; 11&nbsp;&nbsp; 10&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; COLLECTION ITERATOR (PICKLER FETCH) OF 'f_Str2List'<BR>&nbsp; 12&nbsp;&nbsp;&nbsp; 8&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; INLIST ITERATOR<BR>&nbsp; 13&nbsp;&nbsp; 12&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; INDEX (RANGE SCAN) OF '病人费用记录_UQ_NO' (UNIQUE) (Cost=1 Card=4 Bytes=180)<BR>&nbsp; 14&nbsp;&nbsp;&nbsp; 7&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; INDEX (RANGE SCAN) OF '病人预交记录_IX_结帐ID' (NON-UNIQUE)<BR>&nbsp; 15&nbsp;&nbsp;&nbsp; 1&nbsp;&nbsp;&nbsp;&nbsp; TABLE ACCESS (BY INDEX ROWID) OF '结算方式' (Cost=1 Card=1 Bytes=25)<BR>&nbsp; 16&nbsp;&nbsp; 15&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; INDEX (UNIQUE SCAN) OF '结算方式_UQ_名称' (UNIQUE)</P>
<P>统计信息<BR>----------------------------------------------------------<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 0&nbsp; recursive calls<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 0&nbsp; db block gets<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 29&nbsp; consistent gets<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 0&nbsp; physical reads<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 0&nbsp; redo size<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 720&nbsp; bytes sent via SQL*Net to client<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 372&nbsp; bytes received via SQL*Net from client<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 2&nbsp; SQL*Net roundtrips to/from client<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 2&nbsp; sorts (memory)<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 0&nbsp; sorts (disk)<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 3&nbsp; rows processed</P>
<P>--3.当类型表的查询条件中Rownum使用变量时，执行计划虽然有变化，但是仍然认为类型表返回的记录集数为8168,<BR>--&nbsp; 错误地采用了Hash连接的执行计划，产生了374369块逻辑读和11192块物理读<BR>SQL&gt; var v_count number;<BR>SQL&gt;&nbsp; exec :v_count:=4;</P>
<P>PL/SQL 过程已成功完成。</P>
<P>SQL&gt; Select a.No, a.结算方式, Nvl(b.性质, 1) As 性质, a.金额, a.摘要, a.结算号码<BR>&nbsp; 2&nbsp; From (Select b.No, Decode(a.记录性质, 3, a.结算方式, Null) As 结算方式, a.摘要, a.结算号码, Sum<BR>(1 * a.冲预交) As 金额<BR>&nbsp; 3&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; From 病人预交记录 a,<BR>&nbsp; 4&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; (Select Distinct No, 结帐id<BR>&nbsp; 5&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; From 病人费用记录<BR>&nbsp; 6&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Where 记录性质 = 1 And No In (<BR>&nbsp; 7&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Select * From Table(Cast(f_Str2List(:v_str) as t_StrList)) Where Rownum&lt;:v_count<BR>&nbsp; 8&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ) And 记录状态 In (1, 3)) b<BR>&nbsp; 9&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Where a.结帐id = b.结帐id And a.记录性质 In (1, 11, 3) And Nvl(a.冲预交, 0) &lt;&gt; 0<BR>&nbsp;10&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Group By b.No, Decode(a.记录性质, 3, a.结算方式, Null), a.摘要, a.结算号码) a, 结算方式 b<BR>&nbsp;11&nbsp; Where a.结算方式 = b.名称(+);</P>
<P><BR>执行计划<BR>----------------------------------------------------------<BR>&nbsp;&nbsp; 0&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; SELECT STATEMENT Optimizer=ALL_ROWS (Cost=16306 Card=10945 Bytes=1094500)<BR>&nbsp;&nbsp; 1&nbsp;&nbsp;&nbsp; 0&nbsp;&nbsp; HASH JOIN (OUTER) (Cost=16306 Card=10945 Bytes=1094500)<BR>&nbsp;&nbsp; 2&nbsp;&nbsp;&nbsp; 1&nbsp;&nbsp;&nbsp;&nbsp; VIEW (Cost=16264 Card=10945 Bytes=820875)<BR>&nbsp;&nbsp; 3&nbsp;&nbsp;&nbsp; 2&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; SORT (GROUP BY) (Cost=16264 Card=10945 Bytes=1028830)<BR>&nbsp;&nbsp; 4&nbsp;&nbsp;&nbsp; 3&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; VIEW (Cost=16148 Card=10945 Bytes=1028830)<BR>&nbsp;&nbsp; 5&nbsp;&nbsp;&nbsp; 4&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; SORT (UNIQUE) (Cost=16148 Card=10945 Bytes=23520805)<BR>&nbsp;&nbsp; 6&nbsp;&nbsp;&nbsp; 5&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; HASH JOIN (Cost=238 Card=10945 Bytes=23520805)<BR>&nbsp;&nbsp; 7&nbsp;&nbsp;&nbsp; 6&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; TABLE ACCESS (BY INDEX ROWID) OF '病人预交记录' (Cost=1 Card=1 Bytes=102)<BR>&nbsp;&nbsp; 8&nbsp;&nbsp;&nbsp; 7&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; NESTED LOOPS (Cost=164 Card=134 Bytes=19698)<BR>&nbsp;&nbsp; 9&nbsp;&nbsp;&nbsp; 8&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; INDEX (FAST FULL SCAN) OF '病人费用记录_UQ_NO' (UNIQUE) (Cost=4 Card=399 Bytes=17955)<BR>&nbsp; 10&nbsp;&nbsp;&nbsp; 8&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; INDEX (RANGE SCAN) OF '病人预交记录_IX_结帐ID' (NON-UNIQUE)<BR>&nbsp; 11&nbsp;&nbsp;&nbsp; 6&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; VIEW OF 'VW_NSO_1' (Cost=11 Card=8168 Bytes=16352336)<BR>&nbsp; 12&nbsp;&nbsp; 11&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; COUNT (STOPKEY)<BR>&nbsp; 13&nbsp;&nbsp; 12&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; COLLECTION ITERATOR (PICKLER FETCH) OF 'f_Str2List'<BR>&nbsp; 14&nbsp;&nbsp;&nbsp; 1&nbsp;&nbsp;&nbsp;&nbsp; TABLE ACCESS (FULL) OF '结算方式' (Cost=2 Card=82 Bytes=2050)</P>
<P>统计信息<BR>----------------------------------------------------------<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 28&nbsp; recursive calls<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 0&nbsp; db block gets<BR>&nbsp;&nbsp;&nbsp;&nbsp; 374369&nbsp; consistent gets<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 11192&nbsp; physical reads<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 0&nbsp; redo size<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 720&nbsp; bytes sent via SQL*Net to client<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 372&nbsp; bytes received via SQL*Net from client<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 2&nbsp; SQL*Net roundtrips to/from client<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 2&nbsp; sorts (memory)<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 0&nbsp; sorts (disk)<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 3&nbsp; rows processed</P>
<P>--4.当类型表的查询条件中Rownum使用一个固定的极限值时(例如：99999)，情况与使用变量一样遭，错误地采用了Hash连接的执行计划，产生了374354块逻辑读和10756块物理读<BR>SQL&gt; Select a.No, a.结算方式, Nvl(b.性质, 1) As 性质, a.金额, a.摘要, a.结算号码<BR>&nbsp; 2&nbsp; From (Select b.No, Decode(a.记录性质, 3, a.结算方式, Null) As 结算方式, a.摘要, a.结算号码, Sum<BR>(1 * a.冲预交) As 金额<BR>&nbsp; 3&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; From 病人预交记录 a,<BR>&nbsp; 4&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; (Select Distinct No, 结帐id<BR>&nbsp; 5&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; From 病人费用记录<BR>&nbsp; 6&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Where 记录性质 = 1 And No In (<BR>&nbsp; 7&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Select * From Table(Cast(f_Str2List(:v_str) as t_StrList)) Where Rownum&lt;99999<BR>&nbsp; 8&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ) And 记录状态 In (1, 3)) b<BR>&nbsp; 9&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Where a.结帐id = b.结帐id And a.记录性质 In (1, 11, 3) And Nvl(a.冲预交, 0) &lt;&gt; 0<BR>&nbsp;10&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Group By b.No, Decode(a.记录性质, 3, a.结算方式, Null), a.摘要, a.结算号码) a, 结算方式 b<BR>&nbsp;11&nbsp; Where a.结算方式 = b.名称(+);</P>
<P><BR>执行计划<BR>----------------------------------------------------------<BR>&nbsp;&nbsp; 0&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; SELECT STATEMENT Optimizer=ALL_ROWS (Cost=16306 Card=10945 Bytes=1094500)<BR>&nbsp;&nbsp; 1&nbsp;&nbsp;&nbsp; 0&nbsp;&nbsp; HASH JOIN (OUTER) (Cost=16306 Card=10945 Bytes=1094500)<BR>&nbsp;&nbsp; 2&nbsp;&nbsp;&nbsp; 1&nbsp;&nbsp;&nbsp;&nbsp; VIEW (Cost=16264 Card=10945 Bytes=820875)<BR>&nbsp;&nbsp; 3&nbsp;&nbsp;&nbsp; 2&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; SORT (GROUP BY) (Cost=16264 Card=10945 Bytes=1028830)<BR>&nbsp;&nbsp; 4&nbsp;&nbsp;&nbsp; 3&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; VIEW (Cost=16148 Card=10945 Bytes=1028830)<BR>&nbsp;&nbsp; 5&nbsp;&nbsp;&nbsp; 4&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; SORT (UNIQUE) (Cost=16148 Card=10945 Bytes=23520805)<BR>&nbsp;&nbsp; 6&nbsp;&nbsp;&nbsp; 5&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; HASH JOIN (Cost=238 Card=10945 Bytes=23520805)<BR>&nbsp;&nbsp; 7&nbsp;&nbsp;&nbsp; 6&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; TABLE ACCESS (BY INDEX ROWID) OF '病人预交记录' (Cost=1 Card=1 Bytes=102)<BR>&nbsp;&nbsp; 8&nbsp;&nbsp;&nbsp; 7&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; NESTED LOOPS (Cost=164 Card=134 Bytes=19698)<BR>&nbsp;&nbsp; 9&nbsp;&nbsp;&nbsp; 8&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; INDEX (FAST FULL SCAN) OF '病人费用记录_UQ_NO' (UNIQUE) (Cost=4 Card=399 Bytes=17955)<BR>&nbsp; 10&nbsp;&nbsp;&nbsp; 8&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; INDEX (RANGE SCAN) OF '病人预交记录_IX_结帐ID' (NON-UNIQUE)<BR>&nbsp; 11&nbsp;&nbsp;&nbsp; 6&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; VIEW OF 'VW_NSO_1' (Cost=11 Card=8168 Bytes=16352336)<BR>&nbsp; 12&nbsp;&nbsp; 11&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; COUNT (STOPKEY)<BR>&nbsp; 13&nbsp;&nbsp; 12&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; COLLECTION ITERATOR (PICKLER FETCH) OF 'f_Str2List'<BR>&nbsp; 14&nbsp;&nbsp;&nbsp; 1&nbsp;&nbsp;&nbsp;&nbsp; TABLE ACCESS (FULL) OF '结算方式' (Cost=2 Card=82 Bytes=2050)</P>
<P><BR>统计信息<BR>----------------------------------------------------------<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 0&nbsp; recursive calls<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 0&nbsp; db block gets<BR>&nbsp;&nbsp;&nbsp;&nbsp; 374354&nbsp; consistent gets<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 10756&nbsp; physical reads<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 0&nbsp; redo size<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 720&nbsp; bytes sent via SQL*Net to client<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 372&nbsp; bytes received via SQL*Net from client<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 2&nbsp; SQL*Net roundtrips to/from client<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 2&nbsp; sorts (memory)<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 0&nbsp; sorts (disk)<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 3&nbsp; rows processed</P>
<P>&nbsp;</P>
<P>--5.强制使用基于规则的优化器模式<BR>SQL&gt; Select /*+ rule*/ a.No, a.结算方式, Nvl(b.性质, 1) As 性质, a.金额, a.摘要, a.结算号码<BR>&nbsp; 2&nbsp; From (Select b.No, Decode(a.记录性质, 3, a.结算方式, Null) As 结算方式, a.摘要, a.结算号码, Sum<BR>(1 * a.冲预交) As 金额<BR>&nbsp; 3&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; From 病人预交记录 a,<BR>&nbsp; 4&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; (Select Distinct No, 结帐id<BR>&nbsp; 5&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; From 病人费用记录<BR>&nbsp; 6&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Where 记录性质 = 1 And No In (<BR>&nbsp; 7&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Select * From Table(Cast(f_Str2List(:v_str) as t_StrList))<BR>&nbsp; 8&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ) And 记录状态 In (1, 3)) b<BR>&nbsp; 9&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Where a.结帐id = b.结帐id And a.记录性质 In (1, 11, 3) And Nvl(a.冲预交, 0) &lt;&gt; 0<BR>&nbsp;10&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Group By b.No, Decode(a.记录性质, 3, a.结算方式, Null), a.摘要, a.结算号码) a, 结算方式 b<BR>&nbsp;11&nbsp; Where a.结算方式 = b.名称(+);</P>
<P><BR>执行计划<BR>----------------------------------------------------------<BR>&nbsp;&nbsp; 0&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; SELECT STATEMENT Optimizer=HINT: RULE<BR>&nbsp;&nbsp; 1&nbsp;&nbsp;&nbsp; 0&nbsp;&nbsp; NESTED LOOPS (OUTER)<BR>&nbsp;&nbsp; 2&nbsp;&nbsp;&nbsp; 1&nbsp;&nbsp;&nbsp;&nbsp; VIEW<BR>&nbsp;&nbsp; 3&nbsp;&nbsp;&nbsp; 2&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; SORT (GROUP BY)<BR>&nbsp;&nbsp; 4&nbsp;&nbsp;&nbsp; 3&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; VIEW<BR>&nbsp;&nbsp; 5&nbsp;&nbsp;&nbsp; 4&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; SORT (UNIQUE)<BR>&nbsp;&nbsp; 6&nbsp;&nbsp;&nbsp; 5&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; TABLE ACCESS (BY INDEX ROWID) OF '病人预交记录'<BR>&nbsp;&nbsp; 7&nbsp;&nbsp;&nbsp; 6&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; NESTED LOOPS<BR>&nbsp;&nbsp; 8&nbsp;&nbsp;&nbsp; 7&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; NESTED LOOPS<BR>&nbsp;&nbsp; 9&nbsp;&nbsp;&nbsp; 8&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; COLLECTION ITERATOR (PICKLER FETCH) OF 'f_Str2List'<BR>&nbsp; 10&nbsp;&nbsp;&nbsp; 8&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; INDEX (RANGE SCAN) OF '病人费用记录_UQ_NO' (UNIQUE)<BR>&nbsp; 11&nbsp;&nbsp;&nbsp; 7&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; INDEX (RANGE SCAN) OF '病人预交记录_IX_结帐ID' (NON-UNIQUE)<BR>&nbsp; 12&nbsp;&nbsp;&nbsp; 1&nbsp;&nbsp;&nbsp;&nbsp; TABLE ACCESS (BY INDEX ROWID) OF '结算方式'<BR>&nbsp; 13&nbsp;&nbsp; 12&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; INDEX (UNIQUE SCAN) OF '结算方式_UQ_名称' (UNIQUE)</P>
<P><BR>统计信息<BR>----------------------------------------------------------<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 0&nbsp; recursive calls<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 0&nbsp; db block gets<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 25&nbsp; consistent gets<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 0&nbsp; physical reads<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 0&nbsp; redo size<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 720&nbsp; bytes sent via SQL*Net to client<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 372&nbsp; bytes received via SQL*Net from client<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 2&nbsp; SQL*Net roundtrips to/from client<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 2&nbsp; sorts (memory)<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 0&nbsp; sorts (disk)<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 3&nbsp; rows processed<BR></P><img src ="http://www.cnblogs.com/zyk/aggbug/631522.html?type=1" width = "1" height = "1" /><br><br><a href="http://news.cnblogs.com/n/43598/" target="_blank">[新闻]应用程序架构指导包2.0 Beta 2发布</a><br/><a href="http://www.cnblogs.com" target="_blank">博客园首页</a>&nbsp;<a href="http://space.cnblogs.com" target="_blank">社区</a>&nbsp;<a href="http://news.cnblogs.com" target="_blank">新闻频道</a>&nbsp;<a href="http://space.cnblogs.com/group.htm" target="_blank">小组</a>&nbsp;<a href="http://space.cnblogs.com/q" target="_blank">博问</a>&nbsp;<a href="http://wz.cnblogs.com/" target="_blank">网摘</a>&nbsp;<a href="http://space.cnblogs.com/ing" target="_blank">闪存</a>]]></description></item></channel></rss>