0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

Oracleのユーザのパスワードに「@」を入れるとORA-12154でつながらない

0
Posted at

開発用に作ったOracleのユーザのパスワードを「UserP@ssword」にしたんだけどハマりました。

事象

OracleDBを入れたマシンで、sqlplusで接続

$ sqlplus SYSTEM@ORADB
SQL*Plus: Release 19.0.0.0.0 - Production on Thu Jul 23 01:53:12 2026
Version 19.3.0.0.0
Copyright (c) 1982, 2019, Oracle. All rights reserved.
Enter password:
ERROR:
ORA-12154: TNS:could not resolve the connect identifier specified

sqlplus SYSTEM/UserP@ssword@ORADB
はさすがにダメだろうと思って、あえてパスワードは後から入れているのですが、つながりません。

調査

sqlnet.oraに以下3行を入れてトレースを出してみました。

DIAG_ADR_ENABLED=on
TRACE_LEVEL_CLIENT=16
TRACE_TIMESTAMP_CLIENT=on

ログの場所こんな感じのとこにでます。

$ cat ora_7379_129041370229824.trc
Trace file /opt/oracle/diag/clients/user_oracle/host_467415133_110/trace/ora_7379_129041370229824.trc

以下ログ抜粋

  • nnfhrne:Error forming address for ssword, errcode 406
     ssword という名前を使って接続先のアドレスを構成しようとしたが、失敗したことを示している。
  • nnfttran:Error querying ssword of attribute A.SMD errcode 408
     TNSの名前解決プロセスにおいて、ssword に関する属性の照会に失敗している。
  • niqname:address for name "ssword" not found
     最終的に「ssword という名前の接続先は見つかりませんでした」という結果になっている。
  • nigconcbs:Can't Get Oracle SID Name
     接続先が見つからないため、どのSIDに接続すべきかも判断できていない。

原因

なぜか、sqlplus内の Enter password:に入力した UserP@ssword の@から後ろのsswordを接続文字列として扱っている!!

対処

Enter password: に入れるときに ダブルコーテーションでくくった

"UserP@ssword"

を入れると入れました。

ちょっとこれは、ヒドイですね。。。
もしかしたら、Oracle19cだけかもしれませんが、この記事が皆さんの役に立てば幸いです。

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?