※ 시스템 용량 부족으로 인하여 용량을 줄이기 위해 undo tablespace 를 삭제 후 재생성 필요

 

UNDO 조회

UNDO 파라미터 확인

SQL> show parameter undo

NAME                                 TYPE        VALUE
------------------------------------ ----------- ------------------------------
temp_undo_enabled                    boolean     FALSE
undo_management                      string      AUTO
undo_retention                       integer     900
undo_tablespace                      string      UNDOTBS1

 

 

UNDO tablespace 확인

select * from DBA_TABLESPACES
where tablespace_name like '%UNDO%'

 

 

UNDO 위치 및 size 확인

select tablespace_name, file_name, round(bytes/1024/1024/1024,2) SIZE_GB
from dba_data_files
where tablespace_name like '%UNDO%'

 

 

파일시스템 size 확인

SQL> !df -h
Filesystem      Size  Used Avail Use% Mounted on
devtmpfs         16G     0   16G   0% /dev
tmpfs            16G     0   16G   0% /dev/shm
tmpfs            16G  393M   16G   3% /run
tmpfs            16G     0   16G   0% /sys/fs/cgroup
/dev/sda1       100G   98G  2.4G  98% /
tmpfs           3.2G     0  3.2G   0% /run/user/0
tmpfs           3.2G  697M  2.5G  22% /run/user/1001

 

 

UNDO tablespace 생성

파일시스템의 용량에 따라 UNDO tablespace 크기 지정

SQL> CREATE UNDO TABLESPACE "UNDOTBS2" DATAFILE '/app/oracle/oradata/18c/TSORA18/undotbs02.dbf'
2	SIZE 100M AUTOEXTEND ON NEXT 5M MAXSIZE UNLIMITED;

Tablespace created.

 

 

새로 생성된 UNDO tablespace 확인

select * from DBA_TABLESPACES
where tablespace_name like '%UNDO%'

 

 

UNDO tablespace 변경

SQL> alter system set undo_tablespace='UNDOTBS2';

System altered.

 

 

undo tablespace rollbacksegment를 확인

undo는 segment를 사용하여 저장되는데 이때 사용하던 segment의 status를 보여준다.

UNDOTBS1은 사용하지 않으므로 status가 offline이다.

SELECT SEGMENT_NAME, TABLESPACE_NAME, STATUS
FROM DBA_ROLLBACK_SEGS
ORDER BY 2;

 

 

기존 undo tablespace UNDOTBS1를 삭제

SQL> drop tablespace undotbs1 including contents and datafiles;

Tablespace dropped.

 

 

변경 후 undo 파라미터 조회

SQL> show parameter undo

NAME                                 TYPE        VALUE
------------------------------------ ----------- ------------------------------
temp_undo_enabled                    boolean     FALSE
undo_management                      string      AUTO
undo_retention                       integer     900
undo_tablespace                      string      UNDOTBS2

 

 

새로 생성된 UNDO 및 크기 확인

select tablespace_name, file_name, round(bytes/1024/1024/1024,2) SIZE_GB
from dba_data_files
where tablespace_name like '%UNDO%'

 

 

기존 UNDO 데이터 파일 삭제 확인

undotbs1 데이터 파일이 삭제된 것을 확인할 수 있다.

[oracle@ts-oracle1 ~]$ cd /app/oracle/oradata/18c/TSORA18/

[oracle@ts-oracle1 TSORA18]$ ls -alrt
total 49748484
drwxrwxr-x 4 oracle oinstall          32 Oct 26  2020 ..
-rw-r----- 1 oracle oinstall  1073750016 Dec 30  2020 USERS_DATA01.dbf
-rw-r----- 1 oracle oinstall  1924145152 Aug 28 09:00 temp01.dbf
-rw-r----- 1 oracle oinstall   209715712 Sep 27 15:24 redo01.log
-rw-r----- 1 oracle oinstall   209715712 Sep 27 15:25 redo02.log
-rw-r----- 1 oracle oinstall  3160285184 Sep 27 15:55 ITSM_IND01.dbf
-rw-r----- 1 oracle oinstall    58990592 Sep 27 15:55 users01.dbf
-rw-r----- 1 oracle oinstall 10737426432 Sep 27 15:55 ITSM_DATA01.dbf
-rw-r----- 1 oracle oinstall   524296192 Sep 27 15:55 USERS_IND01.dbf
-rw-r----- 1 oracle oinstall  3221233664 Sep 27 15:55 LOB01.dbf
-rw-r----- 1 oracle oinstall   104865792 Sep 27 16:29 undotbs02.dbf
drwxr-x--- 2 oracle oinstall        4096 Sep 27 16:33 .
-rw-r----- 1 oracle oinstall  1205870592 Sep 27 16:35 system01.dbf
-rw-r----- 1 oracle oinstall 28280102912 Sep 27 16:56 sysaux01.dbf
-rw-r----- 1 oracle oinstall   209715712 Sep 27 16:57 redo03.log
-rw-r----- 1 oracle oinstall    11124736 Sep 27 16:58 control01.ctl
-rw-r----- 1 oracle oinstall    11124736 Sep 27 16:58 control02.ctl

[oracle@ts-oracle1 TSORA18]$ ls -alrt undo*
-rw-r----- 1 oracle oinstall 104865792 Sep 27 16:29 undotbs02.dbf

'DB ORACLE 공부 기록' 카테고리의 다른 글

Windows Server 2019 한국어 설치  (0) 2022.12.02
Windows Server 2019 설치  (0) 2022.12.02
Client Tool에서 GUI 실행  (0) 2022.08.17
Statspack 삭제  (0) 2022.07.01
Statspack 설치  (0) 2022.06.29

+ Recent posts