Solved

Oracle Session Set Time

Posted on 2013-06-28
5
723 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 2
5 Comments
 
LVL 77

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 77

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

Free Tool: Postgres Monitoring System

A PHP and Perl based system to collect and display usage statistics from PostgreSQL databases.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Background In several of the companies I have worked for, I noticed that corporate reporting is off loaded from the production database and done mainly on a clone database which needs to be kept up to date daily by various means, be it a logical…
When it comes to protecting Oracle Database servers and systems, there are a ton of myths out there. Here are the most common.
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…
Via a live example, show how to take different types of Oracle backups using RMAN.

756 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