Difference between revisions of "SQLite"

From dbawiki
Jump to: navigation, search
(Convert Unix epoch time to local date and time format)
Line 9: Line 9:
 
<pre>
 
<pre>
 
select host, sid, datetime(started,'unixepoch','localtime'), type from dbahawk_rman_summary where started > date('now')-4 order by 1,2;
 
select host, sid, datetime(started,'unixepoch','localtime'), type from dbahawk_rman_summary where started > date('now')-4 order by 1,2;
 +
</pre>
 +
<pre>
 +
hn5407|crelsasa|2018-05-26 03:02:01|INCR(L1)
 +
hn5407|crelsasa|2018-05-27 03:01:40|INCR(L1)
 +
hn5407|crelsasa|2018-05-28 03:00:52|INCR(L0)
 +
hn5407|loana|2018-03-30 21:00:32|DB FULL
 +
hn5407|loana|2018-04-06 21:00:31|DB FULL
 +
hn5407|loana|2018-04-13 21:00:35|DB FULL
 
</pre>
 
</pre>

Revision as of 11:19, 28 May 2018

sqlite3 - a very handy little database as it is file based and included with almost everything.

Convert Unix epoch time to local date and time format

Also date('now') as an equivalent for Oracle's sysdate

select host, sid, datetime(started,'unixepoch','localtime'), type from dbahawk_rman_summary where started > date('now')-4 order by 1,2;
hn5407|crelsasa|2018-05-26 03:02:01|INCR(L1)
hn5407|crelsasa|2018-05-27 03:01:40|INCR(L1)
hn5407|crelsasa|2018-05-28 03:00:52|INCR(L0)
hn5407|loana|2018-03-30 21:00:32|DB FULL
hn5407|loana|2018-04-06 21:00:31|DB FULL
hn5407|loana|2018-04-13 21:00:35|DB FULL