Oracle
  Home arrow Oracle arrow Page 13 - Oracle Application Server 10g Architec...
Dev Shed Forums 
Administration  
AJAX  
Apache  
BrainDump  
DHTML  
Flash  
Java  
JavaScript  
Multimedia  
MySQL  
Oracle  
Perl  
PHP  
Practices  
Python  
Reviews  
Security  
Style-Sheets  
Web Services  
XML  
Zend  
Zope  
Forums Sitemap 
IBM® developerWorks 
Sun Developer Network 
Dedicated Servers 
E-Commerce Hosting 
Linux Web Hosting 
Managed Hosting 
Small Business Hosting 
Moblin 
JMSL Numerical Library 
VPS Hosting 
Weekly Newsletter

 
Developer Updates  
Free Website Content 
 RSS  Articles
 RSS  Forums
 RSS  All Feeds
Write For Us Get Paid 
Request Media Kit
Contact Us 
Site Map 
Privacy Policy 
Support 
 USERNAME
 
 PASSWORD
 
 
  >>> SIGN UP!  
  Lost Password? 
ORACLE

Oracle Application Server 10g Architecture and Administration
By: McGraw-Hill/Osborne
  • Search For More Articles!
  • Disclaimer
  • Author Terms
  • Rating: 4 stars4 stars4 stars4 stars4 stars / 52
    2004-07-13

    Table of Contents:
  • Oracle Application Server 10g Architecture and Administration
  • Hardware Architecture of Application Server 10g
  • Client Tier, Web Tier, OHS, and Web Cache
  • App Server Tier, Partitioning
  • Application Server 10g Clusters and Farms and Database Tier
  • Application Server Discoverer
  • Oracle Application Server Wireless
  • Single Sign-On (SSO)
  • Oracle Application Server 10g Administration
  • Command-Line Interfaces or OEM?
  • Instance Manager Home Page
  • Category Command Usage Table
  • Command Line Interface and Scripts
  • EM Commands with emctl
  • Managing Application Server 10gwith dcmctl
  • Miscellaneous Application Server 10g Commands and Sumary

  • Rate this Article: Poor Best 
      ADD THIS ARTICLE TO:
      Del.ici.ous Digg
      Blink Simpy
      Google Spurl
      Y! MyWeb Furl
    Email Me Similar Content When Posted
    Add Developer Shed Article Feed To Your Site
    Email Article To Friend
    Print Version Of Article
    PDF Version Of Article
     
     
    ADVERTISEMENT


    Oracle Application Server 10g Architecture and Administration - Command Line Interface and Scripts


    (Page 13 of 16 )

    Knowing these commands (in the table on the previous page) and their parameters for Application Server 10g is very useful for automating administrative functions and creating batch scripts. These commands can easily be placed into scripts (shell scripts in Linux and UNIX) that can be executed to automate routine management tasks.

    While each product with Application Server 10g has control files, there are three main command-line interfaces:

    • opmnctl -- This is the control interface for the Process Management Notification (OPM) component. The opmnctl interface is located at $ORACLE_HOME/opmn/bin/opmnctl. The opmnctl interface provides a startall and stopall argument that will manage all of the Application Server 10g server processes.

    • dcmctl -- This is the control interface for the Distributed Configuration Manager (DCM) component. The dcmctl interface is located at $ORACLE_HOME/dcm/bin/dcmctl.

    • emctl -- This is the Enterprise Manager console utility. The emctl executable is located in $ORACLE_HOME/bin/emctl. It is used for managing the OEM agents, changing OEM passwords, starting the OEM console, and other miscellaneous tasks.

    These command-line interfaces are critical for Application Server 10g administrative scripts. Let’s take a look at how command-line interfaces are used as scripts.

    Using Scripts to Manage Application Server 10g

    You can automate many areas of Application Server 10g administration using scripts. Here is an example of a command list to start the iasdb database, the listener, the infrastructure instance, a midtier instance, and the Enterprise Manager web site on both instances.

    echo Setting Env for Infrastructure

    source envInfra.sh
    echo Starting Listener
    $ORACLE_HOME/bin/lsnrctl start
    echo Starting Database
    $ORACLE_HOME/bin/sqlplus /nolog<<EOF
    connect / as sysdba
    startup
    EOF
    echo Starting all opmnctl controlled processes
    $ORACLE_HOME/opmn/bin/opmnctl startall
    echo Starting the EM website
    #$ORACLE_HOME/bin/emctl start em
    echo Setting Env for MidTier Instance
    source envMidtier.sh
    echo Starting all opmnctl controlled processes
    $ORACLE_HOME/opmn/bin/opmnctl startall
    echo Starting the EM website
    #$ORACLE_HOME/bin/emctl start em
    echo Startup Completed
     

    By themselves, the command list is not very useful, but it becomes very powerful when embedded into a shell script. The source envMidtier.sh statement changes the ORACLE_HOME environmental variable. Each instance of Application Server 10g must be installed in its own ORACLE_HOME. This is covered in the Chapter 2. Because the Application Server 10g commandline utilities exist in many locations, it is critical that you set up your OS environment so that your scripts can locate all of the utilities. Here are examples of the proper PATH commands for UNIX and Windows. These are normally placed in the startup shell script to be executed at sign-on time.

    UNIX PATH Setup

    ORACLE_HOME=/u01/app/oracle/product/9.2.0
    export ORACLE_HOME
    PATH=.:$PATH:.;$ORACLE_HOME/dcm/bin/:$ORACLE_HOME
    /j2ee/home/:$ORACLE_HOME/ldap/bin/:$ORACLE_
    HOME/ldap/odi/admin/:$ORACLE_HOME/oca/bin
    /:$ORACLE_HOME/opmn/bin/:$ORACLE_HOME/portal/admin/
    plsql/sso/:$ORACLE_HOME/sso/lib/:$ORACLE_HOME/uddi
    /lib/:$ORACLE_HOME/upgrade/:$ORACLE_HOME/
    wireless/bin/

    Windows PATH Setup

    Set ORACLE_HOME=c:oracleora92
    SETPATH=.;$PATH;%ORACLE_HOME%dcmbin;%ORACLE_HOME%j2eehome;%ORACLE_HOME%ldapbin
    ;%ORACLE_HOME%ldapodiadmin;%ORACLE_HOME%ocabin;%ORACLE_HOME%opmnbin;%ORACLE_HOME%
    portaladminplsqlsso;%ORACLE_HOME%ssolib;%ORACLE_HOME%uddilib;%ORACLE_HOME%upgrade
    ;%ORACLE_HOME%wirelessbin

    Once you have established the PATH variable, you can create shell scripts that can be submitted in batch mode (in UNIX with the nohup command) to automate Application Server 10g administrative tasks. For example, an Application Server 10g management shell script could be scheduled in the UNIX crontab to perform a scheduled shutdown of all services.

    Of course, the PATH variable is only a part of an Application Server 10gscript, and the complete environment, including ORACLE_BASE, ORACLE_HOME, and ORACLE_SID, must be enabled. The env.ksh script shows a common environmental setting for Application Server 10g command scripts. Note that $ORACLE_HOME is set to ORACLE_BASE/midtier for midtier command scripts and ORACLE_BASE/infra for infrastructure command scripts. Every Application Server 10g instance must be installed in a unique ORACLE_HOME, and startup/shutdown scripts must set the environment variables for that instance.

    env.sh

    #!/bin/ksh
    export ORACLE_BASE=/private/ias
    # Use this ORACLE_HOME for midtier applications
    #export ORACLE_HOME=$ORACLE_BASE/midtier
    # Use this ORACLE_HOME for infra applications
    export ORACLE_HOME=$ORACLE_BASE/infra
    SETPATH=.;$PATH;%ORACLE_HOME%dcmbin;%ORACLE_HOME%j2eehome;%ORACLE_HOME%ldapbin
    ;%ORACLE_HOME%ldapodiadmin;%ORACLE_HOME%ocabin;%ORACLE_HOME%opmnbin;%ORACLE_HOME%
    portaladminplsqlsso;%ORACLE_HOME%ssolib;%ORACLE_HOME%uddilib;%ORACLE_HOME%upgrade
    ;%ORACLE_HOME%wirelessbin
    export ORACLE_SID=iasdb
    export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$ORACLE_HOME/lib
    #export DISPLAY=tor:2.0
    echo ORACLE_HOME : $ORACLE_HOME
    echo ORACLE_SID : $ORACLE_SID
    echo DISPLAY : $DISPLAY
    echo Set PATH and LD_LIBRARY_PATH

    Here is a script to submit when there is a problem with OHS and you need to restart it. Some Application Server 10g administrators place Apache user-exit code to automate the bouncing of the OHS. For example, if an external connection fails to attach to an OHS listener, after ten seconds, the following code could be automatically invoked to bounce OHS.

    bounce_ohs.ksh

    #**************************************************
    # Copyright (c) 2003 by Donald K. Burleson
    #
    #**************************************************
    # Exit if no first parameter $1
    if [ -z "$1" ]
    then
    echo "ERROR: Please pass a valid ORACLE_SID to this script"
    exit 99
    fi
    # Validate Oracle
    TEMP=`cat /etc/oratab|grep ^$1:|cut -f1 -d':'|wc -l`
    tmp=`expr TEMP` # Convert string to number
    if [ $tmp -ne 1 ]
    then
    echo
    echo "ERROR: Your input parameter $1 is invalid. Please Retry"
    echo
    exit 99
    fi
    if [ `whoami` != 'oracle' ]
    then
    echo "Error: You must be oracle to execute the script. Exiting."
    exit
    fi
    # First, we must set the environment . . . .
    export ORACLE_BASE=/private/ias
    # Use this ORACLE_HOME for midtier applications
    #export ORACLE_HOME=$ORACLE_BASE/midtier
    # Use this ORACLE_HOME for infra applications
    export ORACLE_HOME=$ORACLE_BASE/infra
    SETPATH=.;$PATH;%ORACLE_HOME%dcmbin;%ORACLE_HOME%j2eehome;%ORACLE_HOME%ldapbin
    ;%ORACLE_HOME%ldapodiadmin;%ORACLE_HOME%ocabin;%ORACLE_HOME%opmnbin;%ORACLE_HOME%
    portaladminplsqlsso;%ORACLE_HOME%ssolib;%ORACLE_HOME%uddilib;%ORACLE_HOME%upgrade
    ;%ORACLE_HOME%wirelessbin
    export ORACLE_SID=iasdb
    export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$ORACLE_HOME/lib
    #export DISPLAY=tor:2.0
    #********************************************
    # Execute the DCM commands to bounce the OHS
    #*********************************************
    $ORACLE_HOME/dcm/bin/dcmctl stop -ct ohs
    $ORACLE_HOME/dcm/bin/dcmctl start -ct ohs
    $ORACLE_HOME/dcm/bin/dcmctl start -co OC4J_Portal

    As you can see, these shell scripts with embedded Application Server 10g commands are extremely useful for automatic administration. As each component is discussed in later chapters, detailed scripts will be introduced to assist with the administration of that component.

    The next few sections give examples of commands that are used to perform frequent Application Server 10g administrative functions.

    This chapter is from Oracle Application Server 10g Administration Handbook, by Garmany and Burleson. (McGraw-Hill/Osborne, 2004, ISBN: 0072229586). Check it out at your favorite bookstore today. Buy this book now.

    More Oracle Articles
    More By McGraw-Hill/Osborne


     

       

    ORACLE ARTICLES

    - Implementing and Using Oracle`s Restore Poin...
    - Tuning PL/SQL Code
    - Debugging PL/SQL Code
    - Testing PL/SQL Code
    - Working With PL/SQL Code
    - Conditional Compilation for Oracle Database ...
    - Compile-Time Warnings for Oracle DB 10g
    - Compiling PL/SQL Code for an Oracle Database
    - Troubleshooting PL/SQL Code
    - Managing PL/SQL Code
    - Data Manipulation and More for HTML DB Appli...
    - Oracle Database Fundamentals
    - Adding Processes to HTML DB Applications
    - Adding Computations, Processes, and Validati...
    - Sub-templates and More with Oracle HTML DB





    © 2003-2008 by Developer Shed. All rights reserved. DS Cluster 6 hosted by Hostway