23 February 2016

V$ARCHIVED_LOG

copied as it is from:

https://docs.oracle.com/cd/B19306_01/server.102/b14237/dynviews_1016.htm

This was for my personal reference, where I noticed few "NO" entries in the APPLIED column, now I know, why! I observed this, after switchover of the databases, the "NO" sequence is generated at the local destination, so it remains "NO".

V$ARCHIVED_LOG displays archived log information from the control file, including archive log names. An archive log record is inserted after the online redo log is successfully archived or cleared (name column is NULL if the log was cleared). If the log is archived twice, there will be two archived log records with the same THREAD#SEQUENCE#, and FIRST_CHANGE#, but with a different name. An archive log record is also inserted when an archive log is restored from a backup set or a copy and whenever a copy of a log is made with the RMAN COPY command.
ColumnDatatypeDescription
RECIDNUMBERArchived log record ID
STAMPNUMBERArchived log record stamp
NAMEVARCHAR2(513)Archived log file name. If set to NULL, either the log file was cleared before it was archived or an RMAN backup command with the "delete input" option was executed to back up archivelog all (RMAN> backup archivelog all delete input;).
DEST_IDNUMBEROriginal destination from which the archive log was generated. The value is 0 if the destination identifier is not available.
THREAD#NUMBERRedo thread number
SEQUENCE#NUMBERRedo log sequence number
RESETLOGS_CHANGE#NUMBERResetlogs change number of the database when the log was written
RESETLOGS_TIMEDATEResetlogs time of the database when the log was written
RESETLOGS_IDNUMBERResetlogs identifier associated with the archived redo log
FIRST_CHANGE#NUMBERFirst change number in the archived log
FIRST_TIMEDATETimestamp of the first change
NEXT_CHANGE#NUMBERFirst change in the next log
NEXT_TIMEDATETimestamp of the next change
BLOCKSNUMBERSize of the archived log (in blocks)
BLOCK_SIZENUMBERRedo log block size. This is the logical block size of the archived log, which is the same as the logical block size of the online log from which the archived log was copied. The online log logical block size is a platform-specific value that is not adjustable by the user.
CREATORVARCHAR2(7)Creator of the archivelog:
  • ARCH - Archiver process
  • FGRD - Foreground process
  • RMAN - Recovery Manager
  • SRMN - RMAN at standby
  • LGWR - Logwriter process
REGISTRARVARCHAR2(7)Registrar of the entry:
  • RFS - Remote File Server process
  • ARCH - Archiver process
  • FGRD - Foreground process
  • RMAN - Recovery manager
  • SRMN - RMAN at standby
  • LGWR - Logwriter process
STANDBY_DESTVARCHAR2(3)Indicates whether the entry is an archivelog destination (YES) or not (NO)
ARCHIVEDVARCHAR2(3)Indicates whether the online redo log was archived (YES) or whether RMAN only inspected the log and created a record for future application of redo logs during recovery (NO).
APPLIEDVARCHAR2(3)Indicates whether the archivelog has been applied to its corresponding standby database (YES) or not (NO). The value is always NO for local destinations.
This column is meaningful at the physical standby site for the ARCHIVED_LOG entries withREGISTRAR='RFS' (which means this log is shipped from the primary to the standby database). If REGISTRAR='RFS' and APPLIED isNO, then the log has arrived at the standby but has not yet been applied. If REGISTRAR='RFS' and APPLIED is YES, the log has arrived and been applied at the standby database.
You can use this field to identify archivelogs that can be backed up and removed from disk.
DELETEDVARCHAR2(3)Indicates whether an RMAN DELETE command has physically deleted the archived log file from disk, as well as logically removing it from the control file of the target database and from the recovery catalog (YES) or not (NO)
STATUSVARCHAR2(1)Status of the archived log:
A - Available
D - Deleted
U - Unavailable
X - Expired
COMPLETION_TIMEDATETime when the archiving completed
DICTIONARY_BEGINVARCHAR2(3)Indicates whether the log contains the start of a LogMiner dictionary (YES) or not (NO)
DICTIONARY_ENDVARCHAR2(3)Indicates whether the log contains the end of a LogMiner dictionary (YES) or not (NO)
END_OF_REDOVARCHAR2(3)Indicates whether the archived redo log contains the end of all redo information from the primary database (YES) or not (NO)
BACKUP_COUNTNUMBERIndicates the number of times this file has been backed up. Values range from 0-15. If the file has been backed up more than 15 times, the value remains 15.
ARCHIVAL_THREAD#NUMBERRedo thread number of the instance that performed the archival operation. This column differs from the THREAD# column only when a closed thread is archived by another instance.
ACTIVATION#NUMBERNumber assigned to the database instantiation
IS_RECOVERY_DEST_FILEVARCHAR2(3)Indicates whether the file was created in the flash recovery area (YES) or not (NO)
COMPRESSEDVARCHAR2(3)This column is reserved for internal use only
FALVARCHAR2(3)Indicates whether the archive log was generated as the result of a FAL request (YES) or not (NO)
END_OF_REDO_TYPEVARCHAR2(10)Possible values are as follows:
  • SWITCHOVER - Shows archived redo log files that are produced at the end of a switchover
  • TERMINAL - Shows archived redo log files produced after a failover
  • RESETLOGS - Shows online redo log files archived on the primary database after an ALTER DATABASE OPEN RESETLOGS statement is issued
  • ACTIVATION - Shows any log files archived on a physical standby database after an ALTER DATABASE ACTIVATE STANDBY DATABASEstatement is issued
  • "empty string" - Any empty string implies that that the log is just a normal archival and was not archived due to any of the other events

Configure dataguard broker

Setup DG, find link below:
data-guard-physical-standby-setup-in


Prepare Primary Site :

Changes: DB_BROKER_CONFIG_FILEn parameter is used to specify the location of the dataguard configuration. DG_BROKER_START parameter is used to start the broker automatically when the instance starts.

SQL> alter system set dg_broker_config_file1='/u01/app/oracle/product/11.2.0/dbhome_1/dbs/dr1orclp.dat' sid='*';

System altered.

SQL> alter system set dg_broker_config_file2='/u01/app/oracle/product/11.2.0/dbhome_1/dbs/dr2orclp.dat' sid='*';

System altered.

SQL> alter system set dg_broker_start=true  sid='*';

System altered.

Listener.ora Changes : GLOBAL_DBNAME attribute value should be set as shown in the following listener.ora configuration on primary site otherwise you will get TNS-12154 error during switch over configuration. A service with name <sid>_DGMGRL will be started when the listener is started. If you have the GLOBAL_DBNAME parameter set, skip this step.

# listener.ora Network Configuration File: /u01/app/oracle/product/11.2.0/dbhome_1/network/admin/listener.ora
# Generated by Oracle configuration tools.

SID_LIST_LISTENER =
 (SID_LIST =
  (SID_DESC =
   (GLOBAL_DBNAME = ORCL)
   (ORACLE_HOME = /u01/app/oracle/product/11.2.0/dbhome_1)
  (SID_NAME = ORCL)
  )
 )

LISTENER =
  (DESCRIPTION_LIST =
    (DESCRIPTION =
      (ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC1521))
      (ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.1.8)(PORT = 1521))
    )
  )

ADR_BASE_LISTENER = /u01/app/oracle

Prepare Standby site:

SQL> alter system set dg_broker_config_file1='/u01/app/oracle/product/11.2.0/dbhome_1/dbs/dr1orcls.dat' sid='*';

System altered.

SQL> alter system set dg_broker_config_file2='/u01/app/oracle/product/11.2.0/dbhome_1/dbs/dr2orcls.dat' sid='*';

System altered.

SQL> alter system set dg_broker_start=true  sid='*';

System altered.

Listener.ora Changes

DGMGRL> CREATE CONFIGURATION 'first_config' AS PRIMARY DATABASE IS 'ORCL' CONNECT IDENTIFIER IS ORCL;
Error: ORA-16642: DB_UNIQUE_NAME mismatch

Failed.

DGMGRL> CREATE CONFIGURATION 'first_config' AS PRIMARY DATABASE IS 'ORCLP' CONNECT IDENTIFIER IS ORCL;
Configuration "first_config" created with primary database "ORCLP"

DGMGRL> ADD DATABASE 'ORCLS' AS CONNECT IDENTIFIER IS ORCLSTBY MAINTAINED AS PHYSICAL;
Database "ORCLS" added

DGMGRL>  show configuration;

Configuration - first_config

  Protection Mode: MaxPerformance
  Databases:
    ORCLP - Primary database
    ORCLS - Physical standby database

Fast-Start Failover: DISABLED

Configuration Status:
DISABLED

DGMGRL> help enable configuration;

Enables a configuration, a database, or fast-start failover

Syntax:

  ENABLE CONFIGURATION;

  ENABLE DATABASE <database name>;

  ENABLE FAST_START FAILOVER [CONDITION <condition>];

DGMGRL> enable configuration;
Enabled.
DGMGRL> show configuration;

Configuration - first_config

  Protection Mode: MaxPerformance
  Databases:
    ORCLP - Primary database
    ORCLS - Physical standby database

Fast-Start Failover: DISABLED

Configuration Status:
SUCCESS

DGMGRL>

Verifying Configuration With Switchover:

DGMGRL> switchover to 'ORCLS';
Performing switchover NOW, please wait...
New primary database "ORCLS" is opening...
Operation requires shutdown of instance "ORCL" on database "ORCLP"
Shutting down instance "ORCL"...
ORA-01109: database not open

Database dismounted.
ORACLE instance shut down.
Operation requires startup of instance "ORCL" on database "ORCLP"
Starting instance "ORCL"...
Unable to connect to database
ORA-12514: TNS:listener does not currently know of service requested in connect descriptor

Failed.
Warning: You are no longer connected to ORACLE.

Please complete the following steps to finish switchover:
        start up and mount instance "ORCL" of database "ORCLP"

DGMGRL> exit


show database 'ORCLP' 'LogXptStatus';




[oracle@primary admin]$ sqlplus '/as sysdba'

SQL*Plus: Release 11.2.0.1.0 Production on Tue Feb 23 19:45:47 2016

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

Connected to an idle instance.

SQL> startup mount
ORACLE instance started.

Total System Global Area  267825152 bytes
Fixed Size                  1335924 bytes
Variable Size             213912972 bytes
Database Buffers           50331648 bytes
Redo Buffers                2244608 bytes
Database mounted.
SQL> select open_mode, database_role from v$database;

OPEN_MODE            DATABASE_ROLE
-------------------- ----------------
MOUNTED              PHYSICAL STANDBY

SQL> select database_role,switchover_status from v$database;

DATABASE_ROLE    SWITCHOVER_STATUS
---------------- --------------------
PHYSICAL STANDBY NOT ALLOWED

SQL> exit
Disconnected from Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options
[oracle@primary admin]$ dgmgrl
DGMGRL for Linux: Version 11.2.0.1.0 - Production

Copyright (c) 2000, 2009, Oracle. All rights reserved.

Welcome to DGMGRL, type "help" for information.
DGMGRL> conn sys
Unrecognized command "conn", try "help"
DGMGRL> connect sys
Password:
Connected.
DGMGRL> switchover to 'ORCLP';
Performing switchover NOW, please wait...
New primary database "ORCLP" is opening...
Operation requires shutdown of instance "ORCL" on database "ORCLS"
Shutting down instance "ORCL"...
ORA-01109: database not open

Database dismounted.
ORACLE instance shut down.
Operation requires startup of instance "ORCL" on database "ORCLS"
Starting instance "ORCL"...
Unable to connect to database
ORA-12514: TNS:listener does not currently know of service requested in connect descriptor

Failed.
Warning: You are no longer connected to ORACLE.

Please complete the following steps to finish switchover:
        start up and mount instance "ORCL" of database "ORCLS"

DGMGRL>