💡
1. data file 이름을 변경할 때
2. data file 을 다른 위치로 변경할 때
3. 실수로 data file 을 rm 으로 삭제해서 db 가 안올라올 때
4. data file 이 손상되어서 복구가 필요할 때
select tablespace_name, status
from dba_tablespaces;
SCOTT @ ora19dw > create table emp501
tablespace ts01
as
select * from emp;
테이블이 생성되었습니다.
SCOTT @ ora19dw > select count(*) from emp501;
COUNT(*)
----------
14
alter tablespace ts01 offline;
select tablespace_name, status
from dba_tablespaces;
offline 시켰기 때문에 조회되지 않음
select *
from scott.emp501;
2행에 오류:
ORA-00376: 현재 파일 5를 읽을 수 없습니다 ORA-01110: 5
데이터 파일: '/home/oracle/ts01.dbf'
alter tablespace ts01 online;
select tablespace_name, status
from dba_tablespaces;
-- 다시 조회됨
select *
from scott.emp501;
[oracle@ora19c admin]$ cd
[oracle@ora19c ~]$ pwd
/home/oracle
[oracle@ora19c ~]$ mkdir kbm
[oracle@ora19c ~]$
[oracle@ora19c ~]$ ls -ld kbm
drwxr-xr-x. 2 oracle oinstall 6 9월 1 14:46 kbm
[oracle@ora19c ~]$
SYS @ ora19dw > @ts
TABLESPACE FILE_NAME MB_SIZE
---------- ------------------------------------------------------- -------
SYSAUX /u01/app/oracle/oradata/ORA19DW/sysaux01.dbf 560
SYSTEM /u01/app/oracle/oradata/ORA19DW/system01.dbf 950
TEST_BIG /u01/app/oracle/oradata/ORA19DW/test_big01.dbf 20
TS01 /u01/app/oracle/oradata/ORA19DW/ts01.dbf 2
TS02 /u01/app/oracle/oradata/ORA19DW/ts02.dbf 40
TS03 /u01/app/oracle/oradata/ORA19DW/ts03.dbf 20
TS04 /u01/app/oracle/oradata/ORA19DW/ts04.dbf 30
TS07 /u01/app/oracle/oradata/ORA19DW/ts07.dbf 1024
UNDOTBS1 /u01/app/oracle/oradata/ORA19DW/undotbs01.dbf 340
USERS /u01/app/oracle/oradata/ORA19DW/users01.dbf 36
10 행이 선택되었습니다.
SYS @ ora19dw > @ts
TABLESPACE FILE_NAME MB_SIZE
---------- ------------------------------------------------------- -------
SYSAUX /home/oracle/sysaux01.dbf 570
SYSTEM /home/oracle/system01.dbf 900
TEST_BIG /home/oracle/test_big01.dbf 20
TS01 /home/oracle/ts01.dbf 2
TS02 /home/oracle/ts02.dbf 40
TS03 /home/oracle/ts03.dbf 20
TS04 /home/oracle/ts04.dbf 30
TS07 /home/oracle/ts07.dbf 1024
UNDOTBS1 /home/oracle/undotbs01.dbf 340
USERS /home/oracle/users01.dbf 36
10 행이 선택되었습니다.
SYS @ ora19dw > alter tablespace ts01 offline;
테이블스페이스가 변경되었습니다.
SYS @ ora19dw > exit;
Oracle Database 19c Enterprise Edition Release 19.0.0.0.0 - Production
Version 19.3.0.0.0에서 분리되었습니다.
[oracle@ora19c ~]$
[oracle@ora19c ~]$ mv /u01/app/oracle/oradata/ORA19DW/ts01.dbf /home/oracle/yys/ts01.dbf
[oracle@ora19c ~]$
[oracle@ora19c ~]$ sysdw
SYS @ ora19dw > alter database rename file '/u01/app/oracle/oradata/ORA19DW/ts01.dbf'
2 to '/home/oracle/kbm/ts01.dbf';
데이타베이스가 변경되었습니다.
SYS @ ora19dw > alter tablespace ts01 online;
테이블스페이스가 변경되었습니다.
SYS @ ora19dw > @ts
TABLESPACE FILE_NAME MB_SIZE
---------- ------------------------------------------------------- -------
SYSAUX /u01/app/oracle/oradata/ORA19DW/sysaux01.dbf 560
SYSTEM /u01/app/oracle/oradata/ORA19DW/system01.dbf 950
TEST_BIG /u01/app/oracle/oradata/ORA19DW/test_big01.dbf 20
TS01 /home/oracle/kbm/ts01.dbf
TS02 /u01/app/oracle/oradata/ORA19DW/ts02.dbf 40
TS03 /u01/app/oracle/oradata/ORA19DW/ts03.dbf 20
TS04 /u01/app/oracle/oradata/ORA19DW/ts04.dbf 30
TS07 /u01/app/oracle/oradata/ORA19DW/ts07.dbf 1024
UNDOTBS1 /u01/app/oracle/oradata/ORA19DW/undotbs01.dbf 340
USERS /u01/app/oracle/oradata/ORA19DW/users01.dbf 36
10 행이 선택되었습니다.
SYS @ ora19dw >
SYS @ ora19dw > select tablespace_name, status
from dba_tablespaces;
TABLESPACE STATUS
---------- ---------
SYSTEM ONLINE
SYSAUX ONLINE
UNDOTBS1 ONLINE
TEMP ONLINE
USERS ONLINE
TS01 ONLINE
TS02 ONLINE
TEST_BIG ONLINE
TS03 ONLINE
TS04 ONLINE
TS07 ONLINE
TEMP3 ONLINE
TEMP4 ONLINE
TEMP5 ONLINE
14 행이 선택되었습니다.
💡 시스템 관련 테이블스페이스(system, undo) 는 반드시 데이터베이스를 mount 하고 데이터 파일 위치를 변경하는 작업을 해야함
--> offline이 안되기 때문에
SYS @ ora19dw > @ts
TABLESPACE FILE_NAME MB_SIZE
---------- ------------------------------------------------------- -------
SYSAUX /u01/app/oracle/oradata/ORA19DW/sysaux01.dbf 560
SYSTEM /u01/app/oracle/oradata/ORA19DW/system01.dbf 950
TEST_BIG /u01/app/oracle/oradata/ORA19DW/test_big01.dbf 20
TS01 /home/oracle/kbm/ts01.dbf 2
TS02 /u01/app/oracle/oradata/ORA19DW/ts02.dbf 40
TS03 /u01/app/oracle/oradata/ORA19DW/ts03.dbf 20
TS04 /u01/app/oracle/oradata/ORA19DW/ts04.dbf 30
TS07 /u01/app/oracle/oradata/ORA19DW/ts07.dbf 1024
UNDOTBS1 /u01/app/oracle/oradata/ORA19DW/undotbs01.dbf 340
USERS /u01/app/oracle/oradata/ORA19DW/users01.dbf 36
10 행이 선택되었습니다.
SYS @ ora19dw > alter tablespace sysaux offline;
테이블스페이스가 변경되었습니다.
SYS @ ora19dw > exit;
Oracle Database 19c Enterprise Edition Release 19.0.0.0.0 - Production
Version 19.3.0.0.0에서 분리되었습니다.
[oracle@ora19c ~]$ mv /u01/app/oracle/oradata/ORA19DW/sysaux01.dbf /home/oracle/kbm/sysaux01.dbf;
[oracle@ora19c ~]$
[oracle@ora19c ~]$ sysdw
SQL*Plus: Release 19.0.0.0.0 - Production on 월 9월 1 14:58:20 2025
Version 19.3.0.0.0
Copyright (c) 1982, 2019, Oracle. All rights reserved.
다음에 접속됨:
Oracle Database 19c Enterprise Edition Release 19.0.0.0.0 - Production
Version 19.3.0.0.0
SYS @ ora19dw > alter database rename file '/u01/app/oracle/oradata/ORA19DW/sysaux01.dbf'
2 to '/home/oracle/kbm/sysaux01.dbf';
데이타베이스가 변경되었습니다.
SYS @ ora19dw > alter tablespace sysaux online;
테이블스페이스가 변경되었습니다.
SYS @ ora19dw > @ts
TABLESPACE FILE_NAME MB_SIZE
---------- ------------------------------------------------------- -------
SYSAUX /home/oracle/kbm/sysaux01.dbf 560
SYSTEM /u01/app/oracle/oradata/ORA19DW/system01.dbf 950
TEST_BIG /u01/app/oracle/oradata/ORA19DW/test_big01.dbf 20
TS01 /home/oracle/kbm/ts01.dbf 2
TS02 /u01/app/oracle/oradata/ORA19DW/ts02.dbf 40
TS03 /u01/app/oracle/oradata/ORA19DW/ts03.dbf 20
TS04 /u01/app/oracle/oradata/ORA19DW/ts04.dbf 30
TS07 /u01/app/oracle/oradata/ORA19DW/ts07.dbf 1024
UNDOTBS1 /u01/app/oracle/oradata/ORA19DW/undotbs01.dbf 340
USERS /u01/app/oracle/oradata/ORA19DW/users01.dbf 36
10 행이 선택되었습니다.
SYS @ ora19dw > select tablespace_name, status
2 from dba_tablespaces;
TABLESPACE STATUS
---------- ---------
SYSTEM ONLINE
SYSAUX ONLINE
UNDOTBS1 ONLINE
TEMP ONLINE
USERS ONLINE
TS01 ONLINE
TS02 ONLINE
TEST_BIG ONLINE
TS03 ONLINE
TS04 ONLINE
TS07 ONLINE
TABLESPACE STATUS
---------- ---------
TEMP3 ONLINE
TEMP4 ONLINE
TEMP5 ONLINE
14 행이 선택되었습니다.
SYS @ ora19dw >
💡
1. data file 이름을 변경할 때
2. data file을 다른 위치로 변경할 때
3. 실수로 data file을 rm 으로 삭제해서 db 가 안올라오거나 해당 data file을 엑세스 할 수 없을 때
4. data file이 손상되어서 복구가 필요할 때
SYS @ ora19dw > archive log list
데이터베이스 로그 모드 아카이브 모드가 아님
자동 아카이브 사용 안함으로 설정됨
아카이브 대상 USE_DB_RECOVERY_FILE_DEST
가장 오래된 온라인 로그 순서 8
현재 로그 순서 10
SYS @ ora19dw > shutdown immediate
데이터베이스가 닫혔습니다.
데이터베이스가 마운트 해제되었습니다.
ORACLE 인스턴스가 종료되었습니다.
SYS @ ora19dw >
SYS @ ora19dw > startup mount
ORACLE 인스턴스가 시작되었습니다.
Total System Global Area 2415917880 bytes
Fixed Size 8899384 bytes
Variable Size 520093696 bytes
Database Buffers 1879048192 bytes
Redo Buffers 7876608 bytes
데이터베이스가 마운트되었습니다.
SYS @ ora19dw >
SYS @ ora19dw > alter database archivelog;
데이타베이스가 변경되었습니다.
SYS @ ora19dw > alter database open;
데이타베이스가 변경되었습니다.
SYS @ ora19dw > archive log list
데이터베이스 로그 모드 아카이브 모드
자동 아카이브 사용으로 설정됨
아카이브 대상 USE_DB_RECOVERY_FILE_DEST
가장 오래된 온라인 로그 순서 7
아카이브할 다음 로그 9
현재 로그 순서 9
SYS @ ora19dw >
[oracle@ora19c ~]$ export ORACLE_SID=ora19dw
[oracle@ora19c ~]$
[oracle@ora19c ~]$ rman target /
복구 관리자: Release 19.0.0.0.0 - Production on 월 9월 1 15:05:52 2025
Version 19.3.0.0.0
Copyright (c) 1982, 2019, Oracle and/or its affiliates. All rights reserved.
대상 데이터베이스에 접속됨: ORA19DW(DBID=1004651910)
RMAN> backup database include current controlfile;
25/09/01에서 backup을(를) 시작하는 중입니다.
[oracle@ora19c ~]$ cd /home/oracle/kbm
[oracle@ora19c kbm]$ ls
ts01.dbf
[oracle@ora19c kbm]$
[oracle@ora19c kbm]$ rm ts01.dbf
[oracle@ora19c kbm]$
SCOTT @ ora19dw > select * from emp501;
select * from emp501
*
1행에 오류:
ORA-01116: 5 데이터베이스 파일 열기에 오류입니다 ORA-01110: 5
데이터 파일: '/home/oracle/kbm/ts01.dbf'
ORA-27041: 파일을 열 수 없습니다
Linux-x86_64 Error: 2: No such file or directory
Additional information: 3
SCOTT @ ora19dw > connect / as sysdba
연결되었습니다.
SYS @ ora19dw >
SYS @ ora19dw > startup force
ORACLE 인스턴스가 시작되었습니다.
Total System Global Area 2415917880 bytes
Fixed Size 8899384 bytes
Variable Size 520093696 bytes
Database Buffers 1879048192 bytes
Redo Buffers 7876608 bytes
데이터베이스가 마운트되었습니다.
ORA-01157: 데이터 5 파일을 식별 또는 잠금 할 수 없습니다- DBWR 추적 파일을
보십시오
ORA-01110: 5 데이터 파일: '/home/oracle/kbm/ts01.dbf'
SYS @ ora19dw > select status from v$instance;
STATUS
------------
MOUNTED
SYS @ ora19dw > alter database datafile 5 offline;
데이타베이스가 변경되었습니다.
SYS @ ora19dw > alter database open;
데이타베이스가 변경되었습니다.
[oracle@ora19c kbm]$ rman target /
복구 관리자: Release 19.0.0.0.0 - Production on 월 9월 1 15:20:00 2025
Version 19.3.0.0.0
Copyright (c) 1982, 2019, Oracle and/or its affiliates. All rights reserved.
대상 데이터베이스에 접속됨: ORA19DW(DBID=1004651910)
RMAN> restore datafile 5;
25/09/01에서 restore을(를) 시작하는 중입니다.
복구 카탈로그 대신 대상 데이터베이스 제어 파일을 사용하고 있습니다.
채널을 할당했습니다: ORA_DISK_1
채널 ORA_DISK_1: SID=20 장치 유형=DISK
ORA_DISK_1 채널: 데이터 파일 백업 집합 복원을 시작하는 중입니다.
채널 ORA_DISK_1: 백업 집합으로 부터 복원하기 위해서 데이터 파일(들)을 지정합니다
채널 ORA_DISK_1: 데이터 파일 00005을(를) /home/oracle/kbm/ts01.dbf(으)로 복원하는 중입니다.
채널 ORA_DISK_1: 백업 조각 /u01/app/oracle/fast_recovery_area/ORA19DW/backupset/2025_09_01/o1_mf_nnndf_TAG20250901T150613_ncbfyomh_.bkp에서 읽는 중입니다.
채널 ORA_DISK_1: 조각 핸들=/u01/app/oracle/fast_recovery_area/ORA19DW/backupset/2025_09_01/o1_mf_nnndf_TAG20250901T150613_ncbfyomh_.bkp 태그=TAG20250901T150613
채널 ORA_DISK_1: 백업 조각 1을(를) 복원했습니다.
채널 ORA_DISK_1: 복원 완료, 경과 시간: 00:00:01
25/09/01에서 restore을(를) 종료했습니다.
RMAN> recover datafile 5;
25/09/01에서 recover을(를) 시작하는 중입니다.
채널 ORA_DISK_1 사용 중
미디어 복구를 시작합니다
매체 복구 완료, 경과 시간: 00:00:00
25/09/01에서 recover을(를) 종료했습니다.