Home » SQL & PL/SQL » SQL & PL/SQL » Doubt in SYS_CONTEXT
Doubt in SYS_CONTEXT [message #659610] Tue, 24 January 2017 04:02 Go to next message
gajini
Messages: 262
Registered: January 2006
Senior Member
In one of the trigger, a value for the column is getting inserted using this value SYS_CONTEXT('USERENV','TERMINAL').
But sometimes, this column is having these values "UNKNOWN" and "pts/0".
Please let me know when these values will be generated instead of TERMINAL name.
Database version is Oracle 11.2.0.3.0 and its server is Suse Enterprise Linux.
Re: Doubt in SYS_CONTEXT [message #659612 is a reply to message #659610] Tue, 24 January 2017 04:13 Go to previous messageGo to next message
John Watson
Messages: 8929
Registered: January 2010
Location: Global Village
Senior Member
"unknown" means it isn't a terminal session. For example, anyone coming in through an application server. You might the MACHINE column more useful.

--correction: I was referring to v$session, the userenv context might be different. Perhaps use the HOST attribute.

[Updated on: Tue, 24 January 2017 04:18]

Report message to a moderator

Re: Doubt in SYS_CONTEXT [message #659613 is a reply to message #659610] Tue, 24 January 2017 04:51 Go to previous messageGo to next message
Michel Cadot
Messages: 68641
Registered: March 2007
Location: Nanterre, France, http://...
Senior Member
Account Moderator

This attribute is set at connection time from the value sent by the client.
It is the same thing than the V$SESSION column.
On Windows it is the machine name, on Unix/Linux it is the terminal in Unix/Linux meaning.
Thin JDBC drivers generally don't send this information.

Re: Doubt in SYS_CONTEXT [message #659617 is a reply to message #659613] Tue, 24 January 2017 07:28 Go to previous messageGo to next message
Bill B
Messages: 1971
Registered: December 2004
Senior Member
Also "pts/??" is how Linux/Unix shows it's terminal connections.
Re: Doubt in SYS_CONTEXT [message #659677 is a reply to message #659617] Fri, 27 January 2017 01:50 Go to previous messageGo to next message
gajini
Messages: 262
Registered: January 2006
Senior Member
Hi All, Thanks for your reply. Please anyone of you explain me about what is meant by a terminal and why it shows as "UNKNOWN" for the sessions from the application servers.
Re: Doubt in SYS_CONTEXT [message #659678 is a reply to message #659677] Fri, 27 January 2017 02:06 Go to previous messageGo to next message
Michel Cadot
Messages: 68641
Registered: March 2007
Location: Nanterre, France, http://...
Senior Member
Account Moderator

Didn't we already answer this?

Re: Doubt in SYS_CONTEXT [message #659679 is a reply to message #659678] Fri, 27 January 2017 03:24 Go to previous message
cookiemonster
Messages: 13920
Registered: September 2008
Location: Rainy Manchester
Senior Member
As far as oracle is concerned terminal is a bit of data given to it by the client process.
So UNKNOWN means the client process hasn't supplied a value to oracle.
Oracle does not check itself what the terminal is.
Previous Topic: scrambling the data for a column in a tables
Next Topic: JSON Parsing
Goto Forum:
  


Current Time: Sat Apr 20 11:11:54 CDT 2024