I am working on database migration project. Connecting to SQL Server using Oracle gateway.
Image datatype in SQL Server is migrated to blob data in Oracle. But when I try to insert the data using insert command it gives an error.
SQL Server table:
create table xyz ([Image_Data] [image] NULL )
Oracle table:
create table xyz (Image_data BLOB null)
Insert command used:
insert into xyz
select * from xyz#sqldb;
Error message:
SQL Error: ORA-00997: illegal use of LONG datatype
00997. 00000 - "illegal use of LONG datatype"
ODBC is mapping SQL Server column to Oracle's LONG data type. It is not that easy to handle it.
The best way is to use DBMS_SQL package.
Here you can find useful notes:
http://ellebaek.wordpress.com/2010/12/06/converting-a-long-column-to-a-clob-on-the-fly/
We have successfully migrated the data with DTS Tool.
Related
I have a database in Oracle and a database in SQL Server.
I want to write a query in Oracle and I need to use one of SQL Serever table in it.
Before I used database link but now I must to do this with ODI (Oracle Data Integrator).
The way I used before:
CREATE PUBLIC DATABASE LINK "DBLINK"
CONNECT TO "MatrisApp" IDENTIFIED BY VALUES ':1'
USING 'dg4msql';
INSERT
INTO everyday_deposit_temp ***/*this is a table in oracle*/***
(
"DEP_ID",
"REF_DEPOSIT_TYPE",
"REF_DEPOSIT_SUB_TYPE",
"LEDGER_CODE_SELF"
)
SELECT "DEP_ID",
"REF_DEPOSIT_TYPE",
"REF_DEPOSIT_SUB_TYPE",
"LEDGER_CODE_SELF"
FROM dbo.vw_deposit_changed#dblink
Please help me with this
The most common way to get data from MS SQL Server to Oracle through ODI is to use LKM MSSQL to ORACLE (BCP SQLLDR).
Now if you really want to use a dblink, I would try this approach:
Duplicate a Oracle IKM you want to use
In the definition tab, check the Multi-Connections checkbox and set Microsoft SQL Server for the Source Technology.
In the Options tab, add a new option DBLINK_NAME with Value type.
In the Tasks tab, find the task responsible of the insert and edit the target command to add this after the table name : #<%=odiRef.getOption("DBLINK_NAME")%>
Create a mapping using the new IKM. In the Physical tab, click on the target table and add the dblink name in the Option.
I have changed variable names to protect customer.
I am trying to execute a stored procedure from a remote Oracle 12c database, from my SQL Server 2012 database. If it helps, the Oracle database pl/SQL procedure is has input data types of: INPUT1=CHAR(200), INPUT2=(NUMBER), OUTPUT=SYS_REFCURSOR
I am constantly getting the following error:
"OLE DB provider "OraOLEDB.Oracle" for linked server "testsrv1" returned message "Multiple-step OLE DB operation generated errors. Check each OLE DB status value, if available. No work was done.""
My query is found below:
DECLARE #outputParameter int
DECLARE #inputParameter varchar(400)
DECLARE #inputParameter1 varchar(400)
set #inputParameter1 = 'SampleStringValue'
set #inputparameter = SampleNumberValue
EXEC ('BEGIN storedProcedure(?,?); END;', #inputParameter, #inputParameter1, #outputParameter OUTPUT) at testsrv1
After many hours of research, I found that you cannot return a SYS_REF_CURSOR data type over a database link. Even from an Oracle database to another Oracle database.
https://asktom.oracle.com/pls/apex/asktom.search?tag=returning-result-set-from-stored-procedure-over-a-database-link
If Oracle database A is the DB producing the SYS_REF_CURSOR, and database B is the consumer - the only way that I have found online is to retrieve the data inside database A and store into a table, then pass the table via database link.
Is this really the only way to do this? I am somewhat new to oracle, but this seems like something that should be able to be done by now. The link from above is from 10+ years ago.
You can use SSIS and the SSIS Data Streaming Destination to connect to Oracle in SSIS and consume the output of the SSIS package in a SQL Query.
From SSIS you can use OleDB, ODBC, ADO.NET connectors for Oracle, or you can use a .NET script to connect to Oracle.
how can i copy data from a view of one server into the database table of another server in a SQL server database without using linked servers method.
I tried using the code:
SELECT [LogEntryID]
,[TimeStamp]
Into [server-2].[database1].[dbo].[table1]
FROM [server-1].[database1].[dbo].[view_1]
I recieve the error " The object name 'server-2.database1.dbo.table1' contains more than the maximum number of prefixes. The maximum is 2.
The copying statement i am using in a groovy code. But for first i am trying it in a query if it works.
You can use opendatasource instead of linked server
insert DestinationTable
select * from opendatasource('SQLOLEDB', 'Server=SourceServer;User Id=Username;Password=Password;').SourceDb.Schema.SourceTable;
OPENDATASOURCE
I'm working on a project that involves capturing data from an external service and relaying it into an IBM DB2 database. Data captured by the Web API is stored in SQL Server via Entity Framework 6 code. The table in SQL Server was structured after an existing table in DB2, using a generated script from System i Navigator to create an ISO Standard create script.
Remote Service --> Web API --> SQL -/-> DB2
The DB2 Server is set up as a linked server. I am able to select from its libraries and perform inserts manually from SQL Server Management Studio.
My goal is to run a query of the form:
INSERT INTO LinkedServer.SCHEMA.Table (Column1, Column2, Column3,...)
SELECT
(Column1, Column2, Column3,...)
FROM
database.dbo.Table
However, when I attempt to run the above query, I am met with messages like these:
OLE DB provider "IBMDASQL" for linked server "SERVER" returned message "CWBZZ5014 Value of parameter PARAMETER could not be converted to the host data type.".
OLE DB provider "IBMDASQL" for linked server "SERVER" returned message "CWBZZ5013 Cannot convert from CCSID 13488 to CCSID 937.".
OLE DB provider "IBMDASQL" for linked server "SERVER" returned message "CWBZZ5013 Cannot convert from CCSID 1202 to CCSID 937.".
I think there is something weird about how the insert statement is handling character encoding for all of the char(N) columns in the table, but I have no idea what to do about it. Have I missed something?
I Imported a table from SQL database to SPSS dataset, I edited the table by adding a new column to it after some statistics, but when I try to export the table back to the database by adding the new column, by matching the Primary key from dataset and database table which is of type "uniqueIdentifier, this error is shown to me
> Error # 6492
>The ODBC subsystem has issued an error which prevents the processing of SAVE
>TRANSLATE ODBC request.
>Execution of this command stops.
>[Microsoft][ODBC SQL Server Driver][SQL Server]Conversion failed when
>converting from a character string to uniqueidentifier.
how to resolve this error?
uniqueidentifier is probably a type that the ODBC driver doesn't know how to convert to as it is probably a database internal type. Try writing your data to a new table without converting and then do an update of the database table from within the database converting the identifier type inside the database. You can put the necessary SQL in your SAVE TRANSLATE syntax using its SQL subcommand.