网创优客建站品牌官网
为成都网站建设公司企业提供高品质网站建设
热线:028-86922220
成都专业网站建设公司

定制建站费用3500元

符合中小企业对网站设计、功能常规化式的企业展示型网站建设

成都品牌网站建设

品牌网站建设费用6000元

本套餐主要针对企业品牌型网站、中高端设计、前端互动体验...

成都商城网站建设

商城网站建设费用8000元

商城网站建设因基本功能的需求不同费用上面也有很大的差别...

成都微信网站建设

手机微信网站建站3000元

手机微信网站开发、微信官网、微信商城网站...

建站知识

当前位置:首页 > 建站知识

12c修改操作系统时间会数据库有哪些影响?

有些时候可能会因为安装数据库不够规范,导致系统时间设置的不正确,我们需要调整系统时间。但是调整系统时间到底会对数据库造成什么影响呢。我们来做几个小实验。

创新互联公司-专业网站定制、快速模板网站建设、高性价比互助网站开发、企业建站全套包干低至880元,成熟完善的模板库,直接使用。一站式互助网站制作公司更省心,省钱,快速模板网站建设找我们,业务覆盖互助地区。费用合理售后完善,10余年实体公司更值得信赖。

1.测试带有日期字段的表插入操作。

--session 1

SQL> create table t1 (id int,dt date);

Table created.

SQL> insert into t1 values(1,sysdate);

1 row created.

SQL> select * from t1;

        ID DT
---------- -----------------------
         1 09-DEC-2017 10:21:16

--session 2
[root@roidb01 ~]# date
Sat Dec  9 10:21:40 CST 2017
[root@roidb01 ~]# date -s 20:00:00
Sat Dec  9 20:00:00 CST 2017
[root@roidb01 ~]# date
Sat Dec  9 20:00:02 CST 2017

--返回session1
SQL> insert into t1 values(1,sysdate);

1 row created.

SQL> select * from t1;

        ID DT
---------- -----------------------
         1 09-DEC-2017 10:21:16
         1 09-DEC-2017 20:00:09

SQL> 
SQL> insert into t1 values(1,sysdate);

1 row created.

SQL> select * from t1;

        ID DT
---------- -----------------------
         1 09-DEC-2017 10:21:16
         1 09-DEC-2017 20:00:09
         1 09-DEC-2017 19:00:10

这里某些表日期字段使用的sysdate时间的话,时间会根据操作系统时间来插入数据,日期肯定是会变化的,这样很可能造成业务逻辑出现问题,需要注意。

2.测试AWR报告

--修改时间为前一天
[root@roidb01 ~]# date -s 01:00:00
Sat Dec  9 01:00:00 CST 2017
[root@roidb01 ~]# 
[root@roidb01 ~]# date -s "2017-12-08 11:00:00"
Fri Dec  8 11:00:00 CST 2017
[root@roidb01 ~]# date
Fri Dec  8 11:00:01 CST 2017
--AWR报告异常
SQL> @?/rdbms/admin/awrrpt.sql

Current Instance
~~~~~~~~~~~~~~~~

   DB Id    DB Name      Inst Num Instance
----------- ------------ -------- ------------
 1489897299 ORCL                1 orcl

Specify the Report Type
~~~~~~~~~~~~~~~~~~~~~~~
AWR reports can be generated in the following formats.  Please enter the
name of the format at the prompt.  Default value is 'html'.

'html'          HTML format (default)
'text'          Text format
'active-html'   Includes Performance Hub active report

Enter value for report_type: 

Type Specified:                  html

Instances in this Workload Repository schema
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

   DB Id     Inst Num DB Name      Instance     Host
------------ -------- ------------ ------------ ------------
* 1489897299        1 ORCL         orcl         roidb01

Using 1489897299 for database Id
Using          1 for instance number

Specify the number of days of snapshots to choose from
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Entering the number of days (n) will result in the most recent
(n) days of snapshots being listed.  Pressing  without
specifying a number lists all completed snapshots.

Enter value for num_days: 2

Listing the last 2 days of Completed Snapshots

                                                        Snap
Instance     DB Name        Snap Id    Snap Started    Level
------------ ------------ --------- ------------------ -----
orcl         ORCL                 1 09 Dec 2017 10:14      1
                                  2 09 Dec 2017 10:14      1
                                  3 09 Dec 2017 10:14      1
                                  4 09 Dec 2017 10:14      1
                                  5 09 Dec 2017 19:00      1
                                  6 09 Dec 2017 19:01      1
                                  7 09 Dec 2017 01:02      1
                                  8 09 Dec 2017 01:02      1
                                  9 08 Dec 2017 11:00      1  --变成前一天,时间乱了
                                 10 08 Dec 2017 11:00      1

Specify the Begin and End Snapshot Ids
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Enter value for begin_snap: 

这里也说明了,修改时间对AWR会有一定影响,尽量时间往后调整。

3.对数据库集群影响
对于Oracle RAC数据库需要各实例时间一致,时间不一致会造成节点down机。

小结:在安装数据库的时候一定要调整好数据库的时间和时区,这个也是必须检查的项目,要按照规范安装数据库,避免不必要的麻烦。如果还有其他影响,大家可以留言,一起交流。


网站栏目:12c修改操作系统时间会数据库有哪些影响?
网站链接:http://bjjierui.cn/article/iidpep.html

其他资讯