Wednesday, January 11, 2017

SQL Server service crashes when you run an Oracle linked server query

Check event viewer for more info



The SQL Server (MSSQLSERVER) service terminated unexpectedly. It has done this 1 time(s). 


Example of query i ran 
SELECT fname , lname 
--ssn
from oraclelinkedserver.dbname.dbo.table

Cause
This issue occurs because the special characters "--" exist in the query to the Oracle linked server. These characters are used as a comment symbol.

The SQL Server process crashes because of the third-party linked server provider which is loaded inside SQL Server process. If the third-party linked server provider is enabled together with the Allow inprocess option, the SQL Server process crashes when this third-party linked server experiences internal problems.
Workaround
To workaround this issue, use one of the following methods:
Remove the comments symbol, or 
Replace  the comments symbol with the following comments symbol: 
/* */


this works;
SELECT fname , lname  
from oraclelinkedserver.dbname.dbo.table

https://blog.sqlauthority.com/2009/06/27/sql-server-fix-error-17892-logon-failed-for-login-due-to-trigger-execution-changed-database-context...