Oracle vs MSSQL

Oracle / MS SQL Date 변경 하기(DB Server 시간 변경)

darkturtle26 2018. 4. 23. 18:23

Oracle  / MS SQL Date 변경 하기 

: 간단히 테스트를 위해 시간을 앞으로 변경 ( 16:10 -> 19:10 형식으로 ) 

 Oracle / MS SQL 모두 OS 시간만 변경 해주면됨

  ** 시간으로 앞으로 변경 하는 경우라, DB 복구, Data 중복 이슈 없음 ( 날짜 칼럼으로 Unique 설정 등 ) 


가. Oracle DBMS Date 변경하기 

: OS 에서만 변경 해주면 됨 


1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
 
 
 
--------------------------------------------------------------------------------------------------
Oracle DBMS 시간 변경하기  [ OS 시간 변경하기 ]
--------------------------------------------------------------------------------------------------
 
<<VirtualBox Host-Gest 시간동기화 중지 하기>>
링크 : https://askubuntu.com/questions/35566/how-do-i-manually-set-the-system-time-in-virtualbox?utm_medium=organic&utm_source=google_rich_qa&utm_campaign=google_rich_qa
[root@tg ~]# sudo service vboxadd-service stop
Redirecting to /bin/systemctl stop  vboxadd-service.service
 
[TG12102]tg:/home/oracle> ss
 
SQL*Plus: Release 12.1.0.2.0 Production on Mon Apr 23 18:08:40 2018
 
Copyright (c) 19822014, Oracle.  All rights reserved.
 
Connected to an idle instance.
 
sss> startup
ORA-32004: obsolete or deprecated parameter(s) specified for RDBMS instance
ORACLE instance started.
 
Total System Global Area 2097152000 bytes
Fixed Size                  2926320 bytes
Variable Size             603982096 bytes
Database Buffers         1476395008 bytes
Redo Buffers               13848576 bytes
Database mounted.
Database opened.
sss> 
sss> 
sss> 
sss> !date
Mon Apr 23 18:09:31 KST 2018
 
 
<< root 유저로 시간 변경하기 , 한시간 뒤로 >>
[root@tg ~]# date
Mon Apr 23 18:09:07 KST 2018
[root@tg ~]# id
uid=0(root) gid=0(root) groups=0(root) context=unconfined_u:unconfined_r:unconfined_t:s0-s0:c0.c1023
[root@tg ~]# 
[root@tg ~]# date
Mon Apr 23 18:09:34 KST 2018
[root@tg ~]# date -"2018-04-23 19:09:00"
Mon Apr 23 19:09:00 KST 2018
 
<< Oracle DBMS 에서 시간 변경 확인 >>
sss> !date
Mon Apr 23 19:09:11 KST 2018
 
sss> select to_char(sysdate,'yyyymmdd hh24:mi:ss'from dual ;
 
TO_CHAR(SYSDATE,'
-----------------
20180423 19:09:22
sss> !date
Mon Apr 23 19:09:26 KST 2018
sss> 
cs


나. MSSQL DBMS Date 변경하기 

: OS 에서만 변경 해주면 됨 

<<  OS Date 변경 전 18:16 분 >>



<<  OS Date 변경 전 19:17 분 >>