Wednesday, July 24, 2013

Datawarehousing Concepts

Datawarehousing Concepts:
Ø  Physical and Logical Data modeling
Ø  Creating Physical tables and schemas
Ø  Creating Oracle Queries
Ø  Data base installations
Ø  Dataware house concepts
Ø  Star Schema , Snowflake Schema and Galaxy Schema
Ø  SCD Types  ( slowly changing dimentions)
Ø  Dimentional modeling
Ø  Data modeling
Ø  ODI Installations
Ø  Weblogic Installations and configurations
Ø  Oracle Data Integrator 11G New Features Overview

Tuesday, July 23, 2013

Oracle Data Integrator Interview Questions and Answers

1. what is load plans and types of load plans?
ANS) Load plan is a process to run or execute multiple scenarios as a Sequential or parallel or conditional based execution of your scenarios. And same we can call three types of load plans , Sequential, parallel and Condition based load plans.
2. what is profile in odi?
ANS)  profile is a set of objective wise privileges. we can assign this profiles to the users. Users will get the privileges from profile. Please refer http://oditraining.blogspot.co.uk/2012/06/odi-security-manager-all-profiles.html


3 what is the odi console?
ANS) ODI console is a web based navigator to access the Designer, Operator and Topology components through browser.

4.how to write the sub queries in odi?
ANS:)Using Yellow interface and sub queries option we can create sub queries in odi.
or Using  VIEW we can go for sub queries Or Using ODI Procedure we can call direct DB queries
in ODI.

5.suppose i having 6 interfaces and running the interface 3 rd one failed how to run remaining interfaces?
ANS: ) if you are running Sequential load it will stop the other interfaces. so goto operator and right click on filed interface and click on restart. If you are running all the interfaces are parallel only one interface will fail and other interfaces will finish.

6. how to remove the duplicate in odi?
ANS) Use DISTINCT in IKM level. it will remove the duplicate rows while loading into target.

7. suppose having unique and duplicate but i want to load unique record one table and duplicates one table?
ANS) Create two interfaces or once procedure and use two queries one for Unique values and one for duplicate values.

8. how to write the procedures in odi?
ANS) Procedure is a step by step any technology code operations . you can refer


 

Oracle Data Integrator Interview questions and Answers

1)how to implement the logic in procedures if the source side data deleted that will reflect the target side table
ANS)User this query on Command on target Delete from Target_table where not exists (Select 'X' From Source_table Where Source_table.ID=Target_table.ID).

2)if the src hav total 15 records with 2 records are updated and 3 records are newly inserted at the target side we have to load the newly changed and inserted records
ANS) Use IKM Incremental Update Knowledge Module for Both Insert n Update operations.

3)can we implement package in package?
ANS:) Yes we can call one package into other package.

4)how to load the data with one flat file and one rdbms table using joins?
ANS:) Drog n drop both File and table into source area and join as in Staging area.

5)in the package one interface got failed how to know which interface got failed if we no access to operator?
ANS:)Make it mail alert or check into SNP_SESS_LOg tables for session log details.

6)if the src and tgt are oracle technology tell me the process to achieve this requirement(interfaces,kms,models)
ANS) Use LKM SQL to SQL or LKM SQL to Oracle , IKM Oracle Incremental update or Control append.

7)how to implement data validations?
ANS:) Use Filters & Mapping Area AND DataQuality related to constraints use CKM Flowcontrol.

8)how to handle exceptions?
ANS) Exceptions In packages advanced tab and load plan exception tab we can handle exceptions.

9)what we specify the in xml dataserver and parameters for to connect to xml file?
ANS:) Filename with location :F and Schema :S this two parameters

10)how to implement cdc
ANS) CDC is a step by step process please refer.  http://oditraining.blogspot.in/2012/09/cdc-changed-data-capture-in-odi-step-by.html

11)how to reverse engineer views(how to load the data from views)?
ANS) In Models Goto Reverse engineering tab and select Reverse engineering object as
VIEW.



12) What is Start Schema and Snowflake Schema?
Please refer DWH Concepts. http://oditraining.blogspot.in/2012/07/data-ware-housing-concepts-with.html

Tuesday, July 16, 2013

find the files more than 30 days linux / unix

Finding files more than 30 days.

find . -type f -mtime +30

Finding all directories more than 30 days

find . -type d -mtime +30


Find the all files more than 30 days with size gb

find . -type f -mtime +30  | df -g

Find all files more than 30 days  and delete

find . -type f -mtime +30 | | xargs rm

Tuesday, May 28, 2013

ODI 11.1.1.7 version require jdk1.6.0_24 version and higher versions( JDK1.7)

ODI 11.1.1.7 version require jdk1.6.0_24 version and higher versions( JDK1.7 we can use this but oracle not yet certified and right click wont work in ODI Studio ). It won't support for jdk1.6.0_23 and lower version.

ODI 11G 11.1.1.7 New Feature WebSphere integration....
ODI 11.1.1.7 version require   jdk1.6.0_24 version and higher versions( JDK1.7).  It won't support for jdk1.6.0_23  and lower version.

ODI 11G 11.1.1.7 New Feature WebSphere integration....

Friday, May 24, 2013

Unix VI Editor commands

START VI EDITTOR
----------------
     vi filename     edit filename starting at line 1
      vi -r filename     recover filename that was being edited when system crashed
   
EXIT VI
--------
    :x<Return>     quit vi, writing out modified file to file named in original invocation
      :wq<Return>     quit vi, writing out modified file to file named in original invocation
      :q<Return>     quit (or exit) vi
     :q!<Return>     quit vi even though latest changes have not been saved for this vi call

MOVING THE CURSOR:
-----------------
    j or <Return>
  [or down-arrow]     move cursor down one line
     k [or up-arrow]     move cursor up one line
     h or <Backspace>
  [or left-arrow]     move cursor left one character
     l or <Space>
  [or right-arrow]     move cursor right one character
     0 (zero)     move cursor to start of current line (the one with the cursor)
     $     move cursor to end of current line
      w     move cursor to beginning of next word
      b     move cursor back to beginning of preceding word
      :0<Return> or 1G     move cursor to first line in file
      :n<Return> or nG     move cursor to line n
      :$<Return> or G     move cursor to last line in file
   
SCREEN MANIPULATION:
-------------------
     ^f     move forward one screen
      ^b     move backward one screen
      ^d     move down (forward) one half screen
      ^u     move up (back) one half screen
      ^l     redraws the screen
      ^r     redraws the screen, removing deleted lines
   
UNDO:
-----
    u     UNDO WHATEVER YOU JUST DIDA
   
INSERTING OR ADDING TEXT:
------------------------

    i     insert text before cursor, until <Esc> hit
      I     insert text at beginning of current line, until <Esc> hit
     a     append text after cursor, until <Esc> hit
      A     append text to end of current line, until <Esc> hit
     o     open and put text in a new line below current line, until <Esc> hit
     O     open and put text in a new line above current line, until <Esc> hit
   
CHANGING TEXT:
--------------
    r     replace single character under cursor (no <Esc> needed)
      R     replace characters, starting with current cursor position, until <Esc> hit
      cw     change the current word with new text,
        starting with the character under cursor, until <Esc> hit
      cNw     change N words beginning with character under cursor, until <Esc> hit;
  e.g., c5w changes 5 words
      C     change (replace) the characters in the current line, until <Esc> hit
      cc     change (replace) the entire current line, stopping when <Esc> is hit
      Ncc or cNc     change (replace) the next N lines, starting with the current line,
        stopping when <Esc> is hit   
       
DELETING TEXT:
--------------

    x     delete single character under cursor
      Nx     delete N characters, starting with character under cursor
      dw     delete the single word beginning with character under cursor
      dNw     delete N words beginning with character under cursor;
  e.g., d5w deletes 5 words
      D     delete the remainder of the line, starting with current cursor position
     dd     delete entire current line
      Ndd or dNd     delete N lines, beginning with the current line;
  e.g., 5dd deletes 5 lines

CUT & PASTE:
-----------
    yy     copy (yank, cut) the current line into the buffer
      Nyy or yNy     copy (yank, cut) the next N lines, including the current line, into the buffer
      p     put (paste) the line(s) in the buffer into the text after the current line 
   
SEARCHING STRING:
-----------------   
    /string     search forward for occurrence of string in text
      ?string     search backward for occurrence of string in text
      n     move to next occurrence of search string
      N     move to next occurrence of search string in opposite direction
 
DELETING LINE NUMBERS:
----------------------

    :.=     returns line number of current line at bottom of screen
      :=     returns the total number of lines at bottom of screen
      ^g     provides the current line number, along with the total number of lines,
        in the file at the bottom of the screen
       
SAVING & READING FILES:
-----------------------
    :r filename<Return>     read file named filename and insert after current line
        (the line with cursor)
      :w<Return>     write current contents to file named in original vi call
      :w newfile<Return>     write current contents to a new file named newfile
      :12,35w smallfile<Return>     write the contents of the lines numbered 12 through 35 to a new file named smallfile
      :w! prevfile<Return>     write current contents over a pre-existing file named prevfile
   
MOVING THE CURSOR:
-----------------
    h    left one space       
    l    right one space
    j    down one space       
    k    up one space

UNIX CRONTAB Commands

CRONTAB COMMANDS:
-----------------
crontab -l                 #Lists the contents of your current crontab file
crontab -e                 #Edits your current crontab file (when the file saved, the cron daemon is automatically refreshed.)
crontab -r                 #Removes your crontab file from the crontab directory
crontab -v                 #check crontab submission time
crontab mycronfile         #submit your crontab file to /var/spool/cron/crontabs directory

crontab file format:
minute    hour    day_of_month    month        weekday        command
0-59      0-23    1-31            1-12        0-6 Sun-Sat     shell command

* * * * * /bin/script.sh        #schedule a job to run every minute
0 1 15 * * /fullbackup          #1 am on the 15th of every month
0 0 * * 1-5 /usr/sbin/backup    #start the backup command at midnight, Mo - Fr
0,15,30,45 6-17 * * 1-5 /home/script1    #execute script1 every 15 minutes between 6AM and 5PM, Mo - Fr

Friday, April 26, 2013

PLSQL CURSORS

CURSORS

Cursor is a pointer to memory location which is called as context area which contains the information necessary for processing, including the number of rows processed by the statement, a pointer to the parsed representation of the statement, and the active set which is the set of rows returned by the query.

Cursor contains two parts
ü  Header
ü  Body
Header includes cursor name, any parameters and the type of data being loaded.
Body includes the select statement.
Ex:
Cursor c(dno in number) return dept%rowtype is select *from dept;
           In the above
                        Header – cursor c(dno in number) return dept%rowtype
                        Body – select *from dept

CURSOR TYPES
Ø  Implicit (SQL)
Ø  Explicit
ü  Parameterized cursors
ü  REF cursors
CURSOR STAGES
Ø  Open
Ø  Fetch
Ø  Close

CURSOR ATTRIBUTES
Ø  %found
Ø  %notfound
Ø  %rowcount
Ø  %isopen
Ø  %bulk_rowcount
Ø  %bulk_exceptions
CURSOR DECLERATION

Syntax:
     Cursor <cursor_name> is select statement;
Ex:
     Cursor c is select *from dept;

CURSOR LOOPS

Ø  Simple loop
Ø  While loop
Ø  For loop

SIMPLE LOOP

Syntax:
            Loop
                   Fetch <cursor_name> into <record_variable>;
                   Exit when <cursor_name> % notfound;
                  <statements>;
            End loop;
Ex:
     cursor c is select * from student;
     v_stud student%rowtype;
BEGIN
     open c;
     loop
        fetch c into v_stud;
        exit when c%notfound;
        dbms_output.put_line('Name = ' || v_stud.name);
     end loop;
     close c;
END;


Output:
Name = saketh
Name = srinu
Name = satish
Name = sudha

WHILE LOOP

Syntax:
            While <cursor_name> % found loop
                   Fetch <cursor_name> into <record_variable>;
                  <statements>;
            End loop;
Ex:
DECLARE
     cursor c is select * from student;
     v_stud student%rowtype;
BEGIN
     open c;
     fetch c into v_stud;
     while c%found loop
          fetch c into v_stud;
          dbms_output.put_line('Name = ' || v_stud.name);
     end loop;
     close c;
END;

Output:
Name = saketh
Name = srinu
Name = satish
Name = sudha

FOR LOOP

Syntax:
            for <record_variable> in <cursor_name> loop
                  <statements>;
            End loop;
Ex:
DECLARE
     cursor c is select * from student;
BEGIN
     for v_stud in c loop
         dbms_output.put_line('Name = ' || v_stud.name);
     end loop;
END;

Output:
Name = saketh
Name = srinu
Name = satish
Name = sudha

PARAMETARIZED CURSORS

Ø  This was used when you are going to use the cursor in more than one place with different values for the same where clause.
Ø  Cursor parameters must be in mode.
Ø  Cursor parameters may have default values.
Ø  The scope of cursor parameter is within the select statement.

Ex:
     DECLARE
         cursor c(dno in number) is select * from dept where deptno = dno;
         v_dept dept%rowtype;
      BEGIN
         open c(20);
         loop
             fetch c into v_dept;
             exit when c%notfound;
            dbms_output.put_line('Dname = ' || v_dept.dname || ' Loc = ' || v_dept.loc);
         end loop;
         close c;
     END;

Output:
     Dname = RESEARCH Loc = DALLAS

PACKAGED CURSORS WITH HEADER IN SPEC AND BODY IN PACKAGE BODY

Ø  cursors declared in packages will not close automatically.
Ø  In packaged cursors you can modify the select statement without making any changes to the cursor header in the package specification.
Ø  Packaged cursors with must be defined in the package body itself, and then use it as global for the package.
Ø  You can not define the packaged cursor in any subprograms.
Ø  Cursor declaration in package with out body needs the return clause.
Ex:
CREATE OR REPLACE PACKAGE PKG IS
                              cursor c return dept%rowtype is select * from dept;
                procedure proc is
END PKG;

CREATE OR REPLACE PAKCAGE BODY PKG IS
      cursor c return dept%rowtype is select * from dept;
PROCEDURE PROC IS
BEGIN
      for v in c loop
           dbms_output.put_line('Deptno = ' || v.deptno || ' Dname = ' || v.dname || '    
                                                  Loc = ' || v.loc);
      end loop;
END PROC;
END PKG;
Output:
SQL> exec pkg.proc
        Deptno = 10 Dname = ACCOUNTING Loc = NEW YORK
        Deptno = 20 Dname = RESEARCH Loc = DALLAS
        Deptno = 30 Dname = SALES Loc = CHICAGO
                  Deptno = 40 Dname = OPERATIONS Loc = BOSTON
CREATE OR REPLACE PAKCAGE BODY PKG IS
      cursor c return dept%rowtype is select * from dept where deptno > 20;
PROCEDURE PROC IS
BEGIN
      for v in c loop
           dbms_output.put_line('Deptno = ' || v.deptno || ' Dname = ' || v.dname || '    
                                                  Loc = ' || v.loc);
      end loop;
END PROC;
END PKG;
Output:
             SQL> exec pkg.proc
        Deptno = 30 Dname = SALES Loc = CHICAGO
                  Deptno = 40 Dname = OPERATIONS Loc = BOSTON

REF CURSORS AND CURSOR VARIABLES

Ø  This is unconstrained cursor which will return different types depends upon the user input.
Ø  Ref cursors can not be closed implicitly.
Ø  Ref cursor with return type is called strong cursor.
Ø  Ref cursor with out return type is called weak cursor.
Ø  You can declare ref cursor type in package spec as well as body.
Ø  You can declare ref cursor types in local subprograms or anonymous blocks.
Ø  Cursor variables can be assigned from one to another.
Ø  You can declare a cursor variable in one scope and assign another cursor variable with different scope, then you can use the cursor variable even though the assigned cursor variable goes out of scope.
Ø  Cursor variables can be passed as a parameters to the subprograms.
Ø  Cursor variables modes are in or out or in out.
Ø  Cursor variables can not be declared in package spec and package body (excluding subprograms).
Ø  You can not user remote procedure calls to pass cursor variables from one server to another.
Ø  Cursor variables can not use for update clause.
Ø  You can not assign nulls to cursor variables.
Ø  You can not compare cursor variables for equality, inequality and nullity.
Ex:
    CREATE OR REPLACE PROCEDURE REF_CURSOR(TABLE_NAME IN VARCHAR) IS                                                                         
         type t is ref cursor;                                                                                                  
              c t;                                                                                                                   
         v_dept dept%rowtype;                                                                                                   
         type r is record(ename emp.ename%type,job emp.job%type,sal emp.sal%type);                                              
         v_emp r;                                                                                                               
         v_stud student.name%type;                                                                                               
    BEGIN                                                                                                                  
         if table_name = 'DEPT' then                                                                                             
            open c for select * from dept;                                                                                         
         elsif table_name = 'EMP' then                                                                                           
            open c for select ename,job,sal from emp;                                                                              
         elsif table_name = 'STUDENT' then                                                                                       
            open c for select name from student;                                                                                   
         end if;                                                                                                                 
         loop                                                                                                                   
            if table_name = 'DEPT' then                                                                                             
               fetch c into v_dept;                                                                                                   
               exit when c%notfound;                                                                                                   
               dbms_output.put_line('Deptno = ' || v_dept.deptno || ' Dname = ' ||     
               v_dept.dname   || ' Loc = ' || v_dept.loc);                        
            elsif table_name = 'EMP' then                                                                                          
                fetch c into v_emp;                                                                                                    
                exit when c%notfound;                                                                                                  
               dbms_output.put_line('Ename = ' || v_emp.ename || ' Job = ' || v_emp.job || ' Sal
               = ' || v_emp.sal);                         
            elsif table_name = 'STUDENT' then                                                                                      
                 fetch c into v_stud;                                                                                                    
                 exit when c%notfound;                                                                                                  
                 dbms_output.put_line('Name = ' || v_stud);                                                                              
            end if;                                                                                                                
         end loop;                                                                                                               
         close c;                                                                                                               
    END;
Output:

SQL> exec ref_cursor('DEPT')

Deptno = 10 Dname = ACCOUNTING Loc = NEW YORK
Deptno = 20 Dname = RESEARCH Loc = DALLAS
Deptno = 30 Dname = SALES Loc = CHICAGO
Deptno = 40 Dname = OPERATIONS Loc = BOSTON

SQL> exec ref_cursor('EMP')

Ename = SMITH Job = CLERK Sal = 800
Ename = ALLEN Job = SALESMAN Sal = 1600
Ename = WARD Job = SALESMAN Sal = 1250
Ename = JONES Job = MANAGER Sal = 2975
Ename = MARTIN Job = SALESMAN Sal = 1250
Ename = BLAKE Job = MANAGER Sal = 2850
Ename = CLARK Job = MANAGER Sal = 2450
Ename = SCOTT Job = ANALYST Sal = 3000
Ename = KING Job = PRESIDENT Sal = 5000
Ename = TURNER Job = SALESMAN Sal = 1500
Ename = ADAMS Job = CLERK Sal = 1100
Ename = JAMES Job = CLERK Sal = 950
Ename = FORD Job = ANALYST Sal = 3000
Ename = MILLER Job = CLERK Sal = 1300

SQL> exec ref_cursor('STUDENT')

Name = saketh
Name = srinu
Name = satish
Name = sudha                                                                                                                   



CURSOR EXPRESSIONS

Ø  You can use cursor expressions in explicit cursors.
Ø  You can use cursor expressions in dynamic SQL.
Ø  You can use cursor expressions in REF cursor declarations and variables.
Ø  You can not use cursor expressions in implicit cursors.
Ø  Oracle opens the nested cursor defined by a cursor expression implicitly as soon as it fetches the data containing the cursor expression from the parent or outer cursor.
Ø  Nested cursor closes if you close explicitly.
Ø  Nested cursor closes whenever the outer or parent cursor is executed again or closed or canceled.
Ø  Nested cursor closes whenever an exception is raised while fetching data from a parent cursor.
Ø  Cursor expressions can not be used when declaring a view.
Ø  Cursor expressions can be used as an argument to table function.
Ø  You can not perform bind and execute operations on cursor expressions when using the cursor expressions in dynamic SQL.

USING NESTED CURSORS OR CURSOR EXPRESSIONS

Ex:
DECLARE
cursor c is select ename,cursor(select dname from dept d where e.empno = d.deptno)  from emp e;
type t is ref cursor;
c1 t;
c2 t;
v1 emp.ename%type;
v2 dept.dname%type;
BEGIN
open c;
loop
     fetch c1 into v1;
          exit when c1%notfound;
          fetch c2 into v2;
          exit when c2%notfound;
          dbms_output.put_line('Ename = ' || v1 || ' Dname = ' || v2);
end loop;
end loop;
close c;
END;

CURSOR CLAUSES

Ø  Return
Ø  For update
Ø  Where current of
Ø  Bulk collect

RETURN

Cursor c return dept%rowtype is select *from dept;
Or
Cursor c1 is select *from dept;
Cursor c  return c1%rowtype is select *from dept;
Or
Type t is record(deptno dept.deptno%type, dname dept.dname%type);
Cursor c return t is select deptno, dname from dept;

FOR UPDATE AND WHERE CURRENT OF

Normally, a select operation will not take any locks on the rows being accessed. This will allow other sessions connected to the database to change the data being selected. The result set is still consistent. At open time, when the active set is determined, oracle takes a snapshot of the table. Any changes that have been committed prior to this point are reflected in the active set. Any changes made after this point, even if they are committed, are not reflected unless the cursor is reopened, which will evaluate the active set again.

However, if the FOR UPDATE caluse is pesent, exclusive row locks are taken on the rows in the active set before the open returns. These locks prevent other sessions from changing the rows in the active set until the transaction is committed or rolled back. If another session already has locks on the rows in the active set, then SELECT … FOR UPDATE operation will wait for these locks to be released by the other session. There is no time-out for this waiting period. The SELECT…FOR UPDATE will hang until the other session releases the lock. To handle this situation, the NOWAIT clause is available.

Syntax:
               Select …from … for update of column_name [wait n];

If the cursor is declared with the FOR UPDATE clause, the WHERE CURRENT OF clause can be used in an update or delete statement.

Syntax:
               Where current of cursor;
Ex:
DECLARE
       cursor c is select * from dept for update of dname;
BEGIN
       for v in c loop
             update dept set dname = 'aa' where current of c;
             commit;
       end loop;
END;