Oracle DBA Tips Corner |
|
Installing Oracle Application Express 2.0
by Jeff Hunter, Sr. Database Administrator
Contents
Overview
Installing Oracle Application Express is a two step process:
For the purpose of this article, I will be installing Oracle Application
Express 2.0 to a machine that already
contains an Oracle10g R2 Database installation. This database server
also contains an Oracle10g R2 database named TESTDB which will
be used to store the database objects required by Oracle Application Express.
The following table illustrates the current
Oracle configuration and components already installed on this machine:
The Oracle HTTP Server cannot be installed into an existing Oracle Home. It
must be installed into a new Oracle Home!
Prerequisites for the Installation
Verify that the file system that contains the Oracle home directory contains
at least 460MB of free disk space for the installation. Also during the installation
process, about 110MB of temporary disk space will be required.
Oracle Application Express requires the shared_pool_size of the
target database to be at least 100 MB.
Determine the current value of the shared_pool_size parameter:
You can view the number of JOB_QUEUE_PROCESSES from SQL*Plus by
running the following SQL statement:
Oracle XML DB must be installed in the Oracle database that you want to
use. If you are using a preconfigured database created either during
an installation or by Database Configuration Assistant (DBCA),
Oracle XML DB should already be installed and configured.
Installing Oracle HTTP Server
The Oracle HTTP Server uses the mod_plsql extension module to communicate
to the Oracle Application Express engine within the Oracle database. Extension
modules like mod_plsql are special pieces of code that can be added to
the Oracle HTTP Server to extend its functionality. The Oracle HTTP Server loads
the mod_plsql extension module when it starts and acts as the broker for
communicating information between the web server and the Oracle Application Express
objects in the Oracle database.
The following example demonstrates the lifecycle of a typical request in Oracle Application Express:
This section assumes you have access to and will be installing the Oracle HTTP Server from
the Oracle10g Release 2 Companion CD. Note that with a few minor modifications, you
can also install an earlier version of the Oracle HTTP Server from
the Oracle10g Release 1 Companion CD. You can perform the install from the CD or download
it from Oracle Technology Network (OTN):
http://www.oracle.com/technology/software/products/database/oracle10g/index.html
After downloading and unzipping the Oracle10g Release 2 Companion CD software to a temporary
directory, follow the instructions below to install the Oracle HTTP Server:
Click [Next] to continue.
Linux / Unix Users:
Windows Users:
OPMN runs as a background process and periodically checks the health of all OAS
components. If OPMN detects a component has been abruptly shutdown, it will attempt
to restart it. It is also the interface used to manually start, stop and restart OAS
components, like the Oracle HTTP Server.
Although not a complete list, the following are some of the more useful
commands used to start, stop and restart the Oracle HTTP Server:
Installing Oracle Application Express
Note that the version of HTML DB shipped on the Oracle10g
Release 2 Companion CD is version 1.6. With Oracle10g Release
1, the version of HTML DB is 1.5.
The download site for Oracle Application Express 2.0 can be found
at the following location:
From the "Download Oracle Application Express (formerly HTML DB)"
page, select the operating system where Oracle Application Express will
be installed, and then locate the download link for
"Oracle Application Express (formerly HTML DB) v2.0".
The download file from Oracle will be named htmldb_2.0.zip. Place this file
in a temporary directory (i.e. /u01/app/oracle/apex_temp) and unzip it:
I generally create a 100MB tablespace named APEX20 using a uniform extent
size of 64K. Be careful not to set the extent size too high. There are over
600 objects created for Oracle Application Express and disk requirements
can quickly increase.
During the Oracle Application Express install process, three schemas
will be created. A description of each of these schemas is provided
in the following table:
Run the utlrp.sql script from the Oracle Database home:
The files will need to be copied to the $ORACLE_HOME/Apache/Apache/images directory as
illustrated in the following examples:
Linux / Unix Users:
Windows Users:
The following is an example of my dads.conf configuration file used for this
article:
For a complete description of each of the parameters used in the dads.conf
configuration file, read through the file dads.README located in the
same directory. The following table provides a brief description of the
key parameters:
All connections coming from an Oracle
Application Express application, regardless of their
login id and password, will be connected to the database
with this username. This even includes applications that
use a different parsing schema! Consider an application that
uses a parsing schema of DEV_WS. The session user
will be HTMLDB_PUBLIC_USER but the Current User
will be set to DEV_WS:
Run the dadTool.pl utility as follows:
Linux / Unix Users:
Windows Users:
There are two primary URLs that can be used to test connectivity:
Further Reading
All articles, scripts and material located at the Internet address of http://www.idevelopment.info is the copyright of Jeffrey M. Hunter
and is protected under copyright laws of the United States. This document may not be hosted on any other site without my express,
prior, written permission. Application to host any of the material elsewhere can be made by contacting me at jhunter@idevelopment.info.
I have made every effort and taken great care in making sure that the material included on my web site is technically accurate,
but I disclaim any and all responsibility for any loss, damage or destruction of data or any other property which may arise from
relying on it. I will in no case be liable for any monetary damages arising from such loss, damage or destruction.
This article provides instructions for installing
and configuring the Oracle Application Express (formerly HTML DB) software
release 2.0. Please note that these instructions cover the
standalone version only.
Current Oracle Configuration and Components
Machine Name:
linux3.idevelopment.info
Operating System:
Red Hat Linux 3 - (CentOS 3.4)
Oracle Release:
Oracle10g Release 2 - (10.2.0.2.0)
Oracle Database ORACLE_HOME:
/u01/app/oracle/product/10.2.0/db_1
Oracle SID:
TESTDB
Instance Service Names:
TESTDB.IDEVELOPMENT.INFO
When installing Oracle Application Express, you will be required to install
the Oracle HTTP Server which can be found on the Oracle10g Release 2 Companion CD.
Although not a requirement, I will be installing
the Oracle HTTP Server to the same machine which already includes an installation
of the Oracle Database software.
This section describes the requirements for installing Oracle Application Express, Release 2.0.
Browser Requirements
To view or develop Oracle Application Express applications, Web browsers must
support Java Script and the HTML 4.0 and CSS 1.0 standards.
The following browsers meet this requirement:
Operating System Requirements
From what I have read and tested, Oracle Application Express can be
installed on the following Operating System platforms:
Disk Space Requirements
Database Requirements
The installation of Oracle Application Express requires
certain objects to be created in an Oracle database. With Oracle
Application Express 2.0, the database is required to be
Oracle9i Release 2 (9.2.0.3) or later. All of the Oracle Application
Express database objects should be created in a separate tablespace
which we will create later on in this article.
Shared Pool Size Requirements
SQL> show parameter shared_pool_size
Verify JOB_QUEUE_PROCESSES
The initialization parameter JOB_QUEUE_PROCESSES for the Oracle database
determines the maximum number of concurrently running jobs. In Oracle Application Express Release 2.0,
transactional support and SQL scripts require jobs. If JOB_QUEUE_PROCESSES is not
enabled and working properly, you cannot successfully execute a script.
SQL> SELECT VALUE FROM v$parameter WHERE NAME = 'job_queue_processes';
If you need to modify the JOB_QUEUE_PROCESSES initialization parameter,
log into the database as SYSDBA using SQL*Plus and run the ALTER SYSTEM ...
statement. For example, to set the number of JOB_QUEUE_PROCESSES to 20, use:
SQL> ALTER SYSTEM SET JOB_QUEUE_PROCESSES = 20;
Oracle XML DB Requirements
Oracle Text Requirements
Oracle Text must be installed so that you can use the searchable
online help in Oracle HTML DB. By default, Oracle Text is installed
as part of Oracle Database. In addition, make sure that the default
language preferences for Oracle Text have been installed. To install
the Oracle Text default language, log into the Oracle database
where you plan to install Oracle Application Express and run the appropriate
drdeflang.sql script, which by default is located in
ORACLE_BASE\ORACLE_HOME\ctx\admin\defaults. For example,
to run the language preferences script for US English,
drdefus.sql:
$ sqlplus "sys/<sys password> as sysdba"
SQL> @?\ctx\admin\defaults\drdefus.sql
About the Oracle HTTP Server
Oracle Application Express requires the use of the Oracle HTTP Server.
Oracle HTTP Server is a web server supplied by Oracle and is based
on the Apache HTTP Server. The web server will receive all HTTP requests
from the client (the browser) and forward them to the mod_plsql extension module, which
then forwards the request to the Oracle Application Express engine
within the Oracle database. Once the Oracle Application Express engine
has carried out the request, the Oracle HTTP Server will return the resulting
HTML page back to the client browser to be rendered.
Install Oracle HTTP Server
When installing Oracle Application Express, you will be required to install
the Oracle HTTP Server which can be found on the Oracle10g Release 2 Companion CD.
Although not a requirement, I will be installing
the Oracle HTTP Server to the same machine which already includes an installation
of the Oracle Database software.
The Oracle HTTP Server cannot be installed into an existing Oracle Home. If another
Oracle product is installed on the same server, you will need to create a new Oracle home
name and location for the Oracle HTTP Server.
Do not install HTML DB in the next step!
Test the Oracle HTTP Server Installation
After the installation of the Oracle HTTP Server is complete, you should test
it. Point your browser to the URL that was displayed on the "End of Installation"
screen by the Oracle Universal Installer. For me, the URL was
http://linux3:7777/. This should bring up
the Oracle HTTP Server Welcome page.
Post Installation Steps
The only real step that should be taken after installing the Oracle HTTP Server is
to verify it will be restarted on a reboot of the server.
Enter the following set of commands in one of the start configuration files, like /etc/rc.local:
ORACLE_HOME=/u01/app/oracle/product/10.2.0/ohs
export ORACLE_HOME
$ORACLE_HOME/opmn/bin/opmnctl startall
On the Windows platform, the installer will create a service named OracleOraHttpServer10g_home1ProcessManager or something similar
depending on the name you used for the Oracle home name. This service should have been set to
automatically startup on reboot. If not, you should configure it to automatically startup on reboot.
Starting / Stopping / Restarting Oracle HTTP Server
All Oracle Application Server (OAS) components are managed
through the Oracle Process Management Notification (OPMN) service. Since
Oracle HTTP Server is a component of the Oracle Application Server suite, it is managed
by the OPMN service. OAS components are defined in the file
$ORACLE_HOME/opmn/conf/opmn.xml.

Start the OPMN service and all managed OAS components, like the Oracle HTTP Server.
$ORACLE_HOME/opmn/bin/opmnctl startall

Starts the Oracle HTTP Server managed process. The OPMN service must be started and running for this command to succeed.
$ORACLE_HOME/opmn/bin/opmnctl startproc ias-component=HTTP_Server

Stops all managed processes, such as the Oracle HTTP Server, and also stops the OPMN service.
$ORACLE_HOME/opmn/bin/opmnctl stopall

Stops the Oracle HTTP Server managed process, however, the OPMN service will continue to run.
$ORACLE_HOME/opmn/bin/opmnctl stopproc ias-component=HTTP_Server

This command will stop and then restart the Oracle HTTP Server managed process. The OPMN service, obviously, will continue to run.
$ORACLE_HOME/opmn/bin/opmnctl restartproc ias-component=HTTP_Server
Download Oracle Application Express 2.0
Before starting the installation of Oracle Application Express, you will
need to first download the software from the Oracle Technology Network (OTN)
website.
Oracle Application Express was previously known as HTML DB.
With the release of 2.0, Oracle officially changed the name from HTML DB
to Oracle Application Express (APEX) on January 30, 2006.
http://www.oracle.com/technology/products/database/application_express/download.html
$ cd apex_temp
$ unzip htmldb_2.0.zip
The unzipped files will be created in a directory named htmldb.
Create Tablespace for Oracle Application Express Database Objects
Although not necessary, it is recommended to create a separate tablespace to
store the objects created by Oracle Application Express. Otherwise these objects
will be created in the SYSTEM tablespace (or SYSAUX for Oracle10g or higher).
SQL> CREATE TABLESPACE apex20 DATAFILE SIZE 100M
2 EXTENT MANAGEMENT LOCAL UNIFORM SIZE 64K
3 SEGMENT SPACE MANAGEMENT auto;
Note that the above CREATE TABLESPACE ... statement assumes the
use of Oracle Managed Files (OMF) and therefore no datafile name
was specified. For my database, the initialization parameter
db_create_file_dest is set to /u02/oradata. If you are
not using OMF, you will need to specify a name for the datafile.
Create Oracle Application Express Database Objects
After the new tablespace has been created, the next step is to create all required database objects for Oracle Application
Express. These database objects are all created by running a single SQL script that can be found
in the Oracle Application Express software distribution downloaded earlier in this section. The SQL script
to run is named htmldbins.sql and can be found in the htmldb directory created
when unzipping the software distribution. For the purpose of this example, I ran the script as
follows (note that this install script can take quite awhile to complete):
$ cd ~/apex_temp/htmldb
$ sqlplus "/ as sysdba"
SQL> @htmldbins apexpwd apex20 apex20 temp /i/ TESTDB
A description (in order) of the above parameters are provided in the following table:
Parameters to APEX Database Object Creation SQL Script
Parameter Value
Description
apexpwd
The password for the Oracle APEX administrator account,
the APEX schema owner (FLOWS_020000), the
APEX files schema owner (FLOWS_FILES), and
the APEX public user schema (HTMLDB_PUBLIC_USER).
The APEX schema owner is the user or schema into which Oracle Application
Express database objects will be installed. The APEX files schema owner is
the user or schema where uploaded files are maintained in Oracle Application
Express.
apex20
Name of the default tablespace
for the APEX schema owner - (FLOWS_020000).
apex20
Name of the default tablespace
for the APEX files schema owner - (FLOWS_FILES).
Note that Oracle Application Express creates a table named
FLOWS_FILES.WWV_FLOW_FILE_OBJECTS$ in this tablespace
used to store any uploaded files. Although this could have been
a separate tablespace, it is just as easy having the all objects
in a single tablespace.
temp
Name of the temporary tablespace to be used for all
schemas created by the Oracle Application Express install
process.
/i/
Virtual directory that is used for images rendered by
Oracle Application Express. To support
future Oracle HTML DB upgrades, define the virtual image
directory as /i/.
TESTDB
Name of the Oracle Net connect string to the database where
Oracle Application Express database objects are to be installed.
If this is a local
install, you can use none or NONE.
Oracle Application Express Database Schema Accounts
Schema Name
Description
FLOWS_020000
This is basically the schema owner of all objects (tables, views, packages, functions, etc.)
used by Oracle Application Express. The only exception is the table installed in the
FLOWS_FILES schema (FLOWS_FILES.WWV_FLOW_FILE_OBJECTS$)
for storing uploaded files. Note that this account
is locked at the end of the installation and cannot be used unless it is first unlocked.
FLOWS_FILES
This schema is used to store uploaded files to Oracle Application Express.
These can include scripts, documents, cascading style sheets, etc.
Note that this account
is locked at the end of the installation and cannot be used unless it is first unlocked.
HTMLDB_PUBLIC_USER
This schema is used by Oracle Application Express to login to the database
and has access to database objects in the above two schemas for all application
functionality.
Recompiling Invalid PL/SQL Packages
After installing the Oracle Application Express database objects, it is recommended (however not required)
to recompile all invalid PL/SQL packages now instead of when the packages are accessed for the
first time.
SQL> @?/rdbms/admin/utlrp.sql
Install Oracle Application Express Database Images
After successfully creating all of the required Oracle Application Express database objects, the next step
is to copy the necessary images, templates, cascading style sheets, themes, java scripts, (and several other
file types) into the directory tree of the Oracle HTTP Server. The Oracle HTTP Server was installed earlier
in this article and is located at:
$ORACLE_HOME = /u01/app/oracle/product/10.2.0/ohs
The images and other file types to copy can be found in the Oracle Application Express software
distribution downloaded earlier under the .../htmldb/images directory.
$ cd ~/apex_temp/htmldb
$ cp -R images $ORACLE_HOME/Apache/Apache
C:\> xcopy /E /I C:\apex_temp\htmldb\images %ORACLE_HOME%\Apache\Apache\images
Note the directory where you copied the Oracle Application Express images to. This directory
will be referenced when we configure the Oracle Database Access Descriptor (DAD) in the next
section.
Configure Database Access Descriptor
Now that the Oracle Application Express images are in place, the next step is to
configure the Oracle Database Access Descriptor (DAD) file. The configuration
file is named dads.conf and should be located in the
$ORACLE_HOME/Apache/modplsql/conf directory.
The DAD is used by the Oracle HTTP Server and mod_plsql
extension module to connect to the Oracle database.
If you have read through the official Oracle HTML DB documentation, you will note
that it refers to a file named marvel.conf instead of dads.conf.
Whenever the Oracle HTML DB documentation refers to the file
marvel.conf, it means the dads.conf configuration file!
Example dads.conf File
# ============================================================================
# mod_plsql DAD Configuration File
# ============================================================================
# 1. Please refer to dads.README for a description of this file
# ============================================================================
# Note: This file should typically be included in your plsql.conf file with
# the "include" directive.
# Hint: You can look at some sample DADs in the dads.README file
# ============================================================================
Alias /i/ "/u01/app/oracle/product/10.2.0/ohs/Apache/Apache/images/"
AddType text/xml xbl
AddType text/x-component htc
<Location /pls/htmldb>
SetHandler pls_handler
Order deny,allow
Allow from all
AllowOverride None
PlsqlDatabaseUsername HTMLDB_PUBLIC_USER
PlsqlDatabasePassword apexpwd
PlsqlDatabaseConnectString linux3:1521:TESTDB
PlsqlAuthenticationMode Basic
PlsqlDefaultPage htmldb
PlsqlDocumentTablename wwv_flow_file_objects$
PlsqlDocumentPath docs
PlsqlDocumentProcedure wwv_flow_file_mgr.process_download
PlsqlNLSLanguage AMERICAN_AMERICA.AL32UTF8
</Location>
If this were a Windows installation, the alias line would read:
Alias /i/ "C:\oracle\product\10.2.0\ohs\Apache\Apache\images/"
Note you must include the forward slash (/) at the end of the path
for both Linux / Unix and Windows.
Oracle DAD Configuration Parameters and Description
Parameter Name
Description
Alias
This is set to the virtual directory you specified when running
the htmldbins.sql file to create the Oracle Application Express
database objects. This value must match the value you specified
which is recommended to be /i/. The virtual directory
should refer to the location where you copied the Oracle Application
Express images to in the Oracle HTTP Server directory tree.
<Location /pls/htmldb>
This is the name of the virtual path that will be used
to access application in Oracle Application Express.
For example, http://linux3:7777/pls/htmldb/f?p=100.
PlsqlDatabaseUsername
This is the database username that will be used by
the mod_plsql extension module to connect to
Oracle database.
The database username should be HTMLDB_PUBLIC_USER -
the schema created by the htmldbins.sql script.
SELECT
sys_context('USERENV','SESSION_USER') "Session User"
, sys_context('USERENV','CURRENT_USER') "Current User"
FROM dual;
Session User Current User
------------------- ------------
HTMLDB_PUBLIC_USER DEV_WS
PlsqlDatabasePassword
This must match the password you provided during
the creation of the Oracle Application Express database
objects (@htmldbins.sql). This is the password
used by the PlsqlDatabaseUsername (above)
to connect to the Oracle database.
PlsqlDatabaseConnectString
The connection URL string used to connect to the
Oracle database in the format server.domain:port:sid.
If the database is located on the same server, you can use
localhost.
Obfuscate the PlsqlDatabasePassword Parameter
Notice that when we configured the dads.conf file, we put in the plain text
password for the Oracle database user. Exposing plain text passwords is never
good security practice, especially for this sensitive database account.
Fortunately, Oracle provides an obfuscation utility
that targets and encrypts the PlsqlDatabasePassword entry in the dads.conf file.
This utility is named dadTool.pl and can be found in the $ORACLE_HOME/Apache/modplsql/conf
directory.
$ ORACLE_HOME=/u01/app/oracle/product/10.2.0/ohs; export ORACLE_HOME
$ PATH=$ORACLE_HOME/perl/bin:$PATH; export PATH
$ PERL5LIB=$ORACLE_HOME/perl/lib/5.6.1; export PERL5LIB
$ cd $ORACLE_HOME/Apache/modplsql/conf
$ perl dadTool.pl -o
Information
----------------------------------------------------------------------------
Backed up older dads.conf as /u01/app/oracle/product/10.2.0/ohs/Apache/modplsql/conf/dads.conf.orig.2006-08-03_19-00
All passwords successfully obfuscated. New obfuscations : 1
C:\> set ORACLE_HOME=C:\oracle\product\10.2.0\ohs
C:\> set PATH=%ORACLE_HOME%\perl\5.6.1\bin\MSWin32-x86;%PATH%
C:\> set PERL5LIB=%ORACLE_HOME%\perl\5.6.1\lib
C:\> cd %ORACLE_HOME%\Apache\modplsql\conf
C:\> perl dadTool.pl -o
Information
----------------------------------------------------------------------------
Backed up older dads.conf as C:\oracle\product\10.2.0\ohs/Apache/modplsql/conf/dads.conf.orig.2006-08-03_19-17
All passwords successfully obfuscated. New obfuscations : 1
The new dads.conf configuration file will be saved to the same directory
with the PlsqlDatabasePassword now obfuscated!
As you can see from the above example, the dadTool.pl utility first makes
a backup copy of the original dads.conf configuration file before obfuscating
it. The name of the original file will be of the format dads.conf.orig.YYYY-MM-DD_HH-MM.
You should either remove this file or move it to a secure location as it contains the
plain text password for the Oracle database user.
Restart the Oracle HTTP Server
After modifying the dads.conf file (and optionally obfuscating the PlsqlDatabasePassword parameter),
the Oracle HTTP Server will need to be restarted:
$ORACLE_HOME/opmn/bin/opmnctl restartproc ias-component=HTTP_Server
Test Oracle Application Express
Finally, a chance to see the results of your hard work! With the Oracle HTTP Server installed
and configured, the Oracle Application Express engine installed, and the Database Access
Descriptor configured, we can now test connectivity to Oracle Application Express.
In my sample configuration, the URL I used to test was:
http://host:port/pls/htmldb/htmldb_admin
http://host:port/pls/htmldb
http://linux3:7777/pls/htmldb/htmldb_admin
If you get a screen similar to the following then congratulations! You have successfully
installed Oracle Application Express 2.0. To login to the Oracle Application Express Service
Administration screen, use the username ADMIN and the password you supplied
when installing the Oracle Application Express database objects.
Additional information on installing and configuring
Oracle Application Express can be found in the "Oracle HTML DB
Installation Guide Release 2.0".
This guide is available from the Oracle Documentation Library
website located at the following address
http://download-east.oracle.com/docs/cd/B31035_01/doc/install.20/b16375.pdf.
Wednesday, 23-Aug-2006 18:38:15 EDT
Page Count: 10544