# 요약
  << 시나리오 >> control file 손상
<< 시나리오 >> control file 손상, AutoBackup
- rman target /
- shutdown abort
- startup nomount
- restore controlfile from autobackup; 또는 from '파일위치';
- alter database mount;
- recover database;
- alter database open resetlogs;
- backup

# Incarnations 초기화
- RMAN> list incarnation;
- RMAN> drop catalog;
- alter database backup controlfile to trace as '/*.sql';
  ㄴ Set #1. NORESETLOGS case 복사
- shutdown immediate
- startup nomount
- Set #1. NORESETLOGS case 실행
- recover database;
- alter database open;
- ALTER TABLESPACE TEMP ADD TEMPFILE ' ';
  ㄴ Trace File 내용 참고
- backup

<< 시나리오 >> 초기 파라미터 파일 손상
- rman target /
- startup nomount
- set dbid 숫자
- restore spfile from autobackup; 또는 from '파일위치';
- shutdown abort
- startup 
- conn / as sysdba
- show parameter spfile

<< 시나리오 >>  data file 손상, advise failure
<< 시나리오 >> system file 손상, repair failure
- mount
- rman target /
- list failure; & detail;
- advise failure;
- repair failure preview;
- repair failure;
- 복구 완료 & open

<< 시나리오 >> data file, control file 손상
- nomount
- rman target /
- list failure; & detail;
- advise failure;
- repair failure preview;
- control file complete & mount
- list failure; & detail; 부터 반복
- data file complete & open resetlogs
- backup

<< 시나리오 >> control file, redo log file 손상
- nomount
- rman target /
- restore controlfile from autobackup;
- alter database mount;
- restore database;
- recover database;
- run { set until scn = 1333565;
    restore database;
    recover database;
    }
- alter database open resetlogs;
- backup

■ maxsetsize 값 조정
RMAN> show maxsetsize;
RMAN> configure maxsetsize to 600m;
RMAN> configure maxsetsize clear;
RMAN> backup database maxsetsize 800m;

■ maxpiecesize 값 조정
RMAN> configure channel device type disk maxpiecesize 600m;
RMAN> run {
    allocate channel c1 device type disk maxpiecesize 100m;
    backup database;
    }
RMAN> run {
    allocate channel c1 device type disk maxpiecesize 100m;
    backup tablespace system;
    }
RMAN> configure channel device type disk clear;

■ image copy backup
RMAN> backup as copy database;
RMAN> backup as copy current controlfile;
RMAN> list copy;
RMAN> list copy of tablespace system;
RMAN> list copy of controlfile;

<< 시나리오 >> image copy backup, Data File 손상
- mount
- rman target /
RMAN> restore database;
RMAN> recover database;
RMAN> alter database open;

RMAN> report need backup;
RMAN> backup as copy datafile 6 format '/u01/app/oracle/oradata/ora11g/insa_tbs01.dbf';

<< 시나리오 >> image copy backup, User Data File 손상
- mount
alter database datafile 6 offline;
alter database open;
RMAN> list datafilecopy all;
RMAN> switch datafile 6 to copy;
RMAN> recover datafile 6;
RMAN> sql 'alter database datafile 6 online';


- backupset : 백업 단위
    - data file
    - control file
    - archive log file
-backup piece : 백업셋의 용량제한으로 분할되는 하나의 물리적 백업 파일






<< 시나리오 >> control file 손상

  RMAN> list backup;
List of Backup Sets
===================
BS Key  Type LV Size       Device Type Elapsed Time Completion Time
------- ---- -- ---------- ----------- ------------ ---------------
44      Full    1.16G      DISK        00:00:32     29-JAN-24
        BP Key: 44   Status: AVAILABLE  Compressed: NO  Tag: TAG20240129T094416
        Piece Name: /u01/app/oracle/fast_recovery_area/ORA11G/backupset/2024_01_29/o1_mf_nnndf_TAG20240129T094416_lvfx70fc_.bkp
  List of Datafiles in backup set 44
  File LV Type Ckp SCN    Ckp Time  Name
  ---- -- ---- ---------- --------- ----
  1       Full 1272966    29-JAN-24 /u01/app/oracle/oradata/ora11g/system01.dbf
  2       Full 1272966    29-JAN-24 /u01/app/oracle/oradata/ora11g/sysaux01.dbf
  3       Full 1272966    29-JAN-24 /u01/app/oracle/oradata/ora11g/undotbs01.dbf
  4       Full 1272966    29-JAN-24 /u01/app/oracle/oradata/ora11g/users01.dbf
  5       Full 1272966    29-JAN-24 /u01/app/oracle/oradata/ora11g/example01.dbf

BS Key  Type LV Size       Device Type Elapsed Time Completion Time
------- ---- -- ---------- ----------- ------------ ---------------
45      Full    9.73M      DISK        00:00:01     29-JAN-24
        BP Key: 45   Status: AVAILABLE  Compressed: NO  Tag: TAG20240129T094451
        Piece Name: /u01/app/oracle/fast_recovery_area/ORA11G/autobackup/2024_01_29/o1_mf_s_1159523091_lvfx83vs_.bkp
  SPFILE Included: Modification time: 29-JAN-24
  SPFILE db_unique_name: ORA11G
  Control File Included: Ckp SCN: 1273492      Ckp time: 29-JAN-24


SELECT a.file#, a.name file_name, b.name tbs_name, a.status, a.checkpoint_change#
FROM v$datafile a, v$tablespace b WHERE a.ts# = b.ts#;
FILE# FILE_NAME                                          TBS_NAME   STATUS        CHECKPOINT_CHANGE#
----- -------------------------------------------------- ---------- ------------- ------------------
    1 /u01/app/oracle/oradata/ora11g/system01.dbf        SYSTEM     SYSTEM                   1272966
    2 /u01/app/oracle/oradata/ora11g/sysaux01.dbf        SYSAUX     ONLINE                   1272966
    3 /u01/app/oracle/oradata/ora11g/undotbs01.dbf       UNDOTBS    ONLINE                   1272966
    4 /u01/app/oracle/oradata/ora11g/users01.dbf         USERS      ONLINE                   1272966
    5 /u01/app/oracle/oradata/ora11g/example01.dbf       EXAMPLE    ONLINE                   1272966


SELECT name,sequence#,first_change#,first_time,next_change#,next_time
FROM v$archived_log where name is not null order by next_time;
NAME                                               SEQUENCE# FIRST_CHANGE# FIRST_TIME  NEXT_CHANGE# NEXT_TIME
-------------------------------------------------- --------- ------------- ----------- ------------ ---------
/u01/app/oracle/oradata/ora11g/redo01.log                 25       1245117 26-JAN-24        1245120 26-JAN-24
/u01/app/oracle/oradata/ora11g/redo02.log                 26       1245120 26-JAN-24        1245123 26-JAN-24
/u01/app/oracle/oradata/ora11g/redo03.log                 27       1245123 26-JAN-24     2.8147E+14


SYS@ora11g> show parameter control_files
NAME                                 TYPE        VALUE
------------------------------------ ----------- ------------------------------
control_files                        string      /u01/app/oracle/oradata/ora11g/control01.ctl



# 장애 발생
SYS@ora11g> ! rm /u01/app/oracle/oradata/ora11g/control01.ctl


alter system switch logfile;
alter system switch logfile;
alter system switch logfile;
--Thread 1 advanced to log sequence 11 (LGWR switch)
--  Current log# 2 seq# 11 mem# 0: /u01/app/oracle/oradata/ora11g/redo02.log

# 복구
  SYS@ora11g> shutdown immediate
Database closed.
ORA-00210: cannot open the specified control file
ORA-00202: control file: '/u01/app/oracle/oradata/ora11g/control01.ctl'
ORA-27041: unable to open file
Linux Error: 2: No such file or directory
Additional information: 3


SYS@ora11g> shutdown abort


[oracle@oracle ~]$ rman target /
connected to target database (not started)


RMAN> startup nomount
Oracle instance started


RMAN> list backup;
using target database control file instead of recovery catalog
RMAN-00571: ===========================================================
RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ===============
RMAN-00571: ===========================================================
RMAN-03002: failure of list command at 01/29/2024 09:57:02
ORA-01507: database not mounted

>> 백업정보는 Control File이 가지고 있기 때문에 노마운트 상태에서는 볼 수 없다.

> 최근 백업파일의 위치를 알고 있다면
/u01/app/oracle/fast_recovery_area/ORA11G/autobackup/2024_01_29/o1_mf_s_1159523091_lvfx83vs_.bkp


RMAN> restore controlfile from '/u01/app/oracle/fast_recovery_area/ORA11G/autobackup/2024_01_29/o1_mf_s_1159523091_lvfx83vs_.bkp';
Starting restore at 29-JAN-24
allocated channel: ORA_DISK_1
channel ORA_DISK_1: SID=11 device type=DISK

channel ORA_DISK_1: restoring control file
channel ORA_DISK_1: restore complete, elapsed time: 00:00:01
output file name=/u01/app/oracle/oradata/ora11g/control01.ctl
Finished restore at 29-JAN-24


RMAN> alter database mount;
database mounted
released channel: ORA_DISK_1


RMAN> recover database;
Starting recover at 29-JAN-24
Starting implicit crosscheck backup at 29-JAN-24
allocated channel: ORA_DISK_1
channel ORA_DISK_1: SID=11 device type=DISK
Crosschecked 1 objects
Finished implicit crosscheck backup at 29-JAN-24

Starting implicit crosscheck copy at 29-JAN-24
using channel ORA_DISK_1
Finished implicit crosscheck copy at 29-JAN-24

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

List of Cataloged Files
=======================
File Name: /u01/app/oracle/fast_recovery_area/ORA11G/autobackup/2024_01_25/o1_mf_s_1159194558_lv3wfgtv_.bkp
File Name: /u01/app/oracle/fast_recovery_area/ORA11G/autobackup/2024_01_25/o1_mf_s_1159197639_lv3zfqxc_.bkp
File Name: /u01/app/oracle/fast_recovery_area/ORA11G/autobackup/2024_01_25/o1_mf_s_1159201597_lv439fvt_.bkp
File Name: /u01/app/oracle/fast_recovery_area/ORA11G/autobackup/2024_01_25/o1_mf_s_1159202764_lv44fxn5_.bkp
File Name: /u01/app/oracle/fast_recovery_area/ORA11G/autobackup/2024_01_25/o1_mf_s_1159210598_lv4d2q0r_.bkp
File Name: /u01/app/oracle/fast_recovery_area/ORA11G/autobackup/2024_01_25/o1_mf_s_1159211122_lv4dm2t6_.bkp
File Name: /u01/app/oracle/fast_recovery_area/ORA11G/autobackup/2024_01_25/o1_mf_s_1159213118_lv4gkgnv_.bkp
File Name: /u01/app/oracle/fast_recovery_area/ORA11G/autobackup/2024_01_29/o1_mf_s_1159523091_lvfx83vs_.bkp
using channel ORA_DISK_1

starting media recovery
archived log for thread 1 with sequence 9 is already on disk as file /u01/app/oracle/oradata/ora11g/redo03.log
archived log for thread 1 with sequence 10 is already on disk as file /u01/app/oracle/oradata/ora11g/redo01.log
archived log for thread 1 with sequence 11 is already on disk as file /u01/app/oracle/oradata/ora11g/redo02.log
archived log file name=/home/oracle/arch1/arch_1_8_1159289804.arc thread=1 sequence=8
archived log file name=/u01/app/oracle/oradata/ora11g/redo03.log thread=1 sequence=9
archived log file name=/u01/app/oracle/oradata/ora11g/redo01.log thread=1 sequence=10
archived log file name=/u01/app/oracle/oradata/ora11g/redo02.log thread=1 sequence=11
media recovery complete, elapsed time: 00:00:00
Finished recover at 29-JAN-24


RMAN> alter database open resetlogs;

> 컨트롤파일 깨지면 무조건 resetlogs > 과거백업본 무쓸모 > 다시 백업 필수


RMAN> backup as compressed backupset database;
Starting backup at 29-JAN-24
using channel ORA_DISK_1
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=/u01/app/oracle/oradata/ora11g/system01.dbf
input datafile file number=00002 name=/u01/app/oracle/oradata/ora11g/sysaux01.dbf
input datafile file number=00005 name=/u01/app/oracle/oradata/ora11g/example01.dbf
input datafile file number=00003 name=/u01/app/oracle/oradata/ora11g/undotbs01.dbf
input datafile file number=00004 name=/u01/app/oracle/oradata/ora11g/users01.dbf
channel ORA_DISK_1: starting piece 1 at 29-JAN-24
channel ORA_DISK_1: finished piece 1 at 29-JAN-24
piece handle=/u01/app/oracle/fast_recovery_area/ORA11G/backupset/2024_01_29/o1_mf_nnndf_TAG20240129T100328_lvfyc08y_.bkp tag=TAG20240129T100328 comment=NONE
channel ORA_DISK_1: backup set complete, elapsed time: 00:00:25
Finished backup at 29-JAN-24

Starting Control File and SPFILE Autobackup at 29-JAN-24
piece handle=/u01/app/oracle/fast_recovery_area/ORA11G/autobackup/2024_01_29/o1_mf_s_1159524233_lvfyctbw_.bkp comment=NONE
Finished Control File and SPFILE Autobackup at 29-JAN-24


RMAN> report obsolete;


RMAN> delete obsolete;


RMAN> report obsolete;
RMAN retention policy will be applied to the command
RMAN retention policy is set to redundancy 1
Report of obsolete backups and copies
Type                 Key    Completion Time    Filename/Handle
-------------------- ------ ------------------ --------------------
Archive Log          85     26-JAN-24          /home/oracle/arch1/arch_1_1_1159289804.arc
Archive Log          86     26-JAN-24          /home/oracle/arch1/arch_1_2_1159289804.arc
Archive Log          87     26-JAN-24          /home/oracle/arch1/arch_1_3_1159289804.arc
Archive Log          88     26-JAN-24          /home/oracle/arch1/arch_1_4_1159289804.arc
Archive Log          90     26-JAN-24          /home/oracle/arch1/arch_1_6_1159289804.arc
Archive Log          89     26-JAN-24          /home/oracle/arch1/arch_1_5_1159289804.arc
Archive Log          91     26-JAN-24          /home/oracle/arch1/arch_1_7_1159289804.arc


RMAN> crosscheck archivelog all;


RMAN> list expired archivelog all;


RMAN> delete expired archivelog all;


RMAN> crosscheck archivelog all;
released channel: ORA_DISK_1
allocated channel: ORA_DISK_1
channel ORA_DISK_1: SID=11 device type=DISK
specification does not match any archived log in the repository


RMAN> list backup;
List of Backup Sets
===================
BS Key  Type LV Size       Device Type Elapsed Time Completion Time
------- ---- -- ---------- ----------- ------------ ---------------
46      Full    305.25M    DISK        00:00:24     29-JAN-24
        BP Key: 46   Status: AVAILABLE  Compressed: YES  Tag: TAG20240129T100328
        Piece Name: /u01/app/oracle/fast_recovery_area/ORA11G/backupset/2024_01_29/o1_mf_nnndf_TAG20240129T100328_lvfyc08y_.bkp
  List of Datafiles in backup set 46
  File LV Type Ckp SCN    Ckp Time  Name
  ---- -- ---- ---------- --------- ----
  1       Full 1275058    29-JAN-24 /u01/app/oracle/oradata/ora11g/system01.dbf
  2       Full 1275058    29-JAN-24 /u01/app/oracle/oradata/ora11g/sysaux01.dbf
  3       Full 1275058    29-JAN-24 /u01/app/oracle/oradata/ora11g/undotbs01.dbf
  4       Full 1275058    29-JAN-24 /u01/app/oracle/oradata/ora11g/users01.dbf
  5       Full 1275058    29-JAN-24 /u01/app/oracle/oradata/ora11g/example01.dbf

BS Key  Type LV Size       Device Type Elapsed Time Completion Time
------- ---- -- ---------- ----------- ------------ ---------------
47      Full    9.73M      DISK        00:00:01     29-JAN-24
        BP Key: 47   Status: AVAILABLE  Compressed: NO  Tag: TAG20240129T100353
        Piece Name: /u01/app/oracle/fast_recovery_area/ORA11G/autobackup/2024_01_29/o1_mf_s_1159524233_lvfyctbw_.bkp
  SPFILE Included: Modification time: 29-JAN-24
  SPFILE db_unique_name: ORA11G
  Control File Included: Ckp SCN: 1275082      Ckp time: 29-JAN-24



SYS@ora11g> conn / as sysdba


SELECT name,sequence#,first_change#,first_time,next_change#,next_time
FROM v$archived_log where name is not null order by next_time;
NAME                                               SEQUENCE# FIRST_CHANGE# FIRST_TIME  NEXT_CHANGE# NEXT_TIME
-------------------------------------------------- --------- ------------- ----------- ------------ ---------
/u01/app/oracle/oradata/ora11g/redo03.log                  9       1274338 29-JAN-24        1274341 29-JAN-24
/u01/app/oracle/oradata/ora11g/redo01.log                 10       1274341 29-JAN-24        1274344 29-JAN-24
/u01/app/oracle/oradata/ora11g/redo02.log                 11       1274344 29-JAN-24     2.8147E+14






<< 시나리오 >> control file 손상, AutoBackup

  # 장애 발생
SYS@ora11g> ! rm /u01/app/oracle/oradata/ora11g/control01.ctl


SYS@ora11g> alter system checkpoint;
SYS@ora11g> alter system checkpoint;
SYS@ora11g> alter system switch logfile;
--Thread 1 advanced to log sequence 2 (LGWR switch)
--  Current log# 2 seq# 2 mem# 0: /u01/app/oracle/oradata/ora11g/redo02.log

# 복구
  SYS@ora11g> shutdown immediate
Database closed.
ORA-00210: cannot open the specified control file
ORA-00202: control file: '/u01/app/oracle/oradata/ora11g/control01.ctl'
ORA-27041: unable to open file
Linux Error: 2: No such file or directory
Additional information: 3


SYS@ora11g> shutdown abort


[oracle@oracle ~]$ rman target /
connected to target database (not started)


RMAN> startup nomount;


RMAN> restore controlfile from autobackup;
Starting restore at 29-JAN-24
using channel ORA_DISK_1

recovery area destination: /u01/app/oracle/fast_recovery_area
database name (or database unique name) used for search: ORA11G
channel ORA_DISK_1: AUTOBACKUP /u01/app/oracle/fast_recovery_area/ORA11G/autobackup/2024_01_29/o1_mf_s_1159524233_lvfyctbw_.bkp found in the recovery area
AUTOBACKUP search with format "%F" not attempted because DBID was not set
channel ORA_DISK_1: restoring control file from AUTOBACKUP /u01/app/oracle/fast_recovery_area/ORA11G/autobackup/2024_01_29/o1_mf_s_1159524233_lvfyctbw_.bkp
channel ORA_DISK_1: control file restore from AUTOBACKUP complete
output file name=/u01/app/oracle/oradata/ora11g/control01.ctl
Finished restore at 29-JAN-24


RMAN> alter database mount;


RMAN> recover database;


RMAN> alter database open resetlogs;


RMAN> backup as compressed backupset database;


RMAN> list backup;

RMAN> report obsolete;

RMAN> delete obsolete;

RMAN> crosscheck archivelog all;

RMAN> list expired archivelog all;

RMAN> delete expired archivelog all;

RMAN> report obsolete;

RMAN> list backup;
List of Backup Sets
===================
BS Key  Type LV Size       Device Type Elapsed Time Completion Time
------- ---- -- ---------- ----------- ------------ ---------------
48      Full    305.27M    DISK        00:00:24     29-JAN-24
        BP Key: 48   Status: AVAILABLE  Compressed: YES  Tag: TAG20240129T101753
        Piece Name: /u01/app/oracle/fast_recovery_area/ORA11G/backupset/2024_01_29/o1_mf_nnndf_TAG20240129T101753_lvfz61k2_.bkp
  List of Datafiles in backup set 48
  File LV Type Ckp SCN    Ckp Time  Name
  ---- -- ---- ---------- --------- ----
  1       Full 1275984    29-JAN-24 /u01/app/oracle/oradata/ora11g/system01.dbf
  2       Full 1275984    29-JAN-24 /u01/app/oracle/oradata/ora11g/sysaux01.dbf
  3       Full 1275984    29-JAN-24 /u01/app/oracle/oradata/ora11g/undotbs01.dbf
  4       Full 1275984    29-JAN-24 /u01/app/oracle/oradata/ora11g/users01.dbf
  5       Full 1275984    29-JAN-24 /u01/app/oracle/oradata/ora11g/example01.dbf

BS Key  Type LV Size       Device Type Elapsed Time Completion Time
------- ---- -- ---------- ----------- ------------ ---------------
49      Full    9.73M      DISK        00:00:01     29-JAN-24
        BP Key: 49   Status: AVAILABLE  Compressed: NO  Tag: TAG20240129T101818
        Piece Name: /u01/app/oracle/fast_recovery_area/ORA11G/autobackup/2024_01_29/o1_mf_s_1159525098_lvfz6tx9_.bkp
  SPFILE Included: Modification time: 29-JAN-24
  SPFILE db_unique_name: ORA11G
  Control File Included: Ckp SCN: 1275998      Ckp time: 29-JAN-24


SELECT a.group#,b.sequence#,a.member,b.bytes/1024/1024 mb,b.archived,b.status,
    b.first_time,b.first_change#,b.next_change#
FROM v$logfile a, v$log b WHERE a.group# = b.group# ORDER BY 1;
GROUP# SEQUENCE# MEMBER                                                     MB ARCHIVED  STATUS
------ --------- -------------------------------------------------- ---------- --------- -------------
FIRST_TIME  FIRST_CHANGE# NEXT_CHANGE#
----------- ------------- ------------
     1         1 /u01/app/oracle/oradata/ora11g/redo01.log                  50 NO        CURRENT
29-JAN-24         1275812   2.8147E+14

     2         0 /u01/app/oracle/oradata/ora11g/redo02.log                  50 YES       UNUSED
                        0            0

     3         0 /u01/app/oracle/oradata/ora11g/redo03.log                  50 YES       UNUSED
                        0            0






# Incarnations 초기화
resetlogs 계속 사용 시 incarnation 누적된 정보로 오류 발생할 수 있음

# resetlogs 목록
RMAN> list incarnation;
using target database control file instead of recovery catalog
List of Database Incarnations
DB Key  Inc Key DB Name  DB ID            STATUS  Reset SCN  Reset Time
------- ------- -------- ---------------- --- ---------- ----------
1       1       ORA11G   256148331        PARENT  1          25-AUG-13
2       2       ORA11G   256148331        PARENT  635002     07-DEC-23
3       3       ORA11G   256148331        PARENT  1155932    16-JAN-24
4       4       ORA11G   256148331        PARENT  1162497    16-JAN-24
5       5       ORA11G   256148331        PARENT  1165188    17-JAN-24
6       6       ORA11G   256148331        PARENT  1171221    25-JAN-24
7       7       ORA11G   256148331        PARENT  1177479    25-JAN-24
8       8       ORA11G   256148331        PARENT  1177934    25-JAN-24
9       9       ORA11G   256148331        PARENT  1180353    25-JAN-24
10      10      ORA11G   256148331        PARENT  1244944    26-JAN-24
11      11      ORA11G   256148331        PARENT  1274588    29-JAN-24
12      12      ORA11G   256148331        CURRENT 1275812    29-JAN-24


# Incarnations 초기화
RMAN> drop catalog;
recovery catalog owner is
enter DROP CATALOG command again to confirm catalog removal


SYS@ora11g> conn / as sysdba


SYS@ora11g> alter database backup controlfile to trace as '/home/oracle/con.sql';


SYS@ora11g> shutdown immediate


[oracle@oracle ~]$ cat con.sql

>> Set #1. NORESETLOGS case 복사


SYS@ora11g> startup nomount


# 컨트롤 파일 재생성
SYS@ora11g> CREATE CONTROLFILE REUSE DATABASE "ORA11G" NORESETLOGS  ARCHIVELOG
    MAXLOGFILES 16
    MAXLOGMEMBERS 3
    MAXDATAFILES 100
    MAXINSTANCES 8
    MAXLOGHISTORY 292
LOGFILE
  GROUP 1 '/u01/app/oracle/oradata/ora11g/redo01.log'  SIZE 50M BLOCKSIZE 512,
  GROUP 2 '/u01/app/oracle/oradata/ora11g/redo02.log'  SIZE 50M BLOCKSIZE 512,
  GROUP 3 '/u01/app/oracle/oradata/ora11g/redo03.log'  SIZE 50M BLOCKSIZE 512
-- STANDBY LOGFILE
DATAFILE
  '/u01/app/oracle/oradata/ora11g/system01.dbf',
  '/u01/app/oracle/oradata/ora11g/sysaux01.dbf',
  '/u01/app/oracle/oradata/ora11g/undotbs01.dbf',
  '/u01/app/oracle/oradata/ora11g/users01.dbf',
  '/u01/app/oracle/oradata/ora11g/example01.dbf'
CHARACTER SET AL32UTF8
;

Control file created.


SYS@ora11g> recover database;
ORA-00283: recovery session canceled due to errors
ORA-00264: no recovery required

>> 복구할게 없는게 정상


SYS@ora11g> alter database open;


select * from v$log;
GROUP#    THREAD# SEQUENCE#      BYTES  BLOCKSIZE    MEMBERS ARCHIVED  STATUS        FIRST_CHANGE# FIRST_TIME
------ ---------- --------- ---------- ---------- ---------- --------- ------------- ------------- -----------
NEXT_CHANGE# NEXT_TIME
------------ ---------
     1          1         1   52428800        512          1 YES       INACTIVE            1275812 29-JAN-24
     1279099 29-JAN-24

     2          1         2   52428800        512          1 NO        CURRENT             1279099 29-JAN-24
  2.8147E+14

     3          1         0   52428800        512          1 YES       UNUSED                    0
           0

>> 기존 정보 그대로 사용 중


RMAN> list incarnation;
using target database control file instead of recovery catalog
List of Database Incarnations
DB Key  Inc Key DB Name  DB ID            STATUS  Reset SCN  Reset Time
------- ------- -------- ---------------- --- ---------- ----------
1       1       ORA11G   256148331        CURRENT 1275812    29-JAN-24


SYS@ora11g> select * from v$tempfile;
no rows selected

>>> 컨트롤 파일 재생성하면 temp file이 없다. Trace File 내용 안에 있는 명령어로 생성.


ALTER TABLESPACE TEMP ADD TEMPFILE '/u01/app/oracle/oradata/ora11g/temp01.dbf'
     SIZE 20971520  REUSE AUTOEXTEND ON NEXT 655360  MAXSIZE 32767M;


SYS@ora11g> select * from v$tempfile;
FILE# CREATION_CHANGE# CREATION_TIME        TS#     RFILE# STATUS        ENABLED          BYTES     BLOCKS
----- ---------------- ------------- ---------- ---------- ------------- ----------- ---------- ----------
CREATE_BYTES BLOCK_SIZE NAME
------------ ---------- --------------------------------------------------
    1          1279404 29-JAN-24              3          1 ONLINE        READ WRITE    20971520       2560
    20971520       8192 /u01/app/oracle/oradata/ora11g/temp01.dbf


RMAN> list backup;
specification does not match any backup in the repository

>>> 백업이 사라졌다. > control file 재생성 한거라서 지금부터 다시 백업.



RMAN> backup as compressed backupset database;


RMAN> list backup;
List of Backup Sets
===================
BS Key  Type LV Size       Device Type Elapsed Time Completion Time
------- ---- -- ---------- ----------- ------------ ---------------
3       Full    305.48M    DISK        00:00:27     29-JAN-24
        BP Key: 3   Status: AVAILABLE  Compressed: YES  Tag: TAG20240129T110008
        Piece Name: /u01/app/oracle/fast_recovery_area/ORA11G/backupset/2024_01_29/o1_mf_nnndf_TAG20240129T110008_lvg1o8cd_.bkp
  List of Datafiles in backup set 3
  File LV Type Ckp SCN    Ckp Time  Name
  ---- -- ---- ---------- --------- ----
  1       Full 1279634    29-JAN-24 /u01/app/oracle/oradata/ora11g/system01.dbf
  2       Full 1279634    29-JAN-24 /u01/app/oracle/oradata/ora11g/sysaux01.dbf
  3       Full 1279634    29-JAN-24 /u01/app/oracle/oradata/ora11g/undotbs01.dbf
  4       Full 1279634    29-JAN-24 /u01/app/oracle/oradata/ora11g/users01.dbf
  5       Full 1279634    29-JAN-24 /u01/app/oracle/oradata/ora11g/example01.dbf

BS Key  Type LV Size       Device Type Elapsed Time Completion Time
------- ---- -- ---------- ----------- ------------ ---------------
4       Full    1.03M      DISK        00:00:01     29-JAN-24
        BP Key: 4   Status: AVAILABLE  Compressed: YES  Tag: TAG20240129T110008
        Piece Name: /u01/app/oracle/fast_recovery_area/ORA11G/backupset/2024_01_29/o1_mf_ncsnf_TAG20240129T110008_lvg1pdmq_.bkp
  SPFILE Included: Modification time: 29-JAN-24
  SPFILE db_unique_name: ORA11G
  Control File Included: Ckp SCN: 1279702      Ckp time: 29-JAN-24






<< 시나리오 >> 초기 파라미터 파일 손상

  SYS@ora11g> shutdown immediate


# 장애 발생
SYS@ora11g> ! rm $ORACLE_HOME/dbs/spfileora11g.ora
SYS@ora11g> ! rm $ORACLE_HOME/dbs/initora11g.ora


SYS@ora11g> startup
ORA-01078: failure in processing system parameters
LRM-00109: could not open parameter file '/u01/app/oracle/product/11.2.0.4/db_1/dbs/initora11g.ora'

# 복구
  [oracle@oracle ~]$ rman target /
connected to target database (not started)


RMAN> startup nomount
startup failed: ORA-01078: failure in processing system parameters
LRM-00109: could not open parameter file '/u01/app/oracle/product/11.2.0.4/db_1/dbs/initora11g.ora'
starting Oracle instance without parameter file for retrieval of spfile
Oracle instance started

>> 오류가 나오지만 백업본이 있기때문에 노마운트까지 올라간다


RMAN> restore spfile from autobackup;
Starting restore at 29-JAN-24
using target database control file instead of recovery catalog
allocated channel: ORA_DISK_1
channel ORA_DISK_1: SID=171 device type=DISK

RMAN-00571: ===========================================================
RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ===============
RMAN-00571: ===========================================================
RMAN-03002: failure of restore command at 01/29/2024 11:11:56
RMAN-06495: must explicitly specify DBID with SET DBID command

>> 임시 메모리로 노마운트한거라 DBID를 몰라 오류
>> rman 접속 시 connected to target database: ORA11G (DBID=256148331)

RMAN> set dbid 256148331
executing command: SET DBID


RMAN> restore spfile from autobackup;
Starting restore at 29-JAN-24
using channel ORA_DISK_1
channel ORA_DISK_1: looking for AUTOBACKUP on day: 20240129
channel ORA_DISK_1: looking for AUTOBACKUP on day: 20240128
channel ORA_DISK_1: looking for AUTOBACKUP on day: 20240127
channel ORA_DISK_1: looking for AUTOBACKUP on day: 20240126
channel ORA_DISK_1: looking for AUTOBACKUP on day: 20240125
channel ORA_DISK_1: looking for AUTOBACKUP on day: 20240124
channel ORA_DISK_1: looking for AUTOBACKUP on day: 20240123
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 01/29/2024 11:16:21
RMAN-06172: no AUTOBACKUP found or specified handle is not a valid copy or piece

>> 자동으로 못찾아 수동으로 재수행


RMAN> restore spfile from '/u01/app/oracle/fast_recovery_area/ORA11G/autobackup/2024_01_29/o1_mf_s_1159540675_lvggfn2y_.bkp';
Starting restore at 29-JAN-24
using channel ORA_DISK_1

channel ORA_DISK_1: restoring spfile from AUTOBACKUP /u01/app/oracle/fast_recovery_area/ORA11G/autobackup/2024_01_29/o1_mf_s_1159540675_lvggfn2y_.bkp
channel ORA_DISK_1: SPFILE restore from AUTOBACKUP complete
Finished restore at 29-JAN-24


RMAN> shutdown abort


RMAN> startup 
connected to target database (not started)
Oracle instance started
database mounted
database opened


SYS@ora11g> conn / as sysdba


SYS@ora11g> show parameter spfile
NAME                                 TYPE        VALUE
------------------------------------ ----------- ------------------------------
spfile                               string      /u01/app/oracle/product/11.2.0.4/db_1/dbs/spfileora11g.ora





RMAN> show all;

CONFIGURE CONTROLFILE AUTOBACKUP OFF; # default

>> 왜 꺼져있음???? 항상 확인하자

CONFIGURE CONTROLFILE AUTOBACKUP ON;






■ advise failure
- 백업본 보유한 상태에서 data file 복구 시 사용


<< 시나리오 >>  data file 손상, advise failure

  RMAN> report schema;
Report of database schema for database with db_unique_name ORA11G
List of Permanent Datafiles
===========================
File Size(MB) Tablespace           RB segs Datafile Name
---- -------- -------------------- ------- ------------------------
1    750      SYSTEM               ***     /u01/app/oracle/oradata/ora11g/system01.dbf
2    620      SYSAUX               ***     /u01/app/oracle/oradata/ora11g/sysaux01.dbf
3    14       UNDOTBS              ***     /u01/app/oracle/oradata/ora11g/undotbs01.dbf
4    5        USERS                ***     /u01/app/oracle/oradata/ora11g/users01.dbf
5    331      EXAMPLE              ***     /u01/app/oracle/oradata/ora11g/example01.dbf

List of Temporary Files
=======================
File Size(MB) Tablespace           Maxsize(MB) Tempfile Name
---- -------- -------------------- ----------- --------------------
1    20       TEMP                 32767       /u01/app/oracle/oradata/ora11g/temp01.dbf


RMAN> list backup;
using target database control file instead of recovery catalog
List of Backup Sets
===================
BS Key  Type LV Size       Device Type Elapsed Time Completion Time
------- ---- -- ---------- ----------- ------------ ---------------
5       Full    305.73M    DISK        00:00:25     29-JAN-24
        BP Key: 5   Status: AVAILABLE  Compressed: YES  Tag: TAG20240129T113243
        Piece Name: /u01/app/oracle/fast_recovery_area/ORA11G/backupset/2024_01_29/o1_mf_nnndf_TAG20240129T113243_lvg3lcp6_.bkp
  List of Datafiles in backup set 5
  File LV Type Ckp SCN    Ckp Time  Name
  ---- -- ---- ---------- --------- ----
  1       Full 1280928    29-JAN-24 /u01/app/oracle/oradata/ora11g/system01.dbf
  2       Full 1280928    29-JAN-24 /u01/app/oracle/oradata/ora11g/sysaux01.dbf
  3       Full 1280928    29-JAN-24 /u01/app/oracle/oradata/ora11g/undotbs01.dbf
  4       Full 1280928    29-JAN-24 /u01/app/oracle/oradata/ora11g/users01.dbf
  5       Full 1280928    29-JAN-24 /u01/app/oracle/oradata/ora11g/example01.dbf

BS Key  Type LV Size       Device Type Elapsed Time Completion Time
------- ---- -- ---------- ----------- ------------ ---------------
6       Full    9.64M      DISK        00:00:01     29-JAN-24
        BP Key: 6   Status: AVAILABLE  Compressed: NO  Tag: TAG20240129T113308
        Piece Name: /u01/app/oracle/fast_recovery_area/ORA11G/autobackup/2024_01_29/o1_mf_n_1159529588_lvg3m53c_.bkp
  Control File Included: Ckp SCN: 1280959      Ckp time: 29-JAN-24


SYS@ora11g> shutdown immediate


# 장애 발생
SYS@ora11g> ! rm /u01/app/oracle/oradata/ora11g/users01.dbf


SYS@ora11g> startup
Database mounted.
ORA-01157: cannot identify/lock data file 4 - see DBWR trace file
ORA-01110: data file 4: '/u01/app/oracle/oradata/ora11g/users01.dbf'

# 복구
  [oracle@oracle ~]$ rman target /
connected to target database: ORA11G (DBID=256148331, not open)


RMAN> list failure;
using target database control file instead of recovery catalog
List of Database Failures
=========================
Failure ID Priority Status    Time Detected Summary
---------- -------- --------- ------------- -------
45         HIGH     OPEN      29-JAN-24     One or more non-system datafiles are missing
22    HIGH     OPEN      17-DEC-23     One or more non-system datafiles are offline


RMAN> list failure 45 detail;
List of Database Failures
=========================
Failure ID Priority Status    Time Detected Summary
---------- -------- --------- ------------- -------
45         HIGH     OPEN      29-JAN-24     One or more non-system datafiles are missing
  Impact: See impact for individual child failures
  List of child failures for parent failure ID 45
  Failure ID Priority Status    Time Detected Summary
  ---------- -------- --------- ------------- -------
  6706       HIGH     OPEN      29-JAN-24     Datafile 4: '/u01/app/oracle/oradata/ora11g/users01.dbf' is missing
    Impact: Some objects in tablespace USERS might be unavailable


RMAN> repair failure preview;
RMAN-00571: ===========================================================
RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ===============
RMAN-00571: ===========================================================
RMAN-03002: failure of repair command at 01/29/2024 11:54:38
RMAN-06954: REPAIR command must be preceded by ADVISE command in same session


# advize 생성
RMAN> advise failure;
List of Database Failures
=========================
Failure ID Priority Status    Time Detected Summary
---------- -------- --------- ------------- -------
45         HIGH     OPEN      29-JAN-24     One or more non-system datafiles are missing
  Impact: See impact for individual child failures
  List of child failures for parent failure ID 45
  Failure ID Priority Status    Time Detected Summary
  ---------- -------- --------- ------------- -------
  6706       HIGH     OPEN      29-JAN-24     Datafile 4: '/u01/app/oracle/oradata/ora11g/users01.dbf' is missing
    Impact: Some objects in tablespace USERS might be unavailable

analyzing automatic repair options; this may take some time
allocated channel: ORA_DISK_1
channel ORA_DISK_1: SID=171 device type=DISK
analyzing automatic repair options complete

Mandatory Manual Actions
========================
no manual actions available

Optional Manual Actions
=======================
1. If file /u01/app/oracle/oradata/ora11g/users01.dbf was unintentionally renamed or moved, restore it

Automated Repair Options
========================
Option Repair Description
------ ------------------
1      Restore and recover datafile 4
  Strategy: The repair includes complete media recovery with no data loss
  Repair script: /u01/app/oracle/diag/rdbms/ora11g/ora11g/hm/reco_3370251581.hm

>> 파일 생성하여 해당 내용 을 보여줌(preview)


# advise 내용보기
RMAN> repair failure preview;
Strategy: The repair includes complete media recovery with no data loss
Repair script: /u01/app/oracle/diag/rdbms/ora11g/ora11g/hm/reco_3370251581.hm
contents of repair script:
   # restore and recover datafile
   restore datafile 4;
   recover datafile 4;
   sql 'alter database datafile 4 online';


# advise 내용으로 복구 적용
RMAN> repair failure;
Strategy: The repair includes complete media recovery with no data loss
Repair script: /u01/app/oracle/diag/rdbms/ora11g/ora11g/hm/reco_3370251581.hm

contents of repair script:
   # restore and recover datafile
   restore datafile 4;
   recover datafile 4;
   sql 'alter database datafile 4 online';

Do you really want to execute the above repair (enter YES or NO)? y
executing repair script

Starting restore at 29-JAN-24
using channel ORA_DISK_1
channel ORA_DISK_1: starting datafile backup set restore
channel ORA_DISK_1: specifying datafile(s) to restore from backup set
channel ORA_DISK_1: restoring datafile 00004 to /u01/app/oracle/oradata/ora11g/users01.dbf
channel ORA_DISK_1: reading from backup piece /u01/app/oracle/fast_recovery_area/ORA11G/backupset/2024_01_29/o1_mf_nnndf_TAG20240129T113243_lvg3lcp6_.bkp
channel ORA_DISK_1: piece handle=/u01/app/oracle/fast_recovery_area/ORA11G/backupset/2024_01_29/o1_mf_nnndf_TAG20240129T113243_lvg3lcp6_.bkp tag=TAG20240129T113243
channel ORA_DISK_1: restored backup piece 1
channel ORA_DISK_1: restore complete, elapsed time: 00:00:01
Finished restore at 29-JAN-24

Starting recover at 29-JAN-24
using channel ORA_DISK_1
starting media recovery
media recovery complete, elapsed time: 00:00:00
Finished recover at 29-JAN-24

sql statement: alter database datafile 4 online
repair failure complete






<< 시나리오 >> system file 손상, repair failure

  SYS@ora11g> shutdown immediate

# 장애 발생
SYS@ora11g> ! rm /u01/app/oracle/oradata/ora11g/system01.dbf


SYS@ora11g> startup
Database mounted.
ORA-01157: cannot identify/lock data file 1 - see DBWR trace file
ORA-01110: data file 1: '/u01/app/oracle/oradata/ora11g/system01.dbf'

# 복구
  RMAN> report schema;
using target database control file instead of recovery catalog
Report of database schema for database with db_unique_name ORA11G
List of Permanent Datafiles
===========================
File Size(MB) Tablespace           RB segs Datafile Name
---- -------- -------------------- ------- ------------------------
1    0        SYSTEM               ***     /u01/app/oracle/oradata/ora11g/system01.dbf
2    620      SYSAUX               ***     /u01/app/oracle/oradata/ora11g/sysaux01.dbf
3    14       UNDOTBS              ***     /u01/app/oracle/oradata/ora11g/undotbs01.dbf
4    5        USERS                ***     /u01/app/oracle/oradata/ora11g/users01.dbf
5    331      EXAMPLE              ***     /u01/app/oracle/oradata/ora11g/example01.dbf

List of Temporary Files
=======================
File Size(MB) Tablespace           Maxsize(MB) Tempfile Name
---- -------- -------------------- ----------- --------------------
1    20       TEMP                 32767       /u01/app/oracle/oradata/ora11g/temp01.dbf


RMAN> list failure;
List of Database Failures
=========================
Failure ID Priority Status    Time Detected Summary
---------- -------- --------- ------------- -------
6788       CRITICAL OPEN      29-JAN-24     System datafile 1: '/u01/app/oracle/oradata/ora11g/system01.dbf' is missing


RMAN> repair failure preview;
RMAN-00571: ===========================================================
RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ===============
RMAN-00571: ===========================================================
RMAN-03002: failure of repair command at 01/29/2024 12:03:45
RMAN-06954: REPAIR command must be preceded by ADVISE command in same session


RMAN> advise failure;
List of Database Failures
=========================
Failure ID Priority Status    Time Detected Summary
---------- -------- --------- ------------- -------
6788       CRITICAL OPEN      29-JAN-24     System datafile 1: '/u01/app/oracle/oradata/ora11g/system01.dbf' is missing
22         HIGH     OPEN      17-DEC-23     One or more non-system datafiles are offline

analyzing automatic repair options; this may take some time
allocated channel: ORA_DISK_1
channel ORA_DISK_1: SID=12 device type=DISK
analyzing automatic repair options complete

Not all specified failures can currently be repaired.
The following failures must be repaired before advise for others can be given.

Failure ID Priority Status    Time Detected Summary
---------- -------- --------- ------------- -------
6788       CRITICAL OPEN      29-JAN-24     System datafile 1: '/u01/app/oracle/oradata/ora11g/system01.dbf' is missing

Mandatory Manual Actions
========================
no manual actions available

Optional Manual Actions
=======================
1. If file /u01/app/oracle/oradata/ora11g/system01.dbf was unintentionally renamed or moved, restore it

Automated Repair Options
========================
Option Repair Description
------ ------------------
1      Restore and recover datafile 1
  Strategy: The repair includes complete media recovery with no data loss
  Repair script: /u01/app/oracle/diag/rdbms/ora11g/ora11g/hm/reco_1888123032.hm


RMAN> repair failure preview;
Strategy: The repair includes complete media recovery with no data loss
Repair script: /u01/app/oracle/diag/rdbms/ora11g/ora11g/hm/reco_1888123032.hm

contents of repair script:
   # restore and recover datafile
   restore datafile 1;
   recover datafile 1;
   sql 'alter database datafile 1 online';


RMAN> repair failure;
Strategy: The repair includes complete media recovery with no data loss
Repair script: /u01/app/oracle/diag/rdbms/ora11g/ora11g/hm/reco_1888123032.hm

contents of repair script:
   # restore and recover datafile
   restore datafile 1;
   recover datafile 1;
   sql 'alter database datafile 1 online';

Do you really want to execute the above repair (enter YES or NO)? y
executing repair script
Starting restore at 29-JAN-24
using channel ORA_DISK_1
channel ORA_DISK_1: starting datafile backup set restore
channel ORA_DISK_1: specifying datafile(s) to restore from backup set
channel ORA_DISK_1: restoring datafile 00001 to /u01/app/oracle/oradata/ora11g/system01.dbf
channel ORA_DISK_1: reading from backup piece /u01/app/oracle/fast_recovery_area/ORA11G/backupset/2024_01_29/o1_mf_nnndf_TAG20240129T113243_lvg3lcp6_.bkp
channel ORA_DISK_1: piece handle=/u01/app/oracle/fast_recovery_area/ORA11G/backupset/2024_01_29/o1_mf_nnndf_TAG20240129T113243_lvg3lcp6_.bkp tag=TAG20240129T113243
channel ORA_DISK_1: restored backup piece 1
channel ORA_DISK_1: restore complete, elapsed time: 00:00:36
Finished restore at 29-JAN-24
Starting recover at 29-JAN-24
using channel ORA_DISK_1
starting media recovery
media recovery complete, elapsed time: 00:00:00
Finished recover at 29-JAN-24
sql statement: alter database datafile 1 online
repair failure complete


RMAN> report schema;
Report of database schema for database with db_unique_name ORA11G
List of Permanent Datafiles
===========================
File Size(MB) Tablespace           RB segs Datafile Name
---- -------- -------------------- ------- ------------------------
1    750      SYSTEM               ***     /u01/app/oracle/oradata/ora11g/system01.dbf
2    620      SYSAUX               ***     /u01/app/oracle/oradata/ora11g/sysaux01.dbf
3    14       UNDOTBS              ***     /u01/app/oracle/oradata/ora11g/undotbs01.dbf
4    5        USERS                ***     /u01/app/oracle/oradata/ora11g/users01.dbf
5    331      EXAMPLE              ***     /u01/app/oracle/oradata/ora11g/example01.dbf

List of Temporary Files
=======================
File Size(MB) Tablespace           Maxsize(MB) Tempfile Name
---- -------- -------------------- ----------- --------------------
1    20       TEMP                 32767       /u01/app/oracle/oradata/ora11g/temp01.dbf






<< 시나리오 >> data file, control file 손상

  SYS@ora11g> shutdown immediate


# 장애 발생

! rm /u01/app/oracle/oradata/ora11g/*.ctl
! rm /u01/app/oracle/oradata/ora11g/*.dbf


SYS@ora11g> startup
ORACLE instance started.
ORA-00205: error in identifying control file, check alert log for more info

# 복구
  SYS@ora11g> select status, instance_name from v$instance;
STATUS       INSTANCE_NAME
------------ ----------------
STARTED      ora11g


[oracle@oracle ~]$ rman target /
connected to target database: ORA11G (not mounted)


RMAN> list failure;
using target database control file instead of recovery catalog
List of Database Failures
=========================
Failure ID Priority Status    Time Detected Summary
---------- -------- --------- ------------- -------
6953       CRITICAL OPEN      29-JAN-24     Control file /u01/app/oracle/oradata/ora11g/control01.ctl is missing

>> 컨트롤파일 오류 확인


RMAN> repair failure preview;
RMAN-00571: ===========================================================
RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ===============
RMAN-00571: ===========================================================
RMAN-03002: failure of repair command at 01/29/2024 13:50:53
RMAN-06954: REPAIR command must be preceded by ADVISE command in same session


RMAN> advise failure;
List of Database Failures
=========================
Failure ID Priority Status    Time Detected Summary
---------- -------- --------- ------------- -------
6953       CRITICAL OPEN      29-JAN-24     Control file /u01/app/oracle/oradata/ora11g/control01.ctl is missing
22         HIGH     OPEN      17-DEC-23     One or more non-system datafiles are offline

analyzing automatic repair options; this may take some time
allocated channel: ORA_DISK_1
channel ORA_DISK_1: SID=171 device type=DISK
analyzing automatic repair options complete

Not all specified failures can currently be repaired.
The following failures must be repaired before advise for others can be given.

Failure ID Priority Status    Time Detected Summary
---------- -------- --------- ------------- -------
6953       CRITICAL OPEN      29-JAN-24     Control file /u01/app/oracle/oradata/ora11g/control01.ctl is missing

Mandatory Manual Actions
========================
no manual actions available

Optional Manual Actions
=======================
1. If file /u01/app/oracle/oradata/ora11g/control01.ctl was unintentionally renamed or moved, restore it
2. If this is a primary database and a standby database is available, then perform a Data Guard failover initiated from the standby

Automated Repair Options
========================
Option Repair Description
------ ------------------
1      Restore a backup control file
  Strategy: The repair includes complete media recovery with no data loss
  Repair script: /u01/app/oracle/diag/rdbms/ora11g/ora11g/hm/reco_1284600241.hm


RMAN> repair failure preview;
Strategy: The repair includes complete media recovery with no data loss
Repair script: /u01/app/oracle/diag/rdbms/ora11g/ora11g/hm/reco_1284600241.hm

contents of repair script:
   # restore control file
   restore controlfile from autobackup;
   sql 'alter database mount';


RMAN> repair failure;
Strategy: The repair includes complete media recovery with no data loss
Repair script: /u01/app/oracle/diag/rdbms/ora11g/ora11g/hm/reco_1284600241.hm

contents of repair script:
   # restore control file
   restore controlfile from autobackup;
   sql 'alter database mount';

Do you really want to execute the above repair (enter YES or NO)? y
executing repair script

Starting restore at 29-JAN-24
using channel ORA_DISK_1

recovery area destination: /u01/app/oracle/fast_recovery_area
database name (or database unique name) used for search: ORA11G
channel ORA_DISK_1: AUTOBACKUP /u01/app/oracle/fast_recovery_area/ORA11G/autobackup/2024_01_29/o1_mf_s_1159537147_lvgbzd51_.bkp found in the recovery area
AUTOBACKUP search with format "%F" not attempted because DBID was not set
channel ORA_DISK_1: restoring control file from AUTOBACKUP /u01/app/oracle/fast_recovery_area/ORA11G/autobackup/2024_01_29/o1_mf_s_1159537147_lvgbzd51_.bkp
channel ORA_DISK_1: control file restore from AUTOBACKUP complete
output file name=/u01/app/oracle/oradata/ora11g/control01.ctl
Finished restore at 29-JAN-24

sql statement: alter database mount
released channel: ORA_DISK_1
repair failure complete


RMAN> report schema;
Starting implicit crosscheck backup at 29-JAN-24
allocated channel: ORA_DISK_1
channel ORA_DISK_1: SID=171 device type=DISK
Crosschecked 5 objects
Finished implicit crosscheck backup at 29-JAN-24

Starting implicit crosscheck copy at 29-JAN-24
using channel ORA_DISK_1
Finished implicit crosscheck copy at 29-JAN-24

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

List of Cataloged Files
=======================
File Name: /u01/app/oracle/fast_recovery_area/ORA11G/backupset/2024_01_29/o1_mf_nnndf_TAG20240129T101753_lvfz61k2_.bkp
File Name: /u01/app/oracle/fast_recovery_area/ORA11G/backupset/2024_01_29/o1_mf_nnndf_TAG20240129T113243_lvg3lcp6_.bkp
File Name: /u01/app/oracle/fast_recovery_area/ORA11G/autobackup/2024_01_25/o1_mf_s_1159194558_lv3wfgtv_.bkp
File Name: /u01/app/oracle/fast_recovery_area/ORA11G/autobackup/2024_01_25/o1_mf_s_1159197639_lv3zfqxc_.bkp
File Name: /u01/app/oracle/fast_recovery_area/ORA11G/autobackup/2024_01_25/o1_mf_s_1159201597_lv439fvt_.bkp
File Name: /u01/app/oracle/fast_recovery_area/ORA11G/autobackup/2024_01_25/o1_mf_s_1159202764_lv44fxn5_.bkp
File Name: /u01/app/oracle/fast_recovery_area/ORA11G/autobackup/2024_01_25/o1_mf_s_1159210598_lv4d2q0r_.bkp
File Name: /u01/app/oracle/fast_recovery_area/ORA11G/autobackup/2024_01_25/o1_mf_s_1159211122_lv4dm2t6_.bkp
File Name: /u01/app/oracle/fast_recovery_area/ORA11G/autobackup/2024_01_25/o1_mf_s_1159213118_lv4gkgnv_.bkp
File Name: /u01/app/oracle/fast_recovery_area/ORA11G/autobackup/2024_01_29/o1_mf_s_1159523091_lvfx83vs_.bkp
File Name: /u01/app/oracle/fast_recovery_area/ORA11G/autobackup/2024_01_29/o1_mf_s_1159524233_lvfyctbw_.bkp
File Name: /u01/app/oracle/fast_recovery_area/ORA11G/autobackup/2024_01_29/o1_mf_s_1159525098_lvfz6tx9_.bkp
File Name: /u01/app/oracle/fast_recovery_area/ORA11G/autobackup/2024_01_29/o1_mf_n_1159529588_lvg3m53c_.bkp
File Name: /u01/app/oracle/fast_recovery_area/ORA11G/autobackup/2024_01_29/o1_mf_s_1159530577_lvg5wrm3_.bkp
File Name: /u01/app/oracle/fast_recovery_area/ORA11G/autobackup/2024_01_29/o1_mf_s_1159537147_lvgbzd51_.bkp

RMAN-06139: WARNING: control file is not current for REPORT SCHEMA
Report of database schema for database with db_unique_name ORA11G

List of Permanent Datafiles
===========================
File Size(MB) Tablespace           RB segs Datafile Name
---- -------- -------------------- ------- ------------------------
1    0        SYSTEM               ***     /u01/app/oracle/oradata/ora11g/system01.dbf
2    0        SYSAUX               ***     /u01/app/oracle/oradata/ora11g/sysaux01.dbf
3    0        UNDOTBS              ***     /u01/app/oracle/oradata/ora11g/undotbs01.dbf
4    0        USERS                ***     /u01/app/oracle/oradata/ora11g/users01.dbf
5    0        EXAMPLE              ***     /u01/app/oracle/oradata/ora11g/example01.dbf

List of Temporary Files
=======================
File Size(MB) Tablespace           Maxsize(MB) Tempfile Name
---- -------- -------------------- ----------- --------------------
1    20       TEMP                 32767       /u01/app/oracle/oradata/ora11g/temp01.dbf

>> 문제가 또 있다?


RMAN> list failure;
List of Database Failures
=========================
Failure ID Priority Status    Time Detected Summary
---------- -------- --------- ------------- -------
6983       CRITICAL OPEN      29-JAN-24     System datafile 1: '/u01/app/oracle/oradata/ora11g/system01.dbf' is missing
6980       CRITICAL OPEN      29-JAN-24     Control file needs media recovery
45         HIGH     OPEN      29-JAN-24     One or more non-system datafiles are missing
22         HIGH     OPEN      17-DEC-23     One or more non-system datafiles are offline

> 데이터파일 오류 확인


RMAN> advise failure;
List of Database Failures
=========================
Failure ID Priority Status    Time Detected Summary
---------- -------- --------- ------------- -------
6983       CRITICAL OPEN      29-JAN-24     System datafile 1: '/u01/app/oracle/oradata/ora11g/system01.dbf' is missing
6980       CRITICAL OPEN      29-JAN-24     Control file needs media recovery
45         HIGH     OPEN      29-JAN-24     One or more non-system datafiles are missing
22         HIGH     OPEN      17-DEC-23     One or more non-system datafiles are offline

analyzing automatic repair options; this may take some time
using channel ORA_DISK_1
analyzing automatic repair options complete

Not all specified failures can currently be repaired.
The following failures must be repaired before advise for others can be given.

Failure ID Priority Status    Time Detected Summary
---------- -------- --------- ------------- -------
6983       CRITICAL OPEN      29-JAN-24     System datafile 1: '/u01/app/oracle/oradata/ora11g/system01.dbf' is missing
6980       CRITICAL OPEN      29-JAN-24     Control file needs media recovery
45         HIGH     OPEN      29-JAN-24     One or more non-system datafiles are missing

Mandatory Manual Actions
========================
no manual actions available

Optional Manual Actions
=======================
1. If you have the correct version of the control file, then shutdown the database and replace the old control file
2. If file /u01/app/oracle/oradata/ora11g/system01.dbf was unintentionally renamed or moved, restore it
3. If file /u01/app/oracle/oradata/ora11g/sysaux01.dbf was unintentionally renamed or moved, restore it
4. If file /u01/app/oracle/oradata/ora11g/undotbs01.dbf was unintentionally renamed or moved, restore it
5. If file /u01/app/oracle/oradata/ora11g/users01.dbf was unintentionally renamed or moved, restore it
6. If file /u01/app/oracle/oradata/ora11g/example01.dbf was unintentionally renamed or moved, restore it

Automated Repair Options
========================
Option Repair Description
------ ------------------
1      Restore and recover database
  Strategy: The repair includes complete media recovery with no data loss
  Repair script: /u01/app/oracle/diag/rdbms/ora11g/ora11g/hm/reco_636661823.hm

RMAN> repair failure preview;
Strategy: The repair includes complete media recovery with no data loss
Repair script: /u01/app/oracle/diag/rdbms/ora11g/ora11g/hm/reco_636661823.hm

contents of repair script:
   # restore and recover database
   restore database;
   recover database;
   alter database open resetlogs;


RMAN> repair failure;
Strategy: The repair includes complete media recovery with no data loss
Repair script: /u01/app/oracle/diag/rdbms/ora11g/ora11g/hm/reco_636661823.hm

contents of repair script:
   # restore and recover database
   restore database;
   recover database;
   alter database open resetlogs;

Do you really want to execute the above repair (enter YES or NO)? y
executing repair script

Starting restore at 29-JAN-24
using channel ORA_DISK_1

channel ORA_DISK_1: starting datafile backup set restore
channel ORA_DISK_1: specifying datafile(s) to restore from backup set
channel ORA_DISK_1: restoring datafile 00001 to /u01/app/oracle/oradata/ora11g/system01.dbf
channel ORA_DISK_1: restoring datafile 00002 to /u01/app/oracle/oradata/ora11g/sysaux01.dbf
channel ORA_DISK_1: restoring datafile 00003 to /u01/app/oracle/oradata/ora11g/undotbs01.dbf
channel ORA_DISK_1: restoring datafile 00004 to /u01/app/oracle/oradata/ora11g/users01.dbf
channel ORA_DISK_1: restoring datafile 00005 to /u01/app/oracle/oradata/ora11g/example01.dbf
channel ORA_DISK_1: reading from backup piece /u01/app/oracle/fast_recovery_area/ORA11G/backupset/2024_01_29/o1_mf_nnndf_TAG20240129T133842_lvgbylqh_.bkp
channel ORA_DISK_1: piece handle=/u01/app/oracle/fast_recovery_area/ORA11G/backupset/2024_01_29/o1_mf_nnndf_TAG20240129T133842_lvgbylqh_.bkp tag=TAG20240129T133842
channel ORA_DISK_1: restored backup piece 1
channel ORA_DISK_1: restore complete, elapsed time: 00:00:35
Finished restore at 29-JAN-24

Starting recover at 29-JAN-24
using channel ORA_DISK_1

starting media recovery

archived log for thread 1 with sequence 2 is already on disk as file /u01/app/oracle/oradata/ora11g/redo02.log
archived log file name=/u01/app/oracle/oradata/ora11g/redo02.log thread=1 sequence=2
media recovery complete, elapsed time: 00:00:01
Finished recover at 29-JAN-24

database opened
repair failure complete


RMAN> report schema;
Report of database schema for database with db_unique_name ORA11G
List of Permanent Datafiles
===========================
File Size(MB) Tablespace           RB segs Datafile Name
---- -------- -------------------- ------- ------------------------
1    750      SYSTEM               ***     /u01/app/oracle/oradata/ora11g/system01.dbf
2    620      SYSAUX               ***     /u01/app/oracle/oradata/ora11g/sysaux01.dbf
3    14       UNDOTBS              ***     /u01/app/oracle/oradata/ora11g/undotbs01.dbf
4    5        USERS                ***     /u01/app/oracle/oradata/ora11g/users01.dbf
5    331      EXAMPLE              ***     /u01/app/oracle/oradata/ora11g/example01.dbf

List of Temporary Files
=======================
File Size(MB) Tablespace           Maxsize(MB) Tempfile Name
---- -------- -------------------- ----------- --------------------
1    20       TEMP                 32767       /u01/app/oracle/oradata/ora11g/temp01.dbf


RMAN> list backup;
List of Backup Sets
===================
BS Key  Type LV Size       Device Type Elapsed Time Completion Time
------- ---- -- ---------- ----------- ------------ ---------------
13      Full    1.17G      DISK        00:00:29     29-JAN-24
        BP Key: 13   Status: AVAILABLE  Compressed: NO  Tag: TAG20240129T143720
        Piece Name: /u01/app/oracle/fast_recovery_area/ORA11G/backupset/2024_01_29/o1_mf_nnndf_TAG20240129T143720_lvggdjlp_.bkp
  List of Datafiles in backup set 13
  File LV Type Ckp SCN    Ckp Time  Name
  ---- -- ---- ---------- --------- ----
  1       Full 1285303    29-JAN-24 /u01/app/oracle/oradata/ora11g/system01.dbf
  2       Full 1285303    29-JAN-24 /u01/app/oracle/oradata/ora11g/sysaux01.dbf
  3       Full 1285303    29-JAN-24 /u01/app/oracle/oradata/ora11g/undotbs01.dbf
  4       Full 1285303    29-JAN-24 /u01/app/oracle/oradata/ora11g/users01.dbf
  5       Full 1285303    29-JAN-24 /u01/app/oracle/oradata/ora11g/example01.dbf

BS Key  Type LV Size       Device Type Elapsed Time Completion Time
------- ---- -- ---------- ----------- ------------ ---------------
14      Full    9.67M      DISK        00:00:01     29-JAN-24
        BP Key: 14   Status: AVAILABLE  Compressed: NO  Tag: TAG20240129T143755
        Piece Name: /u01/app/oracle/fast_recovery_area/ORA11G/autobackup/2024_01_29/o1_mf_s_1159540675_lvggfn2y_.bkp
  SPFILE Included: Modification time: 29-JAN-24
  SPFILE db_unique_name: ORA11G
  Control File Included: Ckp SCN: 1285330      Ckp time: 29-JAN-24






<< 시나리오 >> control file, redo log file 손상

  SYS@ora11g> shutdown immediate

# 장애 발생
! rm /u01/app/oracle/oradata/ora11g/*.log
! rm /u01/app/oracle/oradata/ora11g/*.ctl


SYS@ora11g> startup nomount
ORACLE instance started.


SYS@ora11g> select status from v$instance;
STATUS
-------------
STARTED

# 복구
  [oracle@oracle ~]$ rman target /
connected to target database: ORA11G (not mounted)


RMAN> restore controlfile from autobackup;
Starting restore at 29-JAN-24
using target database control file instead of recovery catalog
allocated channel: ORA_DISK_1
channel ORA_DISK_1: SID=171 device type=DISK

recovery area destination: /u01/app/oracle/fast_recovery_area
database name (or database unique name) used for search: ORA11G
channel ORA_DISK_1: AUTOBACKUP /u01/app/oracle/fast_recovery_area/ORA11G/autobackup/2024_01_29/o1_mf_s_1159547756_lvgobwvy_.bkp found in the recovery area
AUTOBACKUP search with format "%F" not attempted because DBID was not set
channel ORA_DISK_1: restoring control file from AUTOBACKUP /u01/app/oracle/fast_recovery_area/ORA11G/autobackup/2024_01_29/o1_mf_s_1159547756_lvgobwvy_.bkp
channel ORA_DISK_1: control file restore from AUTOBACKUP complete
output file name=/u01/app/oracle/oradata/ora11g/control01.ctl
Finished restore at 29-JAN-24


RMAN> alter database mount;
database mounted
released channel: ORA_DISK_1


RMAN> restore database;
Starting restore at 29-JAN-24
Starting implicit crosscheck backup at 29-JAN-24
allocated channel: ORA_DISK_1
channel ORA_DISK_1: SID=171 device type=DISK
Crosschecked 1 objects
Finished implicit crosscheck backup at 29-JAN-24

Starting implicit crosscheck copy at 29-JAN-24
using channel ORA_DISK_1
Finished implicit crosscheck copy at 29-JAN-24

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

List of Cataloged Files
=======================
File Name: /u01/app/oracle/fast_recovery_area/ORA11G/autobackup/2024_01_25/o1_mf_s_1159194558_lv3wfgtv_.bkp
File Name: /u01/app/oracle/fast_recovery_area/ORA11G/autobackup/2024_01_25/o1_mf_s_1159197639_lv3zfqxc_.bkp
File Name: /u01/app/oracle/fast_recovery_area/ORA11G/autobackup/2024_01_25/o1_mf_s_1159201597_lv439fvt_.bkp
File Name: /u01/app/oracle/fast_recovery_area/ORA11G/autobackup/2024_01_25/o1_mf_s_1159202764_lv44fxn5_.bkp
File Name: /u01/app/oracle/fast_recovery_area/ORA11G/autobackup/2024_01_25/o1_mf_s_1159210598_lv4d2q0r_.bkp
File Name: /u01/app/oracle/fast_recovery_area/ORA11G/autobackup/2024_01_25/o1_mf_s_1159211122_lv4dm2t6_.bkp
File Name: /u01/app/oracle/fast_recovery_area/ORA11G/autobackup/2024_01_25/o1_mf_s_1159213118_lv4gkgnv_.bkp
File Name: /u01/app/oracle/fast_recovery_area/ORA11G/autobackup/2024_01_29/o1_mf_s_1159523091_lvfx83vs_.bkp
File Name: /u01/app/oracle/fast_recovery_area/ORA11G/autobackup/2024_01_29/o1_mf_s_1159524233_lvfyctbw_.bkp
File Name: /u01/app/oracle/fast_recovery_area/ORA11G/autobackup/2024_01_29/o1_mf_s_1159525098_lvfz6tx9_.bkp
File Name: /u01/app/oracle/fast_recovery_area/ORA11G/autobackup/2024_01_29/o1_mf_n_1159529588_lvg3m53c_.bkp
File Name: /u01/app/oracle/fast_recovery_area/ORA11G/autobackup/2024_01_29/o1_mf_s_1159530577_lvg5wrm3_.bkp
File Name: /u01/app/oracle/fast_recovery_area/ORA11G/autobackup/2024_01_29/o1_mf_s_1159537147_lvgbzd51_.bkp
File Name: /u01/app/oracle/fast_recovery_area/ORA11G/autobackup/2024_01_29/o1_mf_s_1159547756_lvgobwvy_.bkp

using channel ORA_DISK_1
channel ORA_DISK_1: starting datafile backup set restore
channel ORA_DISK_1: specifying datafile(s) to restore from backup set
channel ORA_DISK_1: restoring datafile 00001 to /u01/app/oracle/oradata/ora11g/system01.dbf
channel ORA_DISK_1: restoring datafile 00002 to /u01/app/oracle/oradata/ora11g/sysaux01.dbf
channel ORA_DISK_1: restoring datafile 00003 to /u01/app/oracle/oradata/ora11g/undotbs01.dbf
channel ORA_DISK_1: restoring datafile 00004 to /u01/app/oracle/oradata/ora11g/users01.dbf
channel ORA_DISK_1: restoring datafile 00005 to /u01/app/oracle/oradata/ora11g/example01.dbf
channel ORA_DISK_1: reading from backup piece /u01/app/oracle/fast_recovery_area/ORA11G/backupset/2024_01_29/o1_mf_nnndf_TAG20240129T163521_lvgo9spw_.bkp
channel ORA_DISK_1: piece handle=/u01/app/oracle/fast_recovery_area/ORA11G/backupset/2024_01_29/o1_mf_nnndf_TAG20240129T163521_lvgo9spw_.bkp tag=TAG20240129T163521
channel ORA_DISK_1: restored backup piece 1
channel ORA_DISK_1: restore complete, elapsed time: 00:00:35
Finished restore at 29-JAN-24


RMAN> recover database;
Starting recover at 29-JAN-24
using channel ORA_DISK_1

starting media recovery
unable to find archived log
archived log thread=1 sequence=3
RMAN-00571: ===========================================================
RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ===============
RMAN-00571: ===========================================================
RMAN-03002: failure of recover command at 01/29/2024 17:05:32
RMAN-06054: media recovery requesting unknown archived log for thread 1 with sequence 3 and starting SCN of 1333565


# rman에서의 cansel base recovery
RMAN> run { set until scn = 1333565;
    restore database;
    recover database;
    }

executing command: SET until clause

Starting restore at 29-JAN-24
using channel ORA_DISK_1
skipping datafile 1; already restored to file /u01/app/oracle/oradata/ora11g/system01.dbf
skipping datafile 2; already restored to file /u01/app/oracle/oradata/ora11g/sysaux01.dbf
skipping datafile 3; already restored to file /u01/app/oracle/oradata/ora11g/undotbs01.dbf
skipping datafile 4; already restored to file /u01/app/oracle/oradata/ora11g/users01.dbf
skipping datafile 5; already restored to file /u01/app/oracle/oradata/ora11g/example01.dbf
restore not done; all files read only, offline, or already restored
Finished restore at 29-JAN-24

Starting recover at 29-JAN-24
using channel ORA_DISK_1

starting media recovery
media recovery complete, elapsed time: 00:00:00

Finished recover at 29-JAN-24


RMAN> alter database open resetlogs;


SYS@ora11g> conn / as sysdba


SELECT a.group#,b.sequence#,a.member,b.bytes/1024/1024 mb,b.archived,b.status,
    b.first_time,b.first_change#,b.next_change#
FROM v$logfile a, v$log b WHERE a.group# = b.group# ORDER BY 1;
GROUP# SEQUENCE# MEMBER                                                     MB ARCHIVED  STATUS
------ --------- -------------------------------------------------- ---------- --------- -------------
FIRST_TIME  FIRST_CHANGE# NEXT_CHANGE#
----------- ------------- ------------
     1         1 /u01/app/oracle/oradata/ora11g/redo01.log                  50 NO        CURRENT
29-JAN-24         1333566   2.8147E+14

     2         0 /u01/app/oracle/oradata/ora11g/redo02.log                  50 YES       UNUSED
                        0            0

     3         0 /u01/app/oracle/oradata/ora11g/redo03.log                  50 YES       UNUSED
                        0            0


RMAN> backup as compressed backupset database;


RMAN> report obsolete;


RMAN> delete obsolete;






■ maxsetsize 값 조정

# maxsetsize 설정 변경
  RMAN> show maxsetsize;
RMAN configuration parameters for database with db_unique_name ORA11G are:
CONFIGURE MAXSETSIZE TO UNLIMITED; # default


# maxsetsize 
RMAN> configure maxsetsize to 600m;
new RMAN configuration parameters:
CONFIGURE MAXSETSIZE TO 600 M;
new RMAN configuration parameters are successfully stored


RMAN> show maxsetsize;
RMAN configuration parameters for database with db_unique_name ORA11G are:
CONFIGURE MAXSETSIZE TO 600 M;


RMAN> delete backup;

RMAN> backup database;
Starting backup at 29-JAN-24
using channel ORA_DISK_1
RMAN-00571: ===========================================================
RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ===============
RMAN-00571: ===========================================================
RMAN-03002: failure of backup command at 01/29/2024 15:33:54
RMAN-06183: datafile or datafile copy /u01/app/oracle/oradata/ora11g/system01.dbf (file number 1) larger than MAXSETSIZE

>> 시스템 파일이 maxsetsize 보다 크다


RMAN> report schema;
Report of database schema for database with db_unique_name ORA11G
List of Permanent Datafiles
===========================
File Size(MB) Tablespace           RB segs Datafile Name
---- -------- -------------------- ------- ------------------------
1    750      SYSTEM               ***     /u01/app/oracle/oradata/ora11g/system01.dbf
2    620      SYSAUX               ***     /u01/app/oracle/oradata/ora11g/sysaux01.dbf
3    14       UNDOTBS              ***     /u01/app/oracle/oradata/ora11g/undotbs01.dbf
4    5        USERS                ***     /u01/app/oracle/oradata/ora11g/users01.dbf
5    331      EXAMPLE              ***     /u01/app/oracle/oradata/ora11g/example01.dbf

List of Temporary Files
=======================
File Size(MB) Tablespace           Maxsize(MB) Tempfile Name
---- -------- -------------------- ----------- --------------------
1    20       TEMP                 32767       /u01/app/oracle/oradata/ora11g/temp01.dbf


RMAN> configure maxsetsize to 800m;
old RMAN configuration parameters:
CONFIGURE MAXSETSIZE TO 600 M;
new RMAN configuration parameters:
CONFIGURE MAXSETSIZE TO 800 M;
new RMAN configuration parameters are successfully stored


RMAN> backup database;
Starting backup at 29-JAN-24
using channel ORA_DISK_1
channel ORA_DISK_1: starting full datafile backup set
channel ORA_DISK_1: specifying datafile(s) in backup set
input datafile file number=00001 name=/u01/app/oracle/oradata/ora11g/system01.dbf
channel ORA_DISK_1: starting piece 1 at 29-JAN-24
channel ORA_DISK_1: finished piece 1 at 29-JAN-24
piece handle=/u01/app/oracle/fast_recovery_area/ORA11G/backupset/2024_01_29/o1_mf_nnndf_TAG20240129T153518_lvgks6k8_.bkp tag=TAG20240129T153518 comment=NONE
channel ORA_DISK_1: backup set complete, elapsed time: 00:00:15
channel ORA_DISK_1: starting full datafile backup set
channel ORA_DISK_1: specifying datafile(s) in backup set
input datafile file number=00002 name=/u01/app/oracle/oradata/ora11g/sysaux01.dbf
channel ORA_DISK_1: starting piece 1 at 29-JAN-24
channel ORA_DISK_1: finished piece 1 at 29-JAN-24
piece handle=/u01/app/oracle/fast_recovery_area/ORA11G/backupset/2024_01_29/o1_mf_nnndf_TAG20240129T153518_lvgksor9_.bkp tag=TAG20240129T153518 comment=NONE
channel ORA_DISK_1: backup set complete, elapsed time: 00:00:15
channel ORA_DISK_1: starting full datafile backup set
channel ORA_DISK_1: specifying datafile(s) in backup set
input datafile file number=00005 name=/u01/app/oracle/oradata/ora11g/example01.dbf
input datafile file number=00003 name=/u01/app/oracle/oradata/ora11g/undotbs01.dbf
input datafile file number=00004 name=/u01/app/oracle/oradata/ora11g/users01.dbf
channel ORA_DISK_1: starting piece 1 at 29-JAN-24
channel ORA_DISK_1: finished piece 1 at 29-JAN-24
piece handle=/u01/app/oracle/fast_recovery_area/ORA11G/backupset/2024_01_29/o1_mf_nnndf_TAG20240129T153518_lvgkt4y6_.bkp tag=TAG20240129T153518 comment=NONE
channel ORA_DISK_1: backup set complete, elapsed time: 00:00:07
Finished backup at 29-JAN-24

Starting Control File and SPFILE Autobackup at 29-JAN-24
piece handle=/u01/app/oracle/fast_recovery_area/ORA11G/autobackup/2024_01_29/o1_mf_s_1159544155_lvgktd8m_.bkp comment=NONE
Finished Control File and SPFILE Autobackup at 29-JAN-24


RMAN> list backup;
List of Backup Sets
===================
BS Key  Type LV Size       Device Type Elapsed Time Completion Time
------- ---- -- ---------- ----------- ------------ ---------------
15      Full    642.65M    DISK        00:00:14     29-JAN-24
        BP Key: 15   Status: AVAILABLE  Compressed: NO  Tag: TAG20240129T153518
        Piece Name: /u01/app/oracle/fast_recovery_area/ORA11G/backupset/2024_01_29/o1_mf_nnndf_TAG20240129T153518_lvgks6k8_.bkp
  List of Datafiles in backup set 15
  File LV Type Ckp SCN    Ckp Time  Name
  ---- -- ---- ---------- --------- ----
  1       Full 1308601    29-JAN-24 /u01/app/oracle/oradata/ora11g/system01.dbf

BS Key  Type LV Size       Device Type Elapsed Time Completion Time
------- ---- -- ---------- ----------- ------------ ---------------
16      Full    467.45M    DISK        00:00:10     29-JAN-24
        BP Key: 16   Status: AVAILABLE  Compressed: NO  Tag: TAG20240129T153518
        Piece Name: /u01/app/oracle/fast_recovery_area/ORA11G/backupset/2024_01_29/o1_mf_nnndf_TAG20240129T153518_lvgksor9_.bkp
  List of Datafiles in backup set 16
  File LV Type Ckp SCN    Ckp Time  Name
  ---- -- ---- ---------- --------- ----
  2       Full 1308783    29-JAN-24 /u01/app/oracle/oradata/ora11g/sysaux01.dbf

BS Key  Type LV Size       Device Type Elapsed Time Completion Time
------- ---- -- ---------- ----------- ------------ ---------------
17      Full    84.14M     DISK        00:00:04     29-JAN-24
        BP Key: 17   Status: AVAILABLE  Compressed: NO  Tag: TAG20240129T153518
        Piece Name: /u01/app/oracle/fast_recovery_area/ORA11G/backupset/2024_01_29/o1_mf_nnndf_TAG20240129T153518_lvgkt4y6_.bkp
  List of Datafiles in backup set 17
  File LV Type Ckp SCN    Ckp Time  Name
  ---- -- ---- ---------- --------- ----
  3       Full 1308794    29-JAN-24 /u01/app/oracle/oradata/ora11g/undotbs01.dbf
  4       Full 1308794    29-JAN-24 /u01/app/oracle/oradata/ora11g/users01.dbf
  5       Full 1308794    29-JAN-24 /u01/app/oracle/oradata/ora11g/example01.dbf

BS Key  Type LV Size       Device Type Elapsed Time Completion Time
------- ---- -- ---------- ----------- ------------ ---------------
18      Full    9.67M      DISK        00:00:01     29-JAN-24
        BP Key: 18   Status: AVAILABLE  Compressed: NO  Tag: TAG20240129T153555
        Piece Name: /u01/app/oracle/fast_recovery_area/ORA11G/autobackup/2024_01_29/o1_mf_s_1159544155_lvgktd8m_.bkp
  SPFILE Included: Modification time: 29-JAN-24
  SPFILE db_unique_name: ORA11G
  Control File Included: Ckp SCN: 1308802      Ckp time: 29-JAN-24


# maxsetsize 설정 초기화
RMAN> configure maxsetsize clear;
old RMAN configuration parameters:
CONFIGURE MAXSETSIZE TO 800 M;
RMAN configuration parameters are successfully reset to default value


RMAN> show maxsetsize;
RMAN configuration parameters for database with db_unique_name ORA11G are:
CONFIGURE MAXSETSIZE TO UNLIMITED; # default

# 백업을 하면서 용량 제한
  RMAN> backup database maxsetsize 800m;
Starting backup at 29-JAN-24
using channel ORA_DISK_1
channel ORA_DISK_1: starting full datafile backup set
channel ORA_DISK_1: specifying datafile(s) in backup set
input datafile file number=00001 name=/u01/app/oracle/oradata/ora11g/system01.dbf
channel ORA_DISK_1: starting piece 1 at 29-JAN-24
channel ORA_DISK_1: finished piece 1 at 29-JAN-24
piece handle=/u01/app/oracle/fast_recovery_area/ORA11G/backupset/2024_01_29/o1_mf_nnndf_TAG20240129T153943_lvgl1hx8_.bkp tag=TAG20240129T153943 comment=NONE
channel ORA_DISK_1: backup set complete, elapsed time: 00:00:15
channel ORA_DISK_1: starting full datafile backup set
channel ORA_DISK_1: specifying datafile(s) in backup set
input datafile file number=00002 name=/u01/app/oracle/oradata/ora11g/sysaux01.dbf
channel ORA_DISK_1: starting piece 1 at 29-JAN-24
channel ORA_DISK_1: finished piece 1 at 29-JAN-24
piece handle=/u01/app/oracle/fast_recovery_area/ORA11G/backupset/2024_01_29/o1_mf_nnndf_TAG20240129T153943_lvgl1z1z_.bkp tag=TAG20240129T153943 comment=NONE
channel ORA_DISK_1: backup set complete, elapsed time: 00:00:15
channel ORA_DISK_1: starting full datafile backup set
channel ORA_DISK_1: specifying datafile(s) in backup set
input datafile file number=00005 name=/u01/app/oracle/oradata/ora11g/example01.dbf
input datafile file number=00003 name=/u01/app/oracle/oradata/ora11g/undotbs01.dbf
input datafile file number=00004 name=/u01/app/oracle/oradata/ora11g/users01.dbf
channel ORA_DISK_1: starting piece 1 at 29-JAN-24
channel ORA_DISK_1: finished piece 1 at 29-JAN-24
piece handle=/u01/app/oracle/fast_recovery_area/ORA11G/backupset/2024_01_29/o1_mf_nnndf_TAG20240129T153943_lvgl2g5y_.bkp tag=TAG20240129T153943 comment=NONE
channel ORA_DISK_1: backup set complete, elapsed time: 00:00:07
Finished backup at 29-JAN-24

Starting Control File and SPFILE Autobackup at 29-JAN-24
piece handle=/u01/app/oracle/fast_recovery_area/ORA11G/autobackup/2024_01_29/o1_mf_s_1159544421_lvgl2ohj_.bkp comment=NONE
Finished Control File and SPFILE Autobackup at 29-JAN-24


RMAN> list backup;
List of Backup Sets
===================
BS Key  Type LV Size       Device Type Elapsed Time Completion Time
------- ---- -- ---------- ----------- ------------ ---------------
19      Full    642.65M    DISK        00:00:14     29-JAN-24
        BP Key: 19   Status: AVAILABLE  Compressed: NO  Tag: TAG20240129T153943
        Piece Name: /u01/app/oracle/fast_recovery_area/ORA11G/backupset/2024_01_29/o1_mf_nnndf_TAG20240129T153943_lvgl1hx8_.bkp
  List of Datafiles in backup set 19
  File LV Type Ckp SCN    Ckp Time  Name
  ---- -- ---- ---------- --------- ----
  1       Full 1309015    29-JAN-24 /u01/app/oracle/oradata/ora11g/system01.dbf

BS Key  Type LV Size       Device Type Elapsed Time Completion Time
------- ---- -- ---------- ----------- ------------ ---------------
20      Full    467.45M    DISK        00:00:12     29-JAN-24
        BP Key: 20   Status: AVAILABLE  Compressed: NO  Tag: TAG20240129T153943
        Piece Name: /u01/app/oracle/fast_recovery_area/ORA11G/backupset/2024_01_29/o1_mf_nnndf_TAG20240129T153943_lvgl1z1z_.bkp
  List of Datafiles in backup set 20
  File LV Type Ckp SCN    Ckp Time  Name
  ---- -- ---- ---------- --------- ----
  2       Full 1309027    29-JAN-24 /u01/app/oracle/oradata/ora11g/sysaux01.dbf

BS Key  Type LV Size       Device Type Elapsed Time Completion Time
------- ---- -- ---------- ----------- ------------ ---------------
21      Full    84.14M     DISK        00:00:03     29-JAN-24
        BP Key: 21   Status: AVAILABLE  Compressed: NO  Tag: TAG20240129T153943
        Piece Name: /u01/app/oracle/fast_recovery_area/ORA11G/backupset/2024_01_29/o1_mf_nnndf_TAG20240129T153943_lvgl2g5y_.bkp
  List of Datafiles in backup set 21
  File LV Type Ckp SCN    Ckp Time  Name
  ---- -- ---- ---------- --------- ----
  3       Full 1309033    29-JAN-24 /u01/app/oracle/oradata/ora11g/undotbs01.dbf
  4       Full 1309033    29-JAN-24 /u01/app/oracle/oradata/ora11g/users01.dbf
  5       Full 1309033    29-JAN-24 /u01/app/oracle/oradata/ora11g/example01.dbf

BS Key  Type LV Size       Device Type Elapsed Time Completion Time
------- ---- -- ---------- ----------- ------------ ---------------
22      Full    9.67M      DISK        00:00:00     29-JAN-24
        BP Key: 22   Status: AVAILABLE  Compressed: NO  Tag: TAG20240129T154021
        Piece Name: /u01/app/oracle/fast_recovery_area/ORA11G/autobackup/2024_01_29/o1_mf_s_1159544421_lvgl2ohj_.bkp
  SPFILE Included: Modification time: 29-JAN-24
  SPFILE db_unique_name: ORA11G
  Control File Included: Ckp SCN: 1309041      Ckp time: 29-JAN-24





RMAN> delete backup;

RMAN> list backup;
specification does not match any backup in the repository






■ maxpiecesize 값 조정

# 백업셋 당 600mb로 제한으로 설정 변경
  RMAN> configure channel device type disk maxpiecesize 600m;
new RMAN configuration parameters:
CONFIGURE CHANNEL DEVICE TYPE DISK MAXPIECESIZE 600 M;
new RMAN configuration parameters are successfully stored
released channel: ORA_DISK_1


RMAN> backup database;
Starting backup at 29-JAN-24
allocated channel: ORA_DISK_1
channel ORA_DISK_1: SID=184 device type=DISK
channel ORA_DISK_1: starting full datafile backup set
channel ORA_DISK_1: specifying datafile(s) in backup set
input datafile file number=00001 name=/u01/app/oracle/oradata/ora11g/system01.dbf
input datafile file number=00002 name=/u01/app/oracle/oradata/ora11g/sysaux01.dbf
input datafile file number=00005 name=/u01/app/oracle/oradata/ora11g/example01.dbf
input datafile file number=00003 name=/u01/app/oracle/oradata/ora11g/undotbs01.dbf
input datafile file number=00004 name=/u01/app/oracle/oradata/ora11g/users01.dbf
channel ORA_DISK_1: starting piece 1 at 29-JAN-24
channel ORA_DISK_1: finished piece 1 at 29-JAN-24
piece handle=/u01/app/oracle/fast_recovery_area/ORA11G/backupset/2024_01_29/o1_mf_nnndf_TAG20240129T181222_lvgtzq76_.bkp tag=TAG20240129T181222 comment=NONE
channel ORA_DISK_1: starting piece 2 at 29-JAN-24
channel ORA_DISK_1: finished piece 2 at 29-JAN-24
piece handle=/u01/app/oracle/fast_recovery_area/ORA11G/backupset/2024_01_29/o1_mf_nnndf_TAG20240129T181222_lvgv0j4y_.bkp tag=TAG20240129T181222 comment=NONE
channel ORA_DISK_1: backup set complete, elapsed time: 00:00:40
Finished backup at 29-JAN-24

Starting Control File and SPFILE Autobackup at 29-JAN-24
piece handle=/u01/app/oracle/fast_recovery_area/ORA11G/autobackup/2024_01_29/o1_mf_s_1159553583_lvgv0zmp_.bkp comment=NONE
Finished Control File and SPFILE Autobackup at 29-JAN-24


RMAN> list backupset;
List of Backup Sets
===================
BS Key  Type LV Size       Device Type Elapsed Time Completion Time
------- ---- -- ---------- ----------- ------------ ---------------
38      Full    1.16G      DISK        00:00:36     29-JAN-24
  List of Datafiles in backup set 38
  File LV Type Ckp SCN    Ckp Time  Name
  ---- -- ---- ---------- --------- ----
  1       Full 1337191    29-JAN-24 /u01/app/oracle/oradata/ora11g/system01.dbf
  2       Full 1337191    29-JAN-24 /u01/app/oracle/oradata/ora11g/sysaux01.dbf
  3       Full 1337191    29-JAN-24 /u01/app/oracle/oradata/ora11g/undotbs01.dbf
  4       Full 1337191    29-JAN-24 /u01/app/oracle/oradata/ora11g/users01.dbf
  5       Full 1337191    29-JAN-24 /u01/app/oracle/oradata/ora11g/example01.dbf

  Backup Set Copy #1 of backup set 38
  Device Type Elapsed Time Completion Time Compressed Tag
  ----------- ------------ --------------- ---------- ---
  DISK        00:00:36     29-JAN-24       NO         TAG20240129T181222

    List of Backup Pieces for backup set 38 Copy #1
    BP Key  Pc# Status      Piece Name
    ------- --- ----------- ----------
42      1   AVAILABLE   /u01/app/oracle/fast_recovery_area/ORA11G/backupset/2024_01_29/o1_mf_nnndf_TAG20240129T181222_lvgtzq76_.bkp
43      2   AVAILABLE   /u01/app/oracle/fast_recovery_area/ORA11G/backupset/2024_01_29/o1_mf_nnndf_TAG20240129T181222_lvgv0j4y_.bkp

BS Key  Type LV Size       Device Type Elapsed Time Completion Time
------- ---- -- ---------- ----------- ------------ ---------------
39      Full    9.95M      DISK        00:00:00     29-JAN-24
        BP Key: 44   Status: AVAILABLE  Compressed: NO  Tag: TAG20240129T181303
        Piece Name: /u01/app/oracle/fast_recovery_area/ORA11G/autobackup/2024_01_29/o1_mf_s_1159553583_lvgv0zmp_.bkp
  SPFILE Included: Modification time: 29-JAN-24
  SPFILE db_unique_name: ORA11G
  Control File Included: Ckp SCN: 1337210      Ckp time: 29-JAN-24

# 데이터베이스 레벨 백업
  RMAN> run {
    allocate channel c1 device type disk maxpiecesize 100m;
    backup database;
    }

>> 백업피스(물리적파일) 용량을100mb로 제한하여 디스크 c1 채널에 할당

released channel: ORA_DISK_1
allocated channel: c1
channel c1: SID=184 device type=DISK

Starting backup at 29-JAN-24
channel c1: starting full datafile backup set
channel c1: specifying datafile(s) in backup set
input datafile file number=00001 name=/u01/app/oracle/oradata/ora11g/system01.dbf
input datafile file number=00002 name=/u01/app/oracle/oradata/ora11g/sysaux01.dbf
input datafile file number=00005 name=/u01/app/oracle/oradata/ora11g/example01.dbf
input datafile file number=00003 name=/u01/app/oracle/oradata/ora11g/undotbs01.dbf
input datafile file number=00004 name=/u01/app/oracle/oradata/ora11g/users01.dbf
channel c1: starting piece 1 at 29-JAN-24
channel c1: finished piece 1 at 29-JAN-24
piece handle=/u01/app/oracle/fast_recovery_area/ORA11G/backupset/2024_01_29/o1_mf_nnndf_TAG20240129T181609_lvgv6sv8_.bkp tag=TAG20240129T181609 comment=NONE
channel c1: starting piece 2 at 29-JAN-24
channel c1: finished piece 2 at 29-JAN-24
piece handle=/u01/app/oracle/fast_recovery_area/ORA11G/backupset/2024_01_29/o1_mf_nnndf_TAG20240129T181609_lvgv70ry_.bkp tag=TAG20240129T181609 comment=NONE
channel c1: starting piece 3 at 29-JAN-24
channel c1: finished piece 3 at 29-JAN-24
piece handle=/u01/app/oracle/fast_recovery_area/ORA11G/backupset/2024_01_29/o1_mf_nnndf_TAG20240129T181609_lvgv77s6_.bkp tag=TAG20240129T181609 comment=NONE
channel c1: starting piece 4 at 29-JAN-24
channel c1: finished piece 4 at 29-JAN-24
piece handle=/u01/app/oracle/fast_recovery_area/ORA11G/backupset/2024_01_29/o1_mf_nnndf_TAG20240129T181609_lvgv7bsf_.bkp tag=TAG20240129T181609 comment=NONE
channel c1: starting piece 5 at 29-JAN-24
channel c1: finished piece 5 at 29-JAN-24
piece handle=/u01/app/oracle/fast_recovery_area/ORA11G/backupset/2024_01_29/o1_mf_nnndf_TAG20240129T181609_lvgv7fsk_.bkp tag=TAG20240129T181609 comment=NONE
channel c1: starting piece 6 at 29-JAN-24
channel c1: finished piece 6 at 29-JAN-24
piece handle=/u01/app/oracle/fast_recovery_area/ORA11G/backupset/2024_01_29/o1_mf_nnndf_TAG20240129T181609_lvgv7jsv_.bkp tag=TAG20240129T181609 comment=NONE
channel c1: starting piece 7 at 29-JAN-24
channel c1: finished piece 7 at 29-JAN-24
piece handle=/u01/app/oracle/fast_recovery_area/ORA11G/backupset/2024_01_29/o1_mf_nnndf_TAG20240129T181609_lvgv7mvd_.bkp tag=TAG20240129T181609 comment=NONE
channel c1: starting piece 8 at 29-JAN-24
channel c1: finished piece 8 at 29-JAN-24
piece handle=/u01/app/oracle/fast_recovery_area/ORA11G/backupset/2024_01_29/o1_mf_nnndf_TAG20240129T181609_lvgv7pt9_.bkp tag=TAG20240129T181609 comment=NONE
channel c1: starting piece 9 at 29-JAN-24
channel c1: finished piece 9 at 29-JAN-24
piece handle=/u01/app/oracle/fast_recovery_area/ORA11G/backupset/2024_01_29/o1_mf_nnndf_TAG20240129T181609_lvgv7stc_.bkp tag=TAG20240129T181609 comment=NONE
channel c1: starting piece 10 at 29-JAN-24
channel c1: finished piece 10 at 29-JAN-24
piece handle=/u01/app/oracle/fast_recovery_area/ORA11G/backupset/2024_01_29/o1_mf_nnndf_TAG20240129T181609_lvgv7wv8_.bkp tag=TAG20240129T181609 comment=NONE
channel c1: starting piece 11 at 29-JAN-24
channel c1: finished piece 11 at 29-JAN-24
piece handle=/u01/app/oracle/fast_recovery_area/ORA11G/backupset/2024_01_29/o1_mf_nnndf_TAG20240129T181609_lvgv7zyv_.bkp tag=TAG20240129T181609 comment=NONE
channel c1: starting piece 12 at 29-JAN-24
channel c1: finished piece 12 at 29-JAN-24
piece handle=/u01/app/oracle/fast_recovery_area/ORA11G/backupset/2024_01_29/o1_mf_nnndf_TAG20240129T181609_lvgv82vo_.bkp tag=TAG20240129T181609 comment=NONE
channel c1: backup set complete, elapsed time: 00:00:44
Finished backup at 29-JAN-24

Starting Control File and SPFILE Autobackup at 29-JAN-24
piece handle=/u01/app/oracle/fast_recovery_area/ORA11G/autobackup/2024_01_29/o1_mf_s_1159553813_lvgv8662_.bkp comment=NONE
Finished Control File and SPFILE Autobackup at 29-JAN-24
released channel: c1


RMAN> list backup of tablespace system;
List of Backup Sets
===================
BS Key  Type LV Size       Device Type Elapsed Time Completion Time
------- ---- -- ---------- ----------- ------------ ---------------
42      Full    1.16G      DISK        00:00:43     29-JAN-24
  List of Datafiles in backup set 42
  File LV Type Ckp SCN    Ckp Time  Name
  ---- -- ---- ---------- --------- ----
  1       Full 1337760    29-JAN-24 /u01/app/oracle/oradata/ora11g/system01.dbf

  Backup Set Copy #1 of backup set 42
  Device Type Elapsed Time Completion Time Compressed Tag
  ----------- ------------ --------------- ---------- ---
  DISK        00:00:43     29-JAN-24       NO         TAG20240129T181609

    List of Backup Pieces for backup set 42 Copy #1
    BP Key  Pc# Status      Piece Name
    ------- --- ----------- ----------
    48      1   AVAILABLE   /u01/app/oracle/fast_recovery_area/ORA11G/backupset/2024_01_29/o1_mf_nnndf_TAG20240129T181609_lvgv6sv8_.bkp
    49      2   AVAILABLE   /u01/app/oracle/fast_recovery_area/ORA11G/backupset/2024_01_29/o1_mf_nnndf_TAG20240129T181609_lvgv70ry_.bkp
    50      3   AVAILABLE   /u01/app/oracle/fast_recovery_area/ORA11G/backupset/2024_01_29/o1_mf_nnndf_TAG20240129T181609_lvgv77s6_.bkp
    51      4   AVAILABLE   /u01/app/oracle/fast_recovery_area/ORA11G/backupset/2024_01_29/o1_mf_nnndf_TAG20240129T181609_lvgv7bsf_.bkp
    52      5   AVAILABLE   /u01/app/oracle/fast_recovery_area/ORA11G/backupset/2024_01_29/o1_mf_nnndf_TAG20240129T181609_lvgv7fsk_.bkp
    53      6   AVAILABLE   /u01/app/oracle/fast_recovery_area/ORA11G/backupset/2024_01_29/o1_mf_nnndf_TAG20240129T181609_lvgv7jsv_.bkp
    54      7   AVAILABLE   /u01/app/oracle/fast_recovery_area/ORA11G/backupset/2024_01_29/o1_mf_nnndf_TAG20240129T181609_lvgv7mvd_.bkp
    55      8   AVAILABLE   /u01/app/oracle/fast_recovery_area/ORA11G/backupset/2024_01_29/o1_mf_nnndf_TAG20240129T181609_lvgv7pt9_.bkp
    56      9   AVAILABLE   /u01/app/oracle/fast_recovery_area/ORA11G/backupset/2024_01_29/o1_mf_nnndf_TAG20240129T181609_lvgv7stc_.bkp
    57      10  AVAILABLE   /u01/app/oracle/fast_recovery_area/ORA11G/backupset/2024_01_29/o1_mf_nnndf_TAG20240129T181609_lvgv7wv8_.bkp
    58      11  AVAILABLE   /u01/app/oracle/fast_recovery_area/ORA11G/backupset/2024_01_29/o1_mf_nnndf_TAG20240129T181609_lvgv7zyv_.bkp
    59      12  AVAILABLE   /u01/app/oracle/fast_recovery_area/ORA11G/backupset/2024_01_29/o1_mf_nnndf_TAG20240129T181609_lvgv82vo_.bkp

# 특정 테이블스페이스 레벨 백업
  RMAN> run {
    allocate channel c1 device type disk maxpiecesize 100m;
    backup tablespace system;
    }

> 백어피스(물리적파일) 용량을 100mb로 제한하여 디슼 c1 채널에 할당

allocated channel: c1
channel c1: SID=184 device type=DISK

Starting backup at 29-JAN-24
channel c1: starting full datafile backup set
channel c1: specifying datafile(s) in backup set
input datafile file number=00001 name=/u01/app/oracle/oradata/ora11g/system01.dbf
channel c1: starting piece 1 at 29-JAN-24
channel c1: finished piece 1 at 29-JAN-24
piece handle=/u01/app/oracle/fast_recovery_area/ORA11G/backupset/2024_01_29/o1_mf_nnndf_TAG20240129T181848_lvgvcrnq_.bkp tag=TAG20240129T181848 comment=NONE
channel c1: starting piece 2 at 29-JAN-24
channel c1: finished piece 2 at 29-JAN-24
piece handle=/u01/app/oracle/fast_recovery_area/ORA11G/backupset/2024_01_29/o1_mf_nnndf_TAG20240129T181848_lvgvcvnn_.bkp tag=TAG20240129T181848 comment=NONE
channel c1: starting piece 3 at 29-JAN-24
channel c1: finished piece 3 at 29-JAN-24
piece handle=/u01/app/oracle/fast_recovery_area/ORA11G/backupset/2024_01_29/o1_mf_nnndf_TAG20240129T181848_lvgvcynq_.bkp tag=TAG20240129T181848 comment=NONE
channel c1: starting piece 4 at 29-JAN-24
channel c1: finished piece 4 at 29-JAN-24
piece handle=/u01/app/oracle/fast_recovery_area/ORA11G/backupset/2024_01_29/o1_mf_nnndf_TAG20240129T181848_lvgvd1nz_.bkp tag=TAG20240129T181848 comment=NONE
channel c1: starting piece 5 at 29-JAN-24
channel c1: finished piece 5 at 29-JAN-24
piece handle=/u01/app/oracle/fast_recovery_area/ORA11G/backupset/2024_01_29/o1_mf_nnndf_TAG20240129T181848_lvgvd4o3_.bkp tag=TAG20240129T181848 comment=NONE
channel c1: starting piece 6 at 29-JAN-24
channel c1: finished piece 6 at 29-JAN-24
piece handle=/u01/app/oracle/fast_recovery_area/ORA11G/backupset/2024_01_29/o1_mf_nnndf_TAG20240129T181848_lvgvd7o4_.bkp tag=TAG20240129T181848 comment=NONE
channel c1: starting piece 7 at 29-JAN-24
channel c1: finished piece 7 at 29-JAN-24
piece handle=/u01/app/oracle/fast_recovery_area/ORA11G/backupset/2024_01_29/o1_mf_nnndf_TAG20240129T181848_lvgvdbob_.bkp tag=TAG20240129T181848 comment=NONE
channel c1: backup set complete, elapsed time: 00:00:19
Finished backup at 29-JAN-24

Starting Control File and SPFILE Autobackup at 29-JAN-24
piece handle=/u01/app/oracle/fast_recovery_area/ORA11G/autobackup/2024_01_29/o1_mf_s_1159553947_lvgvdcy3_.bkp comment=NONE
Finished Control File and SPFILE Autobackup at 29-JAN-24
released channel: c1


RMAN> list backup of tablespace system;
List of Backup Sets
===================
BS Key  Type LV Size       Device Type Elapsed Time Completion Time
------- ---- -- ---------- ----------- ------------ ---------------
44      Full    642.44M    DISK        00:00:19     29-JAN-24
  List of Datafiles in backup set 44
  File LV Type Ckp SCN    Ckp Time  Name
  ---- -- ---- ---------- --------- ----
  1       Full 1337902    29-JAN-24 /u01/app/oracle/oradata/ora11g/system01.dbf

  Backup Set Copy #1 of backup set 44
  Device Type Elapsed Time Completion Time Compressed Tag
  ----------- ------------ --------------- ---------- ---
  DISK        00:00:19     29-JAN-24       NO         TAG20240129T181848

    List of Backup Pieces for backup set 44 Copy #1
    BP Key  Pc# Status      Piece Name
    ------- --- ----------- ----------
    61      1   AVAILABLE   /u01/app/oracle/fast_recovery_area/ORA11G/backupset/2024_01_29/o1_mf_nnndf_TAG20240129T181848_lvgvcrnq_.bkp
    62      2   AVAILABLE   /u01/app/oracle/fast_recovery_area/ORA11G/backupset/2024_01_29/o1_mf_nnndf_TAG20240129T181848_lvgvcvnn_.bkp
    63      3   AVAILABLE   /u01/app/oracle/fast_recovery_area/ORA11G/backupset/2024_01_29/o1_mf_nnndf_TAG20240129T181848_lvgvcynq_.bkp
    64      4   AVAILABLE   /u01/app/oracle/fast_recovery_area/ORA11G/backupset/2024_01_29/o1_mf_nnndf_TAG20240129T181848_lvgvd1nz_.bkp
    65      5   AVAILABLE   /u01/app/oracle/fast_recovery_area/ORA11G/backupset/2024_01_29/o1_mf_nnndf_TAG20240129T181848_lvgvd4o3_.bkp
    66      6   AVAILABLE   /u01/app/oracle/fast_recovery_area/ORA11G/backupset/2024_01_29/o1_mf_nnndf_TAG20240129T181848_lvgvd7o4_.bkp
    67      7   AVAILABLE   /u01/app/oracle/fast_recovery_area/ORA11G/backupset/2024_01_29/o1_mf_nnndf_TAG20240129T181848_lvgvdbob_.bkp


# 설정 초기화
configure channel device type disk clear;





delete backup;






■ image copy backup
- 파일카피라서 사용하지 않는 블럭까지 카피 -> 용량 과다

RMAN> backup as copy database;
Starting backup at 29-JAN-24
using channel ORA_DISK_1
channel ORA_DISK_1: starting datafile copy
input datafile file number=00001 name=/u01/app/oracle/oradata/ora11g/system01.dbf
output file name=/u01/app/oracle/fast_recovery_area/ORA11G/datafile/o1_mf_system_lvgm354v_.dbf tag=TAG20240129T155741 RECID=1 STAMP=1159545474
channel ORA_DISK_1: datafile copy complete, elapsed time: 00:00:15
channel ORA_DISK_1: starting datafile copy
input datafile file number=00002 name=/u01/app/oracle/oradata/ora11g/sysaux01.dbf
output file name=/u01/app/oracle/fast_recovery_area/ORA11G/datafile/o1_mf_sysaux_lvgm3n7x_.dbf tag=TAG20240129T155741 RECID=2 STAMP=1159545488
channel ORA_DISK_1: datafile copy complete, elapsed time: 00:00:15
channel ORA_DISK_1: starting datafile copy
input datafile file number=00005 name=/u01/app/oracle/oradata/ora11g/example01.dbf
output file name=/u01/app/oracle/fast_recovery_area/ORA11G/datafile/o1_mf_example_lvgm43c7_.dbf tag=TAG20240129T155741 RECID=3 STAMP=1159545497
channel ORA_DISK_1: datafile copy complete, elapsed time: 00:00:07
channel ORA_DISK_1: starting datafile copy
input datafile file number=00003 name=/u01/app/oracle/oradata/ora11g/undotbs01.dbf
output file name=/u01/app/oracle/fast_recovery_area/ORA11G/datafile/o1_mf_undotbs_lvgm4bj1_.dbf tag=TAG20240129T155741 RECID=4 STAMP=1159545498
channel ORA_DISK_1: datafile copy complete, elapsed time: 00:00:01
channel ORA_DISK_1: starting datafile copy
input datafile file number=00004 name=/u01/app/oracle/oradata/ora11g/users01.dbf
output file name=/u01/app/oracle/fast_recovery_area/ORA11G/datafile/o1_mf_users_lvgm4cjc_.dbf tag=TAG20240129T155741 RECID=5 STAMP=1159545499
channel ORA_DISK_1: datafile copy complete, elapsed time: 00:00:01
Finished backup at 29-JAN-24

Starting Control File and SPFILE Autobackup at 29-JAN-24
piece handle=/u01/app/oracle/fast_recovery_area/ORA11G/autobackup/2024_01_29/o1_mf_s_1159545500_lvgm4f56_.bkp comment=NONE
Finished Control File and SPFILE Autobackup at 29-JAN-24


RMAN> list backup;
List of Backup Sets
===================
BS Key  Type LV Size       Device Type Elapsed Time Completion Time
------- ---- -- ---------- ----------- ------------ ---------------
29      Full    9.67M      DISK        00:00:01     29-JAN-24
        BP Key: 32   Status: AVAILABLE  Compressed: NO  Tag: TAG20240129T155820
        Piece Name: /u01/app/oracle/fast_recovery_area/ORA11G/autobackup/2024_01_29/o1_mf_s_1159545500_lvgm4f56_.bkp
  SPFILE Included: Modification time: 29-JAN-24
  SPFILE db_unique_name: ORA11G
  Control File Included: Ckp SCN: 1310041      Ckp time: 29-JAN-24


# 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
------- ---- - --------------- ---------- ---------------
1       1    A 29-JAN-24       1309999    29-JAN-24
        Name: /u01/app/oracle/fast_recovery_area/ORA11G/datafile/o1_mf_system_lvgm354v_.dbf
        Tag: TAG20240129T155741

2       2    A 29-JAN-24       1310005    29-JAN-24
        Name: /u01/app/oracle/fast_recovery_area/ORA11G/datafile/o1_mf_sysaux_lvgm3n7x_.dbf
        Tag: TAG20240129T155741

4       3    A 29-JAN-24       1310033    29-JAN-24
        Name: /u01/app/oracle/fast_recovery_area/ORA11G/datafile/o1_mf_undotbs_lvgm4bj1_.dbf
        Tag: TAG20240129T155741

5       4    A 29-JAN-24       1310034    29-JAN-24
        Name: /u01/app/oracle/fast_recovery_area/ORA11G/datafile/o1_mf_users_lvgm4cjc_.dbf
        Tag: TAG20240129T155741

3       5    A 29-JAN-24       1310011    29-JAN-24
        Name: /u01/app/oracle/fast_recovery_area/ORA11G/datafile/o1_mf_example_lvgm43c7_.dbf
        Tag: TAG20240129T155741

List of Archived Log Copies for database with db_unique_name ORA11G
=====================================================================
Key     Thrd Seq     S Low Time
------- ---- ------- - ---------
7       1    1       A 29-JAN-24
        Name: /home/oracle/arch1/arch_1_1_1159538090.arc


# copy 목록 부분 검색
RMAN> list copy of tablespace system;
List of Datafile Copies
=======================
Key     File S Completion Time Ckp SCN    Ckp Time
------- ---- - --------------- ---------- ---------------
1       1    A 29-JAN-24       1309999    29-JAN-24
        Name: /u01/app/oracle/fast_recovery_area/ORA11G/datafile/o1_mf_system_lvgm354v_.dbf
        Tag: TAG20240129T155741


RMAN> backup as copy current controlfile;
Starting backup at 29-JAN-24
using channel ORA_DISK_1
channel ORA_DISK_1: starting datafile copy
copying current control file
output file name=/u01/app/oracle/fast_recovery_area/ORA11G/controlfile/o1_mf_TAG20240129T160202_lvgmcbr1_.ctl tag=TAG20240129T160202 RECID=6 STAMP=1159545723
channel ORA_DISK_1: datafile copy complete, elapsed time: 00:00:01
Finished backup at 29-JAN-24

Starting Control File and SPFILE Autobackup at 29-JAN-24
piece handle=/u01/app/oracle/fast_recovery_area/ORA11G/autobackup/2024_01_29/o1_mf_s_1159545723_lvgmccy5_.bkp comment=NONE
Finished Control File and SPFILE Autobackup at 29-JAN-24


RMAN> list copy of controlfile;
List of Control File Copies
===========================
Key     S Completion Time Ckp SCN    Ckp Time
------- - --------------- ---------- ---------------
6       A 29-JAN-24       1310432    29-JAN-24
        Name: /u01/app/oracle/fast_recovery_area/ORA11G/controlfile/o1_mf_TAG20240129T160202_lvgmcbr1_.ctl
        Tag: TAG20240129T160202






<< 시나리오 >> image copy backup, Data File 손상

  SYS@ora11g> shutdown immediate


# 장애
! rm /u01/app/oracle/oradata/ora11g/*.dbf


SYS@ora11g> startup
Database mounted.
ORA-01157: cannot identify/lock data file 1 - see DBWR trace file
ORA-01110: data file 1: '/u01/app/oracle/oradata/ora11g/system01.dbf'

# 복구
  [oracle@oracle ~]$ rman target /
connected to target database: ORA11G (DBID=256148331, not open)

>> mount


RMAN> restore database;
Starting restore at 29-JAN-24
using target database control file instead of recovery catalog
allocated channel: ORA_DISK_1
channel ORA_DISK_1: SID=171 device type=DISK

channel ORA_DISK_1: restoring datafile 00001
input datafile copy RECID=1 STAMP=1159545474 file name=/u01/app/oracle/fast_recovery_area/ORA11G/datafile/o1_mf_system_lvgm354v_.dbf
destination for restore of datafile 00001: /u01/app/oracle/oradata/ora11g/system01.dbf
channel ORA_DISK_1: copied datafile copy of datafile 00001
output file name=/u01/app/oracle/oradata/ora11g/system01.dbf RECID=0 STAMP=0
channel ORA_DISK_1: restoring datafile 00002
input datafile copy RECID=2 STAMP=1159545488 file name=/u01/app/oracle/fast_recovery_area/ORA11G/datafile/o1_mf_sysaux_lvgm3n7x_.dbf
destination for restore of datafile 00002: /u01/app/oracle/oradata/ora11g/sysaux01.dbf
channel ORA_DISK_1: copied datafile copy of datafile 00002
output file name=/u01/app/oracle/oradata/ora11g/sysaux01.dbf RECID=0 STAMP=0
channel ORA_DISK_1: restoring datafile 00003
input datafile copy RECID=4 STAMP=1159545498 file name=/u01/app/oracle/fast_recovery_area/ORA11G/datafile/o1_mf_undotbs_lvgm4bj1_.dbf
destination for restore of datafile 00003: /u01/app/oracle/oradata/ora11g/undotbs01.dbf
channel ORA_DISK_1: copied datafile copy of datafile 00003
output file name=/u01/app/oracle/oradata/ora11g/undotbs01.dbf RECID=0 STAMP=0
channel ORA_DISK_1: restoring datafile 00004
input datafile copy RECID=5 STAMP=1159545499 file name=/u01/app/oracle/fast_recovery_area/ORA11G/datafile/o1_mf_users_lvgm4cjc_.dbf
destination for restore of datafile 00004: /u01/app/oracle/oradata/ora11g/users01.dbf
channel ORA_DISK_1: copied datafile copy of datafile 00004
output file name=/u01/app/oracle/oradata/ora11g/users01.dbf RECID=0 STAMP=0
channel ORA_DISK_1: restoring datafile 00005
input datafile copy RECID=3 STAMP=1159545497 file name=/u01/app/oracle/fast_recovery_area/ORA11G/datafile/o1_mf_example_lvgm43c7_.dbf
destination for restore of datafile 00005: /u01/app/oracle/oradata/ora11g/example01.dbf
channel ORA_DISK_1: copied datafile copy of datafile 00005
output file name=/u01/app/oracle/oradata/ora11g/example01.dbf RECID=0 STAMP=0
Finished restore at 29-JAN-24


RMAN> recover database;
Starting recover at 29-JAN-24
using channel ORA_DISK_1

starting media recovery
media recovery complete, elapsed time: 00:00:03

Finished recover at 29-JAN-24


RMAN> alter database open;


SYS@ora11g> conn / as sysdba
Connected.


SYS@ora11g> select count(*) from hr.employees;

  COUNT
----------
       107






<< 시나리오 >> image copy backup, User Data File 손상

  create tablespace insa_tbs datafile '/home/oracle/insa_tbs01.dbf' size 10m;


create table hr.emp_insa tablespace insa_tbs as select * from hr.employees;



select count(*) from hr.emp_insa;
  COUNT(*)
----------
       107


SELECT a.file#, a.name file_name, b.name tbs_name, a.status, a.checkpoint_change#
FROM v$datafile a, v$tablespace b WHERE a.ts# = b.ts#;
FILE# FILE_NAME                                          TBS_NAME   STATUS        CHECKPOINT_CHANGE#
----- -------------------------------------------------- ---------- ------------- ------------------
    1 /u01/app/oracle/oradata/ora11g/system01.dbf        SYSTEM     SYSTEM                   1310903
    2 /u01/app/oracle/oradata/ora11g/sysaux01.dbf        SYSAUX     ONLINE                   1310903
    3 /u01/app/oracle/oradata/ora11g/undotbs01.dbf       UNDOTBS    ONLINE                   1310903
    4 /u01/app/oracle/oradata/ora11g/users01.dbf         USERS      ONLINE                   1310903
    5 /u01/app/oracle/oradata/ora11g/example01.dbf       EXAMPLE    ONLINE                   1310903
    6 /home/oracle/insa_tbs01.dbf                        INSA_TBS   ONLINE                   1311329


RMAN> report schema;
using target database control file instead of recovery catalog
Report of database schema for database with db_unique_name ORA11G
List of Permanent Datafiles
===========================
File Size(MB) Tablespace           RB segs Datafile Name
---- -------- -------------------- ------- ------------------------
1    750      SYSTEM               ***     /u01/app/oracle/oradata/ora11g/system01.dbf
2    620      SYSAUX               ***     /u01/app/oracle/oradata/ora11g/sysaux01.dbf
3    14       UNDOTBS              ***     /u01/app/oracle/oradata/ora11g/undotbs01.dbf
4    5        USERS                ***     /u01/app/oracle/oradata/ora11g/users01.dbf
5    331      EXAMPLE              ***     /u01/app/oracle/oradata/ora11g/example01.dbf
6    10       INSA_TBS             ***     /home/oracle/insa_tbs01.dbf

List of Temporary Files
=======================
File Size(MB) Tablespace           Maxsize(MB) Tempfile Name
---- -------- -------------------- ----------- --------------------
1    20       TEMP                 32767       /u01/app/oracle/oradata/ora11g/temp01.dbf


RMAN> report need backup;
RMAN retention policy will be applied to the command
RMAN retention policy is set to redundancy 1
Report of files with less than 1 redundant backups
File #bkps Name
---- ----- -----------------------------------------------------
6    0     /home/oracle/insa_tbs01.dbf


RMAN> backup as copy datafile 6 format '/u01/app/oracle/oradata/ora11g/insa_tbs01.dbf';
Starting backup at 29-JAN-24
allocated channel: ORA_DISK_1
channel ORA_DISK_1: SID=182 device type=DISK
channel ORA_DISK_1: starting datafile copy
input datafile file number=00006 name=/home/oracle/insa_tbs01.dbf
output file name=/u01/app/oracle/oradata/ora11g/insa_tbs01.dbf tag=TAG20240129T161420 RECID=7 STAMP=1159546461
channel ORA_DISK_1: datafile copy complete, elapsed time: 00:00:01
Finished backup at 29-JAN-24

Starting Control File and SPFILE Autobackup at 29-JAN-24
piece handle=/u01/app/oracle/fast_recovery_area/ORA11G/autobackup/2024_01_29/o1_mf_s_1159546462_lvgn2gd9_.bkp comment=NONE
Finished Control File and SPFILE Autobackup at 29-JAN-24


# datafile level copy list
RMAN> list datafilecopy all;
List of Datafile Copies
=======================
Key     File S Completion Time Ckp SCN    Ckp Time
------- ---- - --------------- ---------- ---------------
1       1    A 29-JAN-24       1309999    29-JAN-24
        Name: /u01/app/oracle/fast_recovery_area/ORA11G/datafile/o1_mf_system_lvgm354v_.dbf
        Tag: TAG20240129T155741

2       2    A 29-JAN-24       1310005    29-JAN-24
        Name: /u01/app/oracle/fast_recovery_area/ORA11G/datafile/o1_mf_sysaux_lvgm3n7x_.dbf
        Tag: TAG20240129T155741

4       3    A 29-JAN-24       1310033    29-JAN-24
        Name: /u01/app/oracle/fast_recovery_area/ORA11G/datafile/o1_mf_undotbs_lvgm4bj1_.dbf
        Tag: TAG20240129T155741

5       4    A 29-JAN-24       1310034    29-JAN-24
        Name: /u01/app/oracle/fast_recovery_area/ORA11G/datafile/o1_mf_users_lvgm4cjc_.dbf
        Tag: TAG20240129T155741

3       5    A 29-JAN-24       1310011    29-JAN-24
        Name: /u01/app/oracle/fast_recovery_area/ORA11G/datafile/o1_mf_example_lvgm43c7_.dbf
        Tag: TAG20240129T155741

7       6    A 29-JAN-24       1311831    29-JAN-24
        Name: /u01/app/oracle/oradata/ora11g/insa_tbs01.dbf
        Tag: TAG20240129T161420


>> Data File    : /home/oracle/insa_tbs01.dbf
>> Backup File  : /u01/app/oracle/oradata/ora11g/insa_tbs01.dbf



# 장애
! rm /home/oracle/insa_tbs01.dbf



SYS@ora11g> shutdown immediate
ORA-03113: end-of-file on communication channel
Process ID: 11406
Session ID: 9 Serial number: 5


SYS@ora11g> conn / as sysdba
Connected to an idle instance.


SYS@ora11g> startup
Database mounted.
ORA-01157: cannot identify/lock data file 6 - see DBWR trace file
ORA-01110: data file 6: '/home/oracle/insa_tbs01.dbf'

# 복구
  SYS@ora11g> alter database datafile 6 offline;


SYS@ora11g> alter database open;


SELECT a.file#, a.name file_name, b.name tbs_name, a.status, a.checkpoint_change#
FROM v$datafile a, v$tablespace b WHERE a.ts# = b.ts#;
FILE# FILE_NAME                                          TBS_NAME   STATUS        CHECKPOINT_CHANGE#
----- -------------------------------------------------- ---------- ------------- ------------------
    1 /u01/app/oracle/oradata/ora11g/system01.dbf        SYSTEM     SYSTEM                   1332361
    2 /u01/app/oracle/oradata/ora11g/sysaux01.dbf        SYSAUX     ONLINE                   1332361
    3 /u01/app/oracle/oradata/ora11g/undotbs01.dbf       UNDOTBS    ONLINE                   1332361
    4 /u01/app/oracle/oradata/ora11g/users01.dbf         USERS      ONLINE                   1332361
    5 /u01/app/oracle/oradata/ora11g/example01.dbf       EXAMPLE    ONLINE                   1332361
    6 /home/oracle/insa_tbs01.dbf                        INSA_TBS   RECOVER                  1311831


[oracle@oracle ~]$ rman target /
connected to target database: ORA11G (DBID=256148331)


RMAN> list datafilecopy all;
List of Datafile Copies
=======================
Key     File S Completion Time Ckp SCN    Ckp Time
------- ---- - --------------- ---------- ---------------
1       1    A 29-JAN-24       1309999    29-JAN-24
        Name: /u01/app/oracle/fast_recovery_area/ORA11G/datafile/o1_mf_system_lvgm354v_.dbf
        Tag: TAG20240129T155741

2       2    A 29-JAN-24       1310005    29-JAN-24
        Name: /u01/app/oracle/fast_recovery_area/ORA11G/datafile/o1_mf_sysaux_lvgm3n7x_.dbf
        Tag: TAG20240129T155741

4       3    A 29-JAN-24       1310033    29-JAN-24
        Name: /u01/app/oracle/fast_recovery_area/ORA11G/datafile/o1_mf_undotbs_lvgm4bj1_.dbf
        Tag: TAG20240129T155741

5       4    A 29-JAN-24       1310034    29-JAN-24
        Name: /u01/app/oracle/fast_recovery_area/ORA11G/datafile/o1_mf_users_lvgm4cjc_.dbf
        Tag: TAG20240129T155741

3       5    A 29-JAN-24       1310011    29-JAN-24
        Name: /u01/app/oracle/fast_recovery_area/ORA11G/datafile/o1_mf_example_lvgm43c7_.dbf
        Tag: TAG20240129T155741

7       6    A 29-JAN-24       1311831    29-JAN-24
        Name: /u01/app/oracle/oradata/ora11g/insa_tbs01.dbf
        Tag: TAG20240129T161420


# 백업파일 위치로 변경 = restore
RMAN> switch datafile 6 to copy;
datafile 6 switched to datafile copy "/u01/app/oracle/oradata/ora11g/insa_tbs01.dbf"


RMAN> recover datafile 6;
Starting recover at 29-JAN-24
allocated channel: ORA_DISK_1
channel ORA_DISK_1: SID=18 device type=DISK
starting media recovery
media recovery complete, elapsed time: 00:00:00
Finished recover at 29-JAN-24


RMAN> sql 'alter database datafile 6 online';
sql statement: alter database datafile 6 online


RMAN> report schema;
Report of database schema for database with db_unique_name ORA11G
List of Permanent Datafiles
===========================
File Size(MB) Tablespace           RB segs Datafile Name
---- -------- -------------------- ------- ------------------------
1    750      SYSTEM               ***     /u01/app/oracle/oradata/ora11g/system01.dbf
2    620      SYSAUX               ***     /u01/app/oracle/oradata/ora11g/sysaux01.dbf
3    14       UNDOTBS              ***     /u01/app/oracle/oradata/ora11g/undotbs01.dbf
4    5        USERS                ***     /u01/app/oracle/oradata/ora11g/users01.dbf
5    331      EXAMPLE              ***     /u01/app/oracle/oradata/ora11g/example01.dbf
6    10       INSA_TBS             ***     /u01/app/oracle/oradata/ora11g/insa_tbs01.dbf

List of Temporary Files
=======================
File Size(MB) Tablespace           Maxsize(MB) Tempfile Name
---- -------- -------------------- ----------- --------------------
1    20       TEMP                 32767       /u01/app/oracle/oradata/ora11g/temp01.dbf


SELECT a.file#, a.name file_name, b.name tbs_name, a.status, a.checkpoint_change#
FROM v$datafile a, v$tablespace b WHERE a.ts# = b.ts#;
FILE# FILE_NAME                                          TBS_NAME   STATUS        CHECKPOINT_CHANGE#
----- -------------------------------------------------- ---------- ------------- ------------------
    1 /u01/app/oracle/oradata/ora11g/system01.dbf        SYSTEM     SYSTEM                   1332361
    2 /u01/app/oracle/oradata/ora11g/sysaux01.dbf        SYSAUX     ONLINE                   1332361
    3 /u01/app/oracle/oradata/ora11g/undotbs01.dbf       UNDOTBS    ONLINE                   1332361
    4 /u01/app/oracle/oradata/ora11g/users01.dbf         USERS      ONLINE                   1332361
    5 /u01/app/oracle/oradata/ora11g/example01.dbf       EXAMPLE    ONLINE                   1332361
    6 /u01/app/oracle/oradata/ora11g/insa_tbs01.dbf      INSA_TBS   ONLINE                   1332992


SYS@ora11g> select count(*) from hr.emp_insa;
  COUNT(*)
----------
       107


SYS@ora11g> drop tablespace insa_tbs including contents and datafiles;


RMAN> delete copy;


RMAN> delete backup;


RMAN> backup database;


RMAN> list backup;
List of Backup Sets
===================
BS Key  Type LV Size       Device Type Elapsed Time Completion Time
------- ---- -- ---------- ----------- ------------ ---------------
34      Full    1.16G      DISK        00:00:29     29-JAN-24
        BP Key: 38   Status: AVAILABLE  Compressed: NO  Tag: TAG20240129T163521
        Piece Name: /u01/app/oracle/fast_recovery_area/ORA11G/backupset/2024_01_29/o1_mf_nnndf_TAG20240129T163521_lvgo9spw_.bkp
  List of Datafiles in backup set 34
  File LV Type Ckp SCN    Ckp Time  Name
  ---- -- ---- ---------- --------- ----
  1       Full 1333565    29-JAN-24 /u01/app/oracle/oradata/ora11g/system01.dbf
  2       Full 1333565    29-JAN-24 /u01/app/oracle/oradata/ora11g/sysaux01.dbf
  3       Full 1333565    29-JAN-24 /u01/app/oracle/oradata/ora11g/undotbs01.dbf
  4       Full 1333565    29-JAN-24 /u01/app/oracle/oradata/ora11g/users01.dbf
  5       Full 1333565    29-JAN-24 /u01/app/oracle/oradata/ora11g/example01.dbf

BS Key  Type LV Size       Device Type Elapsed Time Completion Time
------- ---- -- ---------- ----------- ------------ ---------------
35      Full    9.95M      DISK        00:00:01     29-JAN-24
        BP Key: 39   Status: AVAILABLE  Compressed: NO  Tag: TAG20240129T163556
        Piece Name: /u01/app/oracle/fast_recovery_area/ORA11G/autobackup/2024_01_29/o1_mf_s_1159547756_lvgobwvy_.bkp
  SPFILE Included: Modification time: 29-JAN-24
  SPFILE db_unique_name: ORA11G
  Control File Included: Ckp SCN: 1333583      Ckp time: 29-JAN-24