In this example, the time zone is set to Asia/Shanghai
Proceed as follows:
1) Modify time zone under root user
# cd /root
# vi .bashrc //打开配置文件 .bashrc
Add: export TZ='Asia/Shanghai'
The complete content of the file after adding is as follows:
# .bashrc
# User specific aliases and functions
alias rm='rm -i'
alias cp='cp -i'
alias mv='mv -i'
# Source global definitions
if [ -f /etc/bashrc ]; then
. /etc/bashrc
fi
export TZ='Asia/Shanghai' //此行为新加内容
2) Modify the time zone under the oracle user
# su - oracle
$ vi .bash_profile //打开配置文件.bash_profile
Add: export TZ='Asia/Shanghai'
The complete content of the file after adding is as follows:
# .bash_profile
# Get the aliases and functions
if [ -f ~/.bashrc ]; then
. ~/.bashrc
fi
# User specific environment and startup programs
PATH=$PATH:$HOME/.local/bin:$HOME/bin
export PATH
... //此处省略数据库环境变量配置信息
export TZ='Asia/Shanghai' //此处为新加内容
Modification is complete! problem solved!