環境
現象
sqlplusを起動しようとすると、以下のようなエラーメッセージを出力して起動しない。
$ /usr/oracle/app/product/11.2.0/dbhome_1/bin/sqlplus
Error 6 initializing SQL*Plus
SP2-0667: Message file sp1<lang>.msb not found
SP2-0750: You may need to set ORACLE_HOME to your Oracle software directory
対策
エラーメッセージにもあるとおり、環境変数にORACLE_HOME
を設定する。
$ export ORACLE_HOME=/usr/oracle/app/product/11.2.0/dbhome_1
$ /usr/oracle/app/product/11.2.0/dbhome_1/bin/sqlplus
SQL*Plus: Release 11.2.0.1.0 Production on Fri Dec 11 15:45:36 2015
Copyright (c) 1982, 2009, Oracle. All rights reserved.
Enter user-name: kagamihoge
Enter password:
ERROR:
ORA-12162: TNS:net service name is incorrectly specified
Enter user-name:
上記メッセージの通りORACLE_SID
の設定も必要なのでこれも設定する。もしくは、sqlplusの引数で指定する(例:sqlplus kagamihoge/password@localhost:1521/orcl
)。
$ export ORACLE_SID=orcl
$ /usr/oracle/app/product/11.2.0/dbhome_1/bin/sqlplus
SQL*Plus: Release 11.2.0.1.0 Production on Fri Dec 11 16:00:04 2015
Copyright (c) 1982, 2009, Oracle. All rights reserved.
Enter user-name: kagamihoge
Enter password:
Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - 64bit Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options
?????????
SQL>
新しくユーザを作ったとか、何らかの要因で環境変数の設定が変更されたとか、そういう場合に遭遇するエラーらしい。