Solved

Oracle Session Set Time

Posted on 2013-06-28
5
716 Views
Last Modified: 2013-06-28
Dear Experts,

There is a way to set the timezone for session by using - alter session set time_zone = '+02:00'

Is there a way to set the date&time for session?  The result would be that a "select sysdate from dual" would yield a value relative to the the date&time set.

The end result is that I want to set the date&time to JAN15 and run a test based on that time.  I am not able to change the server time because it will impact others using the server.

Thanks,

Bill
0
Comment
Question by:bilpar
  • 3
  • 2
5 Comments
 
LVL 76

Expert Comment

by:slightwv (䄆 Netminder)
ID: 39284712
You cannot rewire sysdate.  It makes a hard call to the OS.

The one exception at the database level is FIXED_DATE:
http://docs.oracle.com/cd/E11882_01/server.112/e25513/initparams093.htm#REFRN10062

This will leave the servers date alone but everything in the database will think it is that date.
0
 

Author Comment

by:bilpar
ID: 39284776
Hi slightwv,

This is so very close to what I need... But, it acts at the SYSTEM level and impacts everyone on the database.  I am looking for something that acts at the SESSION level.

Thanks very much.  I did learn something new.
0
 
LVL 76

Accepted Solution

by:
slightwv (䄆 Netminder) earned 500 total points
ID: 39284890
I don't know of a way to have the session alter a call to sysdate.

I did see where someone wrote their own function mysysdate that returned a specific value but you would need to change all your calls from sysdate to mysysdate.

Can you not create a new 'test' database for this testing?  Then you can set it to whatever you want.
0
 

Author Comment

by:bilpar
ID: 39285011
Hi slightwv,

I am doing some work for a large company.  It takes a long time to set things up.  Lots of paperwork.  We know the code works today (with day light savings turned on).  But, we dont know for sure what will happen in November (after day light savings is turned off).

I was looking for a way to test TIMESTAMP with LOCAL ZIME ZONE columns.  If we cannot do that then we will GO LIVE in 2 weeks.  In the meantime, we will setup the dedicated test server and change the date and the test to make sure the code works... prior to the November of course.

Thanks for you assist,

Bill
0
 

Author Closing Comment

by:bilpar
ID: 39285013
Hi slightwv,

I am doing some work for a large company.  It takes a long time to set things up.  Lots of paperwork.  We know the code works today (with day light savings turned on).  But, we dont know for sure what will happen in November (after day light savings is turned off).

I was looking for a way to test TIMESTAMP with LOCAL ZIME ZONE columns now.  If we cannot do that then we will GO LIVE in 2 weeks.  In the meantime, we will setup the dedicated test server and change the date and the test to make sure the code works... prior to the November of course.

Thanks for you assist,

Bill
0

Featured Post

PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

Join & Write a Comment

Subquery in Oracle: Sub queries are one of advance queries in oracle. Types of advance queries: •      Sub Queries •      Hierarchical Queries •      Set Operators Sub queries are know as the query called from another query or another subquery. It can …
Working with Network Access Control Lists in Oracle 11g (part 2) Part 1: http://www.e-e.com/A_8429.html Previously, I introduced the basics of network ACL's including how to create, delete and modify entries to allow and deny access.  For many…
This video explains at a high level about the four available data types in Oracle and how dates can be manipulated by the user to get data into and out of the database.
This video shows syntax for various backup options while discussing how the different basic backup types work.  It explains how to take full backups, incremental level 0 backups, incremental level 1 backups in both differential and cumulative mode a…

705 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

17 Experts available now in Live!

Get 1:1 Help Now