• CozWeAreFriends Banner. Nice isn't it?
  • CozWeAreFriends Banner. Nice isn't it?
  • Oracle SQL to generate maximum/high CPU on OVM Guest

    Posted on July 18th, 2015 by fath

    Hi All,

    There was a time during my project migrating our Oracle database servers to Oracle Virtual Machine (OVM) Guest (VM) that I had an issue regarding how the CPU works. Consider this scenario, you already provisioned 4 VCPUs to your guest running on Windows Server 2008 and then suddenly there is a need to increase the CPU since your Oracle database (oracle.exe) is starving for more processing power. What you did is simply increase the Guest’s VCPU on the fly through your OVM Manager console. The CPU somehow is reflected to your Windows OS (CPU in your task manager changed from 4 to 8 cores) but your oracle.exe process remained utilizing maximum 4 cores and not growing into the new 4 cores.

    I had searched through MOS and Google but cannot find much information related to the scenario except for some documentations regarding Guest sort-of bug but it however was affecting earlier version of OVM.

    Based on our testing in the environment, we found out that there’s no way to let our Oracle database process to switch to 8 VCPUs dynamically except after OS reboot. To test this, we had to ensure that our oracle.exe will initially consume maximum 4 CPUs and we tried to increase the VCPU afterwards.

    It was too bad that the database size was not that big hence I could not figure out how to simulate very high load in an easy way. So what I did was to use the following SQL so that the CPU retained at maximum all the time. I hope it will help anyone of you who is looking for the same answer.

    *Note: you may not want to run this in your production environment.

    SQL:
    select /*+ PARALLEL(100) */ distinct a.obj#, a.obj#
    from SOURCE$ a, WRH$_SYSMETRIC_HISTORY b



    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. 🙂