Pages

Wednesday, August 13, 2014

Oracle Certified Professional Java SE 8 Upgrade Exam

The certification for Java SE 8 is not yet available, but here are the "What's New" from the JDK 8 release, and are candidates for the upgrade exam preparation:
There are several other updates in Security, JavaFX, Tools, etc., but we will wait and see if they make it to the upgrade certification syllabus.

Details on Oracle certification can be accessed from the Certification tab on http://education.oracle.com
 
References:

Tuesday, July 22, 2014

Creating SVN for Existing or New Project


Step 1: Create a directory where the repository will be maintained
mkdir /opt/svnrepos
cd /opt/svnrepos
svnadmin create projectName

Step 2: Add project to SVN
#Create project directory if it does not exist
mkdir /home/user/projectName
svn import /home/user/projectName file:///opt/svnrepos/projectName -m "Initial commit of project"

Step 3: Checkout project and start using SVN
cd /home/user/workspace
svn co file:///opt/svnrepos/projectName
cd projectName
svn status
svn log
For more frequently used SVN commands, see previous post here.

Monday, March 24, 2014

Difference in interrupt counts from /proc/interrupts


The following python script can be used to determine interrupt counts occurred between the before and after "cat /proc/interrupts":

#!/usr/bin/python
'Interrupt counts between before and after /proc/interrupts snapshots'

import sys
from itertools import izip

def checkUsage():
    #Check Usage
    if len(sys.argv) < 3:
        print "Usage ->"
        print sys.argv[0]," </proc/interrupts before> </proc/interrupts after>"

def readFiles(fileName1, fileName2):
    fileA = open(fileName1)
    fileB = open(fileName2)
    for lineA, lineB in izip(fileA, fileB):
        wordsA = lineA.rstrip().split()
        wordsB = lineB.rstrip().split()
        for wordA, wordB in izip(wordsA, wordsB):
            if wordA.isdigit() and wordB.isdigit():
                sys.stdout.write("%s%s" % (str(int(wordB) - int(wordA)),"\t"))
            else:
                sys.stdout.write("%s%s" % (wordB," "))
        print

def main():
    checkUsage()
    #readFile(sys.argv[1])
    readFiles(sys.argv[1], sys.argv[2])

#Don't execute if script is imported instead of executed
if __name__ == '__main__':
    main()

Please leave me a comment if you find this post helpful.

Wednesday, March 5, 2014

Oracle RDBMS tips


Monitoring

Tables/Indexes

  • desc user_tables
  • desc user_indexes

DB CPU

  • V$SYSSTAT: Oracle CPU usage for all sessions. The parse time cpu statistic shows the total CPU time used for parsing.
  • V$SESSTAT: Oracle CPU usage for each session. 
  • select * from v$resource_limit;
  • select count(*) from V$process;

Wait Events

  • db file sequential read: usually single block INDEXED reads [1]. Faster disks or more spindles will help. Larger buffer cache may help.
  • db file scattered read
  • db file single write
  • db file parallel write
  • log file parallel write

Latches

  • HW enq
  • Latch: Cache Buffer Chain - Ref [2]
    -- Find memory address:
    SELECT 
          addr,
          sleeps
    FROM 
          v$latch_children c,
          v$latchname n
    WHERE
          n.name='cache buffers chains' and
          c.latch#=n.latch# and
          sleeps > 100
    ORDER BY sleeps;
    
    -- Find file and block numbers:
    
    SELECT file#, dbablk, class, state, TCH
      FROM X$BH
      WHERE HLADDR='address of latch';
    -- Find segment name from dba_segments
Data/Log/Sys Files

  • select name from v$datafile;
  • select name from v$controlfile;
  • select member from v$logfile;


Performance Tuning Recommendations

  • #Transactions = based on the application, the number of concurrent transactions that can occur
  • #Sessions = (1.1 * PROCESSES) + 5
  • DML_LOCKS = #Transactions * (avg #SQLs per transaction)
  • REPLICATION_DEPENDENCY_TRACKING: disable where replication is not required as skipping tracking generation will make read/write operations faster  

Recovery


References

[1] http://asktom.oracle.com/pls/asktom/f?p=100:11:0:::%3AP11_QUESTION_ID:6265095774206
[2] https://docs.oracle.com/cd/B16240_01/doc/doc.102/e16282/oracle_database_help/oracle_database_wait_bottlenecks_latch_cache_buffer_chains_pct.html

Monday, January 20, 2014

Avoiding SSH delay


# Enable verbose mode in ssh to determine where the hang is

[local-host]$ ssh -v <remote-host>

It will result in the following:
debug1: Reading configuration data /etc/ssh/ssh_config
debug1: Applying options for *
debug1: Connecting to <remote-host> [<remote-IP>] port 22.
debug1: Connection established.
debug1: permanently_set_uid: 0/0
debug1: identity file /root/.ssh/id_rsa type -1
debug1: identity file /root/.ssh/id_dsa type -1
debug1: loaded 2 keys
debug1: Remote protocol version 2.0, remote software version OpenSSH_4.3
debug1: match: OpenSSH_4.3 pat OpenSSH*
debug1: Enabling compatibility mode for protocol 2.0
debug1: Local version string SSH-2.0-OpenSSH_4.3
debug1: SSH2_MSG_KEXINIT sent
debug1: SSH2_MSG_KEXINIT received
debug1: kex: server->client <port1> <port2> none
debug1: kex: client->server <port1> <port2> none
debug1: SSH2_MSG_KEX_DH_GEX_REQUEST(1024<2048<8192) sent
debug1: expecting SSH2_MSG_KEX_DH_GEX_GROUP
debug1: SSH2_MSG_KEX_DH_GEX_INIT sent
debug1: expecting SSH2_MSG_KEX_DH_GEX_REPLY
debug1: Host '<remote-host>' is known and matches the RSA host key.
debug1: Found key in /root/.ssh/known_hosts:33
debug1: ssh_rsa_verify: signature correct
debug1: SSH2_MSG_NEWKEYS sent
debug1: expecting SSH2_MSG_NEWKEYS
debug1: SSH2_MSG_NEWKEYS received
debug1: SSH2_MSG_SERVICE_REQUEST sent
debug1: SSH2_MSG_SERVICE_ACCEPT received
debug1: Authentications that can continue: publickey,password
debug1: Next authentication method: publickey
debug1: Trying private key: /root/.ssh/id_rsa
debug1: Trying private key: /root/.ssh/id_dsa
debug1: Next authentication method: password
root@<remote-host>'s password:

Sometimes the ssh appears to hang / wait for a while at the line in bold above. It is usually due to the UseDNS - default is yes. Disabling it and restarting sshd on the remote-host should fix this delay in ssh:

Add the following line in bold to /etc/ssh/sshd_config on remote-host:
#      UseDNS  Specifies whether sshd should look up the remote host name and
#      check that the resolved host name for the remote IP address maps
#      back to the very same IP address.The default is "yes".
UseDNS no

Restart sshd on the remote-host:
[remote-host]$ service sshd restart