Sunday 2 April 2017

RMAN Active Duplicate on RAC fails with ORA-17629 and ORA-17627: ORA-12154

RMAN active duplication of RAC database fails on restart operation with the following error messages:

oracle@said$ rman target sys@orcl

Recovery Manager: Release 11.2.0.4.0 - Production on Sun Apr 2 14:19:40 2017

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

target database Password:
connected to target database: ORCL (DBID=209740460)

RMAN> connect auxiliary sys@stdby

auxiliary database Password:
connected to auxiliary database: ORCL (not mounted)

RMAN> duplicate target database for standby from active database;

Starting Duplicate Db at 02-APR-17
using target database control file instead of recovery catalog
allocated channel: ORA_AUX_DISK_1
channel ORA_AUX_DISK_1: SID=1921 instance=ORCL1 device type=DISK

contents of Memory Script:
{
   backup as copy reuse
   targetfile  '/u01/app/oracle/product/11.2.0/db_1/dbs/orapwORCL2' auxiliary format
 '/u01/app/oracle/product/11.2.0/db_1/dbs/orapwORCL1'   ;
}
executing Memory Script

Starting backup at 02-APR-17
allocated channel: ORA_DISK_1
channel ORA_DISK_1: SID=2689 instance=ULTIMUS1 device type=DISK
RMAN-00571: ===========================================================
RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ===============
RMAN-00571: ===========================================================
RMAN-03002: failure of Duplicate Db command at 04/02/2017 14:20:46
RMAN-05501: aborting duplication of target database
RMAN-03015: error occurred in stored script Memory Script
RMAN-03009: failure of backup command on ORA_DISK_1 channel at 04/02/2017 14:20:45
ORA-17629: Cannot connect to the remote database server
ORA-17627: ORA-12154: TNS:could not resolve the connect identifier specified
ORA-17629: Cannot connect to the remote database server

RMAN> exit

Reason:


ORA-12154 is raised whenever the TNS alias is not found on tnsnames.ora

After verification of tnsanames.ora files from both installations on Target and Auxiliary we see all the proper entries are there Still the RMAN duplicate command fails on ORA-12154

The reason for ORA-12154 being raised is because the process is looking for tnsnames.ora in a different ORACLE_HOME on the Auxiliary side.   This different ORACLE_HOME on Auxiliary side is usually the GRID HOME.

On 11G RAC Customers can configure SCAN Listener to handle failover connections on DB and ASM instances.

When RMAN duplicate is executed it needs to shutdown/startup the database several times.  Once the DB is down, a TNS connection can get lost on next startup since the corresponding service associated with the instance is no longer available.  The connection from RMAN thus fails when looking for the tnsnames.ora file under the wrong home.

Resolution:

There are two ways to workaround this problem

1) Copy the tnsnames.ora file form the RDBMS Home to the GRID Home

2) Establish a direct connection instead of using a TNS alias.  For example:

RMAN> connect auxiliary sys/pwd@(DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=myauxiliaryhost)(PORT=1521))(CONNECT_DATA=(SERVER=DEDICATED)(SERVICE_NAME=QRM)(UR=A)))

For Example:

oracle@said$ rman target sys@orcl

Recovery Manager: Release 11.2.0.4.0 - Production on Sun Apr 2 14:21:10 2017

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

target database Password:
connected to target database: ORCL (DBID=209740460)

RMAN> connect auxiliary sys/sys123@(DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=172.17.250.75)(PORT=1599))(CONNECT_DATA=(SERVER=DEDICATED)(SERVICE_NAME=ORCL)))

connected to auxiliary database: ORCL (not mounted)


RMAN> duplicate target database for standby from active database;


Hope this will work for you!!!!!!!


Thursday 30 March 2017

Crerating an OCM Response File for a Grid Infrastructure (GI) Home Prior to Patching

Crerating an OCM Response File for a Grid Infrastructure (GI) Home Prior to Patching
Before applying any patches to the GI home, an ocm.rsp file should be created.  As the GI owner, set the GI environment:

$ export ORACLE_BASE=/u01/app
$ export ORACLE_HOME=$ORACLE_HOME/11.2.0/grid

Create the ocm.rsp file:



grid@said-db-201$ $ORACLE_HOME/OPatch/ocm/bin/emocmrsp

When prompted for an email address, either leave blank or provide an email address.  The file will be created in the directory
from which the above command was executed.

For example, when applying a patch to GI and the patch files have been unzipped to a directory, the opatch command will be executed as follows:

# opatch auto -oh

grid@said-db-201$./opatch auto /orasoft/soft/Patch/Patch/24436338 -ocmrf /export/home/grid/ocm.rsp

When pompted:
OPatch is bundled with OCM, Enter the absolute OCM response file path:

Enter the patch of the ocm.rsp file e.g.
/export/home/grid/ocm.rsp



Reference: http://anotherdatabaseblog.blogspot.com/2011/10/crerating-ocm-response-file-for-gi-home.html

Saturday 25 March 2017

Import Method using IMPDP to apply only incremental rows

Import Method using IMPDP to apply only incremental rows 

Step 1: Take a full backup of emp table

[oracle@oracledb ~]$ expdp system/passwd direcctory=dpump tables=scott.emp dumpfile=emp.dmp logfile=emp.log
LRM-00101: unknown parameter name 'direcctory'

[oracle@oracledb ~]$ expdp system/sys123 directory=dpump tables=scott.emp dumpfile=emp.dmp logfile=emp.log

Export: Release 11.2.0.3.0 - Production on Sat Mar 25 12:11:41 2017

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

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
Starting "SYSTEM"."SYS_EXPORT_TABLE_01":  system/******** directory=dpump tables=scott.emp dumpfile=emp.dmp logfile=emp.log
Estimate in progress using BLOCKS method...
Processing object type TABLE_EXPORT/TABLE/TABLE_DATA
Total estimation using BLOCKS method: 64 KB
Processing object type TABLE_EXPORT/TABLE/TABLE
Processing object type TABLE_EXPORT/TABLE/INDEX/INDEX
Processing object type TABLE_EXPORT/TABLE/CONSTRAINT/CONSTRAINT
Processing object type TABLE_EXPORT/TABLE/CONSTRAINT/REF_CONSTRAINT
. . exported "SCOTT"."EMP"                               8.562 KB      14 rows
Master table "SYSTEM"."SYS_EXPORT_TABLE_01" successfully loaded/unloaded
******************************************************************************
Dump file set for SYSTEM.SYS_EXPORT_TABLE_01 is:
  /u01/emp.dmp
Job "SYSTEM"."SYS_EXPORT_TABLE_01" successfully completed at 12:11:57

SQL> select empno from emp;

     EMPNO
----------
      7369
      7499
      7521
      7566
      7654
      7698
      7782
      7788
      7839
      7844
      7876

     EMPNO
----------
      7900
      7902
      7934

14 rows selected.

Step 2: Now insert one row into EMP table

SQL> insert into emp values(1001,'sirat','MGR','7369',sysdate,1000,null,20);

1 row created.

SQL> commit;

Commit complete.

Step 3: Now take a incremental backup using QUERY and DATA_ONLY parameter in IMPDP command

[oracle@oracledb ~]$ cat data.par
tables=SCOTT.EMP
directory=dpump
DUMPFILE=emp_incre.dmp
logfile=emp_incre.log
query=SCOTT.EMP:"where empno=1001"
content=DATA_ONLY

[oracle@oracledb ~]$

[oracle@oracledb ~]$ expdp system/passwd parfile=data.par

Export: Release 11.2.0.3.0 - Production on Sat Mar 25 21:32:14 2017

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

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
Starting "SYSTEM"."SYS_EXPORT_TABLE_01":  system/******** parfile=data.par
Estimate in progress using BLOCKS method...
Processing object type TABLE_EXPORT/TABLE/TABLE_DATA
Total estimation using BLOCKS method: 64 KB
. . exported "SCOTT"."EMP"                               8.031 KB       1 rows
Master table "SYSTEM"."SYS_EXPORT_TABLE_01" successfully loaded/unloaded
******************************************************************************
Dump file set for SYSTEM.SYS_EXPORT_TABLE_01 is:
  /u01/emp_incre.dmp
Job "SYSTEM"."SYS_EXPORT_TABLE_01" successfully completed at 21:32:16

[oracle@oracledb ~]$


Step 4: Delete one row from emp table

SQL> delete from emp where empno=1001;

1 row deleted.

SQL> commit;

Commit complete.

SQL> select empno from emp;

     EMPNO
----------
      7369
      7499
      7521
      7566
      7654
      7698
      7782
      7788
      7839
      7844
      7876

     EMPNO
----------
      7900
      7902
      7934

14 rows selected.

SQL>


Step 5: Apply incremental backup APPEND option in IMPDP command

[oracle@oracledb ~]$ impdp system/passwd directory=dpump dumpfile=emp_incre.dmp logfile=imp1.log table_exists_action=append

Import: Release 11.2.0.3.0 - Production on Sat Mar 25 21:36:31 2017

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

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
Master table "SYSTEM"."SYS_IMPORT_FULL_01" successfully loaded/unloaded
Starting "SYSTEM"."SYS_IMPORT_FULL_01":  system/******** directory=dpump dumpfile=emp_incre.dmp logfile=imp1.log table_exists_action=append
Processing object type TABLE_EXPORT/TABLE/TABLE_DATA
. . imported "SCOTT"."EMP"                               8.031 KB       1 rows
Job "SYSTEM"."SYS_IMPORT_FULL_01" successfully completed at 21:36:34

[oracle@oracledb ~]$

Now check Data append in emp table or not

SQL> select empno from emp;

     EMPNO
----------
      1001
      7369
      7499
      7521
      7566
      7654
      7698
      7782
      7788
      7839
      7844

     EMPNO
----------
      7876
      7900
      7902
      7934

15 rows selected.

SQL>


Thats it!!!!!!!!!!!!!!!!!!!!!!!!!

Reference :  http://www.acehints.com/2012/05/datapump-impdp-tableexistsaction-append.html