oracle一体机linux,Linux修改时区

Linux 修改时区

前言

Linux的时区使用要比windows麻烦,默认使用UTC:0时区时间。中国属于东8区(UTC+8)。对于一个DBA来说,安装操作系统时如果使用了UTC时间,是很恶心的问题。因为数据库的时间格式不对会让你的应用全垮掉

修改方式1)利用tzselect 命令

2)修改配置文件  /etc/sysconfig/clock

优略对比:方式1)不需要重新机器,但是针对所有用户都得去配置,比较麻烦,同时tzselect不是真正修改市区,最终会告诉去修改。bash_profile 文件;

方式2)需要重启机器,但是操作简单

具体修改方式:1)输入tzselect==》选择Aisa==》选择China==>选择Beijing==》1(确认),返回如下:

You can make this change permanent for yourself by appending the line

TZ='Asia/Shanghai'; export TZ

to the file '.profile' in your home directory; then log out and log in again.

Here is that TZ value again, this time on standard output so that you

can use the /usr/bin/tzselect command in shell scripts:

Asia/Shanghai

即在.bash_profile(linux)中输入TZ='Asia/Shanghai'; export TZ:其实方式1)本质是这个。修改完成后输入source .bash_profile,用于生效修改;

依次对所有用户重复上述过程

2) a.修改/etc/sysconfig/clock

ZONE=Asia/Shanghai

b. rm /etc/localtime

c. 链接到上海时区文件

ln -sf /usr/share/zoneinfo/Asia/Shanghai /etc/localtime

执行完上述过程后,重启机器,即可看到时区已经更改。

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值