Monday, June 11, 2012

awk command in linux

awk '/search pattern/ {action}
        /search partern/ {action}' file

awk '{print $2, $5;}' examp.txt
ps -ef | grep user | awk '{print "kill -9 " $2;}'
NF is a built in variable which represents total number of fields in a record


reference:
http://www.thegeekstuff.com/2010/01/awk-introduction-tutorial-7-awk-print-examples/

fork: Resource temporarily unavailable

I meet this error when can sudo to oracle to do dba tasks.

fork: Resource temporarily unavailable


1. issue:
there is some limitatoin  hit by user oracle.

2. check memory ( this command should be fine since you run it in root domain)
free -m

3. check disk  ( this command  should be fine sicne it run in root domain)
df -k

4. check user limitation (this command might fail since it run in oracle domain)
ulimit -a

5. root cause:
nfs interfase has issue and failed all 'df' command. Cron job was issued more then 800 times and all hung on 'df'' command. Oracle used up process quota.

6. kill df process
kill -9 process_id
bulk kill
ps -ef | grep oracle | grep df | awd ' {print "kill -9 ' $2;}
run the output.


reference:
http://www.linuxquestions.org/questions/linux-general-1/fork-resource-temporarily-unavailable-100086/
http://www.webhosting.uk.com/forums/linux-dedicated-servers/5770-fork-resource-temporarily-unavailable.html
http://www.thegeekstuff.com/2010/01/awk-introduction-tutorial-7-awk-print-examples/

Wednesday, June 6, 2012

nologging in oracle

1. nologging option is used for bulk insert to speed up operation and improve performance by reduce redo generation.

2. It will not work for update and delete.

3. for insert, /* append */ hint must be used and talbe must be nologging mode

4. it is very useful for create table from existing resource so that no recovery needed if instance crashed.

EXP: create table tt nologging as select * from testtable.

5. alter table move  and alter index build just like APPEND.

6. table from ASK TOM



Tom's Table:
------------

Table Mode    Insert Mode     ArchiveLog mode      result
-----------   -------------   -----------------    ----------
LOGGING       APPEND          ARCHIVE LOG          redo generated
NOLOGGING     APPEND          ARCHIVE LOG          no redo
LOGGING       no append       ""                   redo generated
NOLOGGING     no append       ""                   redo generated
LOGGING       APPEND          noarchive log mode   no redo
NOLOGGING     APPEND          noarchive log mode   no redo
LOGGING       no append       noarchive log mode   redo generated
NOLOGGING     no append       noarchive log mode   redo generated

reference:
http://asktom.oracle.com/pls/asktom/f?p=100:11:0::::P11_QUESTION_ID:5280714813869
http://jakub.wartak.pl/blog/?page_id=107

Tuesday, June 5, 2012

how to get sql execution information


the basic steps to find out sql exectuion information for tuning

1. explain plan
This will give you how sql is executed.

explain plan for <sql statement >
select * from table (dbms_xplan.display);

2. autotrace
Autotrace can be set on to display explain plan and statistics automatically

set autotrace on


3. trace file
Trace file can be generated to provide more execution information. User need alter session privilege.

alter session set sql_trace true

find out trace file name
select value from v$diag_info where name = 'Default Trace File';

user tkprof to generate readable file from trace file
tkprof <trace file> a.txt sys=no sort=prsela exeela fetchela

4. user dbms_profiler to check plsql code



reference:
https://forums.oracle.com/forums/thread.jspa?threadID=501834&start=0&tstart=0
http://www.articles.freemegazone.com/oracle-trace-file.php
http://asktom.oracle.com/pls/asktom/f?p=100:11:0::::P11_QUESTION_ID:458240723799

sqlplus in linux

sqlplus command
L : last command
R: rerun last command \
c/newtext/oldtext: correct last input
ed: use editor to edit last command


reference:
http://en.kioskea.net/faq/577-oracle-using-sqlplus-under-linux

Monday, June 4, 2012

Informatica PCSF_46008 Cannot Connect to domain Domain_test to lookup service Core Service/UserManagementService

1.Problem:
informatica power center repository client can not connect to informatica server.

2.Error:
PCSF_46008 Cannot Connect to domain Domain_test to lookup service Core Service/UserManagementService

3.Condition:
informatica server is running well. Repository service test is available. domain is accessable through server and admin console is accessible from remote login. hostame is DNS resovable.

4.Cause:
partial hostname is used in domain name and the partial hostname is not resovable to IP.

EXP:     hostname is test.new.com
             domain name is Domain_test
            when you configure domain in repository client, it will user test to access the informatica server.   
            if test is not resovable, then repository client connection will fail with error " PCSF_46008 Cannot Connect to domain Domain_test to lookup service Core Service/UserManagementService"

5.Solution:
a. reinstall the informatica server with domain name like Domain_test.new.com
b. add IP test into your local hosts file.

6.testing:
./infacmd.sh listAllUsers -dn Domain_test001 -un Administrator -pd Administrator -sdn Native -hp test001:6001 -re 100
http://test.new.com:6001/coreservices/DomainService



reference:
https://forums.oracle.com/forums/thread.jspa?messageID=4346396
https://kr.forums.oracle.com/forums/thread.jspa?threadID=2220126
http://datawarehouse.ittoolbox.com/groups/technical-functional/informatica-l/can-you-change-the-domain-name-in-informatica-86-2889070

Friday, June 1, 2012

dbms_system in oracle database

dbms_system is a system package, which is not supported by Oracle.

It has below procedure:
1. ksdwrt -- write message to alert or trace file
  dbms_system.ksdwrt(1,'put message to alert')
        option 1- in trace file
        option 2- in alert log
        option 3- in both

2. set_sql_trace_in_session -- set sql trace to another session
    dbms_system.set_sql_trace_in_session(sid, serial#, true)

3. set_ev -- set event trace on session
    dbms_system.set_ev(sid,serial#, event, level, name)
    dbms_system.Set_Ev(31, 97, 10046, 4, '');

4. read_ev -- read event trace setting on session.
    dbms_system.read_ev(event, output)

Privilege to use dbms_system
1. login as sys
   grant execute on dbms_system to user;
2. login as user
   exec sys.dbms_system.ksdwrt(2,'alert message') ;



preference:
http://www.oracle-base.com/articles/8i/dbms_system.php
http://space.itpub.net/519536/viewspace-616481