2010/02/18

How to Format a Hard Drive in Linux

Linux referes to hard drives as either 'hdx' or 'sdx' where x is a letter, starting with a, which represents the order in which the drive was added to or detected by the compouter. The 'hd' prefix is used for IDE and PATA (formerly just ATA), and the 'sd' prefix is used for SCSI, SATA and USB drives. Usually a number is also put at the end of 'hdx' or 'sdx' to denote different partitions on the same physical drive, but for the purpose of formatting you only need to know which letter the drive you want to format is.

You can see all the drives attached to your system by typing the command 'ls /dev/hd*' and 'ls /dev/sd*' depending on which type the drives are.

First you will use the 'fdisk /dev/' command to erase any old partitions on the drive and create a new one.

Then, you will use the 'mkfs -t /dev/' to create the filesystem on the drive.

Finally, you will edit /etc/fstab file to mount the drive whenever system is rebooted.

2009/12/22

Rebuild Table as Partitioned Table

1. Check if tablespace has enough room for an extra copy of the table.
2. Drop any PK, Indexes, FK for the table.
3. Rename the table to a temporary table name.
4. Create new partitioned table with neccessary contraints.
5. Merge data from temporary table into the partitioned table.
6. Drop the partitioned table.

2009/12/02

Cronjob Doesn't Source Profile By Default

The script runs perfectly in command line won't necessarily run in cronjob. The most possible reason for this is that 'PATH' is not set in the script because by default cronjob won't source '.profile'. And user won't notice this because if user runs the script in command line, he's already sourced his profile. You should include it in your crontab shells or run commands in a way they source profile.

2009/09/23

Warning: no filemap entries available

The following warning occurs while doing opatch lsinventory:
"Warning: no filemap entries available"

Cause:
$ORACLE_HOME/inventory/oneoffs//etc/config/actios or $ORACLE_HOME/inventory/oneoffs//etc/config/inventory does not exist.

Solution:
1. Download the failed patch.
2. Unzip the downloaded patch.
3. cd /etc/config
4. cp inventory $ORACLE_HOME/inventory/oneoffs/<patch number>/etc/config
5. cp actions $ORACLE_HOME/inventory/oneoffs/<patch number>/etc/config
6. Run 'opatch lsinventory' again to verify the result.

Please note this is to fix an issue where "opatch lsinventory" lists an already installed patch this way

2009/09/16

Loader Throughput Too High for Grid Control

Grid Control 10.2.0.4

Metric 'Loader Throughput(rows per second)' is alerted to exceed the critical threshold (3000) on Grid Control homepage. To solve this problem, shutdown grid control and set em.loader.threadPoolSize parameter in file 'emoms.properties' to a higher value (1 to 10). The file is located in $OMS_HOME/sysman/config/ directory. Then, restart Grid Control.

2009/09/11

Recycle the listener.log File

The parameter 'LOGGING_LISTENER' in listener.ora file controls whether listener will be logged, and it defaults to LOGGING_LISTENER=ON. To turn off the log, you have to add LOGGING_LISTENER=OFF into listener.ora file.

If you try to rename or remove the listener.log file without shutting down listener on Windows platform, you will notice that Windows holds a lock on this file and returns an error. Even under Unix, the Oracle listener process holds an open handle to the file. You can remove the file, but Oracle will not re-create the file when it attempts to write it again.

Here is a solution for renaming or removing the listener.log file without having to stop and restart the listener:

lsnrctl set log_status off
mv listener.log listener.log.old
touch listener.log
lsnrctl set log_status on

2009/08/19

Estimate size for undo tablespace

Sizing an UNDO tablespace requires three pieces of information:

UR: UNDO_RETENTION in seconds
UPS: Number of undo data blocks generated per second
DBS: Overhead varies based on extent and file size (db_block_size)

UndoSpace = (UR * (UPS * DBS) + DBS)
or, when the guesstime equates to zero, then add a multiplier (24) to the overhead (DBS) to derive more appropriate results:
UndoSpace = (UR * (UPS * DBS)) + (DBS * 24)

UNDO_RETENTION and DB_BLOCK_SIZE can be obtained from the initialization file. UPS can be acquired from the following query:

SELECT (sum(undoblks))/sum((end_time-begin_time)*86400)
FROM v$undostat;