oracle

In Classical Antiquity, an oracle was a person or agency considered to provide wise counsel or prophetic predictions or precognition of the future, inspired by the gods. read more at WikiPedia

  • oracle_logo3

    The Oracle WebLogic 11g application server product line is the industry's most comprehensive Java platform for developing, deploying, and integrating enterprise applications. It provides the foundation for application grid, which is an architecture that enables enterprises to outperform their competitors while minimizing operational costs.

    Some notes

    This script may look unsecure (and it is)

    Since password are store inside (admin server login: admin and password is admin), by doing so I can restart Oracle Weblogic in a cron job since stopping wont query the console for the login and password: feel free to remove these lines in blue

    I always recommend to install web process in its own user group and use a dedicated user to mitigate any securities issues:

    # groupadd weblogic
    # useradd -g weblogic-c weblogicuser for weblogic' -m weblogic
    # su – weblogic

    Install then weblogic in /home/weblogic

    Respect the order of component for starting

    1. Start Weblogic Node Manager,
    2. Start WebLogic Admin server,
    3. Start all Managed Server in any order.

    and stopping components

    1. Stop the Node Manager
    2. Stop all Managed WebLogic server
    3. Stop WebLogic

    Names of the managed server

     managed server names are in the script so add remove start and stop command for them

    Logs files of start and stop operations

    are written in 2 files, that use timestamp, see WLS_LOG_START and WLS_LOG_STOP

    /etc/init.d/weblogic file

    Create a new file as root in /etc/init.d/weblogic

    # vi /etc/init.d/weblogic

    and paste inside the following

    #!/bin/sh
    # description: webLogic adminServer and managedServer start script
    #

    # customized below to your likings
    WLS_DOMAIN=mytestdomain
    WLS_BASE=/home/weblogic/
    WLS_HOME=${WLS_BASE}/bea/user_projects/domains/$WLS_DOMAIN
    WLS_NODE_HOME=${WLS_BASE}/bea/wlserver_10.3/server/bin
    WLS_OWNER=
    weblogic
    WLS_ADMIN_PORT=7001
    WLS_ADMIN_LOGIN=admin
    WLS_ADMIN_PWD=admin
    WLS_LOG_START=${WLS_BASE}/logs/start.`date '+%d%m%y'`.log
    WLS_LOG_STOP=${WLS_BASE}/logs/stop.`date '+%d%m%y'`.log
    WLS_MANAGED_SERVER1=dev
    WLS_MANAGED_SERVER2=test
    JAVA_OPTIONS="${JAVA_OPTIONS} -Dweblogic.management.username=${WLS_ADMIN_LOGIN}"
    JAVA_OPTIONS="${JAVA_OPTIONS} -Dweblogic.management.password=${WLS_ADMIN_PWD}"

    export JAVA_OPTIONS

    if [ ! -f $WLS_HOME/startWebLogic.sh ]
    then
        echo "WebLogic startup: cannot $WLS_HOME/startWebLogic.sh "
        exit
    fi

    startWeblogic()
    {
    su - $WLS_OWNER -c "nohup $WLS_NODE_HOME/startNodeManager.sh > ${WLS_LOG_START} 2>&1 &"
    sleep 10
    su - $WLS_OWNER -c "nohup $WLS_HOME/startWebLogic.sh >> ${WLS_LOG_START} 2>&1 &"
    sleep 10
    su - $WLS_OWNER -c "nohup $WLS_HOME/bin/startManagedServer.sh >> ${WLS_LOG_START} 2>&1 &"
    sleep 10
    su - $WLS_OWNER -c "nohup $WLS_HOME/bin/startManagedServer.sh >> ${WLS_LOG_START} 2>&1 &"
    return 0
    }

    stopWeblogic()
    {
    su - $WLS_OWNER -c "nohup $WLS_NODE_HOME/stopNodeManager.sh > ${WLS_LOG_STOP} 2>&1 &"
    sleep 10
    su - $WLS_OWNER -c "nohup $WLS_HOME/bin/stopManagedWebLogic.sh $WLS_MANAGED_SERVER1t3://localhost:$WLS_ADMIN_PORT ${WLS_ADMIN_LOGIN} ${WLS_ADMIN_PWD} >> ${WLS_LOG_STOP} 2>&1 &"
    sleep 10
    su - $WLS_OWNER -c "nohup $WLS_HOME/bin/stopManagedWebLogic.sh $WLS_MANAGED_SERVER2 t3://localhost:$WLS_ADMIN_PORT  ${WLS_ADMIN_LOGIN} ${WLS_ADMIN_PWD}>> ${WLS_LOG_STOP} 2>&1 &"
    sleep 10
    su - $WLS_OWNER -c "nohup $WLS_HOME/bin/stopWebLogic.sh >> ${WLS_LOG_STOP} 2>&1 &"
    return 0
    }

    case "$1" in
        'start')
            startWeblogic
            ;;
        'stop')
            stopWeblogic
            ;;
        'restart')
            stopWeblogic
            startWeblogic
            ;;
        *)
            echo "Usage: $0 start|stop|restart"
            exit 1
            ;;
    esac

  • apache_maven

    I found&160; this time a&160; new way to deploy Maven artefacts using the Oracle Weblogic Ant API!

    If you remember my previous post, there is many ways to deploy your war/ear to Oracle Weblogic

    1. Using Oracle Weblogic development mode, a mode in which a simple copy of your files in a specific autodeploy directory trigger the update/install of these
    2. Using Maven Cargo, this work only if your Oracle Weblogic container is local (see here) on the same machine, where Apache Maven is running
    3. Using a very old Maven plugin (2008), local and remote container are supported, but our builds were sometimes hanging during pre integration phase for no apparent reasons.

    And now using the official ANT API of Oracle, by far the MOST stable of all!

    • A covariant, or read-only list of Numbers as List<+Number>.
    • A contravariant, or write-only list of Numbers as List<-Number>.
    • A bivariant, read-write list of Numbers as List<*>.
    • An invariant list of Numbers as List<=Number>.
  • Sun officially released Java 6 for download after over two years of development and collaboration with 10 companies.

    What's New in Java SE 6 Beta 2? here are the top 10 things you need to know about the Java 6 release

    The official Homepage of Java 6 being here.

  • Java Platform, Standard Edition 6 is a major feature release. Significant features and enhancements in Java SE 6 since the prior major release, J2SE 5.0 are all listed on that page.

    You can download the Release Candidate HERE


  • Funny Video

  • ORA-00054: resource busy and acquire with NOWAIT specified
    Cause: Resource interested is busy.
    Action: Retry if necessary.

    I show you here how to get around this error and kill the sessions that are preventing the exclusive lock.

    Note that you could also (preferred)

    • Run your changes later when the database is idle.
    • Do all DDL during a maintenance window when all users are not logged in

    Run in SQL*Plus or SQL developer

    select a.sid, a.serial#  from v$session a, v$locked_object b, dba_objects c 
    where b.object_id = c.object_id 
    and a.sid = b.session_id
    and OBJECT_NAME='YouTableName';

    Then note both the sid and serial and run

    alter system kill  session 'sid,serial#' IMMEDIATE;

    If this still do not work, your last bullet is to kill the Unix process which is still hanging on your database server!

    here is how to find the unix process to kill

    Run in SQL*Plus or SQL developer

    select p.spid,s.sid,s.serial#,s.username,s.status,s.last_call_et,
    p.program,p.terminal,logon_time,module,s.osuser from V$process p,V$session s where s.paddr = p.addr and s.status = 'ACTIVE' and
    s.username not like '%SYS%';

    and finally run a

    kill –9 spid

    if this still don’t not work, your best friend is Google

  • The Oracle error ORA-00054 can be solved by executing as DBA the following query

    select p.spid,s.sid,s.serial#,s.username,s.status,s.last_call_et,
           p.program,p.terminal,logon_time,module,s.osuser 
    from 
           V$process p,V$session s 
    where 
           s.paddr = p.addr and s.status = &39;ACTIVE&39; and 
           s.username not like &39;%SYS%&39;;

    This will return the PID of the hanging process

    You can then SSH to the server ruining oracle and kill the process

    kill -9 PID

     

  • if you encounter this error while starting oracle

    /etc/init.d/oraemctl start Starting Oracle EM DB Console:
    Environment variable ORACLE_UNQNAME not defined. 
    Please set ORACLE_UNQNAME to database unique name. OK
    One possible solution is to edit the script
    # vi /etc/init.d/oraemctl

    and add the following code in blue

    #!/bin/bash
    #
    # oraemctl Starting and stopping Oracle Enterprise Manager Database Control.
    # Script is valid for 10g and 11g versions.
    #
    # chkconfig: 35 80 30
    # description: Enterprise Manager DB Control startup script
    
    # Source function library.
    
    . /etc/rc.d/init.d/functions
    
    ORACLE_OWNER="oracle"
    ORACLE_HOME="/opt/oracle/otk/home"
    ORACLE_HOME="/opt/oracle/otk/home/app/oracle/product/11.2.0/dbhome_1"
    ORACLE_SID=orcl
    
    case "$1" in
     start)
      echo -n $"Starting Oracle EM DB Console:"
      su - $ORACLE_OWNER -c "ORACLE_SID=$ORACLE_SID $ORACLE_HOME/bin/emctl start dbconsole"
      echo "OK"
      ;;
     stop)
      echo -n $"Stopping Oracle EM DB Console:"
      su - $ORACLE_OWNER -c "ORACLE_SID=$ORACLE_SID $ORACLE_HOME/bin/emctl stop dbconsole"
      echo "OK"
      ;;
     *)
     echo $"Usage: $0 {start|stop}"
    ;;
    esac
    ~

    Use of course the right SID, after that Oracle Enterprise manager will start correctly

    # /etc/init.d/oraemctl start
    Starting Oracle EM DB Console:Oracle Enterprise Manager 11g Database Control Release 11.2.0.1.0
    Copyright (c) 1996, 2009 Oracle Corporation.&160; All rights reserved.
    - An instance of Oracle Enterprise Manager 11g Database Control is already running.
    OK