ODI Procedure: Using Variable Logical Schema
Hi!
i wrote a PL\SQL procedure inside an odi procedure, using options, variables etc.
now we need to execute the procedure in different logical schemas.
We've at least 20 different logical schemas and to semplify the maintenance we'd like to pass the logical schema as an Option or something similar,
is it possibile to do this with a procedure?
The version of ODI is 11.1.1.5.0 and the targets are only Oracle DB.
I've got a question : are all you schema in the same server (database) ?
If so, you can LIST the schemas with a SQL Statement in the "command as SOURCE" tab.
example :
select owner as SCHEMA
from all_tables
where ...or a SQL Statement in ODI MASTER_Repository to get the logical schema :
select lschema_name as SCHEMA
from snp_lschema t1
where ...And in the "command as destination" tab, you execute the PL SQL, but you use the result of SCHEMA.
As a result, if you have 40 schema retrieved by the first SQL Statement, ODI will execut your PL/SQL statement 40 times, changing the SCHEMA value each time.
And, in the first tab (command as destination), you use a generic Oracle User that have access to all schema of the dabase (or at least, the 40 schema you want).
Similar Messages
-
Printing messages through ODI procedure using Javashell bean
I am new to this ODI procedure using Javashell bean.
As i know some basics in Java ,i am trying this following code through ODI.
I wanted to print messages using the code System.out.println("Welcome");
But where we can see the output for this code in ODI?
If any on knows ,kindly let me how do i can go about this?if you run an agent from the command line and you are executing your procedure using this agent then the output will be reported in the dos/cmd window.
-
ODI Procedure using Essbase schema
Hi,
I want to retrieve a substitution variable from Essbase. I've done my due diligence and read John's excellent posting on this, so I know how this can be done. As I only want to retrieve a variable, I'm wondering if I can simply do this in a procedure instead of customizing the KM.
My idea was to create a procedure which retrieves the variable as explained by John and then writes it to a database table with the fields {SessionNumber, VariableName, Value}. This would make it possible for a variable to pick up the value easily. So I created a procedure and set Source Technology to Essbase and Target Technology to JavaBeanShell. This way I thought I would be able to get the logon credentials for the Essbase database through <%=odiRef.getInfo("SRC_USER_NAME")%> etc. But this doesn't work because I can't select the Essbase schema for this.
Is this possible?
Thanks,
Matt
Edited by: Matt_SJC on Apr 20, 2010 10:03 AMHi Matt,
I think your idea is perfectly sensible though I am not sure you can do it that way, essbase technology really uses bean scripting as its technology, when you use this technology you can't select the logical schema in a procedure. I am not exactly sure on the reasons behind it, usually it is odbc/jdbc technologies where you can select the schema.
Cheers
John
http://john-goodwin.blogspot.com/ -
Using variable as schema / table names?
Hello all -
First time poster :)
I would like to use PL SQL to do something like so
--***************RUN MAIN******************
DEFINE SCHEMA_NAME = 'SCHEMA_NAME' CHAR;
DEFINE FINAL_TABLE = 'FINAL_TABLE ' CHAR;
BEGIN
SELECT DISTINCT COLUMN FROM SCHEMA_NAME.FINAL_TABLE
END
However this doesn't work. I've googled and found other ways like producing a prompt but those are always in the string to search for and not the name of the schema or table to run the SQL on. I am not sure if this is even possible. Any help would be appreciated.
Thanks!
Edited by: 813738 on Nov 19, 2010 11:02 AMAlso I am running this in Oracle SQL Developer in the SQL Worksheet not in the commandline.
This is the error I got.
Error starting at line 3 in command:
BEGIN
CREATE OR REPLACE SYNONYM SCHEMA FOR BMSAPIX_GRPA_DEV.AE_CV185060_FINAL;
SELECT DISTINCT COLUMN FROM _SCHEMA;
END
Error report:
ORA-06550: line 2, column 3:
PLS-00103: Encountered the symbol "CREATE" when expecting one of the following:
( begin case declare exit for goto if loop mod null pragma
raise return select update while with <an identifier>
<a double-quoted delimited-identifier> <a bind variable> <<
continue close current delete fetch lock insert open rollback
savepoint set sql execute commit forall merge pipe purge
06550. 00000 - "line %s, column %s:\n%s"
*Cause: Usually a PL/SQL compilation error.
*Action:
Edited by: 813738 on Nov 19, 2010 1:10 PM Sensitive info -
How to re-use a PL/SQL procedure on 2 different logical schemas
Hi all,
I need to run the same Oracle PL/SQL procedure on 2 databases (source/target).
How can I re-use the code without having to duplicate the codeof the procedure because as it is a Oracle procedure, I need to declare the logical schema ?
==> does the procedure need to be re-written in Jython ?
Thanks to your all .
Nb my procedure code :
CREATE TABLE COUNT_ROWS AS SELECT TABLE_NAME , NUM_ROWS FROM DBA_TABLES WHERE OWNER_NAME = 'SYSADM'
Edited by: Meapri on Mar 18, 2011 3:37 AMThe only problem is when writing an ODI procedure using the Oracle Technology in ODI Designer, ODI asks for the Schema.
If I do not assign a value to the schema field when I run my ODI procedure I get the error message :
java.lang.Exception: Internal error: object ConnectConnection
ColConnectId:null
ColContextCode:CTX_SRC
ColConName:null
ColIndCommit:null
ColIsolLevel:null
ColLschemaName:null
ColPlanComp:null
ColTechIntName:null
DefConnectId:null
DefContextCode:CTX_SRC
DefConName:null
DefIndCommit:null
DefIsolLevel:null
DefLschemaName:null
DefPlanComp:null
DefTechIntName:ORACLE
ExeChannel:J
IndErr:0
IndLogMethod:null
IndLogNb:null
LogLevDet:3
Nno:1
OrdTrt:0
ScenTaskNo:1
SessNo:4152001
TaskName1:Traitement
TaskName2:CNT_SRC_ALL
TaskName3:DROP COUNT_ROWS -
Odi logical schema referring deleted context in scenario
Hi,
We had a Context that was getting used by default in development. We deleted that default context and updated interfaces and regenerated scenarios to use new Context.
But logical schema is still referring to old deleted context, when scenario runs.
Any idea?
Thanks,
KshipraThe error is happening in Flow step type. Interfaces are updated to use new context.
ODI-1279: The Source Logical Schema LGCL_TERADATA_EDW_FIN_MAS_DATA_EIL and Context CONTEXT1 of the task Load data are not mapped to any Physical Schema.
Caused By: com.sunopsis.core.SnpsInexistantSchemaException: ODI-17523: There is no connection for this logical schema / context pair: LGCL_TERADATA_EDW_FIN_MAS_DATA_EIL / CONTEXT1.
at com.sunopsis.dwg.dbobj.SnpConnect.getSnpConnectByLSchemaNameAndContext(SnpConnect.java:239)
at com.sunopsis.dwg.dbobj.SnpConnect.getSnpConnect(SnpConnect.java:193)
at com.sunopsis.dwg.dbobj.SnpSessTask.getCollectConnection(SnpSessTask.java:358)
at com.sunopsis.dwg.dbobj.SnpSessStep.getSrcDataServer(SnpSessStep.java:1435)
at com.sunopsis.dwg.dbobj.SnpSessStep.createTaskLogs(SnpSessStep.java:700)
at com.sunopsis.dwg.dbobj.SnpSessStep.treatSessStep(SnpSessStep.java:465)
at com.sunopsis.dwg.dbobj.SnpSession.treatSession(SnpSession.java:2128)
at com.sunopsis.dwg.dbobj.SnpSession.treatSession(SnpSession.java:1931)
at oracle.odi.runtime.agent.processor.impl.StartScenRequestProcessor$2.doAction(StartScenRequestProcessor.java:580)
at oracle.odi.core.persistence.dwgobject.DwgObjectTemplate.execute(DwgObjectTemplate.java:216)
at oracle.odi.runtime.agent.processor.impl.StartScenRequestProcessor.doProcessStartScenTask(StartScenRequestProcessor.java:513)
at oracle.odi.runtime.agent.processor.impl.StartScenRequestProcessor$StartScenTask.doExecute(StartScenRequestProcessor.java:1073)
at oracle.odi.runtime.agent.processor.task.AgentTask.execute(AgentTask.java:126)
at oracle.odi.runtime.agent.support.DefaultAgentTaskExecutor$1.run(DefaultAgentTaskExecutor.java:50)
at org.springframework.core.task.SyncTaskExecutor.execute(SyncTaskExecutor.java:50)
at oracle.odi.runtime.agent.support.DefaultAgentTaskExecutor.executeAgentTask(DefaultAgentTaskExecutor.java:41)
at oracle.odi.runtime.agent.processor.TaskExecutorAgentRequestProcessor.doExecuteAgentTask(TaskExecutorAgentRequestProcessor.java:93)
at oracle.odi.runtime.agent.processor.TaskExecutorAgentRequestProcessor.process(TaskExecutorAgentRequestProcessor.java:83)
at oracle.odi.runtime.agent.support.DefaultRuntimeAgent.execute(DefaultRuntimeAgent.java:68)
at oracle.odi.runtime.agent.servlet.AgentServlet.doPost(AgentServlet.java:516)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:727)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:821)
at weblogic.servlet.internal.StubSecurityHelper$ServletServiceAction.run(StubSecurityHelper.java:227)
at weblogic.servlet.internal.StubSecurityHelper.invokeServlet(StubSecurityHelper.java:125)
at weblogic.servlet.internal.ServletStubImpl.execute(ServletStubImpl.java:301)
at weblogic.servlet.internal.TailFilter.doFilter(TailFilter.java:27)
at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:57)
at oracle.security.jps.ee.http.JpsAbsFilter$1.run(JpsAbsFilter.java:119)
at oracle.security.jps.util.JpsSubject.doAsPrivileged(JpsSubject.java:324)
at oracle.security.jps.ee.util.JpsPlatformUtil.runJaasMode(JpsPlatformUtil.java:460)
at oracle.security.jps.ee.http.JpsAbsFilter.runJaasMode(JpsAbsFilter.java:103)
at oracle.security.jps.ee.http.JpsAbsFilter.doFilter(JpsAbsFilter.java:171)
at oracle.security.jps.ee.http.JpsFilter.doFilter(JpsFilter.java:71)
at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:57)
at oracle.dms.servlet.DMSServletFilter.doFilter(DMSServletFilter.java:163)
at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:57)
at weblogic.servlet.internal.WebAppServletContext$ServletInvocationAction.wrapRun(WebAppServletContext.java:3730)
at weblogic.servlet.internal.WebAppServletContext$ServletInvocationAction.run(WebAppServletContext.java:3696)
at weblogic.security.acl.internal.AuthenticatedSubject.doAs(AuthenticatedSubject.java:321)
at weblogic.security.service.SecurityManager.runAs(SecurityManager.java:120)
at weblogic.servlet.internal.WebAppServletContext.securedExecute(WebAppServletContext.java:2273)
at weblogic.servlet.internal.WebAppServletContext.execute(WebAppServletContext.java:2179)
at weblogic.servlet.internal.ServletRequestImpl.run(ServletRequestImpl.java:1490)
at weblogic.work.ExecuteThread.execute(ExecuteThread.java:256)
at weblogic.work.ExecuteThread.run(ExecuteThread.java:221) -
Hi Experts,
i have create one physical schema like SRC_SCOTT ,logical schema is SRC_SCOTT_LS in my development workrepo,and in my test environment physical schema is same structure like SRC_SCOTT
can i reuse the logical schema SRC_SCOTT_LS IN my test environment and can i access the development physical schema in test by using same logical schema,please help me i am new to ODI
Regards
ksbabuHi aetl,
Thanks for quick reply,i have already ctx_text context in text environment ,same physical schema( structure is same ) in my text environment, by using development logical schema can i access or not,
regards
ksbabu -
Rename Logical Schema / Logical Agent
Hi,
is it possible to rename a logical schema / logical agent?
Thanks in advance & kr
MichaelHi,
Yes it is possible to rename logical schema/agent in ODI topology .
While renaming you will get a warning saying this is used in work repository and if you rename you need to make sure all code/objects using this logical schema are pointing to the new name . Else you may find issue during execution.
It is not a good practice to change logical schema name.
Thanks,
Sutirtha -
How to assign a value to ODI Variable using ODI Procedure
Hi ,
Is it possible to assign a value to a ODI Variable using ODI Procedure ?
If it is possible how we can do that.
BEGIN
IF #Counter=1
Then
#Next_Increment:=#Counter+1;
End if;
END;
In my example I have 2 ODI Variables #counter and #Next_increment.
I am trying to assign VALUE TO A ODI VARIABLE #next_increment from another ODI Variable #counter.
thanks
prasannaPrasanna,
I have a similar requirement where I need to assign values to ODI variables within a procedure. How do we make use of an ODI package to accomplish this ?
Actually, I have a sequence of ODI steps, and there is a call to a procedure 'LOG ERROR' from every step which gets called in case error occurs in any step. I just need to identify from which step the error came.
Please help. -
Hi,
I need to use a ODI varible in procedure. That is, when i execute a procedure the data from a oracle table should be stored in the ODI variable.
Later i need to use the same variable in another procedure. But now how can i use the ODI variable in a procedure to store the oracle data.
Some thing like this,
declare
begin
select empno into #sud from emp_source where ename='Mohan';
end;
Here sud is the ODI variable i declared. i am getting some error here. so anyone who know please help me.
Thanks in advance,
Ram Mohan T.Hi Ram,
You could not store the data to variable by procedure.
Better way, write a sql quer for getting the value from the oracle table by:
1) create a variable say var1
2) Write a sql query in Refresh tab like( select empno from 'specify the schema properly' emp_source where ename='Mohan')
3)Select the appropriate Logical schema in that
4)validate the query by click right most top corner button
5) after validation click refresh button inthat refresh tab.
6)it execute the query and hold the values in history tab.
Note: whatever query using in the variable sholud be returns a single value
After refreshing the variable you can use it in some other procedure too
Thanks,
Madha. -
How to read I$ table using ODI procedure
Hi
Can any one help me how to drop a I$ table from out sie of interface.
I have tried below approches but no luck
I have created ODI procedure with technology oracle and target logical schema (I$ tables are creating on target DB) with and with out begin and end;
Approch 1:
Given below code in ODi procedure
drop table <%=odiRef.getTable("L", "INT_NAME", "W")%> <% if (new Integer(odiRef.getOption( "COMPATIBLE" )).intValue() >= 10 ) { out.print( "purge" ); }; %>
Approch 2:
drop table I$_<%=odiRef.getTable("L", "TARG_NAME", "A") %>;
Approch 3:
drop table <%=odiRef.getTable("L", "INT_NAME", "W")%> (but it is fetching target dtabase schema anme not I$ table)
Please help me any other alternative way to drop a I$ table, more over this code should be unique for all interface
Regards,
PhanikanthThanks bhabani,
Actaul my requirement is some time my scenario is stoping due some issue at Merge Rows Step (I am using IKM Oracle Incremental Update(Merge) KM) when the next iteration starts it is thwoing and error at create flow table I$ step and error is table name is already exists, so i am doing is if the interface went failed I am storing those information in one table using ODI procedure (INF--ko-->ODI procedure) in same ODI procedure I want to call a I$ table to drop.
Can you please provide the steps so it will very useful for me using Java variable.
I have gievn a step as below on create I$ table step (after create I$ statement)
<@ java.lang.String Idollertable = <%=odiRef.getTable("L", "INT_NAME", "W")%> ; @>
I am calling Idollertable variable in ODI procedure which is ko>* of INF as <@=Idollertable@>
Note: I have followed below approch
ODI Procedure Code:
drop table <@=Idollertable@>; --> *2nd approch*
begin
insert into ODI_EXECUTION_ERROR_DETAILS
(SESSION_NO,
SCENARIO_NAME,
CONTEXT_NAME,
ERR_MESSAGE,
INSERT_COUNT,
ERROR_COUNT)
values
<%=snpRef.getSession("SESS_NO")%>,
'<%=odiRef.getPrevStepLog("STEP_NAME")%>',
'<%=odiRef.getContext( "CTX_NAME" )%>',
'<%=odiRef.getPrevStepLog("MESSAGE")%>',
'<%=odiRef.getPrevStepLog("INSERT_COUNT")%>',
'<%=odiRef.getPrevStepLog("ERROR_COUNT")%>'
commit;
drop table <@=Idollertable@>; --> * first approch *
end;
Please help me
Regards,
Phanikanth
Edited by: Phanikanth on Mar 3, 2013 9:52 PM
Edited by: Phanikanth on Mar 3, 2013 9:52 PM -
How to use Update Statement in ODI Procedure
Hi,
How can I use an update statement inside an ODI procedure.
ThanksHi,
You do not need the BEGIN and END. ODI procedures are free text, so you can simply write your update statement, as you would in toad/sql developer etc etc. Just make sure you set the Technology and the logical schema. It is how ever best practice to also use the API:
<%=odiRef.getSchemaName("YOUR_LOGICAL_SCHEMA_NAME", "D")%>. to prefix tables. This way, you select data from different schema's in the same instance (as long a your user has the correct privs).
Cheers
Bos
Edited by: Bos on Jun 22, 2011 3:09 PM -
Using generic format for database links in ODI Procedures
Hi,
As in procedure we use
create table <%=odiRef.getSchemaName("Target Schema","D")%>.TABLE2 as
select * from <%=odiRef.getSchemaName("Staging Schema","D")%>.TABLE1
where Staging Database and Target Database are logical schemas which will associate to respective physical schema while execution so the above statement will become as
create table Target_Schema.TABLE2 as
select * from staging_Schema.TABLE1
I just wanted to know if there is any way by which i can apply samethings for Database Links also.
Like if i have statements
create table TABLE2@Target_Database as
select * from TABLE1@staging_Database
can i replace DB links like Target_Database and Staging_Database?
Help would be appreciated. :)
Thanks,
MaheshI am not entirely sure about the exact requirement.
Any way ..
1.
create 2 variable .
v_get_src_schema : select '<%=odiRef.getSchemaName("<your_src_logical_schema>","D")%>' from dual
v_get_tgt_schema : select '<%=odiRef.getSchemaName("<your_tgt_logical_schema>","D")%>' from dual
2.
2 more variable to get the required DBLink
v_SRC_DB_LINK: select DB_LINK from all_db_links where owner='#PRJ_CODE.v_get_src_schema'
v_TGT_DB_LINK: select DB_LINK from all_db_links where owner='#PRJ_CODE.v_get_tgt_schema'
3.
create a procedure :
prc_create_table :
create table <%=odiRef.getSchemaName("Target Schema","D")%>.TABLE2@'#PRJ_CODE.v_TGT_DB_LINK' as
select * from <%=odiRef.getSchemaName("Staging Schema","D")%>.TABLE1@'#PRJ_CODE.v_SRC_DB_LINK'
4.
Create a package :
Connect all the steps in serial with OK line.
Execute and let us know what is the out come .
Thanks,
Sutirtha -
How to list all physical schemas in ODI procedure
Dear Experts,
I am trying a requirement which is to execute a set of sqls in all the schemas configured in ODI.
for example
1) I have four data servers/physical schemas configured in Physical Architecture under Oracle techonlogy.
2) Created corresponding 4 logical schemas for Oracle.
3) Mapped using two different contexts.
4) one context mapped two schemas and another mapped two other schemas.
now, I need to exeture the following sql for all the Oracle schemas mapped in context selected.
just for testing: select dummy from dual
I would like to execute this sql in ODI procedure for every schema mapped in the selected context in single execution.
Can any expert help me on this solution?
- RajaRaja,
I was actually talking about multiple ODI Step command rather than multiple procedure. What you are trying to achieve is difficult unless you specify the logical schema in ODI Procedure , becuase getInfo will throw Null pointer if we dont specify the logical schema ,
the getSchema needs Logical schema . The other way i can think query in work rep tables and get the schema name and pass it .
Any way in case your figure out without passing Logical schema . Please share with us , i would be interested in learning the trick . -
Physical schema vs logical schema in odi
hi, i am new to odi.I have successfully loaded data metadata to essbase and planning . But still i am not clear why odi uses physical schema when we just uses logical schema while reversing, execution of interfaces etc in designer
Hi,
Logical schema will always point to a Physical Schema .
The aim of the logical schema is to ensure the portability of the procedures and models on the different physical schemas. In this way, all developments in Designer are carried out exclusively on logical schemas.
A logical schema can have one or more physical implementations on separate physical schemas, but they must be based on data servers of the same technology. A logical schema is always directly linked to a technology.
To be usable, a logical schema must be declared in a context. Declaring a logical schema in a context consists of indicating which physical schema corresponds to the alias - logical schema - for this context.
Thanks,
Sutirtha
Maybe you are looking for
-
How to add data in User Defined table
Hello Experts, I have design form in screen painter , 3 text boxes and labels, 2 add buttons with uid 1 and 2 , and i have created tables and fields maually and registered new object i have also mentioned table name and alias in property box with fie
-
Upgrade WCS 7.0 to PI 1.2 via NCS 1.1
Hello all, we have started to do the upgrade from WCS 7.0 to PI12. In order to do that we first need to upgrade to NCS 1.1. We have ordered the following from Cisco: R-W-PI12-M-K9 WCS 7.0 to Cisco Prime Infrastructure 1.2 Migration N/A 14 days No N
-
I want to start using my iPad 1 to connect to a projector, will the VGA connector be alright? There have been some bad reviews about it.
-
I am working on a book in the book module of Lightroom. When I started, I didn't realize that there was a page limit of 240 pages. I am going to need to break this book up into two books now. Is there a way to take pages from one book to start a seco
-
Why is my iMac logging so many system crashes?
When I type in the command last in OSX's Terminal I get a long list of logins, reboots and shutdowns. However, very many of them - more than half - have the status crash instead of the logout/shutdown time. Thing is, my Mac hasn't crashed even once.