Showing posts with label INTERVIEW QUESTIONS ANSWERS. Show all posts
Showing posts with label INTERVIEW QUESTIONS ANSWERS. Show all posts

Monday, July 21, 2014

ODI getSession object parameters usage.


We can find below listed parameters for odiRef.getSession  method parameters.



SESS_NO
Internal number of the session
SESS_NAME
Name of the session
SCEN_VERSION
Current scenario version
CONTEXT_NAME
Name of the execution context
CONTEXT_CODE
Code of the execution context
AGENT_NAME
Name of the physical agent in charge of the execution
SESS_BEG
Date and time of the beginning of the session
USER_NAME
odi User running the session.

Examples


The current session Number is: <%=odiRef.getSession("SESS_NO")%>
The current User is: <%=odiRef.getSession("USER_NAME")%>
The current Session Name is: <%=odiRef.getSession("SESS_NAME")%>
The current agent name is: <%=odiRef.getSession("AGENT_NAME")%>

 

Wednesday, July 2, 2014

SQL Analytical Common Interview Questions




1 ) Write a Query To Delete The Repeted Rows from emp table;
SQL>Delete from emp where rowid not in(select min(rowid)from emp group
by ename)
               
2) TO DISPLAY 5 TO 7 ROWS FROM A TABLE
SQL>select ename from emp
         where rowid in(select rowid from emp where rownum<=7
         minus
  select rowid from empi where rownum<5)

3)  DISPLAY  TOP N ROWS FROM TABLE?

SQL>SELECT * FROM
                (SELECT *  FROM EMP ORDER BY ENAME DESC)
                 WHERE ROWNUM <10;

4) DISPLAY   TOP 3 SALARIES FROM EMP;
SQL>SELECT SAL FROM ( SELECT  * FROM EMP ORDER  BY SAL DESC )
                   WHERE ROWNUM <4

5) DISPLAY  9th FROM THE EMP TABLE?
SQL>SELECT ENAME FROM EMP
                WHERE ROWID=(SELECT ROWID FROM EMP WHERE ROWNUM<=10
                MINUS
                SELECT ROWID FROM EMP WHERE ROWNUM <10)
                select second max salary from emp;
                select max(sal) fromemp where sal<(select  max(sal) from emp);

Tuesday, July 1, 2014

Difference between ODI 11G and 12c new features


12C We can below listed Features.

1) Mappings we can use more than one target table (in 11g one Interface only one target table)
2) Reusable mappings added 
3) Reusable mappings available in Global Objects.
4) Procedure GUI changes compare to 11G.  Here we can create options directly.
in 11G We have to Right click on Procedure and then we can create options in 11G.
5) In mappings we can specify options directly Creating Source Data sources DBLinks.
6) Standalone colocated agent is working on WLS template.
7) Hive Technology Added for Hadoop.
8) Wallet ( to store security credentials same as OWB).9) In-Session Parallelism10) Step-by-Step Debugger11) Oracle Warehouse Builder Integration12) Unique Repository IDs

Tuesday, June 24, 2014

ODI Interview Questions and Answers

ODI Interview Questions and Answers

1)We have an options recyle_errors on target table Flow tab. how exactly it works?

A)ODI KM’s option called Recycle Errors does the following

ODI reads from the E$ tables and loads into the I$ capturing all the records

 which are not present in the I$ by matching on the Primary Key or Unique Keys.

2)-I'd like to ask if it possible to use a stored procedure (maybe in cursor) as a data source?

A) As far as i know i dont think you can. 
Either you can use a table, or view or synonym. 
If you have a sql query convert it to a view or use a temporary interface.

 Iam not very sure the codes used in your procedure. If you can put the code here then it would be better to understand and develop the logic.
If its a direct insert to your table you can use odi procedure with java code and jython codes. 
We can write the return resultset of your procedure to a table with help help java/jython without taking the help of interface.

3)
Is it possible to place a variable as a parameter in an API Reference? 

I have a project variable (var1) which uses an API Reference <%=odiRef.getContext("CTX_CODE")%> to get the context code. 
I also have another project variable (var2) that uses the API reference <%=odiRef.getSchemaName ()%>.
Then I want to use var1 as a parameter in API <%=odiRef.getSchemaName("SCHEMA_NAME", "VAR1", "W")%>... is this possible?

A)Though i doubt on this still Check it once.

<%=odiRef.getSchemaName("SCHEMA_NAME", "#VAR1", "W")%>

4)
Whenever i start the CDC it is creating, J$ tables, JV$ Views, UT$ and DT$ triggers.
 but when i stop the CDC it is dropping the tables and views but not the triggers. 
Can anyone please tell me why it is not dropping the tirggers . 
one more issues i have is when i check the trigger script it is pointing to SNP_SUBSCRIBERS in different schema. 
i am not understanding why it is pointing to SNP_SUBSCRIBERS in another schema.please help me with this

A)SNP_SUBSCRIBER will be created in the work schema defined under your Source connection (in Topology) -
 I would advise you keep it here to be honest, saves cluttering up the data schema in the source system.

If ODI is not attempting to drop triggers, why not create an additional KM step to do this for you?
If you study the JKM, there are options to determine when a step runs (Create Journal, Drop Journal,
 Extend Window etc etc.) - Just grab the API ref to create trigger name and re-use in a simlar fashion to drop it.


5)
I am using OdiScpPut for scp the file from ODI server to another Hyperion Server, getting following error.

ODI Command used:

OdiScpPut "-HOST=<Target Server Name>" "-USER=<User Name>" "-PASSWORD=<encrypted password>" 
"-LOCAL_DIR=C:\ODI\FILES" "-LOCAL_FILE=EXTRACT.csv" "-REMOTE_DIR=/eas/app/BI/test" "-COMPRESSION=NO" 
"-STRICT_HOSTKEY_CHECKING=NO" "-TIMEOUT=10"

error-caused by :timeout (socket is not established)


6) how to prevent overwrite existing data in table

A)In target propertices of flow tab if you are using Incremental update tab

Set Option UPDATE = false.   
OR 
A) Use Control append KM



7)
I have Table1(col1,col2),Table2(col1,col2,col3) and excel spredsheet.
I need to compare value of col1 from table1 with col1 of table2.
If it is present in table2 then no action and if not insert that record in excel file.

A)
Reverse engineer Table1, Table2 and your excel spreadsheet (with relevant topology, ODBC / JDBC connections to write out to excel)

Two ways of doing it in an interface :

Option 1 (if using 11G) 

Use the Minus operator , First data set : Table1 , Second data set : Table 2 , map only colum1 ,
 the resulting SQL will load all the values from Table1 that do not exist in table2 to your I$ table, then write out to the Excel File.

Option 2 (if using 10G or alternative to the above)

Source datastore : Table 1
Target datastore : Excel File.

Filter on Table 1 ,NOT EXISTS (select 'x' from <%=odiRef.getObjectName("Table2")%> 
where <%=odiRef.getObjectName("Table1")%>.col1 = <%odiref.getobjectname("Table2")%>.col1 )

so the SQL when loading C$ table will look like :

select
col1,col2 from Table 1 where 1=1 and not exists (select 'x' from table2 where table1.col1 = table2.col1)

This will only give you the values from Table1 that dont exist in Table2, into the I$ table , ready to go out to your excel file.


8) How to tune a mapping in ODI ?

A)Choose between various knowledge modules (KMs) for loading and integration.
 Each one performs differently based on the source/target technology and the type of data that you're dealing with. 
Some perform better than others depending on the situation. Some KMs use set-based transactions, others use PL/SQL blocks to commit data in small batches.

Choose where ODI should execute each join/filter/transform. You can usually choose between the source, target or a separate staging area.
What you choose here can influence how much source data you will extract and process.

The ODI KMs utilize temporary tables to perform the loading, checking and transform operations and will create the necessary indexes for performance.
 It will also analyse these tables as part of the flow to enable the DB engine to generate accurate execution plans.


9)  what is the purpose of defining the OLAP type (dimension, fact table, SCD) in the data store properties in ODI?
 I'm already familiar with dimensions & fact tables as used in data warehousing modeling. 
I am just wondering how specifying the OLAP type of a data store affects its behavior.


A)Pretty sure it opens up the UI to set more options depending on that option, not at PC so cant check.
e.g SCD - Surrogate Key, Current Record, Start Date, End Date etc.


10)what is the difference between JKM Oracle Simple and JKM Oracle Consistent?


A)  With simple journalisation, you focus on 1 table / 1 interface.
When you launch the interface, the journalized data are extracted, then loaded into the target, and the J$ table is deleted.
There is no relation other tables in the CDC process.
It means you can capture changed data in a table A, but not in table B if you want.

With Consistent journalisation, you focus on a set of tables (ex : an entire model). You will focus on a package, and not an unique interface.
When you launch an interface, the journalized data will be extracted and loaded into the target, 
but the J$ table won't be deleted until you decide to purge the journal (at the end of the package.).

This type of journalisation is more complicated, but very important if you have relations between journalised table.

for instance, suppose you have an "order table" and "order line table" in your source. With consistent CDC, 
the data you will capture will be consistent between the 2 tables. You won't capture only order ligne table data, but no order table data.

Actually, the J$ table and the JV$ view structures are different in Simple CDC, or Consistent CDC.

To make it simple, the simple CDC has to be used ONLY if you focus on 1 source table, or various independant source table. 
But if you have relationships between many source table and you want to journalize all these table, you should use consistent CDC. Then consistent JKM.



JKM Oracle consistenet takes care of referential integrity 
i.e. befor populating journalised data in child table, it will make sure that parent table has related data.
While Simple JKM doesnt check referential integrity


11)
I just want to know the procedure to do testing in ODI. 
And along with how to move data from one environment to another environment, say for example now I am working with DEV environment. I want to 
move this data to Testing environment and after that to the Production.


A)What do you mean by "moving data" ?

If you're talking about moving the ODI object, like scenario, projects, interfaces... then use "export / import" tool to move your source into other environment.

If you're talking about data that are in your database table, then use "context". Create 1 context for development, 1 context for Testing and so on.
Just change the context when you want to change data / environment in order to do your QA tests.



12) 

 I am attempting to re-organize the Projects in my ODI instance and can't seem to copy/paste an interface from one Project to another.
 Is this not allowed in ODI or am I doing something wrong? 

A)That's not a stupid question at all.

Actually you can't move it or copy/cut-paste it, because they have some reference in their project.

But you can export it and then import it in your other project


13) I need to process the data in each line of a file, controlling for each line, lengths, comparisons with other tables, etc.
 where these lines are correct in other table and insert them in cases of error, in another file, but not as can be.
I might give some idea.

A)
There are 2 ways to control your file.

1) Define the file as an ODI Datastore. 
When ODI will read it, it will reject the rows that doesn't fit to your specification (length, type...) in a .BAD file and an ERR.file. 
These 2 files are located in the same folder than your original file.

2) Define some constraints in your datastore : alternative key, references and conditions. Thanks to alternative key,
 your can reject the rows that are not unique. Thanks to references, you can compare data of column with values of other tables (like foreign key) and reject the bad ones.
Thanks to conditions, you can set custom rules like "this field must be equal to A, B, C or D only".

These constraints will be set in an ODI interface, whose "working schema" will be set on a specific database.
Indeed, you cannot use the constraints on the file technology, because it requires to create an error table on a database.

14)

For instance, create a simple interface that use your file on source and load any dummy table, but with insert=NO and update=NO. 
The important thing is to activate the flow control in your IKM.

OR... you can also create a full customised KM that will control your file, but it's more difficult and not native. 




15)In one of my interface when ever I executes there are some duplicates are coming to the target table. 
Say if the count of the rows around 5000 in the source table and in the target it would be around 120000. Even after using the distinct rows in the flow control some bugs are coming.

Can you please help how solve this...
Note:In source table one column contains surrogate key.
IKM oracle control append is the KM I am using

A)Using the Control Append IKM will always add the data that is in the Source to the Target, unless you truncate or delete from the Target first.
 If you have data in the Source that has already been loaded to the Target, and you do not truncate the Target prior to the next load, you will have duplicates.

Are you truncating the Target or is the Source data always "new" each time the Interface is run?

Yes I am Truncating the target table, but also there will be a duplicates in the target.
 We are using three source tables out of which two tables having join condition, and the third table have filter.

Just check the number of rows loaded to C$ table. It the number of rows is as per your expction then you need to look into I$ table and the number of rows.
If the C$ table count is more than the actual count then the problem is with cross join.

For my interface rows are inserted with duplicate values and when ever I checked for the data I$ table and C$ table that table is not existing for me.

You can this in your operator tab. Open the C$ step (Load Data in LKM )and I$ steps ( Insert flow into I$ in IKM) to see the records inserted,update,deleted etc.

16)
How to pass a variable more than one values?


A)You can't.
During 1 session, 1 ODI variable can have only 1 value at a time.
If you need more than 1 value, you will have to do somethink like a loop inside your package, and refresh the variable value each time.






Sunday, June 15, 2014

What Is a Scenario?


What Is a Scenario?
Remember that an interface, procedure, or package can be modified at any time. A scenario is created by generating code from such an object. It thus becomes frozen, but can still be executed on a number of different environments or contexts. Because a scenario is stable and ready to be run immediately, it is the preferred form for releasing objects developed in ODI.

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