mokky14's IT diary

IT関係の仕事メモ、勉強会の感想など書いてます。

sqlplusからDB接続したときにORA-21561発生

OracleクライアントをインストしたマシンからOracleDB接続しようとしたら、ORA-21561エラーなるものが発生。
クライアントの環境はCentOS6。

$ sqlplus hoge/fuga@DB

SQL*Plus: Release 11.2.0.3.0 Production on Wed Sep 18 12:34:52 2013

Copyright (c) 1982, 2011, Oracle.  All rights reserved.

ERROR:
ORA-21561: OID generation failed

ここによると、

The problem is that /etc/hosts is not properly configured (usually It does not contain an entry for the name of the server )

/etc/hostsのエントリーが足りないらしい。

ということで対応。
まず自分のホスト名を確認。

$ uname -n
centos6.localhost.localdomain

このホスト名を/etc/hostsの127.0.0.1の定義に追加する。

127.0.0.1   localhost localhost.localdomain centos6 centos6.localhost.localdomain

つないでみる。

$ sqlplus hoge/fuga@DB

SQL*Plus: Release 11.2.0.3.0 Production on Wed Sep 18 12:39:07 2013

Copyright (c) 1982, 2011, Oracle.  All rights reserved.


Connected to:
Oracle Database 10g Enterprise Edition Release 10.2.0.5.0 - 64bit Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options

SQL>

でけた。