~~ creation of CDB database $ORACLE_HOME/bin/dbca \ -silent \ -createDatabase \ -templateName General_Purpose.dbc \ -gdbName EWOK \ -sid EWOKPRD \ -initParams db_unique_name=EWOKPRD \ -characterSet AL32UTF8 \ -sysPassword secret \ -systemPassword secret \ -emConfiguration NONE \ -createAsContainerDatabase TRUE \ -storageType ASM \ -diskGroupName DATA \ -redoLogFileSize 100 \ -sampleSchema FALSE \ -totalMemory 2048 \ -databaseConfType RAC \ -nodelist vortex-db01,vortex-db02 ~~ identify the spfile and passwordfile ASM location and more readable aliases srvctl config database -d EWOKPRD ASMCMD [+] > cd +DATA/EWOKPRD/ ASMCMD [+DATA/EWOKPRD] > mkalias +DATA/EWOKPRD/PARAMETERFILE/spfile.333.957718565 spfileewokprd.ora ASMCMD [+DATA/EWOKPRD] > mkalias +DATA/EWOKPRD/PASSWORD/pwdewokprd.308.957717627 orapwewokprd ~~ update spfile location in the CRS srvctl modify database -db EWOKPRD -spfile +DATA/EWOKPRD/spfileewokprd.ora srvctl modify database -db EWOKPRD -pwfile +DATA/EWOKPRD/orapwewokprd srvctl stop database -d EWOKPRD srvctl start database -d EWOKPRD srvctl status database -d EWOKPRD -v ~~ enable ARCHIVELG mode and FORCE LOGGING on the PRIMARY database alter system set db_recovery_file_dest_size = 4G scope=both sid='*'; alter system set db_recovery_file_dest = '+RECO' scope=both sid='*'; alter system set log_archive_dest_1 = 'location=USE_DB_RECOVERY_FILE_DEST' scope=both sid='*'; srvctl stop database -d EWOKPRD startup mount exclusive alter database archivelog; alter database open; alter database force logging; srvctl stop database -d EWOKPRD srvctl start database -d EWOKPRD alter system archive log current; ~~ copy pfile and passwordfile from primary cluster to first node of the stabdby cluster SQL> create pfile='/tmp/pfile_EWOK.ora' from spfile; asmcmd cp +DATA/EWOKPRD/orapwewokprd /tmp cd /tmp scp orapwewokprd pfile_EWOK.ora kessel-db01/tmp ~~ make adjustements in pfile and put all in $ORACLE_HOME/dbs SQL> create spfile from pfile='/tmp/standby.ora'; cp orapwewokprd $ORACLE_HOME/dbs/orapwEWOKDRP1 SQL> startup nomount ~~ NETWORK configuration - listeners ~~ in my confoguration I have a dedicated listener for DATAGUARD; following definitions has been added on primary cluster: # For DATAGUARD... SID_LIST_LISTENER_DG = (SID_LIST = (SID_DESC = (GLOBAL_DBNAME = EWOKPRD_DGMGRL) (SID_NAME = EWOKPRD1) (ORACLE_HOME = /app/oracle/product/12.1/db_1) ) ) # ...For DATAGUARD ~~ and on standby cluster: # For DATAGUARD... SID_LIST_LISTENER_DG = (SID_LIST = (SID_DESC = (GLOBAL_DBNAME = EWOKDRP_DGMGRL) (SID_NAME = EWOKDRP1) (ORACLE_HOME = /app/oracle/product/12.1/db_1) ) ) # ...For DATAGUARD ~~ cross connection tests; we should be able to connect to iddle instances too sqlplus /nolog connect sys/secret@vortex-db01-dba-vip:1541/EWOKPRD_DGMGRL as sysdba connect sys/secret@vortex-db02-dba-vip:1541/EWOKPRD_DGMGRL as sysdba connect sys/secret@kessel-db01-dba-vip:1541/EWOKDRP_DGMGRL as sysdba (for the moment the standby pfile/passwordfile are not deployed on second node of the standby cluster) ~~ aliases to add on tnsnames.ora on all primary/standby database nodes # For DATAGUARD... EWOKPRD_DG = (DESCRIPTION = (FAILOVER = YES) (ADDRESS_LIST = (ADDRESS = (PROTOCOL = TCP)(HOST = vortex-db01-dba-vip)(PORT = 1541)) (ADDRESS = (PROTOCOL = TCP)(HOST = vortex-db02-dba-vip)(PORT = 1541)) ) (CONNECT_DATA = (SERVER = DEDICATED) (SERVICE_NAME = EWOKPRD_DGMGRL) ) ) EWOKDRP_DG = (DESCRIPTION = (FAILOVER = YES) (ADDRESS_LIST = (ADDRESS = (PROTOCOL = TCP)(HOST = kessel-db01-dba-vip)(PORT = 1541)) (ADDRESS = (PROTOCOL = TCP)(HOST = kessel-db02-dba-vip)(PORT = 1541)) ) (CONNECT_DATA = (SERVER = DEDICATED) (SERVICE_NAME = EWOKDRP_DGMGRL) ) ) # ...For DATAGUARD ~~ cross connexion test using TNS aliases; we should be able to connect to iddle instances sqlplus /nolog connect sys/secret@EWOKPRD_DG as sysdba connect sys/secret@EWOKDRP_DG as sysdba ~~ from the spfile of primary DB we create an spfile for the secondary DB and we start thesecondary DB in nomount rman target sys/secret@EWOKPRD_DG auxiliary sys/secret@EWOKDRP_DG run { allocate channel pri1 device type DISK; allocate channel pri2 device type DISK; allocate auxiliary channel aux1 device type DISK; allocate auxiliary channel aux2 device type DISK; duplicate target database for standby from active database nofilenamecheck using compressed backupset section size 1G; } ~~ Dataguard Broker configuration ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~ on primary database alter system set dg_broker_start=FALSE scope=both sid='*'; alter system set dg_broker_config_file1='+DATA/EWOKPRD/dr1EWOKPRD.dat' scope=both sid='*'; alter system set dg_broker_config_file2='+DATA/EWOKPRD/dr2EWOKPRD.dat' scope=both sid='*'; alter system set dg_broker_start=TRUE scope=both sid='*'; ~~ on secondary database alter system set dg_broker_start=FALSE scope=both sid='*'; alter system set dg_broker_config_file1='+DATA/EWOKDRP/dr1EWOKDRP.dat' scope=both sid='*'; alter system set dg_broker_config_file2='+DATA/EWOKDRP/dr2EWOKFRP.dat' scope=both sid='*'; alter system set dg_broker_start=TRUE scope=both sid='*'; ~~ creation of STANDBY REDELOG on both databases ALTER DATABASE ADD STANDBY LOGFILE thread 1 size 100M; ALTER DATABASE ADD STANDBY LOGFILE thread 1 size 100M; ALTER DATABASE ADD STANDBY LOGFILE thread 1 size 100M; ALTER DATABASE ADD STANDBY LOGFILE thread 2 size 100M; ALTER DATABASE ADD STANDBY LOGFILE thread 2 size 100M; ALTER DATABASE ADD STANDBY LOGFILE thread 2 size 100M; select GROUP#,THREAD#,STATUS, BYTES from v$standby_log; col MEMBER for a60 select * from v$logfile; ~~ create DGMGRL configuration dgmgrl DGMGRL> connect sys/secret@EWOKPRD_DG DGMGRL> create configuration EWOK as primary database is EWOKPRD connect identifier is EWOKPRD_DG; DGMGRL> add database EWOKDRP as connect identifier is EWOKDRP_DG maintained as physical; DGMGRL> edit database 'ewokdrp' set property ArchiveLagTarget=0; DGMGRL> edit database 'ewokdrp' set property LogArchiveMaxProcesses=2; DGMGRL> edit database 'ewokdrp' set property LogArchiveMinSucceedDest=1; DGMGRL> edit database 'ewokdrp' set property StandbyFileManagement='AUTO'; DGMGRL> edit database 'ewokprd' set property ArchiveLagTarget=0; DGMGRL> edit database 'ewokprd' set property LogArchiveMaxProcesses=2; DGMGRL> edit database 'ewokprd' set property LogArchiveMinSucceedDest=1; DGMGRL> edit database 'ewokprd' set property StandbyFileManagement='AUTO'; DGMGRL> enable configuration; DGMGRL> show configuration; ~~ VERY IMPORANT ~~ set StaticConnectIdentifier for all PRIMARY/DATAGUARD database instances ~~ use complete DESCRIPTION syntax to uniquely identifiing the instances of each node EDIT INSTANCE 'EWOKPRD1' SET PROPERTY 'StaticConnectIdentifier'='(DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=vortex-db01-dba-vip)(PORT=1541))(CONNECT_DATA=(SERVICE_NAME=EWOKPRD_DGMGRL)(INSTANCE_NAME=EWOKPRD1)(SERVER=DEDICATED)))'; EDIT INSTANCE 'EWOKPRD2' SET PROPERTY 'StaticConnectIdentifier'='(DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=vortex-db02-dba-vip)(PORT=1541))(CONNECT_DATA=(SERVICE_NAME=EWOKPRD_DGMGRL)(INSTANCE_NAME=EWOKPRD2)(SERVER=DEDICATED)))'; EDIT INSTANCE 'EWOKDRP1' SET PROPERTY 'StaticConnectIdentifier'='(DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=kessel-db01-dba-vip)(PORT=1541))(CONNECT_DATA=(SERVICE_NAME=EWOKDRP_DGMGRL)(INSTANCE_NAME=EWOKDRP1)(SERVER=DEDICATED)))'; EDIT INSTANCE 'EWOKDRP2' SET PROPERTY 'StaticConnectIdentifier'='(DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=kessel-db02-dba-vip)(PORT=1541))(CONNECT_DATA=(SERVICE_NAME=EWOKDRP_DGMGRL)(INSTANCE_NAME=EWOKDRP2)(SERVER=DEDICATED)))'; ~~ move spfile from file system to ASM create pfile='/tmp/pfile_EWOKDRP.ora' from spfile; create spfile ='+DATA/ewokdrp/spfileEWOKDRP.ora' from pfile='/tmp/pfile_EWOKDRP.ora'; ~~ register standby database in the CRS srvctl add database -d EWOKDRP -o /app/oracle/product/12.1/db_1 -c RAC -p '+DATA/EWOKDRP/spfileEWOKDRP.ora' -r physical_standby -n EWOK ~~ pay attention to -s ; the default value is OPEN, that means that your DATAGUARD will be OPENED (active DATAGUARD) srvctl add instance -d EWOKDRP -i EWOKDRP1 -n kessel-db01 srvctl add instance -d EWOKDRP -i EWOKDRP2 -n kessel-db02 srvctl start database -d EWOKDRP -o mount srvctl status database -d EWOKDRP -v ~~ finally, move passwordfile to ASM using pwcopy under asmcmd ~~ note that if the passwordfile is created on DB_UNKNOW ASM directory using --dbuniquename in pwdcopy could be necessary asmcmd pwcopy +DATA/EWOKPRD/orapwewokprd /tmp/orapwewokprd scp /tmp/orapwewokprd kessel-db01:/tmp/orapwewokprd asmcmd pwcopy /tmp/orapwewokprd +DATA/EWOKDRP/orapwewokdrp