Wednesday 18 October 2017

ODI 12c Loading multiple files in a directory to Target table using looping concept.

Hi Guys,

I have a requirement to load all the csv files available in a folder to the target table. The file structure will be same but the name will be vary for each file. So i used variable and looping concept in ODI to achieve this requirement.

Steps followed.
1) list out the names of all the .csv files available in a directory to a temporary file.
----Command----

ls *.csv > Directory/Text_.txt

2) Separate the names into one by one.
---Command----

awk 'sub("$","\r")' Directory/Text_.txt > DirectoryALL_FILE_NAMES.txt

3)Write the file names into a Target table the structure of the target table can be.We can use an ODI interface to

CREATE TABLE ALL_FILE_NAMES
(
ROW_NUMBER INT,
FILE_NAME VARCHAR(50),
LOAD_STATUS VARCHAR(5),
LOAD_DATE DATE)
;

Row_Number: Sequence
File_Nmae: Can directly map the name from the file in ODI mapping.
Load_Status:Stamp 'N' as default.
Load_Date: Sysdate.

4) Create a variable for taking the file count. Select the count of files having LOAD_STATUS equals 'N'

5) Create an Evaluate variable
This variable can be used for looping through the package. In the evaluate condition we can give '>=1' so till the file count equals 0 the loop will be repeated.

6) Create a global variable for picking the file name dynamically.

Eg:
SELECT max(FILE_NAME) FROM ALL_FILE_NAMES
WHERE LOAD_STATUS='N'
group by FILE_NAME
ORDER BY 1


7) Create the interface for loading the data. The above created variable can be used as a file name for this interface.

Resource_Name:#GLOBAL.V_FILE_NAME

8) Create an ODI procedure for updating the file name.This will update the loaded file status to Y and this file will not be picked for next load.

UPDATE ALL_FILE_NAMES SET LOAD_STATUS='Y' WHERE FILE_NAME in (SELECT FILE_NAME FROM ALL_FILE_NAMES
WHERE LOAD_STATUS='N'
and FILE_NAME=#GLOBAL.V_FILE_NAME

9)Take the file count again. This time you will get the updated file count and if that is greater than 0 the loop will be repeated.

10) Refer the screen shot below so you will get a better understanding about the loop process.







Tuesday 19 September 2017

ODI Configure Email Task.

Hi Guys,

In this post i will give you some tips that we can use while creating an Email task in ODI 12c.

The main thing that we need to take care while creating an Email task is Email Subject and Email Body. In failure email and all we need to make this dynamic so we will get proper failure email with subject.For that you can use the following codes.

Subject:
<%=odiRef.getContext("CTX_CODE")%> - ODI session <%=odiRef.getPrevStepLog("STEP_NAME")%> in package   <%=odiRef.getSession("SESS_NAME")%> FAILED AT <%=odiRef.getPrevStepLog("BEGIN")%>

By using the appropriate odiRef we can customize the subject accordingly.

Message Body:<%=odiRef.getPrevStepLog("MESSAGE")%>

This will give you the failure step description with error codes.


ODI error ORA-02292: integrity constraint (ODI_REPO.FK_MAP_PROP_1) violated - child record found

Error From ODI Error log.

java.lang.RuntimeException: java.lang.RuntimeException: java.lang.Exception: ODI-20088: Error while generating the scenario
.
Caused by: java.lang.RuntimeException: java.lang.Exception: ODI-20088: Error while generating the scenario
.
Caused by: java.lang.Exception: ODI-20088: Error while generating the scenario
.
Caused by: oracle.odi.core.repository.UncategorizedRepositoryAccessException: ODI-10182: Uncategorized exception during repository access.
ODI-10143: Error while accessing the ODI repository.
ORA-02292: integrity constraint (ODI_REPO.FK_MAP_PROP_1) violated - child record found
.
Caused by: oracle.odi.core.repository.RepositoryIntegrityViolationException: ODI-10143: Error while accessing the ODI repository.
ORA-02292: integrity constraint (ODI_REPO.FK_MAP_PROP_1) violated - child record found
.
Caused by: java.sql.SQLIntegrityConstraintViolationException: ORA-02292: integrity constraint (ODI_REPO.FK_MAP_PROP_1) violated - child record found


Cause:

Actually i tried to find out if there is any mistakes in the mapping but it is perfectly fine and no other issues.The issue is that we cannot generate the scenario for that.
The reason is some how the code for the mapping is corrupted.

Solution:

I found the solution from the Oracle blog, just updating that here.

The solution is to upgrade the ODI environment to the latest version of ODI 12.2.1.2.6.

There is a workaround involving an export/import of the mapping that can be used until the environment can be patched.

Export the problem mapping.
Open the mapping xml export file for edit.

Locate the lines containing field name IOwnerExecUnit with a number as a value.

For example:
<Field name="IOwnerExecUnit" type="com.sunopsis.sql.DbInt"><![CDATA[40275]]></Field>

You have the option to remove the line completely, or change the line to have a null value.
For example:
<Field name="IOwnerExecUnit" type="com.sunopsis.sql.DbInt"><![CDATA[null]]></Field>

Import this file back into ODI. You should be able to successfully compile it into a scenario.

After doing this step i am able to create the scenario and run it.

Hope this will help you also !.

Thursday 4 May 2017

ODI 12c Using custom SQL to over ride default Source query.

In this post i will give you a brief idea about a new feature introduced in ODI 12c.

As in informatica now ODI also support SQL query over ride, we can use a custom sql query to over ride the source query.

This feature is available in 12c in Extract option under physical diagram

After creating the mapping navigate to the Physical tab and in Extract Option we can see a feature CUSTOM_TEMPLATE.

In this area we can write a custom select statement and that will be used as a source query for populating the target.

Please remember to map all the fields that in the over ride query from source.

IKM Used: IKM Oracle insert global.



Thank you.

Tuesday 25 April 2017

upload RPD Failed: Metadata Lock could Not be acquired. In OBIEE 12c

Issue: Not able to upload rpd in OBIEE 12c, throws an error upload RPD Failed: Metadata Lock could Not be acquired
in

OBIEE version : 12.2.1.0.160719
OBIEE Client tool : 12.2.1.1.0



Cause: Not included some class files.

Solution:

To work around this issue, you can replace the binaries in the 12.2.1.1.0 client from the 12.2.1.0.0 client to make it work successfully.

Steps:

Take a backup of the below files

1) Navigate to the location
 C:\Oracle\Middleware\Oracle_Home\bi\modules\oracle.bi.commandline.tools\scripts
Rename datamodel to datamodel_12.2.1.1.0


2) Navigate to the location
 C:\Oracle\Middleware\Oracle_Home\bi\common\templates\wls
Rename: oracle.bi-commandline-tools-template to oracle.bi-commandline-tools-template_12.2.1.1.0

3) Navigate to the location
C:\Oracle\Middleware\Oracle_Home\bi\lib
Rename: bi-commandline-tools to bi-commandline-tools_12.2.1.1.0

Then copy the files  from the 12.2.1.0.0 client. To the above location

4) Navigate to the location

C:\Oracle\Middleware\Oracle_Home\user_projects\domains\bi1\bitools\bin
Take a backup of the file datamodel.cmd then edit datamodel.cmd file
Change the call statement as shown below
call "C:\Oracle\Middleware\Oracle_Home\bi\modules\oracle.bi.commandline.tools\scripts\data-model-cmd.cmd" %*

After this try to upload the RPD again 

After this step upload rpd successfully worked for me.



Than you .



Wednesday 19 April 2017

Steps to import BISAMPLE Schema for OBIEE12c training.

1: Navigate to the lactation 

C:\app\OracleHomeUser1\product\12.1.0\dbhome_1\NETWORK\ADMIN

Open tnsnames.ora file and add the below tns entry and save the file
PDBORCL =
  (DESCRIPTION =
    (ADDRESS = (PROTOCOL = TCP)(HOST = localhost)(PORT = 1521))
    (CONNECT_DATA =
      (SERVER = DEDICATED)
      (SERVICE_NAME = pdborcl)
    )
  )

2: Open your SQL Developer and run the below query as SYS user

ALTER PLUGGABLE DATABASE ALL OPEN;

3: Creating BISAMPLE user and gave privileges.

Connect as pdborcl and run the query attached (BISAMPLE_USER.SQL)  

For creating user and giving privileges

4: Unzip the dump files (Link) that you downloaded into the below location

C:\app\OracleHomeUser1\oradata\ForOBE

5: Query to create a directory that pointing to the dump files

Run the query from pdborcl

CREATE OR REPLACE DIRECTORY datapumpdir as 'C:\app\OracleHomeUser1\oradata\ForOBE';

To verify the directory is created use the below command

SELECT * from ALL_DIRECTORIES.

6: Command to import the schema.
Open command prompt and run the command.

impdp system/<Password>@pdborcl directory=datapumpdir dumpfile=BISAMPLE.dmp logfile=BISAMPLE.log


Now all the tables will be imported to the schema BISAMPLE. 

Friday 7 April 2017

java.sql.SQLRecoverableException: ORA-01033: while starting OBIEE 12c

Issue: java.sql.SQLRecoverableException: ORA-01033: while starting obiee12c

Unable to start OBIEE 12c. When starting admin server the server failed.

Reason: The issue is related to DB, In OBIEE 12c we are installing our metadata in portable database that is PDBORCL. So while start up it will not start automatically we have to manually open the database.

Soultion:

Command to open the portable database.

ALTER PLUGGABLE DATABASE ALL OPEN;

after opening the database please start OBIEE 12c.

Friday 31 March 2017

Error RCU-6080 while installing RCU for OBIEE 12c

Error: RCU prerequisite check failed with error code RCU- 6080 while configuring RCU for OBIEE 12c.



Cause: The reason for the failure is, from OBIEE 12c onwards oracle prefer to install the obiee metadata schema in pluggable database rather than container database. While installing database 12c we will get a prompt to select install pluggable database with the current installation. So by default in 12c we have a pluggable database with object name 'PBDORCL'. So instead of using ORCL  use PDBORCL as service name and try to create the schema.

But before using pluggable database please make sure that the DB is in open state. Because when starting DB oracle only open the default DB ORCL, So it will be better to use a trigger to open the pluggable DB PDBORCL.

Command to check the MODE of database.

"SELECT NAME ,OPEN_MODE FROM V$PDBS"


Then you can see the OPEN_MODE as mounted so please below command to open the portable database.

ALTER PLUGGABLE DATABASE ALL OPEN;
After executing the command the database will open and that will be available for read and write.

you can use the below trigger for opening pluggable database.

CREATE OR REPLACE TRIGGER OPENPBD AFTER STARTUP ON DATABASE
BEGIN

     EXECUTE IMMEDIATE 'ALTER PLUGGABLE DATABASE ALL OPEN';
END OPENPBD;


Then replace the service name with pdborcl and run the RCU prerequisite one more time.

now you can see the step passed and you can continue with the installation.


Thank you .



INST-07545: Unexpected error while installing OBIEE 12c Client.

Error:INST-07545: Unexpected error the distribution setup_bi_client 12.2.1.2.0 incompatible features with the following.....



Cause: This issue is because we are trying to install the obiee12c client in the same oracle_home where we installed our obiee12c.


Action: Change the oracle installation directory to a fresh directory and continue with the installation.

As shown below i changed the directory into C:\OBIEE_ClientHome

Then the issue is resolved and able to proceed with the installation.


Thank you :).