Wednesday, April 3, 2013

DBMS_REDEFINITION Is Good Option For Zero Downtime Environments


Tried DBMS_REDEFINITION for the table structure change activity. This is almost an no downtime activity and was able to succeed. 
Below are the steps done

Except Step 5, all other step can be performed online.


1) Check table can be redefined

EXEC Dbms_Redefinition.Can_Redef_Table('XX', 'XX_ITEM_COST_INT');

PL/SQL procedure successfully completed.

2) Create intermediate table without any constraints and index (change the INITRANS,PCTFREE value as required )

CREATE TABLE "XX"."XX_ITEM_COST_INT_2"
   (    "ODI_RUN_ID" NUMBER,
        "ORG_TYPE" VARCHAR2(10) NOT NULL ENABLE,
        "ORG" VARCHAR2(40) NOT NULL ENABLE,
.
.
   ) PCTFREE 25 PCTUSED 40 INITRANS 15 MAXTRANS 255
  STORAGE(
.
.
COMPRESS FOR OLTP LOGGING
  STORAGE(
  BUFFER_POOL DEFAULT FLASH_CACHE DEFAULT CELL_FLASH_CACHE DEFAULT)
  TABLESPACE "XX_TS_TX_DATA" )  
  Table created.

3) start redefine table:

EXEC Dbms_Redefinition.Start_Redef_Table('XX','XX_ITEM_COST_INT','XX_ITEM_COST_INT_2');

PL/SQL procedure successfully completed.

Elapsed: 00:08:30.85

4) Add Constraints and indexes: (change the INITRANS,PCTFREE value as required )

alter table "XX"."XX_ITEM_COST_INT_2" add
(CONSTRAINT "XX_CST_SCDH_ITEM_COST_PK_2" PRIMARY KEY ("ODI_RUN_ID", "ITEM_NUM","COST_TYPE", "ORG")
USING INDEX PCTFREE 25 INITRANS 15 MAXTRANS 255 COMPUTE STATISTICS
  STORAGE(INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645
  PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1
  BUFFER_POOL DEFAULT FLASH_CACHE DEFAULT CELL_FLASH_CACHE DEFAULT)
  TABLESPACE "XX_TS_TX_DATA");
  
  Table altered.

Elapsed: 00:10:13.45

CREATE INDEX "XX"."XX_CST_SCDH_ITEM_PROCESS_2" ON "XX"."XX_ITEM_COST_INT_2" ("PROCESS_FLAG")
  PCTFREE 25 INITRANS 15 MAXTRANS 255 COMPUTE STATISTICS
  STORAGE(INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645
  PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1
  BUFFER_POOL DEFAULT FLASH_CACHE DEFAULT CELL_FLASH_CACHE DEFAULT)
  TABLESPACE "XX_TS_TX_IDX";
  
Elapsed: 00:03:02.62

  CREATE INDEX "XX"."XX_CST_SCDH_ITEM_PROCESS_2_2" ON "XX"."XX_ITEM_COST_INT_2" ("ITEM_NUM", "ORG")
  PCTFREE 25 INITRANS 15 MAXTRANS 255 COMPUTE STATISTICS
  STORAGE(INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645
  PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1
  BUFFER_POOL DEFAULT FLASH_CACHE DEFAULT CELL_FLASH_CACHE DEFAULT)
  TABLESPACE "XX_TS_TX_IDX"

Elapsed: 00:04:09.39
  

5) Finish the redefinition

new   1: select OWNER,SEGMENT_NAME,sum(BYTES)/1024/1024/1024 from dba_segments where SEGMENT_NAME='XX_ITEM_COST_INT_2' group by OWNER,SEGMENT_NAME
XX
XX_ITEM_COST_INT_2
               1.94921875 –(with new storage clause size got increased)\

new   1: select OWNER,SEGMENT_NAME,sum(BYTES)/1024/1024/1024 from dba_segments where SEGMENT_NAME='XX_ITEM_COST_INT' group by OWNER,SEGMENT_NAME
XX
XX_ITEM_COST_INT
               1.79882813

EXEC Dbms_Redefinition.Finish_Redef_Table( 'XX', 'XX_ITEM_COST_INT', 'XX_ITEM_COST_INT_2');

PL/SQL procedure successfully completed.

new   1: select OWNER,SEGMENT_NAME,sum(BYTES)/1024/1024/1024 from dba_segments where SEGMENT_NAME='XX_ITEM_COST_INT_2' group by OWNER,SEGMENT_NAME
XX
XX_ITEM_COST_INT_2
               1.79882813
new   1: select OWNER,SEGMENT_NAME,sum(BYTES)/1024/1024/1024 from dba_segments where SEGMENT_NAME='XX_ITEM_COST_INT' group by OWNER,SEGMENT_NAME
XX
XX_ITEM_COST_INT –(table got redefined)
               1.94921875

6) Tidy up the work

DROP TABLE XX.XX_ITEM_COST_INT_2;
ALTER TABLE XX.XX_ITEM_COST_INT RENAME CONSTRAINT XX_CST_SCDH_ITEM_COST_PK_2 TO XX_CST_SCDH_ITEM_COST_PK;
ALTER INDEX XX.XX_CST_SCDH_ITEM_PROCESS_2 RENAME TO XX_CST_SCDH_ITEM_PROCESS_IDX1;
ALTER INDEX XX.XX_CST_SCDH_ITEM_PROCESS_2_2 RENAME TO XX_CST_SCDH_ITEM_PROCESS_IDX2;


HAPPY LEARNING!

Tuesday, March 12, 2013

Holistic Approach Of Solving Performance Issues In Oracle Applications 11i/R12

This blogpost explains an holistic approach for isolating performance issues in Oracle Applications 11i/R12.

Oracle Apps DBA's can have a printout of this holistic approach on their desk as a pin-up and remember, this method is not always perfect, please do comment and feel free to add or remove any of the items in the checklist, also letting me know of the improvements or corrections, so that i can make the corrections for my pin-up too :)







HAPPY LEARNING!

Tuesday, January 22, 2013

Oracle Apps R12 - JSP Compiling



Had a R12 vision instance of mine 'AJITHPATHIYIL', and I was trying to upgrade it to 12.1.3, But due to many reasons I was struck up with the upgrade process, and in the meantime, had to test AGILE PLM integration with PIP plugin for Agile on Oracle Apps R12.1.1, So restored my backup and got my old R12 base version in place. But after restore, My jsp's were not getting forwarded and served by the jsp engine, So had to recompile my jsp's and this is how I did that..

To compile the jsp as soon as you access jsp page :

-- Change s_jsp_main_mode in R12 context file (XML file)
  justrun
change it to
  recompile

--- Run Autoconfig (adautocfg.sh)
Autoconfig will update file
$INST_TOP/ora/10.1.3/j2ee/oacore/application-deployments/oacore/html/orion-web.xml
        main_mode
         justrun

.

How to compile JSP manually
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
perl ojspCompile.pl –compile –flush  (Unix)
or
perl ojspCompile.pl –compile –flush -p 2 (Unix where -p means parallel execution)

perl -x ojspCompile.pl –compile –flush (Windows)
ojspCompile.pl is under $FND_TOP/patch/115/bin/

Note* JSP’s are compiled automatically after patching (whenever patch updates one or more jsp it calls ojspCompile.pl to compile JSP)

.
How I Forced JSP Compilation?
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
$ perl ojspCompile.pl --compile --flush -p 2
logfile set: /u01/app/gebs/AJITHLAB.local/apps/AJITHLAB_ausvmqtcdevap04/logs/appl/rgf/ojsp/ojspc_error.log
starting...(compiling all)
using 10i internal ojsp ver: 10
synchronizing dependency file:
  loading deplist...8049
  enumerating jsps...8049
  updating dependency...0
initializing compilation:
  eliminating children...5980 (-2069)
translating and compiling:
  translating jsps...5980/5980 [failed: 3] in 20m59s
  compiling jsps...5977/5977 in 1h22m
Finished!

[applmgr@ajithpathiyil.lab.com:/u01/app/gebs/AJITHLAB/apps/apps_st/appl/fnd/12.0.0/patch/115/bin][AJITHLAB_FORMS]


JSP Compilation logs 
~~~~~~~~~~~~~~~~~~~~~~
In 11i, all jsp compilation errors are logged in $IAS_ORACLE_HOME/ Apache/ Jserv/ logs/ mod_jserv.log
In R12, all jsp compilation errors are logged in $LOG_HOME/ ora/ 10.1.3/ j2ee/ oacore/ oacore_default_group_1/ application.log

Below is the log of my JSP compilation
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

$ cd $AD_TOP
[applmgr@ajithpathiyil.lab.com:/u01/app/gebs/AJITHLAB/apps/apps_st/appl/ad/12.0.0][AJITHLAB_FORMS]
$ ./adchkcfg.sh    ( Remember I am Running adchkcfg.sh for checking the files that would be affected)
-bash: ./adchkcfg.sh: No such file or directory
[applmgr@ajithpathiyil.lab.com:/u01/app/gebs/AJITHLAB/apps/apps_st/appl/ad/12.0.0][AJITHLAB_FORMS]
$ cd bin
[applmgr@ajithpathiyil.lab.com:/u01/app/gebs/AJITHLAB/apps/apps_st/appl/ad/12.0.0/bin][AJITHLAB_FORMS]
$ ./adchkcfg.sh
Enter the full path to the Applications Context file:
/u01/app/gebs/AJITHLAB.local/apps/AJITHLAB_ajithpathiyil01/appl/admin/AJITHLAB_ajithpathiyil01.xml
Enter the APPS password:

The log file for this session is located at: /u01/app/gebs/AJITHLAB.local/apps/AJITHLAB_ajithpathiyil01/admin/log/01211442/adconfig.log

AutoConfig is running in test mode and building diffs...

AutoConfig will consider the custom templates if present.
        Using CONFIG_HOME location     : /u01/app/gebs/AJITHLAB.local/apps/AJITHLAB_ajithpathiyil01
        Classpath                   : /u01/app/gebs/AJITHLAB/apps/apps_st/comn/java/lib/appsborg2.zip:/u01/app/gebs/AJITHLAB/apps/apps_st/comn/java/classes

        Using Context file          : /u01/app/gebs/AJITHLAB.local/apps/AJITHLAB_ajithpathiyil01/admin/out/01211442/AJITHLAB_ajithpathiyil01.xml

Context Value Management will now update the test Context file

        Updating test Context file...COMPLETED

        [ Test mode ]
        No uploading of Context File and its templates to database.

Testing templates from all of the product tops...
        Testing AD_TOP........
          Testing FND_TOP.......COMPLETED
        Testing ICX_TOP.......COMPLETED
        Testing MSC_TOP.......COMPLETED
        Testing IEO_TOP.......COMPLETED
        Testing BIS_TOP.......COMPLETED
        Testing AMS_TOP.......COMPLETED
        Testing CCT_TOP.......COMPLETED
        Testing WSH_TOP.......COMPLETED
        Testing CLN_TOP.......COMPLETED
        Testing OKE_TOP.......COMPLETED
        Testing OKL_TOP.......COMPLETED
        Testing OKS_TOP.......COMPLETED
        Testing CSF_TOP.......COMPLETED
        Testing IGS_TOP.......COMPLETED
        Testing IBY_TOP.......COMPLETED
        Testing JTF_TOP.......COMPLETED
        Testing MWA_TOP.......COMPLETED
        Testing CN_TOP........COMPLETED
        Testing CSI_TOP.......COMPLETED
        Testing WIP_TOP.......COMPLETED
        Testing CSE_TOP.......COMPLETED
        Testing EAM_TOP.......COMPLETED
        Testing FTE_TOP.......COMPLETED
        Testing ONT_TOP.......COMPLETED
        Testing AR_TOP........COMPLETED
        Testing AHL_TOP.......COMPLETED
        Testing OZF_TOP.......COMPLETED
        Testing IES_TOP.......COMPLETED
        Testing CSD_TOP.......COMPLETED
        Testing IGC_TOP.......COMPLETED

Differences text report is located at: /u01/app/gebs/AJITHLAB.local/apps/AJITHLAB_ajithpathiyil01/admin/out/01211442/cfgcheck.txt

        Generating Profile Option differences report...COMPLETED
Differences text report for the Database is located at: /u01/app/gebs/AJITHLAB.local/apps/AJITHLAB_ajithpathiyil01/admin/out/01211442/ProfileReport.txt
        Generating File System differences report......COMPLETED
Differences html report is located at: /u01/app/gebs/AJITHLAB.local/apps/AJITHLAB_ajithpathiyil01/admin/out/01211442/cfgcheck.html

Differences Zip report is located at: /u01/app/gebs/AJITHLAB.local/apps/AJITHLAB_ajithpathiyil01/admin/out/01211442/ADXcfgcheck.zip

AutoConfig completed successfully.
[applmgr@ajithpathiyil.lab.com:/u01/app/gebs/AJITHLAB/apps/apps_st/appl/ad/12.0.0/bin][AJITHLAB_FORMS]
$


The Difference Logs Shows The FIles That Would Change When Autoconfig is Actually Run
*******************/u01/app/gebs/AJITHLAB.local/apps/AJITHLAB_ajithpathiyil01/admin/out/01211442/cfgcheck.txt************************************
Driver: /u01/app/gebs/AJITHLAB/apps/apps_st/appl/ad/12.0.0/admin/driver/adtmpl.drv

  [CHANGED]
    Existing file: /u01/app/gebs/AJITHLAB.local/apps/AJITHLAB_ajithpathiyil01/ora/10.1.3/j2ee/oacore/application-deployments/oacore/html/orion-web.xml
    New file: /u01/app/gebs/AJITHLAB.local/apps/AJITHLAB_ajithpathiyil01/admin/out/01211442/orion-web.xml
    Diff file: /u01/app/gebs/AJITHLAB.local/apps/AJITHLAB_ajithpathiyil01/admin/out/01211442/x_orion-web.xml

    Existing file: /u01/app/gebs/AJITHLAB.local/apps/AJITHLAB_ajithpathiyil01/ora/10.1.3/j2ee/oafm/application-deployments/oafm/webservices/orion-web.xml
    New file: /u01/app/gebs/AJITHLAB.local/apps/AJITHLAB_ajithpathiyil01/admin/out/01211442/orion-web0.xml
    Diff file: /u01/app/gebs/AJITHLAB.local/apps/AJITHLAB_ajithpathiyil01/admin/out/01211442/x_orion-web0.xml


  [NEW]
    Destination file: /u01/app/gebs/AJITHLAB.local/apps/AJITHLAB_ajithpathiyil01/ora/10.1.3/j2ee/oacore/config/system-jazn-data-new.xml

    Destination file: /u01/app/gebs/AJITHLAB.local/apps/AJITHLAB_ajithpathiyil01/ora/10.1.3/j2ee/oafm/config/system-jazn-data-new.xml

    Destination file: /u01/app/gebs/AJITHLAB.local/apps/AJITHLAB_ajithpathiyil01/ora/10.1.3/j2ee/forms/config/system-jazn-data-new.xml

*******************/u01/app/gebs/AJITHLAB.local/apps/AJITHLAB_ajithpathiyil01/admin/out/01211442/cfgcheck.txt************************************


ACTUAL AUTOCONFIG
=====================
$ ./adautocfg.sh
Enter the APPS user password:

The log file for this session is located at: /u01/app/gebs/AJITHLAB.local/apps/AJITHLAB_ajithpathiyil01/admin/log/01211451/adconfig.log

AutoConfig is configuring the Applications environment...

AutoConfig will consider the custom templates if present.
        Using CONFIG_HOME location     : /u01/app/gebs/AJITHLAB.local/apps/AJITHLAB_ajithpathiyil01
        Classpath                   : /u01/app/gebs/AJITHLAB/apps/apps_st/comn/java/lib/appsborg2.zip:/u01/app/gebs/AJITHLAB/apps/apps_st/comn/java/classes

        Using Context file          : /u01/app/gebs/AJITHLAB.local/apps/AJITHLAB_ajithpathiyil01/appl/admin/AJITHLAB_ajithpathiyil01.xml

Context Value Management will now update the Context file

        Updating Context file...COMPLETED

        Attempting upload of Context file and templates to database...COMPLETED

Configuring templates from all of the product tops...
        Configuring AD_TOP........COMPLETED
        Configuring FND_TOP.......COMPLETED
        Configuring ICX_TOP.......COMPLETED
        Configuring MSC_TOP.......COMPLETED
        Configuring IEO_TOP.......COMPLETED
        Configuring BIS_TOP.......COMPLETED
        Configuring AMS_TOP.......COMPLETED
        Configuring CCT_TOP.......COMPLETED
        Configuring WSH_TOP.......COMPLETED
        Configuring CLN_TOP.......COMPLETED
        Configuring OKE_TOP.......COMPLETED
        Configuring OKL_TOP.......COMPLETED
        Configuring OKS_TOP.......COMPLETED
        Configuring CSF_TOP.......COMPLETED
        Configuring IGS_TOP.......COMPLETED
        Configuring IBY_TOP.......COMPLETED
        Configuring JTF_TOP.......COMPLETED
        Configuring MWA_TOP.......COMPLETED
        Configuring CN_TOP........COMPLETED
        Configuring CSI_TOP.......COMPLETED
        Configuring WIP_TOP.......COMPLETED
        Configuring CSE_TOP.......COMPLETED
        Configuring EAM_TOP.......COMPLETED
        Configuring FTE_TOP.......COMPLETED
        Configuring ONT_TOP.......COMPLETED
        Configuring AR_TOP........COMPLETED
        Configuring AHL_TOP.......COMPLETED
        Configuring OZF_TOP.......COMPLETED
        Configuring IES_TOP.......COMPLETED
        Configuring CSD_TOP.......COMPLETED
        Configuring IGC_TOP.......COMPLETED

AutoConfig completed successfully.
[applmgr@ajithpathiyil.lab.com:/u01/app/gebs/AJITHLAB.local/apps/AJITHLAB_ajithpathiyil01/admin/scripts][AJITHLAB_FORMS]
$


HAPPY LEARNING!