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;

2009/08/17

How to Shutdown and Start Grid Control and All Its Components

Grid Control: 10.2.0.4

Shutdown Grid Control

1. $OMS_HOME/bin/emctl stop oms
2. $OMS_HOME/bin/emctl stop iasconsole
3. $OMS_HOME/opmn/bin/opmnctl stopall
4. $AGENT_HOME/bin/emctl stop agent
5. shutdown repository database
6. shutdown listener

Start Grid Control

1. start listener
2. start repository database
3. $OMS_HOME/bin/emctl start oms
4. $OMS_HOME/opmn/bin/opmnctl startproc ias-component=WebCache
5. $AGENT_HOME/bin/emctl start agent
6. $OMS_HOME/bin/emctl start iasconsole