How to change SYSDATE to future - FIXED_DATE
In real world application is dependent on the SYSDATE for measuring current date-time for the processing.
Whenever there might be a situation where application want to process a complete data only on the month end and for testing or UAT purpose you need to do the processing at adhoc basis.
In this FIXED_DATE parameter help to set the SYSDATE value to the desired any future date you want to set.
Please find below inputs on the change date to future date–
- Changing the time on Exadata server is difficult way to
achieve the goal as It involve complexity, downtime and If we change the
sysdate on server again ntp will try to correct it. We can’t stop ntp as
its having dependencies on cell node.
If you want to check it further with this option then
need to check with Product Support Team through SR.
- We can change the SYSDATE on database for testing
purpose by setting FIXED_DATE to <future date>
- FIXED_DATE enables you to set a constant date
that SYSDATE will always return instead of the current date.
- This parameter only change the SYSDATE not the other
like LOCALTIMESTAMP, CURRENT_TIMESTAMP etc. Please refer below MOS doc
for the further reference and use of this parameter.
Init.ora Parameter "FIXED_DATE"
Reference Note (Doc ID 30724.1)
Clarification CURRENT_DATE, CURRENT_TIMESTAMP,
LOCALTIMESTAMP ,SYSDATE, SYSTIMESTAMP, FIXED_DATE (Doc ID 1624595.1)
Test Case Done –
==============
SQL> select SESSIONTIMEZONE, CURRENT_DATE,
CURRENT_TIMESTAMP, LOCALTIMESTAMP ,SYSDATE, SYSTIMESTAMP from dual;
SESSIONTIMEZONE
CURRENT_D CURRENT_TIMESTAMP
---------------------------------------------------------------------------
---------
---------------------------------------------------------------------------
LOCALTIMESTAMP
SYSDATE SYSTIMESTAMP
---------------------------------------------------------------------------
---------
---------------------------------------------------------------------------
+00:00
19-JAN-18 19-JAN-18 08.16.14.860064 AM +00:00
19-JAN-18 08.16.14.860064
AM
19-JAN-18 19-JAN-18 08.16.14.860061 AM +00:00
SQL>
SQL> Alter System Set Fixed_Date='31-Jan-2018' scope=both
;
System altered.
SQL>
SQL> select SESSIONTIMEZONE, CURRENT_DATE, CURRENT_TIMESTAMP,
LOCALTIMESTAMP ,SYSDATE, SYSTIMESTAMP from dual;
SESSIONTIMEZONE
CURRENT_D CURRENT_TIMESTAMP
---------------------------------------------------------------------------
---------
---------------------------------------------------------------------------
LOCALTIMESTAMP
SYSDATE SYSTIMESTAMP
---------------------------------------------------------------------------
---------
---------------------------------------------------------------------------
+00:00
19-JAN-18 19-JAN-18 08.16.51.732553 AM +00:00
19-JAN-18 08.16.51.732553
AM
31-JAN-18
19-JAN-18 08.16.51.732543 AM +00:00
SQL> !date
Fri Jan 19 08:24:02 GMT 2018
SQL> ALTER SYSTEM SET FIXED_DATE=NONE;
System altered.
SQL> select SESSIONTIMEZONE, CURRENT_DATE,
CURRENT_TIMESTAMP, LOCALTIMESTAMP ,SYSDATE, SYSTIMESTAMP from dual;
SESSIONTIMEZONE
CURRENT_DATE
CURRENT_TIMESTAMP
---------------------------------------------------------------------------
-------------------- ---------------------------------------------------------------------------
LOCALTIMESTAMP
SYSDATE
SYSTIMESTAMP
---------------------------------------------------------------------------
--------------------
---------------------------------------------------------------------------
+00:00
19-JAN-2018 08:26:53 19-JAN-18 08.26.53.209598 AM +00:00
19*JAN*2018
08:26:53
19-JAN-2018
08:26:53 19-JAN-18 08.26.53.209595 AM +00:00