运行映射时出现错误。
我已经创建了“新数据服务器”
我可以通过单击“测试连接”按钮来成功测试连接。
但是映射无法成功运行。完整的错误消息如下:
ODI-1228: Task Merge rows-IKM Oracle Merge-Load USERS fails on the target connection DB-TARGET.
Caused By: java.sql.SQLException: ORA-12154: TNS:невозможно разрешить заданный идентификатор соединения
at oracle.jdbc.driver.T4CTTIoer11.processError(T4CTTIoer11.java:495)
at oracle.jdbc.driver.T4CTTIoer11.processError(T4CTTIoer11.java:447)
at oracle.jdbc.driver.T4C8Oall.processError(T4C8Oall.java:1055)
at oracle.jdbc.driver.T4CTTIfun.receive(T4CTTIfun.java:624)
at oracle.jdbc.driver.T4CTTIfun.doRPC(T4CTTIfun.java:253)
at oracle.jdbc.driver.T4C8Oall.doOALL(T4C8Oall.java:613)
at oracle.jdbc.driver.T4CStatement.doOall8(T4CStatement.java:214)
at oracle.jdbc.driver.T4CStatement.doOall8(T4CStatement.java:38)
at oracle.jdbc.driver.T4CStatement.executeForRows(T4CStatement.java:891)
at oracle.jdbc.driver.OracleStatement.doExecuteWithTimeout(OracleStatement.java:1194)
at oracle.jdbc.driver.OracleStatement.executeInternal(OracleStatement.java:1835)
at oracle.jdbc.driver.OracleStatement.execute(OracleStatement.java:1790)
at oracle.jdbc.driver.OracleStatementWrapper.execute(OracleStatementWrapper.java:301)
at oracle.odi.runtime.agent.execution.sql.SQLCommand.execute(SQLCommand.java:205)
at oracle.odi.runtime.agent.execution.sql.SQLExecutor.execute(SQLExecutor.java:142)
at oracle.odi.runtime.agent.execution.sql.SQLExecutor.execute(SQLExecutor.java:28)
at oracle.odi.runtime.agent.execution.TaskExecutionHandler.handleTask(TaskExecutionHandler.java:52)
at oracle.odi.runtime.agent.execution.SessionTask.processTask(SessionTask.java:206)
at oracle.odi.runtime.agent.execution.SessionTask.doExecuteTask(SessionTask.java:117)
at oracle.odi.runtime.agent.execution.AbstractSessionTask.execute(AbstractSessionTask.java:886)
at oracle.odi.runtime.agent.execution.SessionExecutor$SerialTrain.runTasks(SessionExecutor.java:2225)
at oracle.odi.runtime.agent.execution.SessionExecutor.executeSession(SessionExecutor.java:610)
at oracle.odi.runtime.agent.processor.TaskExecutorAgentRequestProcessor$1.doAction(TaskExecutorAgentRequestProcessor.java:718)
at oracle.odi.runtime.agent.processor.TaskExecutorAgentRequestProcessor$1.doAction(TaskExecutorAgentRequestProcessor.java:611)
at oracle.odi.core.persistence.dwgobject.DwgObjectTemplate.execute(DwgObjectTemplate.java:203)
at oracle.odi.runtime.agent.processor.TaskExecutorAgentRequestProcessor.doProcessStartAgentTask(TaskExecutorAgentRequestProcessor.java:800)
at oracle.odi.runtime.agent.processor.impl.StartSessRequestProcessor.access$1400(StartSessRequestProcessor.java:74)
at oracle.odi.runtime.agent.processor.impl.StartSessRequestProcessor$StartSessTask.doExecute(StartSessRequestProcessor.java:702)
at oracle.odi.runtime.agent.processor.task.AgentTask.execute(AgentTask.java:180)
at oracle.odi.runtime.agent.support.DefaultAgentTaskExecutor$2.run(DefaultAgentTaskExecutor.java:108)
at java.lang.Thread.run(Thread.java:748)
Caused by: Error : 12154, Position : 154, Sql =
MERGE
INTO TARGET.USERS USERS
USING
(
SELECT
USE.NAME AS NAME ,
USE.PASSWD AS PASSWD ,
USE.USER_ROLE AS USER_ROLE
FROM
**SOURCE.USERS@"MySource" USE**
) MERGE_SUBQUERY
ON
(
USERS.NAME = MERGE_SUBQUERY.NAME
)
WHEN NOT MATCHED THEN
INSERT
(
NAME ,
PASSWD ,
USER_ROLE
)
VALUES
(
MERGE_SUBQUERY.NAME ,
MERGE_SUBQUERY.PASSWD ,
MERGE_SUBQUERY.USER_ROLE
)
WHEN MATCHED THEN
UPDATE SET
PASSWD = MERGE_SUBQUERY.PASSWD ,
USER_ROLE = MERGE_SUBQUERY.USER_ROLE , OriginalSql =
MERGE
INTO TARGET.USERS USERS
USING
(
SELECT
USE.NAME AS NAME ,
USE.PASSWD AS PASSWD ,
USE.USER_ROLE AS USER_ROLE
FROM
SOURCE.USERS@"MySource" USE
) MERGE_SUBQUERY
ON
(
USERS.NAME = MERGE_SUBQUERY.NAME
)
WHEN NOT MATCHED THEN
INSERT
(
NAME ,
PASSWD ,
USER_ROLE
)
VALUES
(
MERGE_SUBQUERY.NAME ,
MERGE_SUBQUERY.PASSWD ,
MERGE_SUBQUERY.USER_ROLE
)
WHEN MATCHED THEN
UPDATE SET
PASSWD = MERGE_SUBQUERY.PASSWD ,
USER_ROLE = MERGE_SUBQUERY.USER_ROLE , Error Msg = ORA-12154: TNS:невозможно разрешить заданный идентификатор соединения
at oracle.jdbc.driver.T4CTTIoer11.processError(T4CTTIoer11.java:499)
... 30 more
不要与错误ORA-12154的俄语描述相混淆。 这意味着TNS:无法解析指定的连接标识符。
tnsnames.ora文件存在。我也可以使用SQL Developer进行连接
经过一些调查,在我看来这条线
SOURCE.USERS@"MySource" USE
是罪魁祸首
但是在执行此脚本之前,ODI执行了另一个脚本并成功执行了该脚本。其内容如下:
create database link "MySource" connect to SOURCE identified by <@=odiRef.getInfo("SRC_PASS") @> using '***'
答案 0 :(得分:0)
我在SQL Developer中运行了两个查询,并将<@=odiRef.getInfo("SRC_PASS") @>
替换为实际值。
我可以重现错误。
我在下面运行查询以确保已创建dblink:
select * from all_db_links;
然后我遇到了一个讨论,有人建议以这种方式创建dblink:
create database link "MySource" connect to SOURCE identified by *** using
'(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = localhost)(PORT = 1521))
(CONNECT_DATA =
(SERVER = DEDICATED)
(SERVICE_NAME = oracle.****.***.**)
)
)';
有效。我可以在后续查询中使用此链接。但是我注意到,一种较短的方法是仅使用SID创建dblink:
create database link "MySource" connect to SOURCE identified by *** using oracle;
因此,我切换到ODI并将所有数据服务器中使用的连接字符串从jdbc:oracle:thin:@<host>:<port>/<service name>
更改为格式jdbc:oracle:thin:@<host>:<port>:<sid>
这解决了问题。我可以成功运行映射。
不确定为什么不能使用基于服务名称创建的dblink。
Oracle不会根据文档禁止它
创建数据库链接:
https://docs.oracle.com/cd/B19306_01/server.102/b14200/statements_5005.htm