资讯

精准传达 • 有效沟通

从品牌网站建设到网络营销策划,从策略到执行的一站式服务

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修改操作系统时间会数据库有哪些影响?
标题URL:http://cdkjz.cn/article/iidpep.html
多年建站经验

多一份参考,总有益处

联系快上网,免费获得专属《策划方案》及报价

咨询相关问题或预约面谈,可以通过以下方式与我们联系

大客户专线   成都:13518219792   座机:028-86922220