Sunday, June 15, 2014

Understanding Interface Quick Edit objects in Interface in ODI 11G?



INTERFACE QUICK EDIT Components List

Parameter Value              Description
INS        

    LKM: Not applicable (*)

    IKM: Only for mapping expressions marked with insertion

    CKM: Not applicable

UPD      

    LKM: Not applicable (*)

    IKM: Only for mapping expressions marked with update

    CKM: Not applicable

TRG       

    LKM: Not applicable (*)

    IKM: Only for mapping expressions executed on the target

    CKM: Not applicable

NULL    

    LKM: Not applicable (*)

    IKM: All mapping expressions loading not nullable columns

    CKM: All target columns that do not accept null values

PK          

    LKM: Not applicable (*)

    IKM: All mapping expressions loading the primary key columns

    CKM: All the target columns that are part of the primary key

UK         

    LKM: Not applicable (*)

    IKM: All the mapping expressions loading the update key column chosen for the current interface

    CKM: Not applicable

REW      

    LKM: Not applicable (*)

    IKM: All the mapping expressions loading the columns with read only flag not selected

    CKM: All the target columns with read only flag not selected

UD1      

    LKM: Not applicable (*)

    IKM: All mapping expressions loading the columns marked UD1

    CKM: Not applicable

UD2      

    LKM: Not applicable (*)

    IKM: All mapping expressions loading the columns marked UD2

    CKM: Not applicable

UD3      

    LKM: Not applicable (*)

    IKM: All mapping expressions loading the columns marked UD3

    CKM: Not applicable

UD4      

    LKM: Not applicable (*)

    IKM: All mapping expressions loading the columns marked UD4

    CKM: Not applicable

UD5      

    LKM: Not applicable (*)

    IKM: All mapping expressions loading the columns marked UD5

    CKM: Not applicable

MAP     

    LKM: Not applicable

    IKM: Not applicable

    CKM:

Flow control: All columns of the target table loaded with expressions in the current interface

Static control: All columns of the target table
SCD_SK                LKM, CKM, IKM: All columns marked SCD Behavior: Surrogate Key in the data model definition.
SCD_NK               LKM, CKM, IKM: All columns marked SCD Behavior: Natural Key in the data model definition.
SCD_UPD            LKM, CKM, IKM: All columns marked SCD Behavior: Overwrite on Change in the data model definition.
SCD_INS              LKM, CKM, IKM: All columns marked SCD Behavior: Add Row on Change in the data model definition.
SCD_FLAG           LKM, CKM, IKM: All columns marked SCD Behavior: Current Record Flag in the data model definition.
SCD_START         LKM, CKM, IKM: All columns marked SCD Behavior: Starting Timestamp in the data model definition.
SCD_END             LKM, CKM, IKM: All columns marked SCD Behavior: Ending Timestamp in the data model definition.
NEW      Actions: the column added to a table, the new version of the modified column of a table.
OLD        Actions: The column dropped from a table, the old version of the modified column of a table.
WS_INS                SKM: The column is flagged as allowing INSERT using Data Services.
WS_UPD              SKM: The column is flagged as allowing UDATE using Data Services.
WS_SEL                SKM: The column is flagged as allowing SELECT using Data Services.

How to understand Knowledge Modules in ODI or How to Customise Knowledge Module in ODI?

Using Below all parameters we can understand the Knowledge Modules.



ODI Substitution Parameters L,W,D,P,S usage and meanings

Parameter pMode

L:
use the local object mask to build the complete path of the object.


 R:

Uses the object mask to build the complete path of the object.
use the remote object mask to build the complete path of the object.

Note: When using the remote object mask, getObjectName always resolved the object name using the default physical schema of the remote server.

A:

 Automatic: Defines automatically the adequate mask to use.

 Parameter Location

   W:

Returns the complete name of the object in the physical catalog and the "work" physical schema that corresponds to the specified tuple (context, logical schema)

    D:
Returns the complete name of the object in the physical catalog and the data physical schema that corresponds to the specified tuple (context, logical schema)

A:

Lets Oracle Data Integrator determine the default location of the object. This value is used if pLocation is not specified.

    P:

Qualify object for the partition provided in pPartitionName

    S:

Qualify object for the sub-partition provided in pPartitionName

Parameter  pProperty:




    ID: Datastore identifier.

    TARG_NAME: Full name of the target datastore. In actions, this parameter returns the name of the current table handled by the DDL command. If partitioning is used on the target datastore of an interface, this property automatically includes the partitioning clause in the datastore name.

    RES_NAME: Physical name of the target datastore. In actions, this parameter returns the name of the current table handled by the DDL command. This property does not include the partitioning information.

    COLL_NAME: Full name of the loading datastore.

    INT_NAME: Full name of the integration datastore.

    ERR_NAME: Full name of the error datastore.

    CHECK_NAME: Name of the error summary datastore.

    CT_NAME: Full name of the checked datastore.

    FK_PK_TABLE_NAME: Full name of the datastore referenced by a foreign key.

    JRN_NAME: Full name of the journalized datastore.

    JRN_VIEW: Full name of the view linked to the journalized datastore.

    JRN_DATA_VIEW: Full name of the data view linked to the journalized datastore.

    JRN_TRIGGER: Full name of the trigger linked to the journalized datastore.

    JRN_ITRIGGER: Full name of the Insert trigger linked to the journalized datastore.

    JRN _UTRIGGER: Full name of the Update trigger linked to the journalized datastore.

    JRN_DTRIGGER: Full name of the Delete trigger linked to the journalized datastore.

    SUBSCRIBER_TABLE: Full name of the datastore containing the subscribers list.

    CDC_SET_TABLE: Full name of the table containing list of CDC sets.

    CDC_TABLE_TABLE: Full name of the table containing the list of tables journalized through CDC sets.

    CDC_SUBS_TABLE: Full name of the table containing the list of subscribers to CDC sets.

    CDC_OBJECTS_TABLE: Full name of the table containing the journalizing parameters and objects.

    <flexfield_code>: Flexfield value for the current target table.



One Example For Substitution Methods
Procedure Details for Loading Data from a Remote SQL Database
Source Technology
Oracle
Source Logical Schema
SOURCE
Source Command
select ENAME V_ENAME,EMPNO V_EMPNO
from   <%=odiRef.getObjectName("L","SCOTT","D")%>
Target Technology
Teradata
Target Logical Schema
TERADATA_DWH
Target Command
insert into PARTS
(ENAME,EMPNO)
values
(:V_ENAME,:V_EMPNO)


Oracle Tools Send Mail Example

Procedure Details for Sending Multiple Emails
Source Technology
Oracle
Source Logical Schema
ORACLE
Source Command
Select FirstName FNAME, EMailaddress EMAIL
From <%=odiRef.getObjectName("L","USERS","D")%>
Target Technology
ODITools
Target Logical Schema
None
Target Command
OdiSendMail -MAILHOST= tgrtechnologies.com  -FROM=admin@tgrtechnologies.com “-TO=#EMAIL” “-SUBJECT=Job Failure”
Dear #FNAME,
This is sample program in TGR Technologies, because session <%=snpRef.getSession(“SESS_NO”)%> has just started!
-Admin


Delete Target Table

This task deletes the data from the target table. This command runs in a transaction and is not committed. It is executed if the DELETE_ALL Knowledge Module option is selected.
Command on Target


delete from <%=odiRef.getTable("L","INT_NAME","A")%>

Drop Work Table
This task drops the loading table. This command is executed if the DELETE_TEMPORARY_OBJECTS knowledge module option is selected. This option will allow to preserve the loading table for debugging.
Command on Target


drop table <%=snpRef.getTable("L", "COLL_NAME", "A")%>



Delete Errors from Controlled Table

This task removed from the controlled table (static control) or integration table (flow control) the rows detected as erroneous.
This task is always executed and has the Remove Errors option selected.
Command on Target (Oracle)

delete from       <%=odiRef.getTable("L", "CT_NAME", "A")%>  T
where    exists         (
                select   1
                from    <%=odiRef.getTable("L","ERR_NAME", "W")%> E
                where ODI_SESS_NO = <%=odiRef.getSession("SESS_NO")%>
                and T.rowid = E.ODI_ROW_ID
                )


The following Action Call Methods are available for Actions:

    addAKs(): Call the Add Alternate Key action for all alternate keys of the current table.
    dropAKs(): Call the Drop Alternate Key action for all alternate keys of the current table.
    addPK(): Call the Add Primary Key for the primary key of the current table.
    dropPK(): Call the Drop Primary Key for the primary key of the current table.
    createTable(): Call the Create Table action for the current table.
    dropTable(): Call the Drop Table action for the current table.
    addFKs(): Call the Add Foreign Key action for all the foreign keys of the current table.
    dropFKs(): Call the Drop Foreign Key action for all the foreign keys of the current table.
    enableFKs(): Call the Enable Foreign Key action for all the foreign keys of the current table.
    disableFKs(): Call the Disable Foreign Key action for all the foreign keys of the current table.
    addReferringFKs(): Call the Add Foreign Key action for all the foreign keys pointing to the current table.
    dropReferringFKs(): Call the Drop Foreign Key action for all the foreign keys pointing to the current table.
    enableReferringFKs(): Call the Enable Foreign Key action for all the foreign keys pointing to the current table.
    disableReferringFKs(): Call the Disable Foreign Key action for all the foreign keys pointing to the current table.
    addChecks(): Call the Add Check Constraint action for all check constraints of the current table.
    dropChecks(): Call the Drop Check Constraint action for all check constraints of the current table.
    addIndexes(): Call the Add Index action for all the indexes of the current table.
    dropIndexes(): Call the Drop Index action for all the indexes of the current table.
    modifyTableComment(): Call the Modify Table Comment for the current table.
    AddColumnsComment(): Call the Modify Column Comment for all the columns of the current table.


getObjectName(“L”, “MY_OBJECT”, “D”)


All KMs and procedures

The target datastore getTable(“L”, “TARG_NAME”, “A”) LKM, CKM, IKM, JKM

The “I$” datastore getTable(“L”, “INT_NAME”, “A”) LKM, IKM

The “C$” datastore getTable(“L”, “COLL_NAME”, “A”) LKM

The “E$” datastore getTable(“L”, “ERR_NAME”, “A”) LKM, CKM, IKM

The checked datastore getTable(“L”, “CT_NAME”, “A”) CKM

The datastore referenced  by a foreign key
getTable(“L”, “FK_PK_TABLE_NAME”, “A”) CKM


Friday, June 13, 2014

Is It Necessary To Regenerate A Scenario After Modifying The Refresh Statement Of An ODI Variable?

ODI Interview Questions and Answers:

Is It Necessary To Regenerate A Scenario After Modifying The Refresh Statement Of An ODI Variable?

Yes.

This operation must be carried out in the ODI Repository in which the complete set of ODI Objects are present (Package, Variables, User-defined Functions, Integration Interfaces, etc.).

The resulting Scenario must be exported and imported into an Execution Repository in the production environment.



How to Get Current Repository in using Substitution Method?

ODI Interview Questions and Answers:

How to Get Current Repository in using Substitution Method?

In master repository we can find all work repository names in SNP_REM_REP table.  Using getSession method we can get REP_ID and using below query we can get  repository name

select REP_NAME
from <%=odiRef.getObjectName("L", "SNP_REM_REP", "D")%>
where REP_ID = to_number(substr(to_char(<%=odiRef.getSession("SESS_NO")%>), length(to_char(<%=odiRef.getSession("SESS_NO")%>))-2, 3))




How to use ODI Variables in Substitution Methods Such As 'getObjectName' ?


We can use variables in Substitution methods  using object called  GetObjectName.


<%=odiRef.getObjectName( "L" , "#MYPROJECT.MYTABLE", ... "D" )%>


How to Concatenate Values Of 2 ODI Variables in ODI ?

ODI Interview Questions and Answers:

We can use SQL query to concatenate using || symbol for two variables.


select '#PROJ1.VAR1'||'#PROJ2.VAR2' from dual.


Violation of PRIMARY KEY constraint 'PK_REV_COL'. Cannot insert duplicate key in object 'SNP_REV_COL' ?

ODI Interview Questions and Answers:

Violation of PRIMARY KEY constraint 'PK_REV_COL'. Cannot insert duplicate key in object 'SNP_REV_COL'?


The SNP_REV_COL table which is stored in the current Work Repository is a temporary table that Oracle Data Integrator (ODI) uses during reverse engineering operations.
1. Temporarily disable the SNP_REV_COL primary key constraint.

2. In case customized reverse engineering was used, manually execute the query that ODI has generated for the "Get Columns" reverse engineering step (eg. with Squirrel).

3. Use the following query to identify the columns which are causing the problem:
  
    select I_MOD, TABLE_NAME, COL_NAME, COUNT(*) as REPEATS

    from SNP_REV_COL

    group by I_MOD, TABLE_NAME, COL_NAME

    order by COUNT(*) DESC, TABLE_NAME, COL_NAME


4. Note the TABLE_NAME and COL_NAME information for REPEATS greater than 1.

5. Enable the SNP_REV_COL primary key constraint.



Where we can find Work repository details?

ODI Interview Questions and Answers:

We can find all work repository detains in SNP_REM_REP table in Master repository tables list.


SNP_REM_REP table contains all work repositories related to that master repository.

In this table we can Work repository name and Work repository Type .

If it is 12c we can find addition 2 columns for Global ID and GUID.




Where we can find Customised Reverse engineering Metadata in Repository.

ODI Interview Questions and Answers:

We can find Work Repository SNP_REV_* all tables for Customised reverse engineering metadata.

SNP_REV_TABLE: reverse engineered tables
SNP_REV_COL: Columns of a Datastore
SNP_REV_KEY: Keys or Index to reverse engineer
SNP_REV_KEY_COL: Columns of a Key or Index to reverse
SNP_REV_JOIN: Foreign Keys (Joins/Relations) to reverse
SNP_REV_JOIN_COL: the Foreign Key columns
SNP_REV_COND: Conditions (check constraints)
SNP_REV_FOR_TABLE: Tables to be reverse engineered
Note: this Table is used only in Standard Reverse Engineering, it is not used in Customized Reverse Engineering with a KM
SNP_REV_SUB_MODEL: Sub Model of the Model to reverse engineer


How To Get Current Login User Name in ODI

ODI Interview Questions and Answers:

We can use below query to get current login user name.
All users sessions we can find in SNP_SESSION table and based on GetSession method we can find the current login user session and passing in where clause condition.

select USER_NAME from SNP_SESSION where SESS_NO = <%=odiRef.getSession("SESS_NO"
)%>