• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 1584
  • Last Modified:

ORACLE SYSDATE

The date and time returned by the function SYSDATE varies when accessing the same database depending on the value of the TWO_TASK environment variable.

Case 1)
-------

TWO_TASK = < connect string >

Observation:

SYSDATE returns a date and time different from the date and time returned by the unix command "date".

Case 2)
-------

TWO_TASK = <null>

SYSDATE returns the date and time which is the same as the date and time returned by the unix command "date".

Can anyone explain the difference given that in both cases we access the same database which resides on the same unix server from which we invoke sqlplus?

How does SYSDATE determine the date and time when the TWO_TASK environment variable is set?

0
mainbrain
Asked:
mainbrain
1 Solution
 
mshaikhCommented:
Could you post your tnsnames.ora file please? thanks
0
 
doronlaCommented:
Hey, Mainbrain

Sysdate come from the DB you are connected to. The DB you are connected to takes the date from the system. The explanation for the phenomenon you described, is simply different connection to a different instance.

Now, the TWO_TASK env variable, determines which DB you will connect in case you not specify the "@" sign after the username or password. Empty means connection to a db on the machine. The instance name is taken from the ORACLE_SID env var.
0

Featured Post

Receive 1:1 tech help

Solve your biggest tech problems alongside global tech experts with 1:1 help.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now