how to access oracle sga directly with c code

Zamong is free  oracle monitoring software with DMA method.

dma_picture

What is Direct oracle sga Memory Access ?

This example is from an AIX environment.
On linux, address value is differ from aix.

SQL>  select * from x$ksmmem  where rownum < 10 ;

ADDR                   INDX    INST_ID KSMMMVAL
---------------- ---------- ---------- ----------------
0700000000000000          0          1 00
0700000000000008          1          1 0700000514334020
0700000000000010          2          1 00
0700000000000018          3          1 00
0700000000000020          4          1 00
0700000000000028          5          1 00
0700000000000030          6          1 00
0700000000000038          7          1 00
0700000000000040          8          1 00

9 rows selected.

“0700000000000000” address is sga start address.

oracle@PaCG:/oracle> ipcs -mba
IPC status from /dev/mem as of Thu 
T        ID     KEY        MODE       OWNER    GROUP  CREATOR   CGROUP NATTCH     SEGSZ  CPID  LPID   ATIME    DTIME    CTIME 
Shared Memory:
m   1048576   00000000 --rw-r-----     grid      dba     grid      dba     32 318767104 4456886 58524018 21:41:51 21:41:51  5:38:14
m   5242882   00000000 --rw-r-----     grid      dba     grid      dba     32   3678208 4456886 58524018 21:41:51 21:41:51  5:38:14
m         3 0x8895c820 --rw-r-----     grid      dba     grid      dba     32      8192 4456886 58524018 21:41:51 21:41:51  5:38:14
m   1048581 0x3bea2a94 --rw-r-----   oracle      dba   oracle      dba   2404     16384 9371670 23593476 21:55:27 21:55:27  6:00:24
m   1048582   00000000 --rw-r-----   oracle      dba   oracle      dba   2404 21340618752 9371670 23593476 21:55:27 21:55:27  6:00:24
m   3145735   00000000 --rw-r-----   oracle      dba   oracle      dba   2404 134217728 9371670 23593476 21:55:27 21:55:27  6:00:24

shared memory id : 3145735

This is simple example of attaching oracle shared memory.

aix oracle 12c Installation Fails, rtld: 0712-001 Symbol CreateIoCompletionPort was referenced

when you create database with dbca

UnsatisfiedLinkError exception loading native library: njni12
java.lang.UnsatisfiedLinkError: njni12 (rtld: 0712-001 Symbol CreateIoCompletionPort was referenced
from module /u01/products/rdbms_12102/lib/libnjni12.so(), but a runtime definition
of the symbol was not found.
rtld: 0712-001 Symbol GetMultipleCompletionStatus was referenced
from module /u01/products/rdbms_12102/lib/libnjni12.so(), but a runtime definition
of the symbol was not found.
rtld: 0712-002 fatal error: exiting.)
Exception in thread "main" java.lang.UnsatisfiedLinkError: oracle/net/common/NetGetEnv.get(Ljava/lang/String;)Ljava/lang/String;

The installation logs shows the following relink error:

exec(): 0509-036 Cannot load program sqlplus because of the following errors:
rtld: 0712-001 Symbol CreateIoCompletionPort was referenced
from module /appl/oracle/product/12.1.0/dbhome_1/lib/libttsh12.so(), but a runtime definition
of the symbol was not found.
rtld: 0712-001 Symbol GetMultipleCompletionStatus was referenced
from module /appl/oracle/product/12.1.0/dbhome_1/lib/libttsh12.so(), but a runtime definition
of the symbol was not found.
rtld: 0712-002 fatal error: exiting.

sqlplus , lsnrctl command fails with below error

exec(): 0509-036 Cannot load program sqlplus because of the following errors:
rtld: 0712-001 Symbol CreateIoCompletionPort was referenced
from module /appl/oracle/product/12.1.0/dbhome_1/lib/libttsh12.so(), but a runtime definition
of the symbol was not found.
rtld: 0712-001 Symbol GetMultipleCompletionStatus was referenced
from module /appl/oracle/product/12.1.0/dbhome_1/lib/libttsh12.so(), but a runtime definition
of the symbol was not found.
rtld: 0712-002 fatal error: exiting.


IOCP module should be enabled on the server.

$ lsdev | grep iocp
  iocp0       Defined  I/O Completion Ports

   By default, IOCP is set to Defined.

Enable the “iocp” option and relink the oracle binaries.
To enable IOCP, set IOCP to Available using the following procedure:

Log in as root and run the following command:

# smitty iocp
Select Change / Show Characteristics of I/O Completion Ports.

Change configured state at system restart from Defined to Available.

Run the lsdev command to confirm the IOCP status is set to Available:

$ lsdev | grep iocp
iocp0 Available I/O Completion Ports

Perform a system restart to make the changes permanent.

Relink the binaries using " relink all " and then root.sh as root user.

There is no impact on Existing Oracle Databases installed on server if IOCP status is set to Available.

Zamong is free  oracle monitoring software with DMA method.

dma_picture

AIX “oslevel -s ” numbers mean

If your system is running AIX 5.3 TL 6 or anything later, “oslevel -s” will look something like this: 6100-02-06-0943. Breaking that down, the first four numbers show the AIX base level. In this example, it’s 6100, which means we’re running AIX 6.1. Next is the Technology Level (TL), followed by the number of the Service Pack (SP).The last four digits show the release date of the Service Pack using the format YYWW (YY for the year, then WW for the week of the year). So, if your “oslevel -s” command reports 6100-02-06-0943, then you know you’re on AIX 6.1, running TL 2, with SP 6. The “0943” tells you that Service Pack came out in week 43 of 2009. It’s time to update your system.

RAC with asm on AIX, CSS Initialization wait event , ORA-01114 error


Need to check the oracle bug : OCSSD threads are not set to the correct priority.
[oracle document id : 1493943.1]
OCSSD.BIN threads must be running in Real-Time.


SOLUTION :
1. bug 13940331, fixed in 11.2.0.4, request/apply patch 13940331 if it affects business.
2. bug 16586971, fixed in 12.1.0.2, request/apply patch 13940331 if it affects business.

/usr/sysv/bin/ps -eLo user,s,pid,lwp,pri,args | grep ocss

[on AIX]
/usr/sysv/bin/ps -eLo  user,s,pid,lwp,pri,args | grep ocss 
       grid S   6947068  16187409  60 /data/grid/bin/ocssd.bin  
       grid S   6947068  25690307   0 /data/grid/bin/ocssd.bin  


60 is not real time priority.

1. Our Environment

  • 11g RAC (with asm) R2 on AIX
  • version : 11.2.0.3

2. Our Symptoms

  • Session is waiting for a long time, “CSS Initialization” 
  • ORA-01114 raised
  • Database alert log
  • Tue Oct 02 16:02:39 2012
    Errors in file mydb_ora_55707154.trc:
    ORA-01114: IO error writing block to file (block # )
  • Trace file
2012-09-02 16:02:39.409: [ CSSCLNT]clssscConnect: gipcWait failed with 16 (12)
2012-09-02 16:02:39.409: [ CSSCLNT]clsssInitNative: connect to (ADDRESS=(PROTOCOL=tcp)(HOST=127.0.0.1)(PORT=61100)) failed, rc 16
kgxgncin: CLSS init failed with status 3
kgxgncin: return status 3 (1311719766 SKGXN not av) from CLSS
kjfmsgr: unable to connect to NM for reg in shared group
ORA-01114 .....
  • ocssd.log
  • 2012-10-02 16:01:25.645: [GIPCXCPT][1029] gipcmodClscCallback: async request failed req 122591870 [0000000000737522] { gipcSendRequest : addr '', data 122174250, len 48, olen 0, parentEndp 128bd5250, ret gipcretConnectionLost (12), objFlags 0x0, reqFlags 0x224 }, ret gipcretConnectionLost (12)
    2012-10-02 16:01:25.648: [GIPCXCPT][1029] gipcmodMuxTransferAccept: internal accept request failed endp 111274cd0, child 128bd5250, ret gipcretConnectionInvalid (13)
    2012-10-02 16:01:25.648: [ GIPCMUX][1029] gipcmodMuxTransferAccept: EXCEPTION[ ret gipcretConnectionInvalid (13) ] error during accept on endp 111274cd0
    2012-10-02 16:01:25.649: [GIPCXCPT][1029] gipcmodClscCallback: async request failed req 1221466b0 [000000000073754d] { gipcSendRequest : addr '', data 1157026f0, len 48, olen 0, parentEndp 128eeae10, ret gipcretConnectionLost (12), objFlags 0x0, reqFlags 0x224 }, ret gipcretConnectionLost (12)
    2012-10-02 16:01:25.650: [GIPCXCPT][1029] gipcmodMuxTransferAccept: internal accept request failed endp 111274cd0, child 128eeae10, ret gipcretConnectionInvalid (13)
    2012-10-02 16:01:25.650: [ GIPCMUX][1029] gipcmodMuxTransferAccept: EXCEPTION[ ret gipcretConnectionInvalid (13) ] error during accept on endp 111274cd0

    AIX command for DBA

    What do all those numbers mean on oslevel -s ?
    first four numbers show the AIX base level. Next is the Technology Level (TL), followed by the number of the Service Pack (SP).

    how to check if a fix is installed on aix

      server1:/home/aixuser> instfix -i | grep IV48087    
        All filesets for IV48087 were found.
    

    lists installed software products (fileset)

      server1:/home/aixuser> lslpp -L | grep bos
      bos.64bit                 7.1.3.45    C     F    Base Operating System 64 bit
      bos.acct                  7.1.3.45    C     F    Accounting Services
      bos.adt.base              7.1.3.45    C     F    Base Application Development
      bos.adt.data               7.1.0.0    C     F    Base Application Development
      bos.adt.debug             7.1.3.45    C     F    Base Application Development
      .......
    

    display physical volume 

     server1:/home/aixuser> lspv
    hdisk0          00f754ed016d9c0a                    rootvg          active      
    hdisk1          00f754ed07c6d35d                    rootvg          active       
    hdisk2          none                                None                        
    hdisk4          none                                None                        
    hdisk5          none                                None                        
    hdisk6          none                                None                        
    hdisk7          none                                None                        
    hdisk8          none                                None                        
    hdisk9          none                                None                        
    hdisk10         none                                None                        
    hdisk11         none                                None                        
    hdisk12         none                                None                        
    hdiskpower0     00f754eddf167b65                    vg00            active      
    hdiskpower1     00f754eddf1aa617                    vg00            active      
    hdiskpower2     00f754eddf1ef78f                    vg00            active      
    hdiskpower3     00f754eddf138e5a                    vg00            active      
    hdiskpower4     00f754eddf17939e                    vg00            active
    

    physical volume size

     server1:/home/aixuser> bootinfo  -s hdisk4
      153600
    

    check reserve policy

     server1:/home/aixuser> lsattr -El hdisk10
    PR_key_value   none               Reserve Device on open           True
    clr_q          no                 Device CLEARS its Queue on error True
    location                          Location Label                   True
    lun_id         0x2000000000000    Logical Unit Number ID           False
    lun_reset_spt  yes                FC Forced Open LUN               True
    max_coalesce   0x100000           Maximum Coalesce Size            True
    max_retries    5                  Maximum Number of Retries        True
    max_transfer   0x100000           Maximum TRANSFER Size            True
    node_name      0x50060160c1e0ac34 FC Node Name                     False
    pvid           none               Physical volume identifier       False
    q_err          yes                Use QERR bit                     True
    q_type         simple             Queue TYPE                       True
    queue_depth    32                 Queue DEPTH                      True
    reassign_to    120                REASSIGN time out value          True
    reserve_policy single_path        Reserve Device on open           True
    rw_timeout     30                 READ/WRITE time out value        True
    scsi_id        0xef               SCSI ID                          False
    start_timeout  60                 START UNIT time out value        True
    ww_name        0x5006016141e0ac34 FC World Wide Name               False
    

    display EMC storage powerpath device

    server1:/home/aixuser> powermt display dev=all
    Pseudo name=hdiskpower0
    CLARiiON ID=CK200081101044 [server1]
    Logical device ID=60060160DF621A008601684F9981E511 [LUN 0]
    state=alive; policy=CLAROpt; queued-IOs=0
    Owner: default=SP A, current=SP A       Array failover mode: 3
    ==============================================================================
    --------------- Host ---------------   - Stor -  -- I/O Path --   -- Stats ---
    ###  HW Path               I/O Paths    Interf.  Mode     State   Q-IOs Errors
    ==============================================================================
    1 fscsi2                 hdisk8      SP A1    active   alive      0      0
    0 fscsi0                 hdisk2      SP B1    active   alive      0      0
    
    Pseudo name=hdiskpower1
    CLARiiON ID=CK200081101044 [server1]
    Logical device ID=60060160DF621A00F2B751709981E511 [LUN 2]
    state=alive; policy=CLAROpt; queued-IOs=0
    Owner: default=SP A, current=SP A       Array failover mode: 3
    ==============================================================================
    --------------- Host ---------------   - Stor -  -- I/O Path --   -- Stats ---
    ###  HW Path               I/O Paths    Interf.  Mode     State   Q-IOs Errors
    ==============================================================================
    1 fscsi2                 hdisk9      SP A1    active   alive      0      0
    0 fscsi0                 hdisk4      SP B1    active   alive      0      0
    
    ................
    

    disk  device

     server1:/home/aixuser> lsdev -Cc disk
    hdisk0 Available 00-00-00 SAS Disk Drive
    hdisk1 Available 00-00-00 SAS Disk Drive
    hdisk2 Available 00-00-00 SAS Disk Drive
    hdisk3 Available 00-00-00 SAS Disk Drive
    hdisk4 Available 05-00-02 EMC CLARiiON FCP RAID 1/0 Disk
    hdisk5 Available 05-00-02 EMC CLARiiON FCP RAID 1/0 Disk
    hdisk6 Available 05-00-02 EMC CLARiiON FCP RAID 1/0 Disk
    hdisk7 Available 06-00-02 EMC CLARiiON FCP RAID 1/0 Disk
    hdisk8 Available 06-00-02 EMC CLARiiON FCP RAID 1/0 Disk
    hdisk9 Available 06-00-02 EMC CLARiiON FCP RAID 1/0 Disk
    hdiskpower0 Available 06-00-02 PowerPath Device
    hdiskpower1 Available 06-00-02 PowerPath Device
    hdiskpower2 Available 06-00-02 PowerPath Device
    

    tape device

     server1:/home/aixuser> lsdev -Cc tape
    rmt0 Available 00-00-00 SAS 4mm Tape Drive
    rmt1 Available 07-00-02 Other FC SCSI Tape Drive
    rmt2 Available 07-00-02 Other FC SCSI Tape Drive
    rmt3 Available 07-00-02 Other FC SCSI Tape Drive
    rmt4 Available 07-00-02 Other FC SCSI Tape Drive
    

    how to check iocp configuration for oracle 12c installation
    The resulting output should match the following example:

    server1:/home/aixuser> lsdev -C | grep iocp
    iocp0       Available               I/O Completion Ports