oracle convert unix epoch time to date

To convert from milliseconds from epoch (assume epoch is Jan 1st 1970): select to_date(‘19700101’, ‘YYYYMMDD’) + ( 1 / 24 / 60 / 60 / 1000) * 1322629200000 from dual; 11/30/2011 5:00:00 AM To convert that date back to milliseconds: select (to_date(’11/30/2011 05:00:00′, ‘MM/DD/YYYY HH24:MI:SS’) – to_date(‘19700101’, ‘YYYYMMDD’)) * 24 * 60 * 60 * … Read more

Determining location of relevant tnsnames.ora file

According Oracle these locations are searched for tnsnames.ora, resp. sqlnet.ora and ldap.ora: Oracle Net files in present working directory (PWD/CWD) TNS_ADMIN defined sessionally or by user-defined script TNS_ADMIN defined as a global environment variable TNS_ADMIN defined in the registry Oracle Net files in %ORACLE_HOME/network|net80\admin (Oracle default location) However, I am not sure whether each application/driver … Read more

Get counts of all tables in a schema

This can be done with a single statement and some XML magic: select table_name, to_number(extractvalue(xmltype(dbms_xmlgen.getxml(‘select count(*) c from ‘||owner||’.’||table_name)),’/ROWSET/ROW/C’)) as count from all_tables where owner=”FOOBAR”