How to resolve an intermittent issue in linked server? - sql

Getting the below intermittent error, when inserting the records in Oracle DB using a stored procedure in SQL via linked server.
The OLE DB provider "OraOLEDB.Oracle" for linked server "linkedServer" supplied inconsistent metadata. An extra column was supplied during execution that was not found at compile time.
When I re-run the stored procedure with same arguments again and its successful.

Related

SSIS Package Cant execute OPENROWSET Stored Procedure

Stored Procedure on SQL Server 2017 calls an OPENROWSET command to load a file from an .xlsx file.
When running the Stored Procedure on the server it works fine and will load the xlsx rows into data tables. However when the SSIS package runs the Execute T-SQL Statement task to EXEC the same stored procedure it gives me this error:
"[Execute SQL Task] Error: Executing the query "EXEC USP NAME" failed
with the following error: "Cannot initialize the data source object of
OLE DB provider "Microsoft.ACE.OLEDB.12.0" for linked server "(null)".
OLE DB provider "Microsoft.ACE.OLEDB.12.0" for linked server "(null)"
returned message "Unspecified error".". Possible failure reasons:
Problems with the query, "ResultSet" property not set correctly,
parameters not set correctly, or connection not established
correctly."
The connection being used in the package has full access to the folder that contains the xlsx file and the Test Connection works just fine.

My application cannot execute a stored procedure in SQL Server

I have a new AlwaysOn environment where we've moved an old SQL Server 2008 replication databases. I have replication working between the two environments and when I do a manual failover it works wonderfully.
The problem that I'm having with this is that the application cannot execute the stored procedure. We're tested both the SQL Server 2008 as well as the new SQL Server 2012 edition. The stored procedure works as it has been for years and nothing has changed on it.
I've also did another test while running the application job to create the document and used profiler to find the differences in the two. What I've found is that within the first SQL Server 2008 environment is that I see where the stored procedure is getting executed, as well as the results that getting stored in the tables. With the SQL Server 2012 Profiler results I don't see the same stored procedure execution. More on those line the only thing that I really see is where the statement should be executing. At the end of the profiler I do however see where a statement, that get by mail, executes and stats that "null values are no allowed in a column where nulls are not allow" . This is a true statement. The column does not allow null values. I have double checked the permission and everything matches up.
So my question is why can't the application not execute the stored procedure?
Error is:
Here is the error that we are getting with this process. Error: Error:
PS Auto Changes Process Model. Service Task failed PS Auto
Changes,version 60 : Instance ID 37486 Review Change node :
StoredProcedureServiceTask, SQL Server Exception: Cannot insert the
value NULL into column 'jobID', table
'Docfinity10_Reporting.dbo.TFBAudit_BPMJobInfo'; column does not allow
nulls. INSERT fails.

Multiple-step OLE DB operation generated errors...SSIS VS2005 Business Development Studio

When developing SSIS package using VS 2005, I set up the connection manager for oledb teradata provider and added a oledb source and destination. For oledb source, I used the data access mode as sql command and added sql command text. But when I tried to do column mapping, I'm getting an error message which is detailed below.
Error at All Transactions [OLEDB Source [1627]]:
An OLEDB error has occurred. Error code: 0x80040E21.
An OLE DB record is available. Source: "OLE DB Provider for Teradata" Hresult:
0x80040E21 Description: "Multiple-step OLE DB operation generated errors. Check
each OLE DB status value, if available. No work was done.".
ADDITIONAL INFORMATION:
Exception from HRESULT: 0xC0202009 (Microsoft.SqlServer.DTSPipelineWrap)
BUTTONS:
OK
Please let me know why such error throws. I have a workaround which is described as follows.
when you store the sql within ( and ) and alias the query and set the data access mode as table name or view name variable, then it works fine.
Without any more information on the SQL being used in the OLEDB Source component, I can try and guess. Maybe the issue is with the SQL that is returning columns with the same name or similar situation that leads to incorrect metadata.
I just got this error and I simply edited the provider to a different provider, tested, and then set it back to the original provider. In my case I was using OLEDB Native client 11 so I set it to 10 and then back to 11.
My guess is the XML got corrupted somehow as my package has been working forever.

Error while disabling publishing and distribution

Hi I delete all publications and subscriptions on sql server 2008 . Then try to disabling publishing and distribution for reconfigure replication but have an error :
An exception occurred while executing a Transact-SQL statement or batch. (Microsoft.SqlServer.ConnectionInfo)
Invalid object name 'dbo.sysmergesubscriptions'.
Changed database context to 'master'. (Microsoft SQL Server, Error: 208) Ho solve it ?
One thing you can do is: create that object by yourself. Most likely there would be more than one table/view missing. Just script those missing objects from another database (for example, develop environment) and create them in your production box.

Using linked server returns error - "Cannot obtain the schema rowset for OLE DB provider"

I tried to move data aka ETL from one sql server to another as mentioned in a previous question - Copy data from one column into another column. Now, I get an error when I try to execute a query.
Query -
INSERT INTO [Target_server].[Target_DB1].[dbo].[Target_Table1](Target_Column1)
SELECT Source_Column222
FROM [Source_server].[Source_DB1].[dbo].[Source_Table1]
WHERE Source_Column1 = 'ID7162'
Error -
OLE DB provider "SQLNCLI" for linked server "MYLINKEDSERVER" returned message "Unspecified error".
OLE DB provider "SQLNCLI" for linked server "MYLINKEDSERVER" returned message "The stored procedure required to complete this operation could not be found on the server. Please contact your system administrator.".
Msg 7311, Level 16, State 2, Line 1
Cannot obtain the schema rowset "DBSCHEMA_TABLES_INFO" for OLE DB provider "SQLNCLI" for linked server "MYLINKEDSERVER". The provider supports the interface, but returns a failure code when it is used.
If your wrote that simple select is not working, the issue is in security configuration of the linked server and permissions which your user receive there.
Among this, when you execution your query, you don't need to specify the server name and DB name for both parts - source and target. You simply need to execute the query on target server and target database. In this case your query instead of
INSERT INTO [Target_server].[Target_DB1].[dbo].[Target_Table1](Target_Column1)
SELECT Source_Column222
FROM [Source_server].[Source_DB1].[dbo].[Source_Table1]
WHERE Source_Column1 = 'ID7162'
will looks like the following:
INSERT INTO [dbo].[Target_Table1](Target_Column1)
SELECT Source_Column222
FROM [Source_server].[Source_DB1].[dbo].[Source_Table1]
WHERE Source_Column1 = 'ID7162'
and you need your connection to be opened on server [Target_server] and database [Target_DB1]. Also the linked server security properties need to be checked on [Target_server] against the [Source_server].
If you are using loop back linked server (linked server refering to the same database in the same server) then refer the below mentioned link:
Transaction with loopback linked server - locking issues
If that is not the case, this is the solution provided by Microsoft.