Adding new Hard Drive to an LVM

1. Create the partition table
[root@repository ~]# fdisk /dev/sda
Device contains neither a valid DOS partition table, nor Sun, SGI or OSF disklabel
Building a new DOS disklabel. Changes will remain in memory only,
until you decide to write them. After that, of course, the previous
content won't be recoverable.


The number of cylinders for this disk is set to 60801.
There is nothing wrong with that, but this is larger than 1024,
and could in certain setups cause problems with:
1) software that runs at boot time (e.g., old versions of LILO)
2) booting and partitioning software from other OSs
(e.g., DOS FDISK, OS/2 FDISK)
Warning: invalid flag 0x0000 of partition table 4 will be corrected by w(rite)

Command (m for help): n
Command action
e extended
p primary partition (1-4)
p
Partition number (1-4): 1
First cylinder (1-60801, default 1):
Using default value 1
Last cylinder or +size or +sizeM or +sizeK (1-60801, default 60801):
Using default value 60801

Command (m for help): t
Selected partition 1
Hex code (type L to list codes): 8e
Changed system type of partition 1 to 8e (Linux LVM)

Command (m for help): w
The partition table has been altered!

Calling ioctl() to re-read partition table.
Syncing disks.

2. List the partition table
[root@repository ~]# fdisk -l

Disk /dev/hda: 40.0 GB, 40020664320 bytes
255 heads, 63 sectors/track, 4865 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes

Device Boot Start End Blocks Id System
/dev/hda1 * 1 13 104391 83 Linux
/dev/hda2 14 4865 38973690 8e Linux LVM

Disk /dev/sda: 500.1 GB, 500107862016 bytes
255 heads, 63 sectors/track, 60801 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes

Device Boot Start End Blocks Id System
/dev/sda1 1 60801 488384001 8e Linux LVM


3. Create the LVM Volume
[root@repository ~]# lvm
lvm> pvcreate /dev/sda1
Physical volume "/dev/sda1" successfully created

4. Create the volume group
[root@repository ~]# lvm
lvm> vgcreate VolGroup01 /dev/sda1
Volume group "VolGroup01" successfully created

5. Create the logical volume
lvm> lvcreate -l 100%FREE -n LogVol00 VolGroup01
Logical volume "LogVol00" created

6. Format the file system
[root@repository ~]# mkfs.ext3 /dev/VolGroup01/LogVol00
mke2fs 1.35 (28-Feb-2004)
Filesystem label=
OS type: Linux
Block size=4096 (log=2)
Fragment size=4096 (log=2)
61063168 inodes, 122095616 blocks
6104780 blocks (5.00%) reserved for the super user
First data block=0
Maximum filesystem blocks=125829120
3727 block groups
32768 blocks per group, 32768 fragments per group
16384 inodes per group
Superblock backups stored on blocks:
32768, 98304, 163840, 229376, 294912, 819200, 884736, 1605632, 2654208,
4096000, 7962624, 11239424, 20480000, 23887872, 71663616, 78675968,
102400000

Writing inode tables: done
Creating journal (8192 blocks): done
Writing superblocks and filesystem accounting information: done

This filesystem will be automatically checked every 29 mounts or
180 days, whichever comes first. Use tune2fs -c or -i to override.

That's all the steps

reff:http://www.utahsysadmin.com/2008/10/10/add-a-hard-drive-in-linux-with-lvm/

WEDNESDAY, MARCH 10, 2010

Oracle move table to another Tablespace

If you move a table from one table to another tablespaces, you need to rebuild the Index

1. Checking Index for the tables
SQL> SELECT INDEX_NAME,TABLE_NAME,STATUS
FROM ALL_INDEXES
WHERE TABLE_NAME='IB_ARC_SI_BILL_PAYMENT';

INDEX_NAME TABLE_NAME STATUS
------------------------------ ------------------------------ --------
SYS_C003164 IB_ARC_SI_BILL_PAYMENT VALID

2. Moving to antoher tablespace
SQL> ALTER TABLE IB_ARC_SI_BILL_PAYMENT MOVE TABLESPACE ARCHIVE;

3. Checking Index for the tables again
SQL> SELECT INDEX_NAME,TABLE_NAME,STATUS FROM ALL_INDEXES WHERE TABLE_NAME='IB_ARC_SI_BILL_PAYMENT';

INDEX_NAME TABLE_NAME STATUS
------------------------------ ------------------------------ --------
SYS_C003164 IB_ARC_SI_BILL_PAYMENT UNUSABLE

4. Rebuild the Index
SQL> ALTER INDEX SYS_C003164 REBUILD;

Index altered

5. Check the index status
SQL> SELECT INDEX_NAME,TABLE_NAME,STATUS FROM ALL_INDEXES WHERE TABLE_NAME='IB_ARC_SI_BILL_PAYMENT';

INDEX_NAME TABLE_NAME STATUS
------------------------------ ------------------------------ --------
SYS_C003164 IB_ARC_SI_BILL_PAYMENT VALID

Finish rebuilding index

THURSDAY, FEBRUARY 25, 2010

Auditing database on Oracle 9i

Information that can be audited:
- Operating system login user name
- User name
- Session identifier
- Terminal identifier
- Name of the schema object accessed
- Operation performed or attempted
- Completion code of the operation
- Date and time stamp

Step for activating auditing:
1. Activate auditing in initialization paramaters (DB or OS)
audit_trail = DB
2. Activate auditing option
AUDIT SELECT TABLE, UPDATE TABLE, INSERT TABLE, DELETE TABLE BY user_id BY ACCESS;

Here is VIEW to view audit data on database:
- DBA_AUDIT_EXISTS
- DBA_AUDIT_OBJECT
- DBA_AUDIT_SESSION
- DBA_AUDIT_STATEMENT
- DBA_AUDIT_TRAIL
- DBA_OBJ_AUDIT_OPTS
- DBA_PRIV_AUDIT_OPTS
- DBA_STMT_AUDIT_OPTS

reff:http://download.oracle.com/docs/cd/B10501_01/server.920/a96521/audit.htm#1108

MONDAY, FEBRUARY 8, 2010

How to add new hard drive to existing LVM volume

Sometimes your server running out of space, but if your server configured using LVM Volume, it will not be a problem anymore. Plug your new hard drive and let's configure

1. Creat an LVM partition
[root@oracledev ~]# fdisk /dev/sda
press n for creating new partition
press t for partition type and choose 8e for LVM
press w to write any changes


2. Create LVM physical volume
[root@oracledev ~]# lvm
lvm> pvcreate /dev/sda1
Physical volume "/dev/sda1" successfully created

3. Extend physical volume to existing logical volume group
lvm> vgextend VolGroup00 /dev/sda1
Volume group "VolGroup00" successfully extended

4. Extend the volume to 100%
lvm> lvextend -l +100%FREE /dev/VolGroup00/LogVol02
Extending logical volume LogVol02 to 323.47 GB
Logical volume LogVol02 successfully resized

5. Resize the partition size, but unmount it firstly
[root@oracledev ~]# resize2fs /dev/VolGroup00/LogVol02

reff:http://www.redhat.com/docs/manuals/csgfs/browse/4.6/Cluster_Logical_Volume_Manager/

WEDNESDAY, SEPTEMBER 17, 2008

Oracle 9i Startup Script on CentOS 4.4

Here is startup script for oracle 9i release 2 on centos 4.4

1. Save this script on /etc/init.d/oracle

#!/bin/sh
# 15 September 2008
# Created by Johannes Sitorus
# description: Oracle auto start-stop script.

ORA_HOME=/data/oracle/9.2.0
ORA_OWNER=oracle

if [ ! -f $ORA_HOME/bin/dbstart ]
then
echo "Oracle startup: cannot start"
exit
fi

case "$1" in
'start')
# Start the Oracle databases:
# The following command assumes that the oracle login
# will not prompt the user for any values
su - $ORA_OWNER -c "$ORA_HOME/bin/lsnrctl start"
su - $ORA_OWNER -c $ORA_HOME/bin/dbstart
;;
'stop')
# Stop the Oracle databases:
# The following command assumes that the oracle login
# will not prompt the user for any values
su - $ORA_OWNER -c $ORA_HOME/bin/dbshut
su - $ORA_OWNER -c "$ORA_HOME/bin/lsnrctl stop"
;;
*)
echo $"Usage: $0 {start|stop}"
exit 1

esac

2. chkconfig --level 35 oracle on

P.S Replace the variable as needed

TUESDAY, AUGUST 12, 2008

Apache security

Maybe we need to build up a super secure web server. It's can be done through many steps. There's so many article on Internet, how to secure your web server. One of the step is using modsecurity.

1. Make sure you have mod_unique_id installed
2. Install the latest version of libxml2, if it isn't already installed on the server
3. Stop Apache httpd
4. Unpack modsecurity package if you are using tar.gz or you can install using rpm package (http://www.modsecurity.org/download/)
5. Edit httpd.conf and add these lines
LoadFile /usr/lib/libxml2.so
LoadModule security2_module modules/mod_security2.so
6. Configure ModSecurity
7. Start Apache httpd

Reff: http://www.modsecurity.org/

THURSDAY, JUNE 12, 2008

iptables Packet Route

This picture will show how packet processed on firewall



Source :
http://www.linuxhomenetworking.com/wiki/index.php/Quick_HOWTO_:_Ch14_:_Linux_Firewalls_Using_iptables

date Sabtu, 31 Desember 2011