oracle 如何在 Ubuntu 9.x 上正确设置 ORACLE_HOME 变量?

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/2747462/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-10 02:33:07  来源:igfitidea点击:

How to correctly set the ORACLE_HOME variable on Ubuntu 9.x?

oracleoracle-xe

提问by coderintherye

I have the same problem as listed here: How to recover or change Oracle sysdba passwordalthough I did not lose the password, I entered it twice in the configure script originally, and then when I went to login (localhost:8080/apex, password not accepted.

我遇到了与这里列出的相同的问题:How to recovery or change Oracle sysdba password虽然我没有丢失密码,我原来在配置脚本中输入了两次,然后当我去登录时(localhost:8080/apex, password不接受。

I don't have anything in the database, I just want to install and use Oracle-XE. I have tried apt-get removing it twice and reinstalling, but if I try to run /etc/init.d/oracle-xeconfigure again and I get "Oracle Database 10g Express Edition is already configured" despite the second time removing any folders I could find for Oracle XE.

我在数据库里没有任何东西,我只想安装和使用Oracle-XE。我已经尝试 apt-get 删除它两次并重新安装,但是如果我/etc/init.d/oracle-xe再次尝试运行configure 并且我得到“Oracle Database 10g Express Edition 已经配置”,尽管第二次删除了我可以找到的任何用于 Oracle XE 的文件夹。

I tried running sqlplus "/ as sysdba" but all I get is:

我尝试运行 sqlplus "/ as sysdba" 但我得到的是:

Error 6 initializing SQL*Plus
Message file sp1<lang>.msb not found
SP2-0750: You may need to set ORACLE_HOME to your Oracle software directory

I tried setting the variable via export. (also tried set).

我尝试通过export. (也试过set)。

Tried: export ORACLE_HOME=/usr/lib/oracle/xe/app/oracle/product/10.2.0/server/bin/sqlplusand all the subdirectories of that. Same error every time.

尝试过:export ORACLE_HOME=/usr/lib/oracle/xe/app/oracle/product/10.2.0/server/bin/sqlplus以及它的所有子目录。每次都一样的错误。

What is the ORACLE_HOME supposed to be set to? The only reference I have seen either just say general or say the above up to the version number then "/db_1". I do no thave a db_1.

ORACLE_HOME 应该设置为什么?我看到的唯一参考要么只是说一般性,要么说上面的版本号然后是“/ db_1”。我没有 db_1。

Let me know if you need any clarification. I don't understand what I did wrong in this process.

如果您需要任何说明,请告诉我。我不明白我在这个过程中做错了什么。

回答by dpbradley

Usually the msb file not found problems are the result of an environment setting problem, but in your case I'm a little suspicious of the installation (I've never used the apt-get + configure method).

通常 msb 文件未找到问题是环境设置问题的结果,但在您的情况下,我对安装有点怀疑(我从未使用过 apt-get + configure 方法)。

To check the sanity of the installation:

要检查安装的完整性:

  • ORACLE_HOMEshould be set to a directory path one level above the bindirectory where sqlplusexecutable is found.
  • There should some .msbfiles under $ORACLE_HOME/sqlplus/mesg
  • There should be hundreds (not sure of the number with XE) of .msbfiles under $ORACLE_HOME(try find $ORACLE_HOME -name "*.msb" -printto show them)
  • Your PATH should include $ORACLE_HOME/bin.
  • All files under ORACLE_HOMEshould be owned by user:oracle group:dba.
  • ORACLE_HOME应该设置为比找到可执行文件的bin目录高一级的目录路径sqlplus
  • 下面应该有一些.msb文件$ORACLE_HOME/sqlplus/mesg
  • 下应该有数百个(不确定 XE 的数量).msb文件$ORACLE_HOME(尝试find $ORACLE_HOME -name "*.msb" -print显示它们)
  • 您的 PATH 应包括$ORACLE_HOME/bin.
  • 下的所有文件ORACLE_HOME都应归user:oracle group:dba.

回答by Jeffrey Kemp

I had the same issue. In my home folder I've got a script named sqlplus.sh that takes care of this for me, containing:

我遇到过同样的问题。在我的主文件夹中,我有一个名为 sqlplus.sh 的脚本,它为我处理这个问题,其中包含:

ORACLE_HOME=/usr/lib/oracle/xe/app/oracle/product/10.2.0/server
export ORACLE_HOME
ORACLE_SID=XE
export ORACLE_SID
NLS_LANG=`$ORACLE_HOME/bin/nls_lang.sh`
export NLS_LANG
PATH=$ORACLE_HOME/bin:$PATH
export PATH
sqlplus /nolog

回答by SveguS

Had the same problem,

遇到了同样的问题,

All i had to do whas set the oracle shell variable:

我所要做的就是设置 oracle shell 变量:

. /u01/app/oracle/product/11.2.0/xe/bin/oracle_env.sh

Sorterd!

排序!

回答by Kjell

You have to set LANG as well, look for files named 'sp1*.msb', and set for instance export LANG=us if you find a file name sp1us.msb. The error message could sure be better :)

您还必须设置 LANG,查找名为“sp1*.msb”的文件,如果找到文件名 sp1us.msb,则设置例如 export LANG=us。错误信息肯定会更好:)

回答by Abhi

Once I also got that same type of error.

一旦我也遇到了同样类型的错误。

I.E:

IE:

C:\oracle\product.2.0\db_2>SQLPLUS SYS AS SYSDBA
Error 6 initializing SQL*Plus
Message file sp1<lang>.msb not found
SP2-0750: You may need to set ORACLE_HOME to your Oracle software directory

This error is occurring as the home path is not correctly set. To rectify this, if you are using Windows, run the below query:

发生此错误是因为未正确设置主路径。要纠正此问题,如果您使用的是 Windows,请运行以下查询:

C:\oracle\product.2.0\db_2>SET ORACLE_HOME=C:\oracle\product.2.0\db_2
C:\oracle\product.2.0\db_2>SQLPLUS SYS AS SYSDBA

SQL*Plus: Release 10.2.0.3.0 - Production on Tue Apr 16 13:17:42 2013

Copyright (c) 1982, 2006, Oracle.  All Rights Reserved.

Or if you are using Linux, then replace setwith exportfor the above command like so:

或者,如果你使用的是Linux,然后替换setexport像这样上面的命令:

C:\oracle\product.2.0\db_2>EXPORT ORACLE_HOME='C:\oracle\product.2.0\db_2'
C:\oracle\product.2.0\db_2>SQLPLUS SYS AS SYSDBA

SQL*Plus: Release 10.2.0.3.0 - Production on Tue Apr 16 13:17:42 2013

Copyright (c) 1982, 2006, Oracle.  All Rights Reserved.

回答by karthikeyan

This is the right way to clear this error.

这是清除此错误的正确方法。

export ORACLE_HOME=/u01/app/oracle/product/10.2.0/db_1 sqlplus / as sysdba

导出 ORACLE_HOME=/u01/app/oracle/product/10.2.0/db_1 sqlplus / as sysdba

回答by ridi

After installing weblogic and forms server on a Linux machine we met some problems initializing sqlplusand tnsping. We altered the bash_profilein a way that the forms_home acts as the oracle home. It works fine, both commands (sqlplus and tnsping) are executable for user oracle

在 Linux 机器上安装 weblogic 和表单服务器后,我们遇到了一些初始化sqlplustnsping. 我们改变了bash_profileforms_home 作为oracle home 的方式。它工作正常,两个命令(sqlplus 和 tnsping)对于用户 oracle 都是可执行的

# .bash_profile

# Get the aliases and functions
if [ -f ~/.bashrc ]; then
    . ~/.bashrc
fi

# User specific environment and startup programs

PATH=$PATH:$HOME/bin

export JAVA_HOME=/mnt/software/java/jdk1.7.0_71
export ORACLE_HOME=/oracle/Middleware/Oracle_FRHome1
export PATH=$PATH:$JAVA_HOME/bin:$ORACLE_HOME/bin
export LD_LIBRARY_PATH=/oracle/Middleware/Oracle_FRHome1/lib
export FORMS_PATH=$FORMS_PATH:/oracle/Middleware/Oracle_FRHome1/forms:/oracle/Middleware/asinst_1/FormsComponent/forms:/appl/myapp:/home/oracle/myapp

回答by DCookie

ORACLE_HOME needs to be at the top level of the Oracle directory structure for the database installation. From that point, Oracle knows how to find all the other files it needs. For example, the error message you get is because Oracle can't locate the message files to report errors with (should be in the various mesg directories below the oracle home. Instead of the above value you give, I would try

ORACLE_HOME 需要位于数据库安装的 Oracle 目录结构的顶层。从那时起,Oracle 知道如何找到它需要的所有其他文件。例如,你得到的错误信息是因为oracle找不到要报告错误的消息文件(应该在oracle home下面的各种mesg目录中。而不是你给出的上面的值,我会尝试

export ORACLE_HOME=/usr/lib/oracle/xe/app/oracle/product/10.2.0

回答by kkpadhy

set <ORACLE_HOME> path variable

example

例子

path ORACLE_HOME

value is C:\oraclexe\app\oracle\product\10.2.0\server

值为 C:\oraclex\app\oracle\product\10.2.0\server

enter image description here

在此处输入图片说明