본문 바로가기

강남 아이티윌 오라클DBA과정 94기/RAC

[오라클 DBA 과정] 91일차 RAC(8) (2026-07-29)

# NON SYSTEM DATAFILE 이관
+DATA/RACDB/DATAFILE/asm_tbs.276.1239812769 -> +ASM_DG

1) 테이블스페이스 offline normal

SYS@racdb1> alter tablespace asm_tbs offline normal;



2) os level copy 할 수 없으므로 rman 이용해서 image copy를 활용해야 한다.
copy datafile '기존 asm데이터파일' to '새로운 디스크 그룹';

[oracle@rac1 ~]$ rman target/

RMAN> report schema;

using target database control file instead of recovery catalog
Report of database schema for database with db_unique_name RACDB

List of Permanent Datafiles
===========================
File Size(MB) Tablespace           RB segs Datafile Name
---- -------- -------------------- ------- ------------------------
1    910      SYSTEM               YES     +DATA/RACDB/DATAFILE/system.259.1239811659
2     0       ASM_TBS              NO      +DATA/RACDB/DATAFILE/asm_tbs.276.1239812769
3    750      SYSAUX               NO      +DATA/RACDB/DATAFILE/sysaux.260.1239202861
4    355      UNDOTBS1             YES     +DATA/RACDB/DATAFILE/undotbs1.261.1239202887
5    25       UNDOTBS2             YES     +DATA/RACDB/DATAFILE/undotbs2.267.1239203295
7    5        USERS                NO      +DATA/RACDB/DATAFILE/users.262.1239202887

List of Temporary Files
=======================
File Size(MB) Tablespace           Maxsize(MB) Tempfile Name
---- -------- -------------------- ----------- --------------------
1    39       TEMP                 32767       +DATA/RACDB/TEMPFILE/temp.266.1239202971

RMAN> copy datafile '+DATA/RACDB/DATAFILE/asm_tbs.276.1239812769' to '+ASM_DG';
list copy;

RMAN> list copy;

specification does not match any control file copy in the repository
List of Datafile Copies
=======================

Key     File S Completion Time Ckp SCN    Ckp Time        Sparse
------- ---- - --------------- ---------- --------------- ------
3       1    X 28-JUL-26       3763461    28-JUL-26       NO
        Name: +DATA/RACDB/DATAFILE/system.259.1239811659
        Tag: TAG20260728T160738

6       2    A 29-JUL-26       3793013    29-JUL-26       NO
        Name: +ASM_DG/RACDB/DATAFILE/asm_tbs.256.1239877429
        Tag: TAG20260729T102348



3) 데이터파일 rename
RMAN> alter database rename file '기존 asm 데이터파일' to '새로운 asm 데이터파일';

RMAN> alter database rename file '+DATA/RACDB/DATAFILE/asm_tbs.276.1239812769' to '+ASM_DG/RACDB/DATAFILE/asm_tbs.256.1239877429';



4) 테이블스페이스 online;

RMAN> alter tablespace asm_tbs online;



이관 완료됐는지 검증

RMAN> report schema;

Report of database schema for database with db_unique_name RACDB

List of Permanent Datafiles
===========================
File Size(MB) Tablespace           RB segs Datafile Name
---- -------- -------------------- ------- ------------------------
1    910      SYSTEM               YES     +DATA/RACDB/DATAFILE/system.259.1239811659
2    10       ASM_TBS              NO      +ASM_DG/RACDB/DATAFILE/asm_tbs.256.1239877429
3    750      SYSAUX               NO      +DATA/RACDB/DATAFILE/sysaux.260.1239202861
4    355      UNDOTBS1             YES     +DATA/RACDB/DATAFILE/undotbs1.261.1239202887
5    25       UNDOTBS2             YES     +DATA/RACDB/DATAFILE/undotbs2.267.1239203295
7    5        USERS                NO      +DATA/RACDB/DATAFILE/users.262.1239202887

List of Temporary Files
=======================
File Size(MB) Tablespace           Maxsize(MB) Tempfile Name
---- -------- -------------------- ----------- --------------------
1    39       TEMP                 32767       +DATA/RACDB/TEMPFILE/temp.266.1239202971


RMAN> select count(*) from hr.emp_asm;

  COUNT(*)
----------
       107


RMAN> select f.file_name from dba_extents e, dba_data_files f where e.file_id = f.file_id and e.segment_name = 'EMP_ASM';

FILE_NAME
--------------------------------------------------------------------------------

+ASM_DG/RACDB/DATAFILE/asm_tbs.256.1239877429


SYS@racdb1> select a.file#, b.name tbs_name, a.name file_name, a.checkpoint_change#, a.status
from v$datafile a, v$tablespace b
where a.ts# = b.ts#
order by 1;

     FILE# TBS_NAME                       FILE_NAME                                          CHECKPOINT_CHANGE# STATUS
---------- ------------------------------ -------------------------------------------------- ------------------ -------
         1 SYSTEM                         +DATA/RACDB/DATAFILE/system.259.1239811659                    3769796 SYSTEM
         2 ASM_TBS                        +ASM_DG/RACDB/DATAFILE/asm_tbs.256.1239877429                 3793389 ONLINE
         3 SYSAUX                         +DATA/RACDB/DATAFILE/sysaux.260.1239202861                    3769796 ONLINE
         4 UNDOTBS1                       +DATA/RACDB/DATAFILE/undotbs1.261.1239202887                  3769796 ONLINE
         5 UNDOTBS2                       +DATA/RACDB/DATAFILE/undotbs2.267.1239203295                  3769796 ONLINE
         7 USERS                          +DATA/RACDB/DATAFILE/users.262.1239202887                     3769796 ONLINE






컨트롤파일 trace파일 떠놓고 백업본 확인

SYS@racdb1> alter database backup controlfile to trace as '/home/oracle/create_control.txt'; -- 현재 컨트롤파일의 구조를 텍스트 파일(SQL 스크립트) 형태로 뽑아내는 기능

Database altered.

[oracle@rac1 ~]$ rman target/

Recovery Manager: Release 19.0.0.0.0 - Production on Wed Jul 29 11:04:04 2026
Version 19.3.0.0.0

Copyright (c) 1982, 2019, Oracle and/or its affiliates.  All rights reserved.

connected to target database: RACDB (DBID=1236819723)

RMAN> backup as compressed backupset database;

Starting backup at 29-JUL-26
using target database control file instead of recovery catalog
allocated channel: ORA_DISK_1
channel ORA_DISK_1: SID=56 instance=racdb1 device type=DISK
channel ORA_DISK_1: starting compressed full datafile backup set
channel ORA_DISK_1: specifying datafile(s) in backup set
input datafile file number=00001 name=+DATA/RACDB/DATAFILE/system.259.1239811659
input datafile file number=00003 name=+DATA/RACDB/DATAFILE/sysaux.260.1239202861
input datafile file number=00004 name=+DATA/RACDB/DATAFILE/undotbs1.261.1239202887
input datafile file number=00005 name=+DATA/RACDB/DATAFILE/undotbs2.267.1239203295
input datafile file number=00002 name=+ASM_DG/RACDB/DATAFILE/asm_tbs.256.1239877429
input datafile file number=00007 name=+DATA/RACDB/DATAFILE/users.262.1239202887
channel ORA_DISK_1: starting piece 1 at 29-JUL-26
channel ORA_DISK_1: finished piece 1 at 29-JUL-26
piece handle=+FRA/RACDB/BACKUPSET/2026_07_29/nnndf0_tag20260729t110424_0.275.1239879865 tag=TAG20260729T110424 comment=NONE
channel ORA_DISK_1: backup set complete, elapsed time: 00:00:35
Finished backup at 29-JUL-26

RMAN> report obsolete;

RMAN> delete obsolete;
...
RMAN-06207: warning: 1 objects could not be deleted for DISK channel(s) due
RMAN-06208:          to mismatched status.  Use CROSSCHECK command to fix status
RMAN-06210: List of Mismatched objects
RMAN-06211: ==========================
RMAN-06212:   Object Type   Filename/Handle
RMAN-06213: --------------- ---------------------------------------------------
RMAN-06214: Datafile Copy   +ASM_DG/RACDB/DATAFILE/asm_tbs.256.1239877429

위에 저런 삭제 안 된 거 뜨면 크로스체크
RMAN> crosscheck copy;

RMAN> list expired copy;

RMAN> delete expired copy;


RMAN> list backup;


List of Backup Sets
===================


BS Key  Type LV Size       Device Type Elapsed Time Completion Time
------- ---- -- ---------- ----------- ------------ ---------------
7       Full    18.89M     DISK        00:00:00     28-JUL-26
        BP Key: 7   Status: AVAILABLE  Compressed: NO  Tag: TAG20260728T163146
        Piece Name: +FRA/RACDB/AUTOBACKUP/2026_07_28/s_1239813106.287.1239813107
  SPFILE Included: Modification time: 28-JUL-26
  SPFILE db_unique_name: RACDB
  Control File Included: Ckp SCN: 3770993      Ckp time: 28-JUL-26

BS Key  Type LV Size       Device Type Elapsed Time Completion Time
------- ---- -- ---------- ----------- ------------ ---------------
10      Full    321.00M    DISK        00:00:30     29-JUL-26
        BP Key: 10   Status: AVAILABLE  Compressed: YES  Tag: TAG20260729T110424
        Piece Name: +FRA/RACDB/BACKUPSET/2026_07_29/nnndf0_tag20260729t110424_0.275.1239879865
  List of Datafiles in backup set 10
  File LV Type Ckp SCN    Ckp Time  Abs Fuz SCN Sparse Name
  ---- -- ---- ---------- --------- ----------- ------ ----
  1       Full 3796612    29-JUL-26              NO    +DATA/RACDB/DATAFILE/system.259.1239811659
  2       Full 3796612    29-JUL-26              NO    +ASM_DG/RACDB/DATAFILE/asm_tbs.256.1239877429
  3       Full 3796612    29-JUL-26              NO    +DATA/RACDB/DATAFILE/sysaux.260.1239202861
  4       Full 3796612    29-JUL-26              NO    +DATA/RACDB/DATAFILE/undotbs1.261.1239202887
  5       Full 3796612    29-JUL-26              NO    +DATA/RACDB/DATAFILE/undotbs2.267.1239203295
  7       Full 3796612    29-JUL-26              NO    +DATA/RACDB/DATAFILE/users.262.1239202887

BS Key  Type LV Size       Device Type Elapsed Time Completion Time
------- ---- -- ---------- ----------- ------------ ---------------
11      Full    18.89M     DISK        00:00:00     29-JUL-26
        BP Key: 11   Status: AVAILABLE  Compressed: NO  Tag: TAG20260729T110459
        Piece Name: +FRA/RACDB/AUTOBACKUP/2026_07_29/s_1239879899.274.1239879901
  SPFILE Included: Modification time: 24-JUL-26
  SPFILE db_unique_name: RACDB
  Control File Included: Ckp SCN: 3796635      Ckp time: 29-JUL-26




 

 

컨트롤파일 손상 시나리오

 

1. 현재 컨트롤파일 위치 확인

RMAN> select name from v$controlfile;

NAME
--------------------------------------------------------------------------------
+DATA/RACDB/CONTROLFILE/current.263.1239202955
+FRA/RACDB/CONTROLFILE/current.256.1239202957

 

 

2. DB 정상 종료 후 컨트롤파일 전부 삭제(장애 유발)

[oracle@rac1 ~]$ srvctl status database -d racdb
Instance racdb1 is running on node rac1
Instance racdb2 is running on node rac2
[oracle@rac1 ~]$ srvctl stop database -d racdb -o immediate
[oracle@rac1 ~]$ srvctl status database -d racdb
Instance racdb1 is not running on node rac1
Instance racdb2 is not running on node rac2


[oracle@rac1 ~]$ . oraenv
ORACLE_SID = [racdb1] ? +ASM1
The Oracle base remains unchanged with value /u01/app/oracle
[oracle@rac1 ~]$ asmcmd
ASMCMD> ls +DATA/RACDB/CONTROLFILE/current.263.1239202955
current.263.1239202955
ASMCMD> ls +FRA/RACDB/CONTROLFILE/current.256.1239202957
current.256.1239202957

# 컨트롤파일 장애 유발
ASMCMD> rm +DATA/RACDB/CONTROLFILE/current.263.1239202955
ASMCMD> rm +FRA/RACDB/CONTROLFILE/current.256.1239202957

 

 

3. startup 시도(nomount까지만 올라감.)

ASMCMD> exit
[oracle@rac1 ~]$ . oraenv
ORACLE_SID = [+ASM1] ? racdb1
The Oracle base remains unchanged with value /u01/app/oracle

[oracle@rac1 ~]$ sqlplus / as sysdba

SQL*Plus: Release 19.0.0.0.0 - Production on Wed Jul 29 11:13:16 2026
Version 19.3.0.0.0

Copyright (c) 1982, 2019, Oracle.  All rights reserved.

Connected to an idle instance.

SYS@racdb1> startup
ORACLE instance started.

Total System Global Area 1241513488 bytes
Fixed Size                  8896016 bytes
Variable Size             486539264 bytes
Database Buffers          738197504 bytes
Redo Buffers                7880704 bytes
ORA-00205: error in identifying control file, check alert log for more info
-- 컨트롤파일이 없기 때문에 mount시점에서 오류 발생

 

 

4. RMAN에서 컨트롤파일 복원(restore controlfile form '백업 경로';)

SYS@racdb1> exit
Disconnected from Oracle Database 19c Enterprise Edition Release 19.0.0.0.0 - Production
Version 19.3.0.0.0
[oracle@rac1 ~]$ rman target/

Recovery Manager: Release 19.0.0.0.0 - Production on Wed Jul 29 11:14:19 2026
Version 19.3.0.0.0

Copyright (c) 1982, 2019, Oracle and/or its affiliates.  All rights reserved.

connected to target database: RACDB (not mounted)


# restore controlfile from autobackup; -- 백업경로를 모를 경우(무조건 다 되는 건 아님.)
RMAN> restore controlfile from '+FRA/RACDB/AUTOBACKUP/2026_07_29/s_1239879899.274.1239879901';

Starting restore at 29-JUL-26
allocated channel: ORA_DISK_1
channel ORA_DISK_1: SID=270 instance=racdb1 device type=DISK

channel ORA_DISK_1: restoring control file
channel ORA_DISK_1: restore complete, elapsed time: 00:00:01
output file name=+DATA/RACDB/CONTROLFILE/current.263.1239880683
output file name=+FRA/RACDB/CONTROLFILE/current.256.1239880683
Finished restore at 29-JUL-26

 

 

5. mount까지 올리기

RMAN> alter database mount;

released channel: ORA_DISK_1
Statement processed

 

 

6. recover database

RMAN> recover database;

Starting recover at 29-JUL-26
Starting implicit crosscheck backup at 29-JUL-26
allocated channel: ORA_DISK_1
Crosschecked 5 objects
Finished implicit crosscheck backup at 29-JUL-26

Starting implicit crosscheck copy at 29-JUL-26
using channel ORA_DISK_1
Crosschecked 4 objects
Finished implicit crosscheck copy at 29-JUL-26

searching for all files in the recovery area
cataloging files...
cataloging done

List of Cataloged Files
=======================
File Name: +FRA/RACDB/ARCHIVELOG/2026_07_29/thread_1_seq_28.278.1239880195
File Name: +FRA/RACDB/AUTOBACKUP/2026_07_29/s_1239879899.274.1239879901

using channel ORA_DISK_1

starting media recovery

archived log for thread 1 with sequence 28 is already on disk as file +FRA/RACDB/ARCHIVELOG/2026_07_29/thread_1_seq_28.278.1239880195
archived log for thread 2 with sequence 20 is already on disk as file +DATA/RACDB/ONLINELOG/group_6.278.1239455001
archived log file name=+FRA/RACDB/ARCHIVELOG/2026_07_29/thread_1_seq_28.278.1239880195 thread=1 sequence=28
archived log file name=+DATA/RACDB/ONLINELOG/group_6.278.1239455001 thread=2 sequence=0
Finished recover at 29-JUL-26

 


7. open resetlogs

RMAN> alter database open resetlogs; -- 백업 컨트롤파일을 복원해서 복구했기 때문에 db를 resetlogs로 open해야 한다.

Statement processed



검증 및 정리

RMAN> select name from v$controlfile;

NAME
--------------------------------------------------------------------------------
+DATA/RACDB/CONTROLFILE/current.263.1239880683
+FRA/RACDB/CONTROLFILE/current.256.1239880683


[oracle@rac1 ~]$ srvctl status database -d racdb
Instance racdb1 is running on node rac1
Instance racdb2 is not running on node rac2
[oracle@rac1 ~]$ srvctl start instance -d racdb -i racdb2
[oracle@rac1 ~]$ srvctl status database -d racdb
Instance racdb1 is running on node rac1
Instance racdb2 is running on node rac2



open resetlogs 했으면 무조건 백업 다시 받기.

RMAN> backup as compressed backupset database;

RMAN> report obsolete;

RMAN> delete obsolete;

RMAN> list backup;


List of Backup Sets
===================


BS Key  Type LV Size       Device Type Elapsed Time Completion Time
------- ---- -- ---------- ----------- ------------ ---------------
13      Full    326.15M    DISK        00:00:30     29-JUL-26
        BP Key: 13   Status: AVAILABLE  Compressed: YES  Tag: TAG20260729T112255
        Piece Name: +FRA/RACDB/BACKUPSET/2026_07_29/nnndf0_tag20260729t112255_0.269.1239880977
  List of Datafiles in backup set 13
  File LV Type Ckp SCN    Ckp Time  Abs Fuz SCN Sparse Name
  ---- -- ---- ---------- --------- ----------- ------ ----
  1       Full 3803243    29-JUL-26              NO    +DATA/RACDB/DATAFILE/system.259.1239811659
  2       Full 3803243    29-JUL-26              NO    +ASM_DG/RACDB/DATAFILE/asm_tbs.256.1239877429
  3       Full 3803243    29-JUL-26              NO    +DATA/RACDB/DATAFILE/sysaux.260.1239202861
  4       Full 3803243    29-JUL-26              NO    +DATA/RACDB/DATAFILE/undotbs1.261.1239202887
  5       Full 3803243    29-JUL-26              NO    +DATA/RACDB/DATAFILE/undotbs2.267.1239203295
  7       Full 3803243    29-JUL-26              NO    +DATA/RACDB/DATAFILE/users.262.1239202887

BS Key  Type LV Size       Device Type Elapsed Time Completion Time
------- ---- -- ---------- ----------- ------------ ---------------
14      Full    19.02M     DISK        00:00:00     29-JUL-26
        BP Key: 14   Status: AVAILABLE  Compressed: NO  Tag: TAG20260729T112331
        Piece Name: +FRA/RACDB/AUTOBACKUP/2026_07_29/s_1239881011.263.1239881011
  SPFILE Included: Modification time: 29-JUL-26
  SPFILE db_unique_name: RACDB
  Control File Included: Ckp SCN: 3803272      Ckp time: 29-JUL-26




 


SPFILE 손상 시나리오

 

1. 사전 정보 기록(DBID 확보)

SYS@racdb1> show parameter spfile

NAME                                 TYPE        VALUE
------------------------------------ ----------- ------------------------------
spfile                               string      +DATA/RACDB/PARAMETERFILE/spfile.270.1239203391
                                                 

SYS@racdb1> select dbid from v$database; -- spfile 복구하면서 이걸 물어볼 때가 있으니까 기록해놓는 게 좋음.

      DBID
----------
1236819723

 

 

2. SPFILE 삭제(장애 유발)

SYS@racdb1> exit

[oracle@rac1 ~]$ srvctl stop database -d racdb
[oracle@rac1 ~]$ srvctl status database -d racdb
Instance racdb1 is not running on node rac1
Instance racdb2 is not running on node rac2

[oracle@rac1 ~]$ . oraenv
ORACLE_SID = [racdb1] ? +ASM1
The Oracle base remains unchanged with value /u01/app/oracle
[oracle@rac1 ~]$ asmcmd


ASMCMD> ls +DATA/RACDB/PARAMETERFILE/spfile.270.1239203391
spfile.270.1239203391


ASMCMD> rm +DATA/RACDB/PARAMETERFILE/spfile.270.1239203391 -- 장애 유발
ASMCMD> ls +DATA/RACDB/PARAMETERFILE/spfile.270.1239203391
ASMCMD-8002: entry 'PARAMETERFILE' does not exist in directory '+DATA/RACDB/' -- 디렉터리까지 날려버렸다.

 

 

3. startup 시도 -> 실패(파라미터 파일 자체를 못 찾음.)

[oracle@rac1 ~]$ . oraenv
ORACLE_SID = [+ASM1] ? racdb1
The Oracle base remains unchanged with value /u01/app/oracle
[oracle@rac1 ~]$ sqlplus / as sysdba

SQL*Plus: Release 19.0.0.0.0 - Production on Wed Jul 29 11:33:30 2026
Version 19.3.0.0.0

Copyright (c) 1982, 2019, Oracle.  All rights reserved.

Connected to an idle instance.

SYS@racdb1> startup
ORA-01078: failure in processing system parameters
LRM-00109: could not open parameter file '/u01/app/oracle/product/19.0.0/dbhome_1/dbs/initracdb1.ora'



4. RMAN으로 파라미터 파일 없이 강제 기동

RMAN> startup nomount -- 초기 파라미터가 없어서 오류는 나지만 열어주긴 한다.

startup failed: ORA-01078: failure in processing system parameters
LRM-00109: could not open parameter file '/u01/app/oracle/product/19.0.0/dbhome_1/dbs/initracdb1.ora'

starting Oracle instance without parameter file for retrieval of spfile
Oracle instance started

Total System Global Area    1073737800 bytes

Fixed Size                     8904776 bytes
Variable Size                276824064 bytes
Database Buffers             780140544 bytes
Redo Buffers                   7868416 bytes

 

 

5. restore 시도 ->  DBID 필요 에러

RMAN> restore spfile from autobackup;

Starting restore at 29-JUL-26
using target database control file instead of recovery catalog
allocated channel: ORA_DISK_1
channel ORA_DISK_1: SID=188 device type=DISK

RMAN-00571: ===========================================================
RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ===============
RMAN-00571: ===========================================================
RMAN-03002: failure of restore command at 07/29/2026 11:35:53
RMAN-06495: must explicitly specify DBID with SET DBID command -- dbid값 설정하라고 나옴.


RMAN> set dbid=1236819723 -- dbid값 설정해줌.

executing command: SET DBID

 

 

6. restore spfile from autobackup (자동 탐색) → 실패

RMAN> restore spfile from autobackup; -- 오토백업 받은 것을 못 찾는다. 찾아가야 한다. 찾아가기 싫으면 미리 list backup으로 찍어놓기.

Starting restore at 29-JUL-26
using channel ORA_DISK_1

channel ORA_DISK_1: looking for AUTOBACKUP on day: 20260729
channel ORA_DISK_1: looking for AUTOBACKUP on day: 20260728
channel ORA_DISK_1: looking for AUTOBACKUP on day: 20260727
channel ORA_DISK_1: looking for AUTOBACKUP on day: 20260726
channel ORA_DISK_1: looking for AUTOBACKUP on day: 20260725
channel ORA_DISK_1: looking for AUTOBACKUP on day: 20260724
channel ORA_DISK_1: looking for AUTOBACKUP on day: 20260723
channel ORA_DISK_1: no AUTOBACKUP in 7 days found
RMAN-00571: ===========================================================
RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ===============
RMAN-00571: ===========================================================
RMAN-03002: failure of restore command at 07/29/2026 11:36:59
RMAN-06172: no AUTOBACKUP found or specified handle is not a valid copy or piece

 


7. 정확한 경로 지정 -> 또 다른 에러(ASM 경로 문제)

RMAN> restore spfile from '+FRA/RACDB/AUTOBACKUP/2026_07_29/s_1239881011.263.1239881011';

Starting restore at 29-JUL-26
using channel ORA_DISK_1

channel ORA_DISK_1: restoring spfile from AUTOBACKUP +FRA/RACDB/AUTOBACKUP/2026_07_29/s_1239881011.263.1239881011
RMAN-00571: ===========================================================
RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ===============
RMAN-00571: ===========================================================
RMAN-03002: failure of restore command at 07/29/2026 11:38:39
ORA-19870: error while restoring backup piece +FRA/RACDB/AUTOBACKUP/2026_07_29/s_1239881011.263.1239881011
ORA-32015: unable to restore SPFILE
ORA-17502: ksfdcre:4 Failed to create file +DATA/RACDB/PARAMETERFILE/spfile.270.1239203391
ORA-15046: ASM file name '+DATA/RACDB/PARAMETERFILE/spfile.270.1239203391' is not in single-file creation form

 


8. 우회 전략 - PFILE로 복원
백업파일 경로를 넣었는데도 restore가 안 되면 pfile로 우회해서 restore하자.

RMAN> restore spfile to pfile '/u01/app/oracle/product/19.0.0/dbhome_1/dbs/initracdb1.ora' from '+FRA/RACDB/AUTOBACKUP/2026_07_29/s_1239881011.263.1239881011';

Starting restore at 29-JUL-26
using channel ORA_DISK_1

channel ORA_DISK_1: restoring spfile from AUTOBACKUP +FRA/RACDB/AUTOBACKUP/2026_07_29/s_1239881011.263.1239881011
channel ORA_DISK_1: SPFILE restore from AUTOBACKUP complete
Finished restore at 29-JUL-26

 


9. PFILE로 기동 -> 정상 OPEN

RMAN> exit


Recovery Manager complete.
[oracle@rac1 ~]$ sqlplus / as sysdba

SQL*Plus: Release 19.0.0.0.0 - Production on Wed Jul 29 12:07:40 2026
Version 19.3.0.0.0

Copyright (c) 1982, 2019, Oracle.  All rights reserved.


Connected to:
Oracle Database 19c Enterprise Edition Release 19.0.0.0.0 - Production
Version 19.3.0.0.0

SYS@racdb1> shutdown abort
ORACLE instance shut down.
SYS@racdb1> startup
ORACLE instance started.

Total System Global Area 1241513488 bytes
Fixed Size                  8896016 bytes
Variable Size             486539264 bytes
Database Buffers          738197504 bytes
Redo Buffers                7880704 bytes
Database mounted.
Database opened.

 

 

10. SPFILE 재생성 및 DB 재기동

SYS@racdb1> create spfile='+DATA' from pfile; -- spfile 생성

File created.

SYS@racdb1> shutdown immediate
Database closed.
Database dismounted.
ORACLE instance shut down.
SYS@racdb1> startup
ORACLE instance started.

Total System Global Area 1241513488 bytes
Fixed Size                  8896016 bytes
Variable Size             486539264 bytes
Database Buffers          738197504 bytes
Redo Buffers                7880704 bytes
Database mounted.
Database opened.

SYS@racdb1> show parameter spfile -- spfile 생성 후 DB 내렸다가 올리니까 spfile로 띄워줌.

NAME                                 TYPE        VALUE
------------------------------------ ----------- ------------------------------
spfile                               string      +DATA/RACDB/PARAMETERFILE/spfi
                                                 le.270.1239883739

 


 


rac 백업본을 이용해서 clone db 생성

RMAN> list backup;


List of Backup Sets
===================


BS Key  Type LV Size       Device Type Elapsed Time Completion Time
------- ---- -- ---------- ----------- ------------ ---------------
13      Full    326.15M    DISK        00:00:30     29-JUL-26
        BP Key: 13   Status: AVAILABLE  Compressed: YES  Tag: TAG20260729T112255
        Piece Name: +FRA/RACDB/BACKUPSET/2026_07_29/nnndf0_tag20260729t112255_0.269.1239880977
  List of Datafiles in backup set 13
  File LV Type Ckp SCN    Ckp Time  Abs Fuz SCN Sparse Name
  ---- -- ---- ---------- --------- ----------- ------ ----
  1       Full 3803243    29-JUL-26              NO    +DATA/RACDB/DATAFILE/system.259.1239811659
  2       Full 3803243    29-JUL-26              NO    +ASM_DG/RACDB/DATAFILE/asm_tbs.256.1239877429
  3       Full 3803243    29-JUL-26              NO    +DATA/RACDB/DATAFILE/sysaux.260.1239202861
  4       Full 3803243    29-JUL-26              NO    +DATA/RACDB/DATAFILE/undotbs1.261.1239202887
  5       Full 3803243    29-JUL-26              NO    +DATA/RACDB/DATAFILE/undotbs2.267.1239203295
  7       Full 3803243    29-JUL-26              NO    +DATA/RACDB/DATAFILE/users.262.1239202887

BS Key  Type LV Size       Device Type Elapsed Time Completion Time
------- ---- -- ---------- ----------- ------------ ---------------
14      Full    19.02M     DISK        00:00:00     29-JUL-26
        BP Key: 14   Status: AVAILABLE  Compressed: NO  Tag: TAG20260729T112331
        Piece Name: +FRA/RACDB/AUTOBACKUP/2026_07_29/s_1239881011.263.1239881011
  SPFILE Included: Modification time: 29-JUL-26
  SPFILE db_unique_name: RACDB
  Control File Included: Ckp SCN: 3803272      Ckp time: 29-JUL-26


RMAN> list archivelog all;

List of Archived Log Copies for database with db_unique_name RACDB
=====================================================================

Key     Thrd Seq     S Low Time
------- ---- ------- - ---------
42      2    4       A 29-JUL-26
        Name: +FRA/RACDB/ARCHIVELOG/2026_07_29/thread_2_seq_4.271.1239881465



# 운영 백업본

+FRA/RACDB/BACKUPSET/2026_07_29/nnndf0_tag20260729t112255_0.269.1239880977
+FRA/RACDB/AUTOBACKUP/2026_07_29/s_1239881011.263.1239881011



# 운영 아카이브

+FRA/RACDB/ARCHIVELOG/2026_07_29/*

 

 

1. clone 디렉터리 생성

[oracle@rac1 ~]$ mkdir clone
[oracle@rac1 ~]$ cd clone/
[oracle@rac1 clone]$ pwd
/home/oracle/clone



2. 백업본을 clone 위치에 복제

[oracle@rac1 ~]$ . oraenv
ORACLE_SID = [racdb1] ? +ASM1 -- 그리드(grid) 환경
The Oracle base remains unchanged with value /u01/app/oracle
[oracle@rac1 ~]$ asmcmd
ASMCMD> cd +FRA/RACDB/BACKUPSET/2026_07_29/
ASMCMD> ls
nnndf0_TAG20260729T112255_0.269.1239880977



# 데이터파일들의 백업본을 /home/oracle/clone 위치에 복사

ASMCMD> cp * /home/oracle/clone -- 여기서 cp는 os 명령어가 아니다. asm명령어인데, os에서 쓰던 거를 여기서도 쓸 수 있게 호환성을 맞춰준 것.
copying +FRA/RACDB/BACKUPSET/2026_07_29/nnndf0_TAG20260729T112255_0.269.1239880977 -> /home/oracle/clone/nnndf0_TAG20260729T112255_0.269.1239880977

ASMCMD> cd +FRA/RACDB/AUTOBACKUP/2026_07_29
ASMCMD> pwd
+FRA/RACDB/AUTOBACKUP/2026_07_29
ASMCMD> ls
s_1239881011.263.1239881011



# 컨트롤 파일 백업본을 /home/oracle/clone 위치에 복사

ASMCMD> cp * /home/oracle/clone
copying +FRA/RACDB/AUTOBACKUP/2026_07_29/s_1239881011.263.1239881011 -> /home/oracle/clone/s_1239881011.263.1239881011



# 아카이브 파일 백업본을 /home/oracle/clone 위치에 복사

ASMCMD> cd +FRA/RACDB/ARCHIVELOG/2026_07_29/
ASMCMD> pwd
+FRA/RACDB/ARCHIVELOG/2026_07_29
ASMCMD> ls
thread_1_seq_2.272.1239889685
thread_2_seq_4.271.1239881465

ASMCMD> cp * /home/oracle/clone
copying +FRA/RACDB/ARCHIVELOG/2026_07_29/thread_2_seq_4.271.1239881465 -> /home/oracle/clone/thread_2_seq_4.271.1239881465
copying +FRA/RACDB/ARCHIVELOG/2026_07_29/thread_1_seq_2.272.1239889685 -> /home/oracle/clone/thread_1_seq_2.272.1239889685
ASMCMD>exit



# clone DB용 파라미터 파일(pfile) 작성

[oracle@rac1 ~]$ . oraenv
ORACLE_SID = [+ASM1] ? racdb1
The Oracle base remains unchanged with value /u01/app/oracle
[oracle@rac1 ~]$ echo $ORACLE_HOME
/u01/app/oracle/product/19.0.0/dbhome_1
[oracle@rac1 ~]$ ls clone
nnndf0_TAG20260729T112255_0.269.1239880977  s_1239881011.263.1239881011  thread_1_seq_2.272.1239889685  thread_2_seq_4.271.1239881465
[oracle@rac1 ~]$

[oracle@rac1 ~]$ cd clone
[oracle@rac1 clone]$ vi initclone.ora -- 아래 거 복붙

*.compatible='19.0.0'
*.control_files='/home/oracle/clone/control01.ctl'
*.db_name='clone'
*.log_archive_dest_1='location=/home/oracle/clone'
*.undo_tablespace='UNDOTBS1'
_no_recovery_through_resetlogs=true



3. ORACLE_SID를 'clone'으로 전환 후 pfile로 NOMOUNT

[oracle@rac1 clone]$ cd
[oracle@rac1 ~]$ echo $ORACLE_HOME
/u01/app/oracle/product/19.0.0/dbhome_1
[oracle@rac1 ~]$ . oraenv
ORACLE_SID = [racdb1] ? clone
ORACLE_HOME = [/home/oracle] ? /u01/app/oracle/product/19.0.0/dbhome_1
The Oracle base remains unchanged with value /u01/app/oracle

[oracle@rac1 ~]$ sqlplus / as sysdba

SQL*Plus: Release 19.0.0.0.0 - Production on Wed Jul 29 14:06:41 2026
Version 19.3.0.0.0

Copyright (c) 1982, 2019, Oracle.  All rights reserved.

Connected to an idle instance.

SYS@clone> startup pfile=/home/oracle/clone/initclone.ora nomount
ORACLE instance started.

Total System Global Area  297794752 bytes
Fixed Size                  8895680 bytes
Variable Size             230686720 bytes
Database Buffers           50331648 bytes
Redo Buffers                7880704 bytes

 

 

4. RMAN AUXILIARY 접속 후 DUPLICATE 명령

SYS@clone> exit
Disconnected from Oracle Database 19c Enterprise Edition Release 19.0.0.0.0 - Production
Version 19.3.0.0.0

[oracle@rac1 ~]$ rman auxiliary /

Recovery Manager: Release 19.0.0.0.0 - Production on Wed Jul 29 14:10:55 2026
Version 19.3.0.0.0

Copyright (c) 1982, 2019, Oracle and/or its affiliates.  All rights reserved.

connected to auxiliary database: CLONE (not mounted)


RMAN> run{
set newname for datafile 1 to '/home/oracle/clone/system01.dbf';
set newname for datafile 2 to '/home/oracle/clone/asm_tbs01.dbf';
set newname for datafile 3 to '/home/oracle/clone/sysaux01.dbf';
set newname for datafile 4 to '/home/oracle/clone/undotbs01.dbf';
set newname for tempfile 1 to '/home/oracle/clone/temp01.dbf';
duplicate target database to 'clone'
skip tablespace users, undotbs2
pfile='/home/oracle/clone/initclone.ora'
nofilenamecheck
backup location '/home/oracle/clone'
logfile
'/home/oracle/clone/redo01.log' size 50m,
'/home/oracle/clone/redo02.log' size 50m;
}

 

 

만약 오류났을 경우 dbf, ctl, log파일 삭제 후 startup pfile부터 다시 해야 한다. 
skip 때문에 오류날 가능성 큼.
아래는 오류 났을 경우 다시 하는 과정

[oracle@rac1 ~]$ sqlplus / as sysdba
sys@clone> shutdown abort
sys@clone> exit
[oracle@rac1 clone] ls
[oracle@rac1 clone] rm *.{dbf,ctl,log}
[oracle@rac1 clone] ls
[oracle@rac1 clone] sqlplus / as sysdba

sys@clone> startup pfile=initclone.ora nomount
sys@clone> exit

[oracle@rac1 clone] rman auxiliary /
RMAN> run{
set newname for datafile 1 to '/home/oracle/clone/system01.dbf';
set newname for datafile 2 to '/home/oracle/clone/asm_tbs01.dbf';
set newname for datafile 3 to '/home/oracle/clone/sysaux01.dbf';
set newname for datafile 4 to '/home/oracle/clone/undotbs01.dbf';
set newname for tempfile 1 to '/home/oracle/clone/temp01.dbf';
duplicate target database to 'clone'
skip tablespace users, undotbs2  <<- 안 되면 이 부분 생략
pfile='/home/oracle/clone/initclone.ora'
nofilenamecheck
backup location '/home/oracle/clone'
logfile
'/home/oracle/clone/redo01.log' size 50m,
'/home/oracle/clone/redo02.log' size 50m;
}

RMAN> select tablespace_name
from dba_tablespaces
where tablespace_name in ('USERS', 'UNDOTBS2');

no rows selected


SYS@clone> select file#, name
from v$datafile
order by file#;

 FILE# NAME
---------- ----------------------------------------
         1 /home/oracle/clone/system01.dbf
         2 /home/oracle/clone/asm_tbs01.dbf
         3 /home/oracle/clone/sysaux01.dbf
         4 /home/oracle/clone/undotbs01.dbf


RMAN> select name, open_mode from v$database;

NAME      OPEN_MODE
--------- --------------------
CLONE     READ WRITE