Monday, 5 October 2015

Microsoft Message Analyzer Tool - Free Download

Install and Configure:
1. Download MessageAnalyzer64.msi file from the above link and install. Installation is straight forward.
2. After installation, We have to configure a live trace session. https://technet.microsoft.com/en-us/library/jj659285.aspx
3. Communication on this link is encrypted. To decrypt the message we need to import rui.pfx file in the Analyzer tool. location of rui.pfx --> C:\ProgramData\VMware\VMware VirtualCenter\SSL\rui.pfx (Default passowrd - testpassword)https://technet.microsoft.com/en-us/library/Dn727244.aspx#BKMK_DecryptTraceData
4. Create a Capture filter to avoid unnecessary packets. At VC side requests from VCO are recceived at port 443, We can create a filter like this tcp.port==443 and *Address==<VCO IP Address> find more about creating filters at -https://technet.microsoft.com/en-us/library/JJ738055.aspx Above filter capture all incoming requests coming from VCO to VC on port 443.
5. Keep it running till issue stops occurring.

Tuesday, 5 May 2015

Oracle Kfed Utility to repair formatted asm disks

Error in Altering Data Group

ORA-15032: not all alterations performed
ORA-15040: diskgroup is incomplete
ORA-15042: ASM disk "13" is missing from group number "1" 


Problem Statement - Accidently formatted one of the member disk of the diskgroup using dd command
Impact - dd command formatted the disk thus losing the ASM header information and corrupting the whole diskgroup

Solution -

Repair the formatted disk with "kfed" utility provided by Oracle

cd $ORACLE_HOME/rdbms/lib
make -f ins* ikfed
$ORACLE_HOME/bin/kfed read /dev/rhdisk9
kfbh.endian:                          0 ; 0x000: 0x00
kfbh.hard:                            0 ; 0x001: 0x00
kfbh.type:                            0 ; 0x002: KFBTYP_INVALID
kfbh.datfmt:                          0 ; 0x003: 0x00
kfbh.block.blk:                       0 ; 0x004: blk=0
kfbh.block.obj:                       0 ; 0x008: file=0
kfbh.check:                           0 ; 0x00c: 0x00000000
kfbh.fcn.base:                        0 ; 0x010: 0x00000000
kfbh.fcn.wrap:                        0 ; 0x014: 0x00000000
kfbh.spare1:                          0 ; 0x018: 0x00000000
kfbh.spare2:                          0 ; 0x01c: 0x00000000
000000000 00000000 00000000 00000000 00000000  [................]
  Repeat 255 times
KFED-00322: Invalid content encountered during block traversal: [kfbtTraverseBlock][Invalid OSM block type][][0]


As you see disk /dev/rhdisk9 had issues since it was formatted. Now repair the disk using following command

$ORACLE_HOME/bin/kfed repair /dev/rhdisk9

Once it is done, you can mount the diskgroup and do the alterations on it.

Sunday, 16 February 2014

Error in Starting the Database - ORA-12547: TNS:lost contact



sqlplus / as sysdba

SQL*Plus: Release X.X.X.X Production on Sun Feb 16 21:00:43 2014

Copyright (c) 1982, 2013, Oracle.  All rights reserved.

ERROR:
ORA-12547: TNS:lost contact


Enter user-name:


On one fine day if you encounter above error suddenly (without messing up the Database much, :-) )
You would like to see the $ORACLE_HOME/bin/oracle binary permission and ownership

Permission to $ORACLE_HOME/bin/oracle binary should be 6751 and permission will be <oracle_user>:<oracle_group>, something like this

chmod 6751 $ORACLE_HOME/bin/oracle
chown oracle:dba  $ORACLE_HOME/bin/oracle

Above two commands should help start the database, just fine. 

Thursday, 15 August 2013

Tricky C questions

Tricky C questions
By admin | May 10, 2006

    How do you write a program which produces its own source code as its output?
    How can I find the day of the week given the date?
    Why doesn’t C have nested functions?
    What is the most efficient way to count the number of bits which are set in a value?
    How can I convert integers to binary or hexadecimal?
    How can I call a function, given its name as a string?
    How do I access command-line arguments?
    How can I return multiple values from a function?
    How can I invoke another program from within a C program?
    How can I access memory located at a certain address?
    How can I allocate arrays or structures bigger than 64K?
    How can I find out how much memory is available?
    How can I read a directory in a C program?
    How can I increase the allowable number of simultaneously open files?
    What’s wrong with the call fopen(”c:\newdir\file.dat”, “r”)?

what are storage-class specifier , auto/extern/static
How can you swap two integer variables without using a temporary?
1.12: What is sizeof('A') ?



A: The same as sizeof(int).  Character constants have type

 int in C.  (This is one area in which C++ differs.)

what is the return type of malloc.... it is void*
we need to typecast it to appropriate object.

char *p = malloc(n * sizeof(char));


How would you implement the va_arg() macro in

 <stdarg.h>?


1.24: State the declaration for a pointer to a function

 returning a pointer to char.



A: char *(*f)();

1.23: What do these declarations mean?



     int **a();

     int (*b)();

     int (*c[3])();

     int (*d)[10];



A: declare a as function returning pointer to pointer to int

 declare b as pointer to function returning int

 declare c as array of 3 pointers to functions returning int

 declare d as pointer to array of 10 ints



 The way to read these is "inside out," remembering that

 [] and () bind more tightly than *, unless overridden by

 explicit parentheses.


1.28: Consider these definitions:



     #define Push(val) (*stackp++ = (val))

     #define Pop() (*--stackp)



     int stack[100];

     int *stackp = stack;



 Now consider the expression



     Push(Pop() + Pop())



 1. What is the expression trying to do?  In what sort of

 program might such an expression be found?



 2. What are some deficiencies of this implementation?

 Under what circumstances might it fail?



A: The expression is apparently intended to pop two values

 from a stack, add them, and push the result.  This code

 might be found in a calculator program, or in the

 evaluation loop of the engine for a stack-based language.



 The implementation has at least four problems, however.

 The Push macro does not check for stack overflow; if more

 than 100 values are pushed, the results will be

 unpredictable.  Similarly, the the Pop macro does not

 check for stack underflow; an attempt to pop a value when

 the stack is empty will likewise result in undefined

 behavior.



 On a stylistic note, the stackp variable is global as far

 as the Push and Pop macros are concerned.  If it is

 certain that, in a particular program, only one stack

 will be used, this assumption may be a reasonable one,

 as it allows considerably more succinct invocations.

 If multiple stacks are a possibility, however, it might

 be preferable to pass the stack pointer as an argument

 to the Push and Pop macros.



 Finally, the most serious problem is that the "add"

 operation as shown above is *not* guaranteed to work!

 After macro expansion, it becomes



     (*stackp++ = ((*--stackp) + (*--stackp)))



 This expression modifies a single object more than once

 between sequence points; specifically, it modifies stackp

 three times.  It is not guaranteed to work; moreover,

 there are popular compilers (one is gcc) under which it

 *will* *not* work as expected.  (The extra parentheses

 do nothing to affect the evaluation order; in particular,

 they do not make it any more defined.)


how does printf works. what is the output of printf{"%d"'}


char *x = "abc";
char arr[] = {a,b,c};

sizeof(x) and sizeof(arr)

1.52: How can a header file be protected against being

 included multiple times (perhaps due to nested

 #include directives)?



A: The standard trick is to place lines like



     #ifndef headerfilename_H

     #define headerfilename_H



 at the beginning of the file, and an extra #endif at the

 end.


what is difference in header file and library
what is the return type of sizeof ... unsigned int or unsigned long int
what is memory leak...
malloc realloc... offset pointers


#define square(x) x*x
main()
{
int i;
i = 64/square(4);
printf("%d",i);
}

Answer:
64

Explanation:
the macro call square(4) will substituted by 4*4 so the expression becomes i = 64/4*4 . Since / and * has equal priority the expression will be evaluated as (64/4)*4 i.e. 16*4 = 64


Predict the output or error(s) for the following:

main()
{
int i;
printf("%d",scanf("%d",&i)); // value 10 is given as input here
}

Answer:
1

Explanation:
Scanf returns number of items successfully read and not 1/0. Here 10 is given as input which should have been scanned successfully. So number of items read is 1.

Configuring Disks for ASM

Configuring Disks for ASM

To configure disks for use with ASM on AIX, follow these steps:

    If necessary, install the shared disks that you intend to use for the ASM disk group and restart the system.

    To make sure that the disks are available, enter the following command on every node:

    # /usr/sbin/lsdev -Cc disk


    The output from this command is similar to the following:

    hdisk0 Available 1A-09-00-8,0  16 Bit LVD SCSI Disk Drive
    hdisk1 Available 1A-09-00-9,0  16 Bit LVD SCSI Disk Drive
    hdisk2 Available 17-08-L       SSA Logical Disk Drive


    If a disk is not listed as available on any node, enter the following command to configure the new disks:

    # /usr/sbin/cfgmgr


    Enter the following command on any node to identify the device names for the physical disks that you want to use:

    # /usr/sbin/lspv | grep -i none


    This command displays information similar to the following for each disk that is not configured in a volume group:

    hdisk2     0000078752249812   None


    In this example, hdisk2 is the device name of the disk and 0000078752249812 is the physical volume ID (PVID). The disks that you want to use might have a PVID, but they must not belong to a volume group.

    If a disk that you want to use for the disk group does not have a PVID, enter a command similar to the following to assign one to it:

    # /usr/sbin/chdev -l hdiskn -a pv=yes


    On each of the other nodes, enter a command similar to the following to identify the device name associated with each PVID on that node:

    # /usr/sbin/lspv | grep -i 0000078752249812


    Depending on how each node is configured, the device names might differ between nodes.

    To enable simultaneous access to a disk device from multiple nodes, you must set the appropriate Object Data Manager (ODM) attribute listed in the following table to the value shown, depending on the disk type:
    Disk Type     Attribute     Value
    SSA or FAStT disks     reserve_lock     no
    ESS, EMC, HDS, CLARiiON, or MPIO-capable disks     reserve_policy     no_reserve

    To determine whether the attribute has the correct value, enter a command similar to the following on all cluster nodes for each disk device that you want to use:

    # /usr/sbin/lsattr -E -l hdiskn

    If the required attribute is not set to the correct value on any node, enter a command similar to one of the following on that node:

        SSA and FAStT devices:

        # /usr/sbin/chdev -l hdiskn  -a reserve_lock=no


        ESS, EMC, HDS, CLARiiON, and MPIO-capable devices:

        # /usr/sbin/chdev -l hdiskn  -a reserve_policy=no_reserve


    Enter commands similar to the following on any node to clear the PVID from each disk device that you want to use:

    # /usr/sbin/chdev -l hdiskn -a pv=clear


    Enter commands similar to the following on every node to change the owner, group, and permissions on the character raw device file for each disk that you want to add to the disk group:

    # chown oracle:dba /dev/rhdiskn
    # chmod 660 /dev/rhdiskn


    Note:
    If you are using a multi-pathing disk driver with ASM, make sure that you set the permissions only on the correct logical device name for the disk.

    The device name associated with a disk might be different on other nodes. Make sure that you specify the correct device name on each node.

    If you also want to use raw devices for storage, refer to the "Configure Raw Devices" section.

    Otherwise, refer to the "Verify the Cluster Software Configuration" section.

ORA-12012: error on auto execute of job "ORACLE_OCM"."MGMT_CONFIG_JOB_2_1" ORA-29280: invalid directory path ORA-06512: at "ORACLE_OCM.MGMT_DB_LL_METRICS", line 2436 ORA-06512: at line 1

Errors in file $ORA_BASE/diag/rdbms/oastdb/oastdb1/trace/oastdb1_j001_22085770.trc:
ORA-12012: error on auto execute of job "ORACLE_OCM"."MGMT_CONFIG_JOB_2_1"
ORA-29280: invalid directory path
ORA-06512: at "ORACLE_OCM.MGMT_DB_LL_METRICS", line 2436
ORA-06512: at line 1
Tue May 22 22:15:12 2012


Following errors in the alert.log file:

ORA-12012: error on auto execute of job “ORACLE_OCM”.”MGMT_CONFIG_JOB_2_1?
ORA-29280: invalid directory path

This messages happen because of the OCM collection database job is unable to access the directory location where the OCM data is written .

you do not use OCM delete the OCM configuration from the database:

Log in to your database as user SYS and drop-cascade user ORACLE_OCM:
SQL> DROP USER ORACLE_OCM CASCADE;

If you using OCM to upload collection to My Oracle Support  please refer to note [ID 1378564.1 to re instrument your database


Ora-12012: Error On Auto Execute Of Job "Oracle_ocm"."Mgmt_config_job_2_1" [ID 1378564.1]
      Modified 13-DEC-2011     Type PROBLEM     Status PUBLISHED    

In this Document
  Symptoms
  Cause
  Solution

Applies to:
Oracle Configuration Manager - Version: 10.0.0 and later   [Release: and later ]
Information in this document applies to any platform.
Symptoms

Following errors in the alert.log file:

ORA-12012: error on auto execute of job "ORACLE_OCM"."MGMT_CONFIG_JOB_2_1"
ORA-29283: invalid file operation
Cause

The CM database job is out of sync with the OCM



Solution

This messages happen because of the OCM collection database job is unable to access the directory location where the OCM data is written .


If you using OCM to upload collection to My Oracle Support please re instrument the database:

1. export ORACLE_HOME=<path to the database home>
    export ORACLE_SID=<Database SID>

2.  Please remove the OCM configuration in the database:

     cd $ORACLE_HOME/ccr/bin
     ./configCCR -r

3. Please configure the OCM configuration in the database:

    ./configCCR -a <CSI> <MyOracleSupport ID>

4.  Instrument the Database:

     cd /ccr/admin/scripts
     ./installCCRSQL.sh collectconfig -s <SID> -r SYS

5.  Run a manual collection:

    cd $ORACLE_HOME/ccr/bin
    ./emCCR collect

If you do not use OCM delete the OCM configuration from the database:

Log in to your database as user SYS and drop-cascade user ORACLE_OCM:
SQL> DROP USER ORACLE_OCM CASCADE;

Error to start dbconsole in Oracle 10gR2 on AIX

Error to start dbconsole. Getting Following error while running dbca

Could not complete the Enterprise Manager configuration.
Enterprise manager configuration failed due to the following error -
Error starting Database Control

Metalink note suggests it is due to CS certificate expired, Need to apply Patch 8350262