对不起,没说明白。我的意思是说,能不能不通过执行sql文件,而只是读取oracle的配置文件的方式实现。

解决方案 »

  1.   

    执行下面的语句,即可得到所连接数据库的版本号
    Select version FROM Product_component_version 
    Where SUBSTR(PRODUCT,1,6)='Oracle';
      

  2.   

    init.ora 中的确compatible
    compatible :移植与兼容 允许使用一个新的发行版,同时保证与先前版本的向后兼容性。 默认为当前发行版。 由发行版确定
    但它的值是: compatible = 8.1.0
      

  3.   

    dbstart所做的部分是指出你有哪个Oracle版本。它通过检查某些执行文件如sqldba和svrmgrl的存在与否;并用执行文件并使用awk从文件的输出寻找版本号。dbstart脚本不工作的原因是因为下列行:
    #       Figure out if this is a V5, V6, or V7 database. Do we really need V5?
                if [ -f $ORACLE_HOME/bin/sqldba ] ; then
                    VERSION=`$ORACLE_HOME/bin/sqldba command=exit | awk '
                            /SQL\*DBA: (Release|Version)/ {split($3, V, ".") ;
                            print V[1]}'`
                else
                    if test -f $ORACLE_HOME/bin/svrmgrl; then
                        VERSION=`$ORACLE_HOME/bin/svrmgrl command=exit | awk '
                            /PL\/SQL (Release|Version)/ {substr($3,1,3) ;
                            print substr($3,1,3)}'`
                    else
                            VERSION="8.2"
                    fi
                fi
        
    (看上去Oracle 8.2好像不再有svrmgrl了)。在执行svrmgrl时,它寻找"PL/SQL Release" 或 "PL/SQL Version"这样的词句并在这些字后得出版本号。问题是,这两个词都不是svrmgrl'的输出部分,如下所示: Oracle Server Manager Release 3.1.6.0.0 - Production Copyright (c) 1997, 1999, Oracle Corporation.  All Rights Reserved. Oracle8i Enterprise Edition Release 8.1.6.1.0 - Production
    With the Partitioning option
    JServer Release 8.1.6.0.0 - Production SVRMGR>                 所以很容易修正它。如果要做的是搜索"Edition Release",所以可将前面的脚本部分改成如下的样子:
    #     Figure out if this is a V5, V6, or V7 database. Do we really need V5?
                if [ -f $ORACLE_HOME/bin/sqldba ] ; then
                    VERSION=`$ORACLE_HOME/bin/sqldba command=exit | awk '
                            /SQL\*DBA: (Release|Version)/ {split($3, V, ".") ;
                            print V[1]}'`
                else
                    if test -f $ORACLE_HOME/bin/svrmgrl; then
                        VERSION=`$ORACLE_HOME/bin/svrmgrl command=exit | awk '
                            /Edition Release/ {substr($5,1,3) ;
                            print substr($5,1,3)}'`
                    else
                            VERSION="8.2"
                    fi
                fi