Oracle Cloud: Oracle Database Data Guard 複数スタンバイ構成してみてみた

Oracle Database Data Guard は複数のスタンバイ・データベースを設定することができます。
Oracle Data Guard Broker を使用すると単一の場所から複数データベースの構成と管理を行うことができ、ブローカ構成内のすべてのデータベースが自動的に統一されます。 複数のスタンバイ構成では REDO転送先を制御、スタンバイから別のスタンバイへカスケードREDO転送の制御することで、ローカルのフィジカル・スタンバイ・データベースが、リモートのフィジカル・スタンバイ・データベースにREDOを転送するようにリアルタイム・カスケードを構成することができます。
今回、Data Guard Broker を使用して Data Guard マルチ・スタンバイ・データベース構成を作成してみてみます。

# ■ 構成
![構成CascadeStandby.jpg](https://qiita-image-store.s3.ap-northeast-1.amazonaws.com/0/109087/a39a845f-d3b3-1091-f398-fc10a0c2a7d1.jpeg)
各リージョンのRemote Peering 等の Network構成は事前に作成しておきます。
・参考: [DRGで東京リージョンを経由して、オンプレミスと 大阪リージョンを接続](https://qiita.com/shirok/items/90cff318816fbf2a802d)



# ■ 手順1:クラウド・データベースを作成
## ● クラウド・コンソールを使用してデータベースを作成
クラウド・コンソールを使用し、前の手順でダウンロードしたバージョンを選択して正しいバンドル・パッチでデータベースを作成します。
スタンバイのデータベース名(db_name)はプライマリ・データベースと同じにする必要があります。 ただし、db_unique_name は別にする必要あります。
前回 [Exadata Cloud で作成](https://qiita.com/shirok/items/09c67ee4945df8df9792)したので、今回は 次を参考に Database Cloud Service で Real Application Clusters（RAC）を4つ作成します。

　・参考: [Oracle Cloud: Real Application Clusters（RAC）作成](https://qiita.com/shirok/items/ff7bb98a3b771edd1b5f)

### ・TOKYOリージョン DB作成
- DB#1: DB_NAME=CDB, DB_UNIQUE_NAME=CDB_TOKYOを作成
![CDB_TOKYO.jpg](https://qiita-image-store.s3.ap-northeast-1.amazonaws.com/0/109087/88bddd5d-f7ef-21c3-0e10-c592659c21b9.jpeg)



- DB#2: DB_NAME=CDB, DB_UNIQUE_NAME=CDB_SHIBUYAを作成
![CDB_SHIBUYA.jpg](https://qiita-image-store.s3.ap-northeast-1.amazonaws.com/0/109087/2d06fd0e-5622-8a04-47bb-c630e1c54aa0.jpeg)


### ・Osakaリージョン DB作成
- DB#3: DB_NAME=CDB, DB_UNIQUE_NAME=CDB_OSAKAを作成
![DB_OSAKA.jpg](https://qiita-image-store.s3.ap-northeast-1.amazonaws.com/0/109087/b25baa9c-0d17-ab04-1218-8de1e6aa2c0c.jpeg)


- DB#4: DB_NAME=CDB, DB_UNIQUE_NAME=CDB_NAMBAを作成
![DB_NAMBA.jpg](https://qiita-image-store.s3.ap-northeast-1.amazonaws.com/0/109087/3c088c7a-e137-f761-6492-7cd552cfc8dd.jpeg)





# ■ 作業環境効率化設定

## ● sglogin.sqlファイル設定
sqlpromptの表示をプライマリDBとスタンバイDBを間違えない様 事前定義変数を使用して接続識別子(TNS接続名)を表示するように glogin.sqlファイルに設定しときます。
・参考: [SQL*Plus®ユーザーズ・ガイドおよびリファレンス: 12.17.1 事前定義変数](https://docs.oracle.com/cd/F19136_01/sqpug/DEFINE.html#GUID-D6727C11-E4D9-4AB5-A7B8-9C6527A44A50)

```:全Node
$ vi $ORACLE_HOME/sqlplus/admin/glogin.sql
$ cat $ORACLE_HOME/sqlplus/admin/glogin.sql
	set sqlprompt '&_USER@&_connect_identifier SQL> '
	set pages 1000 
```

**・確認例**

```
[oracle@db-tokyo1 admin]$ sqlplus system/<Password>@CDB_TOKYO1

	SQL*Plus: Release 19.0.0.0.0 - Production on Wed Oct 19 12:30:13 2022
	Version 19.16.0.0.0

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

	Last Successful login time: Fri Oct 07 2022 09:23:35 +00:00

	Connected to:
	Oracle Database 19c EE Extreme Perf Release 19.0.0.0.0 - Production
	Version 19.16.0.0.0

SYSTEM@CDB_TOKYO1 SQL>
SYSTEM@CDB_TOKYO1 SQL> define
	DEFINE _DATE	       = "19-OCT-22" (CHAR)
	DEFINE _CONNECT_IDENTIFIER = "CDB_TOKYO1" (CHAR)
	DEFINE _USER	       = "SYSTEM" (CHAR)
	DEFINE _PRIVILEGE      = "" (CHAR)
	DEFINE _SQLPLUS_RELEASE = "1916000000" (CHAR)
	DEFINE _EDITOR	       = "vi" (CHAR)
	DEFINE _O_VERSION      = "Oracle Database 19c EE Extreme Perf Release 19.0.0.0.0 - Production
	Version 19.16.0.0.0" (CHAR)
	DEFINE _O_RELEASE      = "1916000000" (CHAR)
```

## ● .bashrcファイル設定
よく使うコマンド構文を alias にしときます。
```:設定例
[oracle@db-tokyo1 ~]$ cat .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/19.0.0.0/dbhome_1; export ORACLE_HOME
	PATH=$PATH:/u01/app/oracle/product/19.0.0.0/dbhome_1/bin; export PATH
	LD_LIBRARY_PATH=/u01/app/oracle/product/19.0.0.0/dbhome_1/lib; export LD_LIBRARY_PATH
	ORACLE_UNQNAME=CDB_TOKYO;export ORACLE_UNQNAME
	ORACLE_SID=CDB1; export ORACLE_SID
	## WARNING!! Modifying this file can cause failures in API/CLI provided by Cloud Tooling!!

	export ORACLE_BASE=/u01/app/oracle
	alias cdn='cd $ORACLE_HOME/network/admin'
	alias cdo='cd $ORACLE_HOME'
	alias cdb='cd $ORACLE_BASE'
	alias sys='sqlplus sys/<Password>@CDB_TOKYO as sysdba'
	alias aldb='tail -f $ORACLE_BASE/diag/rdbms/${ORACLE_UNQNAME,,}/$ORACLE_SID/trace/alert_$ORACLE_SID.log'
	alias sysdgm='dgmgrl sys/<Password>@CDB_TOKYO'
```


# ■ Primaryサイト前提条件確認

## ● 名前解決を設定
OCIとの間のSSHおよびOracle Netアクセスできるように設定
/etc/hosts ファイルまたは、Private DNSで設定します。

Remote Piiringは次を参考にしてPrimaryとStandbyサイト間通信できるようにしておきます
・参考: [リージョン間を Remote VCN Peering接続](https://qiita.com/shirok/items/192674aa6e903ea6694a)

### 1)  Private DNS設定
[Private DNSで PeeringしたVCNどうしホスト名解決する](https://qiita.com/shirok/items/4197e09dc2bfd7db82f3)

・参考
	OCI Document:プライベートDNS: https://docs.oracle.com/ja-jp/iaas/Content/DNS/Tasks/privatedns.htm
	チュートリアル: Private DNS Implementation: https://www.ateam-oracle.com/post/private-dns-implementation


### 2) DNS名前解決確認

**・Tokyo -> Osaka確認**

```:全ての Nodeで実行
・db-tokyo-scan 確認
$ nslookup db-tokyo-scan.clientsubnet.vcnexatokyo.oraclevcn.com
	Server:		169.254.169.254
	Address:	169.254.169.254#53

	Non-authoritative answer:
	Name:	db-tokyo-scan.clientsubnet.vcnexatokyo.oraclevcn.com
	Address: 10.10.1.8
	Name:	db-tokyo-scan.clientsubnet.vcnexatokyo.oraclevcn.com
	Address: 10.10.1.11
	Name:	db-tokyo-scan.clientsubnet.vcnexatokyo.oraclevcn.com
	Address: 10.10.1.5

・db-shibuya-scan 確認
$ nslookup db-shibuya-scan.clientsubnet.vcnexatokyo.oraclevcn.com
	Server:		169.254.169.254
	Address:	169.254.169.254#53

	Non-authoritative answer:
	Name:	db-shibuya-scan.clientsubnet.vcnexatokyo.oraclevcn.com
	Address: 10.10.1.2
	Name:	db-shibuya-scan.clientsubnet.vcnexatokyo.oraclevcn.com
	Address: 10.10.1.14
	Name:	db-shibuya-scan.clientsubnet.vcnexatokyo.oraclevcn.com
	Address: 10.10.1.18

・db-osaka-scan 確認
$ nslookup db-osaka-scan.clientsubnet.vcnexaosaka.oraclevcn.com
	Server:		169.254.169.254
	Address:	169.254.169.254#53

	Non-authoritative answer:
	Name:	db-osaka-scan.clientsubnet.vcnexaosaka.oraclevcn.com
	Address: 10.20.1.30
	Name:	db-osaka-scan.clientsubnet.vcnexaosaka.oraclevcn.com
	Address: 10.20.1.8
	Name:	db-osaka-scan.clientsubnet.vcnexaosaka.oraclevcn.com
	Address: 10.20.1.25

・db-namba-scan 確認
$ nslookup db-namba-scan.clientsubnet.vcnexaosaka.oraclevcn.com
	Server:		169.254.169.254
	Address:	169.254.169.254#53

	Non-authoritative answer:
	Name:	db-namba-scan.clientsubnet.vcnexaosaka.oraclevcn.com
	Address: 10.20.1.19
	Name:	db-namba-scan.clientsubnet.vcnexaosaka.oraclevcn.com
	Address: 10.20.1.5
	Name:	db-namba-scan.clientsubnet.vcnexaosaka.oraclevcn.com
	Address: 10.20.1.11
```


## ● バンドル・パッチ(BP)確認
RDBMSソフトウェアは、インスタンス化のためにプライマリとスタンバイで同じものを使用する必要があります。
現在のオンプ レミスOracle DatabaseバージョンをExadata Cloudで使用できない場合は、プライマリ・データベースにパッチを適用するか、 または使用可能なクラウド・バンドル・パッチにアップグレードする必要があります。
クラウドで使用可能なバンドル・パッチ の一覧は、以下のコマンドで表示できます。ソフトウェアのインストールについては、「デプロイメント・プロセス」セクショ ンで説明しています。

### 1) BP確認
・全ての Nodeで BP が同一であることを確認

```shell:rootユーザーで全ての Nodeで実行
# dbcli describe-component

	System Version
	---------------
	22.3.2.1.0

	Component                                Installed Version    Available Version
	---------------------------------------- -------------------- --------------------
	GI                                        19.16.0.0.0           up-to-date
	DB                                        19.16.0.0.0           up-to-date

# dbcli describe-system

	DbSystem Information
	----------------------------------------------------------------
						ID: 975b3541-583f-4553-a704-f76a347200d7
				Platform: Vmdb
			Data Disk Count: 8
			CPU Core Count: 4
					Created: October 5, 2022 12:14:29 PM UTC

	System Information
	----------------------------------------------------------------
					Name: qoeoei7a
				Domain Name: clientsubnet.vcnexatokyo.oraclevcn.com
				Time Zone: UTC
				DB Edition: EeXp
				DNS Servers:
				NTP Servers: 169.254.169.254

	Disk Group Information
	----------------------------------------------------------------
	DG Name                   Redundancy                Percentage
	------------------------- ------------------------- ------------
	Data                      External                  100
	Reco                      External                  100
```

## ● 個別パッチとマージ・パッチ確認
個別パッチとマージ・パッチもプライマリとスタンバイのデータベース間で一致している必要があります。
適用された個別パッチ を以下のコマンドで検索し、パッチのドキュメントに従ってすべてのプライマリ・データーベースに適用されている個別パッチをスタンバイ・データーベースの全サーバーに適用します。

### 1) 確認
・全ての NodeでDBパッチが同一であることを確認


```shell:oracleユーザーで全ての Nodeで実行
$ $ORACLE_HOME/OPatch/opatch lspatches
	33303486;UNPLUG/PLUG A PLUGGABLE DATABASE MOVE DO A COPY AND NEED DOUBLE SPACE IN ASM.
	29780459;INCREASE _LM_RES_HASH_BUCKET AND BACK OUT CHANGES FROM THE BUG 29416368 FIX
	34006650;DSTV38 UPDATE - TZDATA2022A - NEED OJVM FIX
	34006614;RDBMS - DSTV38 UPDATE - TZDATA2022A
	33613829;RDBMS - DSTV37 UPDATE - TZDATA2021E
	34113634;JDK BUNDLE PATCH 19.0.0.0.220719
	32327201;RDBMS - DSTV36 UPDATE - TZDATA2020E
	31335037;RDBMS - DSTV35 UPDATE - TZDATA2020A
	30432118;MERGE REQUEST ON TOP OF 19.0.0.0.0 FOR BUGS 28852325 29997937
	33912872;DATABASE PERL UPDATE IN 19C TO V5.32-1 (CVE-2022-23990 - LIBEXPAT UPDATE)
	34086870;OJVM RELEASE UPDATE: 19.16.0.0.220719 (34086870)
	34160635;OCW RELEASE UPDATE 19.16.0.0.0 (34160635)
	34133642;Database Release Update : 19.16.0.0.220719 (34133642)
```


## ● Data Guard Broker構成確認
データベースがまだ既存のData Guard Broker構成の一部 になっていないことを前提としています。

```shell:全ての Databaseで実行
SQL> sqlplus / as sysdba
SQL> select decode(count(*),0,'NOCONFIG') from v$DG_BROKER_CONFIG;

	DECODE(C
	--------
	NOCONFIG
```

## ● Primary Database Listener のリスナー・ポート検証
次のコマンドを実行して、Primary Database Listener のリスナー・ポートを検証します。
このポートは、 REDO転送の構成時に必要となり、デプロイメント・プロセス時にtns記述子に入力されます。

```shell:全ての Nodeで実行
$ lsnrctl stat| grep 'Connecting to'
	Connecting to (ADDRESS=(PROTOCOL=tcp)(HOST=)(PORT=1521))
```


## ● プライマリ・データベースでMAAベスト・プラクティスのパラメータ設定を実装する
プライマリ・データベースでMAAベスト・プラクティスのパラメータ設定を実装する
ベスト・プラクティスのリストについては、[ドキュメントの付録A](https://www.oracle.com/jp/a/tech/docs/hybrid-data-guard-to-exaoci-update-gen2-exacc-exacs-ja.pdf) を参照してください。このドキュメントで説明するプロセスでは、
インスタンス 化前にプライマリ・データベースが構成されていることを前提としています。
インスタンス化前にREDOログを構成することは特に重要です。


## ● STANDBY_FILE_MANAGEMENT 設定
STANDBY_FILE_MANAGEMENT を AUTO に設定すると、データファイル作成等すると スタンバイ・データベース上にファイルが自動的に作成されます。
場合によっては既存のファイルが上書きされます。STANDBY_FILE_MANAGEMENT と DB_FILE_NAME_CONVERT を設定する場合は、既存のスタンバイ・ファイルが意図せずに上書きされないように注意してください。
スタンバイ・データベースがプライマリ・データベースと同じシステム上にある場合は、プライマリ・システムとスタンバイ・システムが同じファイルを指していないことを確認してください。

・参考: [データベース・リファレンス](https://docs.oracle.com/cd/F19136_01/refrn/STANDBY_FILE_MANAGEMENT.html#GUID-BD652D33-31C7-47C9-8019-7A4B79A9D974)

```:SQL
SQL> ALTER SYSTEM SET standby_file_management=AUTO SCOPE=BOTH;
	System altered.
```

## ● 全Nodeとの間の接続の検証
すべてのネットワーク接続手順を正常に実施し終えたら、以下のコマンドを実行して、全ソースから全ターゲットへ、および全ターゲットから全ソースへの接続に問題がないことを確認します。

**1) SQL接続確認スクリプト作成**
以下のようなshellスクリプトを作成して、全Nodeで実行して全Nodeで接続できることを確認

```shell:oracleユーザーで全ての Nodeで実行
[oracle@db-tokyo2 ~]$ cat sqlplus_connect.txt
	#!/bin/bash

	echo '### CDB_TOKYO ###'
	sqlplus -s system/<Password>@CDB_TOKYO <<EOF
	select DB_UNIQUE_NAME, database_role, open_mode from v\$database;
	exit
	EOF
	echo ''
	echo ''
	echo '### CDB_SHIBUYA ###'
	sqlplus -s system/<Password>@CDB_SHIBUYA <<EOF
	select DB_UNIQUE_NAME, database_role, open_mode from v\$database;
	exit
	EOF
	echo ''
	echo ''
	echo '### CDB_OSAKA ###'
	sqlplus -s system/<Password>@CDB_OSAKA <<EOF
	select DB_UNIQUE_NAME, database_role, open_mode from v\$database;
	exit
	EOF
	echo ''
	echo ''
	echo '### CDB_NAMBA ###'
	sqlplus -s system/<Password>@CDB_NAMBA <<EOF
	select DB_UNIQUE_NAME, database_role, open_mode from v\$database;
	exit
	EOF

	exit
```

**2) 実行結果**
```shell:oracleユーザーで全ての Nodeで実行
$ bash sqlplus_connect.txt
	### CDB_TOKYO ###

	DB_UNIQUE_NAME		       DATABASE_ROLE	OPEN_MODE
	------------------------------ ---------------- --------------------
	CDB_TOKYO		       PRIMARY		READ WRITE



	### CDB_SHIBUYA ###

	DB_UNIQUE_NAME		       DATABASE_ROLE	OPEN_MODE
	------------------------------ ---------------- --------------------
	CDB_SHIBUYA		        PRIMARY		READ WRITE



	### CDB_OSAKA ###

	DB_UNIQUE_NAME		       DATABASE_ROLE	OPEN_MODE
	------------------------------ ---------------- --------------------
	CDB_OSAKA		       PRIMARY		READ WRITE



	### CDB_NAMBA ###

	DB_UNIQUE_NAME		       DATABASE_ROLE	OPEN_MODE
	------------------------------ ---------------- --------------------
	CDB_NAMBA		       PRIMARY		READ WRITE
```

## ● クラウド・ツール更新
dbaastools バージョン18.2.3.2.0_190618以上が必要です。最新のdbaastools rpmに更新することが常に推奨されています。

### 1) dbaascli Version Up
最新のdbaastoolsを適用します。 
・参考: [クラウド・ツール dbaascliをバージョンアップ](https://qiita.com/shirok/items/9c5f4176b86536ff221e)


### 2) dbaascli Version Up確認

```shell:rootユーザーで全ての Nodeで実行
# cliadm update-dbcli

	Job details
	----------------------------------------------------------------
						ID:  2d96a474-adfe-4be9-895e-5cfd9e0b99b1
				Description:  DcsCli patching
					Status:  Created
					Created:  October 5, 2022 3:30:31 PM UTC
					Message:  Dcs cli will be updated

	Task Name                                                                Start Time                          End Time                            Status
	------------------------------------------------------------------------ ----------------------------------- ----------------------------------- ----------
```





# ■ 手順2:APIで作成されたデータベースを手動で削除
## ● データベース・ファイル削除スクリプト作成
スクリプトを作成して、すべてのデータベース・ファイルを削除

**1) スクリプト内容**
```sql:oracleユーザーで全ての RAC Nodeで実行
SQL> set heading off linesize 999 pagesize 0 feedback off trimspool on 
SQL> spool /tmp/delete_ASM_files.sh
SQL> select 'asmcmd rm '||name from v$datafile
  union all
  select 'asmcmd rm '||name from v$tempfile
  union all
  select 'asmcmd rm '||member from v$logfile;
SQL> spool off
SQL> create pfile='/tmp/<standby DB_UNIQUE_NAME>.pfile' from spfile; #Backup of spfile 
SQL> host chmod 777 /tmp/delete_ASM_files.sh
```


**2) スクリプト実行例**
```:oracleユーザーで Primary Database以外のDataseで実行
SYS@CDB_SHIBUYA1 SQL> set heading off linesize 999 pagesize 0 feedback off trimspool on
	spool /tmp/delete_ASM_files.sh
	select 'asmcmd rm '||name from v$datafile
	union all
	select 'asmcmd rm '||name from v$tempfile
	union all
	select 'asmcmd rm '||member from v$logfile;
	spool offSYS@CDB_SHIBUYA1 

SYS@CDB_SHIBUYA1 SQL> asmcmd rm +DATA/CDB_SHIBUYA/DATAFILE/system.260.1117289947
	asmcmd rm +DATA/CDB_SHIBUYA/DATAFILE/sysaux.261.1117289981
	asmcmd rm +DATA/CDB_SHIBUYA/DATAFILE/undotbs1.262.1117289997
	asmcmd rm +DATA/CDB_SHIBUYA/E40FB8A9B379029EE0539306640AE31B/DATAFILE/system.264.1117290071
	asmcmd rm +DATA/CDB_SHIBUYA/E40FB8A9B379029EE0539306640AE31B/DATAFILE/sysaux.265.1117290071
	asmcmd rm +DATA/CDB_SHIBUYA/E40FB8A9B379029EE0539306640AE31B/DATAFILE/undotbs1.266.1117290071
	asmcmd rm +DATA/CDB_SHIBUYA/DATAFILE/undotbs2.268.1117290293
	asmcmd rm +DATA/CDB_SHIBUYA/EA4B68674DC50714E0531A010A0A318A/DATAFILE/system.275.1117290611
	asmcmd rm +DATA/CDB_SHIBUYA/EA4B68674DC50714E0531A010A0A318A/DATAFILE/sysaux.271.1117290621
	asmcmd rm +DATA/CDB_SHIBUYA/EA4B68674DC50714E0531A010A0A318A/DATAFILE/undotbs1.277.1117290793
	asmcmd rm +DATA/CDB_SHIBUYA/EA4B68674DC50714E0531A010A0A318A/DATAFILE/undo_2.270.1117290795
	asmcmd rm +DATA/CDB_SHIBUYA/DATAFILE/users.272.1117290781
	asmcmd rm +DATA/CDB_SHIBUYA/EA4B68674DC50714E0531A010A0A318A/DATAFILE/users.276.1117290781
	asmcmd rm +DATA/CDB_SHIBUYA/TEMPFILE/temp.263.1117290059
	asmcmd rm +DATA/CDB_SHIBUYA/EA4B49BA826C5336E0531A010A0ADDB2/TEMPFILE/temp.267.1117290099
	asmcmd rm +DATA/CDB_SHIBUYA/EA4B68674DC50714E0531A010A0A318A/TEMPFILE/temp.273.1117290607
	asmcmd rm +RECO/CDB_SHIBUYA/ONLINELOG/group_2.257.1117290031
	asmcmd rm +RECO/CDB_SHIBUYA/ONLINELOG/group_1.258.1117290031
	asmcmd rm +RECO/CDB_SHIBUYA/ONLINELOG/group_3.259.1117290451
	asmcmd rm +RECO/CDB_SHIBUYA/ONLINELOG/group_4.260.1117290455
SYS@CDB_SHIBUYA1 SQL> create pfile='/tmp/standby.ora' from spfile;
SYS@CDB_SHIBUYA1 SQL> create pfile='/tmp/init.ora' from spfile;
SYS@CDB_SHIBUYA1 SQL> host ls -l /tmp/delete_ASM_files.sh
	-rwxrwxrwx 1 oracle oinstall 1748 Oct  6 03:50 /tmp/delete_ASM_files.sh
```


## ● インスタンス化後に再適用するRMAN設定保存

**1) スクリプト内容**
```:コマンド
rman target / log='/tmp/rman_setting.log'
RMAN> show all;
RMAN> exit
```

**2) 実行例**

```:oracleユーザーで Primary Database以外のDataseで実行
[oracle@db-shibuya1 ~]$ rman target / log='/tmp/rman_setting.log'
RMAN> show all;
RMAN> exit
[oracle@db-shibuya1 ~]$ cat /tmp/rman_setting.log

	Recovery Manager: Release 19.0.0.0.0 - Production on Thu Oct 6 03:56:35 2022
	Version 19.16.0.0.0

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

	connected to target database: CDB (DBID=2233893548)

	RMAN>
	using target database control file instead of recovery catalog
	RMAN configuration parameters for database with db_unique_name CDB_SHIBUYA are:
	CONFIGURE RETENTION POLICY TO REDUNDANCY 1; # default
	CONFIGURE BACKUP OPTIMIZATION OFF; # default
	CONFIGURE DEFAULT DEVICE TYPE TO DISK; # default
	CONFIGURE CONTROLFILE AUTOBACKUP ON; # default
	CONFIGURE CONTROLFILE AUTOBACKUP FORMAT FOR DEVICE TYPE DISK TO '%F'; # default
	CONFIGURE DEVICE TYPE DISK PARALLELISM 1 BACKUP TYPE TO BACKUPSET; # default
	CONFIGURE DATAFILE BACKUP COPIES FOR DEVICE TYPE DISK TO 1; # default
	CONFIGURE ARCHIVELOG BACKUP COPIES FOR DEVICE TYPE DISK TO 1; # default
	CONFIGURE MAXSETSIZE TO UNLIMITED; # default
	CONFIGURE ENCRYPTION FOR DATABASE OFF; # default
	CONFIGURE ENCRYPTION ALGORITHM 'AES128'; # default
	CONFIGURE COMPRESSION ALGORITHM 'BASIC' AS OF RELEASE 'DEFAULT' OPTIMIZE FOR LOAD TRUE ; # default
	CONFIGURE RMAN OUTPUT TO KEEP FOR 7 DAYS; # default
	CONFIGURE ARCHIVELOG DELETION POLICY TO NONE; # default
	CONFIGURE SNAPSHOT CONTROLFILE NAME TO '+RECO/CDB_SHIBUYA/controlfile/snapcf_cdb_shibuya.f';

	RMAN>

	Recovery Manager complete.
```


## ● データベースをシャットダウン
後で参照できるよう、データベースのクラスタウェア構成を収集します。

1) 実行コマンド
```:oracleユーザーで 全てのDataseで実行
$ srvctl config database -d <db_unique_name> > /tmp/<standby db_unique_name>.config
```



2) 実行例**

```:oracleユーザーで 全てのDataseで実行
・db-tokyo1 の Databaseノード で実行 で実行
[oracle@db-tokyo1 ~]$ srvctl config database -d CDB_TOKYO
	Database unique name: CDB_TOKYO
	Database name: CDB
	Oracle home: /u01/app/oracle/product/19.0.0.0/dbhome_1
	Oracle user: oracle
	Spfile: +DATA/CDB_TOKYO/PARAMETERFILE/spfile.269.1117285011
	Password file: +DATA/CDB_TOKYO/PASSWORD/pwdcdb_tokyo.259.1117284483
	Domain: clientsubnet.vcnexatokyo.oraclevcn.com
	Start options: open
	Stop options: immediate
	Database role: PRIMARY
	Management policy: AUTOMATIC
	Server pools:
	Disk Groups: RECO,DATA
	Mount point paths: /opt/oracle/dcs/commonstore
	Services:
	Type: RAC
	Start concurrency:
	Stop concurrency:
	OSDBA group: dba
	OSOPER group: dbaoper
	Database instances: CDB1,CDB2
	Configured nodes: db-tokyo1,db-tokyo2
	CSS critical: no
	CPU count: 0
	Memory target: 0
	Maximum memory: 0
	Default network number for database services:
	Database is administrator managed

・db-shibuya の Databaseノード で実行
[oracle@db-shibuya1 ~]$ srvctl config database -d CDB_SHIBUYA
	Database unique name: CDB_SHIBUYA
	Database name: CDB
	Oracle home: /u01/app/oracle/product/19.0.0.0/dbhome_1
	Oracle user: oracle
	Spfile: +DATA/CDB_SHIBUYA/PARAMETERFILE/spfile.269.1117290463
	Password file: +DATA/CDB_SHIBUYA/PASSWORD/pwdcdb_shibuya.259.1117289933
	Domain: clientsubnet.vcnexatokyo.oraclevcn.com
	Start options: open
	Stop options: immediate
	Database role: PRIMARY
	Management policy: AUTOMATIC
	Server pools:
	Disk Groups: RECO,DATA
	Mount point paths: /opt/oracle/dcs/commonstore
	Services:
	Type: RAC
	Start concurrency:
	Stop concurrency:
	OSDBA group: dba
	OSOPER group: dbaoper
	Database instances: CDB1,CDB2
	Configured nodes: db-shibuya1,db-shibuya2
	CSS critical: no
	CPU count: 0
	Memory target: 0
	Maximum memory: 0
	Default network number for database services:
	Database is administrator managed


・db-osaka の Databaseノード で実行
[oracle@db-osaka1 ~]$ srvctl config database -d CDB_OSAKA
	Database unique name: CDB_OSAKA
	Database name: CDB
	Oracle home: /u01/app/oracle/product/19.0.0.0/dbhome_1
	Oracle user: oracle
	Spfile: +DATA/CDB_OSAKA/PARAMETERFILE/spfile.269.1117381771
	Password file: +DATA/CDB_OSAKA/PASSWORD/pwdcdb_osaka.259.1117381133
	Domain: clientsubnet.vcnexaosaka.oraclevcn.com
	Start options: open
	Stop options: immediate
	Database role: PRIMARY
	Management policy: AUTOMATIC
	Server pools:
	Disk Groups: RECO,DATA
	Mount point paths: /opt/oracle/dcs/commonstore
	Services:
	Type: RAC
	Start concurrency:
	Stop concurrency:
	OSDBA group: dba
	OSOPER group: dbaoper
	Database instances: CDB1,CDB2
	Configured nodes: db-osaka1,db-osaka2
	CSS critical: no
	CPU count: 0
	Memory target: 0
	Maximum memory: 0
	Default network number for database services:
	Database is administrator managed

 ・db-nambaの Databaseノード で実行
[oracle@db-namba1 ~]$ srvctl config database -d CDB_NAMBA
	Database unique name: CDB_NAMBA
	Database name: CDB
	Oracle home: /u01/app/oracle/product/19.0.0.0/dbhome_1
	Oracle user: oracle
	Spfile: +DATA/CDB_NAMBA/PARAMETERFILE/spfile.269.1117285423
	Password file: +DATA/CDB_NAMBA/PASSWORD/pwdcdb_namba.259.1117284893
	Domain: clientsubnet.vcnexaosaka.oraclevcn.com
	Start options: open
	Stop options: immediate
	Database role: PRIMARY
	Management policy: AUTOMATIC
	Server pools:
	Disk Groups: RECO,DATA
	Mount point paths: /opt/oracle/dcs/commonstore
	Services:
	Type: RAC
	Start concurrency:
	Stop concurrency:
	OSDBA group: dba
	OSOPER group: dbaoper
	Database instances: CDB1,CDB2
	Configured nodes: db-namba1,db-namba2
	CSS critical: no
	CPU count: 0
	Memory target: 0
	Maximum memory: 0
	Default network number for database services:
	Database is administrator managed
```



## ● 最後に、データベースを停止

```:コマンド
$ srvctl stop database -d <db_unique_name> -o immediate
```

・実行例
```:oracleユーザーで 全ての Standby Dataseで実行
・CDB_SHIBUYA Databaseノードで実行
[oracle@db-shibuya1 ~]$ srvctl stop database -d CDB_SHIBUYA -o immediate
[oracle@db-shibuya1 ~]$ srvctl status database -d CDB_SHIBUYA
	Instance CDB1 is not running on node db-shibuya1
	Instance CDB2 is not running on node db-shibuya2

・CDB_OSAKA Databaseノードで実行
[oracle@db-osaka1 ~]$ srvctl stop database -d CDB_OSAKA -o immediate
[oracle@db-osaka1 ~]$ srvctl status database -d CDB_OSAKA
	Instance CDB1 is not running on node db-osaka1
	Instance CDB2 is not running on node db-osaka2

・CDB_NAMABA Databaseノードで実行
[oracle@db-namba1 ~]$ srvctl stop database -d CDB_NAMBA -o immediate
[oracle@db-namba1 ~]$ srvctl status database -d CDB_NAMBA
	Instance CDB1 is not running on node db-namba1
	Instance CDB2 is not running on node db-namba2

```





## ● データベース・ファイルを削除
Standbyサイトの既存のデータファイル、ログ・ファイル、tempfileを削除します。パスワード・ファイルは置換され、spfileは再使用します。

1) データベース・ファイル削除スクリプト作成
gridユーザーとして、前に作成した/tmp/delete_ASM_files.sh を編集して、sqlplusからすべての不要な行を削除し、'asmcmd'で始まる行のみを残します。 

```:gridユーザーで 全ての Standby Dataseで実行
[grid@db-shibuya1 ~]$ vi /tmp/delete_ASM_files.sh
	<--すべての不要な行を削除し、'asmcmd'で始まる行のみを残します。

・CDB_SHIBUYA
[grid@db-shibuya1 ~]$ cat /tmp/delete_ASM_files.sh
	asmcmd rm +DATA/CDB_SHIBUYA/DATAFILE/system.260.1117289947
	asmcmd rm +DATA/CDB_SHIBUYA/DATAFILE/sysaux.261.1117289981
	asmcmd rm +DATA/CDB_SHIBUYA/DATAFILE/undotbs1.262.1117289997
	asmcmd rm +DATA/CDB_SHIBUYA/E40FB8A9B379029EE0539306640AE31B/DATAFILE/system.264.1117290071
	asmcmd rm +DATA/CDB_SHIBUYA/E40FB8A9B379029EE0539306640AE31B/DATAFILE/sysaux.265.1117290071
	asmcmd rm +DATA/CDB_SHIBUYA/E40FB8A9B379029EE0539306640AE31B/DATAFILE/undotbs1.266.1117290071
	asmcmd rm +DATA/CDB_SHIBUYA/DATAFILE/undotbs2.268.1117290293
	asmcmd rm +DATA/CDB_SHIBUYA/EA4B68674DC50714E0531A010A0A318A/DATAFILE/system.275.1117290611
	asmcmd rm +DATA/CDB_SHIBUYA/EA4B68674DC50714E0531A010A0A318A/DATAFILE/sysaux.271.1117290621
	asmcmd rm +DATA/CDB_SHIBUYA/EA4B68674DC50714E0531A010A0A318A/DATAFILE/undotbs1.277.1117290793
	asmcmd rm +DATA/CDB_SHIBUYA/EA4B68674DC50714E0531A010A0A318A/DATAFILE/undo_2.270.1117290795
	asmcmd rm +DATA/CDB_SHIBUYA/DATAFILE/users.272.1117290781
	asmcmd rm +DATA/CDB_SHIBUYA/EA4B68674DC50714E0531A010A0A318A/DATAFILE/users.276.1117290781
	asmcmd rm +DATA/CDB_SHIBUYA/TEMPFILE/temp.263.1117290059
	asmcmd rm +DATA/CDB_SHIBUYA/EA4B49BA826C5336E0531A010A0ADDB2/TEMPFILE/temp.267.1117290099
	asmcmd rm +DATA/CDB_SHIBUYA/EA4B68674DC50714E0531A010A0A318A/TEMPFILE/temp.273.1117290607
	asmcmd rm +RECO/CDB_SHIBUYA/ONLINELOG/group_2.257.1117290031
	asmcmd rm +RECO/CDB_SHIBUYA/ONLINELOG/group_1.258.1117290031
	asmcmd rm +RECO/CDB_SHIBUYA/ONLINELOG/group_3.259.1117290451
	asmcmd rm +RECO/CDB_SHIBUYA/ONLINELOG/group_4.260.1117290455

・CDB_OSAKA
[grid@db-osaka1 ~]$ cat /tmp/delete_ASM_files.sh
	asmcmd rm +DATA/CDB_OSAKA/DATAFILE/system.260.1117381153
	asmcmd rm +DATA/CDB_OSAKA/DATAFILE/sysaux.261.1117381197
	asmcmd rm +DATA/CDB_OSAKA/DATAFILE/undotbs1.262.1117381223
	asmcmd rm +DATA/CDB_OSAKA/E40FB8A9B379029EE0539306640AE31B/DATAFILE/system.264.1117381319
	asmcmd rm +DATA/CDB_OSAKA/E40FB8A9B379029EE0539306640AE31B/DATAFILE/sysaux.265.1117381319
	asmcmd rm +DATA/CDB_OSAKA/E40FB8A9B379029EE0539306640AE31B/DATAFILE/undotbs1.266.1117381319
	asmcmd rm +DATA/CDB_OSAKA/DATAFILE/undotbs2.268.1117381581
	asmcmd rm +DATA/CDB_OSAKA/EA60AC923DEE407DE0531801140AF8F7/DATAFILE/system.275.1117381957
	asmcmd rm +DATA/CDB_OSAKA/EA60AC923DEE407DE0531801140AF8F7/DATAFILE/sysaux.271.1117381969
	asmcmd rm +DATA/CDB_OSAKA/EA60AC923DEE407DE0531801140AF8F7/DATAFILE/undotbs1.277.1117382197
	asmcmd rm +DATA/CDB_OSAKA/EA60AC923DEE407DE0531801140AF8F7/DATAFILE/undo_2.270.1117382201
	asmcmd rm +DATA/CDB_OSAKA/DATAFILE/users.272.1117382179
	asmcmd rm +DATA/CDB_OSAKA/EA60AC923DEE407DE0531801140AF8F7/DATAFILE/users.276.1117382179
	asmcmd rm +DATA/CDB_OSAKA/TEMPFILE/temp.263.1117381299
	asmcmd rm +DATA/CDB_OSAKA/EA60887E5D090374E0531801140ADE97/TEMPFILE/temp.267.1117381359
	asmcmd rm +DATA/CDB_OSAKA/EA60AC923DEE407DE0531801140AF8F7/TEMPFILE/temp.273.1117381953
	asmcmd rm +RECO/CDB_OSAKA/ONLINELOG/group_2.258.1117381263
	asmcmd rm +RECO/CDB_OSAKA/ONLINELOG/group_1.257.1117381263
	asmcmd rm +RECO/CDB_OSAKA/ONLINELOG/group_3.259.1117381753
	asmcmd rm +RECO/CDB_OSAKA/ONLINELOG/group_4.260.1117381761

・CDB_NAMBA
[grid@db-namba1 ~]$ cat /tmp/delete_ASM_files.sh
	asmcmd rm +DATA/CDB_NAMBA/DATAFILE/system.260.1117284909
	asmcmd rm +DATA/CDB_NAMBA/DATAFILE/sysaux.261.1117284943
	asmcmd rm +DATA/CDB_NAMBA/DATAFILE/undotbs1.262.1117284959
	asmcmd rm +DATA/CDB_NAMBA/E40FB8A9B379029EE0539306640AE31B/DATAFILE/system.264.1117285033
	asmcmd rm +DATA/CDB_NAMBA/E40FB8A9B379029EE0539306640AE31B/DATAFILE/sysaux.265.1117285033
	asmcmd rm +DATA/CDB_NAMBA/E40FB8A9B379029EE0539306640AE31B/DATAFILE/undotbs1.266.1117285033
	asmcmd rm +DATA/CDB_NAMBA/DATAFILE/undotbs2.268.1117285253
	asmcmd rm +DATA/CDB_NAMBA/EA4A3BC75B866A0DE0530D01140A2FEC/DATAFILE/system.275.1117285567
	asmcmd rm +DATA/CDB_NAMBA/EA4A3BC75B866A0DE0530D01140A2FEC/DATAFILE/sysaux.271.1117285575
	asmcmd rm +DATA/CDB_NAMBA/EA4A3BC75B866A0DE0530D01140A2FEC/DATAFILE/undotbs1.277.1117285745
	asmcmd rm +DATA/CDB_NAMBA/EA4A3BC75B866A0DE0530D01140A2FEC/DATAFILE/undo_2.270.1117285747
	asmcmd rm +DATA/CDB_NAMBA/DATAFILE/users.272.1117285733
	asmcmd rm +DATA/CDB_NAMBA/EA4A3BC75B866A0DE0530D01140A2FEC/DATAFILE/users.276.1117285735
	asmcmd rm +DATA/CDB_NAMBA/TEMPFILE/temp.263.1117285019
	asmcmd rm +DATA/CDB_NAMBA/EA4A1D72602C302CE0530D01140A3AB2/TEMPFILE/temp.267.1117285061
	asmcmd rm +DATA/CDB_NAMBA/EA4A3BC75B866A0DE0530D01140A2FEC/TEMPFILE/temp.273.1117285563
	asmcmd rm +RECO/CDB_NAMBA/ONLINELOG/group_2.258.1117284993
	asmcmd rm +RECO/CDB_NAMBA/ONLINELOG/group_1.257.1117284993
	asmcmd rm +RECO/CDB_NAMBA/ONLINELOG/group_3.259.1117285409
	asmcmd rm +RECO/CDB_NAMBA/ONLINELOG/group_4.260.1117285415
```


2) スクリプトを保存して実行
/tmp/delete_ASM_files.sh これで、初期データベースのすべてのファイルが削除されました。

```:gridユーザーで 全ての Standby Dataseで実行
・CDB_SHIBUYA
[grid@db-shibuya1 ~]$ . /tmp/delete_ASM_files.sh
[grid@db-shibuya1 ~]$ asmcmd ls +DATA/CDB_SHIBUYA
	PARAMETERFILE/
	PASSWORD/
[grid@db-shibuya1 ~]$ asmcmd ls +RECO/CDB_SHIBUYA
	ARCHIVELOG/
	AUTOBACKUP/
	CONTROLFILE/

・CDB_OSAKA
[grid@db-osaka1 ~]$ . /tmp/delete_ASM_files.sh
[grid@db-osaka1 ~]$ asmcmd ls +DATA/CDB_OSAKA
	PARAMETERFILE/
	PASSWORD/
[grid@db-osaka1 ~]$ asmcmd ls +RECO/CDB_OSAKA
	ARCHIVELOG/
	AUTOBACKUP/
	CONTROLFILE/

・CDB_NAMBA
[grid@db-namba1 ~]$ . /tmp/delete_ASM_files.sh
[grid@db-namba1 ~]$ asmcmd ls +DATA/CDB_NAMBA
	PARAMETERFILE/
	PASSWORD/
[grid@db-namba1 ~]$ asmcmd ls +RECO/CDB_NAMBA
	ARCHIVELOG/
	AUTOBACKUP/
	CONTROLFILE/
```


# ■ 手順3:パスワード・ファイルをExadata Cloudにコピー
スタンバイ・データベースのパスワード・ファイルは、プライマリ・データベースのパスワード・ファイルで置き換え

## ● プライマリ・データーベースのパスワード・ファイルの場所を確認する

```:コマンド
$ srvctl config database -db testdbname
```

**・実行例**

```
[grid@db-tokyo1 ~]$ srvctl config database -db CDB_TOKYO | grep Password
	Password file: +DATA/CDB_TOKYO/PASSWORD/pwdcdb_tokyo.259.1117284483

[grid@db-tokyo1 ~]$ srvctl config database -db CDB_TOKYO
	Database unique name: CDB_TOKYO
	Database name: CDB
	Oracle home: /u01/app/oracle/product/19.0.0.0/dbhome_1
	Oracle user: oracle
	Spfile: +DATA/CDB_TOKYO/PARAMETERFILE/spfile.269.1117285011
	Password file: +DATA/CDB_TOKYO/PASSWORD/pwdcdb_tokyo.259.1117284483
	Domain: clientsubnet.vcnexatokyo.oraclevcn.com
	Start options: open
	Stop options: immediate
	Database role: PRIMARY
	Management policy: AUTOMATIC
	Server pools:
	Disk Groups: RECO,DATA
	Mount point paths: /opt/oracle/dcs/commonstore
	Services:
	Type: RAC
	Start concurrency:
	Stop concurrency:
	OSDBA group: dba
	OSOPER group: dbaoper
	Database instances: CDB1,CDB2
	Configured nodes: db-tokyo1,db-tokyo2
	CSS critical: no
	CPU count: 0
	Memory target: 0
	Maximum memory: 0
	Default network number for database services:
	Database is administrator managed
```


## ● Primary のパスワード・ファイルを Standby へコピー
パスワード・ファイルをすべての Standbyノードにコピーします。
パスワード・ファイルの場所がASMの場合は、ユーザーを"grid"またはASM所有者に切り替え、環境変数を指定してから、以下のようにしてパスワード・ファイルをコピーします。

```:コマンド:Primaryで実行
# su – grid
$ export ORACLE_SID=<ASM ORACLE_SID>
$ export ORACLE_HOME=<GRID_HOME>
$ asmcmd
ASMCMD> cd +<DISKGROUP_NAME>/<DB_UNIQUE_NAME>/PASSWORD ASMCMD> cp orapw<SID> /tmp

copying +DATA/testdbname/PASSWORD/orapw<sid> -> /tmp/orapw<sid> 
scp -i <ssh key> /tmp/orapw<SID> opc@<Public-IP-OCI-HOST>:/tmp
```

```:Primary
cd +DATA/CDB_TOKYO/PASSWORD
ls -l
cp pwdcdb_tokyo.259.1117284483 /tmp
cp pwdcdb_tokyo.259.1117284483 /tmp
exit
scp -i $HOME/.ssh/id_rsa /tmp/pwdcdb_tokyo.259.1117284483 opc@db-shibuya1.clientsubnet.vcnexatokyo.oraclevcn.com:/tmp/
scp -i $HOME/.ssh/id_rsa /tmp/pwdcdb_tokyo.259.1117284483 opc@db-osaka1.clientsubnet.vcnexaosaka.oraclevcn.com:/tmp/
scp -i $HOME/.ssh/id_rsa /tmp/pwdcdb_tokyo.259.1117284483 opc@db-namba1.clientsubnet.vcnexaosaka.oraclevcn.com:/tmp/
```

**・実行例**

```:Primaryで実行
[root@db-osaka1 ~]# su - grid
[grid@db-osaka1 ~]$ env | grep ORA
	ORACLE_SID=+ASM1
	ORACLE_HOME=/u01/app/19.0.0.0/grid

[grid@exa-osaka-node1 ~]$ asmcmd
ASMCMD> cd +DATA/CDB_TOKYO/PASSWORD

ASMCMD> ls
	pwdcdb_tokyo.259.1117284483

ASMCMD> cp pwdcdb_tokyo.259.1117284483 /tmp
	copying +DATA/CDB_TOKYO/PASSWORD/pwdcdb_tokyo.259.1117284483 -> /tmp/pwdcdb_tokyo.259.1117284483

ASMCMD> exit

・CDB_SHIBUYAへ送信
[grid@db-tokyo1 ~]$ scp -i $HOME/.ssh/id_rsa /tmp/pwdcdb_tokyo.259.1117284483 opc@db-shibuya1.clientsubnet.vcnexatokyo.oraclevcn.com:/tmp/
	pwdcdb_tokyo.259.1117284483                100% 2048     7.7MB/s   00:00

・CDB_OSAKAへ送信
[oracle@db-tokyo1 ~]$ scp -i $HOME/.ssh/id_rsa /tmp/pwdcdb_tokyo.259.1117284483 opc@db-osaka1.clientsubnet.vcnexaosaka.oraclevcn.com:/tmp/
	pwdcdb_tokyo.259.1117284483                100% 2048   242.3KB/s   00:00

・CDB＿NAMBAへ送信
[oracle@db-tokyo1 ~]$ scp -i $HOME/.ssh/id_rsa /tmp/pwdcdb_tokyo.259.1117284483 opc@db-namba1.clientsubnet.vcnexaosaka.oraclevcn.com:/tmp/
	pwdcdb_tokyo.259.1117284483                100% 2048   241.1KB/s   00:00
```


## ● Standby のパスワード・ファイルをASMに格納
### 1) Standbyの既存パスワード・ファイル確認
```:コマンド
$ srvctl config database -db <stadndby DB_UNIQUE_NAME> を使用して、現在のパスワード・ファイルの場所を検索します。
```

**・実行例**

```:全Standby Databaseで実行
・CDB＿SIBUYA
[oracle@db-shibuya1 ~]$ srvctl config database -db CDB_SHIBUYA | grep Password
	Password file: +DATA/CDB_SHIBUYA/PASSWORD/pwdcdb_shibuya.259.1117289933

・CDB_OSAKA
[grid@db-osaka1 ~]$ srvctl config database -db CDB_OSAKA | grep Password
	Password file: +DATA/CDB_OSAKA/PASSWORD/pwdcdb_osaka.259.1117381133

・CDB_NAMBA
[grid@db-namba1 ~]$ srvctl config database -db CDB_NAMBA | grep Password
	Password file: +DATA/CDB_NAMBA/PASSWORD/pwdcdb_namba.259.1117284893
```

### 2) Standbyの既存パスワード・ファイル削除

```:コマンド
$ asmcmd rm <Password file Path>
```

**・実行例**
```:全Standby Databaseで実行
・CDB＿SIBUYA
[grid@db-shibuya1 ~]$ asmcmd rm +DATA/CDB_SHIBUYA/PASSWORD/pwdcdb_shibuya.259.1117289933

・CDB_OSAKA
[grid@db-osaka1 ~]$ asmcmd rm +DATA/CDB_OSAKA/PASSWORD/pwdcdb_osaka.259.1117381133

・CDB_NAMBA
[grid@db-namba1 ~]$ asmcmd rm +DATA/CDB_NAMBA/PASSWORD/pwdcdb_namba.259.1117284893
```


### 3) Primaryパスワード・ファイルをStandbyへコピー

```:コマンド
$ asmcmd pwcopy --dbuniquename <standby DB_UNIQUE_NAME> /tmp/<password file name> <current standby password file> –f
<--前に登録されたパスワード・ファイルの場所を再使用している場合、'Error ASMCMD-9453: failed to register password file as a CRS resource' は無視してかまいません。
```

**・実行例**
ASMCMD-9453は無視できます。

```:全Standby Databaseで実行
・CDB＿SIBUYA
ASMCMD> pwcopy --dbuniquename CDB_SHIBUYA /tmp/pwdcdb_tokyo.259.1117284483 +DATA/CDB_SHIBUYA/PASSWORD/pwdcdb_shibuya -f
	ASMCMD-9453: failed to register password file as a CRS resource
	copying /tmp/pwdcdb_tokyo.259.1117284483 -> +DATA/CDB_SHIBUYA/PASSWORD/pwdcdb_shibuya
	ASMCMD-9453: failed to register password file as a CRS resource

ASMCMD> ls -l +DATA/CDB_SHIBUYA/PASSWORD/
	Type      Redund  Striped  Time             Sys  Name
	PASSWORD  UNPROT  COARSE   OCT 06 07:00:00  N    pwdcdb_shibuya => +DATA/CDB_SHIBUYA/PASSWORD/pwdcdb_shibuya.259.1117353511
	PASSWORD  UNPROT  COARSE   OCT 06 07:00:00  Y    pwdcdb_shibuya.259.1117353511

・CDB_OSAKA
[grid@db-osaka1 ~]$ asmcmd pwcopy --dbuniquename CDB_OSAKA /tmp/pwdcdb_tokyo.259.1117284483 +DATA/CDB_OSAKA/PASSWORD/pwdcdb_osaka -f
	ASMCMD-9453: failed to register password file as a CRS resource
	copying /tmp/pwdcdb_tokyo.259.1117284483 -> +DATA/CDB_OSAKA/PASSWORD/pwdcdb_osaka
	ASMCMD-9453: failed to register password file as a CRS resource
[grid@db-osaka1 ~]$ asmcmd ls -l +DATA/CDB_OSAKA/PASSWORD
	Type      Redund  Striped  Time             Sys  Name
	PASSWORD  UNPROT  COARSE   OCT 07 10:00:00  N    pwdcdb_osaka => +DATA/CDB_OSAKA/PASSWORD/pwdcdb_osaka.259.1117447509
	PASSWORD  UNPROT  COARSE   OCT 07 10:00:00  Y    pwdcdb_osaka.259.1117447509

・CDB_NAMBA
[grid@db-namba1 ~]$ asmcmd pwcopy --dbuniquename CDB_NAMBA /tmp/pwdcdb_tokyo.259.1117284483 +DATA/CDB_NAMBA/PASSWORD/pwdcdb_namba -f
	ASMCMD-9453: failed to register password file as a CRS resource
	copying /tmp/pwdcdb_tokyo.259.1117284483 -> +DATA/CDB_NAMBA/PASSWORD/pwdcdb_namba
	ASMCMD-9453: failed to register password file as a CRS resource
[grid@db-namba1 ~]$ asmcmd ls -l DATA/CDB_NAMBA/PASSWORD/pwdcdb_namba
	Type      Redund  Striped  Time             Sys  Name
	PASSWORD  UNPROT  COARSE   OCT 07 10:00:00  N    pwdcdb_namba => +DATA/CDB_NAMBA/PASSWORD/pwdcdb_namba.273.1117447561
```





### 4) 新規パスワード・ファイルを登録
```:コマンド
# su - oracle
$ srvctl modify database -db <standby DB_UNIQUE_NAME> -pwfile <ASM path for standby password file>
```


**・実行例**
```:全Standby Databaseで実行
・CDB_SIBUYA
[root@db-shibuya1 ~]# su - oracle
[oracle@exa-tokyo-node1 ~]$ srvctl modify database -db CDB_SHIBUYA -pwfile +DATA/CDB_SHIBUYA/PASSWORD/pwdcdb_shibuya

・CDB_OSAKA
[root@db-osaka1 ~]# su - oracle
[oracle@db-osaka1 ~]$ srvctl modify database -db CDB_OSAKA -pwfile +DATA/CDB_OSAKA/PASSWORD/pwdcdb_osaka

・CDB_NAMBA
[root@db-namba1 ~]# su - oracle
[oracle@db-namba1 ~]$ srvctl modify database -db CDB_NAMBA -pwfile +DATA/CDB_NAMBA/PASSWORD/pwdcdb_namba
```




### 5) 新規パスワード・ファイル登録確認
```:全Standby Databaseで実行
・CDB_SIBUYA
[grid@db-shibuya1 ~]$ srvctl config database -db CDB_SHIBUYA | grep Password
	Password file: +DATA/CDB_SHIBUYA/PASSWORD/pwdcdb_shibuya

・CDB_OSAKA
[oracle@db-osaka1 ~]$ srvctl config database -db CDB_OSAKA | grep Password
	Password file: +DATA/CDB_OSAKA/PASSWORD/pwdcdb_osaka

・CDB_NAMBA
[oracle@db-namba1 ~]$ srvctl config database -db CDB_NAMBA | grep Password
	Password file: +DATA/CDB_NAMBA/PASSWORD/pwdcdb_namba
```



・参考: Doc ID 2133681.1: Add Standby Database To Data Guard Configuration Returns ORA-01033


# ■ 手順4:Exadata Cloudへのウォレット・ファイルのコピー
### 1) Primary の TDEウォレットの場所を取得
以下の問合せで、Primary の TDEウォレットの場所を取得します。 

```:Primary(CDB_TOKYO)
SYS@CDB_TOKYO1 SQL> select WRL_PARAMETER from v$encryption_wallet;

	WRL_PARAMETER
	--------------------------------------------------------------------------------
	/opt/oracle/dcs/commonstore/wallets/CDB_TOKYO/tde/

SYS@CDB_TOKYO1 SQL> host ls -l /opt/oracle/dcs/commonstore/wallets/CDB_TOKYO/tde/
	total 32
	-rwx------ 1 oracle oinstall 5512 Oct  5 12:59 cwallet.sso
	-rwx------ 1 oracle oinstall 2555 Oct  5 12:53 ewallet_2022100512534983.p12
	-rwx------ 1 oracle oinstall 3995 Oct  5 12:59 ewallet_2022100512590406.p12
	-rwx------ 1 oracle oinstall 5467 Oct  5 12:59 ewallet.p12
```


### 2) Standbyへウォレット・ファイルをコピー
Primary の ewallet.p12 ファイルと cwallet.sso ファイルを、Standbyノード1上の /tmpディレクトリにコピーします。
プライマリでは、パスワード・ファイルの場合と同様に、ASMから/tmpにファイルをコピーすることが必要になる場合があります。

```:コマンド
$ scp -i ~/<ssh_key> <PATH>/ewallet.p12 oracle@<Public-IP-OCI-HOST1>:/tmp 
$ scp -i ~/<ssh_key> <PATH>/cwallet.sso oracle@<Public-IP-OCI-HOST1>:/tmp
```

**・実行例**
```:Primary(CDB_TOKYO)
・CDB_SIBUYAへ送信
[oracle@db-tokyo1 .ssh]$ scp -i ~/.ssh/id_rsa /opt/oracle/dcs/commonstore/wallets/CDB_TOKYO/tde/cwallet.sso oracle@db-shibuya1.clientsubnet.vcnexaosaka.oraclevcn.com:/tmp
	cwallet.sso                100% 5512    21.8MB/s   00:00
[oracle@db-tokyo1 .ssh]$ scp -i ~/.ssh/id_rsa /opt/oracle/dcs/commonstore/wallets/CDB_TOKYO/tde/ewallet.p12 oracle@db-shibuya1.clientsubnet.vcnexaosaka.oraclevcn.com:/tmp
	ewallet.p12                100% 5467    15.9MB/s   00:00

・CDB_OSAKAへ送信
[oracle@db-tokyo1 ~]$ scp -i ~/.ssh/id_rsa /opt/oracle/dcs/commonstore/wallets/CDB_TOKYO/tde/cwallet.sso oracle@db-osaka1.clientsubnet.vcnexaosaka.oraclevcn.com:/tmp
	cwallet.sso                100% 5512   572.5KB/s   00:00
[oracle@db-tokyo1 ~]$ scp -i ~/.ssh/id_rsa /opt/oracle/dcs/commonstore/wallets/CDB_TOKYO/tde/ewallet.p12 oracle@db-osaka1.clientsubnet.vcnexaosaka.oraclevcn.com:/tmp
	ewallet.p12                100% 5467   635.8KB/s   00:00

・CDB_NAMBAへ送信
[oracle@db-tokyo1 ~]$ scp -i ~/.ssh/id_rsa /opt/oracle/dcs/commonstore/wallets/CDB_TOKYO/tde/cwallet.sso oracle@db-namba1.clientsubnet.vcnexaosaka.oraclevcn.com:/tmp
	cwallet.sso                100% 5512   624.8KB/s   00:00
[oracle@db-tokyo1 ~]$ scp -i ~/.ssh/id_rsa /opt/oracle/dcs/commonstore/wallets/CDB_TOKYO/tde/ewallet.p12 oracle@db-namba1.clientsubnet.vcnexaosaka.oraclevcn.com:/tmp
	ewallet.p12                100% 5467   635.8KB/s   00:00
```


### 3)古いウォレット・ファイル削除
/var/opt/oracle/dbaas_acfs/<standby db_name>/tde_walletの古いウォレット・ファイルを削除します。
ノード1でのみコマンドを 実行します(Exadata Cloudノードは、ACFSを使用して/var/opt/oracle/dbaas_acfsのストレージを共有)。

```:全Standby Database
・CDB_SIBUYA
[oracle@db-shibuya-node1 tde]$ cd /opt/oracle/dcs/commonstore/wallets/CDB_SHIBUYA
[oracle@db-shibuya-node1 tde]$ cp tde tde.org
[oracle@db-shibuya-node1 tde]$ cd /var/opt/oracle/dbaas_acfs/CDB/wallet_root/
[oracle@db-shibuya-node1 tde]$ ls -l 
	total 32
	-rw------- 1 oracle oinstall 5512 Sep 16 15:06 cwallet.sso
	-rw------- 1 oracle oinstall 2555 Sep 16 14:59 ewallet_2022091614591224.p12
	-rw------- 1 oracle oinstall 3995 Sep 16 15:06 ewallet_2022091615063141.p12
	-rw------- 1 oracle oinstall 5467 Sep 16 15:06 ewallet.p12

[oracle@db-shibuya-node1 tde]$ rm cwallet.sso ewallet*
[oracle@db-shibuya-node1 tde]$ ls -l
	total 0

・CDB_OSAKA
[oracle@db-namba2 ~]$ cd /opt/oracle/dcs/commonstore/wallets/CDB_OSAKA
[oracle@db-namba2 CDB_OSAKA]$ cp -r tde/ tde.org
[oracle@db-namba2 CDB_OSAKA]$ ls -l
	total 160
	-rw-r--r-- 1 oracle oinstall   309 Oct  5 13:14 cdb_ocids.json
	drwx------ 2 oracle oinstall 20480 Oct  5 13:08 db
	drwx------ 2 oracle oinstall 20480 Oct  5 13:05 tde
	drwx------ 2 oracle oinstall 20480 Oct  7 10:17 tde.org
[oracle@db-osaka2 CDB_OSAKA]$ cd tde
[oracle@db-osaka2 tde]$ rm cwallet.sso ewallet*
[oracle@db-osaka2 tde]$ ls -l
	total 0

・CDB_OSAKA
[oracle@db-namba2 ~]$ cd /opt/oracle/dcs/commonstore/wallets/CDB_OSAKA
[oracle@db-namba2 CDB_OSAKA]$ cp -r tde/ tde.org
[oracle@db-namba2 CDB_OSAKA]$ ls -l
	total 160
	-rw-r--r-- 1 oracle oinstall   309 Oct  5 13:14 cdb_ocids.json
	drwx------ 2 oracle oinstall 20480 Oct  5 13:08 db
	drwx------ 2 oracle oinstall 20480 Oct  5 13:05 tde
	drwx------ 2 oracle oinstall 20480 Oct  7 10:17 tde.org
[oracle@db-osaka2 CDB_OSAKA]$ cd tde
[oracle@db-osaka2 tde]$ rm cwallet.sso ewallet*
[oracle@db-osaka2 tde]$ ls -l
	total 0

・CDB_NAMBA
[oracle@db-namba2 CDB_NAMBA]$ cd /opt/oracle/dcs/commonstore/wallets/CDB_NAMBA
[oracle@db-namba2 CDB_NAMBA]$ cp -r tde/ tde.org
[oracle@db-namba2 CDB_NAMBA]$ ls -l
	total 160
	-rw-r--r-- 1 oracle oinstall   309 Oct  5 13:14 cdb_ocids.json
	drwx------ 2 oracle oinstall 20480 Oct  5 13:08 db
	drwx------ 2 oracle oinstall 20480 Oct  5 13:05 tde
	drwx------ 2 oracle oinstall 20480 Oct  7 10:17 tde.org
[oracle@db-namba2 CDB_NAMBA]$ cd tde
[oracle@db-namba2 tde]$ rm cwallet.sso ewallet*
[oracle@db-namba2 tde]$ ls -l
	total 0
```




### 4) Primary のウォレット・ファイルを Standbyへコピー
・Primaryで　opcユーザーとして実行

```:Primary Database(CDB_TOKYO)
$ cp /tmp/ewallet.p12 /var/opt/oracle/dbaas_acfs/<standby db_name>/tde_wallet/ 
$ cp /tmp/cwallet.sso /var/opt/oracle/dbaas_acfs/<standby db_name>/tde_wallet/ 
$ chmod 600 /var/opt/oracle/dbaas_acfs/<standby db_name>/tde_wallet/*wallet*
```


**・実行例:全ノードで実行**
```:全Standby Database
・CDB_SIBUYA
[oracle@db-shibuya2 ~]$ cp /tmp/ewallet.p12 /opt/oracle/dcs/commonstore/wallets/CDB_SHIBUYA/tde
[oracle@db-shibuya2 ~]$ cp /tmp/cwallet.sso /opt/oracle/dcs/commonstore/wallets/CDB_SHIBUYA/tde
[oracle@db-shibuya2 ~]$ chmod 600 /opt/oracle/dcs/commonstore/wallets/CDB_SHIBUYA/tde/*wallet*
[oracle@db-shibuya2 ~]$ ls -l /opt/oracle/dcs/commonstore/wallets/CDB_SHIBUYA/tde
	total 16
	-rw------- 1 oracle oinstall 5512 Oct  6 10:52 cwallet.sso
	-rw------- 1 oracle oinstall 5467 Oct  6 10:52 ewallet.p12

・CDB_OSAKA
[oracle@db-osaka1 ~]$ cp /tmp/ewallet.p12 /opt/oracle/dcs/commonstore/wallets/CDB_OSAKA/tde
[oracle@db-osaka1 ~]$ cp /tmp/cwallet.sso /opt/oracle/dcs/commonstore/wallets/CDB_OSAKA/tde
[oracle@db-osaka1 ~]$ chmod 600 /opt/oracle/dcs/commonstore/wallets/CDB_OSAKA/tde/*wallet*
[oracle@db-osaka1 ~]$ ls -l /opt/oracle/dcs/commonstore/wallets/CDB_OSAKA/tde
	total 16
	-rw------- 1 oracle oinstall 5512 Oct  7 10:41 cwallet.sso
	-rw------- 1 oracle oinstall 5467 Oct  7 10:41 ewallet.p12

・CDB_NAMBA
[oracle@db-namba1 ~]$ cp /tmp/ewallet.p12 /opt/oracle/dcs/commonstore/wallets/CDB_NAMBA/tde
[oracle@db-namba1 ~]$ cp /tmp/cwallet.sso /opt/oracle/dcs/commonstore/wallets/CDB_NAMBA/tde
[oracle@db-namba1 ~]$ chmod 600 /opt/oracle/dcs/commonstore/wallets/CDB_NAMBA/tde/*wallet*
[oracle@db-namba1 ~]$ ls -l /opt/oracle/dcs/commonstore/wallets/CDB_NAMBA/tde
	total 16
	-rw------- 1 oracle oinstall 5512 Oct  7 10:43 cwallet.sso
	-rw------- 1 oracle oinstall 5467 Oct  7 10:43 ewallet.p12
```


# ■ 手順5:(11gのみ)静的リスナーを構成
19cでは不要



# ■ 手順6:REDO転送用のオラクルのネットワーク暗号化とTNSエントリ
プレーンテキストまたは暗号化されていない表領域のREDOがWAN上で可視状態にならないよう保護するには、すべてデータベースノードの sqlnet.oraファイルに次のエントリを入力します。

## ● sqlnet.ora設定

sqlnet.ora設定内容

```:sqlnet.ora
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)
```


**・設定確認**

```：Primary/Standby 全Node共通
[oracle@all-nodes ~]$ cd $ORACLE_HOME/network/admin
[oracle@all-nodes admin]$ cp sqlnet.ora sqlnet.ora.org
[oracle@all-nodes admin]$ vi sqlnet.ora 
[oracle@all-nodes admin]$ cat 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/$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)
	SQLNET.EXPIRE_TIME=10
```


## ● tnsnames.ora設定
REDO転送が正常に行われるようにするには、プライマリとスタンバイの両方のtnsnames.oraファイルに各データベースのエントリが含まれている必要があります。以下の例の太字の値を、構成に沿った値で置き換えて使用してください。
データベースのTNS記述子は、他のシステムからスキャン・リスナーが解決可能かどうかに応じて異なります。
以下の説明では、スキャン名が解決可能で、TNS記述子で使用可能なことを前提としています。スキャン名を解決できない場合は、ADDRESS_LISTを使用して、[付録B](https://www.oracle.com/jp/a/tech/docs/hybrid-data-guard-to-exaoci-update-gen2-exacc-exacs-ja.pdf)でTNS記述子の例を参照してください。


**・tnsnames.ora設定内容**
Primary(Local DB) の接続記述子には , (UR=A)オプションがあります。

```
<primary db_unique_name> =
	(DESCRIPTION =
		(SDU=65536) (RECV_BUF_SIZE=134217728)
		(SEND_BUF_SIZE=134217728)
		(ADDRESS_LIST =
			(ADDRESS = (PROTOCOL = TCP)(HOST = <primary scan name>)(PORT = {1521|<port#>}))
		)
		(CONNECT_DATA =
			(SERVER = DEDICATED)
			(SERVICE_NAME = <primary database service name>])
			(UR=A)
	))

<standby db_unique_name> =
	(DESCRIPTION =
		(SDU=65536) (RECV_BUF_SIZE=134217728)
		(SEND_BUF_SIZE=134217728)
		(ADDRESS_LIST =
			(ADDRESS = (PROTOCOL = TCP)(HOST = <standby scan name>)(PORT = {1521|<port#>}))
		)
		(CONNECT_DATA =
			(SERVER = DEDICATED)
			(SERVICE_NAME = <service name of the standby database>)
	))
```


**・設定確認**
```:db-tokyo例
[oracle@all-nodes ~]$ cat tnsnames.ora
# tnsnames.ora Network Configuration File: /u01/app/oracle/product/19.0.0.0/dbhome_1/network/admin/tnsnames.ora
# Generated by Oracle configuration tools.

CDB_TOKYO =
  (DESCRIPTION =
    (SDU=65536) (RECV_BUF_SIZE=134217728) (SEND_BUF_SIZE=134217728)
    (ADDRESS = (PROTOCOL = TCP)(HOST = db-tokyo-scan.clientsubnet.vcnexatokyo.oraclevcn.com)(PORT = 1521))
    (CONNECT_DATA =
      (SERVER = DEDICATED)
      (SERVICE_NAME = CDB_TOKYO.clientsubnet.vcnexatokyo.oraclevcn.com)
	  (UR=A)
    )
  )

CDB_SHIBUYA =
  (DESCRIPTION =
    (SDU=65536) (RECV_BUF_SIZE=134217728) (SEND_BUF_SIZE=134217728)
    (ADDRESS = (PROTOCOL = TCP)(HOST = db-shibuya-scan.clientsubnet.vcnexatokyo.oraclevcn.com)(PORT = 1521))
    (CONNECT_DATA =
      (SERVER = DEDICATED)
      (SERVICE_NAME = CDB_SHIBUYA.clientsubnet.vcnexatokyo.oraclevcn.com)
    )
  )

CDB_OSAKA =
  (DESCRIPTION =
    (SDU=65536) (RECV_BUF_SIZE=134217728) (SEND_BUF_SIZE=134217728)
    (ADDRESS = (PROTOCOL = TCP)(HOST = db-osaka-scan.clientsubnet.vcnexaosaka.oraclevcn.com)(PORT = 1521))
    (CONNECT_DATA =
      (SERVER = DEDICATED)
      (SERVICE_NAME = CDB_OSAKA.clientsubnet.vcnexaosaka.oraclevcn.com)
    )
  )

CDB_NAMBA =
  (DESCRIPTION =
    (SDU=65536) (RECV_BUF_SIZE=134217728) (SEND_BUF_SIZE=134217728)
    (ADDRESS = (PROTOCOL = TCP)(HOST = db-namba-scan.clientsubnet.vcnexaosaka.oraclevcn.com)(PORT = 1521))
    (CONNECT_DATA =
      (SERVER = DEDICATED)
      (SERVICE_NAME = CDB_NAMBA.clientsubnet.vcnexaosaka.oraclevcn.com)
    )
  )
```



## ● Primary Database 再起動
sqlnet.ora の WALLET_LOCATION を変更もしくは新規追加した場合、DBを再起動して設定を反映します。

```:Primary/Standby Database
[oracle@db-tokyo1 ~]$ srvctl stop database -d $ORACLE_UNQNAME -o immediate
[oracle@db-tokyo1 ~]$ srvctl start database -d $ORACLE_UNQNAME 
[oracle@db-tokyo1 ~]$ srvctl status database -d $ORACLE_UNQNAME
	Instance CDB1 is running on node db-tokyo1
	Instance CDB2 is running on node db-tokyo2
```





# ■ 手順7:スタンバイ・データベースをインスタンス化

## ● スタンバイ・インスタンス作成
```:コマンド
$ srvctl stop database -d <standby DB_UNIQUE_NAME> -o abort
$ rman target /
RMAN> startup nomount
RMAN> restore standby controlfile from service <primary tns descriptor>;
RMAN> alter database mount;
RMAN> CONFIGURE DEVICE TYPE DISK PARALLELISM 4; <-- 並列度(チャネルの数)を設定します。帯域幅に応じて変更できます。 
RMAN> restore database from service '<primary tns descriptor>' section size 64G;
RMAN> shutdown immediate
```



**・CDB_SHIBUYA Standby Database作成**
```:CDB_SHIBUYA
[oracle@db-shibuya1 admin]$ srvctl stop database -d CDB_SHIBUYA -o immediate
	PRCC-1016 : CDB_SHIBUYA was already stopped

[oracle@db-shibuya1 admin]$ rman target sys/<Password>

	Recovery Manager: Release 19.0.0.0.0 - Production on Thu Oct 6 11:16:41 2022
	Version 19.16.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   32749122168 bytes

	Fixed Size                    13873784 bytes
	Variable Size               3959422976 bytes
	Database Buffers           28588376064 bytes
	Redo Buffers                 187449344 bytes


RMAN> restore standby controlfile from service 'CDB_TOKYO';

	Starting restore at 06-OCT-22
	using target database control file instead of recovery catalog
	allocated channel: ORA_DISK_1
	channel ORA_DISK_1: SID=10 instance=CDB1 device type=DISK

	channel ORA_DISK_1: starting datafile backup set restore
	channel ORA_DISK_1: using network backup set from service CDB_TOKYO
	channel ORA_DISK_1: restoring control file
	channel ORA_DISK_1: restore complete, elapsed time: 00:00:02
	output file name=+RECO/CDB_SHIBUYA/CONTROLFILE/current.256.1117290029
	Finished restore at 06-OCT-22


RMAN>  alter database mount;

	released channel: ORA_DISK_1
	Statement processed

RMAN> CONFIGURE DEVICE TYPE DISK PARALLELISM 4;

	new RMAN configuration parameters:
	CONFIGURE DEVICE TYPE DISK PARALLELISM 4 BACKUP TYPE TO BACKUPSET;
	new RMAN configuration parameters are successfully stored

RMAN> restore database from service 'CDB_TOKYO' section size 64G;

	Starting restore at 06-OCT-22
	Starting implicit crosscheck backup at 06-OCT-22
	allocated channel: ORA_DISK_1
	allocated channel: ORA_DISK_2
	allocated channel: ORA_DISK_3
	allocated channel: ORA_DISK_4
	Crosschecked 1 objects
	Finished implicit crosscheck backup at 06-OCT-22

	Starting implicit crosscheck copy at 06-OCT-22
	using channel ORA_DISK_1
	using channel ORA_DISK_2
	using channel ORA_DISK_3
	using channel ORA_DISK_4
	Finished implicit crosscheck copy at 06-OCT-22

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

	List of Cataloged Files
	=======================
	File Name: +RECO/CDB_SHIBUYA/ARCHIVELOG/2022_10_06/thread_1_seq_3.267.1117342321
	File Name: +RECO/CDB_SHIBUYA/ARCHIVELOG/2022_10_05/thread_2_seq_1.261.1117290465
	File Name: +RECO/CDB_SHIBUYA/ARCHIVELOG/2022_10_05/thread_1_seq_2.262.1117290663
	File Name: +RECO/CDB_SHIBUYA/ARCHIVELOG/2022_10_05/thread_2_seq_2.263.1117290705
	File Name: +RECO/CDB_SHIBUYA/ARCHIVELOG/2022_10_05/thread_2_seq_3.264.1117290705

	using channel ORA_DISK_1
	using channel ORA_DISK_2
	using channel ORA_DISK_3
	using channel ORA_DISK_4

	channel ORA_DISK_1: starting datafile backup set restore
	channel ORA_DISK_1: using network backup set from service CDB_TOKYO
	channel ORA_DISK_1: specifying datafile(s) to restore from backup set
	channel ORA_DISK_1: restoring datafile 00001 to +DATA/CDB_SHIBUYA/DATAFILE/system.280.1117365587
	channel ORA_DISK_1: restoring section 1 of 1
	channel ORA_DISK_2: starting datafile backup set restore
	channel ORA_DISK_2: using network backup set from service CDB_TOKYO
	channel ORA_DISK_2: specifying datafile(s) to restore from backup set
	channel ORA_DISK_2: restoring datafile 00003 to +DATA/CDB_SHIBUYA/DATAFILE/sysaux.267.1117365587
	channel ORA_DISK_2: restoring section 1 of 1
	channel ORA_DISK_3: starting datafile backup set restore
	channel ORA_DISK_3: using network backup set from service CDB_TOKYO
	channel ORA_DISK_3: specifying datafile(s) to restore from backup set
	channel ORA_DISK_3: restoring datafile 00004 to +DATA/CDB_SHIBUYA/DATAFILE/undotbs1.263.1117365589
	channel ORA_DISK_3: restoring section 1 of 1
	channel ORA_DISK_4: starting datafile backup set restore
	channel ORA_DISK_4: using network backup set from service CDB_TOKYO
	channel ORA_DISK_4: specifying datafile(s) to restore from backup set
	channel ORA_DISK_4: restoring datafile 00005 to +DATA/CDB_SHIBUYA/EA4A04DC030F53B2E0530A010A0A0901/DATAFILE/system.276.1117365589
	channel ORA_DISK_4: restoring section 1 of 1
	channel ORA_DISK_3: restore complete, elapsed time: 00:00:03
	channel ORA_DISK_3: starting datafile backup set restore
	channel ORA_DISK_3: using network backup set from service CDB_TOKYO
	channel ORA_DISK_3: specifying datafile(s) to restore from backup set
	channel ORA_DISK_3: restoring datafile 00006 to +DATA/CDB_SHIBUYA/EA4A04DC030F53B2E0530A010A0A0901/DATAFILE/sysaux.272.1117365593
	channel ORA_DISK_3: restoring section 1 of 1
	channel ORA_DISK_1: restore complete, elapsed time: 00:00:23
	channel ORA_DISK_1: starting datafile backup set restore
	channel ORA_DISK_1: using network backup set from service CDB_TOKYO
	channel ORA_DISK_1: specifying datafile(s) to restore from backup set
	channel ORA_DISK_1: restoring datafile 00007 to +DATA/CDB_SHIBUYA/EA4A04DC030F53B2E0530A010A0A0901/DATAFILE/undotbs1.270.1117365609
	channel ORA_DISK_1: restoring section 1 of 1
	channel ORA_DISK_2: restore complete, elapsed time: 00:00:23
	channel ORA_DISK_2: starting datafile backup set restore
	channel ORA_DISK_2: using network backup set from service CDB_TOKYO
	channel ORA_DISK_2: specifying datafile(s) to restore from backup set
	channel ORA_DISK_2: restoring datafile 00008 to +DATA/CDB_SHIBUYA/DATAFILE/undotbs2.277.1117365611
	channel ORA_DISK_2: restoring section 1 of 1
	channel ORA_DISK_3: restore complete, elapsed time: 00:00:19
	channel ORA_DISK_3: starting datafile backup set restore
	channel ORA_DISK_3: using network backup set from service CDB_TOKYO
	channel ORA_DISK_3: specifying datafile(s) to restore from backup set
	channel ORA_DISK_3: restoring datafile 00009 to +DATA/CDB_SHIBUYA/EA4A2316EB740870E0530A010A0AA68A/DATAFILE/system.271.1117365611
	channel ORA_DISK_3: restoring section 1 of 1
	channel ORA_DISK_4: restore complete, elapsed time: 00:00:23
	channel ORA_DISK_4: starting datafile backup set restore
	channel ORA_DISK_4: using network backup set from service CDB_TOKYO
	channel ORA_DISK_4: specifying datafile(s) to restore from backup set
	channel ORA_DISK_4: restoring datafile 00010 to +DATA/CDB_SHIBUYA/EA4A2316EB740870E0530A010A0AA68A/DATAFILE/sysaux.275.1117365613
	channel ORA_DISK_4: restoring section 1 of 1
	channel ORA_DISK_1: restore complete, elapsed time: 00:00:04
	channel ORA_DISK_1: starting datafile backup set restore
	channel ORA_DISK_1: using network backup set from service CDB_TOKYO
	channel ORA_DISK_1: specifying datafile(s) to restore from backup set
	channel ORA_DISK_1: restoring datafile 00011 to +DATA/CDB_SHIBUYA/EA4A2316EB740870E0530A010A0AA68A/DATAFILE/undotbs1.268.1117365613
	channel ORA_DISK_1: restoring section 1 of 1
	channel ORA_DISK_2: restore complete, elapsed time: 00:00:04
	channel ORA_DISK_2: starting datafile backup set restore
	channel ORA_DISK_2: using network backup set from service CDB_TOKYO
	channel ORA_DISK_2: specifying datafile(s) to restore from backup set
	channel ORA_DISK_2: restoring datafile 00012 to +DATA/CDB_SHIBUYA/EA4A2316EB740870E0530A010A0AA68A/DATAFILE/undo_2.266.1117365615
	channel ORA_DISK_2: restoring section 1 of 1
	channel ORA_DISK_3: restore complete, elapsed time: 00:00:04
	channel ORA_DISK_3: starting datafile backup set restore
	channel ORA_DISK_3: using network backup set from service CDB_TOKYO
	channel ORA_DISK_3: specifying datafile(s) to restore from backup set
	channel ORA_DISK_3: restoring datafile 00013 to +DATA/CDB_SHIBUYA/DATAFILE/users.265.1117365615
	channel ORA_DISK_3: restoring section 1 of 1
	channel ORA_DISK_1: restore complete, elapsed time: 00:00:03
	channel ORA_DISK_1: starting datafile backup set restore
	channel ORA_DISK_1: using network backup set from service CDB_TOKYO
	channel ORA_DISK_1: specifying datafile(s) to restore from backup set
	channel ORA_DISK_1: restoring datafile 00014 to +DATA/CDB_SHIBUYA/EA4A2316EB740870E0530A010A0AA68A/DATAFILE/users.264.1117365617
	channel ORA_DISK_1: restoring section 1 of 1
	channel ORA_DISK_2: restore complete, elapsed time: 00:00:03
	channel ORA_DISK_3: restore complete, elapsed time: 00:00:02
	channel ORA_DISK_4: restore complete, elapsed time: 00:00:05
	channel ORA_DISK_1: restore complete, elapsed time: 00:00:01
	Finished restore at 06-OCT-22

RMAN> shutdown immediate

	database dismounted
	Oracle instance shut down

RMAN> exit
```




**・CDB_OSAKA Standby Database作成**
```:CDB_OSAKA
[oracle@db-osaka1 ~]$ srvctl stop database -d CDB_OSAKA -o immediate
	PRCC-1016 : CDB_OSAKA was already stopped
[oracle@db-osaka1 ~]$ rman target sys/<Password>

	Recovery Manager: Release 19.0.0.0.0 - Production on Fri Oct 7 10:52:51 2022
	Version 19.16.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   30601641080 bytes

	Fixed Size                    13872248 bytes
	Variable Size               3690987520 bytes
	Database Buffers           26709327872 bytes
	Redo Buffers                 187453440 bytes

RMAN> restore standby controlfile from service 'CDB_TOKYO';

	Starting restore at 07-OCT-22
	using target database control file instead of recovery catalog
	allocated channel: ORA_DISK_1
	channel ORA_DISK_1: SID=10 instance=CDB1 device type=DISK

	channel ORA_DISK_1: starting datafile backup set restore
	channel ORA_DISK_1: using network backup set from service CDB_TOKYO
	channel ORA_DISK_1: restoring control file
	channel ORA_DISK_1: restore complete, elapsed time: 00:00:03
	output file name=+RECO/CDB_OSAKA/CONTROLFILE/current.256.1117381261
	Finished restore at 07-OCT-22

RMAN> alter database mount;

	released channel: ORA_DISK_1
	Statement processed

RMAN> CONFIGURE DEVICE TYPE DISK PARALLELISM 4;

	new RMAN configuration parameters:
	CONFIGURE DEVICE TYPE DISK PARALLELISM 4 BACKUP TYPE TO BACKUPSET;
	new RMAN configuration parameters are successfully stored

RMAN> restore database from service 'CDB_TOKYO' section size 64G;

	Starting restore at 07-OCT-22
	Starting implicit crosscheck backup at 07-OCT-22
	allocated channel: ORA_DISK_1
	allocated channel: ORA_DISK_2
	allocated channel: ORA_DISK_3
	allocated channel: ORA_DISK_4
	Crosschecked 1 objects
	Crosschecked 1 objects
	Crosschecked 1 objects
	Crosschecked 1 objects
	Finished implicit crosscheck backup at 07-OCT-22

	Starting implicit crosscheck copy at 07-OCT-22
	using channel ORA_DISK_1
	using channel ORA_DISK_2
	using channel ORA_DISK_3
	using channel ORA_DISK_4
	Finished implicit crosscheck copy at 07-OCT-22

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

	List of Cataloged Files
	=======================
	File Name: +RECO/CDB_OSAKA/ARCHIVELOG/2022_10_07/thread_1_seq_3.265.1117445481
	File Name: +RECO/CDB_OSAKA/ARCHIVELOG/2022_10_06/thread_2_seq_1.261.1117381773
	File Name: +RECO/CDB_OSAKA/ARCHIVELOG/2022_10_06/thread_1_seq_2.262.1117382027

	using channel ORA_DISK_1
	using channel ORA_DISK_2
	using channel ORA_DISK_3
	using channel ORA_DISK_4

	channel ORA_DISK_1: starting datafile backup set restore
	channel ORA_DISK_1: using network backup set from service CDB_TOKYO
	channel ORA_DISK_1: specifying datafile(s) to restore from backup set
	channel ORA_DISK_1: restoring datafile 00001 to +DATA/CDB_OSAKA/DATAFILE/system.273.1117450497
	channel ORA_DISK_1: restoring section 1 of 1
	channel ORA_DISK_2: starting datafile backup set restore
	channel ORA_DISK_2: using network backup set from service CDB_TOKYO
	channel ORA_DISK_2: specifying datafile(s) to restore from backup set
	channel ORA_DISK_2: restoring datafile 00003 to +DATA/CDB_OSAKA/DATAFILE/sysaux.267.1117450497
	channel ORA_DISK_2: restoring section 1 of 1
	channel ORA_DISK_3: starting datafile backup set restore
	channel ORA_DISK_3: using network backup set from service CDB_TOKYO
	channel ORA_DISK_3: specifying datafile(s) to restore from backup set
	channel ORA_DISK_3: restoring datafile 00004 to +DATA/CDB_OSAKA/DATAFILE/undotbs1.263.1117450499
	channel ORA_DISK_3: restoring section 1 of 1
	channel ORA_DISK_4: starting datafile backup set restore
	channel ORA_DISK_4: using network backup set from service CDB_TOKYO
	channel ORA_DISK_4: specifying datafile(s) to restore from backup set
	channel ORA_DISK_4: restoring datafile 00005 to +DATA/CDB_OSAKA/EA4A04DC030F53B2E0530A010A0A0901/DATAFILE/system.276.1117450501
	channel ORA_DISK_4: restoring section 1 of 1
	channel ORA_DISK_3: restore complete, elapsed time: 00:00:07
	channel ORA_DISK_3: starting datafile backup set restore
	channel ORA_DISK_3: using network backup set from service CDB_TOKYO
	channel ORA_DISK_3: specifying datafile(s) to restore from backup set
	channel ORA_DISK_3: restoring datafile 00006 to +DATA/CDB_OSAKA/EA4A04DC030F53B2E0530A010A0A0901/DATAFILE/sysaux.272.1117450507
	channel ORA_DISK_3: restoring section 1 of 1
	channel ORA_DISK_4: restore complete, elapsed time: 00:00:22
	channel ORA_DISK_4: starting datafile backup set restore
	channel ORA_DISK_4: using network backup set from service CDB_TOKYO
	channel ORA_DISK_4: specifying datafile(s) to restore from backup set
	channel ORA_DISK_4: restoring datafile 00007 to +DATA/CDB_OSAKA/EA4A04DC030F53B2E0530A010A0A0901/DATAFILE/undotbs1.270.1117450523
	channel ORA_DISK_4: restoring section 1 of 1
	channel ORA_DISK_3: restore complete, elapsed time: 00:00:19
	channel ORA_DISK_3: starting datafile backup set restore
	channel ORA_DISK_3: using network backup set from service CDB_TOKYO
	channel ORA_DISK_3: specifying datafile(s) to restore from backup set
	channel ORA_DISK_3: restoring datafile 00008 to +DATA/CDB_OSAKA/DATAFILE/undotbs2.277.1117450527
	channel ORA_DISK_3: restoring section 1 of 1
	channel ORA_DISK_4: restore complete, elapsed time: 00:00:05
	channel ORA_DISK_4: starting datafile backup set restore
	channel ORA_DISK_4: using network backup set from service CDB_TOKYO
	channel ORA_DISK_4: specifying datafile(s) to restore from backup set
	channel ORA_DISK_4: restoring datafile 00009 to +DATA/CDB_OSAKA/EA4A2316EB740870E0530A010A0AA68A/DATAFILE/system.271.1117450529
	channel ORA_DISK_4: restoring section 1 of 1
	channel ORA_DISK_3: restore complete, elapsed time: 00:00:04
	channel ORA_DISK_3: starting datafile backup set restore
	channel ORA_DISK_3: using network backup set from service CDB_TOKYO
	channel ORA_DISK_3: specifying datafile(s) to restore from backup set
	channel ORA_DISK_3: restoring datafile 00010 to +DATA/CDB_OSAKA/EA4A2316EB740870E0530A010A0AA68A/DATAFILE/sysaux.275.1117450531
	channel ORA_DISK_3: restoring section 1 of 1
	channel ORA_DISK_1: restore complete, elapsed time: 00:00:42
	channel ORA_DISK_1: starting datafile backup set restore
	channel ORA_DISK_1: using network backup set from service CDB_TOKYO
	channel ORA_DISK_1: specifying datafile(s) to restore from backup set
	channel ORA_DISK_1: restoring datafile 00011 to +DATA/CDB_OSAKA/EA4A2316EB740870E0530A010A0AA68A/DATAFILE/undotbs1.268.1117450539
	channel ORA_DISK_1: restoring section 1 of 1
	channel ORA_DISK_2: restore complete, elapsed time: 00:00:43
	channel ORA_DISK_2: starting datafile backup set restore
	channel ORA_DISK_2: using network backup set from service CDB_TOKYO
	channel ORA_DISK_2: specifying datafile(s) to restore from backup set
	channel ORA_DISK_2: restoring datafile 00012 to +DATA/CDB_OSAKA/EA4A2316EB740870E0530A010A0AA68A/DATAFILE/undo_2.266.1117450541
	channel ORA_DISK_2: restoring section 1 of 1
	channel ORA_DISK_3: restore complete, elapsed time: 00:00:11
	channel ORA_DISK_3: starting datafile backup set restore
	channel ORA_DISK_3: using network backup set from service CDB_TOKYO
	channel ORA_DISK_3: specifying datafile(s) to restore from backup set
	channel ORA_DISK_3: restoring datafile 00013 to +DATA/CDB_OSAKA/DATAFILE/users.265.1117450541
	channel ORA_DISK_3: restoring section 1 of 1
	channel ORA_DISK_4: restore complete, elapsed time: 00:00:14
	channel ORA_DISK_4: starting datafile backup set restore
	channel ORA_DISK_4: using network backup set from service CDB_TOKYO
	channel ORA_DISK_4: specifying datafile(s) to restore from backup set
	channel ORA_DISK_4: restoring datafile 00014 to +DATA/CDB_OSAKA/EA4A2316EB740870E0530A010A0AA68A/DATAFILE/users.264.1117450543
	channel ORA_DISK_4: restoring section 1 of 1
	channel ORA_DISK_1: restore complete, elapsed time: 00:00:05
	channel ORA_DISK_2: restore complete, elapsed time: 00:00:04
	channel ORA_DISK_3: restore complete, elapsed time: 00:00:03
	channel ORA_DISK_4: restore complete, elapsed time: 00:00:03
	Finished restore at 07-OCT-22

RMAN> shutdown immediate

	database dismounted
	Oracle instance shut down
```




**・CDB_NAMBA Standby Database作成**
```:CDB_NAMBA
[oracle@db-namba1 ~]$ srvctl stop database -d CDB_NAMBA -o immediate
	PRCC-1016 : CDB_NAMBA was already stopped
	[oracle@db-namba1 ~]$ rman target sys/<Password>

	Recovery Manager: Release 19.0.0.0.0 - Production on Fri Oct 7 10:53:16 2022
	Version 19.16.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   32749122168 bytes

	Fixed Size                    13873784 bytes
	Variable Size               3959422976 bytes
	Database Buffers           28588376064 bytes
	Redo Buffers                 187449344 bytes

RMAN> restore standby controlfile from service 'CDB_TOKYO';

	Starting restore at 07-OCT-22
	using target database control file instead of recovery catalog
	allocated channel: ORA_DISK_1
	channel ORA_DISK_1: SID=10 instance=CDB1 device type=DISK

	channel ORA_DISK_1: starting datafile backup set restore
	channel ORA_DISK_1: using network backup set from service CDB_TOKYO
	channel ORA_DISK_1: restoring control file
	channel ORA_DISK_1: restore complete, elapsed time: 00:00:03
	output file name=+RECO/CDB_NAMBA/CONTROLFILE/current.256.1117284991
	Finished restore at 07-OCT-22

RMAN> alter database mount;

	released channel: ORA_DISK_1
	Statement processed

RMAN> CONFIGURE DEVICE TYPE DISK PARALLELISM 4;

	new RMAN configuration parameters:
	CONFIGURE DEVICE TYPE DISK PARALLELISM 4 BACKUP TYPE TO BACKUPSET;
	new RMAN configuration parameters are successfully stored

RMAN> restore database from service 'CDB_TOKYO' section size 64G;

	Starting restore at 07-OCT-22
	Starting implicit crosscheck backup at 07-OCT-22
	allocated channel: ORA_DISK_1
	allocated channel: ORA_DISK_2
	allocated channel: ORA_DISK_3
	allocated channel: ORA_DISK_4
	Crosschecked 1 objects
	Crosschecked 1 objects
	Crosschecked 1 objects
	Crosschecked 1 objects
	Finished implicit crosscheck backup at 07-OCT-22

	Starting implicit crosscheck copy at 07-OCT-22
	using channel ORA_DISK_1
	using channel ORA_DISK_2
	using channel ORA_DISK_3
	using channel ORA_DISK_4
	Finished implicit crosscheck copy at 07-OCT-22

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

	List of Cataloged Files
	=======================
	File Name: +RECO/CDB_NAMBA/ARCHIVELOG/2022_10_07/thread_2_seq_4.267.1117445483
	File Name: +RECO/CDB_NAMBA/ARCHIVELOG/2022_10_07/thread_1_seq_3.268.1117445483
	File Name: +RECO/CDB_NAMBA/ARCHIVELOG/2022_10_05/thread_2_seq_1.261.1117285425
	File Name: +RECO/CDB_NAMBA/ARCHIVELOG/2022_10_05/thread_1_seq_2.262.1117285619
	File Name: +RECO/CDB_NAMBA/ARCHIVELOG/2022_10_05/thread_2_seq_2.263.1117285663
	File Name: +RECO/CDB_NAMBA/ARCHIVELOG/2022_10_05/thread_2_seq_3.264.1117285663

	using channel ORA_DISK_1
	using channel ORA_DISK_2
	using channel ORA_DISK_3
	using channel ORA_DISK_4

	channel ORA_DISK_1: starting datafile backup set restore
	channel ORA_DISK_1: using network backup set from service CDB_TOKYO
	channel ORA_DISK_1: specifying datafile(s) to restore from backup set
	channel ORA_DISK_1: restoring datafile 00001 to +DATA/CDB_NAMBA/DATAFILE/system.267.1117450491
	channel ORA_DISK_1: restoring section 1 of 1
	channel ORA_DISK_2: starting datafile backup set restore
	channel ORA_DISK_2: using network backup set from service CDB_TOKYO
	channel ORA_DISK_2: specifying datafile(s) to restore from backup set
	channel ORA_DISK_2: restoring datafile 00003 to +DATA/CDB_NAMBA/DATAFILE/sysaux.263.1117450491
	channel ORA_DISK_2: restoring section 1 of 1
	channel ORA_DISK_3: starting datafile backup set restore
	channel ORA_DISK_3: using network backup set from service CDB_TOKYO
	channel ORA_DISK_3: specifying datafile(s) to restore from backup set
	channel ORA_DISK_3: restoring datafile 00004 to +DATA/CDB_NAMBA/DATAFILE/undotbs1.276.1117450493
	channel ORA_DISK_3: restoring section 1 of 1
	channel ORA_DISK_4: starting datafile backup set restore
	channel ORA_DISK_4: using network backup set from service CDB_TOKYO
	channel ORA_DISK_4: specifying datafile(s) to restore from backup set
	channel ORA_DISK_4: restoring datafile 00005 to +DATA/CDB_NAMBA/EA4A04DC030F53B2E0530A010A0A0901/DATAFILE/system.272.1117450493
	channel ORA_DISK_4: restoring section 1 of 1
	channel ORA_DISK_3: restore complete, elapsed time: 00:00:03
	channel ORA_DISK_3: starting datafile backup set restore
	channel ORA_DISK_3: using network backup set from service CDB_TOKYO
	channel ORA_DISK_3: specifying datafile(s) to restore from backup set
	channel ORA_DISK_3: restoring datafile 00006 to +DATA/CDB_NAMBA/EA4A04DC030F53B2E0530A010A0A0901/DATAFILE/sysaux.270.1117450497
	channel ORA_DISK_3: restoring section 1 of 1
	channel ORA_DISK_4: restore complete, elapsed time: 00:00:19
	channel ORA_DISK_4: starting datafile backup set restore
	channel ORA_DISK_4: using network backup set from service CDB_TOKYO
	channel ORA_DISK_4: specifying datafile(s) to restore from backup set
	channel ORA_DISK_4: restoring datafile 00007 to +DATA/CDB_NAMBA/EA4A04DC030F53B2E0530A010A0A0901/DATAFILE/undotbs1.277.1117450513
	channel ORA_DISK_4: restoring section 1 of 1
	channel ORA_DISK_1: restore complete, elapsed time: 00:00:27
	channel ORA_DISK_1: starting datafile backup set restore
	channel ORA_DISK_1: using network backup set from service CDB_TOKYO
	channel ORA_DISK_1: specifying datafile(s) to restore from backup set
	channel ORA_DISK_1: restoring datafile 00008 to +DATA/CDB_NAMBA/DATAFILE/undotbs2.271.1117450517
	channel ORA_DISK_1: restoring section 1 of 1
	channel ORA_DISK_3: restore complete, elapsed time: 00:00:22
	channel ORA_DISK_3: starting datafile backup set restore
	channel ORA_DISK_3: using network backup set from service CDB_TOKYO
	channel ORA_DISK_3: specifying datafile(s) to restore from backup set
	channel ORA_DISK_3: restoring datafile 00009 to +DATA/CDB_NAMBA/EA4A2316EB740870E0530A010A0AA68A/DATAFILE/system.275.1117450519
	channel ORA_DISK_3: restoring section 1 of 1
	channel ORA_DISK_1: restore complete, elapsed time: 00:00:03
	channel ORA_DISK_1: starting datafile backup set restore
	channel ORA_DISK_1: using network backup set from service CDB_TOKYO
	channel ORA_DISK_1: specifying datafile(s) to restore from backup set
	channel ORA_DISK_1: restoring datafile 00010 to +DATA/CDB_NAMBA/EA4A2316EB740870E0530A010A0AA68A/DATAFILE/sysaux.268.1117450521
	channel ORA_DISK_1: restoring section 1 of 1
	channel ORA_DISK_4: restore complete, elapsed time: 00:00:10
	channel ORA_DISK_4: starting datafile backup set restore
	channel ORA_DISK_4: using network backup set from service CDB_TOKYO
	channel ORA_DISK_4: specifying datafile(s) to restore from backup set
	channel ORA_DISK_4: restoring datafile 00011 to +DATA/CDB_NAMBA/EA4A2316EB740870E0530A010A0AA68A/DATAFILE/undotbs1.266.1117450523
	channel ORA_DISK_4: restoring section 1 of 1
	channel ORA_DISK_2: restore complete, elapsed time: 00:00:32
	channel ORA_DISK_2: starting datafile backup set restore
	channel ORA_DISK_2: using network backup set from service CDB_TOKYO
	channel ORA_DISK_2: specifying datafile(s) to restore from backup set
	channel ORA_DISK_2: restoring datafile 00012 to +DATA/CDB_NAMBA/EA4A2316EB740870E0530A010A0AA68A/DATAFILE/undo_2.265.1117450523
	channel ORA_DISK_2: restoring section 1 of 1
	channel ORA_DISK_4: restore complete, elapsed time: 00:00:04
	channel ORA_DISK_4: starting datafile backup set restore
	channel ORA_DISK_4: using network backup set from service CDB_TOKYO
	channel ORA_DISK_4: specifying datafile(s) to restore from backup set
	channel ORA_DISK_4: restoring datafile 00013 to +DATA/CDB_NAMBA/DATAFILE/users.264.1117450527
	channel ORA_DISK_4: restoring section 1 of 1
	channel ORA_DISK_2: restore complete, elapsed time: 00:00:06
	channel ORA_DISK_2: starting datafile backup set restore
	channel ORA_DISK_2: using network backup set from service CDB_TOKYO
	channel ORA_DISK_2: specifying datafile(s) to restore from backup set
	channel ORA_DISK_2: restoring datafile 00014 to +DATA/CDB_NAMBA/EA4A2316EB740870E0530A010A0AA68A/DATAFILE/users.262.1117450529
	channel ORA_DISK_2: restoring section 1 of 1
	channel ORA_DISK_4: restore complete, elapsed time: 00:00:04
	channel ORA_DISK_2: restore complete, elapsed time: 00:00:04
	channel ORA_DISK_3: restore complete, elapsed time: 00:00:15
	channel ORA_DISK_1: restore complete, elapsed time: 00:00:17
	Finished restore at 07-OCT-22

RMAN> shutdown immediate

	database dismounted
	Oracle instance shut down
```




## ● スタンバイ・データベース 再起動

```:コマンド
$ srvctl start database -d <standby DB_UNIQUE_NAME> -o mount
$ srvctl status database -d <standby DB_UNIQUE_NAME>
```


**・実行例**

```: 全 Standby Database
・CDB_SHIBUYA
[oracle@db-shibuya1 admin]$ srvctl start database -d $ORACLE_UNQNAME -o mount
[oracle@db-shibuya1 admin]$ srvctl status database -d $ORACLE_UNQNAME
	Instance CDB1 is running on node db-shibuya1
	Instance CDB2 is running on node db-shibuya2

・CDB_OSAKA
[oracle@db-osaka1 ~]$ srvctl start database -d $ORACLE_UNQNAME -o mount
[oracle@db-osaka1 ~]$ srvctl status database -d $ORACLE_UNQNAME
	Instance CDB1 is running on node db-osaka1
	Instance CDB2 is running on node db-osaka2

・CDB_NAMBA
[oracle@db-namba1 ~]$ srvctl start database -d $ORACLE_UNQNAME -o mount
[oracle@db-namba1 ~]$ srvctl status database -d $ORACLE_UNQNAME
	Instance CDB1 is running on node db-namba1
	Instance CDB2 is running on node db-namba2
```

## ● Standbyの すべてのオンラインおよびスタンバイREDOログを消去
すべてのオンラインおよびスタンバイREDOログを消去します。

### 1) ログを消去する前にDB_CREATE_ONLINE_LOG_DEST確認

• DB_CREATE_ONLINE_LOG_DEST_1= <DATA disk group>.必要に応じて修正します。
• DB_CREATE_ONLINE_LOG_DEST_n is not set other than n=1.


```:コマンド
SYS@CDB_SHIBUYA1 SQL> show parameter DB_CREATE_ONLINE_LOG_DEST

	NAME				     TYPE	 VALUE
	------------------------------------ ----------- ------------------------------
	db_create_online_log_dest_1	     string	 +RECO
	db_create_online_log_dest_2	     string
	db_create_online_log_dest_3	     string
	db_create_online_log_dest_4	     string
	db_create_online_log_dest_5	     string
```



### 2) すべてのlogfileを消去

```:コマンド
$ sqlplus “/ as sysdba”
SQL> set pagesize 0 feedback off linesize 120 trimspool on
SQL> spool /tmp/clearlogs.sql
SQL> select distinct 'alter database clear logfile group '||group#||';' from v$logfile; 
SQL> spool off
SQL> @/tmp/clearlogs.sql
SQL> select member from v$logfile;
すべてのREDOログは、スタンバイDB _UNIQUE_NAMEディレクトリのDATAディスク・グループに格納されることになっています。
```


```:全Standby Databaseで実行
・CDB_SHIBUYA
SYS@CDB_SHIBUYA1 SQL> set pagesize 0 feedback off linesize 120 trimspool on
SYS@CDB_SHIBUYA1 SQL> spool /tmp/clearlogs.sql
SYS@CDB_SHIBUYA1 SQL> select distinct 'alter database clear logfile group '||group#||';' from v$logfile;
	alter database clear logfile group 11;
	alter database clear logfile group 12;
	alter database clear logfile group 13;
	alter database clear logfile group 21;
	alter database clear logfile group 22;
	alter database clear logfile group 23;
SYS@CDB_SHIBUYA1 SQL> spool off
SYS@CDB_SHIBUYA1 SQL> host vi /tmp/clearlogs.sql
 <--不要な行を削除

SYS@CDB_SHIBUYA1 SQL> host cat /tmp/clearlogs.sql
	alter database clear logfile group 11;
	alter database clear logfile group 12;
	alter database clear logfile group 13;
	alter database clear logfile group 21;
	alter database clear logfile group 22;
	alter database clear logfile group 23;

SYS@CDB_SHIBUYA1 SQL> @/tmp/clearlogs.sql
SYS@CDB_SHIBUYA1 SQL> select member from v$logfile;
	+RECO/CDB_SHIBUYA/ONLINELOG/group_11.260.1117365873
	+RECO/CDB_SHIBUYA/ONLINELOG/group_12.259.1117365879
	+RECO/CDB_SHIBUYA/ONLINELOG/group_13.260.1117365884
	+RECO/CDB_SHIBUYA/ONLINELOG/group_21.258.1117365885
	+RECO/CDB_SHIBUYA/ONLINELOG/group_22.257.1117365893
	+RECO/CDB_SHIBUYA/ONLINELOG/group_23.257.1117365897

	4 rows selected.


・CDB_OSAKA
SYS@CDB_NAMBA1 SQL> @/tmp/clearlogs.sql
SYS@CDB_OSAKA1 SQL> select member from v$logfile;
	MEMBER
	------------------------------------------------------------
	+RECO/CDB_OSAKA/ONLINELOG/group_11.267.1117456199
	+RECO/CDB_OSAKA/ONLINELOG/group_12.266.1117456207
	+RECO/CDB_OSAKA/ONLINELOG/group_13.267.1117456301
	+RECO/CDB_OSAKA/ONLINELOG/group_21.266.1117456207
	+RECO/CDB_OSAKA/ONLINELOG/group_22.271.1117456215
	+RECO/CDB_OSAKA/ONLINELOG/group_23.271.1117456219

	4 rows selected.



・CDB_NAMBA
SYS@CDB_NAMBA1 SQL> @/tmp/clearlogs.sql
SYS@CDB_NAMBA1 SQL> select member from v$logfile;
	MEMBER
	------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
	+RECO/CDB_NAMBA/ONLINELOG/group_11.258.1117459107
	+RECO/CDB_NAMBA/ONLINELOG/group_12.257.1117459113
	+RECO/CDB_NAMBA/ONLINELOG/group_13.258.1117459117
	+RECO/CDB_NAMBA/ONLINELOG/group_21.260.1117459121
	+RECO/CDB_NAMBA/ONLINELOG/group_24.259.1117459127
	+RECO/CDB_NAMBA/ONLINELOG/group_23.259.1117459131
	4 rows selected.
```






# ■ Stadby Redo 作成
Standby Redo 作成する時、以下のように数とサイズを設定

	a) the size of SRLs must be the same as the size of ORLs (Online Redo Logs)
	b) (Mumber of SRLs ) = (number of ORLs + 1) for each primary thread.


## ● Prmary/Standby Database で Stadby Redo 作成
### 1) Stadby Redo 作成

**・CDB_TOKYO**
```
-- thread 1
alter database add standby logfile thread 1 group 111 '+RECO/CDB_TOKYO/ONLINELOG/standby_group_111' SIZE 1024M;
alter database add standby logfile thread 1 group 112 '+RECO/CDB_TOKYO/ONLINELOG/standby_group_112' SIZE 1024M;
alter database add standby logfile thread 1 group 113 '+RECO/CDB_TOKYO/ONLINELOG/standby_group_113' SIZE 1024M;
alter database add standby logfile thread 1 group 114 '+RECO/CDB_TOKYO/ONLINELOG/standby_group_114' SIZE 1024M;

-- thread 2
alter database add standby logfile thread 2 group 121 '+RECO/CDB_TOKYO/ONLINELOG/standby_group_121' SIZE 1024M;
alter database add standby logfile thread 2 group 122 '+RECO/CDB_TOKYO/ONLINELOG/standby_group_122' SIZE 1024M;
alter database add standby logfile thread 2 group 123 '+RECO/CDB_TOKYO/ONLINELOG/standby_group_123' SIZE 1024M;
alter database add standby logfile thread 2 group 124 '+RECO/CDB_TOKYO/ONLINELOG/standby_group_124' SIZE 1024M;
```


**・CDB_SHIBUYA**
```
-- thread 1
alter database add standby logfile thread 1 group 111 '+RECO/CDB_SHIBUYA/ONLINELOG/standby_group_111' SIZE 1024M;
alter database add standby logfile thread 1 group 112 '+RECO/CDB_SHIBUYA/ONLINELOG/standby_group_112' SIZE 1024M;
alter database add standby logfile thread 1 group 113 '+RECO/CDB_SHIBUYA/ONLINELOG/standby_group_113' SIZE 1024M;
alter database add standby logfile thread 1 group 114 '+RECO/CDB_SHIBUYA/ONLINELOG/standby_group_114' SIZE 1024M;

-- thread 2
alter database add standby logfile thread 2 group 121 '+RECO/CDB_SHIBUYA/ONLINELOG/standby_group_121' SIZE 1024M;
alter database add standby logfile thread 2 group 122 '+RECO/CDB_SHIBUYA/ONLINELOG/standby_group_122' SIZE 1024M;
alter database add standby logfile thread 2 group 123 '+RECO/CDB_SHIBUYA/ONLINELOG/standby_group_123' SIZE 1024M;
alter database add standby logfile thread 2 group 124 '+RECO/CDB_SHIBUYA/ONLINELOG/standby_group_124' SIZE 1024M;
```


**・CDB_OSAKA**
```
-- thread 1
alter database add standby logfile thread 1 group 111 '+RECO/CDB_OSAKA/ONLINELOG/standby_group_111' SIZE 1024M;
alter database add standby logfile thread 1 group 112 '+RECO/CDB_OSAKA/ONLINELOG/standby_group_112' SIZE 1024M;
alter database add standby logfile thread 1 group 113 '+RECO/CDB_OSAKA/ONLINELOG/standby_group_113' SIZE 1024M;
alter database add standby logfile thread 1 group 114 '+RECO/CDB_OSAKA/ONLINELOG/standby_group_114' SIZE 1024M;

-- thread 2
alter database add standby logfile thread 2 group 121 '+RECO/CDB_OSAKA/ONLINELOG/standby_group_121' SIZE 1024M;
alter database add standby logfile thread 2 group 122 '+RECO/CDB_OSAKA/ONLINELOG/standby_group_122' SIZE 1024M;
alter database add standby logfile thread 2 group 123 '+RECO/CDB_OSAKA/ONLINELOG/standby_group_123' SIZE 1024M;
alter database add standby logfile thread 2 group 124 '+RECO/CDB_OSAKA/ONLINELOG/standby_group_124' SIZE 1024M;
```

**・CDB_NAMBA**
```
-- thread 1
alter database add standby logfile thread 1 group 111 '+RECO/CDB_NAMBA/ONLINELOG/standby_group_111' SIZE 1024M;
alter database add standby logfile thread 1 group 112 '+RECO/CDB_NAMBA/ONLINELOG/standby_group_112' SIZE 1024M;
alter database add standby logfile thread 1 group 113 '+RECO/CDB_NAMBA/ONLINELOG/standby_group_113' SIZE 1024M;
alter database add standby logfile thread 1 group 114 '+RECO/CDB_NAMBA/ONLINELOG/standby_group_114' SIZE 1024M;

-- thread 2
alter database add standby logfile thread 2 group 121 '+RECO/CDB_NAMBA/ONLINELOG/standby_group_121' SIZE 1024M;
alter database add standby logfile thread 2 group 122 '+RECO/CDB_NAMBA/ONLINELOG/standby_group_122' SIZE 1024M;
alter database add standby logfile thread 2 group 123 '+RECO/CDB_NAMBA/ONLINELOG/standby_group_123' SIZE 1024M;
alter database add standby logfile thread 2 group 124 '+RECO/CDB_NAMBA/ONLINELOG/standby_group_124' SIZE 1024M;
```


### 2) Redo Log確認

・CDB_TOKYO
```
SQL> col MEMBER format a60
SQL> SELECT
	b.THREAD#
	,a.GROUP#
	,a.MEMBER
	,b.bytes/1024/1024 as "Bytes(MB)"
	,a.TYPE
	,b.STATUS
FROM
	v$logfile a
	,V$STANDBY_LOG  b
WHERE
	a.GROUP#=b.GROUP#
union
SELECT
		b.THREAD#
		,a.GROUP#
		,a.MEMBER
		,b.bytes/1024/1024 as "Bytes(MB)"
		,a.TYPE
		,b.STATUS
	FROM
		v$logfile a
		,v$log b
	WHERE
		a.GROUP#=b.GROUP#
	ORDER BY GROUP#;

	THREAD#     GROUP# MEMBER							    Bytes(MB) TYPE    STATUS
	---------- ---------- ------------------------------------------------------------ ---------- ------- ----------------
		1	    11 +RECO/CDB_TOKYO/ONLINELOG/group_1.258.1117284581			 1024 ONLINE  INACTIVE
		1	    12 +RECO/CDB_TOKYO/ONLINELOG/group_2.257.1117284585			 1024 ONLINE  CURRENT
		1	    13 +RECO/CDB_TOKYO/ONLINELOG/group_2.257.1117284589			 1024 ONLINE  INACTIVE
		2	    21 +RECO/CDB_TOKYO/ONLINELOG/group_3.259.1117284997			 1024 ONLINE  INACTIVE
		2	    22 +RECO/CDB_TOKYO/ONLINELOG/group_4.260.1117285003			 1024 ONLINE  CURRENT
		2	    23 +RECO/CDB_TOKYO/ONLINELOG/group_4.260.1117285007			 1024 ONLINE  INACTIVE
		1	  111 +RECO/CDB_TOKYO/ONLINELOG/standby_group_111			 1024 STANDBY UNASSIGNED
		1	  112 +RECO/CDB_TOKYO/ONLINELOG/standby_group_112			 1024 STANDBY UNASSIGNED
		1	  113 +RECO/CDB_TOKYO/ONLINELOG/standby_group_113			 1024 STANDBY UNASSIGNED
		1	  114 +RECO/CDB_TOKYO/ONLINELOG/standby_group_114			 1024 STANDBY UNASSIGNED
		2	  121 +RECO/CDB_TOKYO/ONLINELOG/standby_group_121			 1024 STANDBY UNASSIGNED
		2	  122 +RECO/CDB_TOKYO/ONLINELOG/standby_group_122			 1024 STANDBY UNASSIGNED
		2	  123 +RECO/CDB_TOKYO/ONLINELOG/standby_group_123			 1024 STANDBY UNASSIGNED
		2	  124 +RECO/CDB_TOKYO/ONLINELOG/standby_group_124			 1024 STANDBY UNASSIGNED

	12 rows selected.
```

・CDB_SHIBUYA
```
	THREAD#     GROUP# MEMBER							    Bytes(MB) TYPE    STATUS
	---------- ---------- ------------------------------------------------------------ ---------- ------- ----------------
		1	    11 +RECO/CDB_SHIBUYA/ONLINELOG/group_11.260.1117365873		 1024 ONLINE  UNUSED
		1	    12 +RECO/CDB_SHIBUYA/ONLINELOG/group_12.259.1117365879		 1024 ONLINE  UNUSED
		1	    13 +RECO/CDB_SHIBUYA/ONLINELOG/group_13.259.1117365879		 1024 ONLINE  UNUSED
		2	    21 +RECO/CDB_SHIBUYA/ONLINELOG/group_21.258.1117365885		 1024 ONLINE  UNUSED
		2	    22 +RECO/CDB_SHIBUYA/ONLINELOG/group_22.257.1117365893		 1024 ONLINE  UNUSED
		2	    23 +RECO/CDB_SHIBUYA/ONLINELOG/group_23.258.1117365885		 1024 ONLINE  UNUSED
		1	  111 +RECO/CDB_SHIBUYA/ONLINELOG/standby_group_111			 1024 STANDBY UNASSIGNED
		1	  112 +RECO/CDB_SHIBUYA/ONLINELOG/standby_group_112			 1024 STANDBY UNASSIGNED
		1	  113 +RECO/CDB_SHIBUYA/ONLINELOG/standby_group_113			 1024 STANDBY UNASSIGNED
		1	  114 +RECO/CDB_SHIBUYA/ONLINELOG/standby_group_114			 1024 STANDBY UNASSIGNED
		2	  121 +RECO/CDB_SHIBUYA/ONLINELOG/standby_group_121			 1024 STANDBY UNASSIGNED
		2	  122 +RECO/CDB_SHIBUYA/ONLINELOG/standby_group_122			 1024 STANDBY UNASSIGNED
		2	  123 +RECO/CDB_SHIBUYA/ONLINELOG/standby_group_123			 1024 STANDBY UNASSIGNED
		2	  124 +RECO/CDB_SHIBUYA/ONLINELOG/standby_group_124			 1024 STANDBY UNASSIGNED

	12 rows selected.
```


・CDB_OSAKA
```
	THREAD#     GROUP# MEMBER							    Bytes(MB) TYPE    STATUS
	---------- ---------- ------------------------------------------------------------ ---------- ------- ----------------
		1	    11 +RECO/CDB_OSAKA/ONLINELOG/group_11.267.1117456199			 1024 ONLINE  UNUSED
		1	    12 +RECO/CDB_OSAKA/ONLINELOG/group_12.266.1117456207			 1024 ONLINE  UNUSED
		1	    13 +RECO/CDB_OSAKA/ONLINELOG/group_13.266.1117456213			 1024 ONLINE  UNUSED
		2	    21 +RECO/CDB_OSAKA/ONLINELOG/group_21.271.1117456215			 1024 ONLINE  UNUSED
		2	    22 +RECO/CDB_OSAKA/ONLINELOG/group_22.272.1117456223			 1024 ONLINE  UNUSED
		2	    23 +RECO/CDB_OSAKA/ONLINELOG/group_23.272.1117456225			 1024 ONLINE  UNUSED
		1	  111 +RECO/CDB_OSAKA/ONLINELOG/standby_group_111			 1024 STANDBY UNASSIGNED
		1	  112 +RECO/CDB_OSAKA/ONLINELOG/standby_group_112			 1024 STANDBY ACTIVE
		1	  113 +RECO/CDB_OSAKA/ONLINELOG/standby_group_113			 1024 STANDBY UNASSIGNED
		1	  114 +RECO/CDB_OSAKA/ONLINELOG/standby_group_114			 1024 STANDBY UNASSIGNED
		2	  121 +RECO/CDB_OSAKA/ONLINELOG/standby_group_121			 1024 STANDBY UNASSIGNED
		2	  122 +RECO/CDB_OSAKA/ONLINELOG/standby_group_122			 1024 STANDBY ACTIVE
		2	  123 +RECO/CDB_OSAKA/ONLINELOG/standby_group_123			 1024 STANDBY UNASSIGNED
		2	  124 +RECO/CDB_OSAKA/ONLINELOG/standby_group_124			 1024 STANDBY UNASSIGNED

	12 rows selected.
```



・CDB_NAMBA
```
	THREAD#     GROUP# MEMBER							    Bytes(MB) TYPE    STATUS
	---------- ---------- ------------------------------------------------------------ ---------- ------- ----------------
		1	    11 +RECO/CDB_NAMBA/ONLINELOG/group_11.258.1117459107			 1024 ONLINE  CURRENT
		1	    12 +RECO/CDB_NAMBA/ONLINELOG/group_12.257.1117459113			 1024 ONLINE  UNUSED
		1	    13 +RECO/CDB_NAMBA/ONLINELOG/group_13.257.1117459115			 1024 ONLINE  UNUSED
		2	    21 +RECO/CDB_NAMBA/ONLINELOG/group_11.260.1117459121			 1024 ONLINE  CURRENT
		2	    22 +RECO/CDB_NAMBA/ONLINELOG/group_12.259.1117459127			 1024 ONLINE  UNUSED
		2	    23 +RECO/CDB_NAMBA/ONLINELOG/group_13.259.1117459129			 1024 ONLINE  UNUSED
		1	  111 +RECO/CDB_NAMBA/ONLINELOG/standby_group_111			 1024 STANDBY UNASSIGNED
		1	  112 +RECO/CDB_NAMBA/ONLINELOG/standby_group_112			 1024 STANDBY UNASSIGNED
		1	  113 +RECO/CDB_NAMBA/ONLINELOG/standby_group_113			 1024 STANDBY UNASSIGNED
		1	  114 +RECO/CDB_NAMBA/ONLINELOG/standby_group_114			 1024 STANDBY UNASSIGNED
		2	  121 +RECO/CDB_NAMBA/ONLINELOG/standby_group_121			 1024 STANDBY UNASSIGNED
		2	  122 +RECO/CDB_NAMBA/ONLINELOG/standby_group_122			 1024 STANDBY UNASSIGNED
		2	  123 +RECO/CDB_NAMBA/ONLINELOG/standby_group_123			 1024 STANDBY UNASSIGNED
		2	  124 +RECO/CDB_NAMBA/ONLINELOG/standby_group_124			 1024 STANDBY UNASSIGNED

	12 rows selected.
```


# ■ 手順8:Data Guard Brokerを構成
## ● dg_broker_config_fileパラメータ有効
プライマリ・データベースとスタンバイ・データベースで、dg_broker_config_fileパラメータを有効にします。

```:コマンド
SQL> create pfile='/tmp/init<db_unique_name>.ora_nonDG' from spfile;
SQL> alter system set dg_broker_config_file1=’+DATA/<db_unique_name>/dr1.dat’; 
SQL> alter system set dg_broker_config_file2=’+RECO/<db_unique_name>/dr2.dat’;
```


**・実行例**

```:Primary(CDB_TOKYO)
SYS@CDB_TOKYO1 SQL> create pfile='/tmp/initCDB_TOKYO.ora_nonDG' from spfile;

	File created.

SYS@CDB_TOKYO1 SQL> host cat /tmp/initCDB_TOKYO.ora_nonDG
		CDB1.__data_transfer_cache_size=0
		CDB2.__data_transfer_cache_size=0
		CDB2.__db_cache_size=28588376064
		CDB1.__db_cache_size=28454158336
		CDB1.__inmemory_ext_roarea=0
		CDB2.__inmemory_ext_roarea=0
		CDB1.__inmemory_ext_rwarea=0
		CDB2.__inmemory_ext_rwarea=0
		CDB2.__java_pool_size=0
		CDB1.__java_pool_size=134217728
		CDB1.__large_pool_size=201326592
		CDB2.__large_pool_size=201326592
		CDB1.__oracle_base='/u01/app/oracle'#ORACLE_BASE set from environment
		CDB2.__oracle_base='/u01/app/oracle'#ORACLE_BASE set from environment
		CDB1.__pga_aggregate_target=8187281408
		CDB2.__pga_aggregate_target=8187281408
		CDB1.__sga_target=32749125632
		CDB2.__sga_target=32749125632
		CDB1.__shared_io_pool_size=134217728
		CDB2.__shared_io_pool_size=134217728
		CDB1.__shared_pool_size=3623878656
		CDB2.__shared_pool_size=3623878656
		CDB1.__streams_pool_size=0
		CDB2.__streams_pool_size=0
		CDB1.__unified_pga_pool_size=0
		CDB2.__unified_pga_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=20
		*._gc_undo_affinity=TRUE
		*.audit_file_dest='/u01/app/oracle/admin/CDB_TOKYO/adump'
		*.audit_sys_operations=TRUE
		*.audit_trail='db'
		*.cluster_database=true
		*.compatible='19.0.0.0'
		*.control_files='+RECO/CDB_TOKYO/CONTROLFILE/current.256.1117284579'
		*.control_management_pack_access='DIAGNOSTIC+TUNING'
		*.cpu_count=0
		*.cursor_sharing='EXACT'
		*.db_block_checking='OFF'
		*.db_block_checksum='TYPICAL'
		*.db_block_size=8192
		*.db_create_file_dest='+DATA'
		*.db_create_online_log_dest_1='+RECO'
		*.db_domain='clientsubnet.vcnexatokyo.oraclevcn.com'
		*.db_files=1024
		*.db_lost_write_protect='TYPICAL'
		*.db_name='CDB'
		*.db_recovery_file_dest='+RECO'
		*.db_recovery_file_dest_size=255g
		*.db_unique_name='CDB_TOKYO'
		*.diagnostic_dest='/u01/app/oracle'
		*.dispatchers='(PROTOCOL=TCP) (SERVICE=CDBXDB)'
		*.enable_ddl_logging=TRUE
		*.enable_pluggable_database=true
		*.encrypt_new_tablespaces='ALWAYS'
		*.fast_start_mttr_target=300
		*.filesystemio_options='setall'
		*.global_names=TRUE
		*.inmemory_size=0m
		family:dw_helper.instance_mode='read-only'
		CDB1.instance_number=1
		CDB2.instance_number=2
		*.local_listener='-oraagent-dummy-'
		*.log_archive_format='%t_%s_%r.dbf'
		*.log_buffer=134217728
		*.nls_language='AMERICAN'
		*.nls_territory='AMERICA'
		*.open_cursors=1000
		*.os_authent_prefix='ops$'
		*.parallel_execution_message_size=16384
		*.parallel_threads_per_cpu=2
		*.pga_aggregate_limit=15616m
		*.pga_aggregate_target=7808m
		*.processes=800
		*.remote_login_passwordfile='exclusive'
		*.session_cached_cursors=100
		*.sga_target=31232m
		*.spatial_vector_acceleration=TRUE
		*.sql92_security=TRUE
		*.tde_configuration='keystore_configuration=FILE'
		CDB2.thread=2
		CDB1.thread=1
		*.undo_retention=900
		CDB1.undo_tablespace='UNDOTBS1'
		CDB2.undo_tablespace='UNDOTBS2'
		*.use_large_pages='only'
		*.wallet_root='/opt/oracle/dcs/commonstore/wallets/CDB_TOKYO'

SYS@CDB_TOKYO1 SQL> alter system set dg_broker_config_file1='+DATA/CDB_TOKYO/dr1.dat';

	System altered.

SYS@CDB_TOKYO1 SQL> alter system set dg_broker_config_file2='+DATA/CDB_TOKYO/dr2.dat';

	System altered.

SYS@CDB_TOKYO1 SQL> show parameter dg_broker

	NAME				     TYPE	 VALUE
	------------------------------------ ----------- ------------------------------
	dg_broker_config_file1		     string	 +DATA/CDB_TOKYO/dr1.dat
	dg_broker_config_file2		     string	 +DATA/CDB_TOKYO/dr2.dat
	dg_broker_start 		     boolean	 FALSE
```


```:Standby
SYS@CDB_SHIBUYA1 SQL> create pfile='/tmp/initCDB_shibuya.ora_nonDG' from spfile;

File created.

SYS@CDB_SHIBUYA1 SQL> host cat /tmp/initCDB_shibuya.ora_nonDG
		CDB1.__data_transfer_cache_size=0
		CDB2.__data_transfer_cache_size=0
		CDB1.__db_cache_size=28454158336
		CDB2.__db_cache_size=28588376064
		CDB1.__inmemory_ext_roarea=0
		CDB2.__inmemory_ext_roarea=0
		CDB1.__inmemory_ext_rwarea=0
		CDB2.__inmemory_ext_rwarea=0
		CDB1.__java_pool_size=134217728
		CDB2.__java_pool_size=0
		CDB1.__large_pool_size=201326592
		CDB2.__large_pool_size=201326592
		CDB1.__oracle_base='/u01/app/oracle'#ORACLE_BASE set from environment
		CDB2.__oracle_base='/u01/app/oracle'#ORACLE_BASE set from environment
		CDB1.__pga_aggregate_target=8187281408
		CDB2.__pga_aggregate_target=8187281408
		CDB1.__sga_target=32749125632
		CDB2.__sga_target=32749125632
		CDB1.__shared_io_pool_size=134217728
		CDB2.__shared_io_pool_size=134217728
		CDB1.__shared_pool_size=3623878656
		CDB2.__shared_pool_size=3623878656
		CDB1.__streams_pool_size=0
		CDB2.__streams_pool_size=0
		CDB1.__unified_pga_pool_size=0
		CDB2.__unified_pga_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=20
		*._gc_undo_affinity=TRUE
		*.audit_file_dest='/u01/app/oracle/admin/CDB_SHIBUYA/adump'
		*.audit_sys_operations=TRUE
		*.audit_trail='db'
		*.cluster_database=true
		*.compatible='19.0.0.0'
		*.control_files='+RECO/CDB_SHIBUYA/CONTROLFILE/current.256.1117290029'#Restore Controlfile
		*.control_management_pack_access='DIAGNOSTIC+TUNING'
		*.cpu_count=0
		*.cursor_sharing='EXACT'
		*.db_block_checking='OFF'
		*.db_block_checksum='TYPICAL'
		*.db_block_size=8192
		*.db_create_file_dest='+DATA'
		*.db_create_online_log_dest_1='+RECO'
		*.db_domain='clientsubnet.vcnexatokyo.oraclevcn.com'
		*.db_files=1024
		*.db_lost_write_protect='TYPICAL'
		*.db_name='CDB'
		*.db_recovery_file_dest='+RECO'
		*.db_recovery_file_dest_size=255g
		*.db_unique_name='CDB_SHIBUYA'
		*.diagnostic_dest='/u01/app/oracle'
		*.dispatchers='(PROTOCOL=TCP) (SERVICE=CDBXDB)'
		*.enable_ddl_logging=TRUE
		*.enable_pluggable_database=true
		*.encrypt_new_tablespaces='ALWAYS'
		*.fast_start_mttr_target=300
		*.filesystemio_options='setall'
		*.global_names=TRUE
		*.inmemory_size=0m
		family:dw_helper.instance_mode='read-only'
		CDB1.instance_number=1
		CDB2.instance_number=2
		*.local_listener='-oraagent-dummy-'
		*.log_archive_format='%t_%s_%r.dbf'
		*.log_buffer=134217728
		*.nls_language='AMERICAN'
		*.nls_territory='AMERICA'
		*.open_cursors=1000
		*.os_authent_prefix='ops$'
		*.parallel_execution_message_size=16384
		*.parallel_threads_per_cpu=2
		*.pga_aggregate_limit=15616m
		*.pga_aggregate_target=7808m
		*.processes=800
		*.remote_login_passwordfile='exclusive'
		*.session_cached_cursors=100
		*.sga_target=31232m
		*.spatial_vector_acceleration=TRUE
		*.sql92_security=TRUE
		*.tde_configuration='keystore_configuration=FILE'
		CDB2.thread=2
		CDB1.thread=1
		*.undo_retention=900
		CDB1.undo_tablespace='UNDOTBS1'
		CDB2.undo_tablespace='UNDOTBS2'
		*.use_large_pages='only'
		*.wallet_root='/opt/oracle/dcs/commonstore/wallets/CDB_SHIBUYA'

SYS@CDB_SHIBUYA1 SQL> alter system set dg_broker_config_file1='+DATA/CDB_SHIBUYA/dr1.dat';

	System altered.

SYS@CDB_SHIBUYA1 SQL> alter system set dg_broker_config_file2='+RECO/CDB_SHIBUYA/dr2.dat';

	System altered.

SYS@CDB_SHIBUYA1 SQL> show parameter dg_broker_config

	NAME				     TYPE	 VALUE
	------------------------------------ ----------- ------------------------------
	dg_broker_config_file1		     string	 +DATA/CDB_SHIBUYA/dr1.dat
	dg_broker_config_file2		     string	 +RECO/CDB_SHIBUYA/dr2.dat
```




・CDB_OSAKA
```
SYS@CDB_OSAKA1 SQL> show parameter dg_broker_config

	NAME				     TYPE	 VALUE
	------------------------------------ ----------- ------------------------------
	dg_broker_config_file1		     string	 +DATA/CDB_OSAKA/dr1.dat
	dg_broker_config_file2		     string	 +RECO/CDB_OSAKA/dr2.dat
```



・CDB_NAMBA
```
SYS@CDB_NAMBA1 SQL> show parameter dg_broker_config

	NAME				     TYPE	 VALUE
	------------------------------------ ----------- ------------------------------
	dg_broker_config_file1		     string	 +DATA/CDB_NAMBA/dr1.dat
	dg_broker_config_file2		     string	 +RECO/CDB_NAMBA/dr2.dat
```


## ● Guard Brokerプロセス開始
・プライマリ・データベースとスタンバイ・データベースでData Guard Brokerのプロセスを開始します。
PrimaryとStandbyで実行

```:コマンド
SQL> alter system set dg_broker_start=true;
SQL> show parameter dg_broker_start
SQL> select INST_ID,pname from gv$process where pname like 'DMON%';
$ asmcmd ls +DATAC1/<db_unique_name>/dr1.dat
$ asmcmd ls +RECOC1/<db_unique_name>/dr2.dat
```

**・実行例**
```:CDB_TOKYO
SQL> alter system set dg_broker_start=true;

	System altered.

SQL> show parameter dg_broker_start

	NAME				     TYPE	 VALUE
	------------------------------------ ----------- ------------------------------
	dg_broker_start 		     boolean	 TRUE

SQL>  select INST_ID,pname from gv$process where pname like 'DMON%';

	INST_ID PNAME
	---------- -----
		1 DMON
		2 DMON

[grid@db-tokyo2 ~]$ asmcmd ls +DATA/CDB_TOKYO/dr1.dat
	dr1.dat

[grid@db-tokyo2 ~]$ asmcmd ls +DATA/CDB_TOKYO/dr2.dat
	dr2.dat
```



```:CDB_SHIBUYA
SYS@CDB_SHIBUYA1 SQL> alter system set dg_broker_start=true;

	System altered.

SYS@CDB_SHIBUYA1 SQL> show parameter dg_broker_start

	NAME				     TYPE	 VALUE
	------------------------------------ ----------- ------------------------------
	dg_broker_start 		     boolean	 TRUE

SYS@CDB_SHIBUYA1 SQL> select INST_ID,pname from gv$process where pname like 'DMON%';

	INST_ID PNAME
	---------- -----
		1 DMON
		2 DMON

[grid@db-shibuya2 ~]$ asmcmd ls +DATA/CDB_SHIBUYA/dr1.dat
	dr1.dat
[grid@db-shibuya2 ~]$ asmcmd ls +RECO/CDB_SHIBUYA/dr2.dat
	dr2.dat
```


・CDB_OSAKA
```:CDB_OSAKA
SYS@CDB_OSAKA1 SQL> alter system set dg_broker_start=true;

	System altered.

SYS@CDB_OSAKA1 SQL>  show parameter dg_broker_start

	NAME				     TYPE	 VALUE
	------------------------------------ ----------- ------------------------------
	dg_broker_start 		     boolean	 TRUE

SYS@CDB_OSAKA1 SQL> select INST_ID,pname from gv$process where pname like 'DMON%';

	INST_ID PNAME
	---------- -----
		1 DMON
		2 DMON


[grid@db-osaka2 ~]$  asmcmd ls +DATA/CDB_OSAKA/dr1.dat
	dr1.dat
[grid@db-osaka2 ~]$  asmcmd ls +RECO/CDB_OSAKA/dr2.dat
	dr2.dat
```



・CDB_NAMBA
```:CDB_NAMBA
SYS@CDB_NAMBA1 SQL> alter system set dg_broker_start=true;

	System altered.

SYS@CDB_NAMBA1 SQL> show parameter dg_broker_start

	NAME				     TYPE	 VALUE
	------------------------------------ ----------- ------------------------------
	dg_broker_start 		     boolean	 TRUE

SYS@CDB_NAMBA1 SQL> select INST_ID,pname from gv$process where pname like 'DMON%';

	INST_ID PNAME
	---------- -----
		1 DMON
		2 DMON
```	





## ● Data Guard Brokerへデータベースを登録
プライマリ・サイトでDGMGRLを使用してデータベースを登録します。

```:コマンド
$ dgmgrl sys/<sys password>@<net service name for primary database>
DGMGRL> CREATE CONFIGURATION <configuration_name> AS PRIMARY DATABASE IS <primary db_unique_name> CONNECT IDENTIFIER IS <Net Service name for primary database>;
DGMGRL> ADD DATABASE <standby db_unique_name> AS CONNECT IDENTIFIER IS <Net Service name for standby database> MAINTAINED AS PHYSICAL;
DGMGRL> enable configuration;
```

・実行例

```:Primary(CDB_TOKYO)
[oracle@db-tokyo1 ~]$  dgmgrl sys/<Password>@CDB_TOKYO
	DGMGRL for Linux: Release 19.0.0.0.0 - Production on Thu Oct 6 12:07:17 2022
	Version 19.16.0.0.0

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

	Welcome to DGMGRL, type "help" for information.
	Connected to "CDB_TOKYO"
	Connected as SYSDBA.

DGMGRL> CREATE CONFIGURATION DG_CONFIG AS PRIMARY DATABASE IS "CDB_TOKYO" CONNECT IDENTIFIER IS CDB_TOKYO;
	Configuration "dg_config" created with primary database "CDB_TOKYO"

・CDB＿SHIBUYA追加
DGMGRL> ADD DATABASE "CDB_SHIBUYA" AS CONNECT IDENTIFIER IS CDB_SHIBUYA MAINTAINED AS PHYSICAL;
	Database "CDB_SHIBUYA" added

DGMGRL> enable configuration;
	Enabled.	

DGMGRL> show configuration;

	Configuration - dg_config

	Protection Mode: MaxPerformance
	Members:
	CDB_TOKYO   - Primary database
		CDB_SHIBUYA - Physical standby database

	Fast-Start Failover:  Disabled

	Configuration Status:
	SUCCESS   (status updated 58 seconds ago)

・CDB_OSAKA追加
DGMGRL> ADD DATABASE "CDB_OSAKA" AS CONNECT IDENTIFIER IS CDB_OSAKA MAINTAINED AS PHYSICAL;
	Database "CDB_OSAKA" added
DGMGRL> enable configuration;
	Enabled.
DGMGRL> show configuration;

	Configuration - dg_config

	Protection Mode: MaxPerformance
	Members:
	CDB_TOKYO   - Primary database
		CDB_SHIBUYA - Physical standby database
		CDB_OSAKA   - Physical standby database

	Fast-Start Failover:  Disabled

	Configuration Status:
	SUCCESS   (status updated 51 seconds ago)

・CDB＿NAMBA追加
DGMGRL> ADD DATABASE "CDB_NAMBA" AS CONNECT IDENTIFIER IS CDB_NAMBA MAINTAINED AS PHYSICAL;
	Database "CDB_NAMBA" added
DGMGRL> enable configuration;
	Enabled.
DGMGRL> show configuration;

	Configuration - dg_config

	Protection Mode: MaxPerformance
	Members:
	CDB_TOKYO   - Primary database
		CDB_SHIBUYA - Physical standby database
		CDB_OSAKA   - Physical standby database
		CDB_NAMBA   - Physical standby database

	Fast-Start Failover:  Disabled

	Configuration Status:
	SUCCESS   (status updated 51 seconds ago)
```





## ● スタンバイでフラッシュバック・データベースを有効化

スタンバイ・ データベース上で実行

```:コマンド
$ dgmgrl sys/<sys password>@<net service name for primary database>
DGMGRL> edit database <standby> set state=apply-off; 
SQL> alter database flashback on;
DGMGRL> edit database <standby> set state=apply-on;
```


・実行例

```:Standby Database(CDB_SHIBUYA)
[oracle@db-shibuya1 admin]$  dgmgrl sys/<Password>@CDB_SHIBUYA
	DGMGRL for Linux: Release 19.0.0.0.0 - Production on Thu Oct 6 12:31:15 2022
	Version 19.16.0.0.0

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

	Welcome to DGMGRL, type "help" for information.
	Connected to "CDB_SHIBUYA"
	Connected as SYSDBA.

DGMGRL> edit database CDB_SHIBUYA set state=apply-off;
	Succeeded.

SYS@CDB_SHIBUYA SQL> sqlplus / as sysdba
SYS@CDB_SHIBUYA SQL> alter database flashback on;

	Database altered.

SYS@CDB_SHIBUYA SQL> select NAME, FLASHBACK_ON from gv$database;

	FLASHBACK_ON
	------------------
	YES

DGMGRL> edit database CDB_SHIBUYA set state=apply-on;
	Succeeded.
```



```:Standby Database(CDB_OSAKA)
DGMGRL> edit database CDB_OSAKA set state=apply-off;
	Succeeded.


[oracle@db-osaka1 tmp]$ sqlplus / as sysdba

SYS@CDB_OSAKA SQL> alter database flashback on;

	Database altered.

SYS@CDB_OSAKA SQL> select FLASHBACK_ON from v$database;

	FLASHBACK_ON
	------------------
	YES

DGMGRL> edit database CDB_OSAKA set state=apply-on;
	Succeeded.
```



```:Standby Database(CDB_NAMBA)
DGMGRL> edit database CDB_NAMBA set state=apply-off;
	Succeeded.

[oracle@db-namba1 admin]$ sqlplus / as sysdba

	SQL*Plus: Release 19.0.0.0.0 - Production on Fri Oct 7 13:46:53 2022
	Version 19.16.0.0.0

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


	Connected to:
	Oracle Database 19c EE Extreme Perf Release 19.0.0.0.0 - Production
	Version 19.16.0.0.0

SYS@CDB_NAMBA SQL> alter database flashback on;

	Database altered.

SYS@CDB_NAMBA SQL> select FLASHBACK_ON from v$database;

	FLASHBACK_ON
	------------------
	YES
```


# ■ 手順9:(11gのみ)静的リスナーを削除
無し



# ■ 手順10:RMANパラメータを設定
元のRMAN構成を、前に作成した/tmp/rman_setting.log の内容で置き換えます。
これにより、もっとも重要な点として、バックアッ プ構成が、スナップショットcontrolfileの場所に加えて、暗号化、圧縮、保存で置換されます。
これらの値は、スタンバイの controlfileがプライマリ・データベースからコピーされたときに失われています。

```
[oracle@exa-osaka-node1 ~]$ cat /tmp/rman_setting.log

		Recovery Manager: Release 19.0.0.0.0 - Production on Sun Sep 18 15:34:44 2022
		Version 19.15.0.0.0

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

		connected to target database: CDB (DBID=2232167610)

		RMAN>
		using target database control file instead of recovery catalog
		RMAN configuration parameters for database with db_unique_name CDB_OSAKA 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 '%F'; # default
		CONFIGURE DEVICE TYPE DISK PARALLELISM 1 BACKUP TYPE TO BACKUPSET; # default
		CONFIGURE DATAFILE BACKUP COPIES FOR DEVICE TYPE DISK TO 1; # default
		CONFIGURE ARCHIVELOG BACKUP COPIES FOR DEVICE TYPE DISK TO 1; # default
		CONFIGURE MAXSETSIZE TO UNLIMITED; # default
		CONFIGURE ENCRYPTION FOR DATABASE OFF;
		CONFIGURE ENCRYPTION ALGORITHM 'AES256';
		CONFIGURE COMPRESSION ALGORITHM 'LOW' 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 '+DATAC1/CDB_OSAKA/controlfile/snapcf_CDB.f';


[oracle@exa-osaka-node1 ~]$ rman target /

	Recovery Manager: Release 19.0.0.0.0 - Production on Mon Sep 19 05:31:33 2022
	Version 19.15.0.0.0

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

	connected to target database: CDB (DBID=2232114498, not open)

RMAN> show all;

	using target database control file instead of recovery catalog
	RMAN configuration parameters for database with db_unique_name CDB_OSAKA 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 '%F'; # default
	CONFIGURE DEVICE TYPE DISK PARALLELISM 4 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 MAXSETSIZE TO UNLIMITED; # default
	CONFIGURE ENCRYPTION FOR DATABASE OFF;
	CONFIGURE ENCRYPTION ALGORITHM 'AES256';
	CONFIGURE COMPRESSION ALGORITHM 'LOW' 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 '/u02/app/oracle/product/19.0.0.0/dbhome_1/dbs/snapcf_CDB_OSAKA1.f'; # default
```


# ■ SPFILE確認
Data Guard構成されたSPFILEを確認

・Primary(CDB_TOKYO)
```:CDB_TOKYO
SYS@CDB_TOKYO1 SQL> create pfile='/tmp/initCDB_TOKYO_DG_AFTER3.ora' from spfile;

File created.

SYS@CDB_TOKYO1 SQL> host cat /tmp/initCDB_TOKYO_DG_AFTER3.ora
	CDB1.__data_transfer_cache_size=0
	CDB2.__data_transfer_cache_size=0
	CDB1.__db_cache_size=28387049472
	CDB2.__db_cache_size=28588376064
	CDB1.__inmemory_ext_roarea=0
	CDB2.__inmemory_ext_roarea=0
	CDB1.__inmemory_ext_rwarea=0
	CDB2.__inmemory_ext_rwarea=0
	CDB1.__java_pool_size=134217728
	CDB2.__java_pool_size=0
	CDB1.__large_pool_size=201326592
	CDB2.__large_pool_size=201326592
	CDB1.__oracle_base='/u01/app/oracle'#ORACLE_BASE set from environment
	CDB2.__oracle_base='/u01/app/oracle'#ORACLE_BASE set from environment
	CDB1.__pga_aggregate_target=8187281408
	CDB2.__pga_aggregate_target=8187281408
	CDB1.__sga_target=32749125632
	CDB2.__sga_target=32749125632
	CDB1.__shared_io_pool_size=134217728
	CDB2.__shared_io_pool_size=134217728
	CDB1.__shared_pool_size=3690987520
	CDB2.__shared_pool_size=3623878656
	CDB1.__streams_pool_size=0
	CDB2.__streams_pool_size=0
	CDB1.__unified_pga_pool_size=0
	CDB2.__unified_pga_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=20
	*._gc_undo_affinity=TRUE
	*.audit_file_dest='/u01/app/oracle/admin/CDB_TOKYO/adump'
	*.audit_sys_operations=TRUE
	*.audit_trail='db'
	*.cluster_database=true
	*.compatible='19.0.0.0'
	*.control_files='+RECO/CDB_TOKYO/CONTROLFILE/current.256.1117284579'
	*.control_management_pack_access='DIAGNOSTIC+TUNING'
	*.cpu_count=0
	*.cursor_sharing='EXACT'
	*.db_block_checking='OFF'
	*.db_block_checksum='TYPICAL'
	*.db_block_size=8192
	*.db_create_file_dest='+DATA'
	*.db_create_online_log_dest_1='+RECO'
	*.db_domain='clientsubnet.vcnexatokyo.oraclevcn.com'
	*.db_files=1024
	*.db_lost_write_protect='TYPICAL'
	*.db_name='CDB'
	*.db_recovery_file_dest='+RECO'
	*.db_recovery_file_dest_size=255g
	*.db_unique_name='CDB_TOKYO'
	*.dg_broker_config_file1='+DATA/CDB_TOKYO/dr1.dat'
	*.dg_broker_config_file2='+DATA/CDB_TOKYO/dr2.dat'
	*.dg_broker_start=TRUE
	*.diagnostic_dest='/u01/app/oracle'
	*.dispatchers='(PROTOCOL=TCP) (SERVICE=CDBXDB)'
	*.enable_ddl_logging=TRUE
	*.enable_pluggable_database=true
	*.encrypt_new_tablespaces='ALWAYS'
	*.fal_server=''
	*.fast_start_mttr_target=300
	*.filesystemio_options='setall'
	*.global_names=TRUE
	*.inmemory_size=0m
	family:dw_helper.instance_mode='read-only'
	CDB1.instance_number=1
	CDB2.instance_number=2
	*.local_listener='-oraagent-dummy-'
	*.log_archive_config='dg_config=(CDB_TOKYO,CDB_SHIBUYA,CDB_OSAKA,CDB_NAMBA)'
	*.log_archive_dest_2='service="cdb_shibuya"','ASYNC NOAFFIRM delay=0 optional compression=disable max_failure=0 reopen=300 db_unique_name="CDB_SHIBUYA" net_timeout=30','valid_for=(online_logfile,all_roles)'
	*.log_archive_dest_3='service="cdb_osaka"','ASYNC NOAFFIRM delay=0 optional compression=disable max_failure=0 reopen=300 db_unique_name="CDB_OSAKA" net_timeout=30','valid_for=(online_logfile,all_roles)'
	*.log_archive_dest_4='service="cdb_namba"','ASYNC NOAFFIRM delay=0 optional compression=disable max_failure=0 reopen=300 db_unique_name="CDB_NAMBA" net_timeout=30','valid_for=(online_logfile,all_roles)'
	*.log_archive_dest_state_2='ENABLE'
	*.log_archive_dest_state_3='ENABLE'
	*.log_archive_dest_state_4='ENABLE'
	*.log_archive_format='%t_%s_%r.dbf'
	*.log_buffer=134217728
	*.nls_language='AMERICAN'
	*.nls_territory='AMERICA'
	*.open_cursors=1000
	*.os_authent_prefix='ops$'
	*.parallel_execution_message_size=16384
	*.parallel_threads_per_cpu=2
	*.pga_aggregate_limit=15616m
	*.pga_aggregate_target=7808m
	*.processes=800
	*.remote_login_passwordfile='exclusive'
	*.session_cached_cursors=100
	*.sga_target=31232m
	*.spatial_vector_acceleration=TRUE
	*.sql92_security=TRUE
	*.tde_configuration='keystore_configuration=FILE'
	CDB2.thread=2
	CDB1.thread=1
	*.undo_retention=900
	CDB1.undo_tablespace='UNDOTBS1'
	CDB2.undo_tablespace='UNDOTBS2'
	*.use_large_pages='only'
	*.wallet_root='/opt/oracle/dcs/commonstore/wallets/CDB_TOKYO'
```

・Standby(CDB_SHIBUYA)
```:CDB_SHIBUYA
SYS@CDB_SHIBUYA1 SQL> create pfile='/tmp/initCDB_SHIBUYA_DG_AFTER2.ora' from spfile;

	File created.

SYS@CDB_SHIBUYA SQL> host cat /tmp/initCDB_SHIBUYA_DG_AFTER2.ora
	CDB2.__data_transfer_cache_size=0
	CDB1.__data_transfer_cache_size=0
	CDB2.__db_cache_size=28588376064
	CDB1.__db_cache_size=28454158336
	CDB2.__inmemory_ext_roarea=0
	CDB1.__inmemory_ext_roarea=0
	CDB2.__inmemory_ext_rwarea=0
	CDB1.__inmemory_ext_rwarea=0
	CDB2.__java_pool_size=0
	CDB1.__java_pool_size=134217728
	CDB2.__large_pool_size=201326592
	CDB1.__large_pool_size=201326592
	CDB1.__oracle_base='/u01/app/oracle'#ORACLE_BASE set from environment
	CDB2.__oracle_base='/u01/app/oracle'#ORACLE_BASE set from environment
	CDB2.__pga_aggregate_target=8187281408
	CDB1.__pga_aggregate_target=8187281408
	CDB2.__sga_target=32749125632
	CDB1.__sga_target=32749125632
	CDB2.__shared_io_pool_size=134217728
	CDB1.__shared_io_pool_size=134217728
	CDB2.__shared_pool_size=3623878656
	CDB1.__shared_pool_size=3623878656
	CDB2.__streams_pool_size=0
	CDB1.__streams_pool_size=0
	CDB2.__unified_pga_pool_size=0
	CDB1.__unified_pga_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=20
	*._gc_undo_affinity=TRUE
	*.audit_file_dest='/u01/app/oracle/admin/CDB_SHIBUYA/adump'
	*.audit_sys_operations=TRUE
	*.audit_trail='db'
	*.cluster_database=true
	*.compatible='19.0.0.0'
	*.control_files='+RECO/CDB_SHIBUYA/CONTROLFILE/current.256.1117290029'#Restore Controlfile
	*.control_management_pack_access='DIAGNOSTIC+TUNING'
	*.cpu_count=0
	*.cursor_sharing='EXACT'
	*.db_block_checking='OFF'
	*.db_block_checksum='TYPICAL'
	*.db_block_size=8192
	*.db_create_file_dest='+DATA'
	*.db_create_online_log_dest_1='+RECO'
	*.db_domain='clientsubnet.vcnexatokyo.oraclevcn.com'
	*.db_files=1024
	*.db_lost_write_protect='TYPICAL'
	*.db_name='CDB'
	*.db_recovery_file_dest='+RECO'
	*.db_recovery_file_dest_size=255g
	*.db_unique_name='CDB_SHIBUYA'
	*.dg_broker_config_file1='+DATA/CDB_SHIBUYA/dr1.dat'
	*.dg_broker_config_file2='+RECO/CDB_SHIBUYA/dr2.dat'
	*.dg_broker_start=TRUE
	*.diagnostic_dest='/u01/app/oracle'
	*.dispatchers='(PROTOCOL=TCP) (SERVICE=CDBXDB)'
	*.enable_ddl_logging=TRUE
	*.enable_pluggable_database=true
	*.encrypt_new_tablespaces='ALWAYS'
	*.fal_server='cdb_tokyo','cdb_osaka','cdb_namba'
	*.fast_start_mttr_target=300
	*.filesystemio_options='setall'
	*.global_names=TRUE
	*.inmemory_size=0m
	family:dw_helper.instance_mode='read-only'
	CDB1.instance_number=1
	CDB2.instance_number=2
	*.local_listener='-oraagent-dummy-'
	*.log_archive_config='dg_config=(CDB_SHIBUYA,CDB_TOKYO,CDB_OSAKA,CDB_NAMBA)'
	*.log_archive_dest_2=''
	*.log_archive_dest_state_2='ENABLE'
	*.log_archive_format='%t_%s_%r.dbf'
	*.log_buffer=134217728
	*.nls_language='AMERICAN'
	*.nls_territory='AMERICA'
	*.open_cursors=1000
	*.os_authent_prefix='ops$'
	*.parallel_execution_message_size=16384
	*.parallel_threads_per_cpu=2
	*.pga_aggregate_limit=15616m
	*.pga_aggregate_target=7808m
	*.processes=800
	*.remote_login_passwordfile='exclusive'
	*.session_cached_cursors=100
	*.sga_target=31232m
	*.spatial_vector_acceleration=TRUE
	*.sql92_security=TRUE
	*.tde_configuration='keystore_configuration=FILE'
	CDB2.thread=2
	CDB1.thread=1
	*.undo_retention=900
	CDB1.undo_tablespace='UNDOTBS1'
	CDB2.undo_tablespace='UNDOTBS2'
	*.use_large_pages='only'
	*.wallet_root='/opt/oracle/dcs/commonstore/wallets/CDB_SHIBUYA'
```



・Standby(CDB_OSAKA)
```:CDB_OSAKA
SYS@CDB_OSAKA SQL> create pfile='/tmp/initCDB_OSAKA_DG_AFTER.ora' from spfile;

	File created.

SYS@CDB_OSAKA1 SQL> host cat /tmp/initCDB_OSAKA_DG_AFTER.ora
	CDB1.__data_transfer_cache_size=0
	CDB2.__data_transfer_cache_size=0
	CDB1.__db_cache_size=26575110144
	CDB2.__db_cache_size=26709327872
	CDB1.__inmemory_ext_roarea=0
	CDB2.__inmemory_ext_roarea=0
	CDB1.__inmemory_ext_rwarea=0
	CDB2.__inmemory_ext_rwarea=0
	CDB1.__java_pool_size=134217728
	CDB2.__java_pool_size=0
	CDB1.__large_pool_size=201326592
	CDB2.__large_pool_size=201326592
	CDB1.__oracle_base='/u01/app/oracle'#ORACLE_BASE set from environment
	CDB2.__oracle_base='/u01/app/oracle'#ORACLE_BASE set from environment
	CDB1.__pga_aggregate_target=7650410496
	CDB2.__pga_aggregate_target=7650410496
	CDB1.__sga_target=30601641984
	CDB2.__sga_target=30601641984
	CDB1.__shared_io_pool_size=134217728
	CDB2.__shared_io_pool_size=134217728
	CDB1.__shared_pool_size=3355443200
	CDB2.__shared_pool_size=3355443200
	CDB1.__streams_pool_size=0
	CDB2.__streams_pool_size=0
	CDB1.__unified_pga_pool_size=0
	CDB2.__unified_pga_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=20
	*._gc_undo_affinity=TRUE
	*.audit_file_dest='/u01/app/oracle/admin/CDB_OSAKA/adump'
	*.audit_sys_operations=TRUE
	*.audit_trail='db'
	*.cluster_database=TRUE
	*.compatible='19.0.0.0'
	*.control_files='+RECO/CDB_OSAKA/CONTROLFILE/current.256.1117381261'#Restore Controlfile
	*.control_management_pack_access='DIAGNOSTIC+TUNING'
	*.cpu_count=0
	*.cursor_sharing='EXACT'
	*.db_block_checking='OFF'
	*.db_block_checksum='TYPICAL'
	*.db_block_size=8192
	*.db_create_file_dest='+DATA'
	*.db_create_online_log_dest_1='+RECO'
	*.db_domain='clientsubnet.vcnexaosaka.oraclevcn.com'
	*.db_files=1024
	*.db_lost_write_protect='TYPICAL'
	*.db_name='CDB'
	*.db_recovery_file_dest='+RECO'
	*.db_recovery_file_dest_size=255g
	*.db_unique_name='CDB_OSAKA'
	*.dg_broker_config_file1='+DATA/CDB_OSAKA/dr1.dat'
	*.dg_broker_config_file2='+RECO/CDB_OSAKA/dr2.dat'
	*.dg_broker_start=TRUE
	*.diagnostic_dest='/u01/app/oracle'
	*.dispatchers='(PROTOCOL=TCP) (SERVICE=CDBXDB)'
	*.enable_ddl_logging=TRUE
	*.enable_pluggable_database=true
	*.encrypt_new_tablespaces='ALWAYS'
	*.fal_server='cdb_tokyo','cdb_shibuya','cdb_namba'
	*.fast_start_mttr_target=300
	*.filesystemio_options='setall'
	*.global_names=TRUE
	*.inmemory_size=0m
	family:dw_helper.instance_mode='read-only'
	CDB1.instance_number=1
	CDB2.instance_number=2
	*.local_listener='-oraagent-dummy-'
	*.log_archive_config='dg_config=(CDB_OSAKA,CDB_TOKYO,CDB_SHIBUYA,CDB_NAMBA)'
	*.log_archive_format='%t_%s_%r.dbf'
	*.log_buffer=134217728
	*.nls_language='AMERICAN'
	*.nls_territory='AMERICA'
	*.open_cursors=1000
	*.os_authent_prefix='ops$'
	*.parallel_execution_message_size=16384
	*.parallel_threads_per_cpu=2
	*.pga_aggregate_limit=14592m
	*.pga_aggregate_target=7296m
	*.processes=800
	*.remote_login_passwordfile='exclusive'
	*.session_cached_cursors=100
	*.sga_target=29184m
	*.spatial_vector_acceleration=TRUE
	*.sql92_security=TRUE
	*.tde_configuration='keystore_configuration=FILE'
	CDB2.thread=2
	CDB1.thread=1
	*.undo_retention=900
	CDB2.undo_tablespace='UNDOTBS2'
	CDB1.undo_tablespace='UNDOTBS1'
	*.use_large_pages='only'
	*.wallet_root='/opt/oracle/dcs/commonstore/wallets/CDB_OSAKA'
```


・Standby(CDB_NAMBA)
```:CDB_NAMBA
SYS@CDB_NAMBA SQL> create pfile='/tmp/initCDB_NAMAB_DG_AFTER.ora' from spfile;

	File created.

SYS@CDB_NAMBA1 SQL> host cat /tmp/initCDB_NAMAB_DG_AFTER.ora
	CDB1.__data_transfer_cache_size=0
	CDB2.__data_transfer_cache_size=0
	CDB1.__db_cache_size=28454158336
	CDB2.__db_cache_size=28588376064
	CDB1.__inmemory_ext_roarea=0
	CDB2.__inmemory_ext_roarea=0
	CDB1.__inmemory_ext_rwarea=0
	CDB2.__inmemory_ext_rwarea=0
	CDB1.__java_pool_size=134217728
	CDB2.__java_pool_size=0
	CDB1.__large_pool_size=201326592
	CDB2.__large_pool_size=201326592
	CDB1.__oracle_base='/u01/app/oracle'#ORACLE_BASE set from environment
	CDB2.__oracle_base='/u01/app/oracle'#ORACLE_BASE set from environment
	CDB1.__pga_aggregate_target=8187281408
	CDB2.__pga_aggregate_target=8187281408
	CDB1.__sga_target=32749125632
	CDB2.__sga_target=32749125632
	CDB1.__shared_io_pool_size=134217728
	CDB2.__shared_io_pool_size=134217728
	CDB1.__shared_pool_size=3623878656
	CDB2.__shared_pool_size=3623878656
	CDB1.__streams_pool_size=0
	CDB2.__streams_pool_size=0
	CDB1.__unified_pga_pool_size=0
	CDB2.__unified_pga_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=20
	*._gc_undo_affinity=TRUE
	*.audit_file_dest='/u01/app/oracle/admin/CDB_NAMBA/adump'
	*.audit_sys_operations=TRUE
	*.audit_trail='db'
	*.cluster_database=true
	*.compatible='19.0.0.0'
	*.control_files='+RECO/CDB_NAMBA/CONTROLFILE/current.256.1117284991'#Restore Controlfile
	*.control_management_pack_access='DIAGNOSTIC+TUNING'
	*.cpu_count=0
	*.cursor_sharing='EXACT'
	*.db_block_checking='OFF'
	*.db_block_checksum='TYPICAL'
	*.db_block_size=8192
	*.db_create_file_dest='+DATA'
	*.db_create_online_log_dest_1='+RECO'
	*.db_domain='clientsubnet.vcnexaosaka.oraclevcn.com'
	*.db_files=1024
	*.db_lost_write_protect='TYPICAL'
	*.db_name='CDB'
	*.db_recovery_file_dest='+RECO'
	*.db_recovery_file_dest_size=255g
	*.db_unique_name='CDB_NAMBA'
	*.dg_broker_config_file1='+DATA/CDB_NAMBA/dr1.dat'
	*.dg_broker_config_file2='+RECO/CDB_NAMBA/dr2.dat'
	*.dg_broker_start=TRUE
	*.diagnostic_dest='/u01/app/oracle'
	*.dispatchers='(PROTOCOL=TCP) (SERVICE=CDBXDB)'
	*.enable_ddl_logging=TRUE
	*.enable_pluggable_database=true
	*.encrypt_new_tablespaces='ALWAYS'
	*.fal_server='cdb_tokyo','cdb_shibuya','cdb_osaka'
	*.fast_start_mttr_target=300
	*.filesystemio_options='setall'
	*.global_names=TRUE
	*.inmemory_size=0m
	family:dw_helper.instance_mode='read-only'
	CDB1.instance_number=1
	CDB2.instance_number=2
	*.local_listener='-oraagent-dummy-'
	*.log_archive_config='dg_config=(CDB_NAMBA,CDB_TOKYO,CDB_SHIBUYA,CDB_OSAKA)'
	*.log_archive_format='%t_%s_%r.dbf'
	*.log_buffer=134217728
	*.nls_language='AMERICAN'
	*.nls_territory='AMERICA'
	*.open_cursors=1000
	*.os_authent_prefix='ops$'
	*.parallel_execution_message_size=16384
	*.parallel_threads_per_cpu=2
	*.pga_aggregate_limit=15616m
	*.pga_aggregate_target=7808m
	*.processes=800
	*.remote_login_passwordfile='exclusive'
	*.session_cached_cursors=100
	*.sga_target=31232m
	*.spatial_vector_acceleration=TRUE
	*.sql92_security=TRUE
	*.tde_configuration='keystore_configuration=FILE'
	CDB2.thread=2
	CDB1.thread=1
	*.undo_retention=900
	CDB2.undo_tablespace='UNDOTBS2'
	CDB1.undo_tablespace='UNDOTBS1'
	*.use_large_pages='only'
	*.wallet_root='/opt/oracle/dcs/commonstore/wallets/CDB_NAMBA'
```


# ■ 構成確認
## ● 現在の保護モード確認

```:Primary
DGMGRL> show configuration;

	Configuration - dg_config

	Protection Mode: MaxPerformance
	Members:
	CDB_TOKYO   - Primary database
		CDB_SHIBUYA - Physical standby database

	Fast-Start Failover:  Disabled

	Configuration Status:
	SUCCESS   (status updated 58 seconds ago)

DGMGRL> show configuration verbose

	Configuration - dg_config

	Protection Mode: MaxPerformance
	Members:
	CDB_TOKYO   - Primary database
		CDB_SHIBUYA - Physical standby database

	Properties:
		FastStartFailoverThreshold      = '30'
		OperationTimeout                = '30'
		TraceLevel                      = 'USER'
		FastStartFailoverLagLimit       = '30'
		CommunicationTimeout            = '180'
		ObserverReconnect               = '0'
		FastStartFailoverAutoReinstate  = 'TRUE'
		FastStartFailoverPmyShutdown    = 'TRUE'
		BystandersFollowRoleChange      = 'ALL'
		ObserverOverride                = 'FALSE'
		ExternalDestination1            = ''
		ExternalDestination2            = ''
		PrimaryLostWriteAction          = 'CONTINUE'
		ConfigurationWideServiceName    = 'CDB_CFG'

	Fast-Start Failover:  Disabled

	Configuration Status:
	SUCCESS

```


## ● DB確認

・CDB_TOKYO確認
```：Primary
DGMGRL> show database CDB_TOKYO

	Database - CDB_TOKYO

	Role:               PRIMARY
	Intended State:     TRANSPORT-ON
	Instance(s):
		CDB1
		CDB2

	Database Status:
	SUCCESS


DGMGRL>  show database verbose  CDB_TOKYO

	Database - CDB_TOKYO

	Role:               PRIMARY
	Intended State:     TRANSPORT-ON
	Instance(s):
		CDB1
		CDB2

	Properties:
		DGConnectIdentifier             = 'cdb_tokyo'
		ObserverConnectIdentifier       = ''
		FastStartFailoverTarget         = ''
		PreferredObserverHosts          = ''
		LogShipping                     = 'ON'
		RedoRoutes                      = ''
		LogXptMode                      = 'ASYNC'
		DelayMins                       = '0'
		Binding                         = 'optional'
		MaxFailure                      = '0'
		ReopenSecs                      = '300'
		NetTimeout                      = '30'
		RedoCompression                 = 'DISABLE'
		PreferredApplyInstance          = ''
		ApplyInstanceTimeout            = '0'
		ApplyLagThreshold               = '30'
		TransportLagThreshold           = '30'
		TransportDisconnectedThreshold  = '30'
		ApplyParallel                   = 'AUTO'
		ApplyInstances                  = '0'
		StandbyFileManagement           = ''
		ArchiveLagTarget                = '0'
		LogArchiveMaxProcesses          = '0'
		LogArchiveMinSucceedDest        = '0'
		DataGuardSyncLatency            = '0'
		LogArchiveTrace                 = '0'
		LogArchiveFormat                = ''
		DbFileNameConvert               = ''
		LogFileNameConvert              = ''
		ArchiveLocation                 = ''
		AlternateLocation               = ''
		StandbyArchiveLocation          = ''
		StandbyAlternateLocation        = ''
		InconsistentProperties          = '(monitor)'
		InconsistentLogXptProps         = '(monitor)'
		LogXptStatus                    = '(monitor)'
		SendQEntries                    = '(monitor)'
		RecvQEntries                    = '(monitor)'
		HostName(*)
		StaticConnectIdentifier(*)
		TopWaitEvents(*)
		SidName(*)
		(*) - Please check specific instance for the property value

	Log file locations(*):
		(*) - Check specific instance for log file locations.

	Database Status:
	SUCCESS
```




・CDB_SHIBUYA確認
```:Primary
DGMGRL>  show database  CDB_SHIBUYA

	Database - CDB_SHIBUYA

	Role:               PHYSICAL STANDBY
	Intended State:     APPLY-ON
	Transport Lag:      0 seconds (computed 1 second ago)
	Apply Lag:          0 seconds (computed 1 second ago)
	Average Apply Rate: 4.00 KByte/s
	Real Time Query:    ON
	Instance(s):
		CDB1
		CDB2 (apply instance)

	Database Status:
	SUCCESS

DGMGRL> show database verbose  CDB_SHIBUYA

	Database - CDB_SHIBUYA

	Role:               PHYSICAL STANDBY
	Intended State:     APPLY-ON
	Transport Lag:      0 seconds (computed 0 seconds ago)
	Apply Lag:          0 seconds (computed 0 seconds ago)
	Average Apply Rate: 4.00 KByte/s
	Active Apply Rate:  1.00 MByte/s
	Maximum Apply Rate: 1.67 MByte/s
	Real Time Query:    OFF
	Instance(s):
		CDB1
		CDB2 (apply instance)

	Properties:
		DGConnectIdentifier             = 'cdb_shibuya'
		ObserverConnectIdentifier       = ''
		FastStartFailoverTarget         = ''
		PreferredObserverHosts          = ''
		LogShipping                     = 'ON'
		RedoRoutes                      = ''
		LogXptMode                      = 'ASYNC'
		DelayMins                       = '0'
		Binding                         = 'optional'
		MaxFailure                      = '0'
		ReopenSecs                      = '300'
		NetTimeout                      = '30'
		RedoCompression                 = 'DISABLE'
		PreferredApplyInstance          = ''
		ApplyInstanceTimeout            = '0'
		ApplyLagThreshold               = '30'
		TransportLagThreshold           = '30'
		TransportDisconnectedThreshold  = '30'
		ApplyParallel                   = 'AUTO'
		ApplyInstances                  = '0'
		StandbyFileManagement           = ''
		ArchiveLagTarget                = '0'
		LogArchiveMaxProcesses          = '0'
		LogArchiveMinSucceedDest        = '0'
		DataGuardSyncLatency            = '0'
		LogArchiveTrace                 = '0'
		LogArchiveFormat                = ''
		DbFileNameConvert               = ''
		LogFileNameConvert              = ''
		ArchiveLocation                 = ''
		AlternateLocation               = ''
		StandbyArchiveLocation          = ''
		StandbyAlternateLocation        = ''
		InconsistentProperties          = '(monitor)'
		InconsistentLogXptProps         = '(monitor)'
		LogXptStatus                    = '(monitor)'
		SendQEntries                    = '(monitor)'
		RecvQEntries                    = '(monitor)'
		HostName(*)
		StaticConnectIdentifier(*)
		TopWaitEvents(*)
		SidName(*)
		(*) - Please check specific instance for the property value

	Log file locations(*):
		(*) - Check specific instance for log file locations.

	Database Status:
	SUCCESS
```



・CDB_OSAKA確認
```:Primary
DGMGRL> show database CDB_OSAKA

	Database - CDB_OSAKA

	Role:               PHYSICAL STANDBY
	Intended State:     APPLY-ON
	Transport Lag:      0 seconds (computed 0 seconds ago)
	Apply Lag:          0 seconds (computed 0 seconds ago)
	Average Apply Rate: 2.00 KByte/s
	Real Time Query:    OFF
	Instance(s):
		CDB1
		CDB2 (apply instance)

	Database Status:
	SUCCESS

DGMGRL> show database verbose CDB_OSAKA

	Database - CDB_OSAKA

	Role:               PHYSICAL STANDBY
	Intended State:     APPLY-ON
	Transport Lag:      0 seconds (computed 0 seconds ago)
	Apply Lag:          0 seconds (computed 0 seconds ago)
	Average Apply Rate: 2.00 KByte/s
	Active Apply Rate:  56.00 KByte/s
	Maximum Apply Rate: 56.00 KByte/s
	Real Time Query:    OFF
	Instance(s):
		CDB1
		CDB2 (apply instance)

	Properties:
		DGConnectIdentifier             = 'cdb_osaka'
		ObserverConnectIdentifier       = ''
		FastStartFailoverTarget         = ''
		PreferredObserverHosts          = ''
		LogShipping                     = 'ON'
		RedoRoutes                      = ''
		LogXptMode                      = 'ASYNC'
		DelayMins                       = '0'
		Binding                         = 'optional'
		MaxFailure                      = '0'
		ReopenSecs                      = '300'
		NetTimeout                      = '30'
		RedoCompression                 = 'DISABLE'
		PreferredApplyInstance          = ''
		ApplyInstanceTimeout            = '0'
		ApplyLagThreshold               = '30'
		TransportLagThreshold           = '30'
		TransportDisconnectedThreshold  = '30'
		ApplyParallel                   = 'AUTO'
		ApplyInstances                  = '0'
		StandbyFileManagement           = ''
		ArchiveLagTarget                = '0'
		LogArchiveMaxProcesses          = '0'
		LogArchiveMinSucceedDest        = '0'
		DataGuardSyncLatency            = '0'
		LogArchiveTrace                 = '0'
		LogArchiveFormat                = ''
		DbFileNameConvert               = ''
		LogFileNameConvert              = ''
		ArchiveLocation                 = ''
		AlternateLocation               = ''
		StandbyArchiveLocation          = ''
		StandbyAlternateLocation        = ''
		InconsistentProperties          = '(monitor)'
		InconsistentLogXptProps         = '(monitor)'
		LogXptStatus                    = '(monitor)'
		SendQEntries                    = '(monitor)'
		RecvQEntries                    = '(monitor)'
		HostName(*)
		StaticConnectIdentifier(*)
		TopWaitEvents(*)
		SidName(*)
		(*) - Please check specific instance for the property value

	Log file locations(*):
		(*) - Check specific instance for log file locations.

	Database Status:
	SUCCESS
```



・CDB_NAMBA確認
```:Primary
DGMGRL> show database CDB_NAMBA

	Database - CDB_NAMBA

	Role:               PHYSICAL STANDBY
	Intended State:     APPLY-ON
	Transport Lag:      0 seconds (computed 0 seconds ago)
	Apply Lag:          0 seconds (computed 0 seconds ago)
	Average Apply Rate: 2.00 KByte/s
	Real Time Query:    OFF
	Instance(s):
		CDB1
		CDB2 (apply instance)

	Database Status:
	SUCCESS

DGMGRL> show database verbose CDB_NAMBA

	Database - CDB_NAMBA

	Role:               PHYSICAL STANDBY
	Intended State:     APPLY-ON
	Transport Lag:      0 seconds (computed 1 second ago)
	Apply Lag:          0 seconds (computed 1 second ago)
	Average Apply Rate: 2.00 KByte/s
	Active Apply Rate:  60.00 KByte/s
	Maximum Apply Rate: 60.00 KByte/s
	Real Time Query:    OFF
	Instance(s):
		CDB1
		CDB2 (apply instance)

	Properties:
		DGConnectIdentifier             = 'cdb_namba'
		ObserverConnectIdentifier       = ''
		FastStartFailoverTarget         = ''
		PreferredObserverHosts          = ''
		LogShipping                     = 'ON'
		RedoRoutes                      = ''
		LogXptMode                      = 'ASYNC'
		DelayMins                       = '0'
		Binding                         = 'optional'
		MaxFailure                      = '0'
		ReopenSecs                      = '300'
		NetTimeout                      = '30'
		RedoCompression                 = 'DISABLE'
		PreferredApplyInstance          = ''
		ApplyInstanceTimeout            = '0'
		ApplyLagThreshold               = '30'
		TransportLagThreshold           = '30'
		TransportDisconnectedThreshold  = '30'
		ApplyParallel                   = 'AUTO'
		ApplyInstances                  = '0'
		StandbyFileManagement           = ''
		ArchiveLagTarget                = '0'
		LogArchiveMaxProcesses          = '0'
		LogArchiveMinSucceedDest        = '0'
		DataGuardSyncLatency            = '0'
		LogArchiveTrace                 = '0'
		LogArchiveFormat                = ''
		DbFileNameConvert               = ''
		LogFileNameConvert              = ''
		ArchiveLocation                 = ''
		AlternateLocation               = ''
		StandbyArchiveLocation          = ''
		StandbyAlternateLocation        = ''
		InconsistentProperties          = '(monitor)'
		InconsistentLogXptProps         = '(monitor)'
		LogXptStatus                    = '(monitor)'
		SendQEntries                    = '(monitor)'
		RecvQEntries                    = '(monitor)'
		HostName(*)
		StaticConnectIdentifier(*)
		TopWaitEvents(*)
		SidName(*)
		(*) - Please check specific instance for the property value

	Log file locations(*):
		(*) - Check specific instance for log file locations.

	Database Status:
	SUCCESS
```




# ■ Active Datagurd 設定
Standby DBを　Read (Real Time Query)できるように設定

### 1) 確認
Real Time QueryがOFFであることを確認

```:Primary
DGMGRL> show database CDB_SHIBUYA

	Database - CDB_SHIBUYA

	Role:               PHYSICAL STANDBY
	Intended State:     APPLY-ON
	Transport Lag:      0 seconds (computed 0 seconds ago)
	Apply Lag:          0 seconds (computed 0 seconds ago)
	Average Apply Rate: 4.00 KByte/s
	Real Time Query:    OFF
	Instance(s):
		CDB1 (apply instance)
		CDB2

	Database Status:
	SUCCESS
```

### 2) Redo Apply停止

```:Primary
DGMGRL> edit database CDB_SHIBUYA set state=apply-off;
DGMGRL> edit database CDB_OSAKA set state=apply-off;
DGMGRL> edit database CDB_NAMBA set state=apply-off;
	Succeeded.
```


### 3) Real Time Query ON
Standby Database を Open

```:Standby
SYS@CDB_SHIBUYA SQL> alter database open;

	Database altered.
```


### 4) Redo Apply起動
```:Primary
DGMGRL> edit database CDB_SHIBUYA set state=apply-on;
DGMGRL> edit database CDB_OSAKA set state=apply-on;
DGMGRL> edit database CDB_NAMBA set state=apply-on;
```

### 5) 設定確認
・CDB＿SHIBUYA確認
Intended State が APPLY-ON であることを確認

```:Primary
DGMGRL> show database CDB_SHIBUYA

	Database - CDB_SHIBUYA

	Role:               PHYSICAL STANDBY
	Intended State:     APPLY-ON
	Transport Lag:      0 seconds (computed 1 second ago)
	Apply Lag:          0 seconds (computed 1 second ago)
	Average Apply Rate: 126.00 KByte/s
	Real Time Query:    ON
	Instance(s):
		CDB1
		CDB2 (apply instance)

	Database Status:
	SUCCESS
```


・CDB_OSAKA確認
```:Primary
DGMGRL> show database CDB_OSAKA

	Database - CDB_OSAKA

	Role:               PHYSICAL STANDBY
	Intended State:     APPLY-ON
	Transport Lag:      0 seconds (computed 1 second ago)
	Apply Lag:          0 seconds (computed 1 second ago)
	Average Apply Rate: 348.00 KByte/s
	Real Time Query:    ON
	Instance(s):
		CDB1 (apply instance)
		CDB2

	Database Status:
	SUCCESS
```


・CDB_NAMBA確認
```:Primary
DGMGRL> show database CDB_NAMBA

	Database - CDB_NAMBA

	Role:               PHYSICAL STANDBY
	Intended State:     APPLY-ON
	Transport Lag:      0 seconds (computed 1 second ago)
	Apply Lag:          0 seconds (computed 1 second ago)
	Average Apply Rate: 80.00 KByte/s
	Real Time Query:    ON
	Instance(s):
		CDB1 (apply instance)
		CDB2

	Database Status:
	SUCCESS
```


## ● Active Data Guard 確認
Primary Databaseのトランザクジョン(テーブル作成、データInsert) がStandby Databaseへ伝搬することを確認

・Primary: CDB_TOKYO

```:Primary
SYS@CDB_TOKYO1 SQL> CREATE TABLE test_table1 (id number(3), name varchar2(10)) TABLESPACE USERS;

SYS@CDB_TOKYO1 SQL> select * from test_table1;

	no rows selected

SYS@CDB_TOKYO1 SQL> INSERT INTO test_table1  VALUES (1,'AAA');

	1 row created.

SYS@CDB_TOKYO1 SQL> commit;

	Commit complete.

SYS@CDB_TOKYO1 SQL> select * from test_table1;

		ID NAME
	---------- ----------
		1 AAA
```


・CDB_SHIBUYA
```
SYS@CDB_SHIBUYA1 SQL> select * from test_table1;

		ID NAME
	---------- ----------
		1 AAA
```


・CDB_OSAKA
```
SYS@CDB_OSAKA1 SQL> select * from test_table1;

		ID NAME
	---------- ----------
		1 AAA
```

 ・CDB_NAMBA
```
 SYS@CDB_NAMBA1 SQL> select * from test_table1;

		ID NAME
	---------- ----------
		1 AAA
```


# ■ Switchover
スイッチオーバーを実行するには、Data Guard Brokerで以下のコマンドを実行します。
```
DGMGRL> validate database stby;
	Database Role:Physical standby database Primary Database: pri
	Ready for Switchover:Yes
	Ready for Failover:Yes (Primary Running) DGMGRL> switchover to <target standby>;
DGMGRL> switchover to <target standby>;
```


## ● Switchover実行前確認


・Primary (CDB_TOKYO) パラメーター確認

```:CDB_TOKYO
SYS@CDB_TOKYO SQL> show parameter archive

	NAME				     TYPE	 VALUE
	------------------------------------ ----------- ------------------------------
	archive_lag_target		     integer	 0
	log_archive_config		     string	 dg_config=(CDB_TOKYO,CDB_SHIBUYA,CDB_OSAKA,CDB_NAMBA)
	log_archive_dest		     string
	log_archive_dest_1		     string
	log_archive_dest_2		     string	 service="cdb_shibuya", ASYNC N
							OAFFIRM delay=0 optional compr
							ession=disable max_failure=0 r
							eopen=300 db_unique_name="CDB_
							SHIBUYA" net_timeout=30, valid
							_for=(online_logfile,all_roles
							)

	log_archive_dest_3		     string	 service="cdb_osaka", ASYNC NOA
							FFIRM delay=0 optional compres
							sion=disable max_failure=0 reo
							pen=300 db_unique_name="CDB_OS
							AKA" net_timeout=30, valid_for
							=(online_logfile,all_roles)

	log_archive_dest_4		     string	 service="cdb_namba", ASYNC NOA
							FFIRM delay=0 optional compres
							sion=disable max_failure=0 reo
							pen=300 db_unique_name="CDB_NA
							MBA" net_timeout=30, valid_for
							=(online_logfile,all_roles)

	log_archive_dest_state_1	     string	 enable
	log_archive_dest_state_2	     string	 ENABLE
	log_archive_dest_state_3	     string	 ENABLE
	log_archive_duplex_dest 	     string
	log_archive_format		     string	 %t_%s_%r.dbf
	log_archive_max_processes	     integer	 4
	log_archive_min_succeed_dest	     integer	 1
	log_archive_start		     boolean	 FALSE
	log_archive_trace		     integer	 0


・Standby (CDB_SHIBUYA) パラメーター確認
```:CDB_SHIBUYA
SYS@CDB_SHIBUYA SQL> show parameter archive

	NAME				     TYPE	 VALUE
	------------------------------------ ----------- ------------------------------
	archive_lag_target		     integer	 0
	log_archive_config		     string	 dg_config=(CDB_SHIBUYA,CDB_TOKYO,CDB_OSAKA,CDB_NAMBA)
	log_archive_dest		     string
	log_archive_dest_1		     string

	log_archive_dest_2		     string

	log_archive_dest_3		     string

	log_archive_dest_4		     string

	log_archive_dest_state_1	     string	 enable

	log_archive_dest_state_2	     string	 ENABLE

	log_archive_dest_state_3	     string	 enable

	log_archive_duplex_dest 	     string
	log_archive_format		     string	 %t_%s_%r.dbf
	log_archive_max_processes	     integer	 4
	log_archive_min_succeed_dest	     integer	 1
	log_archive_start		     boolean	 FALSE
	log_archive_trace		     integer	 0
```


・Standby (CDB_OSAKA) パラメーター確認
```:CDB_OSAKA
SYS@CDB_OSAKA SQL> show parameter archive

	NAME				     TYPE	 VALUE
	------------------------------------ ----------- ------------------------------
	archive_lag_target		     integer	 0
	log_archive_config		     string	 dg_config=(CDB_OSAKA,CDB_TOKYO
							,CDB_SHIBUYA,CDB_NAMBA)
	log_archive_dest		     string
	log_archive_dest_1		     string

	log_archive_dest_2		     string

	log_archive_dest_3		     string

	log_archive_dest_4		     string

	log_archive_dest_state_1	     string	 enable

	log_archive_dest_state_2	     string	 enable

	log_archive_dest_state_3	     string	 enable

	log_archive_dest_state_4	     string	 enable

	log_archive_duplex_dest 	     string
	log_archive_format		     string	 %t_%s_%r.dbf
	log_archive_max_processes	     integer	 4
	log_archive_min_succeed_dest	     integer	 1
	log_archive_start		     boolean	 FALSE
	log_archive_trace		     integer	 0
```

・Standby (CDB_NAMBA) パラメーター確認
```:CDB_NAMBA
SYS@CDB_NAMBA SQL> show parameter archive

	NAME				     TYPE	 VALUE
	------------------------------------ ----------- ------------------------------
	archive_lag_target		     integer	 0
	log_archive_config		     string	 dg_config=(CDB_NAMBA,CDB_TOKYO,CDB_SHIBUYA,CDB_OSAKA)
	log_archive_dest		     string
	log_archive_dest_1		     string

	log_archive_dest_2		     string

	log_archive_dest_3		     string

	log_archive_dest_4		     string

	log_archive_dest_state_1	     string	 enable

	log_archive_dest_state_2	     string	 enable

	log_archive_dest_state_3	     string	 enable

	log_archive_dest_state_4	     string	 enable

	log_archive_duplex_dest 	     string
	log_archive_format		     string	 %t_%s_%r.dbf
	log_archive_max_processes	     integer	 4
	log_archive_min_succeed_dest	     integer	 1
	log_archive_start		     boolean	 FALSE
	log_archive_trace		     integer	 0
```


## ● Switchover実行
### 1) Data Guardコマンドライン・インタフェース接続
```:Primary
[oracle@db-tokyo1 ~]$ dgmgrl sys/<Password>@CDB_TOKYO
	DGMGRL for Linux: Release 19.0.0.0.0 - Production on Sat Oct 8 04:10:36 2022
	Version 19.16.0.0.0

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

	Welcome to DGMGRL, type "help" for information.
	Connected to "CDB_TOKYO"
	Connected as SYSDBA.
```

### 2) データベース・チェック
ロール変更に先立って包括的なデータベース・チェックを実行

```:Primary
DGMGRL> validate database CDB_TOKYO;

  Database Role:    Primary database

  Ready for Switchover:  Yes

  Managed by Clusterware:
    CDB_TOKYO:  YES

DGMGRL> validate database CDB_OSAKA

  Database Role:     Physical standby database
  Primary Database:  CDB_TOKYO

  Ready for Switchover:  Yes
  Ready for Failover:    Yes (Primary Running)

  Managed by Clusterware:
    CDB_TOKYO:  YES
    CDB_OSAKA:  YES


DGMGRL> validate database CDB_SHIBUYA

  Database Role:     Physical standby database
  Primary Database:  CDB_TOKYO

  Ready for Switchover:  Yes
  Ready for Failover:    Yes (Primary Running)

  Managed by Clusterware:
    CDB_TOKYO  :  YES
    CDB_SHIBUYA:  YES


DGMGRL> validate database CDB_NAMBA

  Database Role:     Physical standby database
  Primary Database:  CDB_TOKYO

  Ready for Switchover:  Yes
  Ready for Failover:    Yes (Primary Running)

  Managed by Clusterware:
    CDB_TOKYO:  YES
    CDB_NAMBA:  YES
```


** 3) Switchover 実行**
```:Primary
DGMGRL> switchover to  CDB_OSAKA;
	Performing switchover NOW, please wait...
	Operation requires a connection to database "CDB_OSAKA"
	Connecting ...
	Connected to "CDB_OSAKA"
	Connected as SYSDBA.
	New primary database "CDB_OSAKA" is opening...
	Oracle Clusterware is restarting database "CDB_TOKYO" ...
	Connected to "CDB_TOKYO"
	Connected to "CDB_TOKYO"
	Switchover succeeded, new primary is "cdb_osaka"
```



### 4) Switchover 確認
・Data GUard Bloker設定確認
```:Primary
DGMGRL> show configuration

	Configuration - dg_config

	Protection Mode: MaxPerformance
	Members:
	CDB_OSAKA   - Primary database
		CDB_TOKYO   - Physical standby database
		CDB_SHIBUYA - Physical standby database
		CDB_NAMBA   - Physical standby database

	Fast-Start Failover:  Disabled

	Configuration Status:
	SUCCESS   (status updated 58 seconds ago)
```

・Database確認
```:Primary
・CDB_TOKYO 確認
DGMGRL> show database CDB_TOKYO

	Database - CDB_TOKYO

	Role:               PHYSICAL STANDBY
	Intended State:     APPLY-ON
	Transport Lag:      0 seconds (computed 0 seconds ago)
	Apply Lag:          0 seconds (computed 0 seconds ago)
	Average Apply Rate: 222.00 KByte/s
	Real Time Query:    ON
	Instance(s):
		CDB1
		CDB2 (apply instance)

	Database Status:
	SUCCESS


・CDB_SHIBUYA 確認
DGMGRL> show database CDB_SHIBUYA

	Database - CDB_SHIBUYA

	Role:               PHYSICAL STANDBY
	Intended State:     APPLY-ON
	Transport Lag:      0 seconds (computed 1 second ago)
	Apply Lag:          0 seconds (computed 1 second ago)
	Average Apply Rate: 5.00 KByte/s
	Real Time Query:    ON
	Instance(s):
		CDB1
		CDB2 (apply instance)

	Database Status:
	SUCCESS


・CDB_OSAKA 確認
DGMGRL> show database CDB_OSAKA

	Database - CDB_OSAKA

	Role:               PRIMARY
	Intended State:     TRANSPORT-ON
	Instance(s):
		CDB1
		CDB2

	Database Status:
	SUCCESS


・CDB_NAMBA確認
DGMGRL> show database CDB_NAMBA

	Database - CDB_NAMBA

	Role:               PHYSICAL STANDBY
	Intended State:     APPLY-ON
	Transport Lag:      0 seconds (computed 0 seconds ago)
	Apply Lag:          0 seconds (computed 0 seconds ago)
	Average Apply Rate: 5.00 KByte/s
	Real Time Query:    ON
	Instance(s):
		CDB1 (apply instance)
		CDB2

	Database Status:
	SUCCESS
```

## ● Switchpver後パラメーター確認

```:CDB_TOKYO
SYS@CDB_TOKYO1 SQL> show parameter archive

	NAME				     TYPE	 VALUE
	------------------------------------ ----------- ------------------------------
	archive_lag_target		     integer	 0
	log_archive_config		     string	 dg_config=(CDB_TOKYO,CDB_SHIBUYA,CDB_OSAKA,CDB_NAMBA)
	log_archive_dest		     string
	log_archive_dest_1		     string
	log_archive_dest_2		     string	 service="cdb_shibuya", ASYNC N
							OAFFIRM delay=0 optional compr
							ession=disable max_failure=0 r
							eopen=300 db_unique_name="CDB_
							SHIBUYA" net_timeout=30, valid
							_for=(online_logfile,all_roles
							)

	log_archive_dest_3		     string	 service="cdb_osaka", ASYNC NOA
							FFIRM delay=0 optional compres
							sion=disable max_failure=0 reo
							pen=300 db_unique_name="CDB_OS
							AKA" net_timeout=30, valid_for
							=(online_logfile,all_roles)

	log_archive_dest_4		     string	 service="cdb_namba", ASYNC NOA
							FFIRM delay=0 optional compres
							sion=disable max_failure=0 reo
							pen=300 db_unique_name="CDB_NA
							MBA" net_timeout=30, valid_for
							=(online_logfile,all_roles)

	log_archive_dest_state_1	     string	 enable
	log_archive_dest_state_2	     string	 ENABLE
	log_archive_dest_state_3	     string	 ENABLE
	log_archive_duplex_dest 	     string
	log_archive_format		     string	 %t_%s_%r.dbf
	log_archive_max_processes	     integer	 4
	log_archive_min_succeed_dest	     integer	 1
	log_archive_start		     boolean	 FALSE
	log_archive_trace		     integer	 0
```


```:CDB_SHIBUYA
SYS@CDB_SHIBUYA1 SQL> show parameter archive

	NAME				     TYPE	 VALUE
	------------------------------------ ----------- ------------------------------
	archive_lag_target		     integer	 0
	log_archive_config		     string	 dg_config=(CDB_SHIBUYA,CDB_TOKYO,CDB_OSAKA,CDB_NAMBA)
	log_archive_dest		     string
	log_archive_dest_1		     string

	log_archive_dest_2		     string

	log_archive_dest_3		     string

	log_archive_dest_4		     string

	log_archive_dest_state_1	     string	 enable

	log_archive_dest_state_2	     string	 ENABLE

	log_archive_dest_state_3	     string	 enable

	log_archive_duplex_dest 	     string
	log_archive_format		     string	 %t_%s_%r.dbf
	log_archive_max_processes	     integer	 4
	log_archive_min_succeed_dest	     integer	 1
	log_archive_start		     boolean	 FALSE
	log_archive_trace		     integer	 0
```


```:CDB_SHIBUYA
SYS@CDB_OSAKA1 SQL> show parameter archive
	NAME				     TYPE	 VALUE
	------------------------------------ ----------- ------------------------------
	archive_lag_target		     integer	 0
	log_archive_config		     string	 dg_config=(CDB_OSAKA,CDB_TOKYO,CDB_SHIBUYA,CDB_NAMBA)
	log_archive_dest		     string
	log_archive_dest_1		     string

	log_archive_dest_2		     string	 service="cdb_tokyo", ASYNC NOA
							FFIRM delay=0 optional compres
							sion=disable max_failure=0 reo
							pen=300 db_unique_name="CDB_TO
							KYO" net_timeout=30, valid_for
							=(online_logfile,all_roles)

	log_archive_dest_3		     string	 service="cdb_shibuya", ASYNC N
							OAFFIRM delay=0 optional compr
							ession=disable max_failure=0 r
							eopen=300 db_unique_name="CDB_
							SHIBUYA" net_timeout=30, valid
							_for=(online_logfile,all_roles
							)

	log_archive_dest_4		     string	 service="cdb_namba", ASYNC NOA
							FFIRM delay=0 optional compres
							sion=disable max_failure=0 reo
							pen=300 db_unique_name="CDB_NA
							MBA" net_timeout=30, valid_for
							=(online_logfile,all_roles)

	log_archive_dest_state_1	     string	 enable

	log_archive_dest_state_2	     string	 ENABLE

	log_archive_dest_state_3	     string	 ENABLE

	log_archive_dest_state_4	     string	 ENABLE

	log_archive_duplex_dest 	     string
	log_archive_format		     string	 %t_%s_%r.dbf
	log_archive_max_processes	     integer	 4
	log_archive_min_succeed_dest	     integer	 1
	log_archive_start		     boolean	 FALSE
	log_archive_trace		     integer	 0
```

```:CDB_NAMBA
SYS@CDB_NAMBA1 SQL> show parameter archive

	NAME				     TYPE	 VALUE
	------------------------------------ ----------- ------------------------------
	archive_lag_target		     integer	 0
	log_archive_config		     string	 dg_config=(CDB_NAMBA,CDB_TOKYO,CDB_SHIBUYA,CDB_OSAKA)
	log_archive_dest		     string
	log_archive_dest_1		     string

	log_archive_dest_2		     string

	log_archive_dest_3		     string

	log_archive_dest_4		     string

	log_archive_dest_state_1	     string	 enable

	log_archive_dest_state_2	     string	 enable

	log_archive_dest_state_3	     string	 enable

	log_archive_dest_state_4	     string	 enable

	log_archive_duplex_dest 	     string
	log_archive_format		     string	 %t_%s_%r.dbf
	log_archive_max_processes	     integer	 4
	log_archive_min_succeed_dest	     integer	 1
	log_archive_start		     boolean	 FALSE
	log_archive_trace		     integer	 0
```


## ● INSERT確認


・Primary: CDB_OSAKA
```Primary(CDB_OSAKA)
SYS@CDB_OSAKA1 SQL> INSERT INTO test_table1  VALUES (2,'BBB');

	1 row created.

SYS@CDB_OSAKA1 SQL> commit;

	Commit complete.

SYS@CDB_OSAKA1 SQL> select * from test_table1;

		ID NAME
	---------- ----------
		1 AAA
		2 BBB
```


・CDB_TOKYO
```:Standby (CDB_TOKYO)
SYS@CDB_TOKYO1 SQL> select * from test_table1;

		ID NAME
	---------- ----------
		1 AAA

SYS@CDB_TOKYO1 SQL> select * from test_table1;

		ID NAME
	---------- ----------
		1 AAA
		2 BBB
```


・CDB_SHIBAUA
```:Standby (CDB_SHIBAUA)
SYS@CDB_SHIBUYA1 SQL> select * from test_table1;

		ID NAME
	---------- ----------
		1 AAA

SYS@CDB_SHIBUYA1 SQL> select * from test_table1;

		ID NAME
	---------- ----------
		1 AAA
		2 BBB

```




・CDB_NAMBA
```:Standby (CDB_NAMBA)
SYS@CDB_NAMBA1 SQL> select * from test_table1;

		ID NAME
	---------- ----------
		1 AAA

SYS@CDB_NAMBA1 SQL> select * from test_table1;

		ID NAME
	---------- ----------
		1 AAA
		2 BBB
```



# ■ Failover と Reinstate

## ● Failover
```:コマンド
DGMGRL> failover to <Standby>;
```


### 1) 事前確認
```:Primary
DGMGRL>  show configuration

	Configuration - dg_config

	Protection Mode: MaxPerformance
	Members:
	CDB_OSAKA   - Primary database
		CDB_TOKYO   - Physical standby database
		CDB_SHIBUYA - Physical standby database
		CDB_NAMBA   - Physical standby database

	Fast-Start Failover:  Disabled

	Configuration Status:
	SUCCESS   (status updated 49 seconds ago)
```

### 2) Failover
Standbyで実行

```:Standby (CDB_TOKYO)
[oracle@db-tokyo1 ~]$ dgmgrl sys/<Password>@CDB_TOKYO
	DGMGRL for Linux: Release 19.0.0.0.0 - Production on Sat Oct 8 04:43:19 2022
	Version 19.16.0.0.0

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

	Welcome to DGMGRL, type "help" for information.
	Connected to "CDB_TOKYO"
	Connected as SYSDBA.

DGMGRL>  show configuration

	Configuration - dg_config

	Protection Mode: MaxPerformance
	Members:
	CDB_OSAKA   - Primary database
		CDB_TOKYO   - Physical standby database
		CDB_SHIBUYA - Physical standby database
		CDB_NAMBA   - Physical standby database

	Fast-Start Failover:  Disabled

	Configuration Status:
	SUCCESS   (status updated 54 seconds ago)

DGMGRL> failover to CDB_TOKYO
	Performing failover NOW, please wait...
	Failover succeeded, new primary is "cdb_tokyo"

DGMGRL>  show configuration

	Configuration - dg_config

	Protection Mode: MaxPerformance
	Members:
	CDB_TOKYO   - Primary database
		CDB_SHIBUYA - Physical standby database
		CDB_OSAKA   - Physical standby database (disabled)
		ORA-16661: the standby database needs to be reinstated

		CDB_NAMBA   - Physical standby database

	Fast-Start Failover:  Disabled

	Configuration Status:
	SUCCESS   (status updated 1924 seconds ago)
```



## ● Reinstate
・旧Primaryで実行
```:コマンド
SQL> shutdown abort
SQL> startup mount


・新Primaryで実行
```:コマンド
DGMGRL> reinstate database <Primary>
```



### 1) 旧Primary(CDB_OSAKA)で実行
```: 旧Primary(CDB_OSAKA)
[oracle@db-osaka1 ~]$ dgmgrl /
	DGMGRL for Linux: Release 19.0.0.0.0 - Production on Sat Oct 8 04:51:07 2022
	Version 19.16.0.0.0

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

	Welcome to DGMGRL, type "help" for information.
	Connected to "CDB_OSAKA"
	Connected as SYSDG.

DGMGRL> show configuration;

	Configuration - dg_config

	Protection Mode: MaxPerformance
	Members:
	CDB_OSAKA   - Primary database
		CDB_TOKYO   - Physical standby database
		CDB_SHIBUYA - Physical standby database
		CDB_NAMBA   - Physical standby database

	Fast-Start Failover:  Disabled

	Configuration Status:
	DISABLED
	DGM-17290: Role change detected. This database may no longer be the primary database.

SYS@CDB_OSAKA1 SQL> shutdown abort
	ORACLE instance shut down.

SYS@CDB_OSAKA1 SQL> startup mount
	ORACLE instance started.

	Total System Global Area 3.0602E+10 bytes
	Fixed Size		   13872248 bytes
	Variable Size		 3690987520 bytes
	Database Buffers	 2.6709E+10 bytes
	Redo Buffers		  187453440 bytes
	Database mounted.
```

### 2) 新Primary(CDB_TOKYO)で実行

```:新Primary(CDB_TOKYO)
DGMGRL>  reinstate database CDB_TOKYO
	Reinstating database "cdb_tokyo", please wait...
	Reinstatement of database "cdb_tokyo" succeeded

DGMGRL> show configuration

	Configuration - dg_config

	Protection Mode: MaxPerformance
	Members:
	CDB_OSAKA - Primary database
		CDB_TOKYO - Physical standby database

	Fast-Start Failover:  Disabled

	Configuration Status:
	SUCCESS   (status updated 34 seconds ago)
```





# ■ スタンバイ・データベースからスナップショット・スタンバイへの変換
## ● スナップショット・スタンバイへの変換
```:コマンド
DGMGRL> convert database 'CDB_OSAKA' to snapshot standby;
DGMGRL> SHOW CONFIGURATION;
```



### 1) スナップショット・スタンバイへ変換
```:Primary
DGMGRL> convert database 'CDB_OSAKA' to snapshot standby;
	Converting database "CDB_OSAKA" to a Snapshot Standby database, please wait...
	Database "CDB_OSAKA" converted successfully
```

### 2) 確認

```:Primary
DGMGRL> SHOW CONFIGURATION;

	Configuration - dg_config

	Protection Mode: MaxPerformance
	Members:
	CDB_TOKYO - Primary database
		CDB_OSAKA - Snapshot standby database
		Warning: ORA-16855: transport lag has exceeded specified threshold

	Fast-Start Failover:  Disabled

	Configuration Status:
	WARNING   (status updated 37 seconds ago)


DGMGRL> show database CDB_OSAKA

	Database - CDB_OSAKA

	Role:               SNAPSHOT STANDBY
	Transport Lag:      3 minutes 5 seconds (computed 1 second ago)
	Apply Lag:          3 minutes 8 seconds (computed 1 second ago)
	Instance(s):
		CDB_OSAKA1
		CDB_OSAKA2

	Database Warning(s):
		ORA-16855: transport lag has exceeded specified threshold

	Database Status:
	WARNING


DGMGRL> show database CDB_TOKYO

	Database - CDB_TOKYO

	Role:               PRIMARY
	Intended State:     TRANSPORT-ON
	Instance(s):
		CDB_TOKYO1
		CDB_TOKYO2

	Database Status:
	SUCCESS
```


## ● スナップショット・スタンバイから元のフィジカル・スタンバイ・データベースに変換
Data Guard Brokerを使用して、次のコマンドを発行します

```:コマンド
DGMGRL> CONVERT DATABASE 'stby' to PHYSICAL STANDBY;
```

### 1) フィジカル・スタンバイ・データベースへ変換
```
DGMGRL> CONVERT DATABASE 'CDB_OSAKA' to PHYSICAL STANDBY;
	Converting database "CDB_OSAKA" to a Physical Standby database, please wait...
	Operation requires a connection to database "CDB_TOKYO"
	Connecting ...
	Connected to "CDB_TOKYO"
	Connected as SYSDBA.
	Oracle Clusterware is restarting database "CDB_OSAKA" ...
	Connected to "CDB_OSAKA"
	Connected to "CDB_OSAKA"
	Continuing to convert database "CDB_OSAKA" ...
	Database "CDB_OSAKA" converted successfully
```

### 2) 確認
```
DGMGRL> SHOW CONFIGURATION;

	Configuration - dg_config

	Protection Mode: MaxPerformance
	Members:
	CDB_TOKYO - Primary database
		CDB_OSAKA - Physical standby database

	Fast-Start Failover:  Disabled

	Configuration Status:
	SUCCESS   (status updated 31 seconds ago)
```

# ■ 複数スタンバイ・データベース構成の REDO転送制御
2つ以上のスタンバイ・データベース構成の場合、REDO転送するルート制御が必要になります。
Oracle Data Guard Broker で制御します。

・参考: [Data Guard Broker で複数スタンバイ・データベース構成の REDO転送を制御](https://qiita.com/shirok/items/67ab65e8c5db2c355e82)

# ■ 参考
**● Data Guard**
・[Data Guard](https://www.oracle.com/jp/database/data-guard/#rc30p2)
・[Oracle Exadata Cloudを使用した ディザスタ・リカバリ](https://www.oracle.com/a/tech/docs/hybrid-data-guard-to-exaoci-update-gen2-exacc-exacs.pdf)
・[Hybrid Data Guard to Exadata Cloud Services](https://www.oracle.com/technetwork/database/availability/hybrid-data-guard-to-exaoci-5600751.pdf)
・[Solution Playbooks: Deploy a hybrid DR topology for an on-premises Oracle Exadata](https://docs.oracle.com/en/solutions/hybrid-dr-for-exadata/index.html#GUID-B9D75B4F-B5EE-4ECB-84AB-F0F6AC56A010)

**● Data Guard Broker**
・[マニュアル: Oracle Data Guard Broker ](https://docs.oracle.com/cd/F19136_01/dgbkr/oracle-data-guard-broker-concepts.html#GUID-723E5B73-A350-4B2E-AF3C-5EA4EFC83966)
・[Oracle Data Guardのベスト・プラクティス](https://docs.oracle.com/cd/F19136_01/haovw/oracle-data-guard-best-practices.html)

**● Exadata**
・[概要: Oracle Exadata Database Service](https://www.oracle.com/jp/engineered-systems/exadata/database-service/)
・[キュメント: Exadataシステム](https://docs.oracle.com/ja-jp/iaas/Content/Database/Concepts/troubleshooting_topic-Exadata_DB_Systems.htm)
・[キュメント: DBAASツール: dbaascliを使用したクラウド・ツール・ログの収集およびクラウド・ツールの ヘルス・チェックの実行](https://docs.oracle.com/ja-jp/iaas/Content/Database/References/dbaascli_topic-tooling_log_collection.htm)
・[Oracle Database Product Management](https://bit.ly/dbpm-youtube)

**● Private DNS**
・[キュメント: OCI Document:プライベートDNS](https://docs.oracle.com/ja-jp/iaas/Content/DNS/Tasks/privatedns.htm)
・[チュートリアル: Private DNS Implementation](https://www.ateam-oracle.com/post/private-dns-implementation)

**● Oracle Cloud：Maximum Availability Architecture (MAA)**
・[Oracle CloudのMAAベスト・プラクティス まとめ](https://www.oracle.com/jp/database/technologies/high-availability/oracle-cloud-maa.html)
・[Oracle WebLogic Server for Oracle Cloud Infrastructureの障害時リカバリ](https://www.oracle.com/jp/a/tech/docs/maa-wls-mp-dr-ja.pdf)
・[Oracle Cloud Infrastructure Marketplace上のSOA Suiteの障害時リカバリ](https://www.oracle.com/jp/a/tech/docs/maa-soamp-dr-ja.pdf)

**● My Oracle Support**
・ [When do SQLNET.ORA changes take effect ? (Doc ID 562589.1)](https://support.oracle.com/knowledge/Oracle%20Database%20Products/562589_1.html)
・ [Data Guard] Data Guard に関する FAQ(KROWN:125680) (Doc ID 1740071.1)
・ [DataGuard] フィジカル・スタンバイ環境での個別パッチの適用手順(KROWN:140197) (Doc ID 1748475.1)

**● Qiitaまとめ**
・ [DRGで東京リージョンを経由して、オンプレミスと 大阪リージョンを接続](https://qiita.com/shirok/items/90cff318816fbf2a802d)
・ [Oracle Exadata Cloud Infrastructure X9M作成](https://qiita.com/shirok/items/1f7a10d254849a9fdddb)
・ [Oracle Cloud: Real Application Clusters（RAC）作成](https://qiita.com/shirok/items/ff7bb98a3b771edd1b5f)
・ [リージョン間を Remote VCN Peering接続](https://qiita.com/shirok/items/192674aa6e903ea6694a)
・ [Private DNSで PeeringしたVCNどうしホスト名解決する](https://qiita.com/shirok/items/4197e09dc2bfd7db82f3)
・ [クラウド・ツール dbaascliをバージョンアップ](https://qiita.com/shirok/items/9c5f4176b86536ff221e)
・ [Data Guard Broker で複数スタンバイ・データベース構成の REDO転送を制御](https://qiita.com/shirok/items/67ab65e8c5db2c355e82)