Friday, 30 January 2015

Tablespace Usage Script - Used and Free

set pagesize 100
column file_name format a32
column tablespace_name format a15
column status format a3 trunc
column t format 999,999.000 heading "Total MB"
column a format a4 heading "Aext"
column p format 990.00 heading "% Free"

SELECT df.file_name,
df.tablespace_name,
df. status,
(df.bytes/1024000) t,
(fs.s/df.bytes*100) p,
decode (ae.y,1,'YES','NO') a
FROM dba_data_files df,
(SELECT file_id,SUM(bytes) s
FROM dba_free_space
GROUP BY file_id) fs,
(SELECT file#, 1 y
FROM sys.filext$
GROUP BY file#) ae
WHERE df.file_id = fs.file_id
AND ae.file#(+) = df.file_id
ORDER BY df.tablespace_name, df.file_id;

Oracle database total size

An oracle database consists of data files, redo log files, control files, temporary files. 
The size of the database actually means the total size of all these files.

select 
( select sum(bytes)/1024/1024/1024 data_size from dba_data_files ) +
( select nvl(sum(bytes),0)/1024/1024/1024 temp_size from dba_temp_files ) +
( select sum(bytes)/1024/1024/1024 redo_size from sys.v_$log ) +
( select sum(BLOCK_SIZE*FILE_SIZE_BLKS)/1024/1024/1024 controlfile_size from v$controlfile) "Size in GB"
from
dual;

Sunday, 11 January 2015

monitoring CDB and PDB tablespaces and users - ORACLE 12 C Database

SQL> CONN system/oracle@pdb1
Connected.

SQL> select name from v$datafile;

NAME
--------------------------------------------------------------------------------
/oradata/orcl/undotbs01.dbf
/oradata/ORCL/datafile/pdb1/system01.dbf
/oradata/ORCL/datafile/pdb1/sysaux01.dbf
/oradata/ORCL/datafile/pdb1/users01.dbf

SQL> create tablespace jyothi datafile '/oradata/ORCL/datafile/pdb1/jyo1.dbf' size 10M;

Tablespace created.

SQL> select name from v$datafile;

NAME
--------------------------------------------------------------------------------
/oradata/orcl/undotbs01.dbf
/oradata/ORCL/datafile/pdb1/system01.dbf
/oradata/ORCL/datafile/pdb1/sysaux01.dbf
/oradata/ORCL/datafile/pdb1/users01.dbf
/oradata/ORCL/datafile/pdb1/jyo1.dbf

SQL> create user sarath identified by sarath default tablespace jyothi;

User created.

SQL> grant connect,resource to sarath;

Grant succeeded.

SQL> conn sarath/sarath
ERROR:
ORA-01017: invalid username/password; logon denied
Warning: You are no longer connected to ORACLE.

Needs to mention tns of PDB database name
SQL> conn sarath/sarath@pdb1
Connected.
SQL> create table test(names char(30));

Table created.
SQL> insert into test values ('records');

1 row created.

SQL> /

1 row created.

SQL> /

1 row created.

SQL> /


1 row created.

Connecting CDB Database and comparing the tablespace names

SQL> conn sys as sysdba
Enter password:
Connected.
SQL> SHOW CON_NAME

CON_NAME
------------------------------
CDB$ROOT

SQL> select tablespace_name from dba_tablespaces;

TABLESPACE_NAME
------------------------------
SYSTEM
SYSAUX
UNDOTBS1
TEMP
USERS

again connecting to PDB database and will have a look

SQL> conn system/oracle@pdb1
Connected.
SQL>  SHOW CON_NAME

CON_NAME
------------------------------
PDB1

SQL> select tablespace_name from dba_tablespaces;

TABLESPACE_NAME
------------------------------
SYSTEM
SYSAUX
TEMP
USERS
JYOTHI


ORA-65066: The specified changes must apply to all containers - ORACLE 12 C

SQL> CONN system/oracle@pdb1
Connected.
SQL> alter user system identified by oracle12;
alter user system identified by oracle12
*
ERROR at line 1:
ORA-65066: The specified changes must apply to all containers


Connect to CDB database ,Then you can reset the system user then it will applies to all PDB's as well.

SQL> conn sys as sysdba
Enter password:
Connected.
SQL> alter user system identified by oracle12;

User altered.

SQL> CONN system/oracle12@pdb1
Connected.

SQL> SHOW CON_NAME

CON_NAME
------------------------------
PDB1


ORA-01109: database not open

SQL> conn sys/oracle@pdb1 as sysdba
Connected.
SQL> SHOW CON_NAME

CON_NAME
------------------------------
PDB1

SQL> alter user system identified by oracle;
alter user system identified by oracle
                                *
ERROR at line 1:
ORA-01109: database not open


SQL> startup;
Pluggable Database opened.


Saturday, 10 January 2015

Installing oracle 12C Database software

Installing oracle 12C Database software

we have oinstall,dba,oper group already we have oracle 11g database having the server(machine)

oracle 12C related groups

groupadd -g 1004 backupdba
groupadd -g 1005 dgdba
groupadd -g 1006 kmdba
groupadd -g 1007 asmdba
groupadd -g 1008 asmoper
groupadd -g 1009 asmadmin

need to execute with root user

cd /u02
mkdir app
chown -R root:oinstall app
or
chown -R root:oinstall /u02/app/

mkdir -p /u02/app
chown -R root:oinstall /u02/app/

mkdir -p /u02/app/oracle/product/12.1.0/dbhome_1
chown -R oracle:oinstall /u02/app/

mkdir -p /u02/oradata/
chown -R root:oinstall /u02/oradata/


mkdir -p /u02/app/oraInventory/
chown -R oracle:oinstall /u02/app/oraInventory/

---startup the operation system
---Mount the software in the vmware
[root@node1 ~]# chown -R root:oinstall /u02/app/
[root@node1 ~]# chown -R root:oinstall /mnt/hgfs/12database/database



Switch to oracle user and set the bash profile

##-----oracle bash profile
export PATH
export oracle_BASE=/u02/app/oracle
export ORACLE_HOME=/u02/app/oracle/product/12.1.0/dbhome_1
export PATH=$PATH:$ORACLE_HOME/bin

oracle$cd /oracle12/database/
oracle$./runInstaller
----
Then go and next as usual like oracle 11g software and install database.Below you can find screenshots


Once completed you will get success alert

Friday, 9 January 2015

Oracle Dataguard Implementation

MACHINE1 (PRIMARY)
SQL> alter database force logging;

Database altered.

size should be same

3 Groups for Primary
SQL> select member from v$logfile;

MEMBER
--------------------------------------------------------------------------------
/u01/app/oracle/oradata/SONY/redo03.log
/u01/app/oracle/oradata/SONY/redo02.log
/u01/app/oracle/oradata/SONY/redo01.log

3 Groups for Standby
SQL> alter database add standby logfile group 4 '/u01/app/oracle/oradata/SONY/redo4.log' size 50m;

Database altered.

SQL> alter database add standby logfile group 5 '/u01/app/oracle/oradata/SONY/redo5.log' size 50m;

Database altered.

SQL> alter database add standby logfile group 6 '/u01/app/oracle/oradata/SONY/redo6.log' size 50m;

Database altered.


SQL>alter system set log_archive_config='DG_CONFIG=(SONY,standdb)' scope=both;

FAILOVER AND SWITCH OVER
SQL>alter system set log_archive_dest_1='location=/u01/app/oracle/arch valid_for=(all_logfiles,all_roles) db_unique_name=SONY' scope=both;

SQL>alter system set log_archive_dest_2='SERVICE=standdb LGWR ASYNC valid_for=(online_logfiles,primary_role) db_unique_name=standdb' scope=both;

LGWR ASYNC (MAX PERFORMANCE)

LGWR SYNC AFFIRM(MAX PROTECTION)

LGWR SYNC NOAFFIRM (MAX AVAILABILITY)

verify if enable or not, if not you can verify

ALTER SYSTEM SET log_archive_dest_state_1=enable scope=both;

ALTER system set log_archive_dest_state_2=enable scope=both;

alter system set fal_server=standdb scope=both;

alter system set fal_client=SONY scope=both;


--Data file can be added automatically , if manual you datafile needs to add or resize
alter system set standby_file_management=auto scope=both;

all most completed the setup

SQL>create pfile from spfile;

SQL> !
[oracle@machine1 ~]$ cd $ORACLE_HOME/dbs
[oracle@machine1 dbs]$ pwd
/u01/app/oracle/product/11.2.0/dbhome_1/dbs
[oracle@machine1 dbs]$ ls -lrt
total 44
-rw-r--r-- 1 oracle oinstall 2851 May 15  2009 init.ora
drwx------ 2 oracle oinstall 4096 Nov 23 01:04 peshm_DBUA0_0
drwx------ 2 oracle oinstall 4096 Nov 23 01:05 peshm_orcl11g_0
-rw-rw---- 1 oracle oinstall 1544 Dec 17 17:16 hc_DBUA0.dat
-rw-rw---- 1 oracle oinstall 1544 Dec 17 17:17 hc_orcl11g.dat
drwx------ 2 oracle oinstall 4096 Dec 17 17:18 peshm_SONY_0
-rw-r----- 1 oracle oinstall   24 Dec 17 17:19 lkSONY
-rw-r----- 1 oracle oinstall 1536 Dec 19 20:24 orapwSONY
-rw-rw---- 1 oracle oinstall 1544 Dec 20 19:00 hc_SONY.dat
-rw-r----- 1 oracle oinstall 3584 Dec 20 19:40 spfileSONY.ora
-rw-r--r-- 1 oracle oinstall 1291 Dec 20 19:57 initSONY.ora

$scpinitSONY.ora oracle@192.168.76.130:/u01/app/oracle/product/11.2.0/dbhome_1/dbs/initstanddb.ora

$scp orapwSONY oracle@192.168.75.130:/u01/app/oracle/product/11.2.0/dbhome_1/dbs/orapwstanddb

Go to Machine2
oracle@machine2 ~]$ cd /u01/app/oracle/product/11.2.0/dbhome_1/dbs/          
[oracle@machine2 dbs]$ ls -lrt
total 40
-rw-r--r-- 1 oracle oinstall 2851 May 15  2009 init.ora
drwx------ 2 oracle oinstall 4096 Nov 23 01:04 peshm_DBUA0_0
drwx------ 2 oracle oinstall 4096 Nov 23 01:05 peshm_orcl11g_0
-rw-r----- 1 oracle oinstall   24 Nov 23 01:06 lkORCL11G
-rw-r----- 1 oracle oinstall 1536 Dec 12 19:15 orapworcl11g
-rw-rw---- 1 oracle oinstall 1544 Dec 17 17:27 hc_DBUA0.dat
-rw-rw---- 1 oracle oinstall 1544 Dec 17 17:27 hc_orcl11g.dat
-rw-r----- 1 oracle oinstall 2560 Dec 17 22:00 spfileorcl11g.ora
-rw-r----- 1 oracle oinstall 3584 Dec 20 20:07 initstanddb.ora
-rw-r----- 1 oracle oinstall 1536 Dec 20 20:07 orapwstanddb

Open vi.init
vi initstanddb.ora
/**Remove
SONY.__db_cache_size=50331648
SONY.__java_pool_size=4194304
SONY.__large_pool_size=4194304
SONY.__oracle_base='/u01/app/oracle'#ORACLE_BASE set from environment
SONY.__pga_aggregate_target=125829120
SONY.__sga_target=188743680
SONY.__shared_io_pool_size=0
SONY.__shared_pool_size=113246208
SONY.__streams_pool_size=8388608
Remove**/
*.audit_file_dest='/u01/app/oracle/admin/standdb/adump'
*.audit_trail='db'
*.compatible='11.2.0.0.0'
*.control_files='/u01/app/oracle/oradata/standdb/control01.ctl','/u01/app/oracle/flash_recovery_area/standdb/control02.ctl'
*.db_block_size=8192
*.db_domain=''
*.db_name='SONY'
*.db_recovery_file_dest='/u01/app/oracle/flash_recovery_area'
*.db_recovery_file_dest_size=4039114752
*.diagnostic_dest='/u01/app/oracle'
*.dispatchers='(PROTOCOL=TCP) (SERVICE=standdbXDB)'
*.fal_client='SONY'
*.fal_server='STANDDB'
*.log_archive_config='DG_CONFIG=(SONY,standdb)'
*.log_archive_dest_1='location=/u01/app/oracle/arch valid_for=(all_logfiles,all_roles) db_unique_name=standdb'

*.log_archive_dest_2='SERVICE=SONY LGWR ASYNC valid_for=(online_logfiles,primary_role) db_unique_name=SONY'
*.log_archive_format='%t_%s_%r.dbf'
*.memory_target=314572800
*.open_cursors=300
*.processes=150
*.remote_login_passwordfile='EXCLUSIVE'
*.standby_file_management='AUTO'
*.undo_tablespace='UNDOTBS1'
*.db_unique_name='standdb'
*.db_file_name_convert=('/u01/app/oracle/oradata/SONY','/u01/app/oracle/oradata/standdb')
*.log_file_name_convert=('/u01/app/oracle/oradata/SONY','/u01/app/oracle/oradata/standdb')


create folders in machine2

mkdir -p /u01/app/oracle/admin/standdb/adump
mkdir -p /u01/app/oracle/oradata/standdb
mkdir -p /u01/app/oracle/flash_recovery_area/standdb
mkdir -p /u01/app/oracle/arch

make sure network settings, its has to ping both Services SONY,STANDDB

LISTENER =
  (DESCRIPTION_LIST =
    (DESCRIPTION =
#     (ADDRESS = (PROTOCOL = TCP)(HOST = localhost.localdomain)(PORT = 1521))
      (ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.75.129)(PORT = 1521))
    )
  )

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



ADR_BASE_LISTENER = /u01/app/oracle
-----------
SONY =
  (DESCRIPTION =
    (ADDRESS_LIST =
      (ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.75.129)(PORT = 1521))
    )
    (CONNECT_DATA =
      (SERVICE_NAME = SONY)
    )
  )

standdb =
  (DESCRIPTION =
    (ADDRESS_LIST =
      (ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.75.130)(PORT = 1521))
    )
    (CONNECT_DATA =
      (SERVICE_NAME = standdb)
    )
  )

----------
Ping services of SONY and standdb
tnsping SONY
tnsping standdb

Machine2
[oracle@machine2 dbs]$ export ORACLE_SID=standdb
[oracle@machine2 dbs]$ sqlplus "/as sysdba"

SQL*Plus: Release 11.2.0.1.0 Production on Sun Dec 21 14:32:45 2014

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

Connected to an idle instance.


SQL> startup nomount;
ORACLE instance started.

Total System Global Area  313860096 bytes
Fixed Size                  1336232 bytes
Variable Size             205524056 bytes
Database Buffers          100663296 bytes
Redo Buffers                6336512 bytes
SQL>exit


$rman target sys/sys123@SONY auxiliary sys/sys123@standdb

[oracle@machine2 admin]$ rman target sys/sys123@SONY auxiliary sys/sys123@standdb

Recovery Manager: Release 11.2.0.1.0 - Production on Sun Dec 21 14:47:43 2014

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

connected to target database: SONY (DBID=3487455235)
connected to auxiliary database: SONY (not mounted)

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

output file name=/u01/app/oracle/oradata/standdb/sysaux01.dbf tag=TAG20141221T145155
channel ORA_DISK_1: datafile copy complete, elapsed time: 00:00:35
channel ORA_DISK_1: starting datafile copy
input datafile file number=00005 name=/u01/app/oracle/oradata/SONY/test_data01.dbf
output file name=/u01/app/oracle/oradata/standdb/test_data01.dbf tag=TAG20141221T145155
channel ORA_DISK_1: datafile copy complete, elapsed time: 00:00:07
channel ORA_DISK_1: starting datafile copy
input datafile file number=00003 name=/u01/app/oracle/oradata/SONY/undotbs01.dbf
output file name=/u01/app/oracle/oradata/standdb/undotbs01.dbf tag=TAG20141221T145155
channel ORA_DISK_1: datafile copy complete, elapsed time: 00:00:03
channel ORA_DISK_1: starting datafile copy
input datafile file number=00004 name=/u01/app/oracle/oradata/SONY/users01.dbf
output file name=/u01/app/oracle/oradata/standdb/users01.dbf tag=TAG20141221T145155
channel ORA_DISK_1: datafile copy complete, elapsed time: 00:00:01
Finished backup at 21-DEC-14

sql statement: alter system archive log current

contents of Memory Script:
{
   switch clone datafile all;
}
executing Memory Script

datafile 1 switched to datafile copy
input datafile copy RECID=1 STAMP=866904809 file name=/u01/app/oracle/oradata/standdb/system01.dbf
datafile 2 switched to datafile copy
input datafile copy RECID=2 STAMP=866904809 file name=/u01/app/oracle/oradata/standdb/sysaux01.dbf
datafile 3 switched to datafile copy
input datafile copy RECID=3 STAMP=866904809 file name=/u01/app/oracle/oradata/standdb/undotbs01.dbf
datafile 4 switched to datafile copy
input datafile copy RECID=4 STAMP=866904809 file name=/u01/app/oracle/oradata/standdb/users01.dbf
datafile 5 switched to datafile copy
input datafile copy RECID=5 STAMP=866904809 file name=/u01/app/oracle/oradata/standdb/test_data01.dbf
Finished Duplicate Db at 21-DEC-14

RMAN> exit


[oracle@machine2 admin]$ sqlplus "/as sysdba"

SQL*Plus: Release 11.2.0.1.0 Production on Sun Dec 21 15:34:29 2014

Copyright (c) 1982, 2009, Oracle.  All rights reserved.
Connected to:
Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options

SQL> select instance_name,status from v$INSTANCE;

INSTANCE_NAME    STATUS
---------------- ------------
standdb          MOUNTED

SQL> !ps -ef|grep mrp*
oracle    6137  6123  0 15:35 pts/1    00:00:00 /bin/bash -c ps -ef|grep mrp*
oracle    6139  6137  0 15:35 pts/1    00:00:00 grep mrp*

Needs to start mrp process

SQL> alter database recover managed standby database disconnect from session;

Database altered.

SQL> !ps -ef|grep mrp*
oracle    6154     1  0 15:38 ?        00:00:00 ora_mrp0_standdb
oracle    6169  6123  0 15:38 pts/1    00:00:00 /bin/bash -c ps -ef|grep mrp*
oracle    6171  6169  0 15:38 pts/1    00:00:00 grep mrp*

verify the count on both primary and standby databases

SQL>select SEQUENCE# from v$log_history;

machine1 - primary switch some log files and in both sides
SQL>alter system switch logfile;

machine2
SQL> alter database open read only;
error
stop the mrp
SQL> alter database recover managed standby database cancel;

Database altered.

SQL> alter database open read only;

Database altered.


SQL> alter database recover managed standby database using current logfile disconnect from session;

Database altered.


in standby db verify
SQL> select instance_name,status from v$instance;

INSTANCE_NAME    STATUS
---------------- ------------
standdb          OPEN

SQL> select name,open_mode,DATABASE_ROLE,protection_mode from v$database;

NAME      OPEN_MODE            DATABASE_ROLE
--------- -------------------- ----------------
SONY      READ ONLY WITH APPLY PHYSICAL STANDBY



SWITCH OVER TO STANDBY

MACHINE1

SQL> alter database commit to switchover to physical standby;

Database altered.


SQL> shut immediate;
ORA-01507: database not mounted

ORACLE instance shut down.

SQL>startup nomount;

SQL> alter database mount standby database;

Database altered.


MACHINE2
SQL> alter database commit to switchover to primary;

Database altered.

SQL> shut immediate;
ORA-01109: database not open
Database dismounted.
ORACLE instance shut down.

SQL>startup;


MACHINE1
SQL> alter database open read only;

Database altered.

SQL> alter database recover managed standby database using current logfile disconnect from session;

Database altered.


verify on both databases
select name,open_mode,DATABASE_ROLE,protection_mode from v$database;


Thursday, 8 January 2015

Oracle Data Guard Interview Questions

1)  How to setup Data Guard?
---Dataguard Implementation Steps
http://oracledbazone.blogspot.in/2015/01/oracle-dataguard-implementation.html

2) What are different types of modes in Data Guard and which is default?


Maximum performance:

This is the default protection mode. 
It provides the highest level of data protection that is possible without affecting the performance of a primary database. 
This is accomplished by allowing transactions to commit as soon as all redo data generated by those transactions has been written to the online log.

Maximum protection:

This protection mode ensures that no data loss will occur if the primary database fails. 
To provide this level of protection, the redo data needed to recover a transaction must be written to both the online redo log and to at least one standby database before the transaction commits. 
To ensure that data loss cannot occur, the primary database will shut down, rather than continue processing transactions.

Maximum availability:

This protection mode provides the highest level of data protection that is possible without compromising the availability of a primary database. 
Transactions do not commit until all redo data needed to recover those transactions has been written to the online redo log and to at least one standby database.


3) How many standby databases we can create (in 10g/11g)?


Till Oracle 10g, 9 standby databases are supported.

From Oracle 11g R2, we can create 30 standby databases.

4) What are the parameters we have to set in primary/standby for Data Guard ?

DB_UNIQUE_NAME
LOG_ARCHIVE_CONFIG
LOG_ARCHIVE_MAX_PROCESSES
DB_CREATE_FILE_DEST
DB_FILE_NAME_CONVERT
LOG_FILE_NAME_CONVERT
LOG_ARCHIVE_DEST_n
LOGARCHIVE_DEST_STATE_n
FAL_SERVER
FAL_CLIENT
STANDBY_FILE_MANAGEMENT


5) What is the use of fal_server & fal_client, is it mandatory to set these ?

FAL_SERVER
specifies the FAL (fetch archive log) server for a standby database. The value is an Oracle Net service name, which is assumed to be configured properly on the standby database system to point to the desired FAL server.


FAL_CLIENT

specifies the FAL (fetch archive log) client name that is used by the FAL service, configured through the
FAL_SERVER initialization parameter, to refer to the FAL client. 
The value is an Oracle Net service name, which is assumed to be configured properly on the FAL server system to point to the FAL client (standby database).


6) What are differences between physical, logical, snapshot standby and Active DG , what are different types of standby databases?


Physical standby – in mount state, MRP will apply archives

ADG – in READ ONLY state, MRP will apply archives
Logical standby – in READ ONLY state, LSP will run

Snapshot standby databases – Physical standby database can be converted to snapshot standby database, which will be in READ WRITE mode, can do any kind of testing, then we can convert back snapshot standby database to physical standby database and start MRP which will apply all pending archives.


7) How to find out backlog of standby?

SELECT ROUND((SYSDATE - A.NEXT_TIME)*24*60) AS "BACKLOG",M.SEQUENCE#-1 "SEQ APPLIED",M.PROCESS, M.STATUS
FROM V$ARCHIVED_LOG A, (SELECT PROCESS,SEQUENCE#, STATUS FROM V$MANAGED_STANDBY WHERE PROCESS LIKE '%MRP%')M WHERE A.SEQUENCE#=(M.SEQUENCE#-1);


8) If you didn't have access to the standby database and you wanted to find out what error has occurred in a data guard configuration, what view would you check in the primary database to check the error message?


You can check the v$dataguard_status view. 

SELECT MESSAGE FROM V$DATAGUARD_STATUS;


9) How can u recover standby which far behind from primary or without archive logs how can we make standby sync?


By using RMAN incremental backup.

10)  What are new features in 11g Data Guard?


Here is some data guard category and there enhancement

1) Data Protection

Advanced Compression
Lost-write protection
Fast-Start Failover

2) Increase ROI
Active Data Guard
Snapshot Standby


3) High Availability
Faster Redo Apply
Faster failover & switchover
Automatic Failover using ASYNC


4) Manageability
    Mixed Windows/Linux

11) What are the uses of standby redo log files


A standby redo log is required for the maximum protection and maximum availability modes and the LGWR ASYNC transport mode is recommended for all databases


You should plan the standby redo log configuration and create all required log groups and group members when you create the standby database. For increased availability, consider multiplexing the standby redo log files, similar to the way that online redo log files are multiplexed.

If the real-time apply feature is enabled, log apply services can apply redo data as it is received, without waiting for the current standby redo log file to be archived. This results in faster switchover and failover times because the standby redo log files have been applied already to the standby database by the time the failover or switchover begins


12) What is dg_config ?


Specify the DG_CONFIG attribute to identify the DB_UNIQUE_NAME for the primary database and each standby database in the Data Guard configuration. The default value of this parameter enables the primary database to send redo data to remote destinations and enables standby databases to receive redo data. The 


DG_CONFIG attribute must be set to enable the dynamic addition of a standby database to a Data Guard configuration that has a Real Application Clusters primary database running in either maximum protection or maximum availability mode.

13) What is RTA (real time apply) mode MRP? 


Real-time apply where before log shipping the LGWR process writes to a standbylog file simultaneously along with the online redolog file. 
This standby logfile is written to standby log file on standby server. There is no loss of any committed transaction whatsoever in Real-Time Apply scenario.

•In Real Time Apply, once a transaction is committed on the Primary, the committed changes will be available on the Standby in Real Time even without switching the log at the Primary


MRP - Managed recovery process - For Data Guard, the background process that applies archived redo log to the standby database.


14)  What is the difference between normal MRP (managed apply) and RTA MRP (real time apply)?



The difference between Redo Apply & Real-Time Apply

------------------------------------------------------
Normally, by default, Archiver processes will be responsible for Redo Transport from Primary to Standby.

Once a log switch happens on the Primary, the online redo log is archived in the Local Archive destination as pointed to by Log_archive_dest_1 

by an Archiver process. 
Another Archiver process will then transmit the redo to the remote standby destination as indicated by Log_archive_dest_2. 
Data Guard Remote File Server (RFS) Process on the Standby then writes redo data from the Standby redo log file to archive redo log file. 
Log apply services then makes use of Managed Recovery Process (MRP) process to apply the redo to the standby database.
This method of propagating redo from the primary to standby is called Redo Apply and it happens only on log switch at the Primary.
When using Redo Apply mode, the status of MRP in v$managed_standby view will show as WAIT_FOR_LOG.

Real Time Apply, in contrast, uses either LGWR or Archiver on the Primary to write redo data to Standby Redo log on the Standby and Log Apply Services can apply the redo data in real-time without the need of the current standby redo log being archived. Once a transaction is committed on the Primary, the committed changes will be available on the Standby in Real Time even without switching the log.


When using Real Time Apply mode, the status of MRP in v$managed_standby view will show as APPLYING_LOG.



15) What is the difference between SYNC/ASYNC, LGWR/ARCH, and AFFIRM/NOAFFIRM ?


Specifies that network I/O is to be done synchronously (SYNC) or asynchronously (ASYNC) when archival is performed using the log writer process (LGWR).

Specifies whether redo transport services use archiver processes (ARCn) or the log writer process (LGWR) to collect transaction redo data and transmit it to standby destinations. If neither the ARCH or LGWR attributes are specified, the default is ARCH.


Controls whether redo transport services use synchronous or asynchronous I/O to write redo data to disk


AFFIRM—specifies that all disk I/O to archived redo log files and standby redo log files is performed synchronously and completes successfully before the log writer process continues.


NOAFFIRM—specifies that all disk I/O to archived redo log files and standby redo log files is performed asynchronously; the log writer process on the primary database does not wait until the disk I/O completes before continuing.



16) What is Static ConnectIdentifier property used for?


11gr2 new database property, StaticConnectIdentifier, which allows the user to specify a static connect identifier that the DGMGRL client will use to start database instances.


17) What is failover/switchover (or) what is the difference between failover & switchover


Switchover – This is done when both primary and standby databases are available.
Failover – This is done when the primary database is NO longer available (i.e in a Disaster).

18) What are the background processes involved in Data Guard?


MRP, LSP,