apex export & deploy giovanni chierico gs-ais-hr 06-may-2014 apex export & deploy

18

Upload: brianne-price

Post on 11-Jan-2016

216 views

Category:

Documents


1 download

TRANSCRIPT

Page 1: APEX Export & Deploy Giovanni CHIERICO GS-AIS-HR 06-May-2014 APEX Export & Deploy
Page 2: APEX Export & Deploy Giovanni CHIERICO GS-AIS-HR 06-May-2014 APEX Export & Deploy

APEX Export & Deploy

APEX Export & Deploy

Giovanni CHIERICO

GS-AIS-HR

06-May-2014

Page 3: APEX Export & Deploy Giovanni CHIERICO GS-AIS-HR 06-May-2014 APEX Export & Deploy

APEX Export & Deploy

APEX AnatomyAn APEX application is usually composed of• The Core APEX application

• Stored as Oracle’s proprietary metadata in APEX schemas

• The DB objects• Stored in the application own schema(s)

• Extra Objects• CSS, Images, …• Stored as APEX files (in DB)

06-May-2014

Page 4: APEX Export & Deploy Giovanni CHIERICO GS-AIS-HR 06-May-2014 APEX Export & Deploy

APEX Export & Deploy

The Problems• Dependencies between core app, extra files

and DB objects. Must keep them aligned.• Application source control• Deployment across instances

06-May-2014

Page 5: APEX Export & Deploy Giovanni CHIERICO GS-AIS-HR 06-May-2014 APEX Export & Deploy

APEX Export & Deploy

Baseline solution• Manual exports / imports• Manual port of differences

Problems• Error prone• Time consuming• Painful

Might work for minimal application (e.g. one developer, changes always in prod!, extra dependencies never change, …)

06-May-2014

Page 6: APEX Export & Deploy Giovanni CHIERICO GS-AIS-HR 06-May-2014 APEX Export & Deploy

APEX Export & Deploy

First Solution• APEXExport: Oracle’s own supported java “dot

class” utility to export APEX core application as a SQL file

• Issues• Not very user friendly• Exported files are not “diff” friendly because they contain

lots of variable IDs• Business “code” (items, processes) often split and

mangled• Does not contain extra files (CSS, …)• Knows nothing about DB dependencies

06-May-2014

Page 7: APEX Export & Deploy Giovanni CHIERICO GS-AIS-HR 06-May-2014 APEX Export & Deploy

APEX Export & Deploy

Slightly Better SolutionI’ve built my own export utility over the years

What it does• Uses Oracle’s own APEXExport to get the core application export• Exports extra application files

• Included into the core export SQL• Exported as actual files in the file system

• Create extra version of export with masked “noise” (timestamps, IDs, …)

• Joins “business code”into readable and “diff”-able text• Looks for DB objects in such “business code” and exports them

Still far away from proper solution, but usually “good enough”

06-May-2014

Page 8: APEX Export & Deploy Giovanni CHIERICO GS-AIS-HR 06-May-2014 APEX Export & Deploy

APEX Export & Deploy

Linking a file to an Application

06-May-2014

Page 9: APEX Export & Deploy Giovanni CHIERICO GS-AIS-HR 06-May-2014 APEX Export & Deploy

APEX Export & Deploy

Why is it better?• Can compare applications across instances

where IDs differ• Reduces deployment risks since all the extra

files (except DB’s) are bundled with the export script (and imported in one single operation)

• Consistent export paths to avoid conflicts• Promotes common practices among

developers

06-May-2014

Page 10: APEX Export & Deploy Giovanni CHIERICO GS-AIS-HR 06-May-2014 APEX Export & Deploy

APEX Export & Deploy

How does it look like?Executable jar

C:\Dev\application\appExporter>java -jar AppExporter-latest.jar

-apex VAL : SQL-LIKE pattern to specify what APEX applications to export. Use * instead of %, e.g. -apex "*MYAPPS*"

-apexIncludeAppFiles : include in the export the files linked to the application

-apexRoot VAL : path to export APEX root directory, e.g. C:\work\apex-export\

-db VAL : SQL-LIKE pattern to specify what objects to export. Use * instead of %, e.g. -db *MYOBJS*

-dbRoot VAL : path to export DB root directory, e.g. C:\work\db-export\

-schema VAL : DB schema to connect to: schema@dbname. dbname must be present in TNS entries and is case-sensitive

-tns VAL : path to directory with tns entries file tnsnames.ora, e.g. G:\Applications\Oracle\ADMIN\

-tortoise VAL : location of TortoiseProc.exe, e.g. "C:\Progs\TortoiseSVN\bin\TortoiseProc.exe"

-zeroSequences : override sequence current value, in order to avoid trivial differences in exports

06-May-2014

Page 11: APEX Export & Deploy Giovanni CHIERICO GS-AIS-HR 06-May-2014 APEX Export & Deploy

APEX Export & Deploy

Simple UsageCreate export.bat file for common default, e.g.

java -jar ./AppExporter-latest.jar -tns G:\Applications\Oracle\ADMIN_localhost\ -dbRoot C:\Dev\svn\exportDb\ -apexRoot C:\Dev\svn\exportApex\ -apexIncludeAppFiles -zeroSequences -tortoise "C:\Program Files\TortoiseSVN\bin\TortoiseProc.exe" %*

06-May-2014

Page 12: APEX Export & Deploy Giovanni CHIERICO GS-AIS-HR 06-May-2014 APEX Export & Deploy

APEX Export & Deploy

Readable Logic

06-May-2014

Page 13: APEX Export & Deploy Giovanni CHIERICO GS-AIS-HR 06-May-2014 APEX Export & Deploy

APEX Export & Deploy

Reduced Noise

06-May-2014

Page 14: APEX Export & Deploy Giovanni CHIERICO GS-AIS-HR 06-May-2014 APEX Export & Deploy

APEX Export & Deploy

Structured Export

06-May-2014

Page 15: APEX Export & Deploy Giovanni CHIERICO GS-AIS-HR 06-May-2014 APEX Export & Deploy

APEX Export & Deploy

Structured DB dependencies

06-May-2014

Page 16: APEX Export & Deploy Giovanni CHIERICO GS-AIS-HR 06-May-2014 APEX Export & Deploy

APEX Export & Deploy

Want to use this?• Contact me: [email protected]• The executable JAR currently bundles

Oracle’s ojdbc … will probably have to remove it …

06-May-2014

Page 17: APEX Export & Deploy Giovanni CHIERICO GS-AIS-HR 06-May-2014 APEX Export & Deploy

APEX Export & Deploy

Q&A

?06-May-2014

Page 18: APEX Export & Deploy Giovanni CHIERICO GS-AIS-HR 06-May-2014 APEX Export & Deploy