SQL Language (MOSC)

MOSC Banner

sys_context('userenv', 'server_host')の値はどのOS情報を元にしていますか?

edited Jan 27, 2022 5:21AM in SQL Language (MOSC) 7 commentsAnswered

OS reahat7.2

Oracle 19.3

select sys_context('userenv', 'server_host') from dual;

上記のクエリを実行した結果、hostAとかえってきます。

hostnameコマンドを実行すると hostA.domainB とかえってきます。

select hostname from v$instanceを実行しても

hostA.domainB とかえってきます。

この違いは何が原因で起きているのでしょうか?

これを解消する方法はありますでしょうか?


hostnameコマンドを実行し、"hostA" とすれば一致することは分かっているのですが

OS情報を変更することに抵抗がある本番環境なのでそれ以外の方法があれば知りたいです。

select sys_context('userenv', 'server_host') from dual;

As a result of executing the above query, it will be returned as hostA.

When you execute the hostname command, it will return to hostA.domainB.

Even if you execute select hostname from v $ instance

It will be returned as hostA.domainB.


What is causing this difference?


Is there a way to get rid of this?

I know it matches if I run the hostname command and say "hostA"

Howdy, Stranger!

Log In

To view full details, sign in to My Oracle Support Community.

Register

Don't have a My Oracle Support Community account? Click here to get started.

Category Leaderboard

Top contributors this month

New to My Oracle Support Community? Visit our Welcome Center

MOSC Help Center