Backup for pluggable db and restoring
[oracle@test ~]$ rman target=/
Recovery Manager: Release 19.0.0.0.0 - Production on Wed Dec 27 17:22:28 2023
Version 19.3.0.0.0
Copyright (c) 1982, 2019, Oracle and/or its affiliates. All rights reserved.
connected to target database: ORCL (DBID=1680360448)
RMAN>
RMAN> list backup of database orclpdb;
using target database control file instead of recovery catalog
List of Backup Sets
===================
BS Key Type LV Size Device Type Elapsed Time Completion Time
------- ---- -- ---------- ----------- ------------ ---------------
4 Full 505.75M DISK 00:00:02 27-DEC-23
BP Key: 4 Status: AVAILABLE Compressed: NO Tag: TAG20231227T164131
Piece Name: /u01/app/oracle/fast_recovery_area/ORCL/09D7302C9140311CE0639802A8C09C66/backupset/2023_12_27/o1_mf_nnndf_TAG20231227T164131_lrrnzwvn_.bkp
List of Datafiles in backup set 4
Container ID: 3, PDB Name: ORCLPDB
File LV Type Ckp SCN Ckp Time Abs Fuz SCN Sparse Name
---- -- ---- ---------- --------- ----------- ------ ----
9 Full 9861657 27-DEC-23 NO /u01/app/oracle/oradata/ORCL/orclpdb/system01.dbf
10 Full 9861657 27-DEC-23 NO /u01/app/oracle/oradata/ORCL/orclpdb/sysaux01.dbf
11 Full 9861657 27-DEC-23 NO /u01/app/oracle/oradata/ORCL/orclpdb/undotbs01.dbf
12 Full 9861657 27-DEC-23 NO /u01/app/oracle/oradata/ORCL/orclpdb/users01.dbf
RMAN>
RMAN> backup database orclpdb plus archivelog;
Starting backup at 27-DEC-23
current log archived
allocated channel: ORA_DISK_1
channel ORA_DISK_1: SID=401 device type=DISK
channel ORA_DISK_1: starting archived log backup set
channel ORA_DISK_1: specifying archived log(s) in backup set
input archived log thread=1 sequence=61 RECID=1 STAMP=1156696890
input archived log thread=1 sequence=62 RECID=2 STAMP=1156696981
input archived log thread=1 sequence=63 RECID=3 STAMP=1156699533
channel ORA_DISK_1: starting piece 1 at 27-DEC-23
channel ORA_DISK_1: finished piece 1 at 27-DEC-23
piece handle=/u01/app/oracle/fast_recovery_area/ORCL/backupset/2023_12_27/o1_mf_annnn_TAG20231227T172534_lrrqjg2b_.bkp tag=TAG20231227T172534 comment=NONE
channel ORA_DISK_1: backup set complete, elapsed time: 00:00:01
Finished backup at 27-DEC-23
Starting backup at 27-DEC-23
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=00010 name=/u01/app/oracle/oradata/ORCL/orclpdb/sysaux01.dbf
input datafile file number=00009 name=/u01/app/oracle/oradata/ORCL/orclpdb/system01.dbf
input datafile file number=00011 name=/u01/app/oracle/oradata/ORCL/orclpdb/undotbs01.dbf
input datafile file number=00012 name=/u01/app/oracle/oradata/ORCL/orclpdb/users01.dbf
channel ORA_DISK_1: starting piece 1 at 27-DEC-23
channel ORA_DISK_1: finished piece 1 at 27-DEC-23
piece handle=/u01/app/oracle/fast_recovery_area/ORCL/09D7302C9140311CE0639802A8C09C66/backupset/2023_12_27/o1_mf_nnndf_TAG20231227T172535_lrrqjh87_.bkp tag=TAG20231227T172535 comment=NONE
channel ORA_DISK_1: backup set complete, elapsed time: 00:00:03
Finished backup at 27-DEC-23
Starting backup at 27-DEC-23
current log archived
using channel ORA_DISK_1
channel ORA_DISK_1: starting archived log backup set
channel ORA_DISK_1: specifying archived log(s) in backup set
input archived log thread=1 sequence=64 RECID=4 STAMP=1156699538
channel ORA_DISK_1: starting piece 1 at 27-DEC-23
channel ORA_DISK_1: finished piece 1 at 27-DEC-23
piece handle=/u01/app/oracle/fast_recovery_area/ORCL/backupset/2023_12_27/o1_mf_annnn_TAG20231227T172538_lrrqjldb_.bkp tag=TAG20231227T172538 comment=NONE
channel ORA_DISK_1: backup set complete, elapsed time: 00:00:01
Finished backup at 27-DEC-23
Starting Control File and SPFILE Autobackup at 27-DEC-23
piece handle=/u01/app/oracle/fast_recovery_area/ORCL/autobackup/2023_12_27/o1_mf_s_1156699539_lrrqjmjf_.bkp comment=NONE
Finished Control File and SPFILE Autobackup at 27-DEC-23
RMAN>
RMAN> list backup of database orclpdb;
List of Backup Sets
===================
BS Key Type LV Size Device Type Elapsed Time Completion Time
------- ---- -- ---------- ----------- ------------ ---------------
4 Full 505.75M DISK 00:00:02 27-DEC-23
BP Key: 4 Status: AVAILABLE Compressed: NO Tag: TAG20231227T164131
Piece Name: /u01/app/oracle/fast_recovery_area/ORCL/09D7302C9140311CE0639802A8C09C66/backupset/2023_12_27/o1_mf_nnndf_TAG20231227T164131_lrrnzwvn_.bkp
List of Datafiles in backup set 4
Container ID: 3, PDB Name: ORCLPDB
File LV Type Ckp SCN Ckp Time Abs Fuz SCN Sparse Name
---- -- ---- ---------- --------- ----------- ------ ----
9 Full 9861657 27-DEC-23 NO /u01/app/oracle/oradata/ORCL/orclpdb/system01.dbf
10 Full 9861657 27-DEC-23 NO /u01/app/oracle/oradata/ORCL/orclpdb/sysaux01.dbf
11 Full 9861657 27-DEC-23 NO /u01/app/oracle/oradata/ORCL/orclpdb/undotbs01.dbf
12 Full 9861657 27-DEC-23 NO /u01/app/oracle/oradata/ORCL/orclpdb/users01.dbf
BS Key Type LV Size Device Type Elapsed Time Completion Time
------- ---- -- ---------- ----------- ------------ ---------------
11 Full 505.82M DISK 00:00:01 27-DEC-23
BP Key: 11 Status: AVAILABLE Compressed: NO Tag: TAG20231227T172535
Piece Name: /u01/app/oracle/fast_recovery_area/ORCL/09D7302C9140311CE0639802A8C09C66/backupset/2023_12_27/o1_mf_nnndf_TAG20231227T172535_lrrqjh87_.bkp
List of Datafiles in backup set 11
Container ID: 3, PDB Name: ORCLPDB
File LV Type Ckp SCN Ckp Time Abs Fuz SCN Sparse Name
---- -- ---- ---------- --------- ----------- ------ ----
9 Full 9867253 27-DEC-23 NO /u01/app/oracle/oradata/ORCL/orclpdb/system01.dbf
10 Full 9867253 27-DEC-23 NO /u01/app/oracle/oradata/ORCL/orclpdb/sysaux01.dbf
11 Full 9867253 27-DEC-23 NO /u01/app/oracle/oradata/ORCL/orclpdb/undotbs01.dbf
12 Full 9867253 27-DEC-23 NO /u01/app/oracle/oradata/ORCL/orclpdb/users01.dbf
RMAN>
# system01.dbf 파일을 삭제하여 DB 오류를 강제로 만든다
[oracle@test ORCL]$ cd orclpdb/
[oracle@test orclpdb]$ ll
합계 883932
-rw-r----- 1 oracle oinstall 377495552 12월 27 17:27 sysaux01.dbf
-rw-r----- 1 oracle oinstall 293609472 12월 27 17:27 system01.dbf
-rw-r----- 1 oracle oinstall 134225920 12월 25 01:40 temp01.dbf
-rw-r----- 1 oracle oinstall 104865792 12월 27 17:27 undotbs01.dbf
-rw-r----- 1 oracle oinstall 5251072 12월 27 17:27 users01.dbf
[oracle@test orclpdb]$ pwd
/u01/app/oracle/oradata/ORCL/orclpdb
[oracle@test orclpdb]$ rm system01.dbf
[oracle@test orclpdb]$ ll
합계 597204
-rw-r----- 1 oracle oinstall 377495552 12월 27 17:27 sysaux01.dbf
-rw-r----- 1 oracle oinstall 134225920 12월 25 01:40 temp01.dbf
-rw-r----- 1 oracle oinstall 104865792 12월 27 17:27 undotbs01.dbf
-rw-r----- 1 oracle oinstall 5251072 12월 27 17:27 users01.dbf
[oracle@test orclpdb]$
# 오류를 발생시킨 DB를 close/open 하면서 오류를 발생시킨다.
[oracle@test orclpdb]$ sqlplus / as sysdba
SQL*Plus: Release 19.0.0.0.0 - Production on Wed Dec 27 17:29:28 2023
Version 19.3.0.0.0
Copyright (c) 1982, 2019, Oracle. All rights reserved.
Connected to:
Oracle Database 19c Enterprise Edition Release 19.0.0.0.0 - Production
Version 19.3.0.0.0
SQL> show pdbs
CON_ID CON_NAME OPEN MODE RESTRICTED
---------- ------------------------------ ---------- ----------
2 PDB$SEED READ ONLY NO
3 ORCLPDB READ WRITE NO
6 PROD1 MOUNTED
7 PROD2 MOUNTED
SQL> alter pluggable database orclpdb close;
Pluggable database altered.
SQL> alter pluggable database orclpdb open;
alter pluggable database orclpdb open
*
ERROR at line 1:
ORA-65368: unable to open the pluggable database due to errors during recovery
ORA-01110: data file 9: '/u01/app/oracle/oradata/ORCL/orclpdb/system01.dbf'
ORA-01157: cannot identify/lock data file 9 - see DBWR trace file
ORA-01110: data file 9: '/u01/app/oracle/oradata/ORCL/orclpdb/system01.dbf'
ORA-01113: file 12 needs media recovery
ORA-01110: data file 12: '/u01/app/oracle/oradata/ORCL/orclpdb/users01.dbf'
SQL>
RMAN> RUN
{
RESTORE PLUGGABLE DATABASE orclpdb;
RECOVER PLUGGABLE DATABASE orclpdb;
ALTER PLUGGABLE DATABASE orclpdb open;
}
2> 3> 4> 5> 6>
Starting restore at 27-DEC-23
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 00009 to /u01/app/oracle/oradata/ORCL/orclpdb/system01.dbf
channel ORA_DISK_1: restoring datafile 00010 to /u01/app/oracle/oradata/ORCL/orclpdb/sysaux01.dbf
channel ORA_DISK_1: restoring datafile 00011 to /u01/app/oracle/oradata/ORCL/orclpdb/undotbs01.dbf
channel ORA_DISK_1: restoring datafile 00012 to /u01/app/oracle/oradata/ORCL/orclpdb/users01.dbf
channel ORA_DISK_1: reading from backup piece /u01/app/oracle/fast_recovery_area/ORCL/09D7302C9140311CE0639802A8C09C66/backupset/2023_12_27/o1_mf_nnndf_TAG20231227T172535_lrrqjh87_.bkp
channel ORA_DISK_1: piece handle=/u01/app/oracle/fast_recovery_area/ORCL/09D7302C9140311CE0639802A8C09C66/backupset/2023_12_27/o1_mf_nnndf_TAG20231227T172535_lrrqjh87_.bkp tag=TAG20231227T172535
channel ORA_DISK_1: restored backup piece 1
channel ORA_DISK_1: restore complete, elapsed time: 00:00:07
Finished restore at 27-DEC-23
Starting recover at 27-DEC-23
using channel ORA_DISK_1
starting media recovery
media recovery complete, elapsed time: 00:00:00
Finished recover at 27-DEC-23
Statement processed
RMAN>
[oracle@test ~]$ sqlplus / as sysdba
SQL*Plus: Release 19.0.0.0.0 - Production on Wed Dec 27 17:32:41 2023
Version 19.3.0.0.0
Copyright (c) 1982, 2019, Oracle. All rights reserved.
Connected to:
Oracle Database 19c Enterprise Edition Release 19.0.0.0.0 - Production
Version 19.3.0.0.0
SQL> show pdbs
CON_ID CON_NAME OPEN MODE RESTRICTED
---------- ------------------------------ ---------- ----------
2 PDB$SEED READ ONLY NO
3 ORCLPDB READ WRITE NO
6 PROD1 MOUNTED
7 PROD2 MOUNTED
SQL> alter pluggable database orclpdb close;
Pluggable database altered.
SQL> show pdbs
CON_ID CON_NAME OPEN MODE RESTRICTED
---------- ------------------------------ ---------- ----------
2 PDB$SEED READ ONLY NO
3 ORCLPDB MOUNTED
6 PROD1 MOUNTED
7 PROD2 MOUNTED
SQL> alter pluggable database orclpdb open;
Pluggable database altered.
SQL> show pdbs
CON_ID CON_NAME OPEN MODE RESTRICTED
---------- ------------------------------ ---------- ----------
2 PDB$SEED READ ONLY NO
3 ORCLPDB READ WRITE NO
6 PROD1 MOUNTED
7 PROD2 MOUNTED
SQL>
'Database > Oracle' 카테고리의 다른 글
118 - [Oracle 19C] Full backup for CDB and restoring (1) | 2023.12.28 |
---|---|
117 - [Oracle 19C] Configuring fast recovery area (0) | 2023.12.28 |
116 - [Oracle 19C] Enableing ARCHIVELOG mode. (0) | 2023.12.28 |
115 - [Oracle 19C] External table with PARTITIONS (0) | 2023.12.27 |
114 - [Oracle 19C] SQL*Loader express mode (1) | 2023.12.27 |