Tuesday, July 17, 2018

ASM meta data

SPOOL ASM1_GENERIC_ASM_METADATA.html
-- ASM VERSIONS 10.1, 10.2, 11.1, 11.2, 12.1 & 12.2
SET MARKUP HTML ON
SET ECHO ON

SET PAGESIZE 200

ALTER SESSION SET NLS_DATE_FORMAT='DD-MON-YYYY HH24:MI:SS';

SELECT 'THIS ASM REPORT WAS GENERATED AT: ==)> ' , SYSDATE " " FROM DUAL;
SELECT 'INSTANCE NAME: ==)> ' , INSTANCE_NAME " " FROM V$INSTANCE;

SELECT 'HOSTNAME ASSOCIATED WITH THIS ASM INSTANCE: ==)> ' , MACHINE " " FROM V$SESSION WHERE PROGRAM LIKE '%SMON%';

SELECT * FROM V$INSTANCE;

SELECT * FROM GV$INSTANCE;

SELECT * FROM V$ASM_DISKGROUP;

SELECT GROUP_NUMBER, DISK_NUMBER, MOUNT_STATUS, HEADER_STATUS, MODE_STATUS, STATE, OS_MB, TOTAL_MB, FREE_MB, NAME, FAILGROUP, PATH
FROM V$ASM_DISK ORDER BY GROUP_NUMBER, FAILGROUP, DISK_NUMBER;

SELECT * FROM V$ASM_DISK ORDER BY GROUP_NUMBER,DISK_NUMBER;

SELECT SUBSTR(D.NAME,1,16) AS ASMDISK, D.MOUNT_STATUS, D.STATE,
DG.NAME AS DISKGROUP FROM V$ASM_DISKGROUP DG, V$ASM_DISK D
WHERE DG.GROUP_NUMBER = D.GROUP_NUMBER;

SELECT * FROM V$ASM_CLIENT;

SELECT DG.NAME AS DISKGROUP, SUBSTR(C.INSTANCE_NAME,1,12) AS INSTANCE,
SUBSTR(C.DB_NAME,1,12) AS DBNAME, SUBSTR(C.SOFTWARE_VERSION,1,12) AS SOFTWARE,
SUBSTR(C.COMPATIBLE_VERSION,1,12) AS COMPATIBLE
FROM V$ASM_DISKGROUP DG, V$ASM_CLIENT C
WHERE DG.GROUP_NUMBER = C.GROUP_NUMBER;

SELECT * FROM V$ASM_ATTRIBUTE;

SELECT * FROM V$ASM_OPERATION;
SELECT * FROM GV$ASM_OPERATION;

SELECT * FROM V$VERSION;

SELECT * FROM V$ASM_ACFSSNAPSHOTS;
SELECT * FROM V$ASM_ACFSVOLUMES;
SELECT * FROM V$ASM_FILESYSTEM;
SELECT * FROM V$ASM_VOLUME;
SELECT * FROM V$ASM_VOLUME_STAT;

SELECT * FROM V$ASM_USER;
SELECT * FROM V$ASM_USERGROUP;
SELECT * FROM V$ASM_USERGROUP_MEMBER;

SELECT * FROM V$ASM_DISK_IOSTAT;
SELECT * FROM V$ASM_DISK_STAT;
SELECT * FROM V$ASM_DISKGROUP_STAT;

SELECT * FROM V$ASM_TEMPLATE;

SHOW PARAMETER

SHOW SGA

!echo "SELECT '" > /tmp/GPNPTOOL.SQL 2> /dev/null
! $ORACLE_HOME/bin/gpnptool get >> /tmp/GPNPTOOL.SQL 2>> /dev/null
!echo "' FROM DUAL;" >> /tmp/GPNPTOOL.SQL 2>> /dev/null
! cat /tmp/GPNPTOOL.SQL
SET ECHO OFF

--DISPLAYS INFORMATION ABOUT THE CONTENTS OF THE SPFILE.
SELECT * FROM V$SPPARAMETER ORDER BY 2;
SELECT * FROM GV$SPPARAMETER ORDER BY 3;

--DISPLAYS INFORMATION ABOUT THE INITIALIZATION PARAMETERS THAT ARE CURRENTLY IN EFFECT IN THE INSTANCE.
SELECT * FROM V$SYSTEM_PARAMETER ORDER BY 2;
SELECT * FROM GV$SYSTEM_PARAMETER ORDER BY 3;

-- 12C ACFS VIEWS

SELECT * FROM V$ASM_ACFS_ENCRYPTION_INFO;
SELECT * FROM V$ASM_ACFSREPL;
SELECT * FROM V$ASM_ACFSREPLTAG;
SELECT * FROM V$ASM_ACFS_SEC_ADMIN;
SELECT * FROM V$ASM_ACFS_SEC_CMDRULE;
SELECT * FROM V$ASM_ACFS_SEC_REALM;
SELECT * FROM V$ASM_ACFS_SEC_REALM_FILTER;
SELECT * FROM V$ASM_ACFS_SEC_REALM_GROUP;
SELECT * FROM V$ASM_ACFS_SEC_REALM_USER;
SELECT * FROM V$ASM_ACFS_SEC_RULE;
SELECT * FROM V$ASM_ACFS_SEC_RULESET;
SELECT * FROM V$ASM_ACFS_SEC_RULESET_RULE;
SELECT * FROM V$ASM_ACFS_SECURITY_INFO;
SELECT * FROM V$ASM_ACFSTAG;

-- 12C ASM AUDIT VIEWS

SELECT * FROM V$ASM_AUDIT_CLEAN_EVENTS;
SELECT * FROM V$ASM_AUDIT_CLEANUP_JOBS;
SELECT * FROM V$ASM_AUDIT_CONFIG_PARAMS;
SELECT * FROM V$ASM_AUDIT_LAST_ARCH_TS;

-- 12C ASM ESTIMATE VIEW

SELECT * FROM V$ASM_ESTIMATE;
SELECT * FROM GV$ASM_ESTIMATE;

SPOOL OFF

EXIT

Shutdown and Startup Script

=====Shutdown Script====
#!/bin/bash

export TMP=/tmp
export TMPDIR=$TMP
export PATH=/usr/sbin:/usr/local/bin:$PATH
export ORACLE_HOSTNAME=qpaydb.nblbd.com
export ORACLE_UNQNAME=remitdb
export ORACLE_HOME=/u01/app/oracle/product/11.2.0.4.0/dbhome_1

export ORACLE_SID=remitdb
ORAENV_ASK=NO
. oraenv
ORAENV_ASK=YES

# Stop Database
sqlplus / as sysdba << EOF
SHUTDOWN IMMEDIATE;
EXIT;
EOF

# Stop Listener
lsnrctl stop

# stop the Enterprise Manager db console
$ORACLE_HOME/bin/emctl stop dbconsole


=====Startup Script====
#!/bin/bash
export TMP=/tmp
export TMPDIR=$TMP
export PATH=/usr/sbin:/usr/local/bin:$PATH
export ORACLE_HOSTNAME=qpaydb.nblbd.com
export ORACLE_UNQNAME=remitdb
export ORACLE_HOME=/u01/app/oracle/product/11.2.0.4.0/dbhome_1

export ORACLE_SID=remitdb
ORAENV_ASK=NO
. oraenv
ORAENV_ASK=YES

# Start Listener
lsnrctl start

# Start Database
sqlplus / as sysdba << EOF
STARTUP;
EXIT;
EOF

# start the Enterprise Manager db console
$ORACLE_HOME/bin/emctl start dbconsole


Dump Backup Script

#!/bin/bash
vdate=nblt24ac_`date '+%d%m%Y%H%M'`
v1=01
v2=02
v3=03
v4=04
v5=05
v6=06
v7=07
v8=08
v9=09
v10=10
v11=11
v12=12
v13=13
v14=14
v15=15
v16=16
expdp t24backup/t24backup DIRECTORY=dir_n1 dumpfile=$vdate%U.dmp logfile=$vdate.log schemas=nblt24 parallel=16 compression=all EXCLUDE=STATISTICS CLUSTER=N metrics=y
gzip /db_dump/soft/$vdate$v1.dmp
gzip /db_dump/soft/$vdate$v2.dmp
gzip /db_dump/soft/$vdate$v3.dmp
gzip /db_dump/soft/$vdate$v4.dmp
gzip /db_dump/soft/$vdate$v5.dmp
gzip /db_dump/soft/$vdate$v6.dmp
gzip /db_dump/soft/$vdate$v7.dmp
gzip /db_dump/soft/$vdate$v8.dmp
gzip /db_dump/soft/$vdate$v9.dmp
gzip /db_dump/soft/$vdate$v10.dmp
gzip /db_dump/soft/$vdate$v11.dmp
gzip /db_dump/soft/$vdate$v12.dmp
gzip /db_dump/soft/$vdate$v13.dmp
gzip /db_dump/soft/$vdate$v14.dmp
gzip /db_dump/soft/$vdate$v15.dmp
gzip /db_dump/soft/$vdate$v16.dmp
#scp /db_dump/soft/$vdate* oracle@172.31.10.6:/dump_backup/

Level 1 RMAN Backup Script

==========In hpux=======
export ORACLE_BASE=/u02/app/oracle
export ORACLE_HOME=$ORACLE_BASE/product/11.2.0.4/dbhome_1
export ORACLE_SID=dcpdb1
export PATH=$ORACLE_HOME/bin:$PATH
export TZ=GMT6

dt=`date '+%d%m%Y%H%M'`

LOG_FILE=/db_rmanbackup/rman_logs/${ORACLE_SID}_DAILY_LEVEL1_BACKUP_${dt}.log
echo "DCPDB DAILY LEVEL 1 BACKUP STARTED on `date` " >$LOG_FILE
rman  <<! >>$LOG_FILE
connect target rmanbkp/rmanbkp
CONFIGURE RETENTION POLICY TO RECOVERY WINDOW OF 7 DAYS;
CONFIGURE ARCHIVELOG DELETION POLICY TO APPLIED ON ALL STANDBY;
sql 'alter system archive log current';
RUN
{
allocate channel c1  type disk;
allocate channel c2  type disk;
allocate channel c3  type disk;
allocate channel c4  type disk;
allocate channel c5  type disk;
allocate channel c6  type disk;
allocate channel c7  type disk;
sql "alter system switch logfile";
backup incremental level 1 cumulative AS COMPRESSED BACKUPSET database tag 'LEV1_T24_DB_$dt' format '/db_rmanbackup/t24_db_l1_%p_%s_$dt.bkp';
backup AS COMPRESSED BACKUPSET archivelog all tag 'daily_arch_bkp_disk' format '/db_rmanbackup/t24_arch_l1_%p_%s_$dt.bkp';
backup current controlfile tag T24_CTL_$dt format '/db_rmanbackup/t24_ctl_l1_%p_%s_$dt.bkp';
backup spfile tag T24_SPF_$dt format '/db_rmanbackup/t24_spf_l1_%p_%s_$dt.bkp';
CROSSCHECK BACKUP;
CROSSCHECK ARCHIVELOG ALL;
delete force noprompt archivelog until time 'sysdate -3';
DELETE NOPROMPT OBSOLETE RECOVERY WINDOW OF 7 DAYS;
release channel c1;
release channel c2;
release channel c3;
release channel c4;
release channel c5;
release channel c6;
release channel c7;
}
!
echo "DCPDB LEVEL 1 BACKUP FINISHIED on  `date` " >>$LOG_FILE

exit 0

=======in linux========
export ORACLE_BASE=/u01/app/oracle
export ORACLE_HOME=$ORACLE_BASE/product/11.2.0.4.0/dbhome_1
export ORACLE_SID=remitdb
export PATH=$ORACLE_HOME/bin:$PATH
#export TZ=GMT6

dt=`date '+%d%m%Y%H%M'`

LOG_FILE=/qpay_rmanbackup/rman_logs/${ORACLE_SID}_DAILY_LEVEL1_BACKUP_${dt}.log
echo "DCPDB DAILY LEVEL 1 BACKUP STARTED on `date` " >$LOG_FILE
rman  <<! >>$LOG_FILE
connect target rmanbkp/rmanbkp
CONFIGURE RETENTION POLICY TO RECOVERY WINDOW OF 7 DAYS;
CONFIGURE ARCHIVELOG DELETION POLICY TO APPLIED ON ALL STANDBY;
sql 'alter system archive log current';
RUN
{
allocate channel c1  type disk;
allocate channel c2  type disk;
sql "alter system switch logfile";
backup incremental level 1 cumulative AS COMPRESSED BACKUPSET database tag 'LEV1_QPAY_DB_$dt' format '/qpay_rmanbackup/qpay_db_l1_%p_%s_$dt.bkp';
backup AS COMPRESSED BACKUPSET archivelog all tag 'daily_arch_bkp_disk' format '/qpay_rmanbackup/qpay_arch_l1_%p_%s_$dt.bkp';
backup current controlfile tag QPAY_CTL_$dt format '/qpay_rmanbackup/qpay_ctl_l1_%p_%s_$dt.bkp';
backup spfile tag QPAY_SPF_$dt format '/qpay_rmanbackup/qpay_spf_l1_%p_%s_$dt.bkp';
CROSSCHECK BACKUP;
CROSSCHECK ARCHIVELOG ALL;
delete noprompt archivelog until time 'sysdate -3';
DELETE NOPROMPT OBSOLETE RECOVERY WINDOW OF 7 DAYS;
release channel c1;
release channel c2;
}
!
echo "DCPDB LEVEL 1 BACKUP FINISHIED on  `date` " >>$LOG_FILE

exit 0

Level 0 RMAN Backup Script


=====In hpux===
export ORACLE_BASE=/u02/app/oracle
export ORACLE_HOME=$ORACLE_BASE/product/11.2.0.4/dbhome_1
export ORACLE_SID=dcpdb1
export PATH=$ORACLE_HOME/bin:$PATH
export TZ=GMT6

dt=`date '+%d%m%Y%H%M'`

LOG_FILE=/db_rmanbackup/rman_logs/${ORACLE_SID}_DAILY_LEVEL0_BACKUP_${dt}.log
echo "DCPDB DAILY LEVEL 0 BACKUP STARTED on `date` " >$LOG_FILE
rman  <<! >>$LOG_FILE
connect target rmanbkp/rmanbkp
CONFIGURE RETENTION POLICY TO RECOVERY WINDOW OF 7 DAYS;
CONFIGURE ARCHIVELOG DELETION POLICY TO APPLIED ON ALL STANDBY;
sql 'alter system archive log current';
RUN
{
allocate channel c1  type disk;
allocate channel c2  type disk;
allocate channel c3  type disk;
allocate channel c4  type disk;
allocate channel c5  type disk;
allocate channel c6  type disk;
allocate channel c7  type disk;
sql "alter system switch logfile";
backup incremental level 0 AS COMPRESSED BACKUPSET database tag 'LEV0_T24_DB_$dt' format '/db_rmanbackup/t24_db_l0_%p_%s_$dt.bkp';
backup AS COMPRESSED BACKUPSET archivelog all tag 'daily_arch_bkp_disk' format '/db_rmanbackup/t24_arch_l0_%p_%s_$dt.bkp';
backup current controlfile tag T24_CTL_$dt format '/db_rmanbackup/t24_ctl_l0_%p_%s_$dt.bkp';
backup spfile tag T24_SPF_$dt format '/db_rmanbackup/t24_spf_l0_%p_%s_$dt.bkp';
CROSSCHECK BACKUP;
CROSSCHECK ARCHIVELOG ALL;
delete force noprompt archivelog until time 'sysdate -3';
DELETE NOPROMPT OBSOLETE RECOVERY WINDOW OF 7 DAYS;
release channel c1;
release channel c2;
release channel c3;
release channel c4;
release channel c5;
release channel c6;
release channel c7;
}
!
echo "DCPDB DAILY LEVEL 0 BACKUP FINISHIED on  `date` " >>$LOG_FILE

exit 0


====In Linux===
export ORACLE_BASE=/u01/app/oracle
export ORACLE_HOME=$ORACLE_BASE/product/11.2.0.4.0/dbhome_1
export ORACLE_SID=remitdb
export PATH=$ORACLE_HOME/bin:$PATH
#export TZ=GMT6

dt=`date '+%d%m%Y%H%M'`

LOG_FILE=/qpay_rmanbackup/rman_logs/${ORACLE_SID}_DAILY_LEVEL0_BACKUP_${dt}.log
echo "DCPDB DAILY LEVEL 0 BACKUP STARTED on `date` " >$LOG_FILE
rman  <<! >>$LOG_FILE
connect target rmanbkp/rmanbkp
CONFIGURE RETENTION POLICY TO RECOVERY WINDOW OF 7 DAYS;
CONFIGURE ARCHIVELOG DELETION POLICY TO APPLIED ON ALL STANDBY;
sql 'alter system archive log current';
RUN
{
allocate channel c1  type disk;
allocate channel c2  type disk;
sql "alter system switch logfile";
backup incremental level 0 AS COMPRESSED BACKUPSET database tag 'LEV0_QPAY_DB_$dt' format '/qpay_rmanbackup/qpay_db_l0_%p_%s_$dt.bkp';
backup AS COMPRESSED BACKUPSET archivelog all tag 'QPAY_arch_bkp_disk' format '/qpay_rmanbackup/qpay_arch_l0_%p_%s_$dt.bkp';
backup current controlfile tag QPAY_CTL_$dt format '/qpay_rmanbackup/qpay_ctl_lv0_%p_%s_$dt.bkp';
backup spfile tag QPAY_SPF_$dt format '/qpay_rmanbackup/qpay_spf_lv0_%p_%s_$dt.bkp';
CROSSCHECK BACKUP;
CROSSCHECK ARCHIVELOG ALL;
delete noprompt archivelog until time 'sysdate -3';
DELETE NOPROMPT OBSOLETE RECOVERY WINDOW OF 7 DAYS;
release channel c1;
release channel c2;
}
!
echo "DCPDB DAILY LEVEL 0 BACKUP FINISHIED on  `date` " >>$LOG_FILE

exit 0

Dataguard Broker

Last login: Mon May 21 18:42:35 2018
[oracle@bach1 ~]$
[oracle@bach1 ~]$ dgmgrl sys@cdb12c
DGMGRL for Linux: Release 12.2.0.1.0 - Production on Mon May 21 23:58:41 2018

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

Welcome to DGMGRL, type "help" for information.
Password:
Connected to "cdb12c"
Connected as SYSDBA.
DGMGRL>
DGMGRL>
DGMGRL>
DGMGRL> create configuration cdb as primary database is cdb12c connect identifier is cdb12c;
Configuration "cdb" created with primary database "cdb12c"
DGMGRL>
DGMGRL>
DGMGRL>
DGMGRL> add database cdr12c as  connect identifier is cdr12c maintained as physical;
Database "cdr12c" added
DGMGRL>
DGMGRL>
DGMGRL>
DGMGRL>
DGMGRL> enable configuration;
Enabled.
DGMGRL> show configuration;

Configuration - cdb

  Protection Mode: MaxPerformance
  Members:
  cdb12c - Primary database
    cdr12c - Physical standby database
      Warning: ORA-16809: multiple warnings detected for the member

Fast-Start Failover: DISABLED

Configuration Status:
WARNING   (status updated 38 seconds ago)

DGMGRL>
DGMGRL> show database cdr12c

Database - cdr12c

  Role:               PHYSICAL STANDBY
  Intended State:     APPLY-ON
  Transport Lag:      3 minutes (computed 26 seconds ago)
  Apply Lag:          3 minutes (computed 26 seconds ago)
  Average Apply Rate: 6.00 KByte/s
  Real Time Query:    ON
  Instance(s):
    cdr12c

  Database Warning(s):
    ORA-16853: apply lag has exceeded specified threshold
    ORA-16855: transport lag has exceeded specified threshold
    ORA-16789: standby redo logs configured incorrectly

Database Status:
WARNING

DGMGRL>
DGMGRL> show database cdb12c

Database - cdb12c

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

Database Status:
SUCCESS

DGMGRL> show database cdr12c

Database - cdr12c

  Role:               PHYSICAL STANDBY
  Intended State:     APPLY-ON
  Transport Lag:      4 minutes (computed 21 seconds ago)
  Apply Lag:          4 minutes (computed 21 seconds ago)
  Average Apply Rate: 6.00 KByte/s
  Real Time Query:    ON
  Instance(s):
    cdr12c

  Database Warning(s):
    ORA-16853: apply lag has exceeded specified threshold
    ORA-16855: transport lag has exceeded specified threshold
    ORA-16789: standby redo logs configured incorrectly

Database Status:
WARNING

DGMGRL>
DGMGRL>
DGMGRL> show database cdr12c

Database - cdr12c

  Role:               PHYSICAL STANDBY
  Intended State:     APPLY-ON
  Transport Lag:      10 minutes 59 seconds (computed 52 seconds ago)
  Apply Lag:          10 minutes 59 seconds (computed 52 seconds ago)
  Average Apply Rate: 6.00 KByte/s
  Real Time Query:    ON
  Instance(s):
    cdr12c

  Database Warning(s):
    ORA-16853: apply lag has exceeded specified threshold
    ORA-16855: transport lag has exceeded specified threshold
    ORA-16857: member disconnected from redo source for longer than specified threshold
    ORA-16789: standby redo logs configured incorrectly

Database Status:
WARNING

DGMGRL>

DGMGRL> show database cdr12c

Database - cdr12c

  Role:               PHYSICAL STANDBY
  Intended State:     APPLY-ON
  Transport Lag:      10 hours 16 minutes 4 seconds (computed 47 seconds ago)
  Apply Lag:          10 hours 16 minutes 4 seconds (computed 47 seconds ago)
  Average Apply Rate: (unknown)
  Real Time Query:    ON
  Instance(s):
    cdr12c

  Database Warning(s):
    ORA-16853: apply lag has exceeded specified threshold
    ORA-16855: transport lag has exceeded specified threshold
    ORA-16857: member disconnected from redo source for longer than specified threshold

Database Status:
WARNING

DGMGRL>
DGMGRL>
DGMGRL> show database cdr12c

Database - cdr12c

  Role:               PHYSICAL STANDBY
  Intended State:     APPLY-ON
  Transport Lag:      10 hours 17 minutes 4 seconds (computed 5 seconds ago)
  Apply Lag:          10 hours 17 minutes 4 seconds (computed 5 seconds ago)
  Average Apply Rate: (unknown)
  Real Time Query:    ON
  Instance(s):
    cdr12c

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

Database Status:
WARNING

DGMGRL>
DGMGRL> show database cdr12c

Database - cdr12c

  Role:               PHYSICAL STANDBY
  Intended State:     APPLY-ON
  Transport Lag:      10 hours 17 minutes 4 seconds (computed 14 seconds ago)
  Apply Lag:          10 hours 17 minutes 4 seconds (computed 14 seconds ago)
  Average Apply Rate: (unknown)
  Real Time Query:    ON
  Instance(s):
    cdr12c

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

Database Status:
WARNING

DGMGRL> show database cdr12c

Database - cdr12c

  Role:               PHYSICAL STANDBY
  Intended State:     APPLY-ON
  Transport Lag:      10 hours 17 minutes 4 seconds (computed 20 seconds ago)
  Apply Lag:          10 hours 17 minutes 4 seconds (computed 20 seconds ago)
  Average Apply Rate: (unknown)
  Real Time Query:    ON
  Instance(s):
    cdr12c

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

Database Status:
WARNING

DGMGRL>
DGMGRL>
DGMGRL>
DGMGRL> show database cdr12c

Database - cdr12c

  Role:               PHYSICAL STANDBY
  Intended State:     APPLY-ON
  Transport Lag:      10 hours 20 minutes 5 seconds (computed 20 seconds ago)
  Apply Lag:          10 hours 20 minutes 5 seconds (computed 20 seconds ago)
  Average Apply Rate: (unknown)
  Real Time Query:    ON
  Instance(s):
    cdr12c

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

Database Status:
WARNING

DGMGRL>
DGMGRL>
DGMGRL> show database cdr12c StandbyFileManagement;
  StandbyFileManagement = 'AUTO'
DGMGRL>
DGMGRL> show database cdb12c StandbyFileManagement;
  StandbyFileManagement = 'AUTO'
DGMGRL>
DGMGRL> exit
[oracle@bach1 ~]$
[oracle@bach1 ~]$ dgmgrl sys@cdb12c
DGMGRL for Linux: Release 12.2.0.1.0 - Production on Tue May 22 21:49:27 2018

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

Welcome to DGMGRL, type "help" for information.
Password:
Connected to "cdb12c"
Connected as SYSDBA.
DGMGRL>
DGMGRL>
DGMGRL>
DGMGRL> show database cdb12c

Database - cdb12c

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

Database Status:
SUCCESS

DGMGRL>
DGMGRL> show database cdr12c

Database - cdr12c

  Role:               PHYSICAL STANDBY
  Intended State:     APPLY-ON
  Transport Lag:      10 hours 31 minutes 5 seconds (computed 51 seconds ago)
  Apply Lag:          10 hours 31 minutes 5 seconds (computed 51 seconds ago)
  Average Apply Rate: (unknown)
  Real Time Query:    ON
  Instance(s):
    cdr12c

  Database Warning(s):
    ORA-16853: apply lag has exceeded specified threshold
    ORA-16855: transport lag has exceeded specified threshold
    ORA-16857: member disconnected from redo source for longer than specified threshold

Database Status:
WARNING

DGMGRL>
DGMGRL> show database cdr12c

Database - cdr12c

  Role:               PHYSICAL STANDBY
  Intended State:     APPLY-ON
  Transport Lag:      10 hours 37 minutes 6 seconds (computed 19 seconds ago)
  Apply Lag:          10 hours 37 minutes 6 seconds (computed 19 seconds ago)
  Average Apply Rate: (unknown)
  Real Time Query:    ON
  Instance(s):
    cdr12c

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

Database Status:
WARNING

DGMGRL>
DGMGRL> help TransportDisconnectedThreshold
Unrecognized command "transportdisconnectedthreshold", try "help"
DGMGRL>
DGMGRL> show database cdr12c

Database - cdr12c

  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: 39.00 KByte/s
  Real Time Query:    ON
  Instance(s):
    cdr12c

Database Status:
SUCCESS

DGMGRL>
DGMGRL>
DGMGRL> show database cdr12c

Database - cdr12c

  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: 38.00 KByte/s
  Real Time Query:    ON
  Instance(s):
    cdr12c

Database Status:
SUCCESS

DGMGRL>
DGMGRL>
DGMGRL>
DGMGRL>
DGMGRL> show database cdr12c

Database - cdr12c

  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: 38.00 KByte/s
  Real Time Query:    ON
  Instance(s):
    cdr12c

Database Status:
SUCCESS

DGMGRL>
DGMGRL>
DGMGRL> show database cdb12c

Database - cdb12c

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

Database Status:
SUCCESS

DGMGRL>
DGMGRL>
DGMGRL>
DGMGRL>
DGMGRL> show database cdr12c

Database - cdr12c

  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: 37.00 KByte/s
  Real Time Query:    ON
  Instance(s):
    cdr12c

Database Status:
SUCCESS

DGMGRL>
DGMGRL>
DGMGRL>
DGMGRL> show database cdb12c

Database - cdb12c

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

Database Status:
SUCCESS

DGMGRL>
DGMGRL>
DGMGRL> show database cdr12c

Database - cdr12c

  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: 10.00 KByte/s
  Real Time Query:    ON
  Instance(s):
    cdr12c

Database Status:
SUCCESS

DGMGRL>
DGMGRL>
DGMGRL>
DGMGRL>
DGMGRL>
DGMGRL>
DGMGRL> show configuration

Configuration - cdb

  Protection Mode: MaxPerformance
  Members:
  cdb12c - Primary database
    cdr12c - Physical standby database

Fast-Start Failover: DISABLED

Configuration Status:
SUCCESS   (status updated 31 seconds ago)

DGMGRL>
DGMGRL> show database secondary;
Object "secondary" was not found
DGMGRL>
DGMGRL>
DGMGRL>
DGMGRL>
DGMGRL> show instance cdb12c

Instance 'cdb12c' of database 'cdb12c'


Instance Status:
SUCCESS

DGMGRL>
DGMGRL>
DGMGRL>
DGMGRL> help

The following commands are available:

@              Execute DGMGRL script file
!              Host operating system command
/              Repeat the last command
--             Comment to be ignored by DGMGRL
add            Adds a member to the broker configuration
connect        Connects to an Oracle database instance
convert        Converts a database from one type to another
create         Creates a broker configuration
disable        Disables a configuration, a member, or fast-start failover
edit           Edits a configuration or a member
enable         Enables a configuration, a member, or fast-start failover
exit           Exits the program
failover       Changes a standby database to be the primary database
help           Displays description and syntax for a command
host           Host operating system command
migrate        Migrate a pluggable database from one configuration to another.
quit           Exits the program
reinstate      Changes a database marked for reinstatement into a viable standby
rem            Comment to be ignored by DGMGRL
remove         Removes a configuration or a member
set            Set a property to a specified value
show           Displays information about a configuration or a member
shutdown       Shuts down a currently running Oracle database instance
spool          store input and output of DGMGRL CLI in a file
sql            Executes a SQL statement
start          Starts the fast-start failover observer
startup        Starts an Oracle database instance
stop           Stops the fast-start failover observer
switchover     Switches roles between a primary and standby database
validate       Performs an exhaustive set of validations for a database

Use "help <command>" to see syntax for individual commands

DGMGRL>
DGMGRL>
DGMGRL> validate database cdb12c

  Database Role:    Primary database

  Ready for Switchover:  Yes

  Flashback Database Status:
    cdb12c:  Off

  Managed by Clusterware:
    cdb12c:  NO
    Warning: Ensure primary database's StaticConnectIdentifier property
    is configured properly so that the primary database can be restarted
    by DGMGRL after switchover

DGMGRL> validate database cdr12c

  Database Role:     Physical standby database
  Primary Database:  cdb12c

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

  Flashback Database Status:
    cdb12c:  Off
    cdr12c:  Off

  Managed by Clusterware:
    cdb12c:  NO
    cdr12c:  NO
    Warning: Ensure primary database's StaticConnectIdentifier property
    is configured properly so that the primary database can be restarted
    by DGMGRL after switchover

DGMGRL> validate database cdb12c

  Database Role:    Primary database

  Ready for Switchover:  Yes

  Managed by Clusterware:
    cdb12c:  NO
    Warning: Ensure primary database's StaticConnectIdentifier property
    is configured properly so that the primary database can be restarted
    by DGMGRL after switchover

DGMGRL>
DGMGRL> validate database cdr12c

  Database Role:     Physical standby database
  Primary Database:  cdb12c

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

  Flashback Database Status:
    cdb12c:  On
    cdr12c:  Off

  Managed by Clusterware:
    cdb12c:  NO
    cdr12c:  NO
    Warning: Ensure primary database's StaticConnectIdentifier property
    is configured properly so that the primary database can be restarted
    by DGMGRL after switchover

DGMGRL>
DGMGRL> show database cdr12c

Database - cdr12c

  Role:               PHYSICAL STANDBY
  Intended State:     OFFLINE
  Transport Lag:      (unknown)
  Apply Lag:          (unknown)
  Average Apply Rate: (unknown)
  Real Time Query:    OFF
  Instance(s):
    cdr12c

Database Status:
SHUTDOWN

DGMGRL>
DGMGRL> show database cdb12c

Database - cdb12c

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

Database Status:
SUCCESS

DGMGRL>
DGMGRL>
DGMGRL> show database cdr12c

Database - cdr12c

  Role:               PHYSICAL STANDBY
  Intended State:     OFFLINE
  Transport Lag:      (unknown)
  Apply Lag:          (unknown)
  Average Apply Rate: (unknown)
  Real Time Query:    OFF
  Instance(s):
    cdr12c

Database Status:
SHUTDOWN

DGMGRL>
DGMGRL>
DGMGRL>
DGMGRL>
DGMGRL>
DGMGRL> show database cdr12c

Database - cdr12c

  Role:               PHYSICAL STANDBY
  Intended State:     OFFLINE
  Transport Lag:      (unknown)
  Apply Lag:          (unknown)
  Average Apply Rate: (unknown)
  Real Time Query:    OFF
  Instance(s):
    cdr12c

Database Status:
SHUTDOWN

DGMGRL>
DGMGRL>
DGMGRL>
DGMGRL>
DGMGRL> show database cdr12c

Database - cdr12c

  Role:               PHYSICAL STANDBY
  Intended State:     OFFLINE
  Transport Lag:      (unknown)
  Apply Lag:          (unknown)
  Average Apply Rate: (unknown)
  Real Time Query:    OFF
  Instance(s):
    cdr12c

Database Status:
SHUTDOWN

DGMGRL>
DGMGRL>

DGMGRL>
DGMGRL> show database cdb12c

Database - cdb12c

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

Database Status:
SUCCESS

DGMGRL>
DGMGRL> show database cdr12c

Database - cdr12c

  Role:               PHYSICAL STANDBY
  Intended State:     OFFLINE
  Transport Lag:      (unknown)
  Apply Lag:          (unknown)
  Average Apply Rate: (unknown)
  Real Time Query:    OFF
  Instance(s):
    cdr12c

Database Status:
SHUTDOWN

DGMGRL>
DGMGRL>
DGMGRL>
DGMGRL> show database cdr12c

Database - cdr12c

  Role:               PHYSICAL STANDBY
  Intended State:     OFFLINE
  Transport Lag:      (unknown)
  Apply Lag:          (unknown)
  Average Apply Rate: (unknown)
  Real Time Query:    OFF
  Instance(s):
    cdr12c

Database Status:
SHUTDOWN

DGMGRL>
DGMGRL>
DGMGRL>
DGMGRL> exit
[oracle@bach1 ~]$
[oracle@bach1 ~]$
[oracle@bach1 ~]$
[oracle@bach1 ~]$
[oracle@bach1 ~]$ dgmgl
bash: dgmgl: command not found...
[oracle@bach1 ~]$
[oracle@bach1 ~]$ dgmgrl
DGMGRL for Linux: Release 12.2.0.1.0 - Production on Wed May 23 00:42:36 2018

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

Welcome to DGMGRL, type "help" for information.
DGMGRL>
DGMGRL> exit
[oracle@bach1 ~]$ dgmgrl sys/Nblcdb12c
DGMGRL for Linux: Release 12.2.0.1.0 - Production on Wed May 23 00:43:11 2018

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

Welcome to DGMGRL, type "help" for information.
Connected to "cdb12c"
Connected as SYSDG.
DGMGRL>
DGMGRL>
DGMGRL>
DGMGRL> show database cdb12c

Database - cdb12c

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

Database Status:
SUCCESS

DGMGRL>
DGMGRL>
DGMGRL> show database database cdr12c
Object "database" was not found
DGMGRL>
DGMGRL>
DGMGRL> show database cdr12c

Database - cdr12c

  Role:               PHYSICAL STANDBY
  Intended State:     OFFLINE
  Transport Lag:      (unknown)
  Apply Lag:          (unknown)
  Average Apply Rate: (unknown)
  Real Time Query:    OFF
  Instance(s):
    cdr12c

Database Status:
SHUTDOWN

DGMGRL>
DGMGRL>
DGMGRL>
DGMGRL> show database cdr12c

Database - cdr12c

  Role:               PHYSICAL STANDBY
  Intended State:     OFFLINE
  Transport Lag:      (unknown)
  Apply Lag:          (unknown)
  Average Apply Rate: (unknown)
  Real Time Query:    OFF
  Instance(s):
    cdr12c

Database Status:
SHUTDOWN

DGMGRL>
DGMGRL>
DGMGRL> show database cdr12c

Database - cdr12c

  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: 1.00 KByte/s
  Real Time Query:    ON
  Instance(s):
    cdr12c
      Warning: ORA-16714: the value of property ArchiveLagTarget is inconsistent with the member setting
      Warning: ORA-16714: the value of property LogArchiveMaxProcesses is inconsistent with the member setting
      Warning: ORA-16714: the value of property LogArchiveMinSucceedDest is inconsistent with the member setting
      Warning: ORA-16714: the value of property DataGuardSyncLatency is inconsistent with the member setting

Database Status:
WARNING

DGMGRL> show database cdr12c

Database - cdr12c

  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: 1.00 KByte/s
  Real Time Query:    ON
  Instance(s):
    cdr12c
      Warning: ORA-16714: the value of property ArchiveLagTarget is inconsistent with the member setting
      Warning: ORA-16714: the value of property LogArchiveMaxProcesses is inconsistent with the member setting
      Warning: ORA-16714: the value of property LogArchiveMinSucceedDest is inconsistent with the member setting
      Warning: ORA-16714: the value of property DataGuardSyncLatency is inconsistent with the member setting

Database Status:
WARNING

DGMGRL> show database cdr12c

Database - cdr12c

  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: 1.00 KByte/s
  Real Time Query:    ON
  Instance(s):
    cdr12c
      Warning: ORA-16714: the value of property ArchiveLagTarget is inconsistent with the member setting
      Warning: ORA-16714: the value of property LogArchiveMaxProcesses is inconsistent with the member setting
      Warning: ORA-16714: the value of property LogArchiveMinSucceedDest is inconsistent with the member setting
      Warning: ORA-16714: the value of property DataGuardSyncLatency is inconsistent with the member setting

Database Status:
WARNING

DGMGRL>
DGMGRL>
DGMGRL> show database cdb12c

Database - cdb12c

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

Database Status:
SUCCESS

DGMGRL> show database cdr12c

Database - cdr12c

  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: 1.00 KByte/s
  Real Time Query:    ON
  Instance(s):
    cdr12c
      Warning: ORA-16714: the value of property ArchiveLagTarget is inconsistent with the member setting
      Warning: ORA-16714: the value of property LogArchiveMaxProcesses is inconsistent with the member setting
      Warning: ORA-16714: the value of property LogArchiveMinSucceedDest is inconsistent with the member setting
      Warning: ORA-16714: the value of property DataGuardSyncLatency is inconsistent with the member setting

Database Status:
WARNING

DGMGRL>
DGMGRL>
DGMGRL>
DGMGRL> show configuration

Configuration - cdb

  Protection Mode: MaxPerformance
  Members:
  cdb12c - Primary database
    cdr12c - Physical standby database
      Warning: ORA-16792: configurable property value is inconsistent with member setting

Fast-Start Failover: DISABLED

Configuration Status:
WARNING   (status updated 29 seconds ago)

DGMGRL> show database ‘PRIMARY’ InconsistentProperties
Object "???primary???" was not found
DGMGRL>
DGMGRL> show database 'cdb12c' InconsistentProperties
INCONSISTENT PROPERTIES
   INSTANCE_NAME        PROPERTY_NAME         MEMORY_VALUE         SPFILE_VALUE         BROKER_VALUE

DGMGRL>
DGMGRL>
DGMGRL> SHOW CONFIGURATION VERBOSE;

Configuration - cdb

  Protection Mode: MaxPerformance
  Members:
  cdb12c - Primary database
    cdr12c - Physical standby database
      Warning: ORA-16792: configurable property value is inconsistent with member setting

  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    = 'cdb12c_CFG'

Fast-Start Failover: DISABLED

Configuration Status:
WARNING

DGMGRL> show database primary statusreport;
Object "primary" was not found
DGMGRL>
DGMGRL>
DGMGRL> show databsae cdb12c statusreport;
show databsae cdb12c statusreport;
     ^
Syntax error before or at "databsae"
DGMGRL>
DGMGRL> show database cdb12c statusreport;
STATUS REPORT
       INSTANCE_NAME   SEVERITY ERROR_TEXT

DGMGRL>
DGMGRL> show database cdr12c statusreport;
STATUS REPORT
       INSTANCE_NAME   SEVERITY ERROR_TEXT
              cdr12c    WARNING ORA-16714: the value of property ArchiveLagTarget is inconsistent with the member setting
              cdr12c    WARNING ORA-16714: the value of property LogArchiveMaxProcesses is inconsistent with the member setting
              cdr12c    WARNING ORA-16714: the value of property LogArchiveMinSucceedDest is inconsistent with the member setting
              cdr12c    WARNING ORA-16714: the value of property DataGuardSyncLatency is inconsistent with the member setting

DGMGRL> show configuration

Configuration - cdb

  Protection Mode: MaxPerformance
  Members:
  cdb12c - Primary database
    cdr12c - Physical standby database
      Warning: ORA-16809: multiple warnings detected for the member

Fast-Start Failover: DISABLED

Configuration Status:
WARNING   (status updated 34 seconds ago)

DGMGRL> show database cdr12c statusreport;
STATUS REPORT
       INSTANCE_NAME   SEVERITY ERROR_TEXT
                   *    WARNING ORA-16853: apply lag has exceeded specified threshold
                   *    WARNING ORA-16855: transport lag has exceeded specified threshold
              cdr12c    WARNING ORA-16714: the value of property DataGuardSyncLatency is inconsistent with the member setting

DGMGRL> show database cdr12c statusreport;
STATUS REPORT
       INSTANCE_NAME   SEVERITY ERROR_TEXT
                   *    WARNING ORA-16853: apply lag has exceeded specified threshold
                   *    WARNING ORA-16855: transport lag has exceeded specified threshold

DGMGRL> show database cdr12c statusreport;
STATUS REPORT
       INSTANCE_NAME   SEVERITY ERROR_TEXT
                   *    WARNING ORA-16853: apply lag has exceeded specified threshold
                   *    WARNING ORA-16855: transport lag has exceeded specified threshold

DGMGRL>
DGMGRL>
DGMGRL> /
STATUS REPORT
       INSTANCE_NAME   SEVERITY ERROR_TEXT
                   *    WARNING ORA-16853: apply lag has exceeded specified threshold
                   *    WARNING ORA-16855: transport lag has exceeded specified threshold

DGMGRL>
DGMGRL>
DGMGRL>
DGMGRL>
DGMGRL> show database cdr12c

Database - cdr12c

  Role:               PHYSICAL STANDBY
  Intended State:     APPLY-ON
  Transport Lag:      2 minutes 46 seconds (computed 12 seconds ago)
  Apply Lag:          2 minutes 46 seconds (computed 12 seconds ago)
  Average Apply Rate: 1.00 KByte/s
  Real Time Query:    ON
  Instance(s):
    cdr12c

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

Database Status:
WARNING

DGMGRL>
DGMGRL> show database cdr12c

Database - cdr12c

  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:    ON
  Instance(s):
    cdr12c

Database Status:
SUCCESS

DGMGRL>
DGMGRL>
DGMGRL>
DGMGRL>
DGMGRL>
DGMGRL>
DGMGRL> show database cdb12c

Database - cdb12c

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

Database Status:
SUCCESS

DGMGRL>
DGMGRL>
DGMGRL> show database cdr12c

Database - cdr12c

  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:    ON
  Instance(s):
    cdr12c

Database Status:
SUCCESS

DGMGRL>
DGMGRL>
DGMGRL>
DGMGRL>
DGMGRL>
DGMGRL>
DGMGRL>
DGMGRL> show database cdr12c

Database - cdr12c

  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:    ON
  Instance(s):
    cdr12c

Database Status:
SUCCESS

DGMGRL>
DGMGRL>
DGMGRL> show database cdb12c

Database - cdb12c

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

Database Status:
SUCCESS

DGMGRL>
DGMGRL>
DGMGRL>
DGMGRL>
DGMGRL> show database cdr12c

Database - cdr12c

  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:    ON
  Instance(s):
    cdr12c

Database Status:
SUCCESS

DGMGRL>
DGMGRL>
DGMGRL> show database cdb12c

Database - cdb12c

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

Database Status:
SUCCESS

DGMGRL>
DGMGRL>
DGMGRL>
DGMGRL>
DGMGRL>
DGMGRL> show database cdb12c

Database - cdb12c

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

Database Status:
SUCCESS

DGMGRL>
DGMGRL>
DGMGRL> show database cdr12c

Database - cdr12c

  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: 3.00 KByte/s
  Real Time Query:    ON
  Instance(s):
    cdr12c

Database Status:
SUCCESS

DGMGRL>
DGMGRL>
DGMGRL>
DGMGRL>
DGMGRL>
DGMGRL> show configuration

Configuration - cdb

  Protection Mode: MaxPerformance
  Members:
  cdb12c - Primary database
    cdr12c - Physical standby database

Fast-Start Failover: DISABLED

Configuration Status:
SUCCESS   (status updated 47 seconds ago)

DGMGRL>
DGMGRL>
DGMGRL>
DGMGRL>
DGMGRL>
DGMGRL> show configuration

Configuration - cdb

  Protection Mode: MaxPerformance
  Members:
  cdb12c - Primary database
    cdr12c - Physical standby database

Fast-Start Failover: DISABLED

Configuration Status:
SUCCESS   (status updated 9 seconds ago)

DGMGRL>
DGMGRL>
DGMGRL>
DGMGRL>
DGMGRL> validate database cdr12c

  Database Role:     Physical standby database
  Primary Database:  cdb12c

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

  Managed by Clusterware:
    cdb12c:  NO
    cdr12c:  NO
    Warning: Ensure primary database's StaticConnectIdentifier property
    is configured properly so that the primary database can be restarted
    by DGMGRL after switchover

DGMGRL>
DGMGRL>
DGMGRL>
DGMGRL>
DGMGRL>
DGMGRL>
DGMGRL> show configuration

Configuration - cdb

  Protection Mode: MaxPerformance
  Members:
  cdb12c - Primary database
    cdr12c - Physical standby database

Fast-Start Failover: DISABLED

Configuration Status:
SUCCESS   (status updated 30 seconds ago)

DGMGRL>
DGMGRL>
DGMGRL> show configuration

Configuration - cdb

  Protection Mode: MaxPerformance
  Members:
  cdb12c - Primary database
    cdr12c - Physical standby database

Fast-Start Failover: DISABLED

Configuration Status:
SUCCESS   (status updated 38 seconds ago)

DGMGRL>
DGMGRL> show database cdr12c

Database - cdr12c

  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: 10.00 KByte/s
  Real Time Query:    ON
  Instance(s):
    cdr12c

Database Status:
SUCCESS

DGMGRL>
DGMGRL> show database cdb12c

Database - cdb12c

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

Database Status:
SUCCESS

DGMGRL> validate database cdr12c

  Database Role:     Physical standby database
  Primary Database:  cdb12c

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

  Managed by Clusterware:
    cdb12c:  NO
    cdr12c:  NO
    Warning: Ensure primary database's StaticConnectIdentifier property
    is configured properly so that the primary database can be restarted
    by DGMGRL after switchover

DGMGRL>
DGMGRL>
DGMGRL>
DGMGRL> validate database cdr12c

  Database Role:     Physical standby database
  Primary Database:  cdb12c

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

  Managed by Clusterware:
    cdb12c:  NO
    cdr12c:  NO
    Warning: Ensure primary database's StaticConnectIdentifier property
    is configured properly so that the primary database can be restarted
    by DGMGRL after switchover

DGMGRL>
DGMGRL>
DGMGRL>
DGMGRL> validate database cdb12c

  Database Role:    Primary database

  Ready for Switchover:  Yes

  Managed by Clusterware:
    cdb12c:  NO
    Warning: Ensure primary database's StaticConnectIdentifier property
    is configured properly so that the primary database can be restarted
    by DGMGRL after switchover

DGMGRL>
DGMGRL>
DGMGRL> validate database cdb12c

  Database Role:    Primary database

  Ready for Switchover:  Yes

  Managed by Clusterware:
    cdb12c:  NO
    Warning: Ensure primary database's StaticConnectIdentifier property
    is configured properly so that the primary database can be restarted
    by DGMGRL after switchover

DGMGRL>
DGMGRL> validate database cdr12c

  Database Role:     Physical standby database
  Primary Database:  cdb12c

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

  Managed by Clusterware:
    cdb12c:  NO
    cdr12c:  NO
    Warning: Ensure primary database's StaticConnectIdentifier property
    is configured properly so that the primary database can be restarted
    by DGMGRL after switchover

DGMGRL>
DGMGRL>
DGMGRL>
DGMGRL> validate database cdr12c

  Database Role:     Physical standby database
  Primary Database:  cdb12c

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

  Managed by Clusterware:
    cdb12c:  NO
    cdr12c:  NO
    Warning: Ensure primary database's StaticConnectIdentifier property
    is configured properly so that the primary database can be restarted
    by DGMGRL after switchover

DGMGRL>
DGMGRL>
DGMGRL>
DGMGRL>
DGMGRL> show database cdb12c

Database - cdb12c

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

Database Status:
SUCCESS

DGMGRL>
DGMGRL> show database
show database
             ^
Syntax error before or at "end-of-line"
DGMGRL>
DGMGRL> show database cdb12c

Database - cdb12c

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

Database Status:
SUCCESS

DGMGRL>
DGMGRL> show database cdr12c

Database - cdr12c

  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: 9.00 KByte/s
  Real Time Query:    ON
  Instance(s):
    cdr12c

Database Status:
SUCCESS

DGMGRL>
DGMGRL> exit
[oracle@bach1 ~]$

Alert log Clear or Move

cp -rp alert_dcpdb1.log alert_dcpdb1.log.bk.030718
> alert_dcpdb1.log

cat alert_dcpdb1.log.bk.030718 | grep -i ora-
tail -1000 alert_dcpdb1.log.bk.030718 > alert_dcpdb1.log.bk.030718.1000lines

tail -3000 alert_dcpdb2.log > /u02/app/alert_dcpdb2.log

Yum configuration on RHEL

--cdrom mount
#mount /dev/sr0  /cdrom   

Step-1:
cp -vR /cdrpm/*    /destination

Step-2:
#cd /etc/yum.repo.d/
#vi server.repo

[serverrepo]
name=myrepo
baseurl=file:///destination/
enabled=1
gpgcheck=0

Step-3:
#yum clean all
#yum list

Implement
===========

[root@bachstd ]# mount /dev/sr0 /cd
mount: /dev/sr0 is write-protected, mounting read-only

[root@bachstd ]# cd /cd/
[root@bachstd cd]# ll
total 1313
drwxr-xr-x. 5 root root   2048 Aug  4  2017 addons
drwxr-xr-x. 3 root root   2048 Aug  4  2017 EFI
-rw-r--r--. 1 root root   8643 Aug  4  2017 EULA
-rw-r--r--. 1 root root  18390 Aug  4  2017 GPL
drwxr-xr-x. 3 root root   2048 Aug  4  2017 images
drwxr-xr-x. 2 root root   2048 Aug  4  2017 isolinux
drwxr-xr-x. 2 root root   2048 Aug  4  2017 LiveOS
drwxr-xr-x. 2 root root 813056 Aug  4  2017 Packages
-rw-r--r--. 1 root root 137152 Aug  4  2017 RELEASE-NOTES-U4-en
-rw-r--r--. 1 root root 346229 Aug  4  2017 RELEASE-NOTES-U4-en.html
drwxr-xr-x. 2 root root   4096 Aug  4  2017 repodata
-rw-r--r--. 1 root root   1011 Aug  4  2017 RPM-GPG-KEY
-rw-r--r--. 1 root root   1011 Aug  4  2017 RPM-GPG-KEY-oracle
-r--r--r--. 1 root root   3322 Aug  4  2017 TRANS.TBL
[root@bachstd cd]# cd
[root@bachstd ]#


Installating following packages for exists [/var/ftp/pub] directory
[root@bachstd ]# cd /cd/Packages/
[root@bachstd Packages]# rpm -ivh vsftpd-3.0.2-22.el7.x86_64.rpm
warning: vsftpd-3.0.2-22.el7.x86_64.rpm: Header V3 RSA/SHA256 Signature, key ID ec551f03: NOKEY
Preparing...                          ################################# [100%]
Updating / installing...
   1:vsftpd-3.0.2-22.el7              ################################# [100%]
[root@bachstd Packages]# cd
[root@bachstd ]#


#cp -vR /cd/* /var/ftp/pub/

[root@bachstd yum.repos.d]# vi myserver.repo
[myserver]
name=mysrv
baseurl=file:///var/ftp/pub/
enabled=1
gpgcheck=0

[root@bachstd yum.repos.d]# yum clean all
[root@bachstd yum.repos.d]# yum list

Configure Oracle 12c Physical standby database

--===================
[oracle@bach1 ~]$
vi $ORACLE_HOME/sqlplus/admin/glogin.sql

and put there following line

SET SQLPROMPT "_user'@'_connect_identifier'> '"
[oracle@bach1 ~]$ export ORACLE_SID=cdb12c

--================

[oracle@bach1 ~]$ sqlplus / as sysdba
Connected to:
Oracle Database 12c Enterprise Edition Release 12.2.0.1.0 - 64bit Production

SYS@cdb12c>


[oracle@bach1 ~]$ sqlplus / as sysdba

SQL> SELECT log_mode, open_mode, force_logging
  2    FROM v$database;

LOG_MODE     OPEN_MODE            FORCE_LOGGING
------------ -------------------- ---------------------------------------
ARCHIVELOG   READ WRITE           NO


SQL> ALTER DATABASE FORCE LOGGING;


LOG_MODE     OPEN_MODE            FORCE_LOGGING
------------ -------------------- ---------------------------------------
ARCHIVELOG   READ WRITE           YES



SYS@cdb12c> col name for a30
SYS@cdb12c> col value for a60
SYS@cdb12c>
SYS@cdb12c>
SYS@cdb12c> SELECT name, value  FROM v$parameter WHERE name LIKE 'db_recovery%';

NAME                           VALUE
------------------------------ ------------------------------------------------------------
db_recovery_file_dest          /fra/fast_recovery_area/cdb12c
db_recovery_file_dest_size     80530636800



SYS@cdb12c>
SYS@cdb12c> SELECT log_mode, open_mode FROM v$database;

LOG_MODE     OPEN_MODE
------------ --------------------
ARCHIVELOG   READ WRITE



SYS@cdb12c> set linesize 300
SYS@cdb12c> column REDOLOG_FILE_NAME format a50
SYS@cdb12c> SELECT
  2      a.GROUP#,
  3      a.THREAD#,
  4      a.SEQUENCE#,
  5      a.ARCHIVED,
  6      a.STATUS,
  7      b.MEMBER    AS REDOLOG_FILE_NAME,
  8      (a.BYTES/1024/1024) AS SIZE_MB
  9  FROM v$log a
 10  JOIN v$logfile b ON a.Group#=b.Group#
 11  ORDER BY a.GROUP# ASC;

    GROUP#    THREAD#  SEQUENCE# ARC STATUS           REDOLOG_FILE_NAME                                     SIZE_MB
---------- ---------- ---------- --- ---------------- -------------------------------------------------- ----------
         1          1        145 YES ACTIVE           /data/oradata/cdb12c/redo01.log                           200
         2          1        146 NO  CURRENT          /data/oradata/cdb12c/redo02.log                           200
         3          1        144 YES ACTIVE           /data/oradata/cdb12c/redo03.log                           200

SYS@cdb12c>


SYS@cdb12c> SELECT group#, type FROM v$logfile;

    GROUP# TYPE
---------- -------
         3 ONLINE
         2 ONLINE
         1 ONLINE

SYS@cdb12c>
SYS@cdb12c>


SYS@cdb12c> ALTER DATABASE ADD STANDBY LOGFILE SIZE 200m;

Database altered.

SYS@cdb12c> ALTER DATABASE ADD STANDBY LOGFILE SIZE 200m;

Database altered.

SYS@cdb12c> ALTER DATABASE ADD STANDBY LOGFILE SIZE 200m;

Database altered.

SYS@cdb12c> ALTER DATABASE ADD STANDBY LOGFILE SIZE 200m;

Database altered.

SYS@cdb12c>


SYS@cdb12c> SELECT group#, type FROM v$logfile;


    GROUP# TYPE
---------- -------
         3 ONLINE
         2 ONLINE
         1 ONLINE
         4 STANDBY
         5 STANDBY
         6 STANDBY
         7 STANDBY

7 rows selected.

SYS@cdb12c>


SYS@cdb12c> set pagesize 500
SYS@cdb12c> set linesize 500
SYS@cdb12c> col name for a40
SYS@cdb12c> col value for a60
SYS@cdb12c>
SYS@cdb12c> SELECT name, value
  2    FROM v$parameter
  3   WHERE name IN
  4    ( 'db_name',
  5      'db_unique_name',
  6      'log_archive_format',
  7      'remote_login_passwordfile' )
  8  ORDER BY NAME;

NAME                                     VALUE
---------------------------------------- ------------------------------------------------------------
db_name                                  cdb12c
db_unique_name                           cdb12c
log_archive_format                       %t_%s_%r.dbf
remote_login_passwordfile                EXCLUSIVE

SYS@cdb12c>



SYS@cdb12c> ALTER SYSTEM SET LOG_ARCHIVE_CONFIG ='DG_CONFIG=(cdb12c,cdr12c)' SCOPE=BOTH;

System altered.

SYS@cdb12c> ALTER SYSTEM SET LOG_ARCHIVE_DEST_1='LOCATION=USE_DB_RECOVERY_FILE_DEST VALID_FOR=(ALL_LOGFILES,ALL_ROLES) DB_UNIQUE_NAME=cdb12c' SCOPE=BOTH;

System altered.

SYS@cdb12c> ALTER SYSTEM SET LOG_ARCHIVE_DEST_2='SERVICE=cdr12c ASYNC VALID_FOR=(ONLINE_LOGFILES,PRIMARY_ROLE) DB_UNIQUE_NAME=cdr12c' SCOPE=BOTH;

System altered.


SYS@cdb12c> show parameter LOG_ARCHIVE_CONFIG

NAME                                 TYPE        VALUE
------------------------------------ ----------- ------------------------------
log_archive_config                   string      DG_CONFIG=(cdb12c,cdr12c)
SYS@cdb12c>
SYS@cdb12c> show parameter LOG_ARCHIVE_DEST_1

NAME                                 TYPE        VALUE
------------------------------------ ----------- ------------------------------
log_archive_dest_1                   string      LOCATION=USE_DB_RECOVERY_FILE_
                                                 DEST VALID_FOR=(ALL_LOGFILES,A
                                                 LL_ROLES) DB_UNIQUE_NAME=cdb12
                                                 c
log_archive_dest_10                  string
log_archive_dest_11                  string
log_archive_dest_12                  string
log_archive_dest_13                  string
log_archive_dest_14                  string
log_archive_dest_15                  string
log_archive_dest_16                  string
log_archive_dest_17                  string
log_archive_dest_18                  string
log_archive_dest_19                  string
SYS@cdb12c>
SYS@cdb12c> show parameter LOG_ARCHIVE_DEST_2

NAME                                 TYPE        VALUE
------------------------------------ ----------- ------------------------------
log_archive_dest_2                   string      SERVICE=cdr12c ASYNC VALID_FOR
                                                 =(ONLINE_LOGFILES,PRIMARY_ROLE
                                                 ) DB_UNIQUE_NAME=cdr12c
log_archive_dest_20                  string
log_archive_dest_21                  string
log_archive_dest_22                  string
log_archive_dest_23                  string
log_archive_dest_24                  string
log_archive_dest_25                  string
log_archive_dest_26                  string
log_archive_dest_27                  string
log_archive_dest_28                  string
log_archive_dest_29                  string
SYS@cdb12c>



SYS@cdb12c> ALTER SYSTEM SET FAL_SERVER = cdr12c SCOPE=BOTH;

System altered.

SYS@cdb12c> ALTER SYSTEM SET DB_FILE_NAME_CONVERT = '/cdr12c/','/cdb12c/' SCOPE=SPFILE;

System altered.

SYS@cdb12c> ALTER SYSTEM SET LOG_FILE_NAME_CONVERT = '/cdr12c/','/cdb12c/' SCOPE=SPFILE;

System altered.

SYS@cdb12c> ALTER SYSTEM SET STANDBY_FILE_MANAGEMENT = AUTO SCOPE=BOTH;

System altered.

SYS@cdb12c> STARTUP FORCE;
ORACLE instance started.

Total System Global Area 4.1339E+10 bytes
Fixed Size                 19420336 bytes
Variable Size            5905582928 bytes
Database Buffers         3.5299E+10 bytes
Redo Buffers              114794496 bytes
Database mounted.
Database opened.
SYS@cdb12c>
SYS@cdb12c> show parameter FAL_SERVER

NAME                                 TYPE        VALUE
------------------------------------ ----------- ------------------------------
fal_server                           string      CDR12C
SYS@cdb12c>
SYS@cdb12c> show parameter DB_FILE_NAME_CONVERT

NAME                                 TYPE        VALUE
------------------------------------ ----------- ------------------------------
db_file_name_convert                 string      /cdr12c/, /cdb12c/
pdb_file_name_convert                string
SYS@cdb12c> show parameter LOG_FILE_NAME_CONVERT

NAME                                 TYPE        VALUE
------------------------------------ ----------- ------------------------------
log_file_name_convert                string      /cdr12c/, /cdb12c/
SYS@cdb12c>
SYS@cdb12c> show parameter STANDBY_FILE_MANAGEMENT

NAME                                 TYPE        VALUE
------------------------------------ ----------- ------------------------------
standby_file_management              string      AUTO
SYS@cdb12c>



SYS@cdb12c> ALTER DATABASE CREATE STANDBY CONTROLFILE AS '/tmp/cdr12c.ctl';

Database altered.

SYS@cdb12c>


SYS@cdb12c> CREATE PFILE='/tmp/initCDR12C.ora' FROM SPFILE;

File created.

oracle@bach1 tmp]$ vi initCDR12C.ora
*.audit_file_dest='/u01/app/oracle/admin/cdr12c/adump'
*.audit_trail='db'
*.compatible='12.2.0'
*.control_files='/data/oradata/cdr12c/control01.ctl','/fra/fast_recovery_area/cdr12c/control02.ctl'
*.db_block_size=8192
*.db_domain='nblbd.com'
*.db_file_name_convert='/cdb12c/','/cdr12c/'
*.db_name='cdr12c'
*.db_recovery_file_dest='/fra/fast_recovery_area/cdb12c'
*.db_recovery_file_dest_size=76800m
*.diagnostic_dest='/u01/app/oracle'
*.dispatchers='(PROTOCOL=TCP) (SERVICE=cdb12cXDB)'
*.enable_pluggable_database=true
*.fal_server='CDB12C'
#*.local_listener='LISTENER_CDB12C'
*.log_archive_config='DG_CONFIG=(cdb12c,cdr12c)'
*.log_archive_dest_1='LOCATION=USE_DB_RECOVERY_FILE_DEST VALID_FOR=(ALL_LOGFILES,ALL_ROLES) DB_UNIQUE_NAME=cdr12c'
*.log_archive_dest_2='SERVICE=cdb12c ASYNC VALID_FOR=(ONLINE_LOGFILES,PRIMARY_ROLE) DB_UNIQUE_NAME=cdb12c'
*.log_archive_format='%t_%s_%r.dbf'
*.log_file_name_convert='/cdb12c/','/cdr12c/'
*.nls_language='AMERICAN'
*.nls_territory='AMERICA'
*.open_cursors=300
*.pga_aggregate_target=13124m
*.processes=1280
*.remote_login_passwordfile='EXCLUSIVE'
*.sga_target=30371m
*.standby_file_management='AUTO'
*.undo_tablespace='UNDOTBS1'


--===Standby server ==
[oracle@bachdbdr ~]$ mkdir -p /u01/app/oracle/admin/cdr12c/adump
[oracle@bachdbdr ~]$
[oracle@bachdbdr ~]$
[oracle@bachdbdr ~]$ cd /u01/app/oracle/admin/cdr12c/adump
[oracle@bachdbdr adump]$
--====End=============


[oracle@bach1 tmp]$ scp initCDR12C.ora oracle@172.31.200.39:$ORACLE_HOME/dbs
oracle@172.31.200.39's password:
initCDR12C.ora                                                                                                                                100% 1169   491.2KB/s   00:00
[oracle@bach1 tmp]$


[oracle@bach1 ~]$ scp $ORACLE_HOME/dbs/orapwcdb12c oracle@172.31.200.39:$ORACLE_HOME/dbs/orapwcdr12c
oracle@172.31.200.39's password:
orapwcdb12c                                                                                                                                   100% 3584     1.4MB/s   00:00
[oracle@bach1 ~]$


--====directories create ===
[oracle@bachdbdr cdr12c]$ mkdir -p /u01/app/oracle/admin/cdr12c/adump
[oracle@bachdbdr cdr12c]$ mkdir -p /u01/app/oracle/admin/cdr12c/dpdump
[oracle@bachdbdr cdr12c]$ mkdir -p /u01/app/oracle/admin/cdr12c/pfile
[oracle@bachdbdr cdr12c]$ mkdir -p /u01/app/oracle/admin/cdr12c/xdb_wallet


[oracle@bachdbdr ~]$ mkdir -p /fra/fast_recovery_area/cdr12c
[oracle@bachdbdr ~]$ mkdir -p /data/oradata/cdr12c
[oracle@bachdbdr ~]$ mkdir -p /data/oradata/cdr12c/pdbseed
[oracle@bachdbdr ~]$ mkdir -p /data/oradata/cdr12c/PORA12C2

[oracle@bach1 admin]$ scp tnsnames.ora oracle@172.31.200.39:$ORACLE_HOME/network/admin
oracle@172.31.200.39's password:
tnsnames.ora                                                                                                                                   100% 1585   624.5KB/s   00:00
[oracle@bach1 admin]$
[oracle@bach1 admin]$ scp listener.ora oracle@172.31.200.39:$ORACLE_HOME/network/admin
oracle@172.31.200.39's password:
listener.ora                                                                                                                                   100%  345   178.0KB/s   00:00
[oracle@bach1 admin]$
[oracle@bach1 admin]$

oracle@bachdbdr admin]$ vi listener.ora
SID_LIST_LISTENER =
  (SID_LIST =
    (SID_DESC =
      (GLOBAL_DBNAME = cdb12c.nblbd.com)
      (ORACLE_HOME = /u01/app/oracle/product/12.2.0.1/dbhome_1)
      (SID_NAME = cdb12c)
    )
    (SID_DESC =
      (GLOBAL_DBNAME = cdr12c.nblbd.com)
      (ORACLE_HOME = /u01/app/oracle/product/12.2.0.1/dbhome_1)
      (SID_NAME = cdr12c)
    )
  )


LISTENER =
  (DESCRIPTION_LIST =
    (DESCRIPTION =
     (ADDRESS = (PROTOCOL = TCP)(HOST = bachdbdr.nblbd.com)(PORT = 1521))
    )
    (DESCRIPTION =
      (ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC1521))
    )
  ) 

  ADR_BASE_LISTENER = /u01/app/oracle
 
 


  [oracle@bach1 ~]$ tnsping cdr12c

TNS Ping Utility for Linux: Version 12.2.0.1.0 - Production on 09-MAY-2018 02:00:58

Copyright (c) 1997, 2016, Oracle.  All rights reserved.

Used parameter files:
/u01/app/oracle/product/12.2.0.1/dbhome_1/network/admin/sqlnet.ora


Used TNSNAMES adapter to resolve the alias
Attempting to contact (DESCRIPTION = (ADDRESS = (PROTOCOL = TCP)(HOST = bach1.nblbd.com)(PORT = 1521)) (CONNECT_DATA = (SERVER = DEDICATED) (SERVICE_NAME = cdr12c.nblbd.com)))
OK (0 msec)
[oracle@bach1 ~]$
[oracle@bach1 ~]$ tnsping cdb12c

TNS Ping Utility for Linux: Version 12.2.0.1.0 - Production on 09-MAY-2018 02:01:05

Copyright (c) 1997, 2016, Oracle.  All rights reserved.

Used parameter files:
/u01/app/oracle/product/12.2.0.1/dbhome_1/network/admin/sqlnet.ora


Used TNSNAMES adapter to resolve the alias
Attempting to contact (DESCRIPTION = (ADDRESS = (PROTOCOL = TCP)(HOST = bach1.nblbd.com)(PORT = 1521)) (CONNECT_DATA = (SERVER = DEDICATED) (SERVICE_NAME = cdb12c.nblbd.com)))
OK (0 msec)
[oracle@bach1 ~]$


[oracle@bachdbdr ~]$ tnsping cdr12c

TNS Ping Utility for Linux: Version 12.2.0.1.0 - Production on 08-MAY-2018 17:57:52

Copyright (c) 1997, 2016, Oracle.  All rights reserved.

Used parameter files:


Used TNSNAMES adapter to resolve the alias
Attempting to contact (DESCRIPTION = (ADDRESS = (PROTOCOL = TCP)(HOST = bach1.nblbd.com)(PORT = 1521)) (CONNECT_DATA = (SERVER = DEDICATED) (SERVICE_NAME = cdr12c.nblbd.com)))
OK (0 msec)
[oracle@bachdbdr ~]$ tnsping cdb12c

TNS Ping Utility for Linux: Version 12.2.0.1.0 - Production on 08-MAY-2018 17:58:00

Copyright (c) 1997, 2016, Oracle.  All rights reserved.

Used parameter files:


Used TNSNAMES adapter to resolve the alias
Attempting to contact (DESCRIPTION = (ADDRESS = (PROTOCOL = TCP)(HOST = bach1.nblbd.com)(PORT = 1521)) (CONNECT_DATA = (SERVER = DEDICATED) (SERVICE_NAME = cdb12c.nblbd.com)))
OK (0 msec)
[oracle@bachdbdr ~]$


oracle@bachdbdr dbs]$ mv initCDR12C.ora initcdr12c.ora
[oracle@bachdbdr dbs]$ sqlplus / as sysdba

SQL*Plus: Release 12.2.0.1.0 Production on Tue May 8 18:03:55 2018

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

Connected to an idle instance.

SQL>
SQL> create spfile from pfile;

File created.

SQL>


[oracle@bachdbdr dbs]$ sqlplus / as sysdba

SQL*Plus: Release 12.2.0.1.0 Production on Tue May 8 18:40:29 2018

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

Connected to an idle instance.

SQL> startup nomount pfile='/u01/app/oracle/product/12.2.0.1/dbhome_1/dbs/initcdr12c.ora';
ORACLE instance started.

Total System Global Area 3.1877E+10 bytes
Fixed Size                 19428376 bytes
Variable Size            4496296936 bytes
Database Buffers         2.7313E+10 bytes
Redo Buffers               47677440 bytes
SQL>
SQL>


[oracle@bach1 ~]$ rman

Recovery Manager: Release 12.2.0.1.0 - Production on Wed May 9 02:37:29 2018

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

RMAN> CONNECT TARGET sys/Nblcdb12c@cdb12c

connected to target database: CDB12C (DBID=4169099588)

RMAN> CONNECT AUXILIARY sys/Nblcdb12c@cdr12c

connected to auxiliary database (not started)

RMAN> duplicate target database for standby from active database nofilenamecheck dorecover;

--===


SELECT Operations.id, Operations.title, DefOperations.title AS defOpTitle, Operations.isFromUser
FROM Operations LEFT JOIN DefOperations ON Operations.defOpID = DefOperations.id;


ALTER DATABASE RECOVER MANAGED STANDBY DATABASE USING CURRENT LOGFILE DISCONNECT FROM SESSION NODELAY;


 alter database recover managed standby database cancel

select group#, status from v$standby_log;
select status, error from v$archive_dest where dest_id = 2;

SELECT SUBSTR(NAME,1,25) FILE_NAME, SEQUENCE#, APPLIED FROM V$ARCVHIVED_LOG ORDER BY SEQUENCE#;


--==============command===

SQL> col member for a40
SQL> select * from v$logfile;


select * from  v$logfile where type='STANDBY';



--====drop Standby Log file ==

select group#, thread#, status, bytes/1024/1024 from v$standby_log;

select group#, thread#, status, bytes/1024/1024 from v$log;

ALTER SYSTEM SET STANDBY_FILE_MANAGEMENT='MANUAL';

alter database clear logfile group 4;
alter database clear logfile group 5;
alter database clear logfile group 6;
alter database clear logfile group 7;

alter database drop standby logfile group 4;
alter database drop standby logfile group 5;
alter database drop standby logfile group 6;
alter database drop standby logfile group 7;


--====Add Standby Log file ==

alter database add standby logfile thread 1 GROUP 4 '/data/oradata/cdb12c/redo_std04a.rdo' size 200M reuse;

alter database add standby logfile thread 1 GROUP 5 '/data/oradata/cdb12c/redo_std05a.rdo' size 200M reuse;
alter database add standby logfile thread 1 GROUP 6 '/data/oradata/cdb12c/redo_std06a.rdo' size 200M reuse;
alter database add standby logfile thread 1 GROUP 7 '/data/oradata/cdb12c/redo_std07a.rdo' size 200M reuse;


alter database add standby logfile thread 1 GROUP 4 '/data/oradata/cdr12c/redo_std04a.rdo' size 200M reuse;
alter database add standby logfile thread 1 GROUP 5 '/data/oradata/cdr12c/redo_std05a.rdo' size 200M reuse;
alter database add standby logfile thread 1 GROUP 6 '/data/oradata/cdr12c/redo_std06a.rdo' size 200M reuse;
alter database add standby logfile thread 1 GROUP 7 '/data/oradata/cdr12c/redo_std07a.rdo' size 200M reuse;


alter system set standby_file_management=AUTO scope=both sid='*';


EDIT DATABASE testfo SET PROPERTY TransportDisconnectedThreshold='120';




Primary:
SQL> select thread#, max(sequence#) "Last Primary Seq Generated"
from v$archived_log val, v$database vdb
where val.resetlogs_change# = vdb.resetlogs_change#
group by thread# order by 1;

PhyStdby:
SQL> select thread#, max(sequence#) "Last Standby Seq Received"
from v$archived_log val, v$database vdb
where val.resetlogs_change# = vdb.resetlogs_change#
group by thread# order by 1;

PhyStdby:
SQL>select thread#, max(sequence#) "Last Standby Seq Applied"
from v$archived_log val, v$database vdb
where val.resetlogs_change# = vdb.resetlogs_change#
and val.applied in ('YES','IN-MEMORY')
group by thread# order by 1;


PhyStdby:
SQL> select al.thrd "Thread", almax "Last Seq Received", lhmax "Last Seq Applied" , almax-lhmax "Sequence Difference"
from (select thread# thrd, max(sequence#) almax
from v$archived_log
where resetlogs_change#=(select resetlogs_change# from v$database)
group by thread#) al,
(select thread# thrd, max(sequence#) lhmax
from v$log_history
where resetlogs_change#=(select resetlogs_change# from v$database)
group by thread#) lh
where al.thrd = lh.thrd;

edit database "cdr12c" set state="APPLY-ON";


--================Dataguard broker====

SYS@cdb12c> show parameter dg_broker_start

NAME                                 TYPE        VALUE
------------------------------------ ----------- ------------------------------
dg_broker_start                      boolean     FALSE
SYS@cdb12c>
SYS@cdb12c> alter system set dg_broker_start=true;

System altered.

SYS@cdb12c>
SYS@cdb12c> show parameter dg_broker_start;

NAME                                 TYPE        VALUE
------------------------------------ ----------- ------------------------------
dg_broker_start                      boolean     TRUE
SYS@cdb12c>


SYS@cdr12c> show parameter dg_broker_start

NAME                                 TYPE        VALUE
------------------------------------ ----------- ------------------------------
dg_broker_start                      boolean     FALSE
SYS@cdr12c>
SYS@cdr12c>
SYS@cdr12c> alter system set dg_broker_start=true;

System altered.

SYS@cdr12c>
SYS@cdr12c> show parameter dg_broker_start

NAME                                 TYPE        VALUE
------------------------------------ ----------- ------------------------------
dg_broker_start                      boolean     TRUE
SYS@cdr12c>
SYS@cdr12c>



SYS@cdb12c> show parameter log_archive_dest_2;

NAME                                 TYPE        VALUE
------------------------------------ ----------- ------------------------------
log_archive_dest_2                   string      SERVICE=cdr12c ASYNC VALID_FOR
                                                 =(ONLINE_LOGFILES,PRIMARY_ROLE
                                                 ) DB_UNIQUE_NAME=cdr12c
log_archive_dest_20                  string


SYS@cdb12c> alter system set log_archive_dest_2='';

System altered.

SYS@cdb12c> show parameter log_archive_dest_2;

NAME                                 TYPE        VALUE
------------------------------------ ----------- ------------------------------
log_archive_dest_2                   string
log_archive_dest_20                  string





SYS@cdr12c> show parameter log_archive_dest_2;

NAME                                 TYPE        VALUE
------------------------------------ ----------- ------------------------------
log_archive_dest_2                   string      SERVICE=cdb12c ASYNC VALID_FOR
                                                 =(ONLINE_LOGFILES,PRIMARY_ROLE
                                                 ) DB_UNIQUE_NAME=cdb12c
log_archive_dest_20                  string
log_archive_dest_21                  string
log_archive_dest_22                  string
log_archive_dest_23                  string
log_archive_dest_24                  string
log_archive_dest_25                  string
log_archive_dest_26                  string
log_archive_dest_27                  string

NAME                                 TYPE        VALUE
------------------------------------ ----------- ------------------------------
log_archive_dest_28                  string
log_archive_dest_29                  string
SYS@cdr12c>
SYS@cdr12c> alter system set log_archive_dest_2='';

System altered.

SYS@cdr12c> show parameter log_archive_dest_2;

NAME                                 TYPE        VALUE
------------------------------------ ----------- ------------------------------
log_archive_dest_2                   string
log_archive_dest_20                  string



[oracle@bach1 ~]$ dgmgrl sys@cdb12c
DGMGRL for Linux: Release 12.2.0.1.0 - Production on Mon May 21 23:58:41 2018

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

Welcome to DGMGRL, type "help" for information.
Password:
Connected to "cdb12c"
Connected as SYSDBA.
DGMGRL>
DGMGRL>
DGMGRL>
DGMGRL> create configuration cdb as primary database is cdb12c connect identifier is cdb12c;
Configuration "cdb" created with primary database "cdb12c"
DGMGRL>
DGMGRL>
DGMGRL>
DGMGRL> add database cdr12c as  connect identifier is cdr12c maintained as physical;
Database "cdr12c" added
DGMGRL>
DGMGRL>
DGMGRL>
DGMGRL>
DGMGRL> enable configuration;
Enabled.
DGMGRL>