Friday, December 21, 2007

SQL script to Enable/Disable the maintenance mode

Run below line to change the maintenance mode (without using adadmin):

$ sqlplus apps/appsPWD @$AD_TOP/patch/115/sql/adsetmmd.sql ENABLE | DISABLE

Must pass one of the following arguments:

   ENABLE - Enable Maintenance Mode
   DISABLE - Disable Maintenance Mode

A quick way to verify if the application is on Maintenance Mode or not, is by running the following as APPS user:

SQL> select fnd_profile.value('APPS_MAINTENANCE_MODE') from dual;

"NORMAL" -- Maintenance Mode is disabled
"MAINT" -- Maintenance Mode is enabled

After you disable the Maintenance Mode, you have to bounce the Apache server.

If the Maintenance Mode is not disabled, EBS page will direct to a warning message (instead of the login page):

Warning
The system has not been taken off maintenance mode completely. Please contact your System Administrator.

And, log $LOG_HOME/ora/10.1.3/j2ee/oacore/oacore_default_group_1/application.log may give error:

javax.servlet.ServletException
        at com.evermind[Oracle Containers for J2EE 10g (10.1.3.5.0) ].server.http.EvermindPageCont
ext.handlePageThrowable(EvermindPageContext.java:911)
        at com.evermind[Oracle Containers for J2EE 10g (10.1.3.5.0) ].server.http.EvermindPageCont
ext.handlePageException(EvermindPageContext.java:828)
        at _jsp._fnd._fnderror._jspService(_fnderror.java:491)


~~~~~~~~~~~~~~~~~~  enable maintenance mode ~~~~~~~~~~~~~~~~~
#!/bin/ksh
# tested in Linux OS
Passwd='appsPWD'

if [ -n "$CONTEXT_FILE" ]; then
  echo 'Running'
else
  echo 'environment variable $CONTEXT_FILE does not exit. Exit ...'
  exit 1;
fi;

$ORACLE_HOME/bin/sqlplus -s /nolog <<-ENDSQL
connect apps/${Passwd}
show user
@$AD_TOP/patch/115/sql/adsetmmd.sql ENABLE
ENDSQL
echo 'Confirm mode:'
$ORACLE_HOME/bin/sqlplus -S /nolog <<-ENDSQL1
connect apps/${Passwd}
select fnd_profile.value('APPS_MAINTENANCE_MODE') from dual;
exit;
ENDSQL1
date
exit 0

~~~~~~~~~~~~~~~~~~  disable maintenance mode ~~~~~~~~~~~~~~~~~
#!/bin/ksh
Passwd='appsPWD'

if [ -n "$CONTEXT_FILE" ]; then
  echo 'Running'
else
  echo 'environment variable $CONTEXT_FILE does not exit. Exit ...'
  exit 1;
fi;

$ORACLE_HOME/bin/sqlplus -s /nolog <<-ENDSQL
connect apps/${Passwd}
show user
@$AD_TOP/patch/115/sql/adsetmmd.sql DISABLE
ENDSQL
echo 'Confirm mode:'
$ORACLE_HOME/bin/sqlplus -S /nolog <<-ENDSQL1
connect apps/${Passwd}
select fnd_profile.value('APPS_MAINTENANCE_MODE') from dual;
exit;
ENDSQL1
date
exit 0
 

No comments: