Skip to main content


Showing posts from 2012

JBOSS7 Logging with Size Rotating

To change jboss7 log rotating from periodic to size base, comment periodic-rotating-file-handler and insert the following size-rotating-file-handler into standalone.xml

HTML parser for Java

There are a lot of tools and libraries for parsing html in java language. One of them is HTML Parser. HTML Parser is a Java library used to parse HTML. It is used for transformation or extraction, it features filters, visitors, custom tags and easy to use JavaBeans. It is a fast, robust and well tested package.

MSSQL Server Differential Backup Failure

Date  Log Job History (TestDB_Maintenance_Plan.TestDB_Diff_Subplan) Step ID 1 Server TestSRV Job Name TestDB_Maintenance_Plan.TestDB_Diff_Subplan Step Name TestDB_Diff_Subplan Duration 00:00:05 Sql Severity 0 Sql Message ID 0 Operator Emailed  Operator Net sent  Operator Paged  Retries Attempted 0

Shell script for getting total amount of the system memory

In order to get total amount of the system memory as GigaByte in a bash script:
#!/bin/bash mem_line=`cat /proc/meminfo |grep MemTotal` mem_kb=`echo $mem_line | tr -cd '[[:digit:]]'` mem_gb=$(awk "BEGIN{print $mem_kb/1024/1024}") echo "System Memory (KB): "$mem_kb echo "System Memory (GB): "$mem_gb

Linux shell script get file timestamp as seconds

This is accomplished using stat command. -c parameter is for the specified FORMAT instead of the default %Y is for the Time of last modification as seconds since Epoch
#!/bin/bash $file="/tmp/testfile" file_time_stamp=$(stat -c %Y $file) echo $file_time_stamp

Shell script generate random number

$RANDOM can be used for generating random number in bash. $RANDOM generate an integer value. For example if you want to generate number as minutes, the command just like:
# echo $[ RANDOM % 60 ] 34

Oracle Analytic Functions

AVG(expression) : Returns average value of expression
CORR(expression1, expression2) : Returns the coefficient of correlation of a set of number pairs
COVAR_POP(expression1, expression2) : Returns the population covariance of a set of number pairs
COVAR_SAMP(expression1, expression2) : Returns the sample covariance of a set of number pairs
COUNT(expression) : Returns the number of rows returned by the query

Using dig tool on windows

dig is one of the finest dns tools for unix and linux admins. ISC (Internet Systems Consortium) provides windows binary for the dig tool. In order to use it from windows machine, download bind zip file from downloads site. Then extract following files to your local folder that is already in your %PATH% environment variable or create a folder in the program files folder and add it to the %PATH% environment variable so you can use it from command line without writing the full path.

ORA-39083 and ORA-02298

ORA-39083: Object type REF_CONSTRAINT failed to create with error: ORA-02298: cannot validate <constraint_name> - parent keys not found Failing sql is: ALTER TABLE <detail_table_name> ADD CONSTRAINT <constraint_name> FOREIGN KEY <detail_table_column_name> REFERENCES <master_table_name> <master_table_column_name> ENABLE

Kinit failed

winbindd[2753] libsmb/cliconnect.c:1052(cli_session_setup_spnego)
Kinit failed: Clock skew too great

if you encounter this message and can not login via ssh using AD account. This is most probably because server's date and time are not set correctly.

Jboss installation script for Redhat Enterprise linux

First, prepare following files under the Jboss installation folder. Jboss AS zip packages are availeble at and java jdk packages are available at

What is VegaDNS?

VegaDNS is the web based tinydns admin tool for configuring DNS records from a web browser.

It has some good features:
Can be accessed with Admin and User levels
Multiple domains can be imported using AXFR
Has a template engine for separation of PHP from HTML
Configurable Default Records to auto-populate new domains with
It is Free
PHP4 (register_globals and safe_mode must be Off for security), MySQL, djbdns, ucspi-tcp, daemontools, wget must be installed.

Installing chrome in fedora

For installing chrome vith yum you just have to: Open a terminal window and type for corresponding cpu architecture:
i386 yum localinstall --nogpgcheck -y
x86_64 yum localinstall --nogpgcheck -y

JBoss Application Server is getting a new name

Your Voice Matters! Submit your names here.
When the JBoss Application Server (JBoss AS) project was launched in 1999, no one could have guessed how successful it would become. Today, you will not only find a successful project (JBoss AS), but also a large and vibrant community (the JBoss Community) and a successful product (JBoss Enterprise Application Platform).

Jboss JMX client twiddle

Twiddle is a command line tool that interact with JMX server instance. For linux systems is under $JBOSS_HOME\bin directory. Usage can be learned typing ./ -h from command line.

./ -h
A JMX client to 'twiddle' with a remote JBoss server.

SQL Server Agent 15404 Error

If you encounter in the Sql Server Agent Log "SQLServer Error: 15404, Could not obtain information about Windows NT group/user 'ISTMRKSQLHOST\Administrator', error code 0x534. [SQLSTATE 42000] (ConnIsLoginSysAdmin)" this is related with Sql Server Agent job security.
Open Sql Server Management Studio, go to Object Explorer select Jobs under SQL Server Agent. Find your Maintenance Plan and right click on it, select Properties. On the General Page change Owner to 'sa'. Then execute the maintenance plan again.

tmpfs size is returning old value after reboot

On Redhat EL 6 /dev/shm is returning the old value even if it is specified in the fstab. This is because tmpfs is never remounted during the boot process. Resolution for this is simply adding remount command to /etc/rc.local file.
eg: mount -o remount,size=5G /dev/shm

hdparm command usage example

hdparm command should be executed with root privileges. The following is an example for cached read and buffered disk read.

# hdparm -Tt /dev/mapper/mpath1

Timing cached reads: 2832 MB in 2.00 seconds = 1415.46 MB/sec
Timing buffered disk reads: 74 MB in 3.10 seconds = 23.85 MB/sec

winsxs folder is large

When viewing size of the Windows directory, users may notice that the C:\Windows\winsxs directory appears to be taking up large amounts of disk space.


NAME        bash,  :,  ., [, alias, bg, bind, break, builtin, cd, command, compgen,        complete, continue, declare, dirs, disown, echo, enable,  eval, exec,        exit,  export,  fc,  fg, getopts, hash, help, history, jobs, kill, let,        local, logout, popd, printf, pushd, pwd, read, readonly, return,  set,        shift,  shopt,  source,suspend,  test, times, trap,type, typeset,        ulimit, umask, unalias, unset,  wait  -bash  built-incommands,  see        bash(1)

Secondary dns zone transfer from tinydns to bind

First create necessary users: # useradd dnslog # useradd axfrdns
axfrdns-conf command creates axfrdns configuration files and folders: (env, log, Makefile, run, tcp) # axfrdns-conf axfrdns dnslog /etc/axfrdns /etc/tinydns <tiny dns server ip address>

Redhat linux default runlevels

Default runlevel. The runlevels used by RHS are:
0 - halt (Do NOT set initdefault to this) 1 - Single user mode 2 - Multiuser, without NFS (The same as 3, if you do not have networking) 3 - Full multiuser mode 4 - unused 5 - X11 6 - reboot (Do NOT set initdefault to this)

last command man page

LAST,LASTB(1)      Linux System Administrator’s Manual LAST,LASTB(1)

NAME        last, lastb - show listing of last logged in users

Redhat Linux ssh login using Active Directory Account

DNS infrastructure should work well In order that winbind funcitons properly. So check it first. # host -t srv has SRV record 0 100 88 has SRV record 0 100 88 
Necessary packages should be installed. # yum installauthconfigpam_krb5samba-common

Creating a JEE project in eclipse with JBoss

From the eclipse menu: Select File > New > Other

ToolKit for Oracle Database

OraToolKit is a collection of tools to ease and optimize Oracle setups throughout the whole lifecycle. With its all-purpose usage it can also be called "The Swiss Army Knife for Oracle". Released as open source software it provides to companies using Oracle database technology many benefits. Those can be seen from financial, efficiency as well as from usability point of view. Goal of this open source project is to help reducing total cost of ownership (TCO) when running Oracle on Unix based systems. Supported are currently Linux and Solaris. In Q3/Q4 there there will be a new OTK release which will support IBM AIX as well as HP-UX. Future releases of an OTK light running on Microsoft Windows operating systems may not be excluded.

host utility for redhat linux

host is a simple utility for performing DNS lookups. In order to use it dnsutil package should be installed on redhat systems.
For example if you want to check kerberos srv records from AD (Active Directory) infrastructure.
# host -t srv _kerberos._tcp.example.local _kerberos._tcp.example.local has SRV record 0 100 88 srv1.example.local. _kerberos._tcp.example.local has SRV record 0 100 88 srv2.example.local. _kerberos._tcp.example.local has SRV record 0 100 88 srv3.example.local. _kerberos._tcp.example.local has SRV record 0 100 88 srv4.example.local.

hostname command man page

HOSTNAME(1)   Linux Programmer’s Manual   HOSTNAME(1)

NAME        hostname - show or set the system’s host name        domainname - show or set the system’s NIS/YP domain name        dnsdomainname - show the system’s DNS domain name        nisdomainname - show or set system’s NIS/YP domain name        ypdomainname - show or set the system’s NIS/YP domain name

Mysql server memory variables

join_buffer_size: (PER SESSION) Controls the amount of memory allocated to perform joins on tables that have no keys which can be used to perform a condition filter. Allocated for each table joined without necessary filter conditions.
key_buffer_size: (GLOBAL) (MyISAM-only) Controls the amount of memory allocated to the MyISAM index key cache.


To administrate SELinux on a linux box you should have to know some basics of SELinux: Viewing and changing SELinux statesViewing and changing SELinux security contextViewing SELinux violation messagesViewing and changing the state of SELinux booleansUsing basic features of the SELinux gui tool

Oracle http-web-access.log file is growing in the long run

http-web-access.log file is in the $ORACLE_HOME/oc4j/j2ee/OC4J_DBConsole_<host>_<sid>/log directory. This log file grows in the long run and can be managed from $ORACLE_HOME/oc4j/j2ee/OC4J_DBConsole_<host>_<sid>/config/http-web-site.xml file.

<?xml version = '1.0' standalone = 'yes'?>
<!DOCTYPE web-site PUBLIC "OracleAS XML Web-site" "">

Hosting images from specific domain on jboss

When it is supposed to host static contents from the same jboss server and additionally host them from multiple domains, new <Host> sections should be defined in the server.xml file. Server.xml file is at /<jboss-home>/deploy/jboss-web.deployer folder in the 4.2 version.

Redhat's OpenShift Cloud Experience

Redhat's OpenShift project describes itself "OpenShift is Red Hat's free, auto-scaling Platform as a Service (PaaS) for applications. As an application platform in the cloud, OpenShift manages the stack so you can focus on your code." OpenShift uses the Secure Shell (SSH) network protocol to manage your cloud environment. I will give some example commands and results. Cygwin terminal can be used on windows systems. I want to create a namespace and application.

iptables command man page


NAME        iptables - administration tool for IPv4 packet filtering and NAT
SYNOPSIS        iptables [-t table] -[AD] chain rule-specification [options]        iptables [-t table] -I chain [rulenum] rule-specification [options]        iptables [-t table] -R chain rulenum rule-specification [options]        iptables [-t table] -D chain rulenum [options]        iptables [-t table] -[LFZ] [chain] [options]        iptables [-t table] -N chain        iptables [-t table] -X [chain]        iptables [-t table] -P chain target [options]        iptables [-t table] -E old-chain-name new-chain-name

Sending jboss log4j logs to remote syslog server

Since the following modifications are made on the conf/jboss-log4j.xml file, jboss apllication middleware logs can be sent to a remote syslog server:

Coment out SYSLOG section and change necessary values according to yours, on the syslog server there are some log facilities as LOCAL0..7 for customizing logs. Choose one of them:   <appender name="SYSLOG" class="">

adduser command man page

USERADD(8)  System Management Commands    USERADD(8)

NAME        useradd - create a new user or update default new user information

Java execute remote ssh command jcraft jsch example

JSch is a famous Java implementation of SSHv2. Below is an example of a running simple ifconfig command on a linux host from a webapp:
<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8" %>
<%@ page import="java.util.*" %> <%@ page import="*" %> <%@ page import="com.jcraft.jsch.*" %> <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" ""> <html> <head> <title>Remote Ssh</title> </head> <body> <% String sshHost = "sshhost"; int sshPort = 22;

An IBM SVC Experience

The company i worked for is running IBM System Storage SAN Volume Controller (SVC) to hold some of the media content. SATA disks are attached to the server via fiber channel protocol.

Oracle Open Cursors Limit

I am searching for a solution about oracle's "Open cursors limit exceeded" alert for sometime. And here is the answer i found:
"The best advice for tuning OPEN_CURSORS is not to tune it. When it comes to the limit, raise it."
Ooh Great :)

Synchronization problem with sccm 2012 with remote wsus 3.0 SP2

When SCCM 2012 is integrated with remote WSUS 3.0 SP2 server, synchronization problems occured. In the wsyncmgr log file there are some logs about the problem. Log files are under Program Files\Microsoft Configuration Manager\Logs folder.
Performing sync on retry schedule  $$<SMS_WSUS_SYNC_MANAGER><05-10-2012 14:10:05.829-180><thread=3452 (0xD7C)>

Sql Server view example

These are some examples creating view from a table

create view prodlist (prid,prname,tam)
select prodid, prodname, totalamount
from products

select * from prodlist

Apache Software Foundation Projects

Apache is a open source software development community. There are lots of software projects that are currently continuing to develop.

This is simple list of projects currently ongoing.

Sql Server System Databases

Master:Master database contains instance metadata and SQL Server system configuration settings but system objects are stored in resource database.
Model: Model database is a template for creating a new database.
Msdb:Msdbdatabase is used by SQL Server Agent.
Resource:Resource database is a read-only database that contains all the system objects that are included with SQL Server.
Tempdb:Tempdb database is a resource that is available to all users is used to hold temporary objects.

iostat command man page

IOSTAT(1)      Linux User’s Manual     IOSTAT(1)

       iostat - Report Central Processing Unit (CPU) statistics and input/out-
       put statistics for devices and partitions.

SQL Server replication concepts

Replication Objects: Article: Objects that will be replicated in the database. Subscription: Object that is used for receiving updates. Each subscriber must be associated with a publisher. Publication: Object that is used for making data available for subscribers. A publication is made of articles.

scp command man page

SCP(1)  BSD General Commands ManualSCP(1)

     scp - secure copy (remote file copy program)

Categorize Blogspot Posts

If you have plenty of posts in the form of uncategorized then all you have to need is labeling your posts. Once labeling is finished Labels Gadget can be inserted on blog from Layout Tab.It’ll be needed to add it by clicking Add a Gadget.  Then it can be customized the by giving it a different title. Labels Gadget has options how the categories are sorted, and whether to show the number of posts corresponding to each category.

Sudoers Configuration (stop and start services)

So you want to allow other users to stop and start some of the services. From the linux point of view you can do this by using sudo.
Change ".bash profile" file contents of the user so that "service" and "chkconfig" commands will be in the PATH environment variable. "/sbin" folder must be included.

RMAN-06059 expected archived log not found

RMAN-00571: ===========================================================
RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS =============== RMAN-00571: =========================================================== RMAN-03002: failure of backup command at 04/09/2012 13:43:10 RMAN-06059: expected archived log not found, lost of archived log compromises recoverability

Lucene Solr Backup Script

today="$(date +%d%m%Y)";
todays_backup="backup.$(date +%Y%m%d)*"

Permission denied message when installing vmtools

When installing vmtools on a linux machine inside the /tmp directory, got this error: ./ /usr/bin/perl: bad interpreter: Permission denied
Then looked at tmp for permissions: lrwxrwxrwx   1 root root     31 Mar  6 11:13
It seems ok but if /etc/fstab has noexec option like: LABEL=/tmp    /tmp    ext3    nosuid,noexec,nodev    1    2
Changed with this one and remount again: LABEL=/tmp    /tmp    ext3    defaults    1    2

Displaying wordpress post contents in multiple columns

There are some template files for displaying post contents in excerpt or full-length form in wordpress like index.php, category.php, archive.php etc. If it is wanted to be displayed post contents in the form of multiple columns, following changes may give the desired result.

put these lines of code after <?php if ( have_posts() ) : ?> and just before <?php while ( have_posts() ) : the_post(); ?> loop:

echo "<table>";
$column = 0

inside the while loop, put <tr> and <td> just after <?php while ( have_posts() ) : the_post(); ?>

if ($column == 0) echo "<tr>";
echo "<td width='50%'>";

Now it comes to close <td> tag after the post content. Post content generally appears similar to <?php get_template_part( 'content', get_post_format() ); ?>

echo "</td>";

Then if the number of columns are reached desired value, close the <tr> tag:

if ($column == 2) {
echo &qu…

Installing linux over network using kickstart

What is required?
LAN infrastructure for network communication.NFS, FTP or HTTP Service for data transfer.DHCP service for ip distribution.TFTP service for booting from network.Linux OS kernel image.Bootloader binary.Linux installation tree should be accessible from nfs,http or ftp.

Creating YUM Repository Server

When it comes to installing yum repository server there are some requirements: Instalattion tree (can be extracted from linux distribution dvd)YUM repositoryNetwork service that is hosting repository and packages. (can be http or ftp server) I use http for hosting repository. In the apache.conf

Oracle analyzing index status

  for i in (select index_name from user_indexes) loop
     execute immediate 'analyze index '||i.index_name||' validate structure';
     insert into indstat select * from index_stats;
  end loop;

Installing Standalone Archiva as a Service

It's very easy to install archiva as a standalone mode.
Get the latest standalone archiva distribution from and unpack it. $ cd /opt $ wget

Memory dump with jmap and jhat

jmap tool is for printing memory maps of a given process. For 64 bit systems -J-d64 option may be used. jhat tool is for parsing a heap dump file and launching webserver. In the following script jmap dumps memory map to a file then jhat reads dump file and serve it from web using port 7000.

If OEM SSL certificate is expired

When i tried to start EM dbconsole got this “ERROR http: 14: Unable to initialize ssl connection with server, aborting connection attempt” in emagent.trc file. Then i realized that EM certificate is expired. You can check EM certificate state from any browser’s (IE, Mozilla etc.) security report. All you need is just “emctl secure dbconsole” command.

Global Server Load Balancing

The most important reason for the use of GSLB is to provide high availability by hosting websites more than one geographic location. With GSLB technology, incoming requests are redirected to servers in different locations on the internet for load balancing. In addition, when service on a site was interrupted by a broken internet connection, power failure, local load balance device(SLB) failure or DoS attack (Denial of Service), GSLB device becomes aware of  the situation, redirects incoming requests to another site and prevent interruption of the service. GSLB makes necessary routing processes by responding to DNS requests.

Jquery, adding and listing rows dynamically

In this example, there is a categories table. Table has category_id and category_name columns. Database transactions are made by hibernate. On the web page side, adding and removing rows are done using jquery. Jquery code is highlighted with yellow.

hibernate.hbm.xml is like:
<class name="com.test.BsCat" table="categories">