Solved

Oracle Session Set Time

Posted on 2013-06-28
5
719 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.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
File generation using utl_file 4 53
oracle 11g 23 80
selective queries 7 27
Oracle 12c Localhost trying to create a Migration Repo, need help with User creation. 13 27
Note: this article covers simple compression. Oracle introduced in version 11g release 2 a new feature called Advanced Compression which is not covered here. General principle of Oracle compression Oracle compression is a way of reducing the d…
How to Unravel a Tricky Query Introduction If you browse through the Oracle zones or any of the other database-related zones you'll come across some complicated solutions and sometimes you'll just have to wonder how anyone came up with them.  …
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.
Via a live example, show how to take different types of Oracle backups using RMAN.

770 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