- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- Oracle SYSDATE show old date
Categories
Company
Local Language
Forums
Discussions
Forums
- Data Protection and Retention
- Entry Storage Systems
- Legacy
- Midrange and Enterprise Storage
- Storage Networking
- HPE Nimble Storage
Discussions
Discussions
Discussions
Discussions
Forums
Forums
Discussions
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
- BladeSystem Infrastructure and Application Solutions
- Appliance Servers
- Alpha Servers
- BackOffice Products
- Internet Products
- HPE 9000 and HPE e3000 Servers
- Networking
- Netservers
- Secure OS Software for Linux
- Server Management (Insight Manager 7)
- Windows Server 2003
- Operating System - Tru64 Unix
- ProLiant Deployment and Provisioning
- Linux-Based Community / Regional
- Microsoft System Center Integration
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Community
Resources
Forums
Blogs
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО01-24-2006 07:39 AM
тАО01-24-2006 07:39 AM
SQL> select to_char(sysdate, 'Dy DD-Mon-YYYY HH24:MI:SS')
as "SYSDATE"
from dual;
2 3
SYSDATE
------------------------
Wed 01-Jan-2003 10:00:00
Steve
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО01-24-2006 07:52 AM
тАО01-24-2006 07:52 AM
Re: Oracle SYSDATE show old date
is the local time correct?
select logon_time from v$session where sid=1;
is this time ok?
Regards
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО01-24-2006 07:54 AM
тАО01-24-2006 07:54 AM
Re: Oracle SYSDATE show old date
SQL> select logon_time from v$session where sid=1;
LOGON_TIM
---------
09-JAN-06
SQL>
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО01-24-2006 07:56 AM
тАО01-24-2006 07:56 AM
Re: Oracle SYSDATE show old date
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО01-24-2006 08:10 AM
тАО01-24-2006 08:10 AM
Re: Oracle SYSDATE show old date
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО01-24-2006 09:10 AM
тАО01-24-2006 09:10 AM
Re: Oracle SYSDATE show old date
Tue Jan 24 14:08:41 PST 2006
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО01-24-2006 09:10 AM
тАО01-24-2006 09:10 AM
Re: Oracle SYSDATE show old date
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО01-24-2006 12:56 PM
тАО01-24-2006 12:56 PM
SolutionThis is what metalink says
The SYSDATE function simply performs a system-call to the Operating System to get the time (a "gettimeofday" call).
The OS (Unix) TZ environment variable influences the time that the OS will pass on to Oracle. So even though sysdate itself does not use the timezones in the database, it is influenced by the (non-Oracle) TZ environment variable on the OS.
To debug situations in which you have a unexplained difference between the oracle sysdate and the system time you see on Unix, use the following method:
telnet to the unix machine
connect using sqlplus in the telnet session:
1)) once through the listener using a tnsnames alias
$sqlplus user/password@[tnsnames alias]
SQL>select to_char(sysdate,'DD-MON-YY HH24:MI:SS') from dual;
2) once trough a "local" ORACLE_SID connection
$env | egrep 'ORACLE_SID'
$sqlplus user/password
SQL>select to_char(sysdate,'DD-MON-YY HH24:MI:SS') from dual;
Check that the time in the banner of sqlplus ( SQL*Plus: Release 10.1.0.4.0 - Production on Wo Jan 11 15:05:46 2006 ) is reflecting the time based on the current TZ set in the Unix (!) session.
If the results are different this means that the listener is started with a different TZ then you current user environment. To resolve this simply stop and start listener with the TZ you want to use. if you are using MTS then you might see a correct result with a dedicated connection, in that case stop and start also the database with the correct TZ.
Indira A
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО01-24-2006 01:28 PM
тАО01-24-2006 01:28 PM
Re: Oracle SYSDATE show old date
What exact Oracle version/platform?
A broken timezone setting seems like the most likely cause.
You may also want do an strace on your Oracle slave and actually 'see' the gettimeofday.
fwiw,
Hein.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО01-24-2006 11:40 PM
тАО01-24-2006 11:40 PM
Re: Oracle SYSDATE show old date
Just to clarify a bit, can you please post the output like the following:
$ export NLS_DATE_FORMAT="dd-mon-yyyy hh24:mi:ss"
$ sqlplus
SQL*Plus: Release 8.1.7.0.0 - Production on Wed Jan 25 16:39:53 2006
(c) Copyright 2000 Oracle Corporation. All rights reserved.
Enter user-name: scott/tiger@mydb
Connected to:
Oracle Database 10g Enterprise Edition Release 10.1.0.3.0 - 64bit Production
With the Partitioning, OLAP and Data Mining options
SQL> select sysdate from dual;
SYSDATE
--------------------
25-jan-2006 16:35:14
SQL>
thanks
kind regards
yogeeraj
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО01-25-2006 12:49 AM
тАО01-25-2006 12:49 AM
Re: Oracle SYSDATE show old date
I would try the following.
Get current system timestamp with time zone information
SQL> select SYSTIMESTAMP from dual;
Check the database time zone
SQL> select DBTIMEZONE from dual;
ALTER database SET TIME_ZONE = '
Switch back DBTIMEZONE to hh:mm format
SQL> ALTER database SET TIME_ZONE = '
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО01-25-2006 01:51 AM
тАО01-25-2006 01:51 AM
Re: Oracle SYSDATE show old date
The Oracle sysdate (and time) is
derived from the OS.
So if you are on unix , runing
the date command and set a new
date would effect that.
Also as was mentioned earlier, the TZ variable is important as it dictates
the timezone. To set it permanently
you need to update a unix file, I believe
it is /etc/timezone(s) , need to check.
Then you can synchronize your time
with the ntpd protocol to some
central server.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО01-25-2006 03:58 AM
тАО01-25-2006 03:58 AM
Re: Oracle SYSDATE show old date
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО01-25-2006 06:55 AM
тАО01-25-2006 06:55 AM
Re: Oracle SYSDATE show old date
In case it is the OS which I think is, make sure of the consequences and the impact of resetting clock. Resetting the clock might make your backup obsolete. So becarefull.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО01-26-2006 07:15 AM
тАО01-26-2006 07:15 AM
Re: Oracle SYSDATE show old date
yogeeraj and Simon ...
SQL> select sysdate from dual;
SYSDATE
--------------------
01-jan-2003 10:00:00
SQL> select SYSTIMESTAMP from dual;
SYSTIMESTAMP
---------------------------------------------------------------------------
26-JAN-06 08.54.56.474850 AM -08:00
SQL> select DBTIMEZONE from dual;
DBTIME
------
-08:00
This look right
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО01-26-2006 08:14 AM
тАО01-26-2006 08:14 AM
Re: Oracle SYSDATE show old date
select to_char(sysdate,'DD-MON-YY HH24:MI:SS') from dual;
SQL*Plus: Release 9.2.0.4.0 - Production on Thu Jan 26 12:17:15 2006
Copyright (c) 1982, 2002, Oracle Corporation. All rights reserved.
Connected to:
Oracle9i Enterprise Edition Release 9.2.0.4.0 - Production
With the Partitioning, OLAP and Oracle Data Mining options
JServer Release 9.2.0.4.0 - Production
SQL>
SQL>
SQL> select to_char(sysdate,'DD-MON-YY HH24:MI:SS') from dual;
TO_CHAR(SYSDATE,'D
------------------
01-JAN-03 10:00:00
This seems like what you said so, how do I start listener with the correct TZ?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО01-26-2006 11:23 AM
тАО01-26-2006 11:23 AM
Re: Oracle SYSDATE show old date
On Unix you can use the OS "TZ" environment variable to alter the time that the OS will pass on to Oracle.
You set the TZ appropriate for the database and then start the listener. It is also a good idea to set the correct TZ in the Unix environment of the user who re-starts the database
TIMEZONE (TZ) is sourced during login from the user├в s profile (Eg:- for a Posix shell, when /etc/profile is sourced during login, /etc/TIMEZONE is sourced if avaailable).
/etc/TIMEZONE is intended to contain the default TZ variable.
The /etc/default/tz file is used to help define the default TZ value when it is not defined.
When you logon as oracle echo $TZ to see what it has beens set to. Then set the TZ to the correct timezone and export the variable and resrat the listener.
Indira A
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО01-26-2006 09:18 PM
тАО01-26-2006 09:18 PM
Re: Oracle SYSDATE show old date
Login as the unix database owner user (usually oracle) and give us the following outputs:
$date; cat /etc/TIMEZONE
Best Regards,
Eric Antunes
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО01-26-2006 10:46 PM
тАО01-26-2006 10:46 PM
Re: Oracle SYSDATE show old date
this is really very strange!
can you also post the output of:
select to_char(sysdate,'DD-MON-YY HH24:MI:SS') from user_objects
where rownum <2;
thanks
kind regards
yogeeraj
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО01-26-2006 11:43 PM
тАО01-26-2006 11:43 PM
Re: Oracle SYSDATE show old date
So as I asked earlier, that clock does not tick... iti is stuck at 10:00 1/1/3 right?
Well then John Wimmers suggestion may point to the problem. Someone has set "fixed_date" to that string.
Maybe they thought it was to give it a fixed format, not a fixed values.
Anyway, set to blank (alter system) and/or restat having made sure it is not in the INIT files.
fwiw,
Hein.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО01-27-2006 12:58 AM
тАО01-27-2006 12:58 AM
Re: Oracle SYSDATE show old date
The FIXED_DATE parameter should unset in INIT.ORA.
Just to test if this is the real cause, you can dynamically unset it using the command ALTER SYSTEM SET FIXED_DATE = NONE;
Once this command has been issued, SYSDATE will return to normal functionality.
good luck
kind regards
yogeeraj
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО01-27-2006 01:03 AM
тАО01-27-2006 01:03 AM
Re: Oracle SYSDATE show old date
The FIXED_DATE parameter should be unset in INIT.ORA.
Just to test if this is the real cause, you can dynamically unset it using the command ALTER SYSTEM SET FIXED_DATE = NONE;
Once this command has been issued, SYSDATE will return to normal functionality.
good luck
kind regards
yogeeraj
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО01-27-2006 04:12 AM
тАО01-27-2006 04:12 AM
Re: Oracle SYSDATE show old date
Eric Antunes ...
[oracle@prolinux oracle]$ date; cat /etc/TIMEZONE
Fri Jan 27 08:55:42 PST 2006
cat: /etc/TIMEZONE: No such file or directory
Yogeeraj ...
SQL> select to_char(sysdate,'DD-MON-YY HH24:MI:SS') from user_objects
where rownum <2; 2
TO_CHAR(SYSDATE,'D
------------------
01-JAN-03 10:00:00
Hein. ...
So as I asked earlier, that clock does not tick... iti is stuck at 10:00 1/1/3 right?
YES - as seen above
I also looked in my init.ora file and found no FIXED_DATE --
Yogeeraj ... (this did it )
SQL> ALTER SYSTEM SET FIXED_DATE = NONE;
SQL> select to_char(sysdate,'DD-MON-YY HH24:MI:SS') from user_objects where rownum <2;
TO_CHAR(SYSDATE,'D
------------------
27-JAN-06 09:08:31
Now will it stay that way after a reboot of oracle?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО01-27-2006 03:45 PM
тАО01-27-2006 03:45 PM
Re: Oracle SYSDATE show old date
Only if your init.ora does not contain the line (e.g.):
FIXED_DATE='01-JAN-03'
if you have it, you will have to remove it from there. This will ensure that sysdate will resume "normal" behaviour.
kind regards
yogeeraj
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО01-27-2006 03:50 PM
тАО01-27-2006 03:50 PM
Re: Oracle SYSDATE show old date
if you are using SPFILE, you should be cautious NOT to set FIXED_DATE=NONE
Metalink reports a bug -- see note 3368245.8
Subject: Bug 3368245 - Setting FIXED_DATE to NONE with SPFILE causes ORA-65 on STARTUP
Again, i recommend that you remove it so that your SYSDATE returns to normal functionality.
hope this helps too!
kind regards
yogeeraj