Setting date/time on UNIX
There are rare times that I need to update the time on some UNIX servers. If the NTP service is setup and running properly, I shouldn’t have to worry about this.
I found one of my database servers was about 5 minutes behind the correct time. I wanted to correct the time manually and I’m always forgetting the format. I can find the information using ‘man date‘ at the command prompt and reviewing the examples. However, writing about it will hopefully infuse the format in my brain and provide a quick reference in the future.
The syntax goes something like this:
date mmddhhmi
where mm = month
dd = day of month
hh = hour
mi = minute
Changing the date/time requires root access. In my case, root access is attainable using sudo.
sudo date 02201015
The command above sets the date/time to February 20, 2007 10:15am. As mentioned in the man pages, the current year is the default because no year is supplied in the setting.
Tuesday, February 20, 2007 at 15:10 pm
If ntp is installed but not configured, you can also run ntpdate -s servername which will contact the ntp server specified and set your time exactly, like ntpd itself would do
Monday, February 26, 2007 at 12:18 pm
I have a general question regarding changing the date on database server.
In order to do some testing for daylight saving time patch, some of our people decided to change the date/time on the Linux database server running a 10.2 single instance database. They kept changing dates back and forth several times. Finally, when the dust settled, ‘ls -ltr’ showed files modified on February 11, 2007 at the end - after March 11, 2007 files.
My question is what’s the effect of this dynamic date/time change on Oracle database? What happens to those DBMS_SCHEDULER jobs? What about internal Oracle dependency on SYSDATE,SYSTIMESTAMP etc.? Is this unhealthy to a running database? If so, then what’s the proper way of changing the date/time on a server? Shutdown the database, change the date and then restart the database?
Now what about a RAC database? Someone changes the date on one server and doesn’t on the other. Is the database going to crash?
Sunday, March 25, 2007 at 6:02 am
hi,
many thanks for your useful brief,
my question
how can i change year time from 2006 to 2007??
is that possible or not?
best regards
NOUR
Monday, March 26, 2007 at 10:51 am
Nour,
You can specify the year using the command below. For example, March 26, 2007 10:50am would be specified as shown below. The century/year goes at the end after the date and time.
date 032610502007
This information can be found in the man pages as well. Hope this helps.
Mike
Thursday, March 27, 2008 at 12:18 pm
in IBM server risc server 6000, i set time in root user.
the command is
“date 02201015″
the date set , but after restart the date is goes to 1970.
Please say permananat command to set date in unix.
Thank U
Thursday, March 27, 2008 at 13:06 pm
Charles,
As mentioned in a previous comment, you can specify the year using the command below. The century/year goes at the end after the date and time. For example, March 27, 2008 10:50am would be specified as shown below.
date 032710502008
This works on HP-UX and Solaris. I have no AIX platform to test this on, but would imagine the information I provided can also be found in the man pages. Hope this helps.
Mike