SQL*Plusが起動できない
インストールしたOracle11gのSQL*Plusを起動しようとしたら以下のエラーが表示されました。
[oracle ~]$ sqlplus /nolog -bash: sqlplus: command not found
環境変数PATHにsqlplusへのパスが通っていないのが原因のようだけど
とりあえず、sqlplusがあるディレクトリまで移動して起動できるか確認。
するとまたもやエラー。今度は以下のように表示されました。
[oracle bin]$ ./sqlplus /nolog Error 6 initializing SQL*Plus Message file sp1.msb not found SP2-0750: You may need to set ORACLE_HOME to your Oracle software directory
ORACLE_HOMEが設定されてないのが原因のようです。
そこで、oracleユーザの.bash_profileファイルにORACLE_HOMEを追記し
PATHにもSQL*Plusへのパスを追加しました。
[oracle ~]$ vi .bash_profile
# .bash_profile
# Get the aliases and functions
if [ -f ~/.bashrc ]; then
. ~/.bashrc
fi
# User specific environment and startup programs
unset USERNAME
umask 022
export ORACLE_BASE=/opt/app/oracle
export ORACLE_HOME=$ORACLE_BASE/product/11.1.0/db_1
PATH=$PATH:$HOME/bin:$ORACLE_HOME/bin
export PATH
[oracle ~]$ . ./.bash_profile
[oracle ~]$ sqlplus /nolog
SQL*Plus: Release 11.1.0.6.0 - Production on Mon Sep 17 16:51:15 2007
Copyright (c) 1982, 2007, Oracle. All rights reserved.
無事SQL*Plusを起動できました。