Database Timezone Query
Jun 12, 2013
When I try to store the xml as clob with element:
<revisedDate version="1">2013-06-10T11:00:00+11:00</revisedDate>
It is throwing �ORA-01830: date format picture ends before converting entire input string�
But when I insert with
<revisedDate version="1">2013-06-10T11:00:00+05:30</revisedDate>,
it is getting inserted successfully.
PS: my db timezone is +00:00
View 1 Replies
ADVERTISEMENT
May 23, 2013
I need the timezone of the server that the DB sits on. I don't want the offset. I need the region name. This is because some regions use daylight savings time and some do not. Plus an SA can change the time of the OS. Another company manages our servers and DBs in production and we don't have contact with them. We could use a lookup talbe and just populate it, then update it when we find out what it is in production. The problem is that I have seen cases where the timezone on servers change. Considering the lack of contact between the teams, we really need a reliable way to get the timezone out of the DB.
We tried several ways. My list is below and I explain why this is not working.
examples:
sessiontimezone: this is the timezone of my server. In theory it should be the same as the DB. We cannot take the risk that this will be out of sync. dbtimezone: This gives the offset. Such as -5:00 for US EST. There are multiple regions that have this. Some do not use daylight savings time and some do. We would need America/New York instead.
sessiontimezone gives the timezone setting for the client. This can be altered.
dbtimezone just gives the offset such as -5:00
We get data feeds from different parts of the world. We get some data based data that is local to that regions timezone. We need to partition on this field. So we need to add a field to the DB and normalize it to the time local to our DB Server. So if we get a record from california and the DB is on a server in US EAST, we add 3 hours. The offset won't work...
1. a timezone that we are getting from may not be in daylight savings time. We are partitioning by hour.
2. We would hit daylight savings time in New York before we hit it in California, so we would need to account for that in the math.
This hourly partition is a fixed and hard requirement. We need this to be absolutely accurate.
Here is what we tried:
What I want (pseudo-code): “Select XXX as timezone_region_name” to return “America/New_York” or “UTC”. It may be that the timezone was not set for the database at install time, and if it were, these queuries would work.
-- FAILED
SELECT DBTIMEZONE FROM dual;
--FAILED
select systimestamp, to_char(systimestamp, 'TZR'), extract (timezone_region from systimestamp) from dual;
--FAILED
SELECT systimestamp
AT TIME ZONE DBTIMEZONE "DB Time"
FROM DUAL;
--FAILED
select to_char(systimestamp, 'TZR') from dual;
View 7 Replies
View Related
Mar 6, 2013
If I run the following query it's executing fine.
SELECT CAST(( FROM_TZ(CAST(SYSDATE AS TIMESTAMP),'CST') AT TIME ZONE ('Japan'))
AS DATE) FROM DUAL;
If I run the following query,I am getting the error.
ORA-01882: timezone region not found
SELECT CAST(( FROM_TZ(CAST(SYSDATE AS TIMESTAMP),'LMT') AT TIME ZONE ('philippines'))
AS DATE) FROM DUAL;
What is the timezone for Philippines.
View 6 Replies
View Related
Sep 14, 2012
I have an interesting problem. I have a server in the UK and I have three databases globally - UK (FINUKQ1), NY (FINNYQ1) and TK (FINTKQ1). The NY and TK databases will be migrated to the UK server as part of a consolidation project. Obviously, Time Zones and DST are the biggest concern for me.Here was my plan for the implementation (concentrating on Time Zone/DST issues).
Added to .profile:
--------------------
if [[ "$ORACLE_SID" = "FINTKQ1" ]]; then
export TZ="Asia/Tokyo"
elif [[ "$ORACLE_SID" = "FINNYQ1" ]]; then
export TZ="America/New_York"
else
unset TZ
fi
echo "TZ=$TZ"
Once environment has been set start database and listener.
Change database TZ:
-----------------
alter database set time_zone='Asia/Tokyo';
alter database set time_zone='America/New_York';
Check database TZ:
select dbtimezone from dual;
Add trigger:
------------
CREATE OR replace TRIGGER sys.timezone_check
AFTER startup ON DATABASE
DECLARE
[code]...
The trigger was there to put the database in restricted session if it is started in the wrong TZ and an error written to the alert log. The check was done on the dbtimezone and the dbname. Quite simple. Only issue is that it doesn't work as I wanted as dbtimezone and TZ are separate and disparate entities. i.e. I can start the TK database up in UK time (which will be incorrect for this project), and check the dbtimezone and it will show as 'Asia/Tokyo'.
Is there a better way of checking? Any trigger like this to compare TZs etc?
View 2 Replies
View Related
Jan 7, 2013
I am using the below query to get time stamp along with time zone format.
>>SELECT CURRENT_TIMESTAMP FROM DUAL
Now the requirement i got is i need to get convert the format in DD-MON-YY, HH:MM:SS, Timezone (GMT or PST)
how to convert this format. Or is there any alternative time stamp option to do conversion.
View 5 Replies
View Related
Oct 10, 2012
I've written this code to present the problem:
declare
region_date varchar2(100);
region varchar2(100);
offset_result varchar2(100);
begin
region_date := '2013-04-07 01:59 Australia/Sydney';
region := 'Australia/Sydney';
select
to_char(
[code]....
What I want to do is to use the variable "region" for the timezone specification as well,And I seem to be unable to, and don't understand why.....
why when I get an "ORA-00907: missing right parenthesis" with this value,Whereas, it works when I put "AT TIME ZONE 'Australia/Sydney'" there?
View 3 Replies
View Related
May 24, 2012
I have one issue My server is in france and it is in french timezone but when I query for sysdate it returns US time.
In '/etc/sysconfig/clock/'
Zone= europe/paris
UTC= true
echo $TZ variable is returning nothing.
sysdate = us time
systimestamp= us time
current_timestamp = french time
current_date = french time
dbtimezone= europe/warsove, sessiontimezone=+2.00( which is also europe timezone offset)
tz_offset(dbtimezone)=+2.00, tz_offset(sessiontimezone)= +2.00 i.e europe
os timezone= europe/paris.
This command "./emctl config agent getTZ" is also returning timezone as europe/paris
Also in "emd.properties" file "agentTZRegion" parameter is set to europe/paris
Oracle version= 11.2.0
Now I don't understand why this sysdate and systimestamp is returning "US time zone" while everything else is returning french time zone.
View 9 Replies
View Related
May 15, 2011
I'm in the process of testing a restore/recover from a simulated full system and media loss. A level 0 backup was taken from the server, and I'm trying to restore/recover to a point in time on a second server. I have created the database (with the same name) and have been able to successfully restore both the controlfile and spfile from the autobackup.
how does RMAN treat the "set until time"? The level 0 was taken on a database/server that is in CST while the database I'm trying to do a restore/ recover to is in EST. So when trying to do a point in time recovery, should I specify the time in EST or CST?
View 2 Replies
View Related
Jan 20, 2013
I'm going to migrate my current db 9.2.0.8 (Timezone version is 1!) to a new server 11.2.0.3, so I was wondering if I must upgrade timezone version of my current 9iR2 to version 4! Before upgrade it...Btw my new server has timezone v14.
View 4 Replies
View Related
Aug 31, 2010
How to change db timezone parameter. My application team has asked me to change the db timzone parameter by following sql.
ALTER database SET TIME_ZONE = '+10:00';
Is this way is the correct one , and do we have any impact on database and does it require a db bounce.
View 2 Replies
View Related
Oct 22, 2011
Order time is not properly displayed in the local timezone format and day light saving calculation is also another issue. Description:
We have web application & a centralized database where users can create orders globally. When orders are created time is saved in UTC format in the centralized global database.
somehow along with the UTC order time, timezone description is also being stored in one of the Database table as
UTC time as: '28-NOV-2010 11:24:54 PM'
Timezone description:
(GMT) Casablanca, Monrovia
(GMT) Greenwich Mean Time : Dublin, Edinburgh, Lisbon, London
(GMT+01:00) Amsterdam, Berlin, Bern, Rome, Stockholm, Vienna
(GMT+01:00) Belgrade, Bratislava, Budapest, Ljubljana, Prague
(GMT+01:00) Brussels, Copenhagen, Madrid, Paris
(GMT+01:00) Sarajevo, Skopje, Warsaw, Zagreb
(GMT+01:00) West Central Africa
(GMT+02:00) Athens, Beirut, Istanbul, Minsk
(GMT+02:00) Bucharest
(GMT+02:00) Cairo
(GMT+02:00) Harare, Pretoria
(GMT+02:00) Helsinki, Kyiv, Riga, Sofia, Tallin
.....
...
With this information how can I map timezone description to V_$TIMEZONE_NAMES. I read Oracle automatically converts to local timezones by considering day light saving timings when TZNAME is given as input with the datetime. by using above timezone descriptions how can I get TZNAMES which are in V_$TIMEZONE_NAMES.
View 1 Replies
View Related
Mar 6, 2012
I have a requirement in which a particular a timestamp column (date1) whose values are in CET timezone needs to be converted to EST and day light savings should be taken care of in the conversion logic. I should not use any ddl statements for altering the timezone and all.
View 9 Replies
View Related
Jun 21, 2012
I have a table with the following columns
EMPLOYEEIDNUMBER(12,0)
PUNCHDTM DATE
TIMEZONEIDNUMBER(12,0)
I want to return any results where any employee id that has 2 different timezoneid's on the same date. I would actually like, if its possible, to select these entries to display on one row per employee per day. So for example
EMPLOYEEID - PUNCHDTM - TIMEZONEID - PUNCHDTM - TIMEZONEID
12345 - 6/20/2012 5:00 am - 123 - 6/20/2012 10:00am - 456
To me who is newer with SQL this sounds like i would be 'joining' the table to itself so i've searched for that but not found what i need.
View 3 Replies
View Related
Jun 14, 2012
I am having an issue to connect my C++ application to my Oracle DB. When my code calls
oracle::occi::Environment::createEnvironment(),
I get an error "ORA-01804: failure to initialize timezone information".
The application works on other people's Windows machine with their Oracle DB. But it doesn't work from my machine connecting to their Oracle instance. So I guess the issue does not come from my instance but rather from my Oracle dlls maybe?
Oracle Database 10g Enterprise Edition Release 10.2.0.3.0
View 0 Replies
View Related
Jul 8, 2013
I am tasked to develop and application using Apex 4.2.2.00.11 and Oracle Database 10.2.0.4 on a Windows 2003 Server. This application needs to support different time zones. Briefly, a user in timezone A should be able to create a record with a date in timezone B and the users should be able to view the records in their timezones. What is the best method? Should I maintain a Timezone field for each user site or even per transaction, or is using "Automatic Time Zone" feature in Globalization section of Application Properties sufficient? I have developed Apex applications before, but they did not have to have different time zones, so I am not sure how I should build my database schema. Do you guys store everything as UTC and display values based on user's Timezone setting? I am aware of the Timestamp with Local Timezone data type.
View 1 Replies
View Related
Jul 17, 2012
I need to know the last executed sql query in the data base.
I tried desc v_$sql , etc.. but it says 'table or view doesnot exist'..
View 5 Replies
View Related
Feb 26, 2013
At my Workplace we have a large Orcle 11g Database with 30 different tables for production control issues.I try to get a couple of different information from the database, so i started with SQL Query's, but for this problem i was not able to write an working query.
In this case i have 2 tables:
Table 1:
ID ;ORDER_NR ;DESCRIPTION ;CREATE_DATE
1 ;A500236 ;CLEAN HOUSE ;02/20/2012
2 ;A623555 ;REPAIR CAR ;01/10/2012
3 ;A866944 ;MAINTAIN EQUIPMENT ;02/11/2012
Table 2:
ID;ORDER_NR;WO_STEP;STEP_DATE;EMPLOYEE
1;A500236 ;A;02/21/2012;W0010
2;A500239 ;F;02/21/2012;W0010
3;A500239 ;S;02/22/2012;W0027
[code]....
And the result of my Query should look like this:
ORDER_NR;DESCRIPTION ;CREATE_DATE;A_STAT_AGE;R_STAT_AGE;U_STAT_AGE
A500236;CLEAN HOUSE ;02/20/2012 ;5 ;3 ;1
A623555;REPAIR CAR ;01/10/2012 ;42 ;39 ;38
A866944;MAINTAIN EQUIPMENT ;02/11/2012 ;15 ;4 ;3
The age of my query result should be calculated from the Create date of the Order.I want to know 2 things, one is how old was the Order when they reached that status A, R and U.The second this ist, how long did the order remain on the stat A,R and U (and if possible all other status also)It could happend that not each order reaches each status, so it ca go directly from A to you in this case i want display a wildcard in this row/column
View 2 Replies
View Related
Jul 11, 2007
I am New to Oracle and PL/SQL. How to import ACCESS database to Oracle(10g) using PL/SQL.
View 1 Replies
View Related
Nov 27, 2010
i have a single form three database field
i want when i open a form in exceute mode then only a single field it does not show any data from database
means query not allowed in that particular field
how it is posible
View 1 Replies
View Related
Apr 12, 2011
I have created a table using a CTAS
E.g. :
CREATE TABLE temp1 AS
SELECT * FROM table1;
Now after the table got created, is there any place in the data base where the select query is stored using which the table got created? In brief, I would like to get the select query through which the table got created.
View 2 Replies
View Related
Mar 5, 2010
How to get a port number in database with a sql query.
View 10 Replies
View Related
Nov 16, 2011
For setting multilingual database which will have application data in Japanese I am preparing as follows....The database server is Linux and database is 10g (10.2.0.4) For storing Japanese characters in the database I am creating a database with AL32UTF8 character set
1) Do I need to change any settings on the Linux server just for handling Japanese characters? (In case it would have been windows database server would I need to change regional settings and/or any other OS settings to Japan etc?)
2) Assuming that a Japanese character will not fit in a single byte and default for semantic for char and varchar being byte, do...I need to change nls_length_sementic to char?
3) Apart from some more space requirement and performance impact on string functions will it cause any other adverse effect?
4)I would select Japanese character set -say JA16SJIS, instead of super UTF compliant AL32UTF8? What would be advantage of using AL32UTF8 over using Japanese specific character set?
5) Do I need to set nls_lang on the Linux server?
6) Users will be connecting to Linux server using putty or sqlplusw from windows Which operations will need the client to set nls_lang? To what value?
7) Apart from setting nls_lang on the client (if needed) as in question 6), are any settings needed on the client for inserting and displaying Japanese characters? e.g. regional setting, font setup, codepage setup.
View 5 Replies
View Related
Dec 1, 2010
I have the scenario where I have a table(table 1) which stores the car code and the meaning of that code. I then have another table (table 2)which just stores the code. My datablock is based on the table which just contains the code(table 2). On my form if the user wishes to populate this field in the record I have a Lov which goes to the table 1 and retrieves the code and the meaning of it.
The code is then returned to the corresponding field in the datablock for table 2. this works fine in adding and editing. the user sees the meaning and whilst selecting from the lov populates the code field behind the scenes and everything works fine. However, my problem is when the user does a query only the code field is populated from table 2 (the code field is hidden to the user) therefore the meaning field is left blank as if there is no data there when in fact this is not the case.
View 2 Replies
View Related
Aug 21, 2013
can we query this without login to the oracle database from linux os?database is up and running . /apps/oracle/product/11.2.0/dbhome/bin/sqlplus system/passwd select name from v$database;
View 5 Replies
View Related
Jul 2, 2012
My problem is I have 3 tables (TEST_TBL1, TEST_TBL2, TEST_TBL3). TEST_TBL2 and TEST_TBL3 are in remote database and I use database link to join them. The following query returns incorrect result (I seems that it ignore the where clause)
SELECT * FROM TEST_TBL1 JOIN TEST_TBL2@db_remote USING (KEY1) JOIN TEST_TBL3@db_remote USING (KEY2) WHERE KEY1=XXX OR KEY2=YYY;
I am on 11R1 (11.1.0.7)
FOR EXAMPLE:
Local database:
CREATE TABLE TEST_TBL1
(
KEY1 NUMBER(5) NOT NULL,
[Code].....
View 8 Replies
View Related
Jul 26, 2013
I am trying to write a proper query to fetch data from database. Scenario:
I need to retrieve employees who are not working in multiple departments. scott@TESTCRM> select * from emp1;
EMPNO DEPTNO
---------- ----------
7654 30 7698 30 7788 20 7788 30 7876 20 7900 10 7900 30 7902 20 7934 10
scott@TESTCRM>
Ouput Expected is
EMPNO DEPTNO
---------- ----------
7654 30 7698 30 7876 20 7902 20 7934 10
View 9 Replies
View Related
Aug 29, 2013
I would like to know 2 days back lock conflicts session information which user held the lock,sql text,when the lock released. any sql query or view in oracle 11g db.
View 1 Replies
View Related
Aug 17, 2012
I am facing a weird situation wherein the explain plan of same sql in SIT and PROD is different.In fact the explain plan is very costly in Prod.Also the DB version of both SIT and PROD is same.
Below is the sql and corresponding explain plan in Prod and SIT respectively.
Query:
SELECT seq,CCN,ProcessorPart,root_item,comp_path,Item,comp_item,comp_item_type,
lag(comp_item_type,1,'PART') over(PARTITION BY seq ORDER BY lvl)Nxt_comp_item_type,lvl,bom_qty,
ROUND(CASE min(abs(bom_qty)) OVER (PARTITION BY seq ORDER BY lvl)
WHEN 0 THEN 0 ELSE 1 END * EXP (SUM (LN (nullif(abs(bom_qty),0))) OVER (PARTITION BY seq ORDER BY lvl))) Ulti_qty,
'AMER'
[code]...
The tables referred in above query is small tables containing arnd 10k records.The above tables are partitioned on Region and not indexed.
Explain Plan in Prod: COST CARDINALITY BYTES
SELECT STATEMENT, GOAL = ALL_ROWS165173613539322883634804
SORT UNIQUE236360
UNION-ALL
PARTITION LIST SINGLE117240
[code]...
Explain Plan in SIT: COST CARDINALITY BYTES
SELECT STATEMENT, GOAL = ALL_ROWS3211689
SORT UNIQUE347240
UNION-ALL
PARTITION LIST SINGLE172120
[code]...
I am not able to attribute why there is a huge change in Cost between SIT and Prod.Apparently the Job is going for 3-5 hours which used to get completed within 20mins in SIT.
View 5 Replies
View Related
Jul 8, 2013
suggest on the dependenecy between the database service and the database instance?
srvctl start instance -i db1
will this start service as well for which the above instance is either preferred or available instance?
will it start the listener as well?
srvctl stop instance -i db1
will this stop service as well for which the above instance is either preferred or available instance?
will it stop the listener as well?
srvctl start service -d db -s dbserve
will this start service as well for which the above instance is either preferred or available instance?
srvctl stop servive -d db -s dbserve
will this stop service as well for which the above instance is either preferred or available instance?
srvctl start database -d db
will it start instance, listener and service as well?
srvctl stop database -d db
will it stop instance, listener and service as well?
View 1 Replies
View Related
Oct 22, 2011
Our Team is planning to find a new architecture for our new project. In which we have to fire query to multiple database and then we have to collect all responses from them.(Suppose there are 10databases on which we have to fire query)
I searched a lot,the only thing I got is...It could be possible only through Database link(DbLink),Is there any other way to fire query on distributed databases...?
View 20 Replies
View Related