Installing Sql Server 2005 SP2 Vol 2

No comments:
SP2 installation progress

Installing Sql Server 2005 SP2 Vol 1

No comments:
Installing Sql Server 2005 SP2 is easy. Installer package is just downloaded from Microsoft site and run.

Installing SQL Server 2005 - Vol 4

No comments:
Collation Settings

Installing SQL Server 2005 - Vol 3

No comments:
After installing prerequisites wizard continues installation and checks system configuration. After these steps wizard begin asking questions about sql server.

Installing SQL Server 2005 - Vol 2

No comments:
After installing required windows components Sql Server 2005 installation can be started. On the "Start" page click "Server components, tools, Books Online, and samples" under the "Install" caption.

Installing SQL Server 2005 - Vol 1

No comments:
Before installing Sql Server 2005 we have to install required windows components. To do this go to "Control Panel" then click on "Add Remove Programs" and open "Add Remove Windows Components" wizard. Install "Internet Information Services" under "Application Server".

RHQ a systems management solution

No comments:
RHQ is a system management application written in java. It has server/agent architecture to implement remote management of server systems. RHQ needs some prerequisites like supported operating system, java environment and database. It runs on windows and linux operating systems that have java 6 jre or jdk installed. Postgres or oracle is supported. Latest release of RHQ is 4.2.0 now. RHQ is a little bit buggy but fixes them regularly. For detailed information about installing, configuring and running RHQ can be obtained from

Backing up oracle database example

No comments: script uses disk_rman.txt that includes rman backup commands.

$ more 

Generate secure download urls with lighttp

No comments:
with mod_secdownload, lighttp can generate secure download urls for a given time period.
Generated url's format is <uri-prefix>/<token>/<timestamp-in-hex>/<rel-path> and looks like

Mount windows shares on linux

No comments:
Any windows share can be mounted on linux easily. Cifs network protocol is used for mounting windows shares. smbclient package is also required.

first install samba-client package
# yum install samba-client

Archive logs older than 10 days

No comments:
This shell command would archive log files that modification times are older than ten days. Find command takes arguments like -maxdepth 1 for maximum level of directories to dig , -type -f for identifying files, -name '*.log' for filtering log files, -mtime +10 for filtering modification time and -exec mv for executing commands for every file that found.

find /ftp/logs/ -maxdepth 1 -type f -name '*.log' -mtime +10 -exec mv {} /ftp/logs/archive/ \;

md5 checksum with linux command line

No comments:
md5 checksum can be done from linux command line. Just run a command like following example:

# md5sum /tmp/sun-javadb-client-10.6.2-1.1.i386.rpm |cut -f1 -d " "

Java hibernate select query example

No comments:
A mysql table named servers contains server records. With the following java and xml files, all server are listed. In eclipse, hibernate.cfg.xml, hibernate.hbm.xml and com.test.Server java files can be produced easily.

This is hibernate config xml
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE hibernate-configuration PUBLIC "-//Hibernate/Hibernate Configuration DTD 3.0//EN" "">

java code for sending an email

No comments:
Java code for sending mails. An smtp server is required to relay mails.

<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8" %>
<%@ page import="java.util.*" %>
<%@ page import="*" %>
<%@page import=""%>

Java file transfer with sftp

No comments:
JSch is an ssh2 library for java and can be used to connect ssh server and make remote file transfers. Following example is an implementation of jsch remote file transfer. jsch library is is available at the maven repository,

<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8" %>
<%@ page import="com.jcraft.jsch.*" %>
<%@ page import="com.jcraft.jsch.ChannelSftp.*" %>

java url redirection

No comments:
An example of redirecting to another url with java

<%@ page import="java.util.*" %>

String source_url = "";
String target_url = "";

Java Active Directory authentication

No comments:
Authenticate users member of a specific group with the java naming library.

<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8" %>
<%@ page import="java.util.*" %>
<%@ page import="javax.naming.*"%>
<%@ page import="javax.naming.ldap.*"%>
<%@ page import="*"%>

Install RHQ agent on linux

Installing RHQ agent is simple. Only thing you have to do is just download plugin jar save it and run the installation command like java -jar <agent-download.jar> --install=<agent directory>. But i want to explain how we can install the agent as a service.

With the following script rhq enterprise agent 4.2.0 can be installed as a service on redhat linux.

Just another file copy program

No comments:
There are two files in the project. and reads from properties file. In the properties file there are some configuration parameters. example:
sDirParam = /source
dDirParam = /destination
dFileExtParam = $G$
fileFilterParam = .srt;.avi;.pdf;
logFileParam = /logs/gates.log

Oracle logical standby monitoring

No comments:
in this examle i am going to use php for getting oracle logical standby replication status. This connects primary and standby servers with oci, then query them which logs were applied and which logs are being applied currently.

Solr Replication Monitoring

No comments:
in this examle i am going to use php for getting solr index replication xml and parsing it. There are two urls. One is inicating master solr server's status, second one is indicating slave solr server's status.

Urls are like:
http://<master server ip>:8080/solr/admin/cores
http://<slave server ip>:8080/solr/admin/cores

SQL Server DB inventory

No comments:
with the following query db inventory of a sql server can be retrieved:

SERVERPROPERTY('ServerName') as 'Server Name',
@@VERSION as 'SQL Version',
SERVERPROPERTY('productversion') as 'SQL Server Versiyon Number',
CASE SERVERPROPERTY('IsIntegratedSecurityOnly') WHEN 0 THEN 'Mix' ELSE 'Windows' END as 'Auth Mode', as 'Database Name',
dbs.collation_name as 'Collation',
mf.physical_name as 'Database File'
FROM sys.master_files as mf, sys.databases as dbs
WHERE (mf.database_id dbs.database_id) and ( not in ('master', 'model', 'msdb', 'tempdb'));

Linux Tilde Character

No comments:
Tilde character represents home directory of the user. To go to home folder of the games user:

# cd ~games
# pwd

Checking Lucene Index Status

No comments:
To check lucene index status, run something similar;

java -ea /opt/jboss/lucene/lucene-core-2.9.0.jar org.apache.lucene.index.CheckIndex /lucene_index

Linux rsync Command

No comments:
To synchronize data between two local folder in linux, following command can be used:

# rsync -avzp /<source_dir>/ /<destination_dir>

Creating Synonyms of Tables For Another Schema

No comments:
Following command can be used for generating “create synonym” queries. schema2 is the newly added schema that needs to use synomym. schema1 is the old schema that holds tables.

select 'create synonym <schema2>.' || TABLE_NAME || ' for <schema1>.' || TABLE_NAME || ';' from dba_tables where owner='<schema1>'

Calculating Size of the Specific Folders - Linux Command

No comments:
To calculate total size of the directories that have specific name under a directory

Following command lists subfolders
find <folder name> -type d

Append this to get size of folders
-exec du -s {} \;

Append this to list only matching folder names
|grep <folder name>

Append this to sum folder sizes
|awk '{ SUM += $1 } END { print SUM/1024/1024 }'

find <root folder> -type d -exec du -s {} \; |grep <subfolder pattern> |awk '{ SUM += $1 } END { print SUM/1024/1024 }'

How to count the number of files in a directory - Linux Shell Command

No comments:
To count number of files in a directory in linux shell command line just;

ls -lR <directory path> | wc -l

Output of a command in a shell script

No comments:
When you want to assign output of a shell command to a variable in your shell script, you have to write shell command between special quotation marks ` <command here> `

example: This command shows oldest two backups.
old_backups=`ls -td backup* | awk 'NR>2'`
echo $old_backups

Java Code for Operating System Properties

No comments:
The following is example of a java code which is getting some basic Operating System properties of a linux server.It gets host name, operating system name, kernel version and CPU architecture values, then writes them on a mysql database. I hope this helps anyone interested in systems management coding in java.

Getting IP Address information in Java

No comments: class must be used in order to learn ip address of the computer. Simply cast all information of the network interfaces  to an enumeration, then pass the enumeration through a collection.


Linux Commands in Java

No comments:
You can use getRuntime method to run linux shell commands from java. Try this example to get memory statistics:

int ch;
String MemStr = "";

Find running transactions longer than one hour

No comments:
to select running transactions longer than one hour

   s.osuser, vp.spid as os_pid, S.BLOCKING_SESSION blocker,
   Q.SQL_FULLTEXT cur_sql, PQ.SQL_FULLTEXT prev_sql,
   vt.used_urec, vt.start_date


No comments:
There are number of sql apply process modules. Coordinator, reader, builder, preparer, analyzer, applier modules can be monitored with the following query



No comments:
using DBA_LOGSTDBY_LOG and DBA_LOGSTDBY_PROGRESS views sql apply process can be monitored

Monitoring Indexes

No comments:
Index management is always key point of performance tuning in a database. It should be considered that optimum number of indexes are created.Sometimes an index is created and used once then it is forgotten. If large number of insert and update statements are committed, IO waits waits may be seen.


1 comment:
Sometimes i have to recreate a table on the oracle standby database to keep standby consistent with the primary. It can be performed by DBMS_LOGSTDBY.INSTANTIATE_TABLE procedure. This procedure uses three parameters. These parameters are “Schema Name”, “Table Name”, “DB Link”.


No comments:
When a transaction prevents sql apply service, it can be found by querying DBA_LOGSTDBY_EVENTS view.

Using this query, transaction identification information is listed.
XIDUSN NUMBER (Transaction ID undo segment number)
XIDSLT NUMBER (Transaction ID slot number)
XIDSQN NUMBER (Transaction ID sequence number)

Restoring Oracle Backup to a New Server

No comments:
Nobody wants database server to crash, but if it happens most recent backup has to be restored on a newly replaced server. There are some requirements before the restoring operation. First, a server oracle software installed on it. Second, it makes restore operation easy that the same folder structure as the old server. Third, autobackup feature must be enabled at the old server. Last but not least, DBID of the old database.


No comments:
When datapump import job is started with the option TABLE_EXISTS_ACTION there will be some effects on existing tables.


No comments:
AFTER STARTUP trigger checks the database role and open mode of the database. Based on the values it starts the appropriate service using DBMS_SERVICE.START_SERVICE procedure.

Do not kill wrong session

No comments:
Killing sessions are dangerous. So you have to be careful not to accidentally kill wrong sql session. You may follow the procedure below:

An Alternative Method for Oracle Physical Standby

No comments:
Physical Standby Server can be used to recover data from disaster is one of the best methods. But the installation and management may be a little bit difficult. There is an another way.

Querying Long Running Jobs

No comments:
Sometimes i want to see output details of a running datapump export job, but datapump’s job output shows only brief explanation and shows each process’s output after the process completed. In that case v$session_longops view helps us.

Some Oracle Questions and Answers

No comments:
Where are datafiles?

Is database using pfile or spfile?

How to use Oracle Data Dictionary?

No comments:
Data Dictionary is the metadata of the oracle database. It contains all informations about the database objects. There are sets of views in the Data Dictionary. They are in the SYSTEM tablespace and have prefixes.

When listener log file grows

No comments:
When oracle listener.log file grows, it is getting harder to tail logs. The log file must be reopened. There is no need to close listener service to reset the log file. After setting the logging state off just rename the log file, then set the logging state on again. Just three commands and it is done.

rescan fc buses on linux

No comments:
rescan fc controllers to add new disks
# echo "1" > /sys/class/fc_host/host<controller number>/issue_lip
# echo "1" > /sys/class/fc_host/host<controller number>/issue_lip

GPT partition on multipathed disk

No comments:
A new gpt partition can be created on multipathed disk with the following command

# parted -s /dev/mapper/mpath1 -mklabel gpt mkpart primary ext3 0 -1

Multipath configuration for IBM SVC disk

No comments:
make these changes to /etc/multipath.conf file and then restart multipathd daemon

Add new EMC storage disk to RHEL4

No comments:
at RHEL 4 system new EMC storage disk can be scanned like this


No comments:
with smbpasswd a user is allowed to change their smb password
# smbpasswd -a <username>

Apache Basic Authentication

No comments:
Creating basic authentication for a web application with apache web server

JBOSS Port Redirection

No comments:
As for the subject to run jboss over port 80 in linux systems, the problem is that linux security model does not allow unprivileged users to use port 80. In my point of view,  best way to achieve this is port forwarding.

Kickstart Post Installation Steps in ks.cfg

No comments:
Installing linux with kickstart server, post installation script can be used in order to make specific changes or install additional softwares.This can be done by adding commands after %post section in ks.cfg file.

Mysql Hotcopy Backup Script

No comments:
It is very easy to get mysql hot copy backup with the following script. /mysql_backup is nfs mounted disk.

Oracle Export Cleaner (Example Script)

No comments:
Regular database exports can be monitored and cleaned regularly while keeping desired number of successful exports with this linux script. There are two files, one is config file that containing schema names and corresponding schema export path, the other one  is export cleaner script.

Redhat Package Manager

No comments:
rpm  is a useful Package Manager. It helps to install, update and uninstall softwares.

Shell Script (Reading config file)

No comments:
In a shell script, we can use while loop for reading configurations. Config file is based on value and corresponding parameter.

Creating a Partition Larger Than 2 TB

No comments:
If you want to create a partition larger than 2 TB on a linux operating system, fdisk utility will not cover your need. Parted is a good partitioning editor and may help you to create a partition larger than 2 TB.

What is Sticky Bit?

No comments:
Sticky bit is an extra permission option for files and folders in linux. There are two main reasons for using sticky bit.

Ftp Site Synchronization with Wget

No comments:
I have a task for synchronizing a remote ftp folder to a local folder. At the remote site, that day’s folder is placed in the form of year_month_day and the local folder placed in the form of year/month/day .

Redhat iSCSI Connection Configuration

No comments:
Making iSCSI connection from Redhat Linux server is easy to implement.

Running java program as a linux service

No comments:
Recently, I was wondering about how the programs are running as a service in Linux. After a little googling,  i learned it is very simple. All we have to do is just write a script that starts, stops and restarts the program and register this script as a Linux service. Let me tell the scenario.

Find and replace with sed command in Linux

No comments:
Find and replace feature is always handy. It can turn into a torture when it comes to change or delete a simple constant string in a text file. There is a handy tool in linux for doing these kind of tihngs. Actually sed is not a text editor but it is used outside of the text file to make changes.

Extending a logical volume at LVM

No comments:
Suppose that we have a volume group named VG-TEST and It contains a logical volume named LV-TEST. After adding new physical disk /dev/sdx , we want to give additional 100G space to the LV-TEST logical volume. Following procedure is applied to the server.

Make Backups using LVM snapshots

No comments:
With Logical Volume Manager, backups can be taken using snapshots.

in this example the resources are: