[Oracle Cloud] RMANを利用して11gR2のRAC環境のバックアップをDBCSへのリストアする方法(TDE暗号化）


#はじめに
**今回の記事では、OnP側の11gR2のRMAN バックアップを利用してOracle Cloud Infrastructure (以下OCI) で新規で作成したRAC環境に簡単にリストアする方法を紹介します。**

#検証概要図

![kousezu.jpg](https://qiita-image-store.s3.ap-northeast-1.amazonaws.com/0/453491/fbb431c8-796e-985b-2115-c37dbe23f5e6.jpeg)

---
#OCI構成
**・メインサイトは、東京リージョンのOCI DBCS (Database Cloud Service) 11gR2 RAC構成
- OnP側のRAC環境ではRMANにてローカル・デイスクへバックアップ取得
- OnP側にOCI-CLIをインストールしてバックアップ・ファイルをオブジェクト・ストレージへUpload
- OCI DBCS側にFileStorageをマウントし、オブジェクト・ストレージからバックアップファイルをDownload
★FileStorageは定期的にバックアップファイルを格納するディレクトリ
- OnP側に大規模障害が発生した時を想定して、RMANにてOCI DBCS へリストアを行う**

#【DBCS構築】
- 東京リージョン : OCI DBCS 作成
- Shape:VM.Standard2.2
- Name : cloud
- DB unique Name:cloud_nrt1tc
- Node1:dbcs1
- Node2:dbcs2
- Edition : Enterprise Edition Extreme Performance (RAC構成の場合)
- Version : 11.2.0.4.210420

#【OCI環境】IAM Policy
**OCI の IAM に紐づく Policy が必要な場合があります。自分が使用している IAM ユーザーが、Administrators グループに所属している場合は IAM Policy の設定は不要です。Administrators 以外の場合は、以下の書式を参考にして設定をします。**

```
Allow group <group_name> to manage objects in compartment <compartment_name> where target.bucket.name = '<bucket_name>'
Allow group <group_name> to read buckets in compartment <compartment_name>
```
##【共通手順OnP & DBCS】OCI-CLIの設定
**OnP環境やDBCS環境でインストールは同じ手順になります。**
まずは、OCI CLIツールをインストールします。
❐OnP DB #1❐YUMリポジトリ取得

``` 
[opc@onp1 ~]$ sudo -s
[root@onp1 opc]# wget -O /etc/yum.repos.d/public-yum-ol7.repo http://public-yum.oracle.com/public-yum-ol7.repo
--2021-11-05 02:46:33--  http://public-yum.oracle.com/public-yum-ol7.repo 
Resolving public-yum.oracle.com (public-yum.oracle.com)... 23.51.208.176, 2600:140b:a800:b90::2a7d, 2600:140b:a800:b88::2a7d
Connecting to public-yum.oracle.com (public-yum.oracle.com)|23.51.208.176|:80 connected.
HTTP request sent, awaiting response... 301 Moved Permanently
Location: https://public-yum.oracle.com/public-yum-ol7.repo [following]
--2021-11-05 02:46:33--  https://public-yum.oracle.com/public-yum-ol7.repo
Connecting to public-yum.oracle.com (public-yum.oracle.com)|23.51.208.176|:443 connected.
HTTP request sent, awaiting response... 200 OK
Length: 16402 (16K) [text/plain]
Saving to: '/etc/yum.repos.d/public-yum-ol7.repo'

100%[======================================>] 16,402      --.-K/s   in 0s

2021-11-05 02:46:34 (156 MB/s) - '/etc/yum.repos.d/public-yum-ol7.repo' saved [16402/16402]
```
❐OnP DB #1❐すべてのロックを解除します。
注意：デフォルトでDBCS上ではyum-plugin-versionlock でバージョンを固定しています。

```
[root@onp1 opc]# yum versionlock clear
Loaded plugins: versionlock
versionlock cleared
```
ここでは❐OnP DB #1❐で実施した内容となります。
※表示の都合上、改行を入れています。
❐OnP DB #1❐Python3がインストールされていない場合は合わせてインストールされます。

```
[root@dbcs2 opc]# su - oracle
[oracle@onp1 ~]$ bash -c "$(curl -L https://raw.githubusercontent.com/oracle/oci-cli/master/scripts/install/install.sh)"
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100 16055  100 16055    0     0  38519      0 --:--:-- --:--:-- --:--:-- 41701

    ******************************************************************************
    You have started the OCI CLI Installer in interactive mode. If you do not wish
    to run this in interactive mode, please include the --accept-all-defaults option.
    If you have the script locally and would like to know more about
    input options for this script, then you can run:
    ./install.sh -h
    If you would like to know more about input options for this script, refer to:
    https://github.com/oracle/oci-cli/blob/master/scripts/install/README.rst
    ******************************************************************************
Running install script.
python3 /tmp/oci_cli_install_tmp_Vhc8
-- Verifying Python version.
-- Python version 3.8.12 okay.
＜省略＞
===> In what directory would you like to place the install? (leave blank to use '/home/oracle/lib/oracle-cli'):＜インストール先を指定：初期状態の場合はEnter＞
-- Creating directory '/home/oracle/lib/oracle-cli'.
-- We will install at '/home/oracle/lib/oracle-cli'.

===> In what directory would you like to place the 'oci' executable? (leave blank to use '/home/oracle/bin'):＜実行ファイル配置先を指定：初期状態の場合はEnter＞
-- Creating directory '/home/oracle/bin'.
-- The executable will be in '/home/oracle/bin'.

===> In what directory would you like to place the OCI scripts? (leave blank to use '/home/oracle/bin/oci-cli-scripts'):＜設定ファイル配置先を指定：初期状態の場合はEnter＞
-- Creating directory '/home/oracle/bin/oci-cli-scripts'.
-- The scripts will be in '/home/oracle/bin/oci-cli-scripts'.

===> Currently supported optional packages are: ['db (will install cx_Oracle)']
What optional CLI packages would you like to be installed (comma separated names; press enter if you don't need any optional packages)?:＜追加でインストールするオプションを指定：追加のオプションに指定がない場合はEnter＞
-- The optional packages installed will be ''.
-- Trying to use python3 venv.
-- Executing: ['/usr/local/bin/python3', '-m', 'venv', '/home/oracle/lib/oracle-cli']
-- Executing: ['/home/oracle/lib/oracle-cli/bin/pip', 'install', '--upgrade', 'pip']

===> Modify profile to update your $PATH and enable shell/tab completion now? (Y/n): 　＜PATH環境変数の更新可否：初期状態(Y)の場合はEnter＞

===> Enter a path to an rc file to update (file will be created if it does not exist) (leave blank to use '/home/oracle/.bashrc'):＜更新する環境変数指定ファイルを指定：初期状態の場合はEnter＞
-- Backed up '/home/oracle/.bashrc' to '/home/oracle/.bashrc.backup'
-- Tab completion set up complete.
-- If tab completion is not activated, verify that '/home/oracle/.bashrc' is sourced by your shell.
--
-- ** Run `exec -l $SHELL` to restart your shell. **　--インストール後実行
--
-- Installation successful.　--正常完了
-- Run the CLI with /home/oracle/bin/oci --help

[oracle@onp1 ~]$ exec -l $SHELL
❐OnP DB #1❐バージョンの確認をします。
[oracle@onp1 ~]$ oci -version
3.2.2
```
##【共通手順OnP & DBCS】OCI-CLIのセットアップ
**OnP環境やDBCS環境でインストールは同じ手順になります。**
OCI-CLIのセットアップの前に以下3点を確認しておきます。
- Oracle Cloudへ接続する際に利用する、Oracle CloudユーザーのOCID
ocid1.user.oc1..aaaaaaaa2hcg7kd5ovyjjiqt7tnn2cyi7loq2ggh2qzps52llbk2uesmmdhq
- 接続するOracle CloudのテナントのOCID
ocid1.tenancy.oc1..aaaaaaaaro7aox2fclu4urtpgsbacnrmjv46e7n4fw3sc2wbq24l7dzf3kba
- 接続するOracle CloudのコンパトメントのOCID
ocid1.compartment.oc1..aaaaaaaahr7aicqtodxmcfor6pbqn3hvsngpftozyxzqw36gj4kh3w3kkj4q

❐OnP DB #1❐セットアップコマンドを実行します。
※表示の都合上、改行を入れています。

```
[oracle@onp1 lib]$ oci setup config
    This command provides a walkthrough of creating a valid CLI config file.
    The following links explain where to find the information required by this
    script:
    User API Signing Key, OCID and Tenancy OCID:
        https://docs.cloud.oracle.com/Content/API/Concepts/apisigningkey.htm#Other
    Region:
        https://docs.cloud.oracle.com/Content/General/Concepts/regions.htm
    General config documentation:
        https://docs.cloud.oracle.com/Content/API/Concepts/sdkconfig.htm

Enter a location for your config [/home/oracle/.oci/config]:＜設定ファイル配置先：初期状態の場合はEnter＞
Enter a user OCID: ocid1.user.oc1..aaaaaaaa2hcg7kd5ovyjjiqt7tnn2cyi7loq2ggh2qzps52llbk2uesmmdhq　＜事前に確認したユーザーのOCID＞
Enter a tenancy OCID: ocid1.tenancy.oc1..aaaaaaaaro7aox2fclu4urtpgsbacnrmjv46e7n4fw3sc2wbq24l7dzf3kba　＜事前に確認したテナンシのOCID＞
Enter a region by index or name(e.g.
1: ap-chiyoda-1, 2: ap-chuncheon-1, 3: ap-hyderabad-1, 4: ap-ibaraki-1, 5: ap-melbourne-1,
6: ap-mumbai-1, 7: ap-osaka-1, 8: ap-seoul-1, 9: ap-singapore-1, 10: ap-sydney-1,
11: ap-tokyo-1, 12: ca-montreal-1, 13: ca-toronto-1, 14: eu-amsterdam-1, 15: eu-frankfurt-1,
16: eu-marseille-1, 17: eu-zurich-1, 18: il-jerusalem-1, 19: me-dubai-1, 20: me-jeddah-1,
21: sa-santiago-1, 22: sa-saopaulo-1, 23: sa-vinhedo-1, 24: uk-cardiff-1, 25: uk-gov-cardiff-1,
26: uk-gov-london-1, 27: uk-london-1, 28: us-ashburn-1, 29: us-gov-ashburn-1, 30: us-gov-chicago-1,
31: us-gov-phoenix-1, 32: us-langley-1, 33: us-luke-1, 34: us-phoenix-1, 35: us-sanjose-1): ap-tokyo-1　＜利用するリージョン＞
Do you want to generate a new API Signing RSA key pair? (If you decline you will be asked to supply the path to an existing key.) [Y/n]: Y＜利用する鍵ファイルの事前準備状態確認＞
Enter a directory for your keys to be created [/home/oracle/.oci]:＜鍵ファイル配置先：初期状態の場合はEnter＞
Enter a name for your key [oci_api_key]:＜鍵ファイル名：初期状態の場合はEnter＞
Public key written to: /home/oracle/.oci/oci_api_key_public.pem　
Enter a passphrase for your private key (empty for no passphrase):＜パスワード：パスワード無しの場合はEnter＞
Private key written to: /home/oracle/.oci/oci_api_key.pem
Fingerprint: bd:ff:b7:ab:19:fe:d4:56:69:ff:4b:50:66:69:3b:d3
Config written to /home/oracle/.oci/config

    If you haven't already uploaded your API Signing public key through the
    console, follow the instructions on the page linked below in the section
    'How to upload the public key':
        https://docs.cloud.oracle.com/Content/API/Concepts/apisigningkey.htm#How2
```
##【共通手順OnP & DBCS】WebコンソールへのAPIキー登録
**OnP環境やDBCS環境でインストールは同じ手順になります。**
ユーザ詳細画面のリソース”APIキー”より「公開キーの追加」を選択します。
公開キーの追加は、ファイルを選択する方法と直接キーを入力する方法があります。

```
[oracle@onp1 lib]$ cat ~/.oci/oci_api_key_public.pem
-----BEGIN PUBLIC KEY-----
MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAsc0hqyOvlaEfXgu6iKoS
Io+nttjFH7i4G0O/49ispNcSaHrQLGV+QHkdyeX5HJWSJKG/hneEx1FTgkKJQFkK
gQGtmBnl8hmSo28NiJ+aSVHk3xV9GxqttRcI29/Af0C60XLl5MbpM6a+AsaWGVWd
tun/D7HH6Y3mHxNz0jAAWdedHIzBrySy45y0sZNNLVWCXIMyYfNx/riqiK4cIxW0
tbCkbbuYxaAphpoxccxzCNYLv1FMr/i/9rfjBNk5ZXnOZNQMFqczbCw9hGSUbE51
FWdNvcnEeGZZvAZoOXCkkDGTI87aJ1gnsy7fMbOgaAjP7OIHmZ/TmokNI+fjPJXM
DQIDAQAB
-----END PUBLIC KEY-----
```

---
※以下では、直接キーを入力する方法で登録します。
![addAPIKey.jpg](https://qiita-image-store.s3.ap-northeast-1.amazonaws.com/0/453491/f29f678b-862c-d7b8-ead9-034589be156f.jpeg)


Fingerprintは以下になります。
![addAPIKey2.jpg](https://qiita-image-store.s3.ap-northeast-1.amazonaws.com/0/453491/a29a1538-4036-b0a1-72ed-3047c619c112.jpeg)

---
設定したら確認してみましょう。
ここでは、以下のコマンドでリージョンのリストを表示します。
場合によっては、可読性が問題になることがあります。
これは、レスポンスを表としてフォーマットすることで簡単に解決できます。
表形式のコマンドにレスポンスするには、次のコマンドを実行します。
次のリージョンのリストは、2つの列の表として戻されます。

```

❐OnP DB #1❐
[oracle@onp1 ~]$ oci iam region list --output table
+-----+----------------+
| key | name           |
+-----+----------------+
| AMS | eu-amsterdam-1 |
| BOM | ap-mumbai-1    |
| CWL | uk-cardiff-1   |
| DXB | me-dubai-1     |
| FRA | eu-frankfurt-1 |
| GRU | sa-saopaulo-1  |
| HYD | ap-hyderabad-1 |
| IAD | us-ashburn-1   |
| ICN | ap-seoul-1     |
| JED | me-jeddah-1    |
| KIX | ap-osaka-1     |
| LHR | uk-london-1    |
| MEL | ap-melbourne-1 |
| MRS | eu-marseille-1 |
| MTZ | il-jerusalem-1 |
| NRT | ap-tokyo-1     |
| PHX | us-phoenix-1   |
| SCL | sa-santiago-1  |
| SIN | ap-singapore-1 |
| SJC | us-sanjose-1   |
| SYD | ap-sydney-1    |
| VCP | sa-vinhedo-1   |
| YNY | ap-chuncheon-1 |
| YUL | ca-montreal-1  |
| YYZ | ca-toronto-1   |
| ZRH | eu-zurich-1    |
+-----+----------------+
```
##【OnP側】事前作業
❐OnP DB #1❐データベースの構成を確認します。
ここではRAC構成で2ノードで構成されていることを確認できます。


```
[oracle@onp1 ~]$ srvctl config database -d op01_nrt1js
Database unique name: op01_nrt1js
Database name: op01
Oracle home: /u01/app/oracle/product/11.2.0.4/dbhome_1
Oracle user: oracle
Spfile: +DATA/op01_nrt1js/spfileop01.ora
Domain: publicsubnet.vcnjpantechning.oraclevcn.com
Start options: open
Stop options: immediate
Database role: PRIMARY
Management policy: AUTOMATIC
Server pools: op01_nrt1js
Database instances: op011,op012　★
Disk Groups: DATA,RECO
Mount point paths:
Services:
Type: RAC　★
Database is administrator managed
```
❐OnP DB #1❐環境変数を確認します。

```
[oracle@onp1 ~]$ srvctl getenv database -d  op01_nrt1js
op01_nrt1js:
ORACLE_UNQNAME=op01_nrt1js
TZ=UTC
```
❐OnP DB #1❐データベースのSIDを確認します。

```
[oracle@onp1 tde]$ echo $ORACLE_SID
op011
```
❐OnP DB #1❐検証用のユーザーやデータを準備します

```
[oracle@onp1 ~]$ sqlplus / as sysdba
SQL*Plus: Release 11.2.0.4.0 Production on Tue Nov 9 03:21:02 2021
Copyright (c) 1982, 2013, Oracle.  All rights reserved.

Connected to:
Oracle Database 11g EE Extreme Perf Release 11.2.0.4.0 - 64bit Production
With the Partitioning, Real Application Clusters, Automatic Storage Management, Oracle Label Security,
OLAP, Data Mining, Oracle Database Vault and Real Application Testing options

❐OnP DB #1❐現行の表領域を確認します
SQL> select TABLESPACE_NAME,FILE_NAME from DBA_DATA_FILES;
TABLESPACE FILE_NAME
---------- ------------------------------------------------------------------------------------------
UNDOTBS1   +DATA/op01_nrt1js/datafile/undotbs1.261.1087437847
SYSAUX     +DATA/op01_nrt1js/datafile/sysaux.260.1087437847
SYSTEM     +DATA/op01_nrt1js/datafile/system.259.1087437847
UNDOTBS2   +DATA/op01_nrt1js/datafile/undotbs2.263.1087437947
USERS      +DATA/op01_nrt1js/datafile/users.265.1087438223

❐OnP DB #1❐検証用表領域TBSを作成します
SQL> CREATE TABLESPACE TBS DATAFILE '+DATA/op01_nrt1js/datafile/TBS' SIZE 500M  AUTOEXTEND ON NEXT 500K MAXSIZE 4096M;
Tablespace created.

❐OnP DB #1❐表領域TBSが作成されていることを確認します
SQL> select TABLESPACE_NAME,FILE_NAME from DBA_DATA_FILES;
TABLESPACE FILE_NAME
---------- ------------------------------------------------------------------------------------------
UNDOTBS1   +DATA/op01_nrt1js/datafile/undotbs1.261.1087437847
SYSAUX     +DATA/op01_nrt1js/datafile/sysaux.260.1087437847
SYSTEM     +DATA/op01_nrt1js/datafile/system.259.1087437847
UNDOTBS2   +DATA/op01_nrt1js/datafile/undotbs2.263.1087437947
USERS      +DATA/op01_nrt1js/datafile/users.265.1087438223
TBS        +DATA/op01_nrt1js/datafile/tbs　　★

6 rows selected.
❐OnP DB #1❐TDE暗号化表領域の確認

SQL>set pages 2000 lin 2000
SQL>col TABLESPACE_NAME for a15
SQL>col EXTENT_MANAGEMENT for a17
SQL>col ALLOCATION_TYPE for a15
SQL>col SEGMENT_SPACE_MANAGEMENT for a25
SQL>col BIGFILE for a6
SQL>col ENCRYPTED for a9

SQL>SELECT
  TABLESPACE_NAME
  ,INITIAL_EXTENT
  ,MAX_SIZE
  ,STATUS
  ,EXTENT_MANAGEMENT
  ,ALLOCATION_TYPE
  ,SEGMENT_SPACE_MANAGEMENT
  ,BIGFILE
  ,ENCRYPTED
FROM DBA_TABLESPACES
ORDER BY 1;

TABLESPACE_NAME INITIAL_EXTENT   MAX_SIZE STATUS    EXTENT_MANAGEMENT ALLOCATION_TYPE SEGMENT_SPACE_MANAGEMENT  BIGFIL ENCRYPTED
--------------- -------------- ---------- --------- ----------------- --------------- ------------------------- ------ ---------
SYSAUX                   65536 2147483645 ONLINE    LOCAL             SYSTEM          AUTO                      NO     NO
SYSTEM                   65536 2147483645 ONLINE    LOCAL             SYSTEM          MANUAL                    NO     NO
TBS                      65536 2147483645 ONLINE    LOCAL             SYSTEM          AUTO                      NO     YES ★暗号化済み
TEMP                   1048576 2147483645 ONLINE    LOCAL             UNIFORM         MANUAL                    NO     NO
UNDOTBS1                 65536 2147483645 ONLINE    LOCAL             SYSTEM          MANUAL                    NO     NO
UNDOTBS2                 65536 2147483645 ONLINE    LOCAL             SYSTEM          MANUAL                    NO     NO
USERS                    65536 2147483645 ONLINE    LOCAL             SYSTEM          AUTO                      NO     YES　★暗号化済み

7 rows selected.

❐OnP DB #1❐ユーザーDEMOを作成します
SQL> CREATE USER DEMO IDENTIFIED BY WElcome##1234 DEFAULT TABLESPACE TBS QUOTA UNLIMITED ON TBS;

User created.

❐OnP DB #1❐権限DBAをユーザーDEMOに付与します
SQL> GRANT DBA to DEMO;

Grant succeeded.

❐OnP DB #1❐作成されたDEMOで接続してみます
SQL> conn DEMO/WElcome##1234
Connected.


❐OnP DB #1❐検証用テーブルやデータを作成します
[oracle@onp1 ~]$ vi sample.sql
create table students ( student_no varchar(10), surname varchar(20), forename varchar(20));
create table modules ( module_code varchar(8), module_name varchar(20));
create table marks ( student_no varchar(10), module_code varchar(8), mark integer);
insert into students values ('20060101','Dickens','Charles');
insert into students values ('20060102','ApGwilym','Dafydd');
insert into students values ('20060103','Zola','Emile');
insert into students values ('20060104','Mann','Thomas');
insert into students values ('20060105','Stevenson','Robert');
insert into modules values ('CM0001', 'Databases');
insert into modules values ('CM0003', 'Operating Systems');
insert into modules values ('CM0004', 'Graphics');
insert into marks values ('20060101', 'CM0001', 80);
insert into marks values ('20060101', 'CM0002', 65);
insert into marks values ('20060101', 'CM0003', 50);
insert into marks values ('20060102', 'CM0001', 75);
insert into marks values ('20060102', 'CM0003', 45);
insert into marks values ('20060102', 'CM0004', 70);
insert into marks values ('20060103', 'CM0001', 60);
insert into marks values ('20060103', 'CM0002', 75);
insert into marks values ('20060103', 'CM0004', 60);
insert into marks values ('20060104', 'CM0001', 55);
insert into marks values ('20060104', 'CM0002', 40);
insert into marks values ('20060104', 'CM0003', 45);
insert into marks values ('20060105', 'CM0001', 55);
insert into marks values ('20060105', 'CM0002', 50);
insert into marks values ('20060105', 'CM0004', 65);
commit;

SQL> @sample.sql

❐OnP DB #1❐DEMOの統計状況を取得します
SQL> EXEC DBMS_STATS.gather_schema_stats('DEMO');

PL/SQL procedure successfully completed.

❐OnP DB #1❐テーブル数やデータ量を確認します
SQL> SELECT TABLE_NAME,NUM_ROWS FROM  DBA_TABLES WHERE TABLESPACE_NAME = 'TBS';

TABLE_NAME                       NUM_ROWS
------------------------------ ----------
STUDENTS                                5
MODULES                                 3
MARKS                                  15

❐OnP DB #1❐テーブル毎のデータを確認します
SQL> select * from STUDENTS;

STUDENT_NO SURNAME              FORENAME
---------- -------------------- --------------------
20060101   Dickens              Charles
20060102   ApGwilym             Dafydd
20060103   Zola                 Emile
20060104   Mann                 Thomas
20060105   Stevenson            Robert

SQL> select * from MODULES;

MODULE_C MODULE_NAME
-------- --------------------
CM0001   Databases
CM0003   Operating Systems
CM0004   Graphics

SQL> select * from MARKS;

STUDENT_NO MODULE_C       MARK
---------- -------- ----------
20060101   CM0001           80
20060101   CM0002           65
20060101   CM0003           50
20060102   CM0001           75
20060102   CM0003           45
20060102   CM0004           70
20060103   CM0001           60
20060103   CM0002           75
20060103   CM0004           60
20060104   CM0001           55
20060104   CM0002           40

STUDENT_NO MODULE_C       MARK
---------- -------- ----------
20060104   CM0003           45
20060105   CM0001           55
20060105   CM0002           50
20060105   CM0004           65

15 rows selected.

❐OnP DB #1❐db_unique_nameを確認します
SQL> show parameter db_unique_name
NAME                                 TYPE        VALUE
------------------------------------ ----------- ------------------------------
db_unique_name                       string      op01_nrt1js

❐OnP DB #1❐DBIDを確認します
SQL> SELECT DBID,NAME,DB_UNIQUE_NAME,CURRENT_SCN,LOG_MODE FROM V$DATABASE;
      DBID NAME      DB_UNIQUE_NAME                 CURRENT_SCN LOG_MODE
---------- --------- ------------------------------ ----------- ------------
2948649754 OP01      op01_nrt1js                         824453 ARCHIVELOG

❐OnP DB #1❐spfileの格納場所を確認します
SQL> show parameter spfile
NAME                                 TYPE        VALUE
------------------------------------ ----------- ------------------------------
spfile                               string      +DATA/op01_nrt1js/spfileop01.ora

❐OnP DB #1❐バックアップを格納するディレクトリを作成します
[oracle@onp1 ~]$ cd /home/oracle
[oracle@onp1 ~]$ mkdir -p backup

❐OnP DB #1❐Pfileをバックアップ用のディレクトリに作成します
[oracle@onp1 ~]$ sqlplus / as sysdba
SQL*Plus: Release 11.2.0.4.0 Production on Tue Nov 9 03:21:02 2021
Copyright (c) 1982, 2013, Oracle.  All rights reserved.

Connected to:
Oracle Database 11g EE Extreme Perf Release 11.2.0.4.0 - 64bit Production
With the Partitioning, Real Application Clusters, Automatic Storage Management, Oracle Label Security,
OLAP, Data Mining, Oracle Database Vault and Real Application Testing options

SQL> CREATE PFILE = '/home/oracle/backup/initop011.ora' FROM SPFILE ='+DATA/op01_nrt1js/spfileop01.ora';
File created.
```

##【OnP側】OCI-CLIにてオブジェクト・ストレージ上でbucketを作成
OnP11g_Backupという名前で、OnP側のバックアップ・ファイルを配置するbucketを作成する。

```Json:
[oracle@onp1 ~]$ oci os bucket create --name OnP11g_Backup --compartment-id ocid1.compartment.oc1..aaaaaaaahr7aicqtodxmcfor6pbqn3hvsngpftozyxzqw36gj4kh3w3kkj4q
{
  "data": {
    "approximate-count": null,
    "approximate-size": null,
    "auto-tiering": null,
    "compartment-id": "ocid1.compartment.oc1..aaaaaaaahr7aicqtodxmcfor6pbqn3hvsngpftozyxzqw36gj4kh3w3kkj4q",
    "created-by": "ocid1.user.oc1..aaaaaaaa2hcg7kd5ovyjjiqt7tnn2cyi7loq2ggh2qzps52llbk2uesmmdhq",
    "defined-tags": {
      "CIS-namesp": {
        "CreatedBy": "oracleidentitycloudservice/ning.x.xu@oracle.com",
        "CreatedOn": "2021-11-09T05:05:47.864Z"
      },
      "default_tags": {
        "CreatedBy": "oracleidentitycloudservice/ning.x.xu@oracle.com",
        "CreatedOn": "2021-11-09T05:05:47.864Z"
      }
    },
    "etag": "6de0bea6-1632-4bfb-83c5-116bfbff5d0a",
    "freeform-tags": {},
    "id": "ocid1.bucket.oc1.ap-tokyo-1.aaaaaaaasi5g7yflqaj66eleq5gk2waeievmk3flpm4y6des33lvwosezy3a",
    "is-read-only": false,
    "kms-key-id": null,
    "metadata": {},
    "name": "OnP11g_Backup",
    "namespace": "sehubjapacprod",
    "object-events-enabled": false,
    "object-lifecycle-policy-etag": null,
    "public-access-type": "NoPublicAccess",
    "replication-enabled": false,
    "storage-tier": "Standard",
    "time-created": "2021-11-09T05:05:47.882000+00:00",
    "versioning": "Disabled"
  },
  "etag": "6de0bea6-1632-4bfb-83c5-116bfbff5d0a"
}
```
❐OnP DB #1❐作成したbucketをリストします。

```Json:
[oracle@onp1]$ oci os bucket list -c ocid1.compartment.oc1..aaaaaaaahr7aicqtodxmcfor6pbqn3hvsngpftozyxzqw36gj4kh3w3kkj4q --all
{
  "data": [
{
      "compartment-id": "ocid1.compartment.oc1..aaaaaaaahr7aicqtodxmcfor6pbqn3hvsngpftozyxzqw36gj4kh3w3kkj4q",
      "created-by": "ocid1.saml2idp.oc1..aaaaaaaa35cermlivp7qpgci4ch7l6msrtze7wnvde6gsio2juyxdnpzi5na/ning.x.xu@oracle.com",
      "defined-tags": null,
      "etag": "3312dded-eea9-4843-9037-a79324def87b",
      "freeform-tags": null,
      "name": "OnP11g_Backup",
      "namespace": "sehubjapacprod",
      "time-created": "2021-11-03T08:06:58.399000+00:00"
    }
  ]
}
```
##【OnP側】RMANバックアップ定義設定
❐OnP DB #1❐RMAN定義の変更
`CONFIGURE CONTROLFILE AUTOBACKUP ON;`
⇓制御ファイルなどバックアップする場所
`CONFIGURE CONTROLFILE AUTOBACKUP FORMAT FOR DEVICE TYPE DISK TO '/home/oracle/backup/cf_%F';`
`CONFIGURE ENCRYPTION FOR DATABASE ON;`
`CONFIGURE COMPRESSION ALGORITHM 'MEDIUM';`
`CONFIGURE BACKUP OPTIMIZATION ON;`
`CONFIGURE DEVICE TYPE DISK PARALLELISM 2 BACKUP TYPE TO BACKUPSET;`

❐OnP DB #1❐RMANに接続します。

```
RMAN> show all;

using target database control file instead of recovery catalog
RMAN configuration parameters for database with db_unique_name OP01_NRT1JS are:
CONFIGURE RETENTION POLICY TO REDUNDANCY 1; # default
CONFIGURE BACKUP OPTIMIZATION ON;★変更
CONFIGURE DEFAULT DEVICE TYPE TO DISK; # default
CONFIGURE CONTROLFILE AUTOBACKUP ON;　★変更
CONFIGURE CONTROLFILE AUTOBACKUP FORMAT FOR DEVICE TYPE DISK TO '/home/oracle/backup/cf_%F';★変更
CONFIGURE DEVICE TYPE DISK PARALLELISM 2 BACKUP TYPE TO BACKUPSET;★変更
CONFIGURE DATAFILE BACKUP COPIES FOR DEVICE TYPE DISK TO 1; # default
CONFIGURE ARCHIVELOG BACKUP COPIES FOR DEVICE TYPE DISK TO 1; # default
CONFIGURE CHANNEL DEVICE TYPE DISK MAXPIECESIZE 2 G;
CONFIGURE MAXSETSIZE TO UNLIMITED; # default
CONFIGURE ENCRYPTION FOR DATABASE ON;★変更
CONFIGURE ENCRYPTION ALGORITHM 'AES128'; # default
CONFIGURE COMPRESSION ALGORITHM 'MEDIUM' AS OF RELEASE 'DEFAULT' OPTIMIZE FOR LOAD TRUE;　★変更
CONFIGURE ARCHIVELOG DELETION POLICY TO NONE; # default
CONFIGURE SNAPSHOT CONTROLFILE NAME TO '+RECO/OP01_NRT1JS/controlfile/snapcf_op01_nrt1js.f';
CONFIGURE SNAPSHOT CONTROLFILE NAME TO '+RECO/op01_nrt1js/controlfile/snapcf_op01_nrt1js.f';

RMAN> exit
Recovery Manager complete.
```
##【OnP側】RMANバックアップ取得
❐OnP DB #1❐バックアップ用シェルスクリプトを作成します。

```Shell:
[oracle@onp1 ~]$vi backup.sh
#!/bin/bash
export ORACLE_HOME=/u01/app/oracle/product/11.2.0.4/dbhome_1
export ORACLE_SID=op011
rman target / nocatalog trace=backup_`date +%Y%m%d-%H%M%S`.log <<!
set encryption on;
backup AS COMPRESSED BACKUPSET INCREMENTAL LEVEL 0 DATABASE TAG 'INCR LEVEL 0' format '/home/oracle/backup/full_bkp_L0_%U';
sql 'alter system archive log current';
sql 'alter system archive log current';
backup AS COMPRESSED BACKUPSET archivelog all format '/home/oracle/backup/archivelog_%d_%u_%s_%T' delete all input;
exit
!
```
❐OnP DB #1❐バックアップシェルに実行権限を付与します。。

```
[oracle@onp1 ~]$ chmod +x backup.sh
```
❐OnP DB #1❐バックアップを実施します。

```
[oracle@onp1 ~]$ ./backup.sh
Recovery Manager: Release 11.2.0.4.0 - Production on Mon Nov 15 05:31:36 2021

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

connected to target database: OP01 (DBID=2948649754)
using target database control file instead of recovery catalog

RMAN>
executing command: SET encryption

RMAN>
Starting backup at 15-NOV-21
allocated channel: ORA_DISK_1
channel ORA_DISK_1: SID=331 instance=op011 device type=DISK
allocated channel: ORA_DISK_2
channel ORA_DISK_2: SID=172 instance=op011 device type=DISK
channel ORA_DISK_1: starting compressed incremental level 0 datafile backup set
channel ORA_DISK_1: specifying datafile(s) in backup set
input datafile file number=00001 name=+DATA/op01_nrt1js/datafile/system.259.1087437847
input datafile file number=00005 name=+DATA/op01_nrt1js/datafile/users.265.1087438223
input datafile file number=00006 name=+DATA/op01_nrt1js/datafile/tbs
channel ORA_DISK_1: starting piece 1 at 15-NOV-21
channel ORA_DISK_2: starting compressed incremental level 0 datafile backup set
channel ORA_DISK_2: specifying datafile(s) in backup set
input datafile file number=00002 name=+DATA/op01_nrt1js/datafile/sysaux.260.1087437847
input datafile file number=00004 name=+DATA/op01_nrt1js/datafile/undotbs2.263.1087437947
input datafile file number=00003 name=+DATA/op01_nrt1js/datafile/undotbs1.261.1087437847
channel ORA_DISK_2: starting piece 1 at 15-NOV-21
channel ORA_DISK_2: finished piece 1 at 15-NOV-21
piece handle=/home/oracle/backup/full_bkp_L0_260e78dq_1_1 tag=INCR LEVEL 0 comment=NONE
channel ORA_DISK_2: backup set complete, elapsed time: 00:00:07
channel ORA_DISK_1: finished piece 1 at 15-NOV-21
piece handle=/home/oracle/backup/full_bkp_L0_250e78dq_1_1 tag=INCR LEVEL 0 comment=NONE
channel ORA_DISK_1: backup set complete, elapsed time: 00:00:15
Finished backup at 15-NOV-21

Starting Control File and SPFILE Autobackup at 15-NOV-21
piece handle=/home/oracle/backup/cf_c-2948649754-20211115-00 comment=NONE
Finished Control File and SPFILE Autobackup at 15-NOV-21


RMAN>
sql statement: alter system archive log current

RMAN>
sql statement: alter system archive log current

RMAN>
Starting backup at 15-NOV-21
current log archived
using channel ORA_DISK_1
using channel ORA_DISK_2
channel ORA_DISK_1: starting compressed archived log backup set
channel ORA_DISK_1: specifying archived log(s) in backup set
input archived log thread=1 sequence=58 RECID=116 STAMP=1088432124
input archived log thread=2 sequence=59 RECID=118 STAMP=1088657109
channel ORA_DISK_1: starting piece 1 at 15-NOV-21
channel ORA_DISK_2: starting compressed archived log backup set
channel ORA_DISK_2: specifying archived log(s) in backup set
input archived log thread=1 sequence=59 RECID=117 STAMP=1088432125
input archived log thread=2 sequence=60 RECID=119 STAMP=1088657109
input archived log thread=1 sequence=60 RECID=122 STAMP=1088659919
input archived log thread=2 sequence=61 RECID=120 STAMP=1088657116
input archived log thread=2 sequence=62 RECID=121 STAMP=1088659918
input archived log thread=2 sequence=63 RECID=124 STAMP=1088659921
channel ORA_DISK_2: starting piece 1 at 15-NOV-21
channel ORA_DISK_2: finished piece 1 at 15-NOV-21
piece handle=/home/oracle/backup/archivelog_OP01_290e78eq_73_20211115 tag=TAG20211115T053209 comment=NONE
channel ORA_DISK_2: backup set complete, elapsed time: 00:00:03
channel ORA_DISK_2: deleting archived log(s)
archived log file name=+RECO/op01_nrt1js/archivelog/2021_11_12/thread_1_seq_59.267.1088432125 RECID=117 STAMP=1088432125
archived log file name=+RECO/op01_nrt1js/archivelog/2021_11_15/thread_2_seq_60.291.1088657109 RECID=119 STAMP=1088657109
archived log file name=+RECO/op01_nrt1js/archivelog/2021_11_15/thread_1_seq_60.265.1088659919 RECID=122 STAMP=1088659919
archived log file name=+RECO/op01_nrt1js/archivelog/2021_11_15/thread_2_seq_61.270.1088657117 RECID=120 STAMP=1088657116
archived log file name=+RECO/op01_nrt1js/archivelog/2021_11_15/thread_2_seq_62.273.1088659919 RECID=121 STAMP=1088659918
archived log file name=+RECO/op01_nrt1js/archivelog/2021_11_15/thread_2_seq_63.268.1088659921 RECID=124 STAMP=1088659921
channel ORA_DISK_2: starting compressed archived log backup set
channel ORA_DISK_2: specifying archived log(s) in backup set
input archived log thread=1 sequence=61 RECID=123 STAMP=1088659920
input archived log thread=1 sequence=62 RECID=125 STAMP=1088659925
input archived log thread=2 sequence=64 RECID=126 STAMP=1088659927
channel ORA_DISK_2: starting piece 1 at 15-NOV-21
channel ORA_DISK_1: finished piece 1 at 15-NOV-21
piece handle=/home/oracle/backup/archivelog_OP01_280e78eq_72_20211115 tag=TAG20211115T053209 comment=NONE
channel ORA_DISK_1: backup set complete, elapsed time: 00:00:04
channel ORA_DISK_1: deleting archived log(s)
archived log file name=+RECO/op01_nrt1js/archivelog/2021_11_12/thread_1_seq_58.266.1088432125 RECID=116 STAMP=1088432124
archived log file name=+RECO/op01_nrt1js/archivelog/2021_11_15/thread_2_seq_59.271.1088657109 RECID=118 STAMP=1088657109
channel ORA_DISK_2: finished piece 1 at 15-NOV-21
piece handle=/home/oracle/backup/archivelog_OP01_2a0e78et_74_20211115 tag=TAG20211115T053209 comment=NONE
channel ORA_DISK_2: backup set complete, elapsed time: 00:00:01
channel ORA_DISK_2: deleting archived log(s)
archived log file name=+RECO/op01_nrt1js/archivelog/2021_11_15/thread_1_seq_61.286.1088659921 RECID=123 STAMP=1088659920
archived log file name=+RECO/op01_nrt1js/archivelog/2021_11_15/thread_1_seq_62.269.1088659925 RECID=125 STAMP=1088659925
archived log file name=+RECO/op01_nrt1js/archivelog/2021_11_15/thread_2_seq_64.274.1088659927 RECID=126 STAMP=1088659927
Finished backup at 15-NOV-21

Starting Control File and SPFILE Autobackup at 15-NOV-21
piece handle=/home/oracle/backup/cf_c-2948649754-20211115-01 comment=NONE
Finished Control File and SPFILE Autobackup at 15-NOV-21

RMAN>

Recovery Manager complete.

[oracle@onp1 ~]$ cd /home/oracle/backup
[oracle@onp1 backup]$ ll
total 294640
-rw-r----- 1 oracle asmadmin  46821376 Nov 15 05:32 archivelog_OP01_280e78eq_72_20211115
-rw-r----- 1 oracle asmadmin  18029568 Nov 15 05:32 archivelog_OP01_290e78eq_73_20211115
-rw-r----- 1 oracle asmadmin      3584 Nov 15 05:32 archivelog_OP01_2a0e78et_74_20211115
-rw-r----- 1 oracle asmadmin  18710528 Nov 15 05:31 cf_c-2948649754-20211115-00
-rw-r----- 1 oracle asmadmin  18710528 Nov 15 05:32 cf_c-2948649754-20211115-01 ★制御ファイル
-rw-r----- 1 oracle asmadmin 140869632 Nov 15 05:31 full_bkp_L0_250e78dq_1_1
-rw-r----- 1 oracle asmadmin  58540032 Nov 15 05:31 full_bkp_L0_260e78dq_1_1
-rw-r--r-- 1 oracle asmadmin      2292 Nov  5 06:53 initop011.ora
```
##【OnP側】透過的データベース暗号化TDEのWalletファイル
透過的データベース暗号化のための Wallet ファイルが必要です。RMAN バックアップは、この Wallet ファイルを使用して暗号化されているので、DBCS側で複合化する時にも必要なファイルです。
sqlnet.ora の設定値を確認して、Wallet ファイルの格納先を確認します。

❐OnP DB #1❐sqlnet.ora の設定値を確認します。

```
[oracle@onp1 ~]$ cat /u01/app/oracle/product/11.2.0.4/dbhome_1/network/admin/sqlnet.ora
ENCRYPTION_WALLET_LOCATION=(SOURCE=(METHOD=FILE)(METHOD_DATA=(DIRECTORY=/opt/oracle/dcs/commonstore/wallets/tde/$ORACLE_UNQNAME)))　　
⇑Wallet ファイルの格納先
SQLNET.ENCRYPTION_SERVER=REQUIRED
SQLNET.CRYPTO_CHECKSUM_SERVER=REQUIRED
SQLNET.ENCRYPTION_TYPES_SERVER=(AES256,AES192,AES128)
SQLNET.CRYPTO_CHECKSUM_TYPES_SERVER=(SHA1)
SQLNET.ENCRYPTION_CLIENT=REQUIRED
SQLNET.CRYPTO_CHECKSUM_CLIENT=REQUIRED
SQLNET.ENCRYPTION_TYPES_CLIENT=(AES256,AES192,AES128)
SQLNET.CRYPTO_CHECKSUM_TYPES_CLIENT=(SHA1)
```
❐OnP DB #1❐ TDE Wallet ファイルを確認します。

```
[oracle@onp1 ~]$ cd /opt/oracle/dcs/commonstore/wallets/tde/
[oracle@onp1 tde]$ ll
total 52
drwx------ 2 oracle oinstall 20480 Nov  1 02:09 op01_nrt1js
[oracle@onp1 tde]$ cd op01_nrt1js
[oracle@onp1 op01_nrt1js]$ ll
total 8
-rw------- 1 oracle oinstall 2917 Nov  1 02:09 cwallet.sso　★Autologinファイル
-rw------- 1 oracle asmadmin 2840 Nov  1 02:09 ewallet.p12　★PWファイル
```
❐OnP DB #1❐TDE Wallet ファイルをbackupに移動します。

```
[oracle@onp1 op01_nrt1js]$ cp cwallet.sso ewallet.p12 /home/oracle/backup
```
❐OnP DB #1❐Object Storageへアップロードするファイルを確認します

```
[oracle@onp1 op01_nrt1js]$ cd /home/oracle/backup
[oracle@onp1 backup]$ ll
total 294640
-rw-r----- 1 oracle asmadmin  46821376 Nov 15 05:32 archivelog_OP01_280e78eq_72_20211115
-rw-r----- 1 oracle asmadmin  18029568 Nov 15 05:32 archivelog_OP01_290e78eq_73_20211115
-rw-r----- 1 oracle asmadmin      3584 Nov 15 05:32 archivelog_OP01_2a0e78et_74_20211115
-rw-r----- 1 oracle asmadmin  18710528 Nov 15 05:31 cf_c-2948649754-20211115-00
-rw-r----- 1 oracle asmadmin  18710528 Nov 15 05:32 cf_c-2948649754-20211115-01
-rw------- 1 oracle oinstall      2917 Nov  9 06:21 cwallet.sso　★TDE関連ファイル
-rw------- 1 oracle oinstall      2840 Nov  9 06:21 ewallet.p12　★TDE関連ファイル
-rw-r----- 1 oracle asmadmin 140869632 Nov 15 05:31 full_bkp_L0_250e78dq_1_1
-rw-r----- 1 oracle asmadmin  58540032 Nov 15 05:31 full_bkp_L0_260e78dq_1_1
-rw-r--r-- 1 oracle asmadmin      2292 Nov  5 06:53 initop011.ora
```
---
##【OnP側】OCI CLIで一括でアップロード
/home/oracle/backupにあるすべてのバックアップファイルをオブジェクト・ストレージにOCI CLIで一括でアップロードします。

```Json:
[oracle@onp1 ~]$ oci os object bulk-upload --bucket-name OnP11g_Backup --src-dir /home/oracle/backup/
Uploaded cf_c-2948649754-20211115-01  [####################################]  100%
Uploaded archivelog_OP01_290e78eq_73_20211115  [####################################]  100%
Uploaded cf_c-2948649754-20211115-00  [####################################]  100%
Uploaded archivelog_OP01_280e78eq_72_20211115  [####################################]  100%
Uploaded full_bkp_L0_260e78dq_1_1  [####################################]  100%
Uploaded full_bkp_L0_250e78dq_1_1  [####################################]  100%

{
  "skipped-objects": [],
  "upload-failures": {},
  "uploaded-objects": {
    "archivelog_OP01_280e78eq_72_20211115": {
      "etag": "f7b3712e-2516-4865-a16f-6bf813728f43",
      "last-modified": "Mon, 15 Nov 2021 05:35:00 GMT",
      "opc-content-md5": "Oy841DAMJSe06BAss9oESQ=="
    },
    "archivelog_OP01_290e78eq_73_20211115": {
      "etag": "28509477-bec7-41ec-b586-ceda7225ccdd",
      "last-modified": "Mon, 15 Nov 2021 05:34:58 GMT",
      "opc-content-md5": "HbRgmDfBVcuOCtfZtuUbiA=="
    },
    "archivelog_OP01_2a0e78et_74_20211115": {
      "etag": "91f4cfcb-2aef-446e-b406-007c56fc81e1",
      "last-modified": "Mon, 15 Nov 2021 05:34:57 GMT",
      "opc-content-md5": "fzIKIeRJpJDOUwc0Tgs8KA=="
    },
    "cf_c-2948649754-20211115-00": {
      "etag": "ce7bc790-39ac-4370-9e10-93c31722dbce",
      "last-modified": "Mon, 15 Nov 2021 05:34:58 GMT",
      "opc-content-md5": "P6V6odxnQr/8YBgSACV0lw=="
    },
    "cf_c-2948649754-20211115-01": {
      "etag": "0639f058-657a-4383-90dd-f6c552071f47",
      "last-modified": "Mon, 15 Nov 2021 05:34:58 GMT",
      "opc-content-md5": "PsBtFgN0B2qf2GbFnHB6cA=="
    },
    "cwallet.sso": {
      "etag": "0fa770a5-7ab9-442d-b86b-e59750d2c85a",
      "last-modified": "Mon, 15 Nov 2021 05:34:57 GMT",
      "opc-content-md5": "JU/edihsdah/EkuKpV9KEw=="
    },
    "ewallet.p12": {
      "etag": "a62a3bae-0968-4de8-bf68-cec73efdb524",
      "last-modified": "Mon, 15 Nov 2021 05:34:57 GMT",
      "opc-content-md5": "RLlubXCYe+zyrTqKNQu75g=="
    },
    "full_bkp_L0_250e78dq_1_1": {
      "etag": "fcbf5f51-9150-4070-bae4-a38380287206",
      "last-modified": "Mon, 15 Nov 2021 05:35:03 GMT",
      "opc-multipart-md5": "0qfI1K0J331DSfMd9Ypl5Q==-2"
    },
    "full_bkp_L0_260e78dq_1_1": {
      "etag": "5cd96413-464b-4c7f-bdfd-2e8582f65e1e",
      "last-modified": "Mon, 15 Nov 2021 05:35:00 GMT",
      "opc-content-md5": "w37xrbr83wannFtMB+RnOw=="
    },
    "initop011.ora": {
      "etag": "255577dd-d353-4712-bac2-d4b671a45ccc",
      "last-modified": "Mon, 15 Nov 2021 05:34:57 GMT",
      "opc-content-md5": "PcHDPFRXGmRUM2U5cS3sxQ=="
    }
  }
}
```
OCI画面のオブジェクト・ストレージページからバックアップファイルがUploadされていることを確認できます。
![objectstorage.jpg](https://qiita-image-store.s3.ap-northeast-1.amazonaws.com/0/453491/20de05a4-637b-ed81-7636-707e792eaeb5.jpeg)

ここまでOnP側の作業完了

##【DBCS側】事前準備
**以下の作業はDBCSの一つのノードで実施**
**YUMリポジトリ取得やOCI CLIインストール＆設定は上記のOnP側の作業をご参考ください。**

##【DBCS NODE1実施】OCIでファイルストレージサービス(FSS)を実装
コンソールメニューからストレージ　＞　ファイル・システムを選択します。
![console.jpg](https://qiita-image-store.s3.ap-northeast-1.amazonaws.com/0/453491/789cea48-8d15-4e7b-7756-c1639487167a.jpeg)

その後、遷移した画面にファイル・システム作成のボタンが出てくるので押下します。
![filestorage.jpg](https://qiita-image-store.s3.ap-northeast-1.amazonaws.com/0/453491/402e63bb-c632-4f6a-d773-a22a0b298ce7.jpeg)

作成するファイル・システムの情報を入力する画面が出てきます。
各情報の詳細の編集という文字をクリックすると項目が出てくるので、必要な項目を入力していきます。
入力が終わったら、作成ボタンを押下します。
成功すると、ファイル・システムとマウント・ターゲットが作成されます。
![filestorage2.jpg](https://qiita-image-store.s3.ap-northeast-1.amazonaws.com/0/453491/06701a54-24c1-e965-c881-a324e3c8405b.jpeg)
![filestorage3.jpg](https://qiita-image-store.s3.ap-northeast-1.amazonaws.com/0/453491/474a9556-75e2-06f7-36c9-5ee0210f6842.jpeg)
![filestorage4.jpg](https://qiita-image-store.s3.ap-northeast-1.amazonaws.com/0/453491/2d09e524-fc49-ee62-b7db-2fedaca62be0.jpeg)
![filestorage5.jpg](https://qiita-image-store.s3.ap-northeast-1.amazonaws.com/0/453491/8a2a75a2-c53e-2470-f55e-7757c61a4c71.jpeg)
作成された共有ストレージを使用してみます。FSSはNFSv3に対応していています。
作成されたファイル・システムは、マウント・ターゲットにエクスポートされている状態です。
なので、このままNFSクライアントからネットワーク越しにアクセスできます。

インスタンス側には何も設定をしていないので、インスタンスにNFSクライアントをインストールして、ファイル・システムをマウントしていきます。
❐DBCS DB #1❐以下のコマンドでnfs-utilsをインストールします。

```
[opc@dbcs1 ~]$ sudo yum install nfs-utils
＜省略＞
Updated:
  nfs-utils.x86_64 1:1.3.0-0.68.0.1.el7.2

Complete!
```
❐DBCS DB #1❐以下のような結果になれば、インストールされています。

```
[opc@dbcs1 ~]$ sudo yum list installed | grep nfs-utils
nfs-utils.x86_64           1:1.3.0-0.68.0.1.el7.2   @ol7_latest　★インストール済み
```
❐DBCS DB #1❐ファイルシステムをマウントするマウントポイントを作成します。

```
[opc@dbcs1 ~]$ sudo mkdir -p /mnt/FSSDBCSNODE1
```
❐DBCS DB #1❐現在マウント状態を確認します。

```
[opc@dbcs1 ~]$ df -h
Filesystem                           Size  Used Avail Use% Mounted on
devtmpfs                              15G     0   15G   0% /dev
tmpfs                                 15G  845M   14G   6% /dev/shm
tmpfs                                 15G  8.9M   15G   1% /run
tmpfs                                 15G     0   15G   0% /sys/fs/cgroup
/dev/mapper/VolGroupSys0-LogVolRoot   45G  9.4G   33G  23% /
/dev/sda2                            1.4G   99M  1.2G   8% /boot
/dev/sda1                            486M  7.5M  478M   2% /boot/efi
/dev/sdj                             197G   22G  166G  12% /u01
tmpfs                                3.0G     0  3.0G   0% /run/user/102
/dev/asm/commonstore-158             5.0G  623M  4.4G  13% /opt/oracle/dcs/commonstore
tmpfs                                3.0G     0  3.0G   0% /run/user/54322
```
❐DBCS DB #1❐以下のコマンドを実行し、マウントします。

```
[opc@dbcs1 ~]$ sudo mount 10.0.0.103:/FSSDBCSNODE1 /mnt/FSSDBCSNODE1
[opc@dbcs1 ~]$ df -h
Filesystem                           Size  Used Avail Use% Mounted on
devtmpfs                              15G     0   15G   0% /dev
tmpfs                                 15G  845M   14G   6% /dev/shm
tmpfs                                 15G  8.9M   15G   1% /run
tmpfs                                 15G     0   15G   0% /sys/fs/cgroup
/dev/mapper/VolGroupSys0-LogVolRoot   45G  9.4G   33G  23% /
/dev/sda2                            1.4G   99M  1.2G   8% /boot
/dev/sda1                            486M  7.5M  478M   2% /boot/efi
/dev/sdj                             197G   22G  166G  12% /u01
tmpfs                                3.0G     0  3.0G   0% /run/user/102
/dev/asm/commonstore-158             5.0G  623M  4.4G  13% /opt/oracle/dcs/commonstore
tmpfs                                3.0G     0  3.0G   0% /run/user/54322
10.0.0.103:/FSSDBCSNODE1             8.0E     0  8.0E   0% /mnt/FSSDBCSNODE1 ★マウント済み
```
❐DBCS DB #1❐rootユーザーに切り替えます。root:rootの権限をoracle:oinstallに設定します。

```
[opc@dbcs1 mnt]$ sudo -s
[root@dbcs1 mnt]# cd /mnt
[root@dbcs1 mnt]# ll
total 0
drwxr-xr-x 2 root root 0 Nov 15 04:35 FSSDBCSNODE1
[root@dbcs1 mnt]# chown oracle:oinstall FSSDBCSNODE1
[root@dbcs1 mnt]# ll
total 0
drwxr-xr-x 2 oracle oinstall 0 Nov 15 04:35 FSSDBCSNODE1
```
❐DBCS DB #1❐再起動する際に自動マウントするよう、設定ファイルの/etc/fstabを設定します。

```
[root@dbcs1 mnt]# vi /etc/fstab
/dev/mapper/VolGroupSys0-LogVolRoot /                       ext4    defaults,_netdev        1 1
LABEL=bootfs             /boot                  ext4    defaults        1 2
LABEL=bootefi             /boot/efi             vfat    defaults        1 2
/dev/mapper/VolGroupSys0-LogVolSwap swap                    swap    defaults        0 0
tmpfs                   /dev/shm                tmpfs   defaults        0 0
devpts                  /dev/pts                devpts  gid=5,mode=620  0 0
sysfs                   /sys                    sysfs   defaults        0 0
proc                    /proc                   proc    defaults        0 0
10.0.0.103:/FSSDBCSNODE1   /mnt/FSSDBCSNODE1  nfs defaults 0 0　　★再起動する際に自動マウントするよう、設定
UUID="17a9b195-0150-4352-99d0-c4587fc8b06d" /u01 ext4  defaults 0 0
```
❐DBCS DB #1❐自動マウントするか検証するため、umountします。

```
[root@dbcs1 mnt]# umount /mnt/FSSDBCSNODE1
[root@dbcs1 mnt]# df -h
Filesystem                           Size  Used Avail Use% Mounted on
devtmpfs                              15G     0   15G   0% /dev
tmpfs                                 15G  845M   14G   6% /dev/shm
tmpfs                                 15G  8.9M   15G   1% /run
tmpfs                                 15G     0   15G   0% /sys/fs/cgroup
/dev/mapper/VolGroupSys0-LogVolRoot   45G  9.4G   33G  23% /
/dev/sda2                            1.4G   99M  1.2G   8% /boot
/dev/sda1                            486M  7.5M  478M   2% /boot/efi
/dev/sdj                             197G   22G  166G  12% /u01
tmpfs                                3.0G     0  3.0G   0% /run/user/102
/dev/asm/commonstore-158             5.0G  623M  4.4G  13% /opt/oracle/dcs/commonstore
tmpfs                                3.0G     0  3.0G   0% /run/user/54322
tmpfs                                3.0G     0  3.0G   0% /run/user/0
```
❐DBCS DB #1❐自動マウントします。

```
[root@dbcs1 mnt]# mount -a
```
❐DBCS DB #1❐自動マウントされていることを確認します。

```
[root@dbcs1 mnt]# df -h
Filesystem                           Size  Used Avail Use% Mounted on
devtmpfs                              15G     0   15G   0% /dev
tmpfs                                 15G  845M   14G   6% /dev/shm
tmpfs                                 15G  8.9M   15G   1% /run
tmpfs                                 15G     0   15G   0% /sys/fs/cgroup
/dev/mapper/VolGroupSys0-LogVolRoot   45G  9.4G   33G  23% /
/dev/sda2                            1.4G   99M  1.2G   8% /boot
/dev/sda1                            486M  7.5M  478M   2% /boot/efi
/dev/sdj                             197G   22G  166G  12% /u01
tmpfs                                3.0G     0  3.0G   0% /run/user/102
/dev/asm/commonstore-158             5.0G  623M  4.4G  13% /opt/oracle/dcs/commonstore
tmpfs                                3.0G     0  3.0G   0% /run/user/54322
tmpfs                                3.0G     0  3.0G   0% /run/user/0
10.0.0.103:/FSSDBCSNODE1             8.0E     0  8.0E   0% /mnt/FSSDBCSNODE1　★自動マウントされていたことを確認します。
```
OnP側と同様でOCI CLI設定完了後、OCI CLI検証を行います。
❐DBCS DB #1❐ここでは、以下のコマンドでリージョンのリストを表示します。

```
[oracle@dbcs1 ~]$ oci iam region list --output table
+-----+----------------+
| key | name           |
+-----+----------------+
| AMS | eu-amsterdam-1 |
| BOM | ap-mumbai-1    |
| CWL | uk-cardiff-1   |
| DXB | me-dubai-1     |
| FRA | eu-frankfurt-1 |
| GRU | sa-saopaulo-1  |
| HYD | ap-hyderabad-1 |
| IAD | us-ashburn-1   |
| ICN | ap-seoul-1     |
| JED | me-jeddah-1    |
| KIX | ap-osaka-1     |
| LHR | uk-london-1    |
| MEL | ap-melbourne-1 |
| MRS | eu-marseille-1 |
| MTZ | il-jerusalem-1 |
| NRT | ap-tokyo-1     |
| PHX | us-phoenix-1   |
| SCL | sa-santiago-1  |
| SIN | ap-singapore-1 |
| SJC | us-sanjose-1   |
| SYD | ap-sydney-1    |
| VCP | sa-vinhedo-1   |
| YNY | ap-chuncheon-1 |
| YUL | ca-montreal-1  |
| YYZ | ca-toronto-1   |
| ZRH | eu-zurich-1    |
+-----+----------------+
```
##【DBCS NODE1】オブジェクト・ストレージからバックアップ・ファイルを一括ダウンロード
以下の作業はDBCSの一つのノードで実施
❐DBCS DB #1❐オブジェクト・ストレージからバックアップ・ファイルを一括ダウンロードします。

```Json:
[oracle@dbcs1 ]# oci os object bulk-download --bucket-name OnP11g_Backup --download-dir /mnt/FSSDBCSNODE1
Downloaded archivelog_OP01_290e78eq_73_20211115  [####################################]  100%
Downloaded cf_c-2948649754-20211115-01  [####################################]  100%
Downloaded cf_c-2948649754-20211115-00  [####################################]  100%
Downloaded archivelog_OP01_280e78eq_72_20211115  [####################################]  100%
Downloaded full_bkp_L0_260e78dq_1_1  [####################################]  100%
Downloaded full_bkp_L0_250e78dq_1_1  [####################################]  100%

{
  "download-failures": {},
  "downloaded-objects": [
    "ewallet.p12",
    "cwallet.sso",
    "archivelog_OP01_2a0e78et_74_20211115",
    "initop011.ora",
    "archivelog_OP01_290e78eq_73_20211115",
    "cf_c-2948649754-20211115-01",
    "cf_c-2948649754-20211115-00",
    "archivelog_OP01_280e78eq_72_20211115",
    "full_bkp_L0_260e78dq_1_1",
    "full_bkp_L0_250e78dq_1_1"
  ],
  "skipped-objects": []
}
```
❐DBCS DB #1❐ダウンロードしたバックアップファイルを確認します。

```
[oracle@dbcs1 ~]$ cd /mnt/FSSDBCSNODE1
[oracle@dbcs1 FSSDBCSNODE1]$ ll
total 299040
-rw-r----- 1 oracle asmadmin  46821376 Nov 15 05:32 archivelog_OP01_280e78eq_72_20211115
-rw-r----- 1 oracle asmadmin  18029568 Nov 15 05:32 archivelog_OP01_290e78eq_73_20211115
-rw-r----- 1 oracle asmadmin      3584 Nov 15 05:32 archivelog_OP01_2a0e78et_74_20211115
-rw-r----- 1 oracle asmadmin  18710528 Nov 15 05:31 cf_c-2948649754-20211115-00
-rw-r----- 1 oracle asmadmin  18710528 Nov 15 05:32 cf_c-2948649754-20211115-01
-rw-r--r-- 1 oracle oinstall      2917 Nov 15 05:45 cwallet.sso
-rw-r--r-- 1 oracle oinstall      2840 Nov 15 05:45 ewallet.p12
-rw-r----- 1 oracle asmadmin 140869632 Nov 15 05:31 full_bkp_L0_250e78dq_1_1
-rw-r----- 1 oracle asmadmin  58540032 Nov 15 05:31 full_bkp_L0_260e78dq_1_1
-rw-r--r-- 1 oracle asmadmin      2292 Nov  5 06:53 initop011.ora
```
---
##【DBCS NODE1】TDE Wallet の復元
以下の作業はDBCSの一つのノードで実施
❐DBCS DB #1❐TDE Wallet 格納場所を確認します。

```
[oracle@dbcs1 ~]$ cat /u01/app/oracle/product/11.2.0.4/dbhome_1/network/admin/sqlnet.ora
ENCRYPTION_WALLET_LOCATION=(SOURCE=(METHOD=FILE)(METHOD_DATA=(DIRECTORY=/opt/oracle/dcs/commonstore/wallets/tde/$ORACLE_UNQNAME)))　
⇑TDEファイル格納場所
SQLNET.ENCRYPTION_SERVER=REQUIRED
SQLNET.CRYPTO_CHECKSUM_SERVER=REQUIRED
SQLNET.ENCRYPTION_TYPES_SERVER=(AES256,AES192,AES128)
SQLNET.CRYPTO_CHECKSUM_TYPES_SERVER=(SHA1)
SQLNET.ENCRYPTION_CLIENT=REQUIRED
SQLNET.CRYPTO_CHECKSUM_CLIENT=REQUIRED
SQLNET.ENCRYPTION_TYPES_CLIENT=(AES256,AES192,AES128)
SQLNET.CRYPTO_CHECKSUM_TYPES_CLIENT=(SHA1)
```
❐DBCS DB #1❐TDE Wallet の復元します。
OnP側の透過的データベース暗号化(Transparent Data Encryption(TDE)) の Wallet ファイルをDBCSから復元します。

```
[oracle@dbcs1 backup]$ mkdir /opt/oracle/dcs/commonstore/wallets/tde/op01_nrt1js
[oracle@dbcs1 backup]$ cd /opt/oracle/dcs/commonstore/wallets/tde
[oracle@dbcs1 tde]$ ll
total 104
drwx------ 2 oracle oinstall 20480 Nov  1 02:19 cloud_nrt1tc ★DBCS元のTDE Wallet
drwxr-xr-x 2 oracle oinstall 20480 Nov  5 04:55 op01_nrt1js ★OnPから復元するTDE Wallet
```
❐DBCS DB #1❐DBCS元のTDE Walletと同様な権限に設定します。

```
[oracle@dbcs1 tde]$ chmod 700 /opt/oracle/dcs/commonstore/wallets/tde/op01_nrt1js 
[oracle@dbcs1 tde]$ ll
total 104
drwx------ 2 oracle oinstall 20480 Nov  1 02:19 cloud_nrt1tc
drwx------ 2 oracle oinstall 20480 Nov  5 04:55 op01_nrt1js
```
❐DBCS DB #1❐cwallet.sso と ewallet.p12 を以下のように復元します。

```
[oracle@dbcs1 tde]$ cd /opt/oracle/dcs/commonstore/wallets/tde/op01_nrt1js
[oracle@dbcs1 op01_nrt1js]$ mv /home/oracle/backup/cwallet.sso /home/oracle/backup/ewallet.p12 ./
[oracle@dbcs1 op01_nrt1js]$ ll
total 8
-rw-r--r-- 1 oracle oinstall 2917 Nov  5 04:51 cwallet.sso
-rw-r--r-- 1 oracle oinstall 2840 Nov  5 04:51 ewallet.p12
```
❐DBCS DB #1❐権限を設定 (root ユーザーで実行)

```
[oracle@dbcs1 op01_nrt1js]$ exit
logout
[root@dbcs1 opc]# cd /opt/oracle/dcs/commonstore/wallets/tde
[root@dbcs1 tde]# ll
total 104
drwx------ 2 oracle oinstall 20480 Nov  1 02:19 cloud_nrt1tc
drwx------ 2 oracle oinstall 20480 Nov  5 04:57 op01_nrt1js
[root@dbcs1 tde]# cd cloud_nrt1tc
[root@dbcs1 cloud_nrt1tc]# ll
total 8
-rw------- 1 oracle oinstall 2917 Nov  1 02:19 cwallet.sso　★DBCS元のファイル
-rw------- 1 oracle asmadmin 2840 Nov  1 02:19 ewallet.p12　★DBCS元のファイル
```
❐DBCS DB #1❐上記の権限設定に従って設定します。

```
[root@dbcs1 tde]# cd /opt/oracle/dcs/commonstore/wallets/tde/op01_nrt1js
[root@dbcs1 op01_nrt1js]# ll
total 8
-rw-r--r-- 1 oracle oinstall 2917 Nov  5 04:51 cwallet.sso
-rw-r--r-- 1 oracle oinstall 2840 Nov  5 04:51 ewallet.p12
[root@dbcs1 op01_nrt1js]# chown oracle:oinstall cwallet.sso
[root@dbcs1 op01_nrt1js]# chown oracle:asmadmin ewallet.p12
[root@dbcs1 op01_nrt1js]# chmod 600 cwallet.sso
[root@dbcs1 op01_nrt1js]# chmod 600 ewallet.p12
[root@dbcs1 op01_nrt1js]# ll
total 8
-rw------- 1 oracle oinstall 2917 Nov  5 04:51 cwallet.sso　★OnPから復元したファイル
-rw------- 1 oracle asmadmin 2840 Nov  5 04:51 ewallet.p12　★OnPから復元したファイル
```
❐DBCS DB #1❐sqlnet を書き換えて、OnP側の TDE Wallet を使用します。

```
[root@dbcs1 op01_nrt1js]# vim /u01/app/oracle/product/11.2.0.4/dbhome_1/network/admin/sqlnet.ora
#ENCRYPTION_WALLET_LOCATION=(SOURCE=(METHOD=FILE)(METHOD_DATA=(DIRECTORY=/opt/oracle/dcs/commonstore/wallets/tde/$ORACLE_UNQNAME)))
ENCRYPTION_WALLET_LOCATION=(SOURCE=(METHOD=FILE)(METHOD_DATA=(DIRECTORY=/opt/oracle/dcs/commonstore/wallets/tde/op01_nrt1js)))
# ↑書き換え
SQLNET.ENCRYPTION_SERVER=REQUIRED
SQLNET.CRYPTO_CHECKSUM_SERVER=REQUIRED
SQLNET.ENCRYPTION_TYPES_SERVER=(AES256,AES192,AES128)
SQLNET.CRYPTO_CHECKSUM_TYPES_SERVER=(SHA1)
SQLNET.ENCRYPTION_CLIENT=REQUIRED
SQLNET.CRYPTO_CHECKSUM_CLIENT=REQUIRED
SQLNET.ENCRYPTION_TYPES_CLIENT=(AES256,AES192,AES128)
SQLNET.CRYPTO_CHECKSUM_TYPES_CLIENT=(SHA1)
```
❐DBCS DB #1❐TDE Wallet の Open 状況の確認します。
SQL*Plus の接続をします。

```
[root@dbcs1 op01_nrt1js]# su - oracle
[oracle@dbcs1 ~]$ sqlplus / as sysdba

SQL*Plus: Release 11.2.0.4.0 Production on Fri Nov 5 05:02:43 2021

Copyright (c) 1982, 2013, Oracle.  All rights reserved.
Connected to:
Oracle Database 11g EE Extreme Perf Release 11.2.0.4.0 - 64bit Production
With the Partitioning, Real Application Clusters, Automatic Storage Management, Oracle Label Security,
OLAP, Data Mining, Oracle Database Vault and Real Application Testing options

SQL> col WRL_TYPE for a10
SQL> set linesize 200
SQL> col WRL_PARAMETER for a90
SQL> col STATUS for a10
SQL> select * from v$encryption_wallet;

WRL_TYPE   WRL_PARAMETER                                                                              STATUS
---------- ------------------------------------------------------------------------------------------ ----------
file       /opt/oracle/dcs/commonstore/wallets/tde/op01_nrt1js                                        OPEN　　★OPENになっていること
```
---
##【DBCS NODE1】リストアする前の準備作業(1)
❐DBCS DB #1❐DBCSのSCAN名の確認

```
[oracle@dbcs1 ~]$  srvctl config scan
SCAN name: dbcs-scan.publicsubnet.vcnjpantechning.oraclevcn.com, Network: 1/10.0.0.0/255.255.255.0/ens3
SCAN VIP name: scan1, IP: /dbcs-scan.publicsubnet.vcnjpantechning.oraclevcn.com/10.0.0.128
SCAN VIP name: scan2, IP: /dbcs-scan.publicsubnet.vcnjpantechning.oraclevcn.com/10.0.0.226
SCAN VIP name: scan3, IP: /dbcs-scan.publicsubnet.vcnjpantechning.oraclevcn.com/10.0.0.76
```
❐DBCS DB #1❐ DBCS でリストアを実施するため、既存の稼働しているインスタンス (sid : cloud1) を停止します。

```
[oracle@dbcs1 ~]$ echo $ORACLE_SID
cloud1
```
注意： DBCS でリストアを実施するため、srvctlコマンドで既存の稼働しているDBを停止します。
❐DBCS DB #1❐srvctlコマンドで既存の稼働しているDBを停止します。

```
[oracle@dbcs1 ~]$ srvctl stop database -d cloud_nrt1tc
[oracle@dbcs1 ~]$ srvctl status database -d cloud_nrt1tc
Instance cloud1 is not running on node dbcs1 ★停止済み
Instance cloud2 is not running on node dbcs2 ★停止済み
```

##【DBCS両ノード】リストアする前の準備作業(2)
DBCS両ノードでそれぞれの設定が必要になります。
以下の手順はノード#1で実施した手順となります。
❐DBCS DB #1❐/etc/oratab(自動起動のための Oracle の Config ファイル) の設定値を確認します。
OnP側の DB と同じSIDを設定するために、vi で開きます。

```
[oracle@dbcs1 ~]$ vi /etc/oratab
#Backup file is  /u01/app/grid/crsdata/dbcs1/output/oratab.bak.dbcs1.oracle line added by Agent
#
# This file is used by ORACLE utilities.  It is created by root.sh
# and updated by either Database Configuration Assistant while creating
# a database or ASM Configuration Assistant while creating ASM instance.

# A colon, ':', is used as the field terminator.  A new line terminates
# the entry.  Lines beginning with a pound sign, '#', are comments.
#
# Entries are of the form:
#   $ORACLE_SID:$ORACLE_HOME:<N|Y>:
#
# The first and second fields are the system identifier and home
# directory of the database respectively.  The third field indicates
# to the dbstart utility that the database should , "Y", or should not,
# "N", be brought up at system boot time.
#
# Multiple entries with the same $ORACLE_SID are not allowed.
#
#
#cloud_nrt1tc:/u01/app/oracle/product/11.2.0.4/dbhome_1:N               # line added by Agent　★コメントアウトします。
op01_nrt1js:/u01/app/oracle/product/11.2.0.4/dbhome_1:N　★OnP側のDB設定に変更します。
```
環境変数の設定についてはDBCS両ノードでそれぞれの設定が必要になります。
以下の手順はノード#1で実施した手順となります。
❐DBCS DB #1❐DBCS上のORACLE_SID を、OnP側のSID　op011 へ変更します。

```
[oracle@dbcs1 ~]$ . oraenv
ORACLE_SID = [cloud1] ? op011
ORACLE_HOME = [/home/oracle] ? /u01/app/oracle/product/11.2.0.4/dbhome_1
The Oracle base has been set to /u01/app/oracle
```
❐DBCS DB #1❐.bashrc でも SID を設定していることを確認します。

```
[oracle@dbcs1 ~]$ vi ~/.bashrc
# .bashrc

# Source global definitions
if [ -f /etc/bashrc ]; then
. /etc/bashrc
fi

# Uncomment the following line if you don't like systemctl's auto-paging feature:
# export SYSTEMD_PAGER=

# User specific aliases and functions
ORACLE_HOME=/u01/app/oracle/product/11.2.0.4/dbhome_1; export ORACLE_HOME
PATH=$PATH:/u01/app/oracle/product/11.2.0.4/dbhome_1/bin; export PATH
LD_LIBRARY_PATH=/u01/app/oracle/product/11.2.0.4/dbhome_1/lib; export LD_LIBRARY_PATH
#ORACLE_UNQNAME=cloud_nrt1tc;export ORACLE_UNQNAME
#ORACLE_SID=cloud1; export ORACLE_SID
ORACLE_UNQNAME=op01_nrt1js;export ORACLE_UNQNAME　　★OnPノード#1と同様に設定、ノード＃2もOnP同様設定
ORACLE_SID=op011; export ORACLE_SID　★OnPノード#1と同様に設定、ノード＃2もOnP同様設定
## WARNING!! Modifying this file can cause failures in API/CLI provided by Cloud Tooling!!

export PATH=/home/oracle/bin:$PATH
[[ -e "/home/oracle/lib/oracle-cli/lib/python3.8/site-packages/oci_cli/bin/oci_autocomplete.sh" ]] && source "/home/oracle/lib/oracle-cli/lib/python3.8/site-packages/oci_cli/bin/oci_autocomplete.sh"
```
❐DBCS DB #1❐環境変数をsourceします。

```
[oracle@dbcs1 ~]$ source ~/.bashrc
```
❐DBCS DB #1❐OnP側の初期化パラーメータをinitop011.oraを$ORACLE_HOME/dbsに格納します。

```
[oracle@dbcs1 ~]$ cd ~
[oracle@dbcs1 ~]$ cd /mnt/FSSDBCSNODE1
[oracle@dbcs1 FSSDBCSNODE1]$ ll
total 209728
-rw-r--r-- 1 oracle oinstall   1176064 Nov  5 04:51 archivelog_OP01_140daa7b_36_20211104
-rw-r--r-- 1 oracle oinstall   1144320 Nov  5 04:51 archivelog_OP01_150daa7b_37_20211104
-rw-r--r-- 1 oracle oinstall      3072 Nov  5 04:51 archivelog_OP01_160daa7c_38_20211104
-rw-r--r-- 1 oracle oinstall  18644992 Nov  5 04:51 cf_c-2948649754-20211104-05
-rw-r--r-- 1 oracle oinstall  18710528 Nov  5 04:51 cf_c-2948649754-20211104-06
-rw-r--r-- 1 oracle oinstall 140517376 Nov  5 04:51 full_bkp_L0_110daa6b_1_1
-rw-r--r-- 1 oracle oinstall  34545664 Nov  5 04:51 full_bkp_L0_120daa6b_1_1
-rw-r--r-- 1 oracle oinstall      2292 Nov  5 06:59 initop011.ora　★OnP側の初期化パラーメータ
-rw-r--r-- 1 oracle oinstall      4945 Nov  5 04:51 rmanlog_20211104-060353.log

[oracle@dbcs1 FSSDBCSNODE1]$ cp initop011.ora $ORACLE_HOME/dbs
[oracle@dbcs1 FSSDBCSNODE1]$ cd $ORACLE_HOME/dbs
[oracle@dbcs1 dbs]$ ll
total 40
-rw-rw---- 1 oracle asmadmin 1544 Nov  5 05:21 hc_cloud1.dat
-rw-r----- 1 oracle oinstall 1544 May  4  2021 hc_g15100.dat
-rw-rw---- 1 oracle asmadmin 1544 Nov  5 05:44 hc_op011.dat
-rw-r--r-- 1 oracle oinstall 2851 May 15  2009 init.ora　
-rw-r----- 1 oracle oinstall   44 Nov  1 02:17 initcloud1.ora　★そもそもDBCSのpfile
-rw-r----- 1 oracle oinstall   77 May  4  2021 initg15100.ora
-rw-r--r-- 1 oracle oinstall 2292 Nov  5 07:02 initop011.ora　　★OnPから持ってきたpfile
-rw-r----- 1 oracle oinstall 1536 Nov  1 02:16 orapwcloud1
-rw-r----- 1 oracle oinstall 1536 May  4  2021 orapwg15100
```
##【DBCS NODE1】pfile編集や事前ディレクトリの作成
❐DBCS DB #1❐OnP側のPfileを編集します。
事前にDBCSノード#1に作成必要なディレクトリを確認します。

```
[oracle@dbcs1 dbs]$ vi initop011.ora
op012.__db_cache_size=12381585408　
op011.__db_cache_size=12381585408
op012.__java_pool_size=33554432
op011.__java_pool_size=33554432
op012.__large_pool_size=67108864
op011.__large_pool_size=67108864
op012.__pga_aggregate_target=3623878656
op011.__pga_aggregate_target=3623878656
op012.__sga_target=14495514624
op011.__sga_target=14495514624
op012.__shared_io_pool_size=0
op011.__shared_io_pool_size=0
op012.__shared_pool_size=1912602624
op011.__shared_pool_size=1912602624
op012.__streams_pool_size=0
op011.__streams_pool_size=0
*._datafile_write_errors_crash_instance=false
*._db_writer_coalesce_area_size=16777216
*._disable_interface_checking=TRUE
*._ENABLE_NUMA_SUPPORT=FALSE
*._FILE_SIZE_INCREASE_INCREMENT=2143289344
*._fix_control='18960760:on'
*._gc_policy_time=0
*._gc_undo_affinity=FALSE
*.audit_file_dest='/u01/app/oracle/admin/op01_nrt1js/adump'　　★DBCS側に該当ディレクトリがないので作成必要
*.audit_sys_operations=TRUE
*.audit_trail='db'
*.cluster_database=true
*.compatible='11.2.0.4'
*.control_files='+RECO/op01_nrt1js/controlfile/current.256.1087437915'　★この行は削除します。
*.cpu_count=0
*.cursor_sharing='EXACT'
*.db_block_checking='FULL'
*.db_block_checksum='FULL'
*.db_block_size=8192
*.db_create_file_dest='+DATA'
*.db_create_online_log_dest_1='+RECO'
*.db_domain='publicsubnet.vcnjpantechning.oraclevcn.com'　
*.db_files=1024
*.db_lost_write_protect='TYPICAL'
*.db_name='op01'
*.db_recovery_file_dest='+RECO'
*.db_recovery_file_dest_size=269509197824
*.db_unique_name='op01_nrt1js'
*.diagnostic_dest='/u01/app/oracle'
*.dispatchers='(PROTOCOL=TCP) (SERVICE=op01XDB)'
*.fast_start_mttr_target=300
*.filesystemio_options='setall'
*.global_names=TRUE
op011.instance_number=1
op012.instance_number=2
*.log_archive_format='%t_%s_%r.dbf'
*.log_buffer=16777216
*.nls_language='AMERICAN'
*.nls_territory='AMERICA'
*.open_cursors=1000
*.os_authent_prefix=''
*.parallel_adaptive_multi_user=FALSE
*.parallel_execution_message_size=16384
*.parallel_threads_per_cpu=2
*.pga_aggregate_target=3623878656
*.processes=400
*.remote_listener='onp-scan.publicsubnet.vcnjpantechning.oraclevcn.com:1521'　★DBCSのSCAN名：dbcs-scan.publicsubnet.vcnjpantechning.oraclevcn.comに書き換え
*.remote_login_passwordfile='exclusive'
*.session_cached_cursors=100
*.sga_target=14495514624
*.sql92_security=TRUE
op012.thread=2
op011.thread=1
*.undo_retention=900
op012.undo_tablespace='UNDOTBS2'
op011.undo_tablespace='UNDOTBS1'
*.use_large_pages='only'
```
❐DBCS DB #1❐リストアするための事前ディレクトリ作成しておきます。

```
[oracle@dbcs1 ~]$ mkdir -p /u01/app/oracle/admin/op01_nrt1js/adump
[oracle@dbcs1 ~]$ ll /u01/app/oracle/admin/op01_nrt1js/adump
total 0
```
❐DBCS DB #1❐ASMに格納が必要なディレクトリ作成しておきます。

```
[root@dbcs1 ~]$su - grid
[grid@dbcs1 ~]$ asmcmd
ASMCMD> ls
DATA/
RECO/
ASMCMD> cd DATA/
ASMCMD> ls
ASM/
CLOUD_NRT1TC/
dbSyslfgm5ioq/
orapwasm
orapwasm_backup
ASMCMD> mkdir op01_nrt1js　★OnP側のop01_nrt1jsフォルダを作成(OnPと同じ設定)
ASMCMD> cd op01_nrt1js
ASMCMD> mkdir datafile　★OnP側のop01_nrt1jsフォルダにdatafile格納場所を作成(OnPと同じ設定)
ASMCMD> cd ..
ASMCMD> ls
ASM/
CLOUD_NRT1TC/
dbSyslfgm5ioq/
op01_nrt1js/　　
orapwasm
orapwasm_backup
ASMCMD> cd op01_nrt1js/
ASMCMD> ls
datafile/
ASMCMD> cd datafile/
ASMCMD> pwd
+DATA/op01_nrt1js/datafile　★ここにデータファイルをリストアする
```
##【DBCS NODE1】RMANでリストアとリカバリを実施
❐DBCS DB #1❐RMAN接続をします。

```
[oracle@dbcs1 ~]$ rman target /

Recovery Manager: Release 11.2.0.4.0 - Production on Fri Nov 5 05:34:53 2021

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

connected to target database (not started)

❐DBCS DB #1❐OnP側で確認したDBID を設定
RMAN> set dbid 2948649754

executing command: SET DBID

❐DBCS DB #1❐編集したPfileからデータベースをnomountで起動
RMAN> startup nomount pfile='/u01/app/oracle/product/11.2.0.4/dbhome_1/dbs/initop011.ora';

Oracle instance started

Total System Global Area   14430793728 bytes

Fixed Size                     2267144 bytes
Variable Size               2147485688 bytes
Database Buffers           12247367680 bytes
Redo Buffers                  33673216 bytes


❐DBCS DB #1❐TDE を使った暗号化の設定をします
RMAN> SET ENCRYPTION ON;

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

❐DBCS DB #1❐controlfileをバックアップから戻します。
RMAN> restore controlfile from '/mnt/FSSDBCSNODE1/cf_c-2948649754-20211115-01';

Starting restore at 15-NOV-21
allocated channel: ORA_DISK_1
channel ORA_DISK_1: SID=469 instance=op011 device type=DISK

channel ORA_DISK_1: restoring control file
channel ORA_DISK_1: restore complete, elapsed time: 00:00:01
output file name=+RECO/op01_nrt1js/controlfile/current.330.1088663677
Finished restore at 15-NOV-21

❐DBCS DB #1❐データベースをマウントします。
RMAN> alter database mount;

database mounted
released channel: ORA_DISK_1

❐DBCS DB #1❐CATALOG START WITHコマンドにて別の場所に配置したバックアップを、再度リカバリ・カタログに追加します。
RMAN> catalog start with '/mnt/FSSDBCSNODE1';  ★カタログ追加しないとエラー発生

searching for all files that match the pattern /mnt/FSSDBCSNODE1

List of Files Unknown to the Database
=====================================
File Name: /mnt/FSSDBCSNODE1/full_bkp_L0_250e78dq_1_1
File Name: /mnt/FSSDBCSNODE1/archivelog_OP01_290e78eq_73_20211115
File Name: /mnt/FSSDBCSNODE1/archivelog_OP01_280e78eq_72_20211115
File Name: /mnt/FSSDBCSNODE1/ewallet.p12
File Name: /mnt/FSSDBCSNODE1/cwallet.sso
File Name: /mnt/FSSDBCSNODE1/archivelog_OP01_2a0e78et_74_20211115
File Name: /mnt/FSSDBCSNODE1/cf_c-2948649754-20211115-01
File Name: /mnt/FSSDBCSNODE1/full_bkp_L0_260e78dq_1_1
File Name: /mnt/FSSDBCSNODE1/initop011.ora
File Name: /mnt/FSSDBCSNODE1/cf_c-2948649754-20211115-00

Do you really want to catalog the above files (enter YES or NO)? yes
cataloging files...
cataloging done

List of Cataloged Files
=======================
File Name: /mnt/FSSDBCSNODE1/full_bkp_L0_250e78dq_1_1
File Name: /mnt/FSSDBCSNODE1/archivelog_OP01_290e78eq_73_20211115
File Name: /mnt/FSSDBCSNODE1/archivelog_OP01_280e78eq_72_20211115
File Name: /mnt/FSSDBCSNODE1/archivelog_OP01_2a0e78et_74_20211115
File Name: /mnt/FSSDBCSNODE1/cf_c-2948649754-20211115-01
File Name: /mnt/FSSDBCSNODE1/full_bkp_L0_260e78dq_1_1
File Name: /mnt/FSSDBCSNODE1/cf_c-2948649754-20211115-00

List of Files Which Where Not Cataloged
=======================================
File Name: /mnt/FSSDBCSNODE1/ewallet.p12
  RMAN-07517: Reason: The file header is corrupted　
File Name: /mnt/FSSDBCSNODE1/cwallet.sso
  RMAN-07517: Reason: The file header is corrupted
File Name: /mnt/FSSDBCSNODE1/initop011.ora
  RMAN-07517: Reason: The file header is corrupted
  

❐DBCS DB #1❐データベースをリストアします。
RMAN> restore database;

Starting restore at 15-NOV-21
using channel ORA_DISK_1
using channel ORA_DISK_2

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 00002 to +DATA/op01_nrt1js/datafile/sysaux.260.1087437847
channel ORA_DISK_1: restoring datafile 00003 to +DATA/op01_nrt1js/datafile/undotbs1.261.1087437847
channel ORA_DISK_1: restoring datafile 00004 to +DATA/op01_nrt1js/datafile/undotbs2.263.1087437947
channel ORA_DISK_1: reading from backup piece /mnt/FSSDBCSNODE1/full_bkp_L0_260e78dq_1_1
channel ORA_DISK_2: starting datafile backup set restore
channel ORA_DISK_2: specifying datafile(s) to restore from backup set
channel ORA_DISK_2: restoring datafile 00001 to +DATA/op01_nrt1js/datafile/system.259.1087437847
channel ORA_DISK_2: restoring datafile 00005 to +DATA/op01_nrt1js/datafile/users.265.1087438223
channel ORA_DISK_2: restoring datafile 00006 to +DATA/op01_nrt1js/datafile/tbs
channel ORA_DISK_2: reading from backup piece /mnt/FSSDBCSNODE1/full_bkp_L0_250e78dq_1_1
channel ORA_DISK_1: piece handle=/mnt/FSSDBCSNODE1/full_bkp_L0_260e78dq_1_1 tag=INCR LEVEL 0
channel ORA_DISK_1: restored backup piece 1
channel ORA_DISK_1: restore complete, elapsed time: 00:00:15
channel ORA_DISK_2: piece handle=/mnt/FSSDBCSNODE1/full_bkp_L0_250e78dq_1_1 tag=INCR LEVEL 0
channel ORA_DISK_2: restored backup piece 1
channel ORA_DISK_2: restore complete, elapsed time: 00:00:15
Finished restore at 15-NOV-21

❐DBCS DB #1❐データベースをARCHIVELOGモードでの不完全リカバリします。
RMAN> recover database;

Starting recover at 15-NOV-21
using channel ORA_DISK_1
using channel ORA_DISK_2

starting media recovery

channel ORA_DISK_1: starting archived log restore to default destination
channel ORA_DISK_1: restoring archived log
archived log thread=1 sequence=60
channel ORA_DISK_1: restoring archived log
archived log thread=2 sequence=62
channel ORA_DISK_1: restoring archived log
archived log thread=2 sequence=63
channel ORA_DISK_1: reading from backup piece /mnt/FSSDBCSNODE1/archivelog_OP01_290e78eq_73_20211115
channel ORA_DISK_2: starting archived log restore to default destination
channel ORA_DISK_2: restoring archived log
archived log thread=1 sequence=61
channel ORA_DISK_2: restoring archived log
archived log thread=1 sequence=62
channel ORA_DISK_2: restoring archived log
archived log thread=2 sequence=64
channel ORA_DISK_2: reading from backup piece /mnt/FSSDBCSNODE1/archivelog_OP01_2a0e78et_74_20211115
channel ORA_DISK_2: piece handle=/mnt/FSSDBCSNODE1/archivelog_OP01_2a0e78et_74_20211115 tag=TAG20211115T053209
channel ORA_DISK_2: restored backup piece 1
channel ORA_DISK_2: restore complete, elapsed time: 00:00:01
channel ORA_DISK_1: piece handle=/mnt/FSSDBCSNODE1/archivelog_OP01_290e78eq_73_20211115 tag=TAG20211115T053209
channel ORA_DISK_1: restored backup piece 1
channel ORA_DISK_1: restore complete, elapsed time: 00:00:04
archived log file name=+RECO/op01_nrt1js/archivelog/2021_11_15/thread_1_seq_60.302.1088664161 thread=1 sequence=60
archived log file name=+RECO/op01_nrt1js/archivelog/2021_11_15/thread_2_seq_62.329.1088664163 thread=2 sequence=62
channel default: deleting archived log(s)
archived log file name=+RECO/op01_nrt1js/archivelog/2021_11_15/thread_2_seq_62.329.1088664163 RECID=130 STAMP=1088664162
archived log file name=+RECO/op01_nrt1js/archivelog/2021_11_15/thread_2_seq_63.309.1088664163 thread=2 sequence=63
channel default: deleting archived log(s)
archived log file name=+RECO/op01_nrt1js/archivelog/2021_11_15/thread_1_seq_60.302.1088664161 RECID=132 STAMP=1088664162
archived log file name=+RECO/op01_nrt1js/archivelog/2021_11_15/thread_1_seq_61.308.1088664161 thread=1 sequence=61
channel default: deleting archived log(s)
archived log file name=+RECO/op01_nrt1js/archivelog/2021_11_15/thread_1_seq_61.308.1088664161 RECID=127 STAMP=1088664161
archived log file name=+RECO/op01_nrt1js/archivelog/2021_11_15/thread_1_seq_62.294.1088664161 thread=1 sequence=62
channel default: deleting archived log(s)
archived log file name=+RECO/op01_nrt1js/archivelog/2021_11_15/thread_2_seq_63.309.1088664163 RECID=131 STAMP=1088664162
archived log file name=+RECO/op01_nrt1js/archivelog/2021_11_15/thread_2_seq_64.281.1088664163 thread=2 sequence=64
channel default: deleting archived log(s)
archived log file name=+RECO/op01_nrt1js/archivelog/2021_11_15/thread_1_seq_62.294.1088664161 RECID=128 STAMP=1088664162
unable to find archived log
archived log thread=1 sequence=63
RMAN-00571: ===========================================================
RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ===============
RMAN-00571: ===========================================================
RMAN-03002: failure of recover command at 11/15/2021 06:42:46
RMAN-06054: media recovery requesting unknown archived log for thread 1 with sequence 63 and starting SCN of 1492774

❐DBCS DB #1❐データベースをresetlogsオプション付きでDB起動します。
RMAN> alter database open resetlogs;
database opened

RMAN> exit
Recovery Manager complete.

❐DBCS DB #1❐検証用スキーマやデータが戻っていることを確認します。
[oracle@dbcs1 backup]$ sqlplus / as sysdba

SQL*Plus: Release 11.2.0.4.0 Production on Fri Nov 5 08:13:18 2021

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


Connected to:
Oracle Database 11g EE Extreme Perf Release 11.2.0.4.0 - 64bit Production
With the Partitioning, Real Application Clusters, Automatic Storage Management, Oracle Label Security,
OLAP, Data Mining, Oracle Database Vault and Real Application Testing options

SQL> set linesize 200
SQL> col FILE_NAME for a100
SQL> select TABLESPACE_NAME,FILE_NAME from DBA_DATA_FILES;

TABLESPACE FILE_NAME
---------- ----------------------------------------------------------------------------------------------------
UNDOTBS1   +DATA/op01_nrt1js/datafile/undotbs1.276.1087804489
SYSAUX     +DATA/op01_nrt1js/datafile/sysaux.267.1087804489
SYSTEM     +DATA/op01_nrt1js/datafile/system.269.1087804489
UNDOTBS2   +DATA/op01_nrt1js/datafile/undotbs2.273.1087804489
USERS      +DATA/op01_nrt1js/datafile/users.275.1087804489
TBS        +DATA/op01_nrt1js/datafile/tbs

6 rows selected.

TDE暗号化表領域の確認

SQL>set pages 2000 lin 2000
SQL>col TABLESPACE_NAME for a15
SQL>col EXTENT_MANAGEMENT for a17
SQL>col ALLOCATION_TYPE for a15
SQL>col SEGMENT_SPACE_MANAGEMENT for a25
SQL>col BIGFILE for a6
SQL>col ENCRYPTED for a9

SQL>SELECT
  TABLESPACE_NAME
  ,INITIAL_EXTENT
  ,MAX_SIZE
  ,STATUS
  ,EXTENT_MANAGEMENT
  ,ALLOCATION_TYPE
  ,SEGMENT_SPACE_MANAGEMENT
  ,BIGFILE
  ,ENCRYPTED
FROM DBA_TABLESPACES
ORDER BY 1;

TABLESPACE_NAME INITIAL_EXTENT   MAX_SIZE STATUS    EXTENT_MANAGEMENT ALLOCATION_TYPE SEGMENT_SPACE_MANAGEMENT  BIGFIL ENCRYPTED
--------------- -------------- ---------- --------- ----------------- --------------- ------------------------- ------ ---------
SYSAUX                   65536 2147483645 ONLINE    LOCAL             SYSTEM          AUTO                      NO     NO
SYSTEM                   65536 2147483645 ONLINE    LOCAL             SYSTEM          MANUAL                    NO     NO
TBS                      65536 2147483645 ONLINE    LOCAL             SYSTEM          AUTO                      NO     YES　★暗号化済み
TEMP                   1048576 2147483645 ONLINE    LOCAL             UNIFORM         MANUAL                    NO     NO
UNDOTBS1                 65536 2147483645 ONLINE    LOCAL             SYSTEM          MANUAL                    NO     NO
UNDOTBS2                 65536 2147483645 ONLINE    LOCAL             SYSTEM          MANUAL                    NO     NO
USERS                    65536 2147483645 ONLINE    LOCAL             SYSTEM          AUTO                      NO     YES　★暗号化済み

7 rows selected.

SQL> conn DEMO/WElcome##1234
Connected.
SQL> EXEC DBMS_STATS.gather_schema_stats('DEMO');

PL/SQL procedure successfully completed.

SQL>  SELECT TABLE_NAME,NUM_ROWS FROM  DBA_TABLES WHERE TABLESPACE_NAME = 'TBS';

TABLE_NAME                       NUM_ROWS
------------------------------ ----------
STUDENTS                                5
MODULES                                 3
MARKS                                  15

❐DBCS DB #1❐SPFILEを確認します。
SQL>  SHOW PARAMETER spfile;

NAME                                 TYPE        VALUE
------------------------------------ ----------- ------------------------------
spfile                               string

❐DBCS DB #1❐PFILEからSPFILEを作成します。OnP側と同じ場所に格納
SQL> CREATE SPFILE = '+DATA/op01_nrt1js/spfileop01.ora' FROM PFILE ='/u01/app/oracle/product/11.2.0.4/dbhome_1/dbs/initop011.ora';

File created.
```
❐DBCS DB #1❐リスナーの起動を確認します。

```
[oracle@dbcs1 dbs]$ lsnrctl status

LSNRCTL for Linux: Version 11.2.0.4.0 - Production on 09-NOV-2021 08:09:39

Copyright (c) 1991, 2013, Oracle.  All rights reserved.

Connecting to (ADDRESS=(PROTOCOL=tcp)(HOST=)(PORT=1521))
STATUS of the LISTENER
------------------------
Alias                     LISTENER
Version                   TNSLSNR for Linux: Version 19.0.0.0.0 - Production
Start Date                09-NOV-2021 07:18:56
Uptime                    0 days 0 hr. 50 min. 43 sec
Trace Level               off
Security                  ON: Local OS Authentication
SNMP                      OFF
Listener Parameter File   /u01/app/19.0.0.0/grid/network/admin/listener.ora
Listener Log File         /u01/app/grid/diag/tnslsnr/dbcs1/listener/alert/log.xml
Listening Endpoints Summary...
  (DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=LISTENER)))
  (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=10.0.0.214)(PORT=1521)))
  (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=10.0.0.21)(PORT=1521)))
Services Summary...
Service "+APX" has 1 instance(s).
  Instance "+APX1", status READY, has 1 handler(s) for this service...
Service "+ASM" has 1 instance(s).
  Instance "+ASM1", status READY, has 1 handler(s) for this service...
Service "+ASM_DATA" has 1 instance(s).
  Instance "+ASM1", status READY, has 1 handler(s) for this service...
Service "+ASM_RECO" has 1 instance(s).
  Instance "+ASM1", status READY, has 1 handler(s) for this service...
Service "op01XDB.publicsubnet.vcnjpantechning.oraclevcn.com" has 1 instance(s).
  Instance "op011", status READY, has 1 handler(s) for this service...
Service "op01_nrt1js.publicsubnet.vcnjpantechning.oraclevcn.com" has 1 instance(s).
  Instance "op011", status READY, has 1 handler(s) for this service...
The command completed successfully
```
##【DBCS NODE1】RMANでリカバリ後の作業
❐DBCS DB #1❐srvctlでDBCS側の自動再起動の構成を確認します。

```
[oracle@dbcs1 dbs]$ srvctl config database
cloud_nrt1tc　
```
❐DBCS DB #1❐srvctlでデータベース構成から既存DBCSのDBを削除します。

```
[oracle@dbcs1 dbs]$ srvctl remove database -d cloud_nrt1tc
Remove the database cloud_nrt1tc? (y/[n]) y
```
❐DBCS DB #1❐srvctl add コマンドで、自動再起動の設定を入力します。各種パラメータは、OnP側の自動再起動の設定値を参考に適宜変更します。

```
[oracle@dbcs1 dbs]$ srvctl add database \
-d "op01_nrt1js" \
-o "/u01/app/oracle/product/11.2.0.4/dbhome_1" \
-c "RAC" \
-m "publicsubnet.vcnjpantechning.oraclevcn.com" \
-p "+DATA/op01_nrt1js/spfileop01.ora" \
-r "primary" \
-s "OPEN" \
-t "IMMEDIATE" \
-n "op01" \
-y "AUTOMATIC" \
-a "DATA,RECO"
```
❐DBCS DB #1❐srvctl add コマンドでRACの各ノードを追加します。

```
[oracle@dbcs1 ~]$ srvctl add instance -d op01_nrt1js -i op011 -n dbcs1
[oracle@dbcs1 ~]$ srvctl add instance -d op01_nrt1js -i op012 -n dbcs2
```
❐DBCS DB #1❐srvctlでDBCS側の自動再起動の構成を確認します。

```
[oracle@dbcs1 dbs]$ srvctl config database
op01_nrt1js　★OnP側のDBが構成されていることを確認します。
```
❐DBCS DB #1❐設定されたことを確認します。

```
[oracle@dbcs1 ~]$ srvctl config database -d op01_nrt1js
Database unique name: op01_nrt1js　★OnP側のDBも構成されています
Database name: op01
Oracle home: /u01/app/oracle/product/11.2.0.4/dbhome_1
Oracle user: oracle
Spfile: +DATA/op01_nrt1js/spfileop01.ora
Domain: publicsubnet.vcnjpantechning.oraclevcn.com
Start options: open
Stop options: immediate
Database role: PRIMARY
Management policy: AUTOMATIC
Server pools: op01_nrt1js
Database instances: op011,op012 ★各ノードが追加されています
Disk Groups: DATA,RECO
Mount point paths:
Services:
Type: RAC　★RAC構成
Database is administrator managed
```
❐DBCS DB #1❐OnP側と同じ環境変数の設定を行います。

```
[oracle@dbcs1 dbs]$ srvctl setenv database \
-d op01_nrt1js \
-t "ORACLE_UNQNAME=op01_nrt1js,TZ=UTC"
```

❐DBCS DB #1❐環境変数の確認を行います。

```
[oracle@dbcs1 dbs]$ srvctl getenv database -d  op01_nrt1js
op01_nrt1js:
ORACLE_UNQNAME=op01_nrt1js
TZ=UTC

[oracle@dbcs1 ~]$ exit
logout
```
##【DBCS NODE1】既存のデータファイルの削除作業
既存DBのCLOUDに関するデータファイルの削除します。　

```
[root@dbcs1 opc]# su - grid
Last login: Mon Nov 29 07:45:08 UTC 2021
[grid@dbcs1 ~]$ asmcmd
ASMCMD> ls
DATA/
RECO/
ASMCMD> cd DATA
ASMCMD> ls
ASM/
CLOUD_NRT1TC/  ★DBCS新規作成時にできたもの
dbSyslfgm5ioq/
op01_nrt1js/
orapwasm
orapwasm_backup
ASMCMD> rm -rf CLOUD_NRT1TC/
ASMCMD> ls
ASM/
dbSyslfgm5ioq/
op01_nrt1js/
orapwasm
orapwasm_backup
ASMCMD> cd ..
ASMCMD> ls
DATA/
RECO/
ASMCMD> cd RECO
ASMCMD> ls
CLOUD_NRT1TC/
OP01_NRT1JS/
ASMCMD> rm -rf CLOUD_NRT1TC/
ASMCMD> ls
OP01_NRT1JS/
```



##【DBCS両ノード】CRS再起動の確認作業
DBCS両ノードで再起動の確認作業を行います。
以下の手順はノード#1で実施した手順となります。
❐DBCS DB #1❐すべてのサービスを停止します。

```
[root@dbcs1 opc]# /u01/app/19.0.0.0/grid/bin/crsctl stop crs
CRS-2791: Starting shutdown of Oracle High Availability Services-managed resources on 'dbcs1'
CRS-2673: Attempting to stop 'ora.crsd' on 'dbcs1'
CRS-2790: Starting shutdown of Cluster Ready Services-managed resources on server 'dbcs1'
CRS-2673: Attempting to stop 'ora.chad' on 'dbcs1'
CRS-2673: Attempting to stop 'ora.data.commonstore.acfs' on 'dbcs1'
CRS-2673: Attempting to stop 'ora.qosmserver' on 'dbcs1'
CRS-2673: Attempting to stop 'ora.op01_nrt1js.db' on 'dbcs1'
CRS-2677: Stop of 'ora.data.commonstore.acfs' on 'dbcs1' succeeded
CRS-2673: Attempting to stop 'ora.DATA.COMMONSTORE.advm' on 'dbcs1'
CRS-2677: Stop of 'ora.DATA.COMMONSTORE.advm' on 'dbcs1' succeeded
CRS-2673: Attempting to stop 'ora.proxy_advm' on 'dbcs1'
CRS-2677: Stop of 'ora.op01_nrt1js.db' on 'dbcs1' succeeded
CRS-2673: Attempting to stop 'ora.LISTENER.lsnr' on 'dbcs1'
CRS-2673: Attempting to stop 'ora.LISTENER_SCAN1.lsnr' on 'dbcs1'
CRS-2673: Attempting to stop 'ora.LISTENER_SCAN2.lsnr' on 'dbcs1'
CRS-2673: Attempting to stop 'ora.LISTENER_SCAN3.lsnr' on 'dbcs1'
CRS-2673: Attempting to stop 'ora.cvu' on 'dbcs1'
CRS-2673: Attempting to stop 'ora.dbcs1.vip' on 'dbcs1'
CRS-2677: Stop of 'ora.dbcs1.vip' on 'dbcs1' succeeded
CRS-2677: Stop of 'ora.cvu' on 'dbcs1' succeeded
CRS-2677: Stop of 'ora.LISTENER.lsnr' on 'dbcs1' succeeded
CRS-2673: Attempting to stop 'ora.dbcs2.vip' on 'dbcs1'
CRS-2677: Stop of 'ora.LISTENER_SCAN3.lsnr' on 'dbcs1' succeeded
CRS-2673: Attempting to stop 'ora.scan3.vip' on 'dbcs1'
CRS-2677: Stop of 'ora.LISTENER_SCAN1.lsnr' on 'dbcs1' succeeded
CRS-2673: Attempting to stop 'ora.scan1.vip' on 'dbcs1'
CRS-2677: Stop of 'ora.LISTENER_SCAN2.lsnr' on 'dbcs1' succeeded
CRS-2673: Attempting to stop 'ora.scan2.vip' on 'dbcs1'
CRS-2677: Stop of 'ora.dbcs2.vip' on 'dbcs1' succeeded
CRS-2677: Stop of 'ora.scan3.vip' on 'dbcs1' succeeded
CRS-2677: Stop of 'ora.scan2.vip' on 'dbcs1' succeeded
CRS-2677: Stop of 'ora.scan1.vip' on 'dbcs1' succeeded
CRS-2677: Stop of 'ora.qosmserver' on 'dbcs1' succeeded
CRS-2677: Stop of 'ora.chad' on 'dbcs1' succeeded
CRS-2677: Stop of 'ora.proxy_advm' on 'dbcs1' succeeded
CRS-33673: Attempting to stop resource group 'ora.asmgroup' on server 'dbcs1'
CRS-2673: Attempting to stop 'ora.RECO.dg' on 'dbcs1'
CRS-2673: Attempting to stop 'ora.DATA.dg' on 'dbcs1'
CRS-2677: Stop of 'ora.RECO.dg' on 'dbcs1' succeeded
CRS-2677: Stop of 'ora.DATA.dg' on 'dbcs1' succeeded
CRS-2673: Attempting to stop 'ora.asm' on 'dbcs1'
CRS-2677: Stop of 'ora.asm' on 'dbcs1' succeeded
CRS-2673: Attempting to stop 'ora.ASMNET1LSNR_ASM.lsnr' on 'dbcs1'
CRS-2677: Stop of 'ora.ASMNET1LSNR_ASM.lsnr' on 'dbcs1' succeeded
CRS-2673: Attempting to stop 'ora.asmnet1.asmnetwork' on 'dbcs1'
CRS-2677: Stop of 'ora.asmnet1.asmnetwork' on 'dbcs1' succeeded
CRS-33677: Stop of resource group 'ora.asmgroup' on server 'dbcs1' succeeded.
CRS-2673: Attempting to stop 'ora.ons' on 'dbcs1'
CRS-2677: Stop of 'ora.ons' on 'dbcs1' succeeded
CRS-2673: Attempting to stop 'ora.net1.network' on 'dbcs1'
CRS-2677: Stop of 'ora.net1.network' on 'dbcs1' succeeded
CRS-2792: Shutdown of Cluster Ready Services-managed resources on 'dbcs1' has completed
CRS-2677: Stop of 'ora.crsd' on 'dbcs1' succeeded
CRS-2673: Attempting to stop 'ora.asm' on 'dbcs1'
CRS-2673: Attempting to stop 'ora.crf' on 'dbcs1'
CRS-2673: Attempting to stop 'ora.drivers.acfs' on 'dbcs1'
CRS-2673: Attempting to stop 'ora.mdnsd' on 'dbcs1'
CRS-2677: Stop of 'ora.crf' on 'dbcs1' succeeded
CRS-2677: Stop of 'ora.drivers.acfs' on 'dbcs1' succeeded
CRS-2677: Stop of 'ora.mdnsd' on 'dbcs1' succeeded
CRS-2677: Stop of 'ora.asm' on 'dbcs1' succeeded
CRS-2673: Attempting to stop 'ora.ctssd' on 'dbcs1'
CRS-2673: Attempting to stop 'ora.evmd' on 'dbcs1'
CRS-2677: Stop of 'ora.ctssd' on 'dbcs1' succeeded
CRS-2677: Stop of 'ora.evmd' on 'dbcs1' succeeded
CRS-2673: Attempting to stop 'ora.cssd' on 'dbcs1'
CRS-2677: Stop of 'ora.cssd' on 'dbcs1' succeeded
CRS-2673: Attempting to stop 'ora.gipcd' on 'dbcs1'
CRS-2673: Attempting to stop 'ora.gpnpd' on 'dbcs1'
CRS-2677: Stop of 'ora.gipcd' on 'dbcs1' succeeded
CRS-2677: Stop of 'ora.gpnpd' on 'dbcs1' succeeded
CRS-2793: Shutdown of Oracle High Availability Services-managed resources on 'dbcs1' has completed
CRS-4133: Oracle High Availability Services has been stopped.
```
❐DBCS DB #1❐すべてのサービスを起動します。

```
[root@dbcs1 opc]# /u01/app/19.0.0.0/grid/bin/crsctl start crs
CRS-4123: Oracle High Availability Services has been started.

[root@dbcs1 opc]# su - grid
Last login: Thu Nov 11 07:41:56 UTC 2021
[grid@dbcs1 ~]$ crsctl stat res -t
--------------------------------------------------------------------------------
Name           Target  State        Server                   State details
--------------------------------------------------------------------------------
Local Resources
--------------------------------------------------------------------------------
ora.DATA.COMMONSTORE.advm
               ONLINE  ONLINE       dbcs1                    STABLE
               ONLINE  ONLINE       dbcs2                    STABLE
ora.LISTENER.lsnr
               ONLINE  ONLINE       dbcs1                    STABLE
               ONLINE  ONLINE       dbcs2                    STABLE
ora.chad
               ONLINE  ONLINE       dbcs1                    STABLE
               ONLINE  ONLINE       dbcs2                    STABLE
ora.data.commonstore.acfs
               ONLINE  ONLINE       dbcs1                    mounted on /opt/oracle/dcs/commonstore,STABLE
               ONLINE  ONLINE       dbcs2                    mounted on /opt/oracle/dcs/commonstore,STABLE
ora.net1.network
               ONLINE  ONLINE       dbcs1                    STABLE
               ONLINE  ONLINE       dbcs2                    STABLE
ora.ons
               ONLINE  ONLINE       dbcs1                    STABLE
               ONLINE  ONLINE       dbcs2                    STABLE
ora.proxy_advm
               ONLINE  ONLINE       dbcs1                    STABLE
               ONLINE  ONLINE       dbcs2                    STABLE
--------------------------------------------------------------------------------
Cluster Resources
--------------------------------------------------------------------------------
ora.ASMNET1LSNR_ASM.lsnr(ora.asmgroup)
      1        ONLINE  ONLINE       dbcs1                    STABLE
      2        ONLINE  ONLINE       dbcs2                    STABLE
ora.DATA.dg(ora.asmgroup)
      1        ONLINE  ONLINE       dbcs1                    STABLE
      2        ONLINE  ONLINE       dbcs2                    STABLE
ora.LISTENER_SCAN1.lsnr
      1        ONLINE  ONLINE       dbcs1                    STABLE
ora.LISTENER_SCAN2.lsnr
      1        ONLINE  ONLINE       dbcs2                    STABLE
ora.LISTENER_SCAN3.lsnr
      1        ONLINE  ONLINE       dbcs2                    STABLE
ora.RECO.dg(ora.asmgroup)
      1        ONLINE  ONLINE       dbcs1                    STABLE
      2        ONLINE  ONLINE       dbcs2                    STABLE
ora.asm(ora.asmgroup)
      1        ONLINE  ONLINE       dbcs1                    Started,STABLE
      2        ONLINE  ONLINE       dbcs2                    Started,STABLE
ora.asmnet1.asmnetwork(ora.asmgroup)
      1        ONLINE  ONLINE       dbcs1                    STABLE
      2        ONLINE  ONLINE       dbcs2                    STABLE
ora.cvu
      1        ONLINE  ONLINE       dbcs2                    STABLE
ora.dbcs1.vip
      1        ONLINE  ONLINE       dbcs1                    STABLE
ora.dbcs2.vip
      1        ONLINE  ONLINE       dbcs2                    STABLE
ora.op01_nrt1js.db
      1        ONLINE  ONLINE       dbcs1                    Open,HOME=/u01/app/oracle/product/11.2.0.4/dbhome_1,STABLE　★ノード＃１のDB起動済み
      2        ONLINE  ONLINE       dbcs2                    Open,HOME=/u01/app/oracle/product/11.2.0.4/dbhome_1,STABLE　★ノード＃2のDB起動済み
ora.qosmserver
      1        ONLINE  ONLINE       dbcs2                    STABLE
ora.scan1.vip
      1        ONLINE  ONLINE       dbcs1                    STABLE
ora.scan2.vip
      1        ONLINE  ONLINE       dbcs2                    STABLE
ora.scan3.vip
      1        ONLINE  ONLINE       dbcs2                    STABLE
--------------------------------------------------------------------------------
```
これでOCIのDBCSへリストアやリカバリできて再起動後もサービスが問題なく提供されていることを確認できてます。