Tuesday, December 11, 2012

How to Deinstall/Disable a specific licensable database option from already installed Oracle Database 11gR2 Home



Method:

Installation of Oracle Database 11g Release 2 Software installs all the licensable database options. Though installed, not all the licensable database options are enabled by default. During installation, installer gives an option for users to enable the licensable database options that are not enabled in a default installation. 

Users can also choose to disable some licensable database options that are enabled by default. 

Once the installation is done, users can still disable or enable some licensable database options. 

This article explains how to enable or disable a specific licensable database option from an already installed Oracle home.

Oracle Database 11g Release 2 (11.2.0.x), it is not possible to deinstall/remove a specific licensable database option from an already installed database Oracle home. However, users can choose to enable or disable a specific licensable database option using the chopt tool. 

The chopt tool is a command-line utility that is located in the ORACLE_HOME/bin directory. 

The syntax for chopt is:
 
chopt [ enable | disable] db_option

Example :  To enable the Oracle Partitioning option in your Oracle binary files, stop the database, run the following command, and start the database. 

chopt enable Partitioning

 

Friday, November 9, 2012

Product Licenses Oracle GoldenGate and Oracle Active DataGuard


Product Licenses Oracle GoldenGate and Oracle Active DataGuard

Oracle Golden Gate and Oracle Active Data Guard are strategic capabilities within Oracle's software portfolio and are complementary to each other. When used together, Oracle GoldenGate and Oracle Active Data Guard offer a unique data protection and information distribution solution not offered by any other product.

Note:
Oracle GoldenGate is an Oracle product sold independently of the Oracle Database for Oracle and third-party database management systems. It is available for both Oracle Database Enterprise Edition and Oracle Database Standard Edition. A license for Oracle GoldenGate includes a license for Oracle Active Data Guard.


Oracle Active Data Guard requires a separate license and can only be used with Oracle Database Enterprise Edition. It can be purchased as the Active Data Guard Option for Oracle Database Enterprise Edition. It is also included with Oracle GoldenGate. Basic Data Guard functionality does not require a separate license, and it is included with Oracle Enterprise Edition.

Oracle GoldenGate is Oracle's strategic product for data distribution and data integration.
 

Oracle GoldenGate supplements Active Data Guard with its heterogeneous and bidirectional replication capabilities to enable enterprise-wide information distribution, zero-downtime upgrades and migrations, query offloading to heterogeneous systems, and multimaster database solutions.

Depending on the business situation:
Choose Oracle Active Data Guard for a simple, high-performance, drop-in solution for disaster recovery, data protection, and high availability for the entire Oracle database.
 

Choose Oracle GoldenGate to set up a data distribution and data synchronization solution through this Oracle-Oracle replication configuration, or a more flexible multimaster HA solution.

Thursday, November 8, 2012

Comparative Study Between Oracle GoldenGate and Oracle DataGuard


Comparative Study Between Oracle GoldenGate and Oracle DataGuard


Technical Points   Oracle Dataguard / Oracle Active Dataguard   Oracle GoldenGate
         
Operating System   Primary Database and Standby Database Should be same. (But 11g Onwards it supports Heteregenous Data Guard Configurations.                       Example : We can imeplement Oracle Data Guard between Oracle Linux server 6.2 (x86_64)  and Microsoft Windows 2008 Server R2 (x64)   Primary Database and Standby Database need not be same.
         
Database   Should be Oracle Database in both Source and Target.   Database can be different in Source and Target. Example :Source database can be Oracle and Target database can be MY SQL/MS SQL server.
         
Database Version   Primary Database and Standby Database Should be same.   Primary Database and Standby Database need not be same. (Including Database Software).
         
Replication method   Data movement will be in-form of Log Files.   It moves Data Transaction wise through Extract and Replicat process from Source to Target, when commits.
         
Database mode    Source: Read write mode
Target:  Recovery Mode / Open Read Only.
  Source: Read write mode
Target:  Read write mode
         
Replication Type   Unidirectional. (Data movement will happen in single direction).   Multi-Directional.
         
Integrated Feature   No additional software to install. Oracle Data Guard /Active Data Guard includes in Enterprise Edition.   Oracle GoldenGate software to install in Source as well as Target.
         
License Cost   No additional license required for Oracle Data Guard to install. Oracle Active Data Guard is an enterprise option with Oracle Enterprise Edition.   Oracle GoldenGate Software Licence required in Source and Target Databases.
         
Database Edition   Source: Oracle Enterprise Edition
Target: Oracle Enterprise Edition.
  Source: Can be Oracle Enterprise Edition/Oracle Standard Edition/Oracle Standard Edition One
Target:  Oracle Enterprise Edition/Oracle Standard Edition/Oracle Standard Edition One

Tuesday, November 6, 2012

How to check which Enterprise Options are enabled in your Oracle Database


The following Oracle Database features will require additional enterprise option along with Oracle Enterprise Edition (EE).

1. Oracle Partitioning
2. Oracle OLAP
3. Oracle DataMining
4. Oracle OLTP Compression
5. Oracle Label Security
6. Oracle Advanced Security
7. Oracle RAC
8. Oracle Data Masking Pack
9. Oracle Flashback Data Archive
10. Oracle Active Data Guard

Before moving your databases to production environment, check the above Oracle options enabled in your Oracle Database. Based on Oracle License Options you can disable/enable the above Oracle Features.

Oracle has views to tell if you have been using specific extra cost Oracle features in your Oracle Database.

from which date.


Query :

Set feedback off
Set linesize 122
Col name                         format a45     heading "Feature"
Col version                    format a10     heading "Version"
Col detected_usages  format 999,990 heading "Detected|usages"
Col currently_used    format a06     heading "Curr.|used?"
Col first_usage_date  format a10     heading "First use"
Col last_usage_date   format a10     heading "Last use"
Col nop noprint
Break on nop skip 1 on name
SQL> Select decode(detected_usages,0,2,1) nop,
                          name, version, detected_usages, currently_used,
                          to_char(first_usage_date,'DD/MM/YYYY') first_usage_date, 
                          to_char(last_usage_date,'DD/MM/YYYY') last_usage_date
            from dba_feature_usage_statistics
           order by nop, 1, 2


Thursday, October 25, 2012

11.2.0.3.4 Patch Set Update for Oracle 11g R2 (11.2.0.3.0)



Database 11.2.0.3.4 PSU Patch 14275605
--------------------------------------------------------

To install the PSU 11.2.0.3.4 patch, the Oracle home must have the 11.2.0.3.0 Database installed. Subsequent PSU patches can be installed on Oracle Database 11.2.0.3.0

This patch is Oracle RAC Rolling Installable.

This patch is Data Guard Standby-First Installable.

You must use the OPatch utility version 11.2.0.3.0 or later to apply this patch. Oracle recommends that you use the latest released OPatch 11.2, which is available for download from My Oracle Support patch 6880880 by selecting the 11.2.0.0.0 release.

If you are installing the PSU to an environment that has a Grid Infrastructure home, note the following:

Patch 14275572: GRID INFRASTRUCTURE PATCH SET UPDATE 11.2.0.3.4 (INCLUDES DB PSU 11.2.0.3.4)


Patch 14275605 - 11.2.0.3.4 Patch Set Update
--------------------------------------------------------------

Bugs Fixed by This Patch - This patch includes the following bug fixes.

1 CPU Molecules
------------------------


CPU molecules in PSU 11.2.0.3.4:

PSU 11.2.0.3.4 contains all molecules previously released in PSU 11.2.0.3.3 and the following new PSU 11.2.0.3.4 molecules:

14480674 - DB-11.2.0.3-MOLECULE-019-CPUOCT2012
14480675 - DB-11.2.0.3-MOLECULE-020-CPUOCT2012
14480676 - DB-11.2.0.3-MOLECULE-021-CPUOCT2012
14548763 - DB-11.2.0.3-MOLECULE-022-CPUOCT2012
14664355 - DB-11.2.0.3-MOLECULE-023-CPUOCT2012

2 Bug Fixes
----------------


See My Oracle Support Document 1449750.1 that documents all the non-security bugs fixed in each 11.2.0.4 Patch Set Update (PSU).
 

PSU 11.2.0.3.4 contains the following new fixes:
----------------------------------------------------------------- 
Advanced Queuing

13484963 - INVALID TTC BUFFER LENGTH IN CASE OF PROPAGATION MAY RAISE ORA-3146

Automatic Storage Management

13476583 - DROPPING OF A DISK CAN CAUSE DISMOUNT OF DISKGROUP IN OTHER ASM

Buffer Cache Management

13397104 - INSTANCE CRASH WITH ORA-600 [KJBLPKEYDRMQSCCHK:PKEY]
14409183 - SESSION HANGS ON GC BUFFER BUSY ACQUIRE

Generic

12693626 - HIGH CPU USAGE BY QUERY ON PARTITIONING KEY WITH INTERVAL PARTITIONING
12971775 - ORA-0600 WHILE RUNNING PARALLEL DML WHILE ONLINE INDEX IS CREATING
13059165 - EXEC OF UTLRP.SQL MAY RETURN INCORRECT COUNT FOR "OBJECTS WITH ERRORS" RESULT
13080778 - ORA-00942 RETURNED IN SQL ON MULTIPLE SCHEMAS DATABASE
13099577 - ORA-1460 WHEN PARALLEL QUERY SERVERS ARE USED
13250244 - ORA-4031 ERRORS SEEN WHEN PARAMETER _KGHDSIDX_COUNT IS SET TO >1 DUE TO MEM LEAK
13358781 - DBA_HIST_SQLSTAT SHOWS CCWAIT_DELTA ALWAYS = 0
13384182 - ORA-600 [DELROW:IOT1] RAISED FOR DELETE OR MERGE..DELETE SQL
13550185 - QUERIES ON V$SQLSTATS MAY CAUSE CRASH OR HANG
13566938 - DML WITH BINDS ON A REFERENCE PARTITIONED TABLE MAY RAISE ORA-600 [KCBGTCR_1]
13572659 - DBMS_REDEFINITION DISABLES FKS USED FOR REFERENCE PARTITIONING
13705338 - WRONG RESULTS ON IOT SECONDARY INDEX THROUGH JOIN
14076523 - ORA-600 [KGXRELEASE-BAD-HOLDER] FROM PROCESS WITH NO USER SESSION
14613900 - POSSIBLE CORE DUMP WHILE SCANNING FOR A CHILD FOR SHARABLE CURSOR

High Availability

12794305 - REDO SHIPMENT COULD FAIL AT THE STANDBY WITH ORA-600:[KRSR_PIC_COMPLETE.8]
13377816 - DON'T SEND IN DIA0 IF SOCKET CLOSED - HANDLE FAILURE APPROPRIATELY
13385346 - GCR0 TRACE FILES CONTINUOUSLY CREATED WITH KJGCR_DELETESO MESSAGES
13718279 - DB INSTANCE TERMINATED DUE TO ORA-29770 WHEN _GC_DEFER_TIME IS SET TO 1MS
13737746 - MRP0: BACKGROUND MEDIA RECOVERY TERMINATED

Oracle Security

11708510 - ORA-28267: INVALID NAMESPACE VALUE ERROR WHEN SQL USES DB LINK TO ACCESS 10G DB

Oracle Space Management

12583611 - EXCESSIVE ENQ:TX CONTENTION WITH HEAVY SECUREFILE INSERT WORKLOAD ON RAC
13464002 - PREFETCH INVOLVING TEMP OBJECTS MAY RAISE ORA-600[KCBCHG1_12]/[KDIFIND:KCBGET_24
13649031 - ORA-10637 OCCURS WHEN SHRINK ON PARTITIONED TABLE
13773133 - ORA-600 [KTSFLMERGE-CYCLE-1] DURING INSERTS INTO FREELIST MANAGED SEGMENT

Oracle Streams

12594032 - POSSIBLE MEMORY CORRUPTION WHEN USING CDC EXTEND_WINDOW OR EXTEND_WINDOW_LIST

Oracle Transaction Management

13430938 - ORA-4031 ERRORS WITH HIGH "KTC LATCH SUBH" MEMORY USAGE

Oracle Virtual Operating System Services

12585543 - RMAN BACKUP PERFORMANCE DROPS SIGNIFICANTLY AFTER UPGRADE TO 11.2

PL/SQL

13612575 - PROCEDURES RETURNING REFCURSOR BIND VARIABLES MAY HIT ORA-600 [15419]
13624984 - DATAPUMP HANGS ON PACKAGE BODY COMPILATION LIBRARY CACHE PIN
13804294 - INTERNAL ERRORS, CORRUPTIONS, USING PIPELINED FUNCTION WHOSE ROWS CAUSE ERRS

Server Manageability

13257247 - POPULATING WRH$_TEMPSTATXS MAY BE SLOW DUE TO INEFFICIENT QUERY EXECUTION PLAN
13699124 - AWR COMPARE PERIOD: SPINNING WHEN QUERYING DIFF OF KEY INSTANCE STATS







Monday, September 3, 2012

Oracle DataGuard Vs SAN-to-SAN Replication

Oracle DataGuard Vs SAN-to-SAN Replication








Wednesday, August 29, 2012

Tuesday, August 28, 2012

Recover the Primary Database's datafile using a copy of a Physical Standby Database's Datafile

Recover the Primary Database's datafile using a copy of a Physical Standby Database's Datafile

Before replacing a datafile with a copy from either production or standby, please confirm that all archivelogs are available for full recovery of this datafile.

Check the following before replacing :

a). dbv must return with zero corrupted pages
$ dbv file=<full path filename> blocksize=<tablespace blocksize> logfile=<output log>

b). rman validate:  
RMAN> backup validate check logical datafile n;   (n is datafile number)

c). Once RMAN is completed, this view must return zero rows:
SQL> select * from v$database_block_corruption;

Recovering the Primary's Datafile :

1). In the Physical standby database, backup the datafile to a cooked file system:
RMAN> backup datafile 5 format '/tmp/df5_st.bk';

2). Transfer the backuppiece from the standby to the primary host using scp, ftp, nfs etc

3). In the primary database, do the following:

a). Catalog this backuppiece and confirm that it is available for use:
RMAN> catalog backuppiece '/tmp/df5_st.bk';
RMAN> list backuppiece '/tmp/df5_st.bk'
RMAN> list backup of datafile 5;

b). Restore the datafile:
SQL>  alter database datafile 5 offline;
RMAN> restore datafile 5;

c). Recover the datafile:
RMAN> recover datafile 5;

d). Place the datafile online:
SQL> alter database datafile 5 online;


e). Check the datafile status:
SQL> select file_name from dba_data_files

11.2.0.3.3 Patch Set Update for Oracle 11g R2 (11.2.0.3.0)

Patch 13923374 - 11.2.0.3.3 Patch Set Update :

To install the PSU 11.2.0.3.3 patch, the Oracle home must have the 11.2.0.3.0 Database installed. Subsequent PSU patches can be installed on Oracle Database 11.2.0.3.0

This patch is Oracle RAC Rolling Installable.

This patch is Data Guard Standby-First Installable.

You must use the OPatch utility version 11.2.0.3.0 or later to apply this patch. Oracle recommends that you use the latest released OPatch 11.2, which is available for download from My Oracle Support patch 6880880 by selecting the 11.2.0.0.0 release.

If you are installing the PSU to an environment that has a Grid Infrastructure home, note the following:
  • Grid Infrastructure PSU 11.2.0.3.3 <<Patch 13919095>> should be applied to the Grid Infrastructure home and Database home using the readme instructions provided with the patch.

PSU 11.2.0.3.3 contains the following new fixes

Buffer Cache Management
13457582 - INSTANCE CRASH AFTER ORA-600 [KCLANTILOCK_8]
13467683 - JOIN OF TEMP AND PERMANENT TABLES IN RAC MIGHT CAUSE

CORRUPTION OF PERMANENT TBL
13916709 - FIX FOR BUG 13916709

Generic
9761357 - ORA-600[QKEISEXPRRE...ED1] WHEN QUERYING DUAL WITH PREDICATE INVOLVING ORA_ROWSN
12535346 - DML ON TABLE W/ RI AND INTERVAL PARTITIONED PARENT TABLE MAY FAIL WITH SIGSEGV
12617123 - SPLIT SUBPARTITION ON TABLE W/ CHILD REFERENCE-PARTITIONED TABLE FAIL WITH ORA-1
12646784 - ALTER TABLE FAILS WITH ORA-600 [KKPOFFOC]
12658411 - LARGE RESULT CACHE CAUSING INSTANCE TO HANGS
12678920 - CONCURRENT SPLIT/MERGE,DROP PARTITION OPERATIONS ON TABLE MAY FAIL WITH SIGSEGV
12797420 - KGLHDGH CONTENTION ON THE DB INSTANCE HANDLE WHEN CURSOR_SHARING IS SET TO FORCE
12913474 - DISABLED INVALID TABLE TRIGGER CAN STILL BLOCK DML
12976376 - MEMORY LEAK IN SHARED CURSOR LAYER: "KKSFBC:HASH1"
13035360 - TASK FORCE: UNEXPECTED ORA-02303: RAISED FROM PATCH EDITION OF THE INSTANCE
13370330 - ORA-600[QKEISEXPRREFERENCED1] FROM QUERY W/ VIRTUAL COLUMN WITH A CONSTANT VALUE
13419660 - UNSHARED DATAPUMP SESSION STATE THRU DBMS_REDEFINITION CALLS CAUSES MEMORY LEAK
13502183 - VALID PACKAGE BODY IN CHILD EDITION MARKED AS INVALID DURING UTL_RECOMP
13588248 - COREDUMP IN RAC ENV WITH SESSION POOLING, DRCP, FLASH CACHE, SERVER CACHE, AC
13657605 - ORA-600 [KKZGBTCOLS] DURING BUILD DEFERRED REMOTE WITH ROWID MV CREATION

High Availability
10133521 - LOGICAL STANDBY APPLY COULD FAIL WITH ORA-26808/26786 FOR SOME NLS_SORT VALUES
12879027 - LMON PROCESS CAN GET STUCK IN DRM QUIESCE STEP TRIGGERING PSEUDO RECONFIGURATION
13366202 - DBNEWID [ NID ] DOESN'T ALLOW TARGET=/

Oracle Network
12880299 - RAC: TCP HANDLERS BLOCK IF LISTENER REGISTRATION IS RESTRICTED TO IPC W/COST

Oracle Security
11840910 - ORA-604 DURING STARTUP WITH SYSOPER
13340388 - ORA-600 [KZAXPOPR14...] WHILE READING XML AUDIT FILES WITH XML EXTENDED AUDITING

Oracle Space Management
12401111 - ORA-00600 [KDLIXFMCHECK] ON 11.2.0.2
13103913 - ORA-600 [25027] [TS#] [1] DURING DML WHILE INDEX IS BEING REBUILT ONLINE
13326736 - ORA-959 RENAMING A TABLESPACE TO ALREADY DROPPED TABLESPACE NAME
13981051 - CORE DUMP IN TBSAFL MAY BE SEEN WHILE CREATING TABLESPACE WITH COMPRESSION

Oracle Transaction Management
13903046 - ORA-600 [4417] WHILE PERFORMING BLOCK CLEANOUTS ON HCC COMPRESSED TABLE BLOCKS

Oracle Utilities
9858539 - DATA PUMP IMPORT FAILS FOR LOGON TRIGGER ORA-04072: INVALID TRIGGER TYPE
13001379 - DATAPUMP TRANSPORT_TABLESPACES PRODUCES WRONG METADATA FOR SOME TABLES

Server Manageability
13338048 - ORA-1476 OCCURRED WHILE OUTPUTTING THE AWR REPORT FOR STREAMS-RELATED SECTIONS
13527323 - AWR REPORT GENERATION COULD FAIL WITH ORA-6502 WITH MULTIBYTE CHARS IN SQL TEXT


Tuesday, July 31, 2012

Calculation - Number of Semaphores per set Calculated on a Unix platforms


Example :

Unix kernel parameters:
 

SEMMNI = 100   # semaphore identifiers
SEMMSL = 50      # max semaphores per id or set
SEMMNS = 500  # semaphores in system

Oracle parameter:

PROCESSES=150

If the maximum number of semaphores in a set is less than (processes+4), Oracle will try to allocate at most (processes+4)/2 semaphores per set, even less if that's still too large.

Basically, the server tries to allocate a set of processes+4 semaphores, and if this fails, it divides the number by 2 and tries again, until it succeeds, and that's the number per set it will use.

Next, it subtracts 4 from this number (for internal use) and the remainder is what can be used for process semaphores.

So processes+4 makes 154 divided by 2 makes 77.

77 > 50 so we need to divide it again by 2 which makes 38 which is < 50 so 38 is OK. 


Next, we substract 4 from this number (for internal use) which makes 34.

Now, we need 150 semaphores, this makes 5 sets of 34 semaphores each. 

(5 sets makes 170, 4 sets is not enough because it only makes 136 < 150)
 
At the end we do not need sets of 34 but 38 (34 + 4) which makes 5 sets of 38.

With the above settings, Oracle will create 5 sets of 38 semaphores each

Monday, March 26, 2012

Power Of Native Compilation Initialization Parameter



Connect as 'sysdba' user


SQL> conn sys/oracle@Production as sysdba

SQL> SHOW PARAMETER PLSQL_CODE_TYPE


NAME                                 TYPE        VALUE
------------------------------------ ----------- ------------------------------
plsql_code_type                      string      INTERPRETED


SQL> alter user sh identified by sh account unlock;
User altered


SQL> conn sh/sh@Production

SQL> CREATE OR REPLACE FUNCTION C_N_K (N IN NUMBER, K IN NUMBER)
  2  RETURN NUMBER
  3  IS
  4  N_FAT NUMBER := 1;
  5  K_FAT NUMBER := 1;
  6  N_K_FAT NUMBER := 1;
  7  BEGIN
  8  FOR J IN 1..N LOOP
  9  N_FAT := N_FAT * J;
 10  END LOOP;
 11  FOR J IN 1..K LOOP
 12  K_FAT := K_FAT * J;
 13  END LOOP;
 14  FOR J IN 1..(N - K) LOOP
 15  N_K_FAT := N_K_FAT * J;
 16  END LOOP;
 17  RETURN (N_FAT / (N_K_FAT * K_FAT));
 18  END;
 19  /


Function created


SQL> CREATE OR REPLACE PROCEDURE STRESS(ANUM NUMBER)
  2  IS
  3  AVAL NUMBER;
  4  BEGIN
  5  FOR J IN 1..ANUM LOOP
  6  AVAL := C_N_K (50,10);
  7  END LOOP;
  8  END;
  9  /


Procedure created


SQL> SET TIMING ON
SQL> BEGIN
  2  STRESS(100000);
  3  END;
  4  /

PL/SQL procedure successfully completed


Executed in 1.123 seconds


Note : Flush the Shared Pool Area / Bounce the database server.


SQL> SET TIMING OFF


SQL> ALTER SESSION SET PLSQL_CODE_TYPE = NATIVE;
Session altered


SQL> CREATE OR REPLACE FUNCTION C_N_K (N IN NUMBER, K IN NUMBER)
  2  RETURN NUMBER
  3  IS
  4  N_FAT NUMBER := 1;
  5  K_FAT NUMBER := 1;
  6  N_K_FAT NUMBER := 1;
  7  BEGIN
  8  FOR J IN 1..N LOOP
  9  N_FAT := N_FAT * J;
 10  END LOOP;
 11  FOR J IN 1..K LOOP
 12  K_FAT := K_FAT * J;
 13  END LOOP;
 14  FOR J IN 1..(N - K) LOOP
 15  N_K_FAT := N_K_FAT * J;
 16  END LOOP;
 17  RETURN (N_FAT / (N_K_FAT * K_FAT));
 18  END;
 19  /


Function created


SQL> CREATE OR REPLACE PROCEDURE STRESS(ANUM NUMBER)
  2  IS
  3  AVAL NUMBER;
  4  BEGIN
  5  FOR J IN 1..ANUM LOOP
  6  AVAL := C_N_K (50,10);
  7  END LOOP;
  8  END;
  9  /


Procedure created


SQL> SET TIMING ON
SQL> BEGIN
  2  STRESS(100000);
  3  END;
  4  /


PL/SQL procedure successfully completed


Executed in 0.936 seconds


SQL> SET TIMING OFF
SQL> ALTER SESSION SET PLSQL_CODE_TYPE = INTERPRETED;
Session altered





Saturday, March 10, 2012

Effect of Creating Tablespace/Datafile on Primary Database when Logical Standby Database in Place


Primary Database:
Create a tablespace as below.

dbPRD>create tablespace tbstest2
              datafile '/oradata1/dbprd/tbstestt201.dbf' size 1m
              autoextend on next 1m maxsize unlimited;
Tablespace created.

dbPRD>select name from v$tablespace where name ='TBSTEST2';

NAME
-------------
TBSTEST2

Logical Standby Database :

Check whether the tablespace has replicated from primary site to logical standby site.

dbREP-LOGICAL>select name from v$database where name='TBSTEST2';
no rows selected

From the above result we can understand that, the tablespace created in primary site did not replicate to logical standby.

The following steps has to be followed to replicate the tablespace to logical standby site.

Stop the Logical Standby Database apply process :
 
dbREP-LOGICAL>alter database stop logical standby apply;
Database altered.

Execute the below procedure.

dbREP-LOGICAL>CREATE OR REPLACE PROCEDURE SYS.CREATE_TBS_DDL (
OLD_STMT IN VARCHAR2,
STMT_TYP  IN VARCHAR2,
SCHEMA    IN VARCHAR2,
NAME         IN VARCHAR2,
XIDUSN     IN NUMBER,
XIDSLT      IN NUMBER,
XIDSQN   IN NUMBER,
ACTION   OUT NUMBER,
NEW_STMT OUT VARCHAR2
)
AS
BEGIN
NEW_STMT := REPLACE(OLD_STMT,'/oradata1/dbprd','/oradata2/dbrep');
ACTION := DBMS_LOGSTDBY.SKIP_ACTION_REPLACE;
EXCEPTION
WHEN OTHERS THEN
ACTION := DBMS_LOGSTDBY.SKIP_ACTION_ERROR;
NEW_STMT := NULL;
END CREATE_TBS_DDL;
/

Procedure created.

After creating the procedure, Execute the below dbms statement.

dbREP-LOGICAL>EXECUTE DBMS_LOGSTDBY.SKIP
(stmt => 'TABLESPACE',
 proc_name => 'sys.CREATE_TBS_DDL');

PL/SQL procedure successfully completed.

Start the Logical Standby Database apply process :

dbREP-LOGICAL>ALTER DATABASE START LOGICAL STANDBY APPLY IMMEDIATE;
Database altered.

Check whether the tablespace is replicated in logical standby site.

dbREP-LOGICAL>select name from v$tablespace where name='TBSTEST2';

NAME
-------------
TBSTEST2

Executing Data Pump (EXPDP) from Physical Standby Database

Physical Standby Database:
SQL> alter database recover managed standby database cancel;

Production Database:

SQL> create database link dbstd_dblink
SQL> connect to scott identified by laser using 'dbstd';

SQL> show user
USER is "SCOTT"

SQL> conn sys/oracle@dbprd as sysdba
Connected.

SQL> grant read,write on directory data_pump_dir to scott;
Grant succeeded.

SQL> grant read,write on directory data_pump_dir to system;
Grant succeeded.

SQL> host

[oracle@nagpur Desktop]$ expdp directory=data_pump_dir dumpfile=scott.dmp log=scott.log network_link=dbstd_dblink
Export: Release 11.2.0.3.0 - Production on Tue Feb 21 19:36:18 2012
Copyright (c) 1982, 2011, Oracle and/or its affiliates.  All rights reserved.
Username: scott/laser@dbprd

Connected to: Oracle Database 11g Enterprise Edition Release 11.2.0.3.0 - 64bit Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options
Legacy Mode Active due to the following parameters:
Legacy Mode Parameter: "log=scott.log" Location: Command Line, Replaced with: "logfile=scott.log"
Legacy Mode has set reuse_dumpfiles=true parameter.
FLASHBACK automatically enabled to preserve database integrity.
Starting "SCOTT"."SYS_EXPORT_SCHEMA_01":  scott/********@dbprd directory=data_pump_dir dumpfile=scott.dmp logfile=scott.log network_link=dbstd_dblink reuse_dumpfiles=true
Estimate in progress using BLOCKS method...
Processing object type SCHEMA_EXPORT/TABLE/TABLE_DATA
Total estimation using BLOCKS method: 256 KB
Processing object type SCHEMA_EXPORT/PRE_SCHEMA/PROCACT_SCHEMA
Processing object type SCHEMA_EXPORT/TABLE/TABLE
Processing object type SCHEMA_EXPORT/TABLE/INDEX/INDEX
Processing object type SCHEMA_EXPORT/TABLE/CONSTRAINT/CONSTRAINT
Processing object type SCHEMA_EXPORT/TABLE/INDEX/STATISTICS/INDEX_STATISTICS
Processing object type SCHEMA_EXPORT/TABLE/CONSTRAINT/REF_CONSTRAINT
Processing object type SCHEMA_EXPORT/TABLE/STATISTICS/TABLE_STATISTICS
. . exported "SCOTT"."DEPT"                              5.937 KB       4 rows
. . exported "SCOTT"."EMP"                               8.570 KB      14 rows
. . exported "SCOTT"."SALGRADE"                    5.867 KB       5 rows
. . exported "SCOTT"."T1"                                   5.125 KB      11 rows
. . exported "SCOTT"."BONUS"                                 0 KB       0 rows
Master table "SCOTT"."SYS_EXPORT_SCHEMA_01" successfully loaded/unloaded
******************************************************************************
Dump file set for SCOTT.SYS_EXPORT_SCHEMA_01 is:
  /cbsprddbs/oracle/admin/dbprd/dpdump/scott.dmp
Job "SCOTT"."SYS_EXPORT_SCHEMA_01" successfully completed at 19:37:28

[oracle@nagpur Desktop]$

Restoration of scott schema in Primary database using the above taken backup:

SQL> select db_unique_name,name,database_role from v$database;

DB_UNIQUE_NAME               NAME     DATABASE_ROLE
------------------------------     ---------    ----------------
dbprd                                         dbPRD      PRIMARY

SQL> drop user scott cascade;
User dropped.

SQL> select username from all_users where username='SCOTT';
no rows selected

SQL> create user scott identified by laser default tablespace users;
User created.

SQL> grant connect,resource,create database link,debug connect session,debug any procedure to scott;
Grant succeeded.

SQL> host impdp directory=data_pump_dir dumpfile=scott.dmp log=impdp_scott.log remap_schema=scott:scott parallel=2
Import: Release 11.2.0.3.0 - Production on Tue Feb 21 20:38:07 2012
Copyright (c) 1982, 2011, Oracle and/or its affiliates.  All rights reserved.
Username: sys/oracle@dbprd as sysdba

Connected to: Oracle Database 11g Enterprise Edition Release 11.2.0.3.0 - 64bit Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options
Legacy Mode Active due to the following parameters:
Legacy Mode Parameter: "log=impdp_scott.log" Location: Command Line, Replaced with: "logfile=impdp_scott.log"
Master table "SYS"."SYS_IMPORT_FULL_01" successfully loaded/unloaded
Starting "SYS"."SYS_IMPORT_FULL_01":  sys/********@dbprd AS SYSDBA directory=data_pump_dir dumpfile=scott.dmp logfile=impdp_scott.log remap_schema=scott:scott parallel=2
Processing object type SCHEMA_EXPORT/PRE_SCHEMA/PROCACT_SCHEMA
Processing object type SCHEMA_EXPORT/TABLE/TABLE
Processing object type SCHEMA_EXPORT/TABLE/TABLE_DATA
. . imported "SCOTT"."DEPT"                              5.937 KB       4 rows
. . imported "SCOTT"."EMP"                               8.570 KB      14 rows
. . imported "SCOTT"."SALGRADE"                    5.867 KB       5 rows
. . imported "SCOTT"."T1"                                   5.125 KB      11 rows
. . imported "SCOTT"."BONUS"                                 0 KB       0 rows
Processing object type SCHEMA_EXPORT/TABLE/INDEX/INDEX
Processing object type SCHEMA_EXPORT/TABLE/CONSTRAINT/CONSTRAINT
Processing object type SCHEMA_EXPORT/TABLE/INDEX/STATISTICS/INDEX_STATISTICS
Processing object type SCHEMA_EXPORT/TABLE/CONSTRAINT/REF_CONSTRAINT
Processing object type SCHEMA_EXPORT/TABLE/STATISTICS/TABLE_STATISTICS
Job "SYS"."SYS_IMPORT_FULL_01" successfully completed at 20:38:25

The schema Scott is restored from the backup taken from the physical standby database.

Monday, March 5, 2012

Oracle 11g RAC Exam Questions and Answers (1zo-058)

QUESTION NO: 1

Which three actions would be helpful in determining the cause of a node reboot?

A. determining the time of the node reboot by using the update command and subtracting the up time from the current system time
B. looking for messages such as "Oracle CSSD failure. Rebooting for cluster integrity” in
/var/log/messages
C. using the crsctl command to view tracing information
D. inspecting the ocssd log for "Begin Dump" or "End Dump" messages
E. inspecting the database alert log for reboot messages

Answer: A,B,D

QUESTION NO: 2

After Oracle Grid Infrastructure has been installed, you should take a few moments to verify the installation.
Which two actions would be useful in verifying the installation?

A. Run the crsctl status resource –t command to confirm that all necessary cluster resources are online.
B. Use the operating system utilities to verify that your SCAN addresses are being properly resolved.
C. Start Oracle Enterprise Manager and check all monitored targets.
D. Run the cluvfy comp nodecon –n all –verbose command to verify the entire Grid Infrastructure installation.

Answer: A,D

QUESTION NO: 3

Which two network addresses are required to be static, non-dhcp addresses when using the Grid Naming?

A. GNS VIP Address
B. SCAN VIP Address
C. Node VIP Address
D. Node Public Address
E. Node Private Address
Answer: A,D

QUESTION NO: 4

You are in the planning stages for upgrading your Oracle RAC database from Oracle Database 10g Release 2 to Oracle Database 11g Release 2 to run under the Oracle Grid Infrastructure.You decide to use an administrator-managed configuration because the cluster is fairly small.  Which statement is correct about this configuration?

A. A parent pool of the GENERIC server pool will be used.
B. You must define a new server pool called MANUAL.
C. A subpool of the GENERIC server pool will be used.
D. A subpool of the FREE server pool will be used.

Answer: C

QUESTION NO: 5

The Instance Initialization parameters are set to:
D8_CREATE_FILE_DEST = +DATA
DB_CREATE_ONLlNE_LOG_DEST_l = +LOGS
DB_CREATE_ONLlNE_LOG_DEST_2 = + FRA
The SQL* Plus command ALTER DATABASE ADD LOGFILE;  will create:

A. a new log file in the +DATA disk group, or a log file in the + FRA disk group, if +DATA is not available
B. a new log file in the +DATA disk group and a log file in the + FRA disk group
C. a new log file in the +LOGS disk group and a log file in the + FRA disk group
D. a new log file in the +LOGS disk group, or a log file in the +FRA dls* available
E. a new log file in the +DATA disk group, a log file in the +LOGS disk group, and a log file in the +FRA disk group
F. a new log file in the +LOGS disk group, or a log file in the +FRA disk group, if +LOGS is not available

Answer: C

QUESTION NO: 6

Which three statements define a cluster?

A. is a group of independent, but interconnected computers that act as a single system
B. can be deployed to increase availability and performance
C. can be deployed to balance a dynamically changing workload
D. should appear to an application as multiple servers

Answer: A,B,C

QUESTION NO: 7

You want to create an ACFS on an ADVM volume using a shell script and the appropriate command-line utilities. These are the requirements:
1. The dynamic volume file must use space in the VOLFILE disk group with a size of 500 M and be called prodvol.
2. The mount point called /acfs already exists.
Which four steps must be performed to achieve this?

A. As the Grid Infrastructure owner, run mount –t acfs /dev/asm/prodvol-417 /acfs to mount the file system.
B. As the Grid Infrastructure owner, run asmcmd volinfo –d VOLFILE prodvol to determine the volume information.
C. As the Grid Infrastructure owner, run asmcmd voicreate –d VOLFILE –s 500M
prodvol to create the volume file.
D. As the Grid Infrastructure owner, run mkfs –t acfs /dev/asm/prodvol -417 to create the file system.
E. As root, run mount –t acfs /dev/asm/prodvol -417 /acfs to mount the file system.
F. As root, run mkfs –t acfs /dev/asm/prodvol -417 to create the file system.

Answer: B,C,E,F

QUESTION 8

Some new non-ASM shared storage has been made available by the storage administrator and the Oracle Grid Infrastructure Administrator decides to move the voting disks, which do not reside in ASM, to this new non-ASM location. How can this be done?

A. By running crsctl add css votedisk <path_to_new_location> followed by crsctl delete css votedisk <path_to_old_location>      
B. By running crsctl replace css votedisk <path_to_old_location/path_to_new_location>      
C. By running srvctl replace css votedisk <path_to_old_location,path_to_new_location>      
D. By running crsctl add css votedisk<path_to_new_location> followed by srvctl delete css votedisk <path_to_old_location>   

Answer: B

QUESTION 9

Which three statements are true about using RMAN with ASM?

 A.RMAN is the only supported method to back up database files stored in ASM.      
B.RMAN is the only supported method to back up ACFS files.      
C.RMAN can use ASM storage for backups.      
D.RMAN cannot use ASM storage for backups.      
E.Using RMAN, database files can be migrated to ASM from a file system.      
F.Using RMAN, database files cannot be moved from ASM to a file system   

Answer: ACE

QUESTION 10

Which two statements are true about ACFS snapshots?

A.They can be created for ACFS file systems only if the ASM disk group hosting the ADVM volume file used by the file system has free space available.      
B.They can be created for ACFS file systems only if the ADVM volume file used by the file system has free space available.      
C.They can be created only if the ASM disk group hosting the ADVM volume used by the file system has no other ASM files contained in the disk group.      
D.They can be created when ACFS is used both on clusters and on stand-alone servers.      
E.They are accessible only on the cluster node that was used when creating the snapshot.   

Answer: AD

QUESTION 11

Your cluster is subject to a service-level agreement that allows for little scheduled down time You want to use patching and maintenance methods that permit the Oracle Grid Infrastructure and Oracle RAT Databases to be available as much as possible. Which two techniques will work some or all of the time to provide you with minimum down time?

A.rolling upgradeable and in place patch sets      
B.idling upgradeable and out of place patch bundles      
C.rolling upgradeable and out of place patch sets      
D.rolling upgradeable and in place patch bundles      
E.rolling upgradeable and out of place one-off patches   

Answer: CD

QUESTION 12

Which two types of files can be stored In an ASM clustered file system?

A.OCR and Voting Disk files      
B.data files for external tables      
C.Oracle database executable      
D.Grid Infrastructure executables      
E.data files for tablespaces      
F.archive log files   

Answer: BC

QUESTION 13

You want to reorganize the DATA diskgroup while continuing database operations. The DATA diskgroup was created using normal redundancy having one disk per failure group. The two disks used are /dev/sdal and /dev/sda2.
You plan to drop the existing disks and add the /dev/sdb1 and /dev/sdb2 disks to failure group FG_C and the /dev/sdcl and /dev/sdc2 disks to failure group FG_D.
Which procedure would you use to minimize the effect of the I/Os of this reorganization on ongoing database operations?

A.Set rebalance power to 0 for diskgroup DATA.
Add failure group FG_C with all the /dev/sdb disks.
Add failure group FG_D with all the /dev/sdc disks.
Drop disks/dev/sda1 and /dev/sda2
Set rebalance power to 1 for diskgroup DATA.      
B.Set rebalance power to 0 for diskgroup DATA.
Add failure group FG_C with all the /dev/sdb disks.
Add failure group FG_D with all the /dev/sdb disks.
Drop disks/dev/sda1 and /dev/sda2
Set rebalance power to 9 for diskgroup DATA.      
C.Set rebalance power to 9 for diskgroup DATA.
Add failure group FG_C with all the /dev/sdb disks.
Add failure group FG_D with all the /dev/sdc disks.
Drop disks /dev/sda1 and /dev/sda2.
Set rebalance power to 0 for diskgroup DATA.      
D.Set rebalance power to 0 for diskgroup DATA
Drop disks /dev/sdal and /dev/sdb disks.
Add failure group FG_C with all the /dev/sdb disks.
Add failure group FG_D with all the /dev/sdc disks
Set rebalance power to 1 for diskgroup DATA.   

Answer: A

QUESTION 14

Which two Cluster ware stack administration actions must be performed as the root user?

A.checking the health of the Clusterware on one node      
B.starting the Clusterware manually on one node      
C.disabling the Clusterware from automatic start at node reboot      
D.checking the health and viability of the Clusterware on all nodes      
E.listing the location of the voting disks   

Answer: BC

QUESTION 15

Which four statements are true about ADVM interoperability?

A.Using fdisk or similar disk utilities to partition ADVM-managed volumes is not supported      
B.On Linux platforms, the raw utility can be used to map ADVM volume block devices to raw volume devices.      
C.The creation of multipath devices over ADVM devices is not supported.      
D.You may create ASMLIB devices over ADVM devices to simplify volume management.      
E.ADVM does not support ASM storage contained in Exadata.      
F.ADVM volumes cannot be used as a boot device or a root file system.   

Answer: ACEF

QUESTION 16

Your four-node cluster was originally purchased, installed, and configured three years ago. You recently added another four nodes to the cluster.

Now you want to remove two of the older nodes that are still accessible to be redeployed elsewhere in the data center. Which two are true regarding the procedure for removing one or more cluster nodes?

A.The procedure requires that all commands be invoked from one of the surviving cluster nodes.      
B.All commands are run as root regardless of which nodes are used to invoke them.      
C.The procedure requires that some commands be invoked on the node or nodes to be removed and that some be invoked from all surviving cluster nodes.      
D.The procedure requires that some commands be invoked on the node or nodes to be removed and that some be invoked from one surviving cluster node.      
E.Some commands require that the name of the node or nodes to be removed are passed arguments, and some commands require the name of existing nodes to be passed   

Answer: DE

QUESTION 17

Your production environment cluster is running Oracle Enterprise Linux and currently has four nodes. You are asked to plan for extending the cluster to six nodes. Which three methods are available to add the new nodes?

A. silent cloning using crsctl clone cluster and ssh      
B. a GUI interface from Enterprise Manager      
C. with the Oracle Universal Installer using runInstaller ­clone <nodename>      
D. silent cloning using  perl clone.pl ­silent either with parameters in a file or in line      
E. using addNode.sh   

Answer: BDE

QUESTION 18

The Oracle 11g Release 2 (version 11.2.0.1) ASM instance has a new diskgroup named data that Is currently not mounted You log in to a cluster node as the Grid Infrastructure software, and set the environment variables to point to the ASM instance on that node. Using SQL*plus, you issue the commands:

CONNECT / AS SYSDBA
ALTER DISKGROUP DATA MOUNT;

The system response is:
ERROR at line 1:
ORA-15032: not all alterations performed
ORA-1S260: permission denied on ASM disk group

How do you diagnose this error?

A.Check v$asm_operation for operations halted by the error.      
B.Check v$asm_attributes to determine the asm.compatible setting.      
C.Check v$asm_usergroup to determine the owning user group for this diskgroup.      
D.Check v$xs_session_role to determine the role privileges of the current user.      
E.Check the connect string for the privileged role.   

Answer: E

QUESTION 19

You enter the following command:

crsctl status resource MyApp

You get this output:
NAME=MyApp
TYPE=cluster_resource
TARGET=ONLINE
STATE=ONLINE on RACNODE4

MyApp is a policy-managed resource using a server pool with two nodes called RACNODE3 and RACNODE4 and has a cardinality of 1.
What are the meanings of the target and state status values?

A.MyApp is currently active on RACNODE4 and is meant to be active only on RACNODE4.      
B.MyApp is meant to be active, is currently active on RACNODE4, but the Grid Infrastructure may start MyApp on RACNODE3 due to failovers.      
C.MyApp is active on RACNODE4 and was manually started.      
D.MyApp should also be online on RACNODE3 because it is a cluster_resources type that must be active on at least two nodes in the cluster, thereby overriding the CARDINALITY attribute.   

Answer: B

QUESTION 20

After evaluating the various methods for extending a cluster, you decide to use addNode.sh.The cluster originally consisted of four nodes: RACNODE1, RACNODE2, RACNODE3, and RACNODE4. Now two nodes called RACNODE5 and RACNODE6 have been installed and connected to the cluster by OS administrations.

Which three actions should be performed to check whether the new nodes are ready for running addNode.sh and to help correct any problems?

A. cluvfy stage -pre crsinst -n RACNODE5/ RACNODE6 -C + DATA -q +VOTE -orainv      
B. <oinstall group> -fixup -verbose      
C. cluvfy stage -post hwos -n RACNODE5, RACNODE6 -verbose      
D. cluvfy comp peer -refnode RACNODE1 -n RACNODE5, RACNODE6 -orainv <oinstall group> - osdba <asmdba group> -verbose      
E. cluvfy stage -post hwos -n all -verbose      
F. cluvfy stage -pre nodeadd -n RACNODE5, RACNODE6 -fixup      
G. cluvfy comp peer -refnode RACNODE5 -n RACNODE6 -orainv <oinstall group> -osdba <asmdba group> -verbose   

Answer: CDF

QUESTION 21

What are the default connect strings used by SQL*Plus and ASMCMD when connecting to ASM instances?

A. operating system authentication for ASMCMD-none for SQL*Plus      
B. "/ as sysasm" for ASMCMD' "/" for SQL*Plus      
C. "sys/ as sysasm" for ASMCMD; "/ as sysdba" for SQL* Plus      
D. operating system authentication for ASMCMD; operating system authentication for SQL*Plus      
E. "/ as sysasm" for ASMCMD; Operating system authentication for SQL*Plus   

Answer: B

QUESTION 22

You want to install a database patch on your eight-node cluster by using Opatch with, the minimum amount of down time to your cluster nodes.

You have already been prompted for the first set of nodes and you replied with node names RACNODE1, RACNODE2 and RACNODE3.

Which two statements are true about the procedure for minimizing down time?

A. The patch must be propagated to, applied, and the inventory updated on all the remaining nodes before restarting the instances on the first set of nodes.      
B. When the first set of nodes has been patched, the instances on the remaining nodes are shut down automatically by opatch.      
C. The instances must be started on the first set of nodes and then stopped on the remaining set to make certain that some nodes are always available.      
D. When the first set of nodes has been patched, the administrator is prompted to shut down the instances on the remaining nodes.      
E. The patch must be propagated to and the inventory updated on all the remaining nodes before restarting the instances on the first set of nodes.   

Answer: CD

QUESTION 23

You are ready to add two new nodes called RACNODE5 and RACNODE6 to your existing four- node cluster Using addNode.sh

You have run cluvfy -peer to check the new nodes against a reference node.

When you originally created the cluster, the network administrators chose to statically define the scan vip addresses in the corporate DNS server, and you installed the Oracle Grid Infrastructure without using GNS.What is the correct way to silently add the nodes?


A. addNode.sh -silent "CLUSTER_NEW_NODES={RACNODE5,RACNODE6}"      
B. addNode.sh -silent "CLUSTER_NEW_VIRTUAL_HOSTNAMES={RACNODE5-VIP, RACNODE6-VIP}"      
C. addNode.sh -silent "CLUSTER_NEW_NODES={RACNODE5,RACNODE6}" "CLUSTER_NEW_VlRTUAL_HOSTNAMES=RACNODE5-VIP,RACNODE6-VIP"      
D. addNode.sh -silent -responseFile mynewnodea.txt with the response file containing only      
E. CLUSTER_NEW_NODES={"RACNODE5,RACNODE6"}      
F. addNode.sh -silent -responseFile mynewnodes.txt with the response file containing only   CLUSTER_NEW_VIRTUAL_HOSTNAMES={"RACNODE3-VIP,RACNODE4-VIP"}   

Answer: C

QUESTION 24
Which four statements about mounting ASM cluster file systems are true?

A. An ACFS volume can be mounted by using ASMCA.      
B. The standard Linux/UNIX mount command can be used to mount an ACFS volume, provided the ACFS type is specified; (mount -t acfs).      
C. ACFS volumes can be mounted by using the ASMCMD utility.      
D. The acfsmountvol command can be used to mount ACFS volumes on Windows platforms.      
E. Oracle Enterprise Manager can be used to mount ACFS volumes.   

Answer: ABDE

QUESTION 25

You are allocating space from the ASM disk group for an ADVM volume. What will be the volume extent and Volume Allocation Unit (VAU) if the stripe column is 4 and AU is 1 MB? which are the default values?

A. The volume extent is 64 MB and the VAU will be 512 MB.      
B. The volume extent is 64 MB and the VAU will be 256 MB.      
C. The volume extent is 32 MB and the VAU will be 256 MB.      
D. It is not possible to calculate these values with the given information.   

Answer: B

Thursday, March 1, 2012

Switchover In Logical Standby Database Without Using DGMGRL

On Primary Database:

Check the switchover status and of the  Primary Database.


SQL> select switchover_status from v$database;


SWITCHOVER_STATUS

-----------------------------

TO STANDBY


SQL> select name,db_unique_name,database_role,open_mode from v$database;


NAME      DB_UNIQUE_NAME         DATABASE_ROLE      OPEN_MODE

--------- ------------------------------ ---------------- --------------------

primdb      primdb              PRIMARY      READ WRITE


Issue the below command to prepare the Primary Database to switchover to logical standby.

--> alter database prepare to switchover to logical standby;


SQL> alter database prepare to switchover to logical standby;

Database altered.

SQL> select switchover_status from v$database;


SWITCHOVER_STATUS

-----------------------------

PREPARING SWITCHOVER


Here the switchover status is PREPARING SWITCHOVER. Change the switchover status of Logical standby database and Wait for some time so that the status of primary database will change as TO LOGICAL STANDBY.


On Logical Standby Database
primdb

Check the switchover status and database role of the database.


SQL> select switchover_status from v$database;


SWITCHOVER_STATUS

----------------------------

NOT ALLOWED


SQL> select name,db_unique_name,database_role,open_mode from v$database;


NAME      DB_UNIQUE_NAME         DATABASE_ROLE      OPEN_MODE

---------    ------------------------------ ---------------- --------------------

stddby   stddby             LOGICAL STANDBY  READ WRITE


Issue the command to prepare the Logical standby database to switchover to Primary Database.


--> alter database prepare to switchover to logical standby;


SQL> alter database prepare to switchover to primary;

Database altered.


SQL> select switchover_status from v$database;


SWITCHOVER_STATUS
----------------------------

TO PRIMARY


On Primary Database

Now the check the switchover status of primary database. The status will be changed as TO LOGICAL STANDBY.


SQL> select switchover_status from v$database;

SWITCHOVER_STATUS
----------------------------

TO LOGICAL STANDBY

Now switchover primary database to Logical Standby using the  below command.


--> alter database commit to switchover to logical standby;


SQL> alter database commit to switchover to logical standby;

Database altered.


Now check the database role of the primary database. It will be changed to Logical Standby.


SQL> select name,db_unique_name,database_role,open_mode from v$database;

NAME      DB_UNIQUE_NAME         DATABASE_ROLE      OPEN_MODE

--------- ------------------------------ ---------------- --------------------

primdb      primdb              LOGICAL STANDBY  READ WRITE


On Logical Standby Database

Now check the switchover status of Logical Standby Database.

SQL> select switchover_status from v$database;

SWITCHOVER_STATUS

----------------------------

TO PRIMARY


Switchover the  Logical standby database to Primary using the below command.


--> alter database commit to switchover to primary;


SQL> alter database commit to switchover to primary;

Database altered.

Check the database role of the Logical Standby database. It will be changed as Primary.


SQL> select name,db_unique_name,database_role,open_mode from v$database;


NAME      DB_UNIQUE_NAME         DATABASE_ROLE      OPEN_MODE

--------- ------------------------------ ---------------- --------------------

stddby   stddby             PRIMARY      READ WRITE


On Primary Database

Start the Logical Standby apply process.


SQL> alter database start logical standby apply immediate;

Database altered.


On Logical Standby Database (Current Primary Database)

Insert a row in a table and check whether it has been replicated to Primary Database(Currently Logical Standby).


SQL> select * from scott.t1;

    NO
----------

     2

     1

     3

SQL> insert  into scott.t1 values(4);

1 row created.


SQL> commit;

Commit complete.

SQL> select * from scott.t1;


    NO

----------

     2

     1

     3

     4


On Primary Database (Current Logical Standby Database)

Check the replication to Primary Database(Current Logical Standby).


SQL> select * from scott.t1;

    NO

----------

     2

     1

     3


SQL> select * from scott.t1;


    NO

----------

     2

     1

     3

     4

The same thing has to be followed for Switchback.


SWITCHBACK TO OLD ROLE


On Logical Standby Database(Current Primary Database)

SQL> select switchover_status from v$database;


SWITCHOVER_STATUS

-----------------------------

TO STANDBY


SQL> alter database prepare to switchover to logical standby;

Database altered.

SQL> select switchover_status from v$database;

SWITCHOVER_STATUS
----------------------------

PREPARING SWITCHOVER


SQL> select switchover_status from v$database;


SWITCHOVER_STATUS

----------------------------
TO LOGICAL STANDBY


SQL> alter database commit to switchover to logical standby;

Database altered.


SQL> select switchover_status from v$database;


SWITCHOVER_STATUS

----------------------------

NOT ALLOWED


SQL> select open_mode,database_role,name from v$database;

OPEN_MODE         DATABASE_ROLE    NAME

-------------------- ---------------- ---------

READ WRITE         LOGICAL STANDBY  stddby


SQL> alter database start logical standby apply immediate;

Database altered.


SQL> archive log list

Database log mode           Archive Mode

Automatic archival           Enabled

Archive destination           /oradata3/stddby/archives

Oldest online log sequence     17

Next log sequence to archive   19

Current log sequence           19


SQL> select * from scott.t1;

    NO

----------

     2

     1

     3

     4


SQL> select * from scott.t1;

    NO

----------

     2

     5

     1

     3

     4



On primary Database (Current Logical Standby Database)

SQL> select switchover_status from v$database;

SWITCHOVER_STATUS

----------------------------

NOT ALLOWED


SQL> archive log list

Database log mode           Archive Mode

Automatic archival           Enabled

Archive destination           /oradata2/primdb/archives

Oldest online log sequence     33

Next log sequence to archive   35

Current log sequence           35

SQL> alter database prepare to switchover to primary;

Database altered.

SQL> select switchover_status from v$database;

SWITCHOVER_STATUS
----------------------------

PREPARING SWITCHOVER


SQL> select switchover_status from v$database;

SWITCHOVER_STATUS

----------------------------

TO PRIMARY


SQL> alter database commit to switchover to primary;

Database altered.


SQL> select switchover_status from v$database;

SWITCHOVER_STATUS

----------------------------

LOG SWITCH GAP


SQL> select open_mode,database_role,name from v$database;

OPEN_MODE         DATABASE_ROLE    NAME

-------------------- ---------------- ---------

READ WRITE         PRIMARY          primdb

SQL> select switchover_status from v$database;

SWITCHOVER_STATUS
----------------------------

LOG SWITCH GAP

SQL> alter system switch logfile;

System altered.

SQL> archive log list

Database log mode           Archive Mode

Automatic archival           Enabled

Archive destination           /oradata2/primdb/archives

Oldest online log sequence     40

Next log sequence to archive   42

Current log sequence           42

SQL> select switchover_status from v$database;

SWITCHOVER_STATUS

----------------------------

TO STANDBY


SQL> select * from scott.t1;

    NO
----------

     4

     3

     1

     2

SQL> insert into scott.t1 values(5);

1 row created.

SQL> commit;

Commit complete.

SQL> select * from scott.t1;

    NO
----------
     4

     3

     1

     2

     5