[20160822]11g Restore Point Enhancements2.txt
--上个星期写的关于11gRestore Point的问题,链接:
http://blog.itpub.net/267265/viewspace-2123766/
--今天在回家的路上,突然明白为什么差8个小时.实际上国内在第8时区,也就是smon_scn_time保存的时间是UTC时间.
--如果执行如下命令:
create restore point restore3 as of timestamp date'2015-08-01';
--这个时间是本地时间,减去8小时才是UTC时间.
--不知道理解是否正确,在实践中注意,不过还是使用scn更加准确一点.
SYS@book> @ &r/ver1
PORT_STRING VERSION BANNER
------------------------------ -------------- --------------------------------------------------------------------------------
x86_64/Linux 2.4.xx 11.2.0.4.0 Oracle Database 11g Enterprise Edition Release 11.2.0.4.0 - 64bit Production
SYS@book> select max(TIME_DP),sysdate from smon_scn_time ;
MAX(TIME_DP) SYSDATE
------------------- -------------------
2016-08-22 23:55:10 2016-08-23 08:00:52
--从视图也可以看出smon_scn_time记录的时间是UTC。
--顺便学习unix的date命令的转换问题:
$ date -u -d '1970-01-01 UTC 1438358400 seconds' +"%Y-%m-%d %T"
2015-07-31 16:00:00
$ date -d '1970-01-01 UTC 1438358400 seconds' +"%Y-%m-%d %T"
2015-08-01 00:00:00
$ date -d '2015-08-01 UTC' +"%Y-%m-%d %T"
2015-08-01 08:00:00
--//2015-08-01 UTC 相当于本地时间的2015-08-01 08:00:00。
$ date -d '2015-08-01' +"%s"
1438358400
--//日期的2015-08-01(本地)对比1970/1/1的秒数。
来自 “ ITPUB博客 ” ,链接:https://blog.itpub.net/267265/viewspace-2123831/ ,如需转载,请注明出处,否则将追究法律责任。