• CozWeAreFriends Banner. Nice isn't it?
  • CozWeAreFriends Banner. Nice isn't it?
  • Are we just friends or more than friends?

    Posted on April 30th, 2012 by fath

    I found an interesting article by Cathy Meyer regarding this issue and I want to share this to you guys. Hope after reading this, you can ask questions to yourself, in which position are you right now?

     

    This is very predictable statement that will come from a cheating spouse. If your spouse is spending more and more time with this new “friend” then there is probably more to it than mere friendship. Your spouse may feel they have a lot in common with this person, that this person understands them and things they are going through. Whatever the reasons for the friendship, it’s a big warning sign and one you should take seriously.

     

    I received an email from a husband whose wife had accused him of cheating. He ask this question, “what would a spouse who is not cheating say about a friendship? If they really are just friends, what would he say?” According to him, his wife found an article and now has “confirmed” in her mind that he is cheating because he has female friends. He does not love them, He does not sleep with them, He does not even touch them, but they are friends and he has told his wife this.

     

    Here is this man’s problem. His wife is evidently uncomfortable with the fact that he has female friends. For whatever reason, in her mind she does not feel that it is proper. She feels threatened by the fact that he has female friends. Instead of getting upset and defensive, why doesn’t this man try to find out why she feels so threatened by the idea that he has female friends?

     

    I see nothing wrong with having friends of the opposite sex. I do see something wrong with dismissing your spouse’s feelings about the issue though. Your friendship with members of the opposite sex may be platonic and harmless, in your opinion. When you are married, your spouse’s opinion should be taken into consideration also.

     

    When does friendship cross the line and become more than “just friends?”

    1- When you discuss your marital problems with your friend.

    2- When you keep your relationship with your friend a secret.

    3- When you begin to feel an attraction toward your friend.

    4- When you turn to your friend with a problem instead of your wife.

    5- When you exclude your wife from your relationship with your friend.

    6- When you would rather spend time with your friend than your spouse.

    7- When you think your friend understands you better than your spouse.

     

    If you are reading this article, you are an adult, more than likely. If so, you have the common sense to know when a friendship has crossed the line and becomes more than “just friends.” You may be able to deny it to yourself but your spouse will be able to sense that there is a problem.

     

    If you have friendships with members of the opposite sex and want to put your spouse at ease about those friendships then make sure your spouse is a part of the relationships. It may sound antiquated but, when married, friendships should be shared. They should involve you and your spouse both. If for some reason you don’t feel a need to make your spouse a part of the friendship you need to question what your true objective is for maintaining the friendship.

     



    Oracle SQLplus – How to check database version

    Posted on April 30th, 2012 by fath

    Hi All.

    A lot of you might’ve been knowing how to achieve what I mentioned in the title. But sometime, we are clueless and we dig down here and there, but found nothing. Hehe. So here’s the easy way how to get Oracle database version using SQLplus.

    Just login to your SQLplus. You will see it there. 🙂

     

    $ sqlplus ‘/as sysdba’

    SQL*Plus: Release 10.2.0.4.0 – Production on Mon Apr 30 17:19:49 2012

    Copyright (c) 1982, 2007, Oracle.  All Rights Reserved.

    Connected to:
    Oracle Database 10g Enterprise Edition Release 10.2.0.4.0 – 64bit Production
    With the Partitioning, Real Application Clusters, OLAP, Data Mining
    and Real Application Testing options

     



    How to sort process running in HP-UX server by Memory utilization (RSS)

    Posted on April 30th, 2012 by fath

    Hello All,

    Regarding the topic that I posted, run the Glance command. You will see by default, the processes listed in the screen are sorted by CPU usage. You may use this settings if you want to see which program/application is running active at any instance time. But what if the server memory is spiking all the time and you need to know which application is causing that? The investigation can be started by looking into process that consumes the largest memory.

    Once you are in Glance, then hit “o” and you will see the image below right at the bottom of the screen. Press 1.

    After getting into the page below, press “down” arrow until you reach “Sort key” option. Then type in “rss” and hit enter.

    The alert below will show up. Press “y” to save this setting as default.

    You will be redirected to the initial Glance page. Now, the processes are already sorted by the memory utilization.

    Hope this helps. Cheers! 🙂

     



    Siebel Restart WebServer Script When Memory Reaching Threshold

    Posted on April 27th, 2012 by fath

    Hello All,

    There’s this occasion whereby Siebel will somehow crash if the server memory reaching certain level. To encounter/as a workaround for this, I wrote a monitoring script that will check the server utilization and perform Siebel’s WebServer restart whenever only small amount of memory left in the server. Please have a look at the script below 🙂

     

    #!/usr/bin/sh
    # Script to grep Free RAM
    # Perform Web Server restart once the RAM meet threshold
    # Written by Fath

    # THRESHOLD IN ‘K’ bytes UNIT
    THRESHOLD=1400000

    WEB_SERVICE_DIR=/opt/hpws/apache32/bin

    FREE_RAM_OUTPUT=/home/admin/FREE_RAM_OUTPUT.txt
    TOP_OUTPUT=/home/admin/TOP_OUTPUT.txt
    top -d1 -f ${TOP_OUTPUT}

    MEMORY_ALL=`grep “Memory:” ${TOP_OUTPUT}`
    FREE_RAM=`echo ${MEMORY_ALL} | awk ‘{print $8}’`
    FREE_RAM_NO=`echo $FREE_RAM | awk ‘{gsub (/K/,””); print}’`

    echo “———————————————–” >> ${FREE_RAM_OUTPUT}
    date >> ${FREE_RAM_OUTPUT}

    if [ “$FREE_RAM_NO” -lt “$THRESHOLD” ];then
    echo “Free RAM is less than ${THRESHOLD}K (${FREE_RAM_NO}K). Performing Web Service restart…” >> ${FREE_RAM_OUTPUT}
    echo “httpd processes running in server:” >> ${FREE_RAM_OUTPUT}
    ps -ef | grep httpd | grep apache32 >> ${FREE_RAM_OUTPUT}
    echo “Shutting down.. ” >> ${FREE_RAM_OUTPUT}
    . ${WEB_SERVICE_DIR}/stopapa >> ${FREE_RAM_OUTPUT}
    sleep 1
    PROC_COUNT=`ps -ef | grep httpd | grep apache32 | wc -l`
    while [ “$PROC_COUNT” -ne “0” ]
    do
    sleep 1
    PROC_COUNT=`ps -ef | grep httpd | grep apache32 | wc -l`
    done
    echo “0 httpd process running. Starting up..” >> ${FREE_RAM_OUTPUT}
    . ${WEB_SERVICE_DIR}/startapa >> ${FREE_RAM_OUTPUT}
    while [ “$PROC_COUNT” -eq “0” ]
    do
    sleep 1
    PROC_COUNT=`ps -ef | grep httpd | grep apache32 | wc -l`
    done
    echo “OK! httpd processes are running!” >> ${FREE_RAM_OUTPUT}
    else
    echo “There’s enough free RAM (${FREE_RAM_NO}K).” >> ${FREE_RAM_OUTPUT}
    fi

    echo “———————————————–” >> ${FREE_RAM_OUTPUT}
    rm ${TOP_OUTPUT}

     



    UNIX – Shell script to create XMLs based on user input data

    Posted on April 26th, 2012 by fath

    Hi All,

    I wrote a simple shell script that can read parameterized XML structure and will generate completed XMLs (with correct values) based on what we specified in the input data. This script was actually meant for my initial phase of Performance Testing data loading in my project.

    To accomplish this, I created 3 files which are the script itself, the parameterized XML template, as well as the data file. Below are the files:

    1) structure.txt (XML template) – here I replaced the value of the field that we need to parameterize with variable, such as ${ACC_NUM}

    <Sbsc xmlns=”http://www.cozwearefriends.com/XMLSchema” xmlns:xsi=”http://www.w3.org/2001/XMLSchema-instance” xsi:schemaLocation=”http://www.cozwearefriends.com/XMLSchema XXX_Subsc
    ribers.xsd”>
    <ActSbsc id=”${ACC_NUM}”>
    <Act>
    <ActNo>${ACC_NUM}</ActNo>
    <Curr>${LOG}</Curr>
    <CustSegList/>
    <SubSta>A</SubSta>
    <BType>B</Btype>
    <Eff>2011-08-01T01:22:15-07:00</Eff>
    <CrtT>2011-08-01T01:22:15-07:00</CrtT>
    <ANArr elem=1>
    </Act>
    </ActSbsc>
    </Sbsc>

    2) createXML.sh (Shell script)

    # Script to create XML
    # based on user input
    # created by Fath

    STRUCTURE_FILE=structure.txt
    INPUT_FILE=input.txt
    OUTPUT_FILE=output.xml

    LOOP_NUMBER=`cat ${INPUT_FILE} | wc -l`

    i=1
    while [ “$i” -lt “$LOOP_NUMBER+1” ]
    do
    ACC_NUM=`head -${i} ${INPUT_FILE} | tail -1 | cut -f1 -d’;’`
    LOG=`head -${i} ${INPUT_FILE} | tail -1 | cut -f2 -d’;’`
    # Add in more variable here as well as in the command below if you have more than 2 parameters

    cat ${STRUCTURE_FILE} | sed -e s/’${ACC_NUM}’/${ACC_NUM}/g -e s/’${LOG}’/${LOG}/g >> ${OUTPUT_FILE}

    i=$((i+1))
    done

    3) input.txt (data file)

    ACC1;LOG1;
    ACC2;LOG2;
    ACC3;LOG3;

     

    You may change the files above depending on your requirements. Cheers. 🙂

     



    UNIX – Shell script to capture SQL query using Oracle sqlplus

    Posted on April 22nd, 2012 by fath

    Hi All,
    In my project, as part of Performance Testing team, I’ve wrote a number of scripts to help us perform our duty in system tunings. Here. I’d like to share one of my shell script that can help to capture SQL query running in the background.Feel free to modify this script to fit your own requirement.

     

    ###############################
    # CAPTURE SQL – by Fath #
    ###############################
    ################# PARAMETERS #################

    ##############################################
    #SH_LOG=”$location/CAPTURE_SQL.log”

    clear
    echo “*****************************************************************”
    echo “PV SQL CAPTURE SCRIPT”
    echo “*****************************************************************”

    echo “LOADING CAPTURING SQL..”

    echo “”
    pros=`ps -ef | grep ora_pmon | awk ‘{print $9}’ | grep ora_pmon_ | awk ‘{print substr($1,10)}’`

    echo “Database running on Oracle Process = $pros”
    echo “Oracle SID = $ORACLE_SID”
    echo “Proceed? [y/n]”
    read option
    echo “”

    if [ “$option” = “y” ]
    then
    echo “Enter sid and serial#”
    echo “SID:”
    read sid
    echo “Serial #:”
    read serial

    result=`sqlplus -s ‘/as sysdba’ << ENDOFSQL
    begin
    dbms_system.set_ev(‘$sid’,’$serial’,10046,12,”);
    end;
    /

    begin
    DBMS_SYSTEM.SET_SQL_TRACE_IN_SESSION (sid=>’$sid’, serial#=>’$serial’,sql_trace=>TRUE);
    end;
    /
    show parameter user_dump_dest
    exit;
    ENDOFSQL`

    #path=”$result”

    echo “”
    echo “——————————-”
    echo “Remarks:”
    echo “Spooled queries will be generated in:”
    #echo “$path” | grep /app | awk ‘{print $3}’

    path=”/app/oracle/admin/NSBLPVT/udump”
    echo “$path”
    echo “——————————-”
    echo “”

    while true
    do
    echo “Stop capturing? [y/n]”
    read option2
    echo “”

    if [ “$option2” = “y” ]
    then
    result2=`sqlplus -s ‘/as sysdba’ << ENDOFSQL
    begin
    DBMS_SYSTEM.SET_SQL_TRACE_IN_SESSION (sid=>’$sid’, serial#=>’$serial’,sql_trace=>FALSE);
    end;
    /
    exit;
    ENDOFSQL`

    echo “——————————-”
    echo “Results: ”
    echo “SQL captured in: ”
    result3=`ls -lrt $path | tail -n 1 | awk ‘{print $9}’`
    echo “$result3”
    echo “Converting trace file to log…”
    result4=`tkprof $path/$result3 SQL_CAPTURED[$result3].log sys=no waits=yes sort=exeela`
    echo “Converted to SQL_CAPTURED[$result3].log…”
    echo “Completed.”
    echo “——————————-”

    break
    fi
    done
    fi

    echo “”
    echo “SEE YOU AGAIN!!”
    echo “”

     

     



    JVM Monitoring & Tunings – Tutorial 1 for Basic Knowledge

    Posted on April 22nd, 2012 by fath

    Hi All,

    Lately, I’ve been doing quite a lot of experimenting, tunings on JVM since this was one of the tasks given to me in my project. I’d like to share some of my notes to you guys. They might not be so detail, but I hope this would help those who are new in this topic. Cheers! 🙂

     

    INTRODUCTION

    serial collector – a single threaded collector
    parallel collector – multiple thread to collect garbage

    HOW IT WORKS

    the following collectors operate on the young generation:
    -XX:+UseSerialGC
    -XX:+UseParallelGC
    -XX:+UseParNewGC

    the following collectors operate on the old generation:
    -XX:+UseParallelOldGC
    -XX:+UseConcMarkSweepGC

    Both the serial and parallel collectors cause a stop-the-world during the GC.

    There are two differences between a parallel and a CMS collectors:

    1) the parallel uses multiple GC threads, while the CMS uses only one.
    2) the parallel is a ‘stop-the-world’ collector, while the CMS stops the world only during the initial mark and remark phases.
    during the concurrent marking and sweeping phases, the CMS thread runs along with the application’s threads.

    the CMS performs the following steps (all made by only one GC thread):
    – initial mark
    – concurrent marking
    – remark
    – concurrent sweeping

    Parallel & Conc can be combined in GC by using:
    – -XX:UserParNewGC for the new generation (multiple GC threads)
    – -XX:+UseConcMarkSweepGC for the old generation (one GC thread, freezes the JVM only during the initial mark and remark phases)

    WHEN TO USE FLAGS

    – In theory, the CMS should be used when you you want to reduce the time you application spends on GC freezes (Stop-The-World) by making the GC working concurrently with your application.
    – you’ll use parallel when you want to reduce the application freezes but not in the cost of interfering with your application threads.

    GC ALGORITHM

    Parallel (For Throughput Applications)
    |— -XX:+UseParallelOldGC – parallel garbage collector on young and old gen
    |— -XX:+UseParallelGC – parallel garbage collector on young and serial on old gen
    |— -XX:ParallelGCThreads=# – To modify the number of threads, use the flag , where # is the number of threads

    Concurrent (For Latency Applications)
    – can cause fragmentation on heap because the heap is not compacted on every single collection. It compacts when the new object cant fit in the heap.
    – the goal of concurrent is to reduce the number of full collections

    -XX:+UseConcMarkSweepGC
    |— -XX:+CMSIncrementalMode (perform different collection phases incrementally)
    |— -XX:CMSIncrementalSafetyFactor=# (# a number of 0-100; default=10%; larger value means giving more time for minor collection, if not helping, increase min duty cycle)
    |— -XX:CMSIncrementalDutyCycleMin=# (# a number of 0-100; The higher the number, the more minimum time you are willing to give to a minor collection.)

    SOME OTHER FLAGS OPTION

    By adding the flag -Xmn you can set the nursery size, and the remaining heap is then allocated to the tenured space.
    This tuning of the nursery can be an important source of performance improvements because a nursery collection is significantly faster than a full collection. This parameter allocates space in heap for the young generation. If you have available memory, you can increase the –Xmn value to increase young generation size. This reduces the frequency of minor collections and gives short-lived objects in the young generation more time to die.

    Using the flag -verbose:gc shows each nursery, full GC, how much was collected, and how much of the heap is free.
    Adding -XX:+PrintGCDetails increases the level of detail.

    SurvivorRatio?The SurvivorRatio parameter controls the size of the two survivor spaces in the young generation. For example: -XX:SurvivorRatio=8 sets the ratio between each survivor space and eden to be 1:8.

    TargetSurvivorRatio?The default value of TargetSurvivorRatio is 50. Increasing this (for example, by setting -XX:TargetSurvivorRatio=90) will allow better utilization of survivor space memory.

    The NewRatio argument defines the ratio of the tenured generation to the young generation. The default value is 2, which means the tenured generation occupies 2/3 of the memory and the young generation occupies 1/3. By profiling your application you can tune this value to improve performance. For example, if the profile of the application shows the young generation occupancy as 20%, you can define –XX:NewRatio=4, so that the tenured generation occupies 4/5 of the memory and the young generation occupies 1/5.

    HOW TO READ GC LOG

    Minor Collection
    [GC [DefNew: 910K->12K(960K), 0.0003947 secs] 1239K->341K(5056K), 0.0005048 secs] [Times: user=0.00 sys=0.00, real=0.00 secs]
    [GC [DefNew: 908K->13K(960K), 0.0004003 secs] 1237K->341K(5056K), 0.0005126 secs] [Times: user=0.00 sys=0.00, real=0.00 secs]
    [GC [DefNew: 909K->14K(960K), 0.0005241 secs] 1237K->342K(5056K), 0.0006367 secs] [Times: user=0.00 sys=0.00, real=0.00 secs]
    Full Collection
    [Full GC [Tenured: 3485K->4095K(4096K), 0.1745373 secs] 61244K->7418K(63104K), [Perm : 10756K->10756K(12288K)], 0.1762129 secs] [Times: user=0.19 sys=0.00, real=0.19 secs]

    What does all of that mean?  The first three lines are young generation or minor collections.  These are usually quick, and happen quite frequently.  The various parts of the young generation include  Nursery, From space, and To space.  Allocations happen in the nursery, so applications that allocate heavily need a large nursery to improve performance.  In this case, the nursery is 960k and has around 909k worth of data before the collection and around 13k after the collection.  The total size of the young generation (Nursery + From Space + To Space) is 5056k; it has around 1237k worth of data before the collection and about 341k after the collection.  The last line shows a full collection.  The tenured space is 4096k and — in this case — objects were moved into tenured space but none were collected.  Here you might have a different problem, in which the tenured space is too small and should be increased to help give better performance.

     

    Extra Notes:
    – increase xmn (young space) would reduce the number of minor collection, throughput increase.
    – Decreasing the survivor ratio will increase the size of survivor spaces. Larger survivor spaces allow short-lived objects a longer time period to die in the young generation
    – Note: Do not use -XX:+UseParallelGC with -XX:+UseConcMarkSweepGC.
    –XX:NewRatio= OLD/(young+survivor+survivor2)