I am new to HBase and using Phoenix driver to connect HBase using Squirrel client. Below query describes my table structure and it has composite primary key with "Alert Id ( varchar)" and "Alert StartTime ( Row Timestamp)".
CREATE TABLE ALERT_DETAILS (ALERTID VARCHAR,MACHINENAME VARCHAR(100),PLACE VARCHAR(100),ALERTTYPE VARCHAR(32),ALERTSTARTTIME TIMESTAMP NOT NULL CONSTRAINT CTKEY PRIMARY KEY (ALERTID, ALERTSTARTTIME ROW_TIMESTAMP));
When I am inserting data using using below query. I am not able to see the time stamp value which I have given in the query. It is changing (5 hours before) to other value.
upsert into ALERT_DETAILS values('956dbd63fc586e35bccb0cac18d2cef0','machineone','AUS','CRITICAL ALERT','2016-12-22 11:30:23.0')
After executing the query The timestamp value is changing from '2016-12-22 11:30:23.0' to '2016-12-22 06:30:23.0'.
My system time zone is EST and please help me how to change configuration of Phoenix and Hbase
Phoenix uses the system time zone.
Use tzselect and follow the prompts. It will output an environment variable that you can set in your .bash_profile or set on system startup.
ie. TZ='America/New_York'; export TZ
Related
I am trying to export data from oracle but i cant get the latest updates.I am newbie on oracle so don't get angry
Is it a default time for export i mean like specific history(1 week before?)
I created a table last week but i cant get this table in this export file.
Also there are new values in these tables but i cant get this value too.
I am using this code:
exp SYSTEM/password FILE=tables.dmp TABLES(sometable) GRANTS=y INDEXES=y log=exp.log
The company I work for is in the process of switching from oracle to EnterpriseDB and I'm trying to update a query that uses a timestamp from a table, but whenever I try to pull that timestamp it gives me:
[Devart][ODBC][PostgreSQL]Invalid TIMESTAMP string {HY000}
I've tried casting it as varchar2, date, timestamp, using to_date, and nothing has worked.
The query is:
select "ship_date" from "promotion"#pgProd
In postgres ship_date is just a timestamp.
Any information about how this can be accomplished would be appreciated.
EDIT: To clarify, this query is being run in oracle pulling data from postgres.
Oracle version is 11g
The relevent line of the creation script is:
ship_date timestamp without time zone NOT NULL
I am trying to insert my system date by using the query is,"insert into table values (current_date)",But it is inserting database date, Help me to solve this problem
CURRENT_DATE returns the date/time in your current session time zone. Most likely you did not set the session time zone and Oracle defaults it to database time zone.
You can set your session time zone explicitly by
ALTER SESSION SET TIME_ZONE = ...
Default SESSIONTIMEZONE can be set by environment variable ORA_SDTZ or (on Windows) by registry entry HKLM\SOFTWARE\Wow6432Node\ORACLE\KEY_%ORACLE_HOME_NAME%\ORA_SDTZ (for 32 bit Client), resp. HKLM\SOFTWARE\ORACLE\KEY_%ORACLE_HOME_NAME%\ORA_SDTZ (for 64 bit Client).
My database was configured with an dbtimezone=+2:00:
When my application sends a date which has a timezone, does Oracle automatically translate the date to its dbtimezone and store it in the column?
When my application asks for a field date, does Oracle automatically translate it to the application timezone?
In order to be consistency with business rules, I wanted to change this dbtimezone to UTC. So I made the alter database set time_zone='UTC' command, I restarted the oracle server and now the select dbtimezone from dual; command returns "UTC".
But, all fields date in DB haven't changed (no change -2 hours from GMT+2 to UTC). When I ask the sysdate, it returns the GMT+2 date ... I try to change my SQL Developer configuration timezone to UTC but it didn't change anything. Do I have an issue of Oracle session parameters that convert my DB data to GMT+2 before displaying it ?
Finally, does anyone have a good practice to make this change ? (change the database timezone and existing date to a new timezone).
If all you're doing is changing the database time zone setting, then you are only going to notice any change in output if your data is stored with the TIMESTAMP WITH LOCAL TIME ZONE type.
I don't recommend that though. It would be much better if your data was just stored in a regular TIMESTAMP field and was already set to UTC.
You should read the documentation about all of the different date and time datatypes, so you understand how each of these types works and differs from the other.
I am hitting a bit of a problem when using the date datatype. When trying to save a row to the table where the field it throws an error ora 01830 and complains about converting the date format picture ends...etc. Now when I do the insert, I use the to_date function with the format of "dd-mon-yyyy hh24:mi:ss". Of course, when I remove the time element, everything is perfect.
Checking sysdate, I noticed that the time element wasn't be displayed, and I used alter session set nls_date_format to set the date and time I want to save to the table, which worked!
I used alter system set nls_date_format ="dd-mon-yyyy hh24:mi:ss" scope=spfile; This showed that it was altered, and I can see the setting in the enterprise management console. In sqlplus, I shutdown the database, and restarted with startup mount; alter database open; and then selecting sysdate, it still shows the date as dd-mon-yy, and still no time! Checking the enterprise management, and looking up the nls_date_format the setting is still shown as "dd-mon-yyyy hh24:mi:ss".
So, my question is this - what am I doing wrong? Why can't save date and time using date in Oracle 11g?????
Thanks
Dates are stored with "second" granularity in Oracle.
Display formats are dependent on the system and session. In your case, since you are connecting with sqlplus, you are using a default session format from the client that does not include time. You need to execute an:
ALTER SESSION SET nls_date_format ="dd-mon-yyyy hh24:mi:ss";
when you start up your sqlplus client in order to change the default display. There is a client side file (glogin.sql?) that sqlplus will run on startup. You can place this kind of command in there if you want it to be executed each you start that client. I'm pretty sure the sqlplus client sends an "alter session set nls_date..." on start up.
In general, when outputting dates, I think it is better to just be explicit on the format by doing a TO_CHAR(myDateColumn, "dd-mon-yyyy hh24:mi:ss"). If you are reading dates programatically, you don't need to worry about it since you are dealing with internal formats, not display formats.
I've seen this error when the input data did not match the date format used. check your, data would be my suggestion.