Tuesday 28 August 2007

10g features related general notes

More notes: http://www.globusz.com/ebooks/Oracle/00000010.htm

To change Thresholds
BEGIN
DBMS_SERVER_ALERT.SET_THRESHOLD(
METRICS_ID => dbms_server_alert.tablespace_pct_full,
WARNING_OPERATOR => dbms_server_alert.operator_ge,
WARNING_VALUE => '55',
CRITICAL_OPERATOR => dbms_server_alert.operator_ge,
CRITICAL_VALUE => '80',
OBSERVATION_PERIOD => 1,
CONSECUTIVE_OCCURRENCES => 1,
INSTANCE_NAME => NULL,
OBJECT_TYPE => dbms_server_alert.object_type_tablespace,
OBJECT_NAME => 'USERS');
END;
/

To turn of alerts for USERS tablespace
BEGIN
DBMS_SERVER_ALERT.SET_THRESHOLD(
METRICS_ID => dbms_server_alert.tablespace_pct_full,
WARNING_OPERATOR => dbms_server_alert.operator_do_not_check,
WARNING_VALUE => '0',
CRITICAL_OPERATOR => dbms_server_alert.operator_do_not_check,
CRITICAL_VALUE => '0',
OBSERVATION_PERIOD => 1,
CONSECUTIVE_OCCURRENCES => 1,
INSTANCE_NAME => NULL,
OBJECT_TYPE => dbms_server_alert.object_type_tablespace,
OBJECT_NAME => 'USERS');
END;
/



select * from RECYCLEBIN;

PURGE RECYCLEBIN;

DROP TABLE emp PURGE;


Search OPDG in metalink for perf tuning guide

Oracle Patch: http://www.oracle.com/technology/support/patches.htm
Oracle Alert: http://www.oracle.com/technology/deploy/security/alerts.htm

Back to fixed size SGA (on the fly):
alter system set sga_max_size=2G scope=spfile;
alter system set sga_target=0M scope=both;
alter system set shared_pool_size=384M scope=both;
alter system set db_cache_size=416M scope=both;
alter system set java_pool_size=16M scope=
both;
alter system set large_pool_size=16M scope=
both;

show parameter sga_max_size;
show parameter sga_target;
show parameter shared_pool_size;

show parameter db_cache_size;
show parameter java_pool_size;
show parameter large_pool;


Clean delete of database on Linux (so next install uses the original ports and files)

Remove entires from:
/u01/oracle/product/10.2.0/install/portlist.ini


rm $ORACLE_HOME/plumtree.com_NIDB
rm
$ORACLE_HOME/oc4j/j2ee/OC4J_DBConsole_plumtree.com_NIDB

Friday 24 August 2007

BLOB's

To find the table the lob belongs to:
select table_name from user_lobs where SEGMENT_NAME = 'SYS_LOB033344496$$';

or chr(10)
set sqlblanklines on


DBVERIFY
Perfom while db is up and file is offline / online.
dbv file='/u22/oracle/oradata/NIDB/NIDB_BLOB_DATA_07.dbf' blocksize=8192

Ramadan 2007

The ninth month of the Muslim lunar calendar, month of fasting throughout hours of daylight. Fasing is to abstain from eating, drinking, smoking, and sex from dawn to sunset. ItiIs also the month in which the Koran was revealed to Muhammad


Personal notes:
Rajaab [15, 16]
Sahbaan [M, T, 15]

Complete on 11 Oct 2007 (29th Ramada) at 5.50pm (40 min before Ifter)
Taqobalallahu Minna Waminkum

Friday 17 August 2007

Forgotten vi commands

Below are the vi commands I keep forgetting if I don't use them for a month or so.

To comment below 9 lines:
:.,+9 s/^/#/ (or can do :1,20)

To set line no:
set nu

Global search replease:
:g/foo/ s//bar/g (or put c for confim)

Thursday 16 August 2007

Unix topics

split from chunk and download
split -b 100m nidb.dmp nidb_

find text in all files
find . -type f -exec grep "\"select" {} \; -print | grep jsp

mount share via nfs (this is softshare, has a time)
mount -o soft lnx-nidb1.jhq:/u02/oracle /mnt/nidb1

Unix mail from command line
echo "myTest body" | mail -s "myTest subject" nislam@sch.com

Format disk
with ext3
mkfs.ext3 /dev/sda1

Restarting netowrk
service network restart

Plug the USB then check dmesg to see device location e.g. sdg: sdg1 sdg2
mount /dev/sdg1 /mnt/usbdisk

List open file (fuser / lsof)
============
fuser system01.dbf
/usr/sbin/lsof system01.dbf

Find old files and delete (30 days)
find /u01/oracle/NIDB/arch -maxdepth 1 -mtime +30 -name "*.arc" -exec rm -rf {} \;

Change OS time
cd /etc
ln -sf /usr/share/zoneinfo/Etc/GMT localtime

But most things will need a restart before it takes affect, can we find some time to action a reboot?

Check Netowrk speed
ethtool eth0


Database Disk Layout
Good discussion on db disk and Raid
http://asktom.oracle.com/pls/asktom/f?p=100:11:0::::P11_QUESTION_ID:359617936136


New Database (2*74) (12*300)
Here are disk layout I plan to implement on new db box.

Internal (2x 74GB) Raid 1
/boot 150MB
/ 10GB
/home 5GB
Swap 16384MB
/u01 15GB Ora Software, admin
/u02 25GB Redo 1, Undo

External (6x 300GB) Raid 1+0
Swap 8192MB
/u11 150GB App Datafile
/u12 150GB App Datafile
/u13 100GB App Datafile
/dbbackup1 500GB (Or rest) RMAN backup and Exp dmp

External (4x 300GB) Raid 1+0
Swap 8192MB
/u21 100GB Index
/u22 100GB Index
/u23 100GB Ineex
/dbbackup2 300GB (Or rest) RMAN backup

External (2x 300GB) Raid 1
/u31 10GB Redo 2, Temp
/u32 40GB Redo 3, Arc
/u33 250GB (Or rest) Other

If I had more disks I would have moved Redo 1 from OS / Software disk.

Thursday 9 August 2007

AWR

Read:
Transparent Data Encryption
http://www.oracle.com/technology/oramag/oracle/05-sep/o55security.html

Whats in SYSAUX?
select occupant_name, schema_name, space_usage_kbytes from v$sysaux_occupants;


For more information, go to http://tahiti.oracle.com


To generate AWR reports:

@$ORACLE_HOME/rdbms/admin/awrrpt



Explain Plan
Note: 235530.1 Recommended Methods for Obtaining a Formatted Explain Plan
@?/rdbms/admin/utlxplan
@?/rdbms/admin/utlxpls
set lines 130
set head off
alter session set cursor_sharing=EXACT;
select plan_table_output from table(dbms_xplan.display('PLAN_TABLE',null,'ALL'));

-- Plan of last executed SQL
select * from table(dbms_xplan.display_cursor(null,null, 'ALL'));

Note: 215187.1 Enhanced Explain Plan and related diagnostic info for one SQL statement

Friday 3 August 2007

~50th Oracle 10g install, still seeing error

This is approximately my 50th Oracle 10g install, was little surprised when I saw error during this install.

Don't be too shocked, this time my Sys Admin let me down, he did not install some basic packages required by Oracle (that we previously agreed will be in OS install list). My kind Sys Admin installed those packages, things started to work like a dream.

1. UnsatisfiedLinkError
$ xterm opens fine but dbca/netca does no work, gives error!

[oracle@lnx-field ~]$ dbca
UnsatisfiedLinkError exception loading native library: njni10
Exception in thread "main" java.lang.UnsatisfiedLinkError: get
at oracle.net.common.NetGetEnv.get(Native Method)
at oracle.net.config.Config.getNetDir(Unknown Source)


Fix was: Install libgcc (and libstdbc++-devel) RPM (make sure 64 bit and 32 are there)
e.g.
up2date --arch i386 expat fontconfig freetype glibc-devel libgcc xorg-x11-deprecated-libs xorg-x11-libs xorg-x11-Mesa-libGL zlib libaio


Fix 2 was:
Got this again on Aug 2008, this time after lib install make sure to reinstall the software (or maybe you can just relink), I did the full software re-install of Oracle, since it onlye takes 15 min.

2. TNS: Lost Contact
Got following error during db creation via dbca (afte hitting Create DB), error came up on pop up.

ORA-12547: TNS:lost contact

Fix was: Install libaio RPM


3. Error towards end of 10g install (20 Aug 2007)
Failed to allocate port(s) in the specified range for the following process(es): JMS [5540-5559], RMI [5520-5539], Database Control [5500-5519], EM agent [3938] [1830-1849]
Could not complete the configuration. Refer to the log file for details.


Fix was: fix the /etc/host file make sure IP and hostname is correct.



4. Error ORA-00600 during startup (24 Aug 2007)
open_cursors = 300
pga_aggregate_target = 402653184
Thu Aug 23 17:07:03 2007
Errors in file /u01/oracle/admin/P1AR/udump/p1ar_ora_5067.trc:
ORA-00600: internal error code, arguments: [keltnfy-ldmInit], [46], [1], [], [], [], [], []
USER: terminating instance due to error 600
Instance terminated by USER, pid = 5067


Fix was: Make sure /etc/sysconfig/network is correct (hostname was different).
Why error: Sys Admin changed hostname few days ago, only after OS restart error started happening.


5. Oracle Install logs (dbca)
/u01/oracle/product/10.2.0/cfgtoollogs/dbca/SID

Thursday 2 August 2007

Hadith of the Day

http://www.quranexplorer.com/quran/
http://www.geocities.com/mtaufiq.rm/quran.html
http://www.altafsir.com

Current Mark
13 Nov 2007 : Arabic | 6.132 (page 145) (wooow, shocking this same place as 13 Sep)

11 Oct 2007 (Ramadan 29) : Arabic | Katam and started again, (just 30 min before the last iftar)

13 Sep 2007 (Ramadan 1) : Arabic | 6.132 (page 145)

13 Aug 2007 : Arabic & Eng | 6.57