SP2-0750: You may need to set ORACLE_HOME to your Oracle software directory

今天登錄一臺服務器用roote用戶登錄的,在切換到oracle用戶,執行sqlplus sys/ as sysdba進入數據庫提示如下錯誤:

SP2-0750: You may need to set ORACLE_HOME to your Oracle software directory


在/home/oracle目錄下查看文件.bash_profile,它是隱藏文件。

$ cat .bash_profile 
# .bash_profile
# Get the aliases and functions
if [ -f ~/.bashrc ]; then
        . ~/.bashrc
fi
# User specific environment and startup programs
PATH=$PATH:$HOME/bin
export PATH
export ORACLE_BASE=/u01/app/oracle 
export ORACLE_HOME=/u01/app/oracle/product/11.1.0/db_1 
export ORACLE_SID=orcl
export PATH=$ORACLE_HOME/bin:$PATH 
export LD_LIBRARY_PATH=$ORACLE_HOME/lib
LANG=zh_CN.UTF-8; export LANG
NLS_LANG='SIMPLIFIED CHINESE_CHINA.AL32UTF8'; export NLS_LANG

[oracle@localhost ~]$ cd $ORACLE_HOME

-bash: cd: /u01/app/oracle/product/11.1.0/db_1: 沒有那個文件或目錄


發現oracle安裝定義的家目錄是在/u01/app/oracle/product/11.1.0/db_1目錄下的
u01目錄是root用戶的權限,在切回到root用戶,執行如下命令:
[root@localhost ~]# cd $ORACLE_HOME
[root@localhost dbhome_1]# pwd
/u01/app/oracle/product/11.2.0/dbhome_1
[root@localhost dbhome_1]# sqlplus / as sysdba
或是
[root@localhost dbhome_1]# cd bin
[root@localhost dbhome_1]# pwd
/u01/app/oracle/product/11.2.0/dbhome_1/bin
[root@localhost bin]# ./sqlplus / as sysdba
SQL*Plus: Release 11.2.0.4.0 Production on Thu Oct 12 17:20:48 2017
Copyright (c) 1982, 2013, Oracle.  All rights reserved.
Enter password: 
Connected to:
Oracle Database 11g Enterprise Edition Release 11.2.0.4.0 - 64bit Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options
SQL>

問題解決!


發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章