현재 사용하고 있는 VM 환경의 disk 가 full 되어있는 상태
[oracle@/oracle/base/db]$df -h
Filesystem Size Used Avail Use% Mounted on
/dev/mapper/VolGroup00-LogVol00
25G 23G 0 100% /
/dev/sda1 99M 13M 82M 14% /boot
tmpfs 2.0G 533M 1.5G 27% /dev/shm
디스크가 full 차서 oracle 접속도 되지 않는 상태
[oracle@/oracle/base/oradata/ORA11]$sqlplus / as sysdba
SQL*Plus: Release 11.2.0.3.0 Production on Mon Feb 7 17:10:52 2022
Copyright (c) 1982, 2011, Oracle. All rights reserved.
ERROR:
ORA-09817: Write to audit file failed.
Linux-x86_64 Error: 28: No space left on device
Additional information: 12
ORA-01075: you are currently logged on
트레이스파일을 삭제하였으나 큰차이가 보이지 않음.
[oracle@/oracle/base/diag/rdbms/ora11/ORA11/trace]$rm *.trc
[oracle@/oracle/base/diag/rdbms/ora11/ORA11/trace]$rm *.trm
[oracle@/oracle/base/diag/rdbms/ora11/ORA11/trace]$df -h
Filesystem Size Used Avail Use% Mounted on
/dev/mapper/VolGroup00-LogVol00
25G 23G 493M 98% /
/dev/sda1 99M 13M 82M 14% /boot
tmpfs 2.0G 533M 1.5G 27% /dev/shm
fdisk 명령어로 확인하면 해당 VM에 53 GB가 할당되어있는데 실제 사용중인 공간은 30GB 정도임.
[root@localhost ~]# fdisk -l
Disk /dev/sda: 53.6 GB, 53687091200 bytes
255 heads, 63 sectors/track, 6527 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Device Boot Start End Blocks Id System
/dev/sda1 * 1 13 104391 83 Linux
/dev/sda2 14 2610 20860402+ 8e Linux LVM
/dev/sda3 2611 3916 10490445 8e Linux LVM
[root@localhost ~]# df -h
Filesystem Size Used Avail Use% Mounted on
/dev/mapper/VolGroup00-LogVol00
25G 23G 493M 98% /
/dev/sda1 99M 13M 82M 14% /boot
tmpfs 2.0G 533M 1.5G 27% /dev/shm
[root@localhost dev]# lvscan
ACTIVE '/dev/VolGroup00/LogVol00' [25.00 GB] inherit
ACTIVE '/dev/VolGroup00/LogVol01' [3.91 GB] inherit
[root@localhost dev]# vgscan
Reading all physical volumes. This may take a while...
Found volume group "VolGroup00" using metadata type lvm2
[root@localhost dev]# pvscan
PV /dev/sda2 VG VolGroup00 lvm2 [19.88 GB / 0 free]
PV /dev/sda3 VG VolGroup00 lvm2 [10.00 GB / 992.00 MB free]
Total: 2 [29.88 GB] / in use: 2 [29.88 GB] / in no VG: 0 [0 ]
fdisk 명령어로 남은 공간을 파티션 할당 해줌
Command (m for help): p
Disk /dev/sda: 53.6 GB, 53687091200 bytes
255 heads, 63 sectors/track, 6527 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Device Boot Start End Blocks Id System
/dev/sda1 * 1 13 104391 83 Linux
/dev/sda2 14 2610 20860402+ 8e Linux LVM
/dev/sda3 2611 3916 10490445 8e Linux LVM
Command (m for help): n
Command action
e extended
p primary partition (1-4)
p
Invalid partition number for type `4'
Command action
e extended
p primary partition (1-4)
p
Selected partition 4
First cylinder (3917-6527, default 3917):
Using default value 3917
Last cylinder or +size or +sizeM or +sizeK (3917-6527, default 6527):
Using default value 6527
Command (m for help): w
The partition table has been altered!
[root@localhost dev]# fdisk -l
Disk /dev/sda: 53.6 GB, 53687091200 bytes
255 heads, 63 sectors/track, 6527 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Device Boot Start End Blocks Id System
/dev/sda1 * 1 13 104391 83 Linux
/dev/sda2 14 2610 20860402+ 8e Linux LVM
/dev/sda3 2611 3916 10490445 8e Linux LVM
/dev/sda4 3917 6527 20972857+ 83 Linux
추가된 파티션을 포맷후 사용하기위해서는 OS 재기동 필요
재기동 후 mkfs 명령어를 이용하여 포맷진행
[root@localhost ~]# mkfs.ext2 /dev/sda4
mke2fs 1.39 (29-May-2006)
warning: 334 blocks unused.
Filesystem label=
OS type: Linux
Block size=4096 (log=2)
Fragment size=4096 (log=2)
2626560 inodes, 5242880 blocks
262160 blocks (5.00%) reserved for the super user
First data block=0
Maximum filesystem blocks=4294967296
160 block groups
32768 blocks per group, 32768 fragments per group
16416 inodes per group
Superblock backups stored on blocks:
32768, 98304, 163840, 229376, 294912, 819200, 884736, 1605632, 2654208,
4096000
Writing inode tables: done
Writing superblocks and filesystem accounting information: done
This filesystem will be automatically checked every 32 mounts or
180 days, whichever comes first. Use tune2fs -c or -i to override.
포맷된 파티션을 마운트
[root@localhost ~]# mount /dev/sda4 /oradata
[root@localhost ~]# df -h
Filesystem Size Used Avail Use% Mounted on
/dev/mapper/VolGroup00-LogVol00
25G 23G 493M 98% /
/dev/sda1 99M 13M 82M 14% /boot
tmpfs 2.0G 0 2.0G 0% /dev/shm
/dev/sda4 20G 44M 19G 1% /oradata
DB 접속하여 순차적으로 dbf 파일을 신규 파티션으로 이동한다.
SQL> alter tablespace ts_damo offline;
Tablespace altered.
SQL> !cp /oracle/base/oradata/ORA11/tsdamo.dbf /oradata
SQL> alter tablespace ts_damo rename datafile '/oracle/base/oradata/ORA11/tsdamo.dbf' to '/oradata/tsdamo.dbf';
Tablespace altered.
SQL> alter tablespace ts_damo online;
Tablespace altered.
SQL> conn damo/damo
Connected.
SQL> select gc from dual;
GC
--------------------------------------------------------------------------------
MBIEELlsqsBIfUa1hYHAMnsjoXI=
[oracle@/oracle/base/oradata/ORA11]$df -h
Filesystem Size Used Avail Use% Mounted on
/dev/mapper/VolGroup00-LogVol00
25G 17G 6.2G 74% /
/dev/sda1 99M 13M 82M 14% /boot
tmpfs 2.0G 527M 1.5G 27% /dev/shm
/dev/sda4 20G 3.5G 16G 19% /oradata
재기동시 자동 마운트를 위해 /etc/fstab 에 등록
UUID 확인
[oracle@/oracle/base/oradata/ORA11]$blkid
/dev/mapper/VolGroup00-LogVol01: TYPE="swap"
/dev/mapper/VolGroup00-LogVol00: UUID="9ae555ac-e3ba-409f-857d-ba9b8f296cdc" TYPE="ext3"
/dev/sda1: LABEL="/boot" UUID="ef945aaf-c2bc-432f-9f32-8b8149263f4e" TYPE="ext3" SEC_TYPE="ext2"
/dev/hdc: LABEL="VMware Tools" TYPE="iso9660"
/dev/VolGroup00/LogVol00: UUID="9ae555ac-e3ba-409f-857d-ba9b8f296cdc" TYPE="ext3"
/dev/VolGroup00/LogVol01: TYPE="swap"
/dev/sda4: UUID="d8646b5c-c333-4c33-87c7-199ee3f0eea2" TYPE="ext2"
/etc/fstab 에 내용추가
UUID=d8646b5c-c333-4c33-87c7-199ee3f0eea2 /oradata ext2 defaults 0 0
재부팅 후 정상적으로 자동으로 마운트가 되는지 확인
[root@localhost oradata]# init 6
[root@localhost oradata]# Connection to 192.168.174.129 closed by remote host.
Connection to 192.168.174.129 closed.
✘
───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
[2022-02-08 09:27.25] ~
[leecb.DESKTOP-P9ABQBO] ➤ ssh oracle@192.168.174.129
Last login: Mon Feb 7 17:40:33 2022 from 192.168.174.1
[oracle@/oracle]$df -h
Filesystem Size Used Avail Use% Mounted on
/dev/mapper/VolGroup00-LogVol00
25G 17G 6.2G 74% /
/dev/sda1 99M 13M 82M 14% /boot
tmpfs 2.0G 0 2.0G 0% /dev/shm
/dev/sda4 20G 3.5G 16G 19% /oradata
[oracle@/oracle]$sqlplus / as sysdba
SQL*Plus: Release 11.2.0.3.0 Production on Tue Feb 8 09:30:00 2022
Copyright (c) 1982, 2011, Oracle. All rights reserved.
Connected to an idle instance.
SQL> startup
ORACLE instance started.
Total System Global Area 839282688 bytes
Fixed Size 2233000 bytes
Variable Size 704646488 bytes
Database Buffers 125829120 bytes
Redo Buffers 6574080 bytes
Database mounted.
Database opened.
SQL> select damo.gc from dual;
GC
--------------------------------------------------------------------------------
MBIEECbDg0/Qn+RxTlwQKNMLe0M=
-------------------------------------------------------------------------------------------------------
System tablespace, undo tablespace 이동
db 다운 후 mount 상태로 startup
SQL> startup mount;
ORACLE instance started.
Total System Global Area 839282688 bytes
Fixed Size 2233000 bytes
Variable Size 675286360 bytes
Database Buffers 155189248 bytes
Redo Buffers 6574080 bytes
Database mounted.
SQL> select status from v$instance;
STATUS
------------
MOUNTED
테이블스페이스 상태 확인
SQL> select name, status from v$datafile;
NAME
--------------------------------------------------------------------------------
STATUS
-------
/oracle/base/oradata/ORA11/system01.dbf
SYSTEM
/oracle/base/oradata/ORA11/sysaux01.dbf
ONLINE
/oracle/base/oradata/ORA11/undotbs01.dbf
ONLINE
NAME
--------------------------------------------------------------------------------
STATUS
-------
/oracle/base/oradata/ORA11/users01.dbf
ONLINE
/oradata/tsdamo.dbf
ONLINE
/oracle/base/oradata/ORA11/tpch.dbf
ONLINE
6 rows selected.
테이블스페이스 파일 이관대상 디스크(디렉토리)로 복사
SQL> !cp -av /oracle/base/oradata/ORA11/system01.dbf /oradata
`/oracle/base/oradata/ORA11/system01.dbf' -> `/oradata/system01.dbf'
SQL> !cp -av /oracle/base/oradata/ORA11/sysaux01.dbf /oradata
`/oracle/base/oradata/ORA11/sysaux01.dbf' -> `/oradata/sysaux01.dbf'
SQL> !cp -av /oracle/base/oradata/ORA11/undotbs01.dbf /oradata
`/oracle/base/oradata/ORA11/undotbs01.dbf' -> `/oradata/undotbs01.dbf'
SQL> !cp -av /oracle/base/oradata/ORA11/users01.dbf /oradata
`/oracle/base/oradata/ORA11/users01.dbf' -> `/oradata/users01.dbf'
데이터베이스 리네임 진행
SQL> alter database rename file '/oracle/base/oradata/ORA11/system01.dbf'
2 to '/oradata/system01.dbf';
Database altered.
SQL> alter database rename file '/oracle/base/oradata/ORA11/sysaux01.dbf'
2 to '/oradata/sysaux01.dbf';
Database altered.
SQL> alter database rename file '/oracle/base/oradata/ORA11/undotbs01.dbf'
2 to '/oradata/undotbs01.dbf';
Database altered.
SQL> alter database rename file '/oracle/base/oradata/ORA11/users01.dbf'
2 to '/oradata/users01.dbf';
Database altered.
Database open 후 변경되었는지 확인
SQL> alter database open;
Database altered.
SQL> select name, status from v$datafile;
NAME
--------------------------------------------------------------------------------
STATUS
-------
/oradata/system01.dbf
SYSTEM
/oradata/sysaux01.dbf
ONLINE
/oradata/undotbs01.dbf
ONLINE
NAME
--------------------------------------------------------------------------------
STATUS
-------
/oradata/users01.dbf
ONLINE
/oradata/tsdamo.dbf
ONLINE
/oracle/base/oradata/ORA11/tpch.dbf
ONLINE
6 rows selected.
'DB' 카테고리의 다른 글
MSSQL 2019 설치 및 SSMS 설치 (0) | 2022.12.01 |
---|---|
CUBRID 9.3.6 Left outer join 이슈 (0) | 2022.11.15 |
FBI (Function-Based Index) 조회 테스트 (0) | 2022.11.15 |
ORACLE MAX_STRING_SIZE 변경 (0) | 2022.11.02 |
Oracle 통계정보 수집 (0) | 2022.10.21 |