Blog dedicated to Oracle Applications (E-Business Suite) Technology; covers Apps Architecture, Administration and third party bolt-ons to Apps

Tuesday, November 13, 2007

Backout an apps patch

Oracle documentation tells us that there is no way to backout a patch other than restoring from backup. With Apps databases growing in terabyte space, it is not practical to restore a backup. Logically speaking, if you can apply a patch, then you should be able to backout a patch too. Patches which replace a few forms or java classes, it is easy to backout with the help of the backup directory created by every patch which has the backup of files which were replaced by the patch. The problem comes when its database objects. Typically a patch will create new objects, modify existing objects, even drop some existing objects. Theoretically, you could drop the new objects, reverse the modifications and recreate the dropped objects. However to do all this, you need to understand what the patch does in the first place. To understand this you should open the driver file in a text editor. Let us take patch 6143275 which has u driver u6143275.drv. The driver file has 5474 lines. Till line 1870 there are lot of begin bug and end bug constructs similar to this one:

begin bug ar 6002847
begin actions
end actions
end bug ar 6002847

From line 1870 copy action starts:

#=================================#
# Actions for Copying Patch Files #
#=================================#

copy ad admin/driver adf01.drv 115.0
copy ad admin/driver adf02.drv 115.0
copy ad admin/driver adf03.drv 115.52

Some other actions are:

libin ad lib aifvaf.o
libout ad lib adifo.o
jcopy j6143275_fnd.zip
link ad bin adadmin
link ad bin adadmin_wrapper


#=======================================#
# Actions for Applying Database Objects #
#=======================================#
These are the phases in applying DB objects:
appwms76@tsgsd1004 # grep Phase u6143275.drv
# Phase FIRST - First phase, runs before all others
# Phase CON - Disable constraints, foreign keys
# Phase SEQ - Create Sequences
# Phase TAB - Create Tables and Indexes
# Phase TBM - Alter table in ways not supported by ODF
# Phase PLS - Create Package Specifications
# Phase VW - Create Views
# Phase PLB - Create Package Bodies
# Phase DAA - AOL Seed Data
# Phase DAT - non-AOL Seed Data
# Phase UPG - non-AOL Transaction Data
# Phase DFR - Create deferred indexes
# Phase EN - Enable constraints, create triggers
# Phase LAST - Last phase, runs after all others
# Phase NOEXEC - These files are intentionally not executed.

#
# Phase FIRST - First phase, runs before all others
#

# file-version-parsed ad ati adsysapp2.sql 115.2
sql admin top adsysapp2.sql none none none sqlplus_driver &phase=first checkfile:nocheck &systempwd

#
# Phase CON - Disable constraints, foreign keys
#

# file-version-parsed ad patch/115/sql adgrnctx4.sql 115.7
sql ad patch/115/sql adgrnctx4.sql none none none sqlplus &phase=con checkfile:ad:patch/115/sql:adgrnctx4.sql:ICX &systempwd &un_fnd CTXSYS &un_icx ICX


#
# Phase SEQ - Create Sequences
#

# file-version-parsed ad patch/115/odf adphst.odf 115.26
exec ad patch/115/odf adphst.odf odf &phase=seq checkfile:ad:patch/115/odf:adphst.odf:seq_sequences mode=sequences


#
# Phase TAB - Create Tables and Indexes
#

# file-version-parsed ad patch/115/odf adconc.odf 115.3
exec ad patch/115/odf adconc.odf odf &phase=tab checkfile:ad:patch/115/odf:adconc.odf:tab_tables mode=tables

# file-version-parsed ar patch/115/xdf ar_line_rev_adj_gt.xdf 115.0
exec java oracle/apps/fnd/odf2 FndXdfCmp.class java &phase=tab checkfile:ar:patch/115/xdf:ar_line_rev_adj_gt.xdf:tab_table &un_ar &pw_ar &un_apps &pw_apps &jdbc_protocol &jdbc_db_addr table &fullpath_ar_patch/115/xdf_ar_line_rev_adj_gt.
xdf &fullpath_fnd_patch/115/xdf_xsl

#
# Phase TBM - Alter table in ways not supported by ODF
#

# file-version-parsed ad patch/115/sql adphtm1g.sql 115.0
sql ad patch/115/sql adphtm1g.sql none none none sql_owner &phase=tbm &un_apps &pw_apps &un_fnd

#
# Phase PLS - Create Package Specifications
#

# file-version-parsed ad patch/115/sql adawld9is.pls 115.0
sql ad patch/115/sql adawld9is.pls MVIEW_RECOMMENDATIONS SYSTEM &systempwd sqlplus &phase=pls

# file-version-parsed ad patch/115/sql adcslcks.pls 115.2
sql ad patch/115/sql adcslcks.pls none none none package &phase=pls checkfile:ad:patch/115/sql:adcslcks.pls

#
# Phase VW - Create Views
#

# file-version-parsed ar patch/115/odf arcar.odf 115.16
exec ar patch/115/odf arcar.odf odf &phase=vw checkfile:ar:patch/115/odf:arcar.odf:vw_views mode=views

# file-version-parsed ar patch/115/odf ardt.odf 115.5
exec ar patch/115/odf ardt.odf odf &phase=vw checkfile:ar:patch/115/odf:ardt.odf:vw_views mode=views

#
# Phase PLB - Create Package Bodies
#

# file-version-parsed ad patch/115/sql adawld9ib.pls 115.5
sql ad patch/115/sql adawld9ib.pls MVIEW_RECOMMENDATIONS SYSTEM &systempwd sqlplus &phase=plb

# file-version-parsed ad patch/115/sql adcslckb.pls 115.3
sql ad patch/115/sql adcslckb.pls none none none package &phase=plb checkfile:ad:patch/115/sql:adcslckb.pls

# file-version-parsed ad patch/115/sql adddb.pls 115.9
sql ad patch/115/sql adddb.pls none none none package &phase=plb checkfile:ad:patch/115/sql:adddb.pls

#
# Phase DAA - AOL Seed Data
#

# file-version-parsed ar patch/115/xml/US arwfengs.wfx 115.1
exec java oracle/apps/fnd/wf WFXLoad.class java &phase=daa+39 checkfile:ar:patch/115/xml/US:arwfengs.wfx -u &un_apps &pw_apps &jdbc_db_addr &jdbc_protocol US &fullpath_ar_patch/115/xml/US_arwfengs.wfx

# file-version-parsed ar patch/115/import/US arnlu.ldt 115.4
exec fnd bin FNDLOAD bin &phase=daa+51 checkfile:ar:patch/115/import/US:arnlu.ldt &ui_apps 0 Y UPLOAD @FND:patc
h/115/import/aflvmlu.lct @AR:patch/115/import/US/arnlu.ldt

#
# Phase DAT - non-AOL Seed Data
#

# file-version-parsed ar patch/115/import/US b3966132ca.ldt 115.1
exec fnd bin FNDLOAD bin &phase=dat checkfile:ar:patch/115/import/US:b3966132ca.ldt &ui_apps 0 Y UPLOAD @AR:patch/115/import/ararca.lct @AR:patch/115/import/US/b3966132ca.ldt

#
# Phase UPG - non-AOL Transaction Data
#

# file-version-parsed ad patch/115/sql adasnupd3.sql 115.0
sql ad patch/115/sql adasnupd3.sql none none none sqlplus &phase=upg checkfile:ad:patch/115/sql:adasnupd3.sql &un_fnd


# file-version-parsed ad patch/115/sql adphenup.sql 115.5
sql ad patch/115/sql adphenup.sql none none none sqlplus &phase=upg checkfile:ad:patch/115/sql:adphenup.sql &un_fnd

#
# Phase DFR - Create deferred indexes
#

# file-version-parsed ad patch/115/odf adphst.odf 115.26
exec ad patch/115/odf adphst.odf odf &phase=dfr checkfile:ad:patch/115/odf:adphst.odf:dfr_tables mode=tables

# file-version-parsed ar patch/115/odf arcar.odf 115.16
exec ar patch/115/odf arcar.odf odf &phase=dfr checkfile:ar:patch/115/odf:arcar.odf:dfr_views mode=views

#
# Phase EN - Enable constraints, create triggers
#

# file-version-parsed ar patch/115/sql arpltgld.sql 115.13.15103.1
sql ar patch/115/sql arpltgld.sql none none none sqlplus &phase=en checkfile:ar:patch/115/sql:arpltgld.sql

#
# Phase LAST - Last phase, runs after all others
#

# file-version-parsed ad patch/115/sql adcf1151.sql 115.7
sql ad patch/115/sql adcf1151.sql none none none sqlplus &phase=last checkfile:ad:patch/115/sql:adcf1151.sql &un_fnd


# file-version-parsed ad patch/115/sql adcf1152.sql 115.7
sql ad patch/115/sql adcf1152.sql none none none sqlplus &phase=last checkfile:ad:patch/115/sql:adcf1152.sql &un_fnd

#
# Phase NOEXEC - These files are intentionally not executed.
#

# file-version-parsed ad admin/sql adaaddlb.pls 115.6
# noexec ad admin/sql adaaddlb.pls

# file-version-parsed ad admin/sql adaaddls.pls 115.7
# noexec ad admin/sql adaaddls.pls

#========================================#
# Actions for Generating Dependent Files #
#========================================#

genform ar forms/US ARBRREMI.fmb
genform ar forms/US ARHDATTR.fmb
genform ar forms/US ARXAIEXP.fmb
genform ar forms/US ARXCOECC.fmb
genform ar forms/US ARXCOQIL.fmb

If you can manually undo each of the above steps, you can backout of an apps patch.

1 comment:

杨佳 said...

hi, I just encounter a problem when applying a patch.
I am wondering how can I backout the '# Phase UPG - non-AOL Transaction Data' part of adpatch.

Should I just copy the original copy to it's corresponding destination.

Looking forward to your reply.