Posts Tagged ‘apex’

How to run standalone Oracle APEX Listener 2.0 with Oracle 11g XE and APEX 4.1.1

August 23rd, 2012 2 comments

This is short guide on how to run standalone Oracle APEX Listener 2.0 beta with Oracle 11g XE. I’m using Oracle Enterprise Linux 5.7 for running Oracle APEX Listener and Oracle Database 11g XE with APEX 4.1.1. Although running APEX Listener standalone is not supported I’m using it to run several internal applications for company needs.

When using APEX Listener with Oracle XE, APEX won’t work properly and white screen appears when APEX is open. This is because the APEX images are stored in the XML DB repository, but APEX Listener have to be run with parameter –apex-images pointing to directory containing the images at the filesystem. To solve this I downloaded the latest patch of APEX and copied the images from the patch.

If you have another database running on the same machine, keep in mind this.


Install Oracle 11g XE and update Oracle APEX to latest version:

1. Download Oracle Database Express Edition 11g Release 2 for Linux x64

2. Install Oracle 11g XE:
rpm -ivh oracle-xe-11.2.0-1.0.x86_64.rpm

3. Configure Express Edition:
/etc/init.d/oracle-xe configure
Port: 1522
Password: secret

4. Update APEX to 4.1

Download APEX 4.1
cd /tmp
unzip -q
cd apex
sqlplus / as sysdba
@apxldimg.sql /tmp/apex

5. Update APEX to version 4.1.1
Download patch set 13331096 from MOS

Disable Oracle XML DB HTTP server:

PL/SQL procedure successfully completed.

Commit complete.


Run apxpatch.sql to patch the system:

SQL> @apxpatch.sql

Update the Images Directory When Running the Embedded PL/SQL Gateway:

@apxldimg.sql /tmp/patch

Commit complete.

Once the update finished do not enable Oracle XML DB HTTP server, because we’ll be using Oracle APEX Listener, which will setup next.


Install APEX Listener 2.0.0

1. Download Oracle APEX Listener 2.0.0 beta

2. Download and install latest JRE 1.6 version, currently latest version is 1.6.34

Unpack to /opt/jre1.6.0_34

3. Unlock and set password for apex_public_user at the Oracle XE database:
alter user APEX_PUBLIC_USER account unlock;
alter user APEX_PUBLIC_USER identified by secret;

4. Patch Oracle APEX to support RESTful  Services:
cd /oracle/apxlsnr/apex_patch/
sqlplus / as sysdba @catpatch.sql

Set passwords for both users APEX_LISTENER and APEX_REST_PUBLIC_USER.

5. Install Oracle APEX Listener:
mkdir /oracle/apxlsnr/
cd /oracle/apxlsnr/

Now this is tricky, for XE edition the images are kept in the XML DB repository, so images have to be copied from the patch to the listener home:
cp /tmp/patch/images .

6. Configure Oracle APEX Listener:
export JAVA_HOME=/opt/jre1.6.0_34
export PATH=$JAVA_HOME/bin:$PATH

Set APEX listener config dir:
java -jar apex.war configdir $PWD/config

Configure the listener:
java -jar apex.war

Once configuration is complete, listener is started. It has to be stopped and run with appropriate parameters, use Ctrl-C to stop it.

7. Finally start the listener:
java -jar apex.war standalone –apex-images /oracle/apxlsnr/images

In case you want to run it in background here’s how to do it:
nohup java -jar apex.war standalone –apex-images /oracle/apxlsnr/images > apxlsnr.log &


Periodically I was seeing exceptions like these:
ConnectionPoolException [error=BAD_CONFIGURATION]

Caused by: oracle.ucp.UniversalConnectionPoolException: Universal Connection Pool already exists in the Universal Connection Pool Manager. Universal Connection Pool cannot be added to the Universal Connection Pool Manager

I found that if APEX Listener is not configured with RESTful Services then these messages appeared in the log and could be safety ignored.



Categories: linux, oracle Tags: ,

Oracle 11g XE listener does not start when there is another database running

May 15th, 2012 No comments

If for any reason you have a two databases running on the same server and one of them is Oracle 11g Express Edition then you will get surprised that listener of XE is not started automatically during boot if there is another listener already running. Debugging the startup script I found that this happens because of a bug in the code, which assumes that XE listener is running if it finds the word LISTENER within the processes list.

In file /etc/init.d/oracle-xe, at line 556 the code is failing:

+ status='oracle 2889 1 0 May13 ? 00:00:05 /oracle/ora112se/bin/tnslsnr LISTENER -inherit'
+ '[' 'oracle 2889 1 0 May13 ? 00:00:05 /oracle/ora112se/bin/tnslsnr LISTENER -inherit' == '' ']'

As you can see I have another database running and because of the XE startup script found the keyword LISTENER it’s supposing that the XE LISTENER is already running.

Simply changing line 556 from:

status=`ps -ef | grep tns | grep oracle`


status=`ps -ef | grep tns | grep oracle | grep xe`

is fixing the error and now XE listener is started automatically during boot.


Categories: oracle Tags: ,

Not able to update Web service process in APEX 4.1

March 21st, 2012 No comments

Last month I created a simple APEX application with enabled mobile support and latest version of jQuery, which integrates with HP Service Manager through web services. The purpose was to give option for company engineers to open and update incidents through mobile in few easy steps.

The first step was to create form and report by using the web service. At this point web service request process is created where authentication and input parameter are described. The problem appears if you try to change any parameter and update the web service process. This is the error:

 Error error updating web service parameters
ORA-01403: no data found

To fix this, one option is to apply patch 12934733 on top of APEX 4.1. The other option is to apply latest patch set for APEX version 4.1.1, patch number 13331096.

At the time I got the error patch set wasn’t released yet and I went with the patch only to fix this issue. Later I’ve decided to update the APEX to latest version 4.1.1 and I’ll review the update process at glance.

To upgrade to APEX 4.1.1 make sure first to review the release notes here. The process is really simple and takes few minutes.

Before applying the patch make sure to prevent access to the APEX. In my case I’m using Oracle Database 11g Express Edition and I’m using Embedded PL/SQL gateway. Then apply the patch using apxpatch.sql and update the images directory. Because I’m using Express Edition, my images are stored in the XML DB repository and script apxldimg.sql has to be used to upload the new images within the repository.


Disabling Oracle XML DB HTTP Server:




PL/SQL procedure successfully completed.


Commit complete.




Run apxpatch.sql to patch the system:

SQL> @apxpatch.sql


timing for: Complete Patch
Elapsed: 00:06:25.48


Updating the Images Directory When Running the Embedded PL/SQL Gateway:

@apxldimg.sql /tmp/patch


Commit complete.

timing for: Load Images
Elapsed: 00:04:12.56

Directory dropped.


Enabling Oracle XML DB HTTP Server:


PL/SQL procedure successfully completed.


Commit complete.


APEX is now updated to version 4.1.1



Categories: oracle Tags: , , , ,

Automatically backup Oracle APEX applications to Subversion

March 12th, 2012 2 comments

In continue of my previous posts about APEX and Subversion I made a short script using APEXExport utility to automate and backup APEX to Subversion repository.

I’m using Oracle Express Edition 11.2, which by default doesn’t have the APEXExport utility. That’s why you need first to create the directory holding it and then copy the utility there.


Create destination directory holding the utility and copy APEXExport.class there:

mkdir -p $ORACLE_HOME/utilities/oracle/apex


Create backup directory in the SVN project for holding the backup files:

[oracle@dbsrv ~]$ svn mkdir -m "Making a backup dir."

Committed revision 33.

At this point you’ll be asked for password which must be cached in order the automated backup to work correctly. The password itself is written (I assume you’re logged in with oracle user) in file in this directory: /home/oracle/.subversion/auth/svn.simple/


Finally you need to decide where the backup directory will be checked out. This will be used to store all the APEX backups, which will be committed to the SVN repository:

cd /oracle
svn checkout


This is the script for automating the backup of APEX applications, because the formatting is not correct here is download link for the script:


### Automated APEX applications backup to Subversion (SVN), v1
### 2012-03-07
### Svetoslav Gyurov,

# Environment settings for Oracle database and Java
export ORACLE_HOME=/u01/app/oracle/product/11.2.0/xe
export JAVA_HOME=/oracle/ora112ee/jdk

export CLASSPATH=$ORACLE_HOME/jdbc/lib/ojdbc5.jar:$ORACLE_HOME/utilities

# How many days/backups should be kept back
export RETENTION=7
export COMPRESS=0

# SVN directory for Oracle APEX

# Get current date and oldest backup
DATE=`date +%Y%m%d`
OLDEST_BACKUP=`date --date="-${RETENTION} days" +%Y%m%d`

# Change to SVN directory and export data
$JAVA_HOME/bin/java oracle.apex.APEXExport -db -user sve -password secret -applicationid 100


# If APEXExport is successfully continue, otherwise fail with message
if [ $exitValue -eq 0 ];
svn update

for i in `ls -1 f*.sql`
if [ $COMPRESS -eq 1 ];
gzip $i
mv $i.gz ${DATE}_$i.gz
svn add ${DATE}_$i.gz

if [ -f ${OLDEST_BACKUP}_$i.gz ];
rm ${OLDEST_BACKUP}_$i.gz
svn remove ${OLDEST_BACKUP}_$i.gz
mv $i ${DATE}_$i
svn add ${DATE}_$i

if [ -f ${OLDEST_BACKUP}_$i ];
svn remove ${OLDEST_BACKUP}_$i

svn commit -m "Daily APEX backup completed and committed."

echo Daily APEX backup completed.

echo "APEX applications could not be exported"

Of course there are few parameters which need to be set. These are ORACLE_HOME, JAVA_HOME, RETENTION period defines how many backups to be kept back and COMPRESS defines whether the exported applications be compressed with gzip. Also don’t forget to change the application id, you could also put the whole workspace to be backed up.


Finally put the script at the crontab:

31 1 * * * /home/oracle/ > /dev/null 2>&1


To check whether the backup was successful run svn info or svn log within the backup directory or just browse the repository:

cd /oracle/Backup
[oracle@dbsvn Backup]$ svn info
Path: .
Repository Root:
Repository UUID: 40fb9d41-50a5-4b10-b803-b133fb623816
Revision: 59
Node Kind: directory
Schedule: normal
Last Changed Author: oracle
Last Changed Rev: 59
Last Changed Date: 2012-03-07 01:31:07 +0200 (Wed, 07 Mar 2012)

[oracle@dbsrv Backup]$ svn log
r59 | oracle | 2012-03-07 01:31:07 +0200 (Wed, 07 Mar 2012) | 1 line

Daily APEX backup completed and commited.


Feel free to modify the script for your own needs.



Categories: linux, oracle Tags: , ,

Setup Subversion on Oracle Enterprise Linux

November 1st, 2011 5 comments

As I mentioned in my previous post I’m using Subversion to keep my SQL design, APEX application and all application serving files. Concurrent Versions System are not something new and they are must for big projects. Although I’m single person, I’m finding SVN very useful for many reasons:

  • All my files are kept at one place. At any time I could checkout the whole application and deploy it on different server.
  • I have a history (revisions) of my changes. If I know something worked yesterday I could just checkout the file from yesterday and get it working.
  • Using APEXExport I’m doing daily backups of my applications.
  • Oracle SQL Developer and SQL Data Modeler are easy to integrate with SVN.
  • When the time comes, I’ll create a branch, stable version of my application, by doing so I’ll have at any time a working and stable copy of my application.
  • Having branches I could still develop and improve the application itself, if a bug appears I’ll be fixing it in the branch not in the main version (trunk).
  • At any time more people could join the project and this would not stop the development process.

Just saw today, that Eddie Award retweeted Subversion Best Practices: Repository Structure, so I recommend you to get familiar with SVN first, before start using it.

Usually I’m using Debian for CVS systems, but in this case I’m installing Subversion on OEL 5.6, the procedure is the same for OEL 6.x.

First of all you need to install web server and svn packages. Assuming you have a configured repository, this is how to installed the packages:
yum install httpd mod_dav_svn subversion

If you want to change specific parameters you could edit Apache configuration file /etc/httpd/conf.d/httpd.conf, otherwise it’s not necessary.

Next you configure the SVN repository and authentication, the repository itself will be created next.

Edit file vi /etc/httpd/conf.d/subversion.conf and paste following:
<Location /svn>
DAV svn
SVNParentPath /var/www/svn
SVNListParentPath on
SVNIndexXSLT “/repos-web/view/repos.xsl”
AuthType Basic
AuthName “Oracle Repository authentication required”
AuthUserFile /etc/httpd/conf.d/svn.users
Require valid-user

Create users who can access the repository:
htpasswd -cm /etc/httpd/conf.d/svn.users oracle
New password:
Re-type new password:
Adding password for user oracle
[root@db ~]# cat /etc/httpd/conf.d/svn.users

Create the SVN repository:
mkdir /var/www/svn/
cd /var/www/svn/
svnadmin create oracle
chown -R apache:apache oracle

Finally restart apache and make sure it starts after reboot:
/etc/init.d/httpd restart
chkconfig httpd on

In case you see the following error then most probably you’ve omitted the SVNListParentPath parameter:
Could not fetch resource information.  [403, #0]
(2)No such file or directory: The URI does not contain the name of a repository.  [403, #190001]

These is also an issue if you use SVNListParentPath and AuthzSVNAccessFile, bug description and workaround could be found here.

Now you are ready to create you’re first project and start using SVN to maintain the source code of your applications. Given the example, the access URL would be http://hostname/svn/oracle or locally svn info file:///var/www/svn/oracle/. For maintaining the code you could use TortoiseSVN, which is excellent client for Windows.

The parameter I specified early SVNIndexXSLT will define the repository style once opened in a web browser. In my case I used a package called repo-style, which could be found here.

This is how my repository looks like:

plus the repository history looks really cool 🙂

It’s much better than the default one:



Categories: linux, oracle Tags: , ,

Why I like Oracle Application Express

October 27th, 2011 4 comments

Few years ago when I was Linux system administrator I already knew PHP and I used it to create monitoring scripts for the servers and services that I was responsible for. They were really simple application which I kept open in a browser window and integrated javascript to alert me in case some service goes down. The web design wasn’t my strong side, I guess people are born with it, but for my applications these were enough, although they were not as fancy and beautiful as I wanted to be. Then I start coding ASNI C (as a SA this is a must), created some client-server applications, loading data in MySQL and displaying it with PHP. Both PHP/C are much similar and programming in one of them clearly sets your mind of thinking in a way that it’s very easy to start the other. As system administrator I really liked using Bash, PHP, C for my daily duties. Writing applications, automating few process and protectively monitoring the systems, these kept my brain busy, made me think for new ideas and approaches and especially learned new things, I felt really positive and useful.

Now I’m an Oracle DBA, although I still do some SA and apart from my daily duties, I wanted to feel the same way. To create something that will be useful and make me satisfied, to learn new things. During the six years within this company, I saw a lot of things and found the company is missing a centralised tool for managing company assets, car park, people contacts details, certificates and more. I felt that this could be a chance to be useful and create let’s say corporate portal, integrate it with AD and have people use it.  I thought that Oracle APEX is the perfect fit for this case and perfect for me to learn APEX.

I’m pretty sure there are a lot of brilliant developers out there and I do not tend to call myself developer, but personally I feel like APEX is the development tool for me as an Oracle DBA. The very first moment I created and run my first application in APEX, I felt the same was as I was feeling back when I was writing PHP/C applications, I wanted to learn more. I got few books, read forums and online docs, but I think that the main progress I made with APEX was because I had an idea to follow.

Now, few months later I feel prepared to start developing corporate portal for the company needs. I’ve created SVN repo for this project, integrated SQL Data Modeler with SVN, created backup script with APEXExport and SVN, integrated APEX with Microsoft AD (both auth and load users from it), integrated it with Jasper for PDF reports, put some fancy jQuery for pulling data and at after all APEX is using Oracle Database. As I said, I do not tend to call myself developer, but as an Oracle DBA, I feel great and thankful that I can use APEX to create and support company applications.

That’s why I like Oracle APEX.


Categories: oracle Tags: ,