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 >


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?

Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Could you post your tnsnames.ora file please? thanks
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.

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Oracle Database

From novice to tech pro — start learning today.