Error ORA-12154 in Oracle Data Integrator - oracle
I get the error when I run a mapping.
I've created a "New Data Server"
I can successfully test the connection by clicking on "Test Connection" button.
But the mapping cannot be run successfully. The full error message is below:
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
Don't be confused with russian description of the error ORA-12154.
It means TNS:could not resolve the connect identifier specified.
tnsnames.ora file exists. I can also connect using SQL Developer
After some investigation it seems to me that the line
SOURCE.USERS#"MySource" USE
is the culprit
But before this script was executed ODI executed another script and executed it successfully. Below are its contents:
create database link "MySource" connect to SOURCE identified by <#=odiRef.getInfo("SRC_PASS") #> using '***'
I ran both queries in SQL Developer and replaced <#=odiRef.getInfo("SRC_PASS") #> with the real value.
I could reproduce the error.
I ran the query below to be sure that the dblink had been created:
select * from all_db_links;
Then I ran against a discussion where someone suggested to create dblinks in this way:
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.****.***.**)
)
)';
It worked. I could use this link in the subsequent queries. But I noticed that a shorter way was to create a dblink by using SID only:
create database link "MySource" connect to SOURCE identified by *** using oracle;
So I switched to ODI and changed the connection strings used in all the data servers from jdbc:oracle:thin:#<host>:<port>/<service name> to the format jdbc:oracle:thin:#<host>:<port>:<sid>
This resolved the isssue. I could run the mapping successfully.
Not sure why a dblink that is created based on service name cannot be used.
Oracle doesn't forbid it according to the docu
CREATE DATABASE LINK:
https://docs.oracle.com/cd/B19306_01/server.102/b14200/statements_5005.htm
Related
Goldengate get an unique constraint error during insert into a simple table
I have a two node gg1 and gg2 setup of goldengate. Seem to work. However when I insert a row into my table T1 connect sender/oracle create table t1 (f1 char, f2 char); alter table t1 add constraint t1_i1 primary key (f1); I get an error 2022-01-30T19:16:05.705-0500 WARNING OGG-01154 Oracle GoldenGate Delivery for Oracle, d_rep.prm: SQL error 1 mapping SENDER.T1 to SENDER.T1 OCI Error ORA-00001: unique constraint (SENDER.T1_I1) violated (status = 1), SQL <INSERT INTO "SENDER"."T1" ("F1","F2") VALUES (:a0,:a1)>. enter image description here enter image description here enter image description here here are prm files for gg1 # cat s_ext.prm extract s_ext userid ggs_owner, password Newpassword_2 tranlogoptions excludeuser ggs_owner exttrail /u01/gg/dirdat/lt ddl include all getupdatebefores sequence sender.*; table sender.*; # cat s_pmp.prm extract s_pmp userid ggs_owner, password Newpassword_2 rmthost 10.10.0.216, mgrport 7809 rmttrail /u01/gg/dirdat/rt passthru sequence sender.*; table sender.*; # cat d_rep.prm replicat d_rep userid ggs_owner, password Newpassword_2 assumetargetdefs discardfile /u01/gg/dirrpt/drep1.dsc, append reperror (default, exception) map sender.*, target sender.*; MACRO #exception_handler BEGIN , TARGET GGS_OWNER.GGS_EXCEPTIONS , COLMAP ( rep_name = #GETENV('GGENVIRONMENT', 'GROUPNAME') , TABLE_NAME = #GETENV ('GGHEADER', 'TABLENAME') , ERRNO = #GETENV ('LASTERR', 'DBERRNUM') , DBERRMSG = #GETENV ('LASTERR', 'DBERRMSG') , OPTYPE = #GETENV ('LASTERR', 'OPTYPE') , ERRTYPE = #GETENV ('LASTERR', 'ERRTYPE') , LOGRBA = #GETENV ('GGHEADER', 'LOGRBA') , LOGPOSITION = #GETENV ('GGHEADER', 'LOGPOSITION') , COMMITTIMESTAMP = #GETENV ('GGHEADER', 'COMMITTIMESTAMP') , GGS_FILENAME = #GETENV('GGFILEHEADER', 'FILENAME') , CDRFAIL = #GETENV('DELTASTATS','CDR_RESOLUTIONS_FAILED') , CDRSUC = #GETENV('DELTASTATS','CDR_RESOLUTIONS_SUCCEEDED') , CDRDETECT = #GETENV('DELTASTATS','CDR_CONFLICTS')) , INSERTALLRECORDS , EXCEPTIONSONLY; END; MAP sender.* #exception_handler(); site gg2 is similar. All row that i insert get insert with no abends but the warning confuses me.
According to the message you are getting a Key violation. Does the target table already have a record with the same key? Your exceptions mapping is handling it and you should see records in the ggs.ggs_exceptions table. Also, do a STATS on Replicat. STATS REPLICAT repname TOTAL and look for discards or collisions.
It seem like key "1" might already be on the target database. can you check that first? ALso, you might want to remove the reperror and exception to test.
Azure Synapse Analysis: Error while accessing the external table
Failed to execute query. Error: File 'https://track2gen2storage.blob.core.windows.net/\sourcedata\sample.csv' cannot be opened because it does not exist or it is used by another process. we performed these steps:- create database SalesdataDemo use salesdataDemo -----create master key CREATE MASTER KEY ENCRYPTION BY PASSWORD = <Password>; SELECT * FROM sys.symmetric_keys AS SK WHERE SK.name = '##MS_DatabaseMasterKey##'; CREATE DATABASE SCOPED CREDENTIAL ADL_User WITH IDENTITY = '<client_id>#<OAuth_2.0_Token_EndPoint>',Secret = <Key> CREATE DATABASE SCOPED CREDENTIAL adls_credential WITH IDENTITY ='SHARED ACCESS SIGNATURE', SECRET = <azure_storage_account_key> CREATE EXTERNAL DATA SOURCE adlsdatasource WITH ( LOCATION = 'https://track2gen2storage.blob.core.windows.net', CREDENTIAL = adls_credential ) ; CREATE EXTERNAL FILE FORMAT adls_csv WITH ( FORMAT_TYPE = DELIMITEDTEXT, FORMAT_OPTIONS ( FIELD_TERMINATOR = ',', STRING_DELIMITER = '"', FIRST_ROW = 2 ) ); CREATE EXTERNAL TABLE sampledata ( <ColumnName><Datatype>) WITH ( LOCATION = '/sourcedata/sample.csv', DATA_SOURCE = adlsdatasource, FILE_FORMAT = adls_csv ) select * from sampledata
I think the problem is your external table location is starting with /. Try changing it to: CREATE EXTERNAL TABLE sampledata ( <ColumnName><Datatype>) WITH ( LOCATION = 'sourcedata/sample.csv', DATA_SOURCE = adlsdatasource, FILE_FORMAT = adls_csv ) Here is the document you can also take a look for reference: https://learn.microsoft.com/en-us/azure/synapse-analytics/sql/create-use-external-tables One more question, why do you need database scoped credential named ADL_User?
Error ORA-00600 in select table in Oracle dblink
I created an Oracle Dblink to access SQLServer tables. I can see the tables/views I have access. But when I execute a select, it returns ORA-00600. My dblink create command: CREATE DATABASE LINK SQLREQUERIM CONNECT TO my_user IDENTIFIED BY "myPassword" USING 'MSSQLREQUERIM'; My tnsnames.ora file MSSQLREQUERIM = (DESCRIPTION= (ADDRESS=(PROTOCOL=tcp)(HOST=myOracleHost)(PORT=1521)) (CONNECT_DATA=(SID=MSSQLREQUERIM)) (HS=OK) ) My listener.ora file SID_LIST_LISTENER = (SID_LIST = (SID_DESC= (SID_NAME=MSSQLREQUERIM) (ORACLE_HOME=/u01/app/oracle/product/11.2.0/dbhome_1) (PROGRAM=dg4odbc) ) ) My odbc.ini [ODBC Data Sources] MSSQLREQUERIM = MSSQL Server [MSSQLREQUERIM] Driver=/usr/lib64/libtdsodbc.so.0 Description = MSSQL Server Trace = No Server = mySQLServerHost Database = REQUERIM Port = 60472 TDS_Version = 7.2 My iniMYSQLREQUERIM.ora file HS_FDS_CONNECT_INFO = MSSQLREQUERIM HS_FDS_TRACE_LEVEL = DEBUG HS_FDS_SHAREABLE_NAME = /usr/lib64/libodbc.so set ODBCINI=/etc/odbc.ini
The error was due to some table columns having types (text) that are incompatible with Oracle. Suppressing these columns the search worked.
Query failing on Oracle 12c and 18c when changing NLS_SORT to BINARY_CI
I have the following query which correctly returns records when I execute it via code or Oracle SQL Developer. SELECT TABLE_T.COL_P, 1234 AS COL_C, TABLE_T.COL_D, SUM(SOME_COLUMN) Value FROM TABLE_T INNER JOIN TABLE_E E ON TABLE_T.COL_P = E.COL_P AND TABLE_T.COL_C = E.COL_C AND TABLE_T.COL_CC = E.COL_CC AND TABLE_T.COL_CL = E.COL_CL INNER JOIN TABLE_C C1 ON C1.COL_P = E.COL_P AND C1.COL_C = E.COL_C INNER JOIN TABLE_C C2 ON C2.COL_P = C1.COL_P AND C2.COL_CX = C1.COL_CX AND C2.COL_CY = C1.COL_CY AND C2.COL_CZ = C1.COL_CZ WHERE TABLE_T.COL_P = 'Some Text' AND C2.COL_C = 1234 AND TABLE_T.COL_CL IN (SELECT COL_CL FROM TABLE_CL WHERE COL_P = 'Some Text' AND ((COL_CLTYPE = 'VALUE_A') OR (COL_CLTYPE = 'VALUE_B') OR (COL_CLTYPE = 'VALUE_C') OR (COL_CLTYPE = 'VALUE_D')) ) GROUP BY TABLE_T.COL_P, TABLE_T.COL_D However, it fails to return records once I execute the following session commands: ALTER SESSION SET NLS_COMP = LINGUISTIC; ALTER SESSION SET NLS_SORT = BINARY_CI; This problem only occurs when I'm running against an Oracle 12c or 18c database. It works find with/without the session commands when running against an Oracle 12C R2 or 11g database. I've already checked the Explain Plan for 12c/18c and 12cR2 and its creating the same plan. I found out that by adding an ORDER BY clause to the query (ORDER BY TABLE_T.COL_D, it resolves the problem. Any ideas on what might be causing this problem? I know the ORDER BY solution works, but I'd like to know what the underlying cause is and if there's a better solution to it.
Oracle-lost rpc connection to heterogeneous remote agent using sid
Im trying to select in plsql using dblink connected to mysql. Here is my query: select t1."header_id" header_id from "table1"#times t1 ,"table2"#times t2 where t1."processed" = 'no' and t1."returned" = 'yes' and t2."header_id" is null and t1."header_id" = t2."header_id"(+) ; This is the error: Please help.Thank you.