Search Blog Post

Sunday, March 16, 2014

ORA-39083: Object type INDEX failed to create with error:

Problem:
Recently while trying to import one schema from production database to our test environment, I had this error while trying to create an Index.
ORA-39083: Object type INDEX failed to create with error:
The steps I followed to export/import the schema were:
 On Source System:
  • Creating a directory object on source system, grant read and write to directory.
  • Starting the export
 $ expdp system/manager schemas=DWHS  directory=dmpdir dumpfile=DWHS_schema.dmp logfile=expdp_DWHS.log
  • Starting the import 
 $ nohup impdp system/manager schemas= DWHWHS  directory=dmpdir dumpfile=DWHS_schema.dmp logfile=impdp_DWHS.log remap_schema=DWHS: DWHWHS remap_tablespace=DMD:DMD &
  •   Crosscheck the total number of objects in source and target system.
SQL> Select count(*) from dba_objects where owner='DWHS';
  COUNT(*)
----------
       841
SQL> Select count(*) from dba_objects where owner='DWHWHS';
  COUNT(*)
----------
       627
SQL> Select owner,object_type,count(1) from dba_objects where owner='DWHS' group by owner,object_type;
OWNER                          OBJECT_TYPE           COUNT(1)
------------------------------ ------------------- ----------
DWHS                           TABLE                      400
DWHS                           VIEW                        48
DWHS                           PACKAGE                      5
DWHS                           SEQUENCE                     6
DWHS                           PROCEDURE                    8
DWHS                           TRIGGER                      1
DWHS                           INDEX                      342
DWHS                           SYNONYM                     12
DWHS                           FUNCTION                     5
DWHS                           PACKAGE BODY                 5
DWHS                           DATABASE LINK                9
SQL> Select owner,object_type,count(1) from dba_objects where owner='DWHWHS' group by owner,object_type;
OWNER                          OBJECT_TYPE           COUNT(1)
------------------------------ ------------------- ----------
DWHWHS                         FUNCTION                     5
DWHWHS                         SEQUENCE                     6
DWHWHS                         PROCEDURE                    8
DWHWHS                         VIEW                        48
DWHWHS                         INDEX                      129
DWHWHS                         TRIGGER                      1
DWHWHS                         PACKAGE                      5
DWHWHS                         PACKAGE BODY                 5
DWHWHS                         DATABASE LINK                8
DWHWHS                         TABLE                      400
DWHWHS                         SYNONYM                     12
I can clearly see that a major number of indexes were not imported, than to dig further I looked in the log file generated by the import command.And there you go, two many errors saying index failed to create.
Processing object type SCHEMA_EXPORT/TABLE/INDEX/INDEX
ORA-39083: Object type INDEX failed to create with error:

Cause:
The reason these indexes are not being created is because the base object - table - exists.

Workaround:
  • I would recommend to import the dump file by excluding the indexes and later you can import the indexes from the dump file.
  • Even you can set table_exists_action clause to skip, truncate, or append, none of the dependent objects are created if the base objects already exists and is included in the data pump job. This includes indexes as well 
  • In my case, I used append options which actually imports the data, but not the indexes
$ impdp system/manager directory=dmpdir dumpfile=DWHS_schema.dmp TABLE_EXISTS_ACTION=APPEND INCLUDE=INDEX logfile=impdp_DWHS1.log remap_schema=DWHS:DWHWHS
  • When you say include=index, that is all that is included. Nothing else. No tables, no data, nothing. This is why you don't see any data being loaded. In fact, that table_exists_action=append doesn't do anything since data is not being loaded.
  • If that doesn't work you can also use exclude, instead of using include. You know that you already have the tables, so if you just exclude the tables, you will get the data and the indexes.
$ impdp system/manager directory=dmpdir dumpfile=DWHS_schema.dmp logfile=impdp_DWHS1.log EXCLUDE=TABLE/TABLE remap_schema=DWHS:DWHWHS
  • You don't want to just say exclude=table because this will exclude all objets with TABLE in them.
HTH
Thanks for reading.

Saturday, March 15, 2014

adstrtal.sh: Database connection could not be established. Either the database is down or the APPS credentials supplied are wrong

Problem:
While trying to start application on middle tier, I was getting below error: $ ./adstrtal.sh apps/<apps password>
adstrtal.sh version 115.19
adstrtal.sh: Database connection could not be established. Either the database is down or the APPS credentials supplied are wrong.
USAGE:  adstrtal.sh <appsusername/appspassword>
adstrtal.sh: exiting with status 1


Cause:  
  • The database listener may not be up and running and please check if you can connect to the database remotely as apps/apps.
  • Also, check is the apps password is correct 
  • Please make sure you source the Correct environment file before using adstrtal.sh
Possibilities:
In our case, both the database and listener were running fine. So, it might be something else which is not letting us start the applications.
I invoked APPSORA.env to set the environment, and tried to start application again but all in vain still the same issue.

Now, when I'm trying to connect to database from CM node via SQL*Plus .. I got ORA-12545 error
 $ sqlplus
SQL*Plus: Release 8.0.6.0.0 - Production on Sat Mar 15 08:25:58 2014
(c) Copyright 1999 Oracle Corporation.  All rights reserved.
Enter user-name: apps
ERROR:
ORA-12545: Connect failed because target host or object does not exist


Alright, it seems easier to troubleshoot now as we know 

ORA-12545 is a generic error as a result of TNS configuration issue at client.

TNS configuration issue is unable to resolve host / IP specified in TNS entry
We can analyze what exactly is wrong by performing below steps
1. ping  <DB_HOST/IP>
2. telnet <DB_HOST/IP> <PORT>
3. tnsping <TNS_Alias/SID>
4. sqlplus apps@<TNS_Alias>/<apps_password>
Checks 1 and 2 were  successful when ORA-12545 is faced, but 3 and 4 were not working and making them successful will resolve the error.

Solution:
I would recommend you to follow the below steps to overcome the issue. 
  • Bounce or reload listener on DB node
  • Check if all services are down on application node, no process should be running. 
  • Run cmclean -- on Concurrent Processing node - CMCLEAN.SQL - Non Destructive Script to Clean Concurrent Manager Tables [ID 134007.1] 
  • Run autoconfig on db tier -- make sure it completes successfully. 
  • Run autoconfig on all apps tier -- make sure it completes successfully. 
  • Now, try to start applications on middle tier.

                   ++++++++++++++XXXXX+++++++++++++++
Please see the following docs, if the above fix doesn't work.
R12: "adstrtal.sh: Database connection could not be established" Error When Running Script adstrtal.sh and adstpall.sh [ID 1492611.1]
R12 Adstrtal.sh Fails with "Database Connection Could Not Be Established error starting all services on the target" [ID 1499837.1]

HTH
Thanks for reading.

Friday, March 14, 2014

Applying Hot Patch in Oracle EBS

Recently I was told to apply a one-off patch during the peak business hours. Though Oracle recommended approach is to apply all patches "cold"{Shutting down the applications and enable maintenance mode before applying the patch}

You must check README file of all the patches, if it states that there is no need to bring down application services than you can use hotpatch option.
Also, for all the major patch (like AD/FND/ATG) you need to shutdown the application services. And, if you are on Windows you will have to shutdown the application services otherwise the relinking would fail.


So before we begin applying hot patch, let me tell you about defaults file and why do we use it.

Patching in NON-interactive mode
  • Instead of responding to the adpatch prompts, you can create a file which keeps the adpatch responses. In this case you don't have to asnswer to the adpatch prompt and because of this the down time is smaller. The file thus created is called as a defaults file

 Create the response file (the defaultsfile file) 

  •  adpatch defaultsfile=$APPL_TOP/admin/$SID/defaults.txt
  • When AutoPatch ask you for the location of the patch type abort and <ENTER>. 

$ adpatch defaultsfile=$APPL_TOP/admin/TRCDEV/defaults_0312.txt

                     Copyright (c) 2002 Oracle Corporation
                        Redwood Shores, California, USA

                         Oracle Applications AutoPatch

                                 Version 11.5.0

NOTE: You may not use this utility for custom development
      unless you have written permission from Oracle Corporation.

Attention: AutoPatch no longer checks for unapplied pre-requisite patches.
You must use OAM Patch Wizard for this feature. Alternatively, you can
review the README for pre-requisite information.

Your default directory is '/mnt/DEVapps/trcappl'.
Is this the correct APPL_TOP [Yes] ?

AutoPatch records your AutoPatch session in a text file
you specify.  Enter your AutoPatch log file name or press [Return]
to accept the default file name shown in brackets.

Filename [adpatch.log] :

Defaults Feature Enabled = YES.

You can be notified by email if a failure occurs.
Do you wish to activate this feature [No] ?

Please enter the batchsize [1000] :

Please enter the name of the Oracle Applications System that this
APPL_TOP belongs to.

The Applications System name must be unique across all Oracle
Applications Systems at your site, must be from 1 to 30 characters
long, may only contain alphanumeric and underscore characters,
and must start with a letter.

Sample Applications System names are: "prod", "test", "demo" and
"Development_2".

Applications System Name [TRCDEV] : TRCDEV *

NOTE: If you do not currently have certain types of files installed
in this APPL_TOP, you may not be able to perform certain tasks.

Example 1: If you don't have files used for installing or upgrading
the database installed in this area, you cannot install or upgrade
the database from this APPL_TOP.

Example 2: If you don't have forms files installed in this area, you cannot
generate them or run them from this APPL_TOP.

Example 3: If you don't have concurrent program files installed in this area,
you cannot relink concurrent programs or generate reports from this APPL_TOP.

Do you currently have files used for installing or upgrading the database
installed in this APPL_TOP [YES] ? YES *

Do you currently have Java and HTML files for HTML-based functionality
installed in this APPL_TOP [YES] ? YES *

Do you currently have Oracle Applications forms files installed
in this APPL_TOP [YES] ? YES *

Do you currently have concurrent program files installed
in this APPL_TOP [YES] ? YES *

Please enter the name Oracle Applications will use to identify this APPL_TOP.

The APPL_TOP name you select must be unique within an Oracle Applications
System, must be from 1 to 30 characters long, may only contain
alphanumeric and underscore characters, and must start with a letter.

Sample APPL_TOP Names are: "prod_all", "demo3_forms2", and "forms1".

APPL_TOP Name [gddevap1] : gddevap1 *

You are about to apply a patch to the installation of Oracle Applications
in your ORACLE database 'TRCDEV'
using ORACLE executables in '/mnt/DEVapps/trcora/806'.

Is this the correct database [Yes] ?

AutoPatch needs the password for your 'SYSTEM' ORACLE schema
in order to determine your installation configuration.

Enter the password for your 'SYSTEM' ORACLE schema:

The ORACLE username specified below for Application Object Library
uniquely identifies your existing product group: APPLSYS

Enter the ORACLE password of Application Object Library [APPS] :

AutoPatch is verifying your username/password.
The status of various features in this run of AutoPatch is:

                                           <-Feature version in->
Feature                          Active?   APPLTOP    Data model    Flags
------------------------------   -------   --------   -----------   -----------
CHECKFILE                        Yes       1          1             Y N N Y N Y
PREREQ                           Yes       6          6             Y N N Y N Y
CONCURRENT_SESSIONS              No        2          2             Y Y N Y Y N
PATCH_TIMING                     Yes       2          2             Y N N Y N Y
PATCH_HIST_IN_DB                 Yes       6          6             Y N N Y N Y
SCHEMA_SWAP                      Yes       1          1             Y N N Y Y Y

Identifier for the current session is 3835

Reading product information from file...

Reading language and territory information from file...

Reading language information from applUS.txt ...

Reading database to see what industry is currently installed.

Reading FND_LANGUAGES to see what is currently installed.
Currently, the following language is installed:

Code   Language                                Status
----   --------------------------------------- ---------
US     American English                        Base

Your base language will be AMERICAN.

Setting up module information.
Reading database for information about the modules.
Saving module information.
Reading database for information about the products.
Reading database for information about how products depend on each other.
Reading topfile.txt ...

Saving product information.

AD code level : [11i.AD.I.7]

Trying to obtain a lock...

Attempting to instantiate the current-view snapshot...

Instantiated bug-fix info from baseline info.

Enter the directory where your Oracle Applications patch has been unloaded

The default directory is [/mnt/DEVapps/patches/10179153] : abort    + ENTER     !!!!!



  •   Verify that the defaults file exists in APPL_TOP/admin/<SID> directory:

Now we can apply patch by itself using defaults file, adpatch will pick APP_TOP, ORACLE_HOME information, system password and apps password from defaults file.

This way you can reduce your patch timing using defaults file .
Now, let see the following option when calling adpatch for applying a hot fix:
options=hotpatch 

$ adpatch defaultsfile==$APPL_TOP/admin/TRCDEV/defaults_0312.txt logfile=all_10179153.log \
patchtop=/mnt/DEVapps/patches/10179153 \
driver=u10179153.drv \
workers=8 \
interactive=yes \
options=novalidate,hotpatch

HTH
Thanks for reading.