2
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 1 year has passed since last update.

RMAN 増分バックアップで新しいデータベース・サーバーを作成する方法

Last updated at Posted at 2021-09-27

RMAN 増分バックアップで新しいデータベース・サーバーを作成する方法

前回はデータベースのフルバックアップから新しいデータベースを作成する方法を紹介しました。最後のところで、データ量が大き場合バックアップやリストアする時にかかる時間がかなり長くなる可能性があるという考察がありました。

今回はRMANの増分バックアップとリストア/リカバリの技術を用いて、データ量が大きいでもバックアップとリストア/リカバリは早く完了できるような方法を紹介します。

想定したシナリオは下記の通りです。

image.png

①オンプレミス環境(平常時):

  • Backup Moduleを使ってオンプレ・データベースからOCI Object Storageへバックアップをします。
  • 用意したOCI Compute Instanceのデータベースへ上記取得したバックアップを随時に適用(リカバリ)します。ただ、データベースはオープンしません。バックアップをリカバリした後にCompute Instanceを停止しても構いません。

②オンプレミス環境(障害時):

  • 上記の OCI Compute Instance(最新のバックアップを適用後)を起動し、データベースをオープン(RESETLOGSが必要)します。オンプレミス環境がリペアできるまで、このデータベースでサービスを提供します。
  • Backup Moduleを使ってOCI Compute InstanceのデータベースをOCI Object Storageへバックアップをします。
  • 同時に、オンプレミス環境のリペア作業を行います。

③オンプレミス環境(復旧後):

  • オンプレミス環境にデータベースを構築し、取得したOCI Compute Instanceのデータベースのバックアップから新しいデータベースをリストア/リカバリします。

上記の流れを見て、いくつかステップがありますが、基本的なのは2つ(バックアップの取得、バックアップの適用)しかありません。違うところは異なるステップにソース(バックアップの取得対象)とターゲット(バックアップの適用対象)が異なります。

このため、上記のシナリオのステップを抽象し、ステップを下記のように紹介します。

  1. ソース・データベースの LEVEL0 のバックアップを取得
  2. ソース・データベースの LEVEL1 のバックアップを取得
  3. ターゲット・データベースへ取得したバックアップを適用
  4. ターゲット・データベースをオープンし、サービスを提供

データベース・サーバーにはOCI-CLIBackup Moduleのインストールが完了したと想定します。具体的なインストール方法は前回の記事「Oracle Database Cloud Backup ModuleでデータベースをOCI Object Storageにバックアップする方法」のOCI-CLIの設定Backup Moduleの設定のセクションを参照してください。

ソース・データベースの LEVEL0 のバックアップを取得

Oracle Database Cloud Backup Moduleを使ってデータベースのバックアップを実施する時に暗号化しておく必要がありますので、忘れないでください。

暗号化の設定

[oracle@oda10 ~]$ rman target /

Recovery Manager: Release 19.0.0.0.0 - Production on Wed Sep 15 09:16:33 2021
Version 19.3.0.0.0

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

connected to target database: ORCL (DBID=1610037248)

RMAN> SET ENCRYPTION ON IDENTIFIED BY <PASSWORD> ONLY;

executing command: SET encryption

LEVEL0 のバックアップを取得

RMAN> BACKUP INCREMENTAL LEVEL 0 DATABASE TAG ODA10_INC_L0_DATAFILE_00 PLUS ARCHIVELOG TAG ODA10_ARCHIVELOG_00;


Starting backup at 2021/09/17 03:39:36
current log archived
released channel: ORA_DISK_1
using channel ORA_SBT_TAPE_1
channel ORA_SBT_TAPE_1: starting compressed archived log backup set
channel ORA_SBT_TAPE_1: specifying archived log(s) in backup set
input archived log thread=1 sequence=9 RECID=5 STAMP=1082790657
input archived log thread=1 sequence=10 RECID=6 STAMP=1082795993
input archived log thread=1 sequence=11 RECID=7 STAMP=1082796039
input archived log thread=1 sequence=12 RECID=8 STAMP=1082796691
input archived log thread=1 sequence=13 RECID=9 STAMP=1082796713
input archived log thread=1 sequence=14 RECID=10 STAMP=1082858988
input archived log thread=1 sequence=15 RECID=11 STAMP=1082863243
input archived log thread=1 sequence=16 RECID=12 STAMP=1082863262
input archived log thread=1 sequence=17 RECID=13 STAMP=1082863312
input archived log thread=1 sequence=18 RECID=14 STAMP=1083246110
input archived log thread=1 sequence=19 RECID=15 STAMP=1083247386
input archived log thread=1 sequence=20 RECID=16 STAMP=1083247420
input archived log thread=1 sequence=21 RECID=17 STAMP=1083247471
input archived log thread=1 sequence=22 RECID=18 STAMP=1083247641
input archived log thread=1 sequence=23 RECID=19 STAMP=1083247652
input archived log thread=1 sequence=24 RECID=20 STAMP=1083249284
input archived log thread=1 sequence=25 RECID=21 STAMP=1083249294
input archived log thread=1 sequence=26 RECID=22 STAMP=1083289742
input archived log thread=1 sequence=27 RECID=23 STAMP=1083294512
input archived log thread=1 sequence=28 RECID=24 STAMP=1083294538
input archived log thread=1 sequence=29 RECID=25 STAMP=1083294589
input archived log thread=1 sequence=30 RECID=26 STAMP=1083304920
input archived log thread=1 sequence=31 RECID=27 STAMP=1083304938
input archived log thread=1 sequence=32 RECID=28 STAMP=1083310304
input archived log thread=1 sequence=33 RECID=29 STAMP=1083310326
input archived log thread=1 sequence=34 RECID=32 STAMP=1083316229
input archived log thread=1 sequence=35 RECID=33 STAMP=1083316229
input archived log thread=1 sequence=36 RECID=34 STAMP=1083316229
channel ORA_SBT_TAPE_1: starting piece 1 at 2021/09/17 03:39:36
channel ORA_SBT_TAPE_1: finished piece 1 at 2021/09/17 03:39:43
piece handle=28098rbo_1_1 tag=ODA10_ARCHIVELOG_00 comment=API Version 2.0,MMS Version 19.0.0.1
channel ORA_SBT_TAPE_1: backup set complete, elapsed time: 00:00:07
channel ORA_SBT_TAPE_1: starting compressed archived log backup set
channel ORA_SBT_TAPE_1: specifying archived log(s) in backup set
input archived log thread=1 sequence=1 RECID=35 STAMP=1083316859
input archived log thread=1 sequence=2 RECID=36 STAMP=1083316885
input archived log thread=1 sequence=3 RECID=37 STAMP=1083335478
input archived log thread=1 sequence=4 RECID=38 STAMP=1083335500
input archived log thread=1 sequence=5 RECID=39 STAMP=1083335514
input archived log thread=1 sequence=6 RECID=40 STAMP=1083336644
input archived log thread=1 sequence=7 RECID=41 STAMP=1083341296
input archived log thread=1 sequence=8 RECID=42 STAMP=1083341309
input archived log thread=1 sequence=9 RECID=43 STAMP=1083341354
input archived log thread=1 sequence=10 RECID=44 STAMP=1083468794
input archived log thread=1 sequence=11 RECID=45 STAMP=1083469176
channel ORA_SBT_TAPE_1: starting piece 1 at 2021/09/17 03:39:43
channel ORA_SBT_TAPE_1: finished piece 1 at 2021/09/17 03:39:46
piece handle=29098rbv_1_1 tag=ODA10_ARCHIVELOG_00 comment=API Version 2.0,MMS Version 19.0.0.1
channel ORA_SBT_TAPE_1: backup set complete, elapsed time: 00:00:03
Finished backup at 2021/09/17 03:39:46

Starting backup at 2021/09/17 03:39:46
using channel ORA_SBT_TAPE_1
channel ORA_SBT_TAPE_1: starting compressed incremental level 0 datafile backup set
channel ORA_SBT_TAPE_1: specifying datafile(s) in backup set
input datafile file number=00001 name=/u01/app/oracle/oradata/ORCL/system01.dbf
input datafile file number=00003 name=/u01/app/oracle/oradata/ORCL/sysaux01.dbf
input datafile file number=00004 name=/u01/app/oracle/oradata/ORCL/undotbs01.dbf
input datafile file number=00007 name=/u01/app/oracle/oradata/ORCL/users01.dbf
channel ORA_SBT_TAPE_1: starting piece 1 at 2021/09/17 03:39:46
channel ORA_SBT_TAPE_1: finished piece 1 at 2021/09/17 03:40:21
piece handle=2a098rc2_1_1 tag=ODA10_INC_L0_DATAFILE_00 comment=API Version 2.0,MMS Version 19.0.0.1
channel ORA_SBT_TAPE_1: backup set complete, elapsed time: 00:00:35
Finished backup at 2021/09/17 03:40:21

Starting backup at 2021/09/17 03:40:21
current log archived
using channel ORA_SBT_TAPE_1
channel ORA_SBT_TAPE_1: starting compressed archived log backup set
channel ORA_SBT_TAPE_1: specifying archived log(s) in backup set
input archived log thread=1 sequence=12 RECID=46 STAMP=1083469221
channel ORA_SBT_TAPE_1: starting piece 1 at 2021/09/17 03:40:21
channel ORA_SBT_TAPE_1: finished piece 1 at 2021/09/17 03:40:24
piece handle=2b098rd5_1_1 tag=ODA10_ARCHIVELOG_00 comment=API Version 2.0,MMS Version 19.0.0.1
channel ORA_SBT_TAPE_1: backup set complete, elapsed time: 00:00:03
Finished backup at 2021/09/17 03:40:24

Starting Control File and SPFILE Autobackup at 2021/09/17 03:40:24
piece handle=c-1610037248-20210917-00 comment=API Version 2.0,MMS Version 19.0.0.1
Finished Control File and SPFILE Autobackup at 2021/09/17 03:40:28

RMAN>

バックアップのリストを確認

RMAN> LIST BACKUP;


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


BS Key  Size       Device Type Elapsed Time Completion Time
------- ---------- ----------- ------------ -------------------
65      44.50M     SBT_TAPE    00:00:04     2021/09/17 03:39:40
        BP Key: 65   Status: AVAILABLE  Compressed: YES  Tag: ODA10_ARCHIVELOG_00
        Handle: 28098rbo_1_1   Media: objectstorage.us-phoenix..oud.com/n/sehubjapacprod/rex-db-backup

  List of Archived Logs in backup set 65
  Thrd Seq     Low SCN    Low Time            Next SCN   Next Time
  ---- ------- ---------- ------------------- ---------- ---------
  1    9       2349525    2021/09/05 15:14:39 2503665    2021/09/09 07:10:54
  1    10      2503665    2021/09/09 07:10:54 2510456    2021/09/09 08:39:53
  1    11      2510456    2021/09/09 08:39:53 2510506    2021/09/09 08:40:39
  1    12      2510506    2021/09/09 08:40:39 2510959    2021/09/09 08:51:31
  1    13      2510959    2021/09/09 08:51:31 2510987    2021/09/09 08:51:53
  1    14      2510987    2021/09/09 08:51:53 2624119    2021/09/10 02:09:48
  1    15      2624119    2021/09/10 02:09:48 2628728    2021/09/10 03:20:43
  1    16      2628728    2021/09/10 03:20:43 2628758    2021/09/10 03:21:02
  1    17      2628758    2021/09/10 03:21:02 2628806    2021/09/10 03:21:52
  1    18      2628806    2021/09/10 03:21:52 2753748    2021/09/14 13:41:49
  1    19      2753748    2021/09/14 13:41:49 2756519    2021/09/14 14:03:06
  1    20      2756519    2021/09/14 14:03:06 2756575    2021/09/14 14:03:40
  1    21      2756575    2021/09/14 14:03:40 2756616    2021/09/14 14:04:31
  1    22      2756616    2021/09/14 14:04:31 2756755    2021/09/14 14:07:21
  1    23      2756755    2021/09/14 14:07:21 2756776    2021/09/14 14:07:31
  1    24      2756776    2021/09/14 14:07:31 2758260    2021/09/14 14:34:43
  1    25      2758260    2021/09/14 14:34:43 2758281    2021/09/14 14:34:54
  1    26      2758281    2021/09/14 14:34:54 2858633    2021/09/15 01:49:01
  1    27      2858633    2021/09/15 01:49:01 2868776    2021/09/15 03:08:32
  1    28      2868776    2021/09/15 03:08:32 2868807    2021/09/15 03:08:58
  1    29      2868807    2021/09/15 03:08:58 2868856    2021/09/15 03:09:49
  1    30      2868856    2021/09/15 03:09:49 2875023    2021/09/15 06:02:00
  1    31      2875023    2021/09/15 06:02:00 2875046    2021/09/15 06:02:18
  1    32      2875046    2021/09/15 06:02:18 2878497    2021/09/15 07:31:44
  1    33      2878497    2021/09/15 07:31:44 2878521    2021/09/15 07:32:06
  1    34      2878521    2021/09/15 07:32:06 2878780    2021/09/15 07:38:58
  1    35      2878780    2021/09/15 07:38:58 2878801    2021/09/15 07:39:09
  1    36      2878801    2021/09/15 07:39:09 2882428    2021/09/15 09:10:29

BS Key  Size       Device Type Elapsed Time Completion Time
------- ---------- ----------- ------------ -------------------
66      6.25M      SBT_TAPE    00:00:01     2021/09/17 03:39:44
        BP Key: 66   Status: AVAILABLE  Compressed: YES  Tag: ODA10_ARCHIVELOG_00
        Handle: 29098rbv_1_1   Media: objectstorage.us-phoenix..oud.com/n/sehubjapacprod/rex-db-backup

  List of Archived Logs in backup set 66
  Thrd Seq     Low SCN    Low Time            Next SCN   Next Time
  ---- ------- ---------- ------------------- ---------- ---------
  1    1       2882301    2021/09/15 09:10:29 2883385    2021/09/15 09:20:59
  1    2       2883385    2021/09/15 09:20:59 2883416    2021/09/15 09:21:25
  1    3       2883416    2021/09/15 09:21:25 2895728    2021/09/15 14:31:18
  1    4       2895728    2021/09/15 14:31:18 2895760    2021/09/15 14:31:40
  1    5       2895760    2021/09/15 14:31:40 2895785    2021/09/15 14:31:54
  1    6       2895785    2021/09/15 14:31:54 2996194    2021/09/15 14:50:43
  1    7       2996194    2021/09/15 14:50:43 3000923    2021/09/15 16:08:15
  1    8       3000923    2021/09/15 16:08:15 3000948    2021/09/15 16:08:29
  1    9       3000948    2021/09/15 16:08:29 3000983    2021/09/15 16:09:14
  1    10      3000983    2021/09/15 16:09:14 3101861    2021/09/17 03:33:14
  1    11      3101861    2021/09/17 03:33:14 3108643    2021/09/17 03:39:36

BS Key  Type LV Size       Device Type Elapsed Time Completion Time
------- ---- -- ---------- ----------- ------------ -------------------
67      Incr 0  269.00M    SBT_TAPE    00:00:28     2021/09/17 03:40:14
        BP Key: 67   Status: AVAILABLE  Compressed: YES  Tag: ODA10_INC_L0_DATAFILE_00
        Handle: 2a098rc2_1_1   Media: objectstorage.us-phoenix..oud.com/n/sehubjapacprod/rex-db-backup
  List of Datafiles in backup set 67
  File LV Type Ckp SCN    Ckp Time            Abs Fuz SCN Sparse Name
  ---- -- ---- ---------- ------------------- ----------- ------ ----
  1    0  Incr 3108661    2021/09/17 03:39:46              NO    /u01/app/oracle/oradata/ORCL/system01.dbf
  3    0  Incr 3108661    2021/09/17 03:39:46              NO    /u01/app/oracle/oradata/ORCL/sysaux01.dbf
  4    0  Incr 3108661    2021/09/17 03:39:46              NO    /u01/app/oracle/oradata/ORCL/undotbs01.dbf
  7    0  Incr 3108661    2021/09/17 03:39:46              NO    /u01/app/oracle/oradata/ORCL/users01.dbf

BS Key  Size       Device Type Elapsed Time Completion Time
------- ---------- ----------- ------------ -------------------
68      256.00K    SBT_TAPE    00:00:01     2021/09/17 03:40:22
        BP Key: 68   Status: AVAILABLE  Compressed: YES  Tag: ODA10_ARCHIVELOG_00
        Handle: 2b098rd5_1_1   Media: objectstorage.us-phoenix..oud.com/n/sehubjapacprod/rex-db-backup

  List of Archived Logs in backup set 68
  Thrd Seq     Low SCN    Low Time            Next SCN   Next Time
  ---- ------- ---------- ------------------- ---------- ---------
  1    12      3108643    2021/09/17 03:39:36 3108682    2021/09/17 03:40:21

BS Key  Type LV Size       Device Type Elapsed Time Completion Time
------- ---- -- ---------- ----------- ------------ -------------------
69      Full    512.00K    SBT_TAPE    00:00:00     2021/09/17 03:40:25
        BP Key: 69   Status: AVAILABLE  Compressed: YES  Tag: TAG20210917T034025
        Handle: c-1610037248-20210917-00   Media: objectstorage.us-phoenix..oud.com/n/sehubjapacprod/rex-db-backup
  SPFILE Included: Modification time: 2021/09/17 03:33:15
  SPFILE db_unique_name: ORCL
  Control File Included: Ckp SCN: 3108694      Ckp time: 2021/09/17 03:40:25

RMAN>

ターゲット・データベースへ取得したバックアップ(LEVEL0)を適用

ターゲット・データベース・サーバーにおける必要な準備が完了したと想定しますので、リストア作業から紹介しておきます。

復号化とDBIDの設定

OCI Object Storageにバックアップをした時に暗号化が必要でした。バックアップからファイルをリストアする時にも復号化が必要です。このため、リストアする前にまず復号化の設定をしておきます。

[oracle@oda11 ~]$ rman target /

Recovery Manager: Release 19.0.0.0.0 - Production on Fri Sep 17 03:45:50 2021
Version 19.3.0.0.0

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

connected to target database (not started)

# データベース・インスタンスを起動
RMAN> STARTUP NOMOUNT;

Oracle instance started

Total System Global Area    6291453600 bytes

Fixed Size                     8910496 bytes
Variable Size               1073741824 bytes
Database Buffers            5200936960 bytes
Redo Buffers                   7864320 bytes

# 復号化のパスワードを設定
RMAN> SET DECRYPTION IDENTIFIED BY <PASSWORD>;

executing command: SET decryption
using target database control file instead of recovery catalog

# DBIDを設定
RMAN> SET DBID=1610037248;

executing command: SET DBID

SPFILE のリストア

OCI Object Storage から SPFILE をリストアします。

# SPFILEをリストア
RMAN> RUN {
ALLOCATE CHANNEL t1 DEVICE TYPE SBT_TAPE PARMS='SBT_LIBRARY=/home/oracle/lib/libopc.so, SBT_PARMS=(OPC_PFILE=/u01/app/oracle/product/19.0.0/dbhome_1/dbs/opcORCL.ora)';
RESTORE SPFILE TO PFILE '/u01/app/oracle/product/19.0.0/dbhome_1/dbs/initORCL.ora' FROM AUTOBACKUP;
}

allocated channel: t1
channel t1: SID=21 device type=SBT_TAPE
channel t1: Oracle Database Backup Service Library VER=19.0.0.1

Starting restore at 2021/09/17 03:46:45

channel t1: looking for AUTOBACKUP on day: 20210917
channel t1: AUTOBACKUP found: c-1610037248-20210917-00
channel t1: restoring spfile from AUTOBACKUP c-1610037248-20210917-00
channel t1: SPFILE restore from AUTOBACKUP complete
Finished restore at 2021/09/17 03:46:56
released channel: t1

RMAN>

SPFILEの作成

リストアされたばかりの SPFILE は PFILE の形式で存在します。自動バックアップするため、SQLコマンド create spfile from pfile; で 新しい SPFILE を作成します。

SQL> SHOW PARAMETER SPFILE;
SQL> CREATE SPFILE FROM PFILE;
SQL> SHUTDOWN IMMEDIATE
SQL> STARTUP NOMOUNT
SQL> SHOW PARAMETER SPFILE;

必要なディレクトリを確保

SPFILEの中に記載されているディレクトリが存在することを確保します。

[oracle@oda11 ~]$ cat cat /u01/app/oracle/product/19.0.0/dbhome_1/dbs/initORCL.ora
cat: cat: No such file or directory
ORCL.__data_transfer_cache_size=0
ORCL.__db_cache_size=5066719232
ORCL.__inmemory_ext_roarea=0
ORCL.__inmemory_ext_rwarea=0
ORCL.__java_pool_size=0
ORCL.__large_pool_size=16777216
ORCL.__oracle_base='/u01/app/oracle'#ORACLE_BASE set from environment
ORCL.__pga_aggregate_target=2097152000
ORCL.__sga_target=6291456000
ORCL.__shared_io_pool_size=134217728
ORCL.__shared_pool_size=1056964608
ORCL.__streams_pool_size=0
ORCL.__unified_pga_pool_size=0
*.audit_file_dest='/u01/app/oracle/admin/ORCL/adump'
*.audit_trail='db'
*.compatible='19.0.0'
*.control_files='/u01/app/oracle/oradata/ORCL/control01.ctl','/u01/app/oracle/oradata/ORCL/control02.ctl'
*.db_block_size=8192
*.db_flashback_retention_target=10080
*.db_name='ORCL'
*.db_recovery_file_dest_size=10737418240
*.db_recovery_file_dest='/u01/app/oracle/fast_recovery_area/'
*.diagnostic_dest='/u01/app/oracle'
*.dispatchers='(PROTOCOL=TCP) (SERVICE=ORCLXDB)'
*.nls_language='AMERICAN'
*.nls_territory='AMERICA'
*.open_cursors=300
*.pga_aggregate_target=2000m
*.processes=300
*.remote_login_passwordfile='EXCLUSIVE'
*.sga_target=6000m
*.undo_tablespace='UNDOTBS1'
[oracle@oda11 ~]$


# 必要なディレクトリを作成
[oracle@oda11 ~]$ mkdir -p /u01/app/oracle/fast_recovery_area/
[oracle@oda11 ~]$ mkdir -p /u01/app/oracle/admin/ORCL/adump
[oracle@oda11 ~]$ mkdir -p /u01/app/oracle/oradata/ORCL/

CONTROLFILE のリストア

リストアされた SPFILE からデータベース・インスタンスを再起動します。

RMAN> SHUTDOWN IMMEDIATE;

Oracle instance shut down

RMAN> STARTUP NOMOUNT;

connected to target database (not started)
Oracle instance started

Total System Global Area    6291453600 bytes

Fixed Size                     8910496 bytes
Variable Size               1073741824 bytes
Database Buffers            5200936960 bytes
Redo Buffers                   7864320 bytes

RMAN>

ソース・データベースの CONTROLFILE をリストアします。

RMAN> RUN {
ALLOCATE CHANNEL t1 DEVICE TYPE SBT_TAPE PARMS='SBT_LIBRARY=/home/oracle/lib/libopc.so, SBT_PARMS=(OPC_PFILE=/u01/app/oracle/product/19.0.0/dbhome_1/dbs/opcORCL.ora)';
RESTORE CONTROLFILE FROM AUTOBACKUP;
}

# log
allocated channel: t1
channel t1: SID=21 device type=SBT_TAPE
channel t1: Oracle Database Backup Service Library VER=19.0.0.1

Starting restore at 2021/09/17 03:55:23

channel t1: looking for AUTOBACKUP on day: 20210917
channel t1: AUTOBACKUP found: c-1610037248-20210917-00
channel t1: restoring control file from AUTOBACKUP c-1610037248-20210917-00
channel t1: control file restore from AUTOBACKUP complete
output file name=/u01/app/oracle/oradata/ORCL/control01.ctl
output file name=/u01/app/oracle/oradata/ORCL/control02.ctl
Finished restore at 2021/09/17 03:55:34
released channel: t1

RMAN>

データベースをMOUNTに変更

RMAN> ALTER DATABASE MOUNT;

Statement processed

ソース・データベースの RMAN の設定が正しく反映されたことを確認します。

RMAN> show all;

RMAN configuration parameters for database with db_unique_name ORCL are:
CONFIGURE RETENTION POLICY TO REDUNDANCY 1; # default
CONFIGURE BACKUP OPTIMIZATION OFF; # default
CONFIGURE DEFAULT DEVICE TYPE TO 'SBT_TAPE';
CONFIGURE CONTROLFILE AUTOBACKUP ON;
CONFIGURE CONTROLFILE AUTOBACKUP FORMAT FOR DEVICE TYPE SBT_TAPE TO '%F'; # default
CONFIGURE CONTROLFILE AUTOBACKUP FORMAT FOR DEVICE TYPE DISK TO '%F'; # default
CONFIGURE DEVICE TYPE 'SBT_TAPE' PARALLELISM 1 BACKUP TYPE TO COMPRESSED BACKUPSET;
CONFIGURE DEVICE TYPE DISK PARALLELISM 1 BACKUP TYPE TO BACKUPSET; # default
CONFIGURE DATAFILE BACKUP COPIES FOR DEVICE TYPE SBT_TAPE TO 1; # default
CONFIGURE DATAFILE BACKUP COPIES FOR DEVICE TYPE DISK TO 1; # default
CONFIGURE ARCHIVELOG BACKUP COPIES FOR DEVICE TYPE SBT_TAPE TO 1; # default
CONFIGURE ARCHIVELOG BACKUP COPIES FOR DEVICE TYPE DISK TO 1; # default
CONFIGURE CHANNEL DEVICE TYPE 'SBT_TAPE' PARMS  'SBT_LIBRARY=/home/oracle/lib/libopc.so, SBT_PARMS=(OPC_PFILE=/u01/app/oracle/product/19.0.0/dbhome_1/dbs/opcORCL.ora)';
CONFIGURE MAXSETSIZE TO UNLIMITED; # default
CONFIGURE ENCRYPTION FOR DATABASE OFF; # default
CONFIGURE ENCRYPTION ALGORITHM 'AES128'; # default
CONFIGURE COMPRESSION ALGORITHM 'MEDIUM' AS OF RELEASE 'DEFAULT' OPTIMIZE FOR LOAD TRUE;
CONFIGURE RMAN OUTPUT TO KEEP FOR 7 DAYS; # default
CONFIGURE ARCHIVELOG DELETION POLICY TO NONE; # default
CONFIGURE SNAPSHOT CONTROLFILE NAME TO '/u01/app/oracle/product/19.0.0/dbhome_1/dbs/snapcf_ORCL.f'; # default

RMAN>

データファイルのリストアのプレビュー

実際のリストアを実施する前に、プレビューしたほうがいいです。データベースを一致させるためのSCNを特定し、リストアする時に使用されるバックアップ・ピースやロケーションも確認します。

RMAN> RESTORE DATABASE PREVIEW;

Starting restore at 2021/09/17 03:56:52
Starting implicit crosscheck backup at 2021/09/17 03:56:52
allocated channel: ORA_DISK_1
channel ORA_DISK_1: SID=259 device type=DISK
Finished implicit crosscheck backup at 2021/09/17 03:56:52

Starting implicit crosscheck copy at 2021/09/17 03:56:52
using channel ORA_DISK_1
Finished implicit crosscheck copy at 2021/09/17 03:56:52

searching for all files in the recovery area
cataloging files...
no files cataloged

allocated channel: ORA_SBT_TAPE_1
channel ORA_SBT_TAPE_1: SID=26 device type=SBT_TAPE
channel ORA_SBT_TAPE_1: Oracle Database Backup Service Library VER=19.0.0.1
using channel ORA_DISK_1


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


BS Key  Type LV Size       Device Type Elapsed Time Completion Time
------- ---- -- ---------- ----------- ------------ -------------------
67      Incr 0  269.00M    SBT_TAPE    00:00:28     2021/09/17 03:40:14
        BP Key: 67   Status: AVAILABLE  Compressed: YES  Tag: ODA10_INC_L0_DATAFILE_00
        Handle: 2a098rc2_1_1   Media: objectstorage.us-phoenix..oud.com/n/sehubjapacprod/rex-db-backup
  List of Datafiles in backup set 67
  File LV Type Ckp SCN    Ckp Time            Abs Fuz SCN Sparse Name
  ---- -- ---- ---------- ------------------- ----------- ------ ----
  1    0  Incr 3108661    2021/09/17 03:39:46              NO    /u01/app/oracle/oradata/ORCL/system01.dbf
  3    0  Incr 3108661    2021/09/17 03:39:46              NO    /u01/app/oracle/oradata/ORCL/sysaux01.dbf
  4    0  Incr 3108661    2021/09/17 03:39:46              NO    /u01/app/oracle/oradata/ORCL/undotbs01.dbf
  7    0  Incr 3108661    2021/09/17 03:39:46              NO    /u01/app/oracle/oradata/ORCL/users01.dbf
using channel ORA_SBT_TAPE_1


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


BS Key  Size       Device Type Elapsed Time Completion Time
------- ---------- ----------- ------------ -------------------
68      256.00K    SBT_TAPE    00:00:01     2021/09/17 03:40:22
        BP Key: 68   Status: AVAILABLE  Compressed: YES  Tag: ODA10_ARCHIVELOG_00
        Handle: 2b098rd5_1_1   Media: objectstorage.us-phoenix..oud.com/n/sehubjapacprod/rex-db-backup

  List of Archived Logs in backup set 68
  Thrd Seq     Low SCN    Low Time            Next SCN   Next Time
  ---- ------- ---------- ------------------- ---------- ---------
  1    12      3108643    2021/09/17 03:39:36 3108682    2021/09/17 03:40:21
validation succeeded for backup piece
recovery will be done up to SCN 3108661
Media recovery start SCN is 3108661
Recovery must be done beyond SCN 3108661 to clear datafile fuzziness
validation succeeded for backup piece
Finished restore at 2021/09/17 03:56:53

RMAN>

データファイルのリストア

問題がなければ、データファイルのリストアを実施します。

RMAN> RESTORE DATABASE;

Starting restore at 2021/09/17 03:57:26
using channel ORA_SBT_TAPE_1
using channel ORA_DISK_1

channel ORA_SBT_TAPE_1: starting datafile backup set restore
channel ORA_SBT_TAPE_1: specifying datafile(s) to restore from backup set
channel ORA_SBT_TAPE_1: restoring datafile 00001 to /u01/app/oracle/oradata/ORCL/system01.dbf
channel ORA_SBT_TAPE_1: restoring datafile 00003 to /u01/app/oracle/oradata/ORCL/sysaux01.dbf
channel ORA_SBT_TAPE_1: restoring datafile 00004 to /u01/app/oracle/oradata/ORCL/undotbs01.dbf
channel ORA_SBT_TAPE_1: restoring datafile 00007 to /u01/app/oracle/oradata/ORCL/users01.dbf
channel ORA_SBT_TAPE_1: reading from backup piece 2a098rc2_1_1
channel ORA_SBT_TAPE_1: piece handle=2a098rc2_1_1 tag=ODA10_INC_L0_DATAFILE_00
channel ORA_SBT_TAPE_1: restored backup piece 1
channel ORA_SBT_TAPE_1: restore complete, elapsed time: 00:00:45
Finished restore at 2021/09/17 03:58:11

RMAN>

リカバリのプレビュー

プレビューで、リカバリを実行する時に具体的な動作を確認します。

RMAN> RECOVER DATABASE PREVIEW;

Starting recover at 2021/09/17 03:58:47
using channel ORA_SBT_TAPE_1
using channel ORA_DISK_1
using channel ORA_SBT_TAPE_1
using channel ORA_DISK_1


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


BS Key  Size       Device Type Elapsed Time Completion Time
------- ---------- ----------- ------------ -------------------
68      256.00K    SBT_TAPE    00:00:01     2021/09/17 03:40:22
        BP Key: 68   Status: AVAILABLE  Compressed: YES  Tag: ODA10_ARCHIVELOG_00
        Handle: 2b098rd5_1_1   Media: objectstorage.us-phoenix..oud.com/n/sehubjapacprod/rex-db-backup

  List of Archived Logs in backup set 68
  Thrd Seq     Low SCN    Low Time            Next SCN   Next Time
  ---- ------- ---------- ------------------- ---------- ---------
  1    12      3108643    2021/09/17 03:39:36 3108682    2021/09/17 03:40:21
validation succeeded for backup piece
recovery will be done up to SCN 3108661
Media recovery start SCN is 3108661
Recovery must be done beyond SCN 3108661 to clear datafile fuzziness
Finished recover at 2021/09/17 03:58:47

RMAN>

データベースをリカバリ

プレビューした時に特定された SCN を指定し、データベースのリカバリを実施します。

RMAN> RECOVER DATABASE UNTIL SCN 3108682;

Starting recover at 2021/09/17 03:59:57
using channel ORA_SBT_TAPE_1
using channel ORA_DISK_1

starting media recovery

channel ORA_SBT_TAPE_1: starting archived log restore to default destination
channel ORA_SBT_TAPE_1: restoring archived log
archived log thread=1 sequence=12
channel ORA_SBT_TAPE_1: reading from backup piece 2b098rd5_1_1
channel ORA_SBT_TAPE_1: piece handle=2b098rd5_1_1 tag=ODA10_ARCHIVELOG_00
channel ORA_SBT_TAPE_1: restored backup piece 1
channel ORA_SBT_TAPE_1: restore complete, elapsed time: 00:00:01
archived log file name=/u01/app/oracle/fast_recovery_area/ORCL/archivelog/2021_09_17/o1_mf_1_12_jn84oy3x_.arc thread=1 sequence=12
channel default: deleting archived log(s)
archived log file name=/u01/app/oracle/fast_recovery_area/ORCL/archivelog/2021_09_17/o1_mf_1_12_jn84oy3x_.arc RECID=47 STAMP=1083470398
media recovery complete, elapsed time: 00:00:00
Finished recover at 2021/09/17 03:59:58

RMAN>

ソース・データベースの LEVEL1 のバックアップを取得

データが変更された後に、RMAN の増分バックアップで LEVEL1 のバックアップを取得できます。変更したデータだけバックアップしますから、LEVEL1 のバックアップ量は LEVEL0 より相当少なくなります。そのため、バックアップに必要な時間はかなり短くなります。

LEVEL1 のバックアップを取得

RMAN> BACKUP INCREMENTAL LEVEL 1 DATABASE TAG ODA10_INC_L1_DATAFILE_01 PLUS ARCHIVELOG TAG ODA10_ARCHIVELOG_01;


Starting backup at 2021/09/17 04:05:24
current log archived
using channel ORA_SBT_TAPE_1
channel ORA_SBT_TAPE_1: starting compressed archived log backup set
channel ORA_SBT_TAPE_1: specifying archived log(s) in backup set
input archived log thread=1 sequence=9 RECID=5 STAMP=1082790657
input archived log thread=1 sequence=10 RECID=6 STAMP=1082795993
input archived log thread=1 sequence=11 RECID=7 STAMP=1082796039
input archived log thread=1 sequence=12 RECID=8 STAMP=1082796691
input archived log thread=1 sequence=13 RECID=9 STAMP=1082796713
input archived log thread=1 sequence=14 RECID=10 STAMP=1082858988
input archived log thread=1 sequence=15 RECID=11 STAMP=1082863243
input archived log thread=1 sequence=16 RECID=12 STAMP=1082863262
input archived log thread=1 sequence=17 RECID=13 STAMP=1082863312
input archived log thread=1 sequence=18 RECID=14 STAMP=1083246110
input archived log thread=1 sequence=19 RECID=15 STAMP=1083247386
input archived log thread=1 sequence=20 RECID=16 STAMP=1083247420
input archived log thread=1 sequence=21 RECID=17 STAMP=1083247471
input archived log thread=1 sequence=22 RECID=18 STAMP=1083247641
input archived log thread=1 sequence=23 RECID=19 STAMP=1083247652
input archived log thread=1 sequence=24 RECID=20 STAMP=1083249284
input archived log thread=1 sequence=25 RECID=21 STAMP=1083249294
input archived log thread=1 sequence=26 RECID=22 STAMP=1083289742
input archived log thread=1 sequence=27 RECID=23 STAMP=1083294512
input archived log thread=1 sequence=28 RECID=24 STAMP=1083294538
input archived log thread=1 sequence=29 RECID=25 STAMP=1083294589
input archived log thread=1 sequence=30 RECID=26 STAMP=1083304920
input archived log thread=1 sequence=31 RECID=27 STAMP=1083304938
input archived log thread=1 sequence=32 RECID=28 STAMP=1083310304
input archived log thread=1 sequence=33 RECID=29 STAMP=1083310326
input archived log thread=1 sequence=34 RECID=32 STAMP=1083316229
input archived log thread=1 sequence=35 RECID=33 STAMP=1083316229
input archived log thread=1 sequence=36 RECID=34 STAMP=1083316229
channel ORA_SBT_TAPE_1: starting piece 1 at 2021/09/17 04:05:25
channel ORA_SBT_TAPE_1: finished piece 1 at 2021/09/17 04:05:32
piece handle=2d098ss5_1_1 tag=ODA10_ARCHIVELOG_01 comment=API Version 2.0,MMS Version 19.0.0.1
channel ORA_SBT_TAPE_1: backup set complete, elapsed time: 00:00:07
channel ORA_SBT_TAPE_1: starting compressed archived log backup set
channel ORA_SBT_TAPE_1: specifying archived log(s) in backup set
input archived log thread=1 sequence=1 RECID=35 STAMP=1083316859
input archived log thread=1 sequence=2 RECID=36 STAMP=1083316885
input archived log thread=1 sequence=3 RECID=37 STAMP=1083335478
input archived log thread=1 sequence=4 RECID=38 STAMP=1083335500
input archived log thread=1 sequence=5 RECID=39 STAMP=1083335514
input archived log thread=1 sequence=6 RECID=40 STAMP=1083336644
input archived log thread=1 sequence=7 RECID=41 STAMP=1083341296
input archived log thread=1 sequence=8 RECID=42 STAMP=1083341309
input archived log thread=1 sequence=9 RECID=43 STAMP=1083341354
input archived log thread=1 sequence=10 RECID=44 STAMP=1083468794
input archived log thread=1 sequence=11 RECID=45 STAMP=1083469176
input archived log thread=1 sequence=12 RECID=46 STAMP=1083469221
input archived log thread=1 sequence=13 RECID=47 STAMP=1083470725
channel ORA_SBT_TAPE_1: starting piece 1 at 2021/09/17 04:05:32
channel ORA_SBT_TAPE_1: finished piece 1 at 2021/09/17 04:05:35
piece handle=2e098ssc_1_1 tag=ODA10_ARCHIVELOG_01 comment=API Version 2.0,MMS Version 19.0.0.1
channel ORA_SBT_TAPE_1: backup set complete, elapsed time: 00:00:03
Finished backup at 2021/09/17 04:05:35

Starting backup at 2021/09/17 04:05:35
using channel ORA_SBT_TAPE_1
channel ORA_SBT_TAPE_1: starting compressed incremental level 1 datafile backup set
channel ORA_SBT_TAPE_1: specifying datafile(s) in backup set
input datafile file number=00001 name=/u01/app/oracle/oradata/ORCL/system01.dbf
input datafile file number=00003 name=/u01/app/oracle/oradata/ORCL/sysaux01.dbf
input datafile file number=00004 name=/u01/app/oracle/oradata/ORCL/undotbs01.dbf
input datafile file number=00007 name=/u01/app/oracle/oradata/ORCL/users01.dbf
channel ORA_SBT_TAPE_1: starting piece 1 at 2021/09/17 04:05:35
channel ORA_SBT_TAPE_1: finished piece 1 at 2021/09/17 04:05:38
piece handle=2f098ssf_1_1 tag=ODA10_INC_L1_DATAFILE_01 comment=API Version 2.0,MMS Version 19.0.0.1
channel ORA_SBT_TAPE_1: backup set complete, elapsed time: 00:00:03
Finished backup at 2021/09/17 04:05:38

Starting backup at 2021/09/17 04:05:38
current log archived
using channel ORA_SBT_TAPE_1
channel ORA_SBT_TAPE_1: starting compressed archived log backup set
channel ORA_SBT_TAPE_1: specifying archived log(s) in backup set
input archived log thread=1 sequence=14 RECID=48 STAMP=1083470738
channel ORA_SBT_TAPE_1: starting piece 1 at 2021/09/17 04:05:38
channel ORA_SBT_TAPE_1: finished piece 1 at 2021/09/17 04:05:41
piece handle=2g098ssi_1_1 tag=ODA10_ARCHIVELOG_01 comment=API Version 2.0,MMS Version 19.0.0.1
channel ORA_SBT_TAPE_1: backup set complete, elapsed time: 00:00:03
Finished backup at 2021/09/17 04:05:41

Starting Control File and SPFILE Autobackup at 2021/09/17 04:05:41
piece handle=c-1610037248-20210917-01 comment=API Version 2.0,MMS Version 19.0.0.1
Finished Control File and SPFILE Autobackup at 2021/09/17 04:05:44

RMAN>

バックアップのリストを確認

想定された対象ファイル(データファイル, ARCHIVELOG, CONTROLFILE, SPFILEなど)をすべてバックアップしたかを確認します。

RMAN> list backup;


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


BS Key  Size       Device Type Elapsed Time Completion Time
------- ---------- ----------- ------------ -------------------
65      44.50M     SBT_TAPE    00:00:04     2021/09/17 03:39:40
        BP Key: 65   Status: AVAILABLE  Compressed: YES  Tag: ODA10_ARCHIVELOG_00
        Handle: 28098rbo_1_1   Media: objectstorage.us-phoenix..oud.com/n/sehubjapacprod/rex-db-backup

  List of Archived Logs in backup set 65
  Thrd Seq     Low SCN    Low Time            Next SCN   Next Time
  ---- ------- ---------- ------------------- ---------- ---------
  1    9       2349525    2021/09/05 15:14:39 2503665    2021/09/09 07:10:54
  1    10      2503665    2021/09/09 07:10:54 2510456    2021/09/09 08:39:53
  1    11      2510456    2021/09/09 08:39:53 2510506    2021/09/09 08:40:39
  1    12      2510506    2021/09/09 08:40:39 2510959    2021/09/09 08:51:31
  1    13      2510959    2021/09/09 08:51:31 2510987    2021/09/09 08:51:53
  1    14      2510987    2021/09/09 08:51:53 2624119    2021/09/10 02:09:48
  1    15      2624119    2021/09/10 02:09:48 2628728    2021/09/10 03:20:43
  1    16      2628728    2021/09/10 03:20:43 2628758    2021/09/10 03:21:02
  1    17      2628758    2021/09/10 03:21:02 2628806    2021/09/10 03:21:52
  1    18      2628806    2021/09/10 03:21:52 2753748    2021/09/14 13:41:49
  1    19      2753748    2021/09/14 13:41:49 2756519    2021/09/14 14:03:06
  1    20      2756519    2021/09/14 14:03:06 2756575    2021/09/14 14:03:40
  1    21      2756575    2021/09/14 14:03:40 2756616    2021/09/14 14:04:31
  1    22      2756616    2021/09/14 14:04:31 2756755    2021/09/14 14:07:21
  1    23      2756755    2021/09/14 14:07:21 2756776    2021/09/14 14:07:31
  1    24      2756776    2021/09/14 14:07:31 2758260    2021/09/14 14:34:43
  1    25      2758260    2021/09/14 14:34:43 2758281    2021/09/14 14:34:54
  1    26      2758281    2021/09/14 14:34:54 2858633    2021/09/15 01:49:01
  1    27      2858633    2021/09/15 01:49:01 2868776    2021/09/15 03:08:32
  1    28      2868776    2021/09/15 03:08:32 2868807    2021/09/15 03:08:58
  1    29      2868807    2021/09/15 03:08:58 2868856    2021/09/15 03:09:49
  1    30      2868856    2021/09/15 03:09:49 2875023    2021/09/15 06:02:00
  1    31      2875023    2021/09/15 06:02:00 2875046    2021/09/15 06:02:18
  1    32      2875046    2021/09/15 06:02:18 2878497    2021/09/15 07:31:44
  1    33      2878497    2021/09/15 07:31:44 2878521    2021/09/15 07:32:06
  1    34      2878521    2021/09/15 07:32:06 2878780    2021/09/15 07:38:58
  1    35      2878780    2021/09/15 07:38:58 2878801    2021/09/15 07:39:09
  1    36      2878801    2021/09/15 07:39:09 2882428    2021/09/15 09:10:29

BS Key  Size       Device Type Elapsed Time Completion Time
------- ---------- ----------- ------------ -------------------
66      6.25M      SBT_TAPE    00:00:01     2021/09/17 03:39:44
        BP Key: 66   Status: AVAILABLE  Compressed: YES  Tag: ODA10_ARCHIVELOG_00
        Handle: 29098rbv_1_1   Media: objectstorage.us-phoenix..oud.com/n/sehubjapacprod/rex-db-backup

  List of Archived Logs in backup set 66
  Thrd Seq     Low SCN    Low Time            Next SCN   Next Time
  ---- ------- ---------- ------------------- ---------- ---------
  1    1       2882301    2021/09/15 09:10:29 2883385    2021/09/15 09:20:59
  1    2       2883385    2021/09/15 09:20:59 2883416    2021/09/15 09:21:25
  1    3       2883416    2021/09/15 09:21:25 2895728    2021/09/15 14:31:18
  1    4       2895728    2021/09/15 14:31:18 2895760    2021/09/15 14:31:40
  1    5       2895760    2021/09/15 14:31:40 2895785    2021/09/15 14:31:54
  1    6       2895785    2021/09/15 14:31:54 2996194    2021/09/15 14:50:43
  1    7       2996194    2021/09/15 14:50:43 3000923    2021/09/15 16:08:15
  1    8       3000923    2021/09/15 16:08:15 3000948    2021/09/15 16:08:29
  1    9       3000948    2021/09/15 16:08:29 3000983    2021/09/15 16:09:14
  1    10      3000983    2021/09/15 16:09:14 3101861    2021/09/17 03:33:14
  1    11      3101861    2021/09/17 03:33:14 3108643    2021/09/17 03:39:36

BS Key  Type LV Size       Device Type Elapsed Time Completion Time
------- ---- -- ---------- ----------- ------------ -------------------
67      Incr 0  269.00M    SBT_TAPE    00:00:28     2021/09/17 03:40:14
        BP Key: 67   Status: AVAILABLE  Compressed: YES  Tag: ODA10_INC_L0_DATAFILE_00
        Handle: 2a098rc2_1_1   Media: objectstorage.us-phoenix..oud.com/n/sehubjapacprod/rex-db-backup
  List of Datafiles in backup set 67
  File LV Type Ckp SCN    Ckp Time            Abs Fuz SCN Sparse Name
  ---- -- ---- ---------- ------------------- ----------- ------ ----
  1    0  Incr 3108661    2021/09/17 03:39:46              NO    /u01/app/oracle/oradata/ORCL/system01.dbf
  3    0  Incr 3108661    2021/09/17 03:39:46              NO    /u01/app/oracle/oradata/ORCL/sysaux01.dbf
  4    0  Incr 3108661    2021/09/17 03:39:46              NO    /u01/app/oracle/oradata/ORCL/undotbs01.dbf
  7    0  Incr 3108661    2021/09/17 03:39:46              NO    /u01/app/oracle/oradata/ORCL/users01.dbf

BS Key  Size       Device Type Elapsed Time Completion Time
------- ---------- ----------- ------------ -------------------
68      256.00K    SBT_TAPE    00:00:01     2021/09/17 03:40:22
        BP Key: 68   Status: AVAILABLE  Compressed: YES  Tag: ODA10_ARCHIVELOG_00
        Handle: 2b098rd5_1_1   Media: objectstorage.us-phoenix..oud.com/n/sehubjapacprod/rex-db-backup

  List of Archived Logs in backup set 68
  Thrd Seq     Low SCN    Low Time            Next SCN   Next Time
  ---- ------- ---------- ------------------- ---------- ---------
  1    12      3108643    2021/09/17 03:39:36 3108682    2021/09/17 03:40:21

BS Key  Type LV Size       Device Type Elapsed Time Completion Time
------- ---- -- ---------- ----------- ------------ -------------------
69      Full    512.00K    SBT_TAPE    00:00:00     2021/09/17 03:40:25
        BP Key: 69   Status: AVAILABLE  Compressed: YES  Tag: TAG20210917T034025
        Handle: c-1610037248-20210917-00   Media: objectstorage.us-phoenix..oud.com/n/sehubjapacprod/rex-db-backup
  SPFILE Included: Modification time: 2021/09/17 03:33:15
  SPFILE db_unique_name: ORCL
  Control File Included: Ckp SCN: 3108694      Ckp time: 2021/09/17 03:40:25

BS Key  Size       Device Type Elapsed Time Completion Time
------- ---------- ----------- ------------ -------------------
70      44.50M     SBT_TAPE    00:00:02     2021/09/17 04:05:27
        BP Key: 70   Status: AVAILABLE  Compressed: YES  Tag: ODA10_ARCHIVELOG_01
        Handle: 2d098ss5_1_1   Media: objectstorage.us-phoenix..oud.com/n/sehubjapacprod/rex-db-backup

  List of Archived Logs in backup set 70
  Thrd Seq     Low SCN    Low Time            Next SCN   Next Time
  ---- ------- ---------- ------------------- ---------- ---------
  1    9       2349525    2021/09/05 15:14:39 2503665    2021/09/09 07:10:54
  1    10      2503665    2021/09/09 07:10:54 2510456    2021/09/09 08:39:53
  1    11      2510456    2021/09/09 08:39:53 2510506    2021/09/09 08:40:39
  1    12      2510506    2021/09/09 08:40:39 2510959    2021/09/09 08:51:31
  1    13      2510959    2021/09/09 08:51:31 2510987    2021/09/09 08:51:53
  1    14      2510987    2021/09/09 08:51:53 2624119    2021/09/10 02:09:48
  1    15      2624119    2021/09/10 02:09:48 2628728    2021/09/10 03:20:43
  1    16      2628728    2021/09/10 03:20:43 2628758    2021/09/10 03:21:02
  1    17      2628758    2021/09/10 03:21:02 2628806    2021/09/10 03:21:52
  1    18      2628806    2021/09/10 03:21:52 2753748    2021/09/14 13:41:49
  1    19      2753748    2021/09/14 13:41:49 2756519    2021/09/14 14:03:06
  1    20      2756519    2021/09/14 14:03:06 2756575    2021/09/14 14:03:40
  1    21      2756575    2021/09/14 14:03:40 2756616    2021/09/14 14:04:31
  1    22      2756616    2021/09/14 14:04:31 2756755    2021/09/14 14:07:21
  1    23      2756755    2021/09/14 14:07:21 2756776    2021/09/14 14:07:31
  1    24      2756776    2021/09/14 14:07:31 2758260    2021/09/14 14:34:43
  1    25      2758260    2021/09/14 14:34:43 2758281    2021/09/14 14:34:54
  1    26      2758281    2021/09/14 14:34:54 2858633    2021/09/15 01:49:01
  1    27      2858633    2021/09/15 01:49:01 2868776    2021/09/15 03:08:32
  1    28      2868776    2021/09/15 03:08:32 2868807    2021/09/15 03:08:58
  1    29      2868807    2021/09/15 03:08:58 2868856    2021/09/15 03:09:49
  1    30      2868856    2021/09/15 03:09:49 2875023    2021/09/15 06:02:00
  1    31      2875023    2021/09/15 06:02:00 2875046    2021/09/15 06:02:18
  1    32      2875046    2021/09/15 06:02:18 2878497    2021/09/15 07:31:44
  1    33      2878497    2021/09/15 07:31:44 2878521    2021/09/15 07:32:06
  1    34      2878521    2021/09/15 07:32:06 2878780    2021/09/15 07:38:58
  1    35      2878780    2021/09/15 07:38:58 2878801    2021/09/15 07:39:09
  1    36      2878801    2021/09/15 07:39:09 2882428    2021/09/15 09:10:29

BS Key  Size       Device Type Elapsed Time Completion Time
------- ---------- ----------- ------------ -------------------
71      7.00M      SBT_TAPE    00:00:00     2021/09/17 04:05:32
        BP Key: 71   Status: AVAILABLE  Compressed: YES  Tag: ODA10_ARCHIVELOG_01
        Handle: 2e098ssc_1_1   Media: objectstorage.us-phoenix..oud.com/n/sehubjapacprod/rex-db-backup

  List of Archived Logs in backup set 71
  Thrd Seq     Low SCN    Low Time            Next SCN   Next Time
  ---- ------- ---------- ------------------- ---------- ---------
  1    1       2882301    2021/09/15 09:10:29 2883385    2021/09/15 09:20:59
  1    2       2883385    2021/09/15 09:20:59 2883416    2021/09/15 09:21:25
  1    3       2883416    2021/09/15 09:21:25 2895728    2021/09/15 14:31:18
  1    4       2895728    2021/09/15 14:31:18 2895760    2021/09/15 14:31:40
  1    5       2895760    2021/09/15 14:31:40 2895785    2021/09/15 14:31:54
  1    6       2895785    2021/09/15 14:31:54 2996194    2021/09/15 14:50:43
  1    7       2996194    2021/09/15 14:50:43 3000923    2021/09/15 16:08:15
  1    8       3000923    2021/09/15 16:08:15 3000948    2021/09/15 16:08:29
  1    9       3000948    2021/09/15 16:08:29 3000983    2021/09/15 16:09:14
  1    10      3000983    2021/09/15 16:09:14 3101861    2021/09/17 03:33:14
  1    11      3101861    2021/09/17 03:33:14 3108643    2021/09/17 03:39:36
  1    12      3108643    2021/09/17 03:39:36 3108682    2021/09/17 03:40:21
  1    13      3108682    2021/09/17 03:40:21 3110490    2021/09/17 04:05:24

BS Key  Type LV Size       Device Type Elapsed Time Completion Time
------- ---- -- ---------- ----------- ------------ -------------------
72      Incr 1  1.00M      SBT_TAPE    00:00:01     2021/09/17 04:05:36
        BP Key: 72   Status: AVAILABLE  Compressed: YES  Tag: ODA10_INC_L1_DATAFILE_01
        Handle: 2f098ssf_1_1   Media: objectstorage.us-phoenix..oud.com/n/sehubjapacprod/rex-db-backup
  List of Datafiles in backup set 72
  File LV Type Ckp SCN    Ckp Time            Abs Fuz SCN Sparse Name
  ---- -- ---- ---------- ------------------- ----------- ------ ----
  1    1  Incr 3110504    2021/09/17 04:05:35              NO    /u01/app/oracle/oradata/ORCL/system01.dbf
  3    1  Incr 3110504    2021/09/17 04:05:35              NO    /u01/app/oracle/oradata/ORCL/sysaux01.dbf
  4    1  Incr 3110504    2021/09/17 04:05:35              NO    /u01/app/oracle/oradata/ORCL/undotbs01.dbf
  7    1  Incr 3110504    2021/09/17 04:05:35              NO    /u01/app/oracle/oradata/ORCL/users01.dbf

BS Key  Size       Device Type Elapsed Time Completion Time
------- ---------- ----------- ------------ -------------------
73      256.00K    SBT_TAPE    00:00:00     2021/09/17 04:05:38
        BP Key: 73   Status: AVAILABLE  Compressed: YES  Tag: ODA10_ARCHIVELOG_01
        Handle: 2g098ssi_1_1   Media: objectstorage.us-phoenix..oud.com/n/sehubjapacprod/rex-db-backup

  List of Archived Logs in backup set 73
  Thrd Seq     Low SCN    Low Time            Next SCN   Next Time
  ---- ------- ---------- ------------------- ---------- ---------
  1    14      3110490    2021/09/17 04:05:24 3110511    2021/09/17 04:05:38

BS Key  Type LV Size       Device Type Elapsed Time Completion Time
------- ---- -- ---------- ----------- ------------ -------------------
74      Full    512.00K    SBT_TAPE    00:00:01     2021/09/17 04:05:42
        BP Key: 74   Status: AVAILABLE  Compressed: YES  Tag: TAG20210917T040541
        Handle: c-1610037248-20210917-01   Media: objectstorage.us-phoenix..oud.com/n/sehubjapacprod/rex-db-backup
  SPFILE Included: Modification time: 2021/09/17 03:33:15
  SPFILE db_unique_name: ORCL
  Control File Included: Ckp SCN: 3110523      Ckp time: 2021/09/17 04:05:41

RMAN>

ターゲット・データベースへ取得したバックアップ(LEVEL1)を適用

バックアップのレベルが違いますが、ターゲット・データベースへ適用する方法はほぼ同じです。ただ、異なる点としては LEVEL1 のバックアップの適用はデータファイルのリストアが必要なし、直接リカバリしても良いです。

必要なステップは

データベースをオープンする

データベースをオープンする時に、RESETLOGSの指定することが必要です。
RESETLOGSを指定すると、オープンされたデータベースにソース・データベースのバックアップを適用できなくなります。
そのため、オンプレミス・データベースが平常稼働している間は、この作業は行いません(リカバリのみ実施しておきます)
オンプレミス・データベースが平常稼働している間はOCIデータベースをオープンしないことに注意してください。
ソース・データベース・サーバーが障害があった場合に、バックアップ環境として準備しておいたOCIデータベース・サーバー(ソースのバックアップが適用されたもの)を起動して、データベースをRESETLOGS指定をしてオープンします。

ALTER DATABASE OPEN RESETLOGS;

RMAN> ALTER DATABASE OPEN RESETLOGS;

Statement processed

RMAN>

オンプレミス・データベース・サーバがリペアした後

オンプレミス・データベース・サーバーが障害がない時に、ソースはオンプレミス・データベース、ターゲットは OCI Compute Instance のデータベースとします。

① オンプレミス・データベース・サーバーが障害があった時に、OCI Compute Instance のデータベースがオープンされて、サービスを提供します。同時にこの OCI Compute Instance のデータベースはソースになります。RMAN で Object Storage に増分バックアップ(LEVEL0, LEVEL1)を取得します。

② オンプレミス環境のリペアが完了して、オンプレミスはターゲットとして、上記の OCI Compute Instance のデータベースのバックアップから新しいデータベース・インスタンスを作成します。

restore_to_onp.png

2
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
2
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?