linux时区不对造成数据库时间混乱
2021/12/20 2:19:50
本文主要是介绍linux时区不对造成数据库时间混乱,对大家解决编程问题具有一定的参考价值,需要的程序猿们随着小编来一起学习吧!
select dbtimezone from dual; select sessiontimezone from dual; SELECT TZ_OFFSET(SESSIONTIMEZONE), TZ_OFFSET(DBTIMEZONE) FROM DUAL; 207 20:09:12 SQL> select dbtimezone from dual; DBTIMEZONE ---------- +00:00 20:34:15 SQL> select sessiontimezone from dual; SESSIONTIMEZONE --------------------------------------------------------------------------- +08:00 20:35:24 SQL> 208 20:34:01 SQL> select dbtimezone from dual; DBTIMEZONE ---------- +08:00 20:34:30 SQL> select sessiontimezone from dual; SESSIONTIMEZONE --------------------------------------------------------------------------- +08:00 timedatectl set-timezone 'Asia/Shanghai' timedatectl set-timezone 'Asia/Shanghai' timedatectl set-ntp no timedatectl set-time 2021-12-19 timedatectl set-time 20:25:38 使用timedatectl可以进行如下常见操作 1.查看当前时间/日期/时区:timedatectl或者timedatectl status 2.查看所有可用时区:timedatectl list-timezones 3.设置时区:timedatectl set-timezone “Asia/Shanghai” 或者 timedatectl set-timezone PRC 4.设置时间:timedatectl set-time HH:MM:SS 5.设置日期:timedatectl set-time YYYY-MM-DD 6.设置日期时间:timedatectl set-time “YYYY-MM-DD HH:MM:SS” 7.设置硬件时钟为本地时间:timedatectl set-local-rtc 1 8.设置硬件时钟为UTC时间:timedatectl set-local-rtc 0 9.启动NTP时间同步(启用NTP服务或者Chrony服务):timedatectl set-ntp true 10.禁用NTP时间同步:timedatectl set-ntp false LANG=zh_CN.UTF-8 LANG=en_US.UTF-8 shutdown abort startup alter database set time_zone='+0:00'; select dbtimezone from dual;
这篇关于linux时区不对造成数据库时间混乱的文章就介绍到这儿,希望我们推荐的文章对大家有所帮助,也希望大家多多支持为之网!
- 2024-03-30[译]漫画SELinux概念
- 2024-03-29linux 移动文件
- 2024-03-28linux .so file
- 2024-03-28Linux 磁盘管理
- 2024-03-28Linux学习笔记(十三)磁盘管理(一):磁盘分区
- 2024-03-26linux 创建 文件
- 2024-03-25使用SecureCRT对Linux vim进行颜色设置
- 2024-03-202019-2020-12 20199317 《Linux内核原理与分析》 第十二周作业
- 2024-03-20Linux运维的第二周总结
- 2024-03-13how to count number of directories in linux