Home > Database > Oracle > How to change time zone in oracle

How to change time zone in oracle

WBOY
Release: 2022-03-07 15:02:05
Original
7144 people have browsed it

Oracle method to modify the time zone: 1. Use the "alter database set time_zone=' 8:00';" statement to modify the time zone; 2. Use the "shutdown immediate" and "startup" commands to restart the database.

How to change time zone in oracle

The operating environment of this tutorial: Windows 10 system, Oracle 11g version, Dell G3 computer.

How to modify the time zone in oracle

1. Check the current database time zone

SQL> select dbtimezone from dual;
 
DBTIMEZONE
------------
+00:00
Copy after login

2. Check the session time zone

SQL> select sessiontimezone from dual;
 
SESSIONTIMEZONE
--------------------------------------------------------------------------------
+08:00
Copy after login

You can see that the session time zone is Beijing time zone. The time zone is inconsistent with the database time zone.

3. Modify the time zone of the database to CST

alter database set time_zone='+8:00';
 
SQL> alter database set time_zone='+8:00';
 
Database altered.
Copy after login

4. Restart the database

SQL> shutdown immediate
Database closed.
Database dismounted.
ORACLE instance shut down.
SQL> startup
ORACLE instance started.
 
Total System Global Area  784998400 bytes
Fixed Size        2257352 bytes
Variable Size     478154296 bytes
Database Buffers    301989888 bytes
Redo Buffers        2596864 bytes
Database mounted.
Database opened.
SQL> select sessiontimezone, dbtimezone from dual;
 
SESSIONTIMEZONE
--------------------------------------------------------------------------------
DBTIMEZONE
------------
+08:00
+08:00
Copy after login

Recommended tutorial: "Oracle Video Tutorial"

The above is the detailed content of How to change time zone in oracle. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template