06 May 2011

DSEenable_impersonation

START DS SERVICE with user dsadm and it asked for password
 
The following steps will help above problem.
1. log-on as root
2. stop datastage
3. run . ./dsenv
4. run script DSEenable_impersonation.sh is in $DSHOME/scripts
5. test start by using dsadm

How to restart IIS Suite


1) Stop DataStage 
login as dsadm
cd /opt/IBM/InformationServer/Server/DSEngine
. ./dsenv
./bin/uv -admin -stop

2) Stop NodeAgent (ASBNode)
login as root
cd /opt/IBM/InformationServer/ASBNode/bin
./NodeAgents.sh stop

3) Stop WAS
login as root
cd /opt/IBM/WebSphere/AppServer/bin
./stopServer.sh server1 -username wasadmin -password wasadmin

4) Start WAS
login as root
cd /opt/IBM/WebSphere/AppServer/bin
./startServer.sh server1 -username wasadmin -password wasadmin

5) Start NodeAgent (ASBNode)
login as root
cd /opt/IBM/InformationServer/ASBNode/bin
./NodeAgents.sh start
6) Start DataStage 
login as dsadm
cd /opt/IBM/InformationServer/Server/DSEngine
. ./dsenv
./bin/uv -admin -start

04 October 2010

How to make an Index creation Faster

When an index is created on a table , a full table scan is
performed. Oracle fetches rows from the table into memory and sorts them prior  to creating the index.  For this task, Oracle requires sort area space in memory.  If memory areas for sorting are not large enough, Oracle will divide the data into smaller sections, sort each section individually, and then merge  together the results.  This is not as efficient as if memory allocated were large enough for the sort.

1) Increase "SORT_AREA_SIZE" parameter in the "init.ora".

 Sqlplus> alter session set sort_area_size=25000;


2) PARALLEL Option: While creating index oracle must first collect the symbolic key/ROWID pairs with a full-table scan. With Parallel option supplied to the create index script oracle will

scan full table parallel based on the number of CPUs, table partitioning and disk configuration and thus do the tasks faster.

On a server that have 6 CPUs you may give parallel 5 as below.
create index emp_idx on emp(id,code) parallel 5;

3) NOLOGGING Option: With the NOLOGGING option provided while creating index you can restrict database to generate a large redo log. NOLOGGING option generates minimal redo. So you will achieve higher performance.

create index emp_idx on emp(id,code) parallel 5 nologging;

 4) Larger Block Size: You can create an index in a tablespace that uses Larger block size. If you have DSS environment then you can do it. This will improve performance while creating index.

You can do it by first creating a tablespace with 32k blocksize and then create index under it,

create tablespace index_ts
datafile '/u01/index_file.dbf' size 1024m
blocksize 32k;

create index emp_idx on emp(id,code) parallel 5 nologging  tablespace index_ts;

Tag: Oracle, Rebuild Index, Create Index

Import Sequential File with Extra Column


Job reads sequential file and load into RDBMS table.

What happen if sequential file has extra column in the back of each record?

It depends on data type of last column defined by DS and RDBMS table.
  • If data type of last column = varchar, extra column will be included as last column.
  • If data type of last column = numeric, last column value will become 0 because there is delimiter character which usually not a numeric.
  • If data type of last column = date, extra column will be dropped.
Their result base on transformer stage behavior on implicit data type conversion.



01 August 2010

วิธีการ create table บน Teradata

วิธีการสร้าง Permanent Table

CREATE SET TABLE DB1.TABLE1, NO FALLBACK
      ( CALL_START_DT DATE,
        ACCT_ID INTEGER,
        MSISDN VARCHAR(15),
        VC_AMNT DECIMAL(18,4),
        VAS_AMNT DECIMAL(18,4)
      )
UNIQUE PRIMARY INDEX (CALL_START_DT,ACCT_ID,MSISDN); 

วิธีการสร้าง Volatile Table (Temporary Table)

แบบที่ 1 - แบบระบุ column

CREATE VOLATILE SET TABLE VOL_TABLE1, NO LOG
      ( CALL_START_DT DATE,
        ACCT_ID INTEGER,
        MSISDN VARCHAR(15),
        VC_AMNT DECIMAL(18,4),
        VAS_AMNT DECIMAL(18,4)
      )
UNIQUE PRIMARY INDEX (CALL_START_DT,ACCT_ID,MSISDN) ON COMMIT PRESERVE ROWS;
แบบที่ 2 - แบบ select มาจาก table อื่นอีกที
 CREATE VOLATILE MULTISET TABLE VOL_TABLE2, NO LOG AS
      ( SELECT ACCT_ID, MSISDN, PKG_NM, PKG_START_DT, PKG_END_DT
        FROM DB2.TABLE2
        WHERE SWON_DT >= '2010-01-01'
      ) WITH DATA
PRIMARY INDEX (ACCT_ID,MSISDN)
INDEX (PKG_NM) ON COMMIT PRESERVE ROWS;
การ create แบบที่ 2 จะได้ schema table ตาม data ที่ select มา
โดยจะต้องมีการระบุว่า WITH DATA (ได้มาทั้ง schema และ data) 
หรือ WITH NO DATA (ได้ schema อย่างเดียว ไม่เอา data)

Teradata Table Type and Index Type

Teradata มี table อยู่ 2 ประเภท คือ
  1. Set table: การเก็บข้อมูลใน table จะต้องไม่มี data ที่ duplicate กันทั้ง record กรณีที่มี data duplicate เข้ามาจะโดน reject ออก
  2. Multiset table: สามารถมี data ที่ duplicate กันทั้ง record เก็บใน table เดียวกันได้
Index เป็นตัวกำหนดการกระจายตัวของ data ลงในแต่ละ disk มีผลต่อประสิทธิภาพในการ access data 
มี 2 ประเภท เช่นกัน ได้แก่
  1. Primary Index (PI): column ที่กำหนดสามารถเป็น column ที่เป็น unique data หรือไม่ก็ได้
  2. Unique Primary Index (UPI): column ที่กำหนดจะต้องเป็น column ที่เป็น unique data

NLS_DATE_FORMAT

สำหรับ Oracle ถ้าอยากให้ผลของ SQL display date ออกมาเป็นยังงัย ให้รัน command นี้ก่อนเพื่อกำหนด format ของ session นั้น
alter session set NLS_DATE_FORMAT = 'mm-dd-yyyy HH24:mi:ss';