프린트 하기

OS환경 : Oracle Linux 7.6 (64bit)


DB 환경 : Oracle Database 12.2.0.1


방법 : 리눅스 용량 많이 차지하는 파일, 디렉토리 찾기

oracle db 사용 중 filesystem full 로 인해 db 접속이 되지 않음

용량을 많이 차지하는 파일들을 찾아야 하는 상황


오라클 접속

1
2
3
4
5
6
7
8
9
$ sqlplus / as sysdba
 
SQL*Plus: Release 12.2.0.1.0 Production on Sun Feb 23 21:09:16 2020
 
Copyright (c) 19822016, Oracle.  All rights reserved.
 
.
.
(HANG 상태)



파일시스템 확인

1
2
3
4
5
6
7
8
9
10
$ df -h
Filesystem      Size  Used Avail Use% Mounted on
devtmpfs        2.0G     0  2.0G   0/dev
tmpfs           2.0G  1.1G  912M  54/dev/shm
tmpfs           2.0G  121M  1.9G   7/run
tmpfs           2.0G     0  2.0G   0/sys/fs/cgroup
/dev/sda1        10G  1.7G  8.4G  17/
/dev/sda5        30G   30G   20K 100/app
/dev/sda3       2.0G   33M  2.0G   2/tmp
tmpfs           394M     0  394M   0/run/user/0

/app이 100% 사용중 상태



du -sh* | sort -hr 명령으로 용량 많은순으로 확인

1
2
3
4
5
6
7
8
9
10
$ cd /app/oracle/
$ du -sh * | sort -hr
19G    product
7.0G    oradata
651M    diag
4.2M    tfa
2.2M    cfgtoollogs
16K    admin
4.0K    audit
0    checkpoints

product 디렉토리가 용량을 많이 잡아먹고있음



product 디렉토리로 들어가서 한번 더 확인

1
2
3
4
5
6
7
8
9
10
$ cd product
$ du -sh * | sort -hr
12G    dbs
1.9G    lib
841M    inventory
624M    apex
609M    bin
424M    assistants
380M    javavm
346M    md



dbs 폴더로 가서 확인

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
$ cd dbs/
$ ls
afiedt.buf                arch1_402_1021683472.dbf  arch1_415_1021683472.dbf  arch1_428_1021683472.dbf  arch1_441_1021683472.dbf  arch1_454_1021683472.dbf
arch1_390_1021683472.dbf  arch1_403_1021683472.dbf  arch1_416_1021683472.dbf  arch1_429_1021683472.dbf  arch1_442_1021683472.dbf  arch1_455_1021683472.dbf
arch1_391_1021683472.dbf  arch1_404_1021683472.dbf  arch1_417_1021683472.dbf  arch1_430_1021683472.dbf  arch1_443_1021683472.dbf  arch1_456_1021683472.dbf
arch1_392_1021683472.dbf  arch1_405_1021683472.dbf  arch1_418_1021683472.dbf  arch1_431_1021683472.dbf  arch1_444_1021683472.dbf  c-3621335312-20200201-00
arch1_393_1021683472.dbf  arch1_406_1021683472.dbf  arch1_419_1021683472.dbf  arch1_432_1021683472.dbf  arch1_445_1021683472.dbf  c-3621335312-20200202-00
arch1_394_1021683472.dbf  arch1_407_1021683472.dbf  arch1_420_1021683472.dbf  arch1_433_1021683472.dbf  arch1_446_1021683472.dbf  core_31061
arch1_395_1021683472.dbf  arch1_408_1021683472.dbf  arch1_421_1021683472.dbf  arch1_434_1021683472.dbf  arch1_447_1021683472.dbf  hc_ORCL12.dat
arch1_396_1021683472.dbf  arch1_409_1021683472.dbf  arch1_422_1021683472.dbf  arch1_435_1021683472.dbf  arch1_448_1021683472.dbf  init.ora
arch1_397_1021683472.dbf  arch1_410_1021683472.dbf  arch1_423_1021683472.dbf  arch1_436_1021683472.dbf  arch1_449_1021683472.dbf  lkORCL12
arch1_398_1021683472.dbf  arch1_411_1021683472.dbf  arch1_424_1021683472.dbf  arch1_437_1021683472.dbf  arch1_450_1021683472.dbf  orapwORCL12
arch1_399_1021683472.dbf  arch1_412_1021683472.dbf  arch1_425_1021683472.dbf  arch1_438_1021683472.dbf  arch1_451_1021683472.dbf  snapcf_ORCL12.f
arch1_400_1021683472.dbf  arch1_413_1021683472.dbf  arch1_426_1021683472.dbf  arch1_439_1021683472.dbf  arch1_452_1021683472.dbf  spfileORCL12.ora
arch1_401_1021683472.dbf  arch1_414_1021683472.dbf  arch1_427_1021683472.dbf  arch1_440_1021683472.dbf  arch1_453_1021683472.dbf

아카이브 파일들이 정리되지 않고 많이 쌓여있음

현재는 아카이브 파일이 필요하지 않기때문에 모두 삭제



삭제 후 용량 확인

1
2
3
4
5
6
7
8
9
10
11
$ rm -rf arch1_*.dbf
$ df -h
Filesystem      Size  Used Avail Use% Mounted on
devtmpfs        2.0G     0  2.0G   0/dev
tmpfs           2.0G  1.1G  912M  54/dev/shm
tmpfs           2.0G  121M  1.9G   7/run
tmpfs           2.0G     0  2.0G   0/sys/fs/cgroup
/dev/sda1        10G  1.7G  8.4G  17/
/dev/sda5        30G   16G   15G  53/app
/dev/sda3       2.0G   33M  2.0G   2/tmp
tmpfs           394M     0  394M   0/run/user/0

사용률이 53%로 안정적임




참조 : https://technote.kr/165