Could not execute procedure on remote server via Linked server - sql-server-2014

I triggered a subscription using following query on Server-A using following query and it executes correctly -
On Server-A:
EXEC ReportServer.dbo.AddEvent #EventType='TimedSubscription', #EventData='452e4a40-7442-4377-abe3-1b96fc953956'
However, when I trigger it from Server B by adding Server-A as a Linked Server, then it doesn't work. It fails by throwing below error -
On Server-B:
EXEC [Server-A].ReportServer.dbo.AddEvent #EventType='TimedSubscription', #EventData='452e4a40-7442-4377-abe3-1b96fc953956'
Error:
Could not execute procedure on remote server 'Server-A' because SQL Server is not configured for remote access. Ask your system administrator to reconfigure SQL Server to allow remote access.
I have enabled the Remote Access configuration on Server-A by
USE ReportServer ;
GO
EXEC sp_configure 'remote access', 1;
GO
RECONFIGURE ;
GO
Still it gives me above mentioned error.
Can anyone help me on this? Thanks
UPDATE
NOT a single Stored Procedure is getting called via Linked Server. This has been observed after latest patch installed on Windows Server 2012R2.

Despite being an old thread forget about enabling remote access (and restart service) on remote server and try:
EXEC (N'ReportServer.dbo.AddEvent #EventType=''TimedSubscription'', #EventData=''452e4a40-7442-4377-abe3-1b96fc953956'' ') AT [Server-A]

Related

Visual Studio Code mssql extention: SQL Server (mssql) - Unable to connect to server

I'm trying for the first time to get my project to run in Visual Studio Code. This includes a MySQL database. So I've installed the SQL Server (mssql) extension version 1.7.1. I follow the instructions here: https://learn.microsoft.com/en-us/sql/visual-studio-code/sql-server-develop-use-vscode?view=sql-server-ver15
I get to the section "Connect to SQL Server" and enter:
servername: localhost
db name: c3
Authentication type: Integrated
At the end of the section it should connect with the server but instead I get two errors:
mssql: Error "Unable to connect using the connection information
provided. Retry profile creation?"
mssql: Error 2: A network-related or instance-specific error occurred
while establishing a connection to SQL Server. The server was not
found or was not accessible. Verify that the instance name is correct
and that SQL Server is configured to allow remote connections.
(provider: Named Pipes Provider, error: 40 - Could not open a
connection to SQL Server)
Does anyone see what is going wrong here?
I've re-installed the extension but with the same result.
A MySQL db and Microsoft SQL Server db are two different things.
It seems that there's no SQL Server installed? You might install the free SQL Server Express Version, create the database in there and then connect from Visual Studio Code.
You have to install the database server yourself as VS Code is just a client. You might also use somekind of hosted offers (many webhosters offer a mysql server with self service installation, or use a cloud based database server). Yout can also use a local database (e.g. SqlLite) which is file based and doesn't need a special installation.
You should do the following
install SQL server in your machine and create Database here
Create a login and a database user here
If you are Using VS code install SQL Server (mssql) open new
connection, follow the prompts to specify the properties for the new
connection profile
If you want to login to your server to make sure of your data
sqlcmd -S localhost -U SA -P '<YourPassword>'

Login Failed for User (Microsoft SQL Server, Error: 18456

I have SQL Server 2008 running on my local machine. I have removed myself from Database --> Sercurity. Now I cannot login and I am getting following error
Login Failed for User (Microsoft SQL Server, Error: 18456)
My Login is auttenticating from Active Directory
If you removed or disabled your login to the dmbs and have no other Logins to repair the situation, this Tip from a Microsoft Blog may apply:
Here are the steps you will need to perform:
Start the SQL Server instance using single user mode (or minimal configuration which will also put SQL Server in single user mode)
From the command prompt type: SQLServr.Exe –m (or SQLServr.exe –f)
Note: If the Binn folder is not in your environmental path, you’ll
need to navigate to the Binn folder.
(Usually the Binn folder is located at: C:\Program Files\Microsoft SQL
Server\MSSQL10.MSSQLSERVER\MSSQL\Binn)
Once SQL Server service has been started in single user mode or with minimal configuration, you can now use the SQLCMD command from
command prompt to connect to SQL Server and perform the following
operations to add yourself back as an Admin on SQL Server instance.
SQLCMD –S
You will now be logged in to SQL Server as an Admin.
Once you are logged into the SQL Server using SQLCMD, issue the following commands to create a new account or add an existing login to
SYSADMIN server role.
To create a new login and add that login to SYSADMIN server role:
1> CREATE LOGIN ‘’ with PASSWORD=’’
2> go
1> SP_ADDSRVROLEMEMBER '','SYSADMIN'
2>go
To add an existing login to SYSADMIN server role, execute the
following:
1> SP_ADDSRVROLEMEMBER ‘’,’SYSADMIN’
The above operation will take care of granting SYSADMIN privileges to
an existing login or to a new login.
Once the above steps are successfully performed, the next step is to stop and start SQL Server services using regular startup options.
(This time you will not need –f or –m)

Distributed Transaction on Linked Server between sql server and mysql

I have a table say Table1 on SQL Server 2014 and MySQL both.
Table1
ID INT,Code VARCHAR(100)
I created a linked server MyLinkedServer in SQL Server using "Microsoft OLEDB Provider for ODBC".
**Linked Server **
EXEC master.dbo.sp_addlinkedserver #server = N'MyLinkedServer', #srvproduct=N'MyLinkedServer', #provider=N'MSDASQL', #datasrc=N'MyLinkedServer'
EXEC master.dbo.sp_addlinkedsrvlogin #rmtsrvname=N'MyLinkedServer',#useself=N'False',#locallogin=NULL,#rmtuser=N'username',#rmtpassword='########'
Linked Server Settings
EXEC master.dbo.sp_serveroption #server=N'MyLinkedServer', #optname=N'data access', #optvalue=N'true'
EXEC master.dbo.sp_serveroption #server=N'MyLinkedServer', #optname=N'use remote collation', #optvalue=N'true'
EXEC master.dbo.sp_serveroption #server=N'MyLinkedServer', #optname=N'remote proc transaction promotion', #optvalue=N'true'
The linked server is created successfully and I am able to query Mysql Table in SQL Server.
Query
When I run
INSERT INTO MyLinkedServer...Table1(ID,Code) SELECT 1,'Code1'
The record is inserted. However when I start a transaction and run the INSERT, I get an error:
BEGIN TRAN
INSERT INTO MyLinkedServer...Table1(ID,Code) SELECT 1,'Code1'
COMMIT
Error:
OLE DB provider "MSDASQL" for linked server "MyLinkedServer" returned message "[MySQL][ODBC 5.3(a) Driver]Optional feature not supported".
Msg 7391, Level 16, State 2, Line 8
The operation could not be performed because OLE DB provider "MSDASQL" for linked server "MyLinkedServer" was unable to begin a distributed transaction.
What I have tried so far.
Enable XA Transactions in MSDTC
Enabled following setting in Linked Server Provider
Nested queries
Level zero only
Allow inprocess
Supports ‘Like’ Operator
I checked the following links and their suggestions however the error persists:
Distributed transactions between MySQL and MSSQL
SQL-Server and MySQL interoperability?
SQL Server and MySQL Syncing
EDIT
Additional Details:
MySQL is using InnoDB storage engine on Ubuntu machine.
I have already configured the ODBC connector and used it to configure a ODBC System Data Source which is used in the Linked Server
Theoretically this should work.
I would suggest different steps to sort this out:
Have you checked you MySql storage engine yet? It looks only InnoDB storage engine support distribute transaction per MySql document: https://dev.mysql.com/doc/refman/5.7/en/xa.html
See if you can switch to use MySQL Connectors setup connection to connect to MySql in SQL Server instead of OLEDB provider, which state by MySql document above that support distribute transaction.
If still not working, it might be the MSDTC service itself has some problem, see if you can isolate that like get a SQL Server instance running on the MySql server box(if you are using Windows MySql), or try install Windows MySql on the Sql Server box to get distribute transaction working between two MySql. Which would be able to point you to the actual problem.
EDIT:
Unfortunately it looks that you proved this not working, I've a closer look at the MySql document and sorry it looks that I wasn't reading it thoroughly, it says:
Currently, among the MySQL Connectors, MySQL Connector/J 5.0.0 and higher supports XA directly
And by some other Googling I found this: https://bugs.mysql.com/bug.php?id=37283, people report this bug many years ago and they marked this as a won't fix.
Some one suggested something here: https://social.msdn.microsoft.com/Forums/en-US/fc07937d-8b42-43da-8c75-3a4966ab95f9/xa-msdtc?forum=windowstransactionsprogramming, which is to implement your own XA-Compliant Resource Managers to be used by your application (https://msdn.microsoft.com/en-us/library/ms684317.aspx)
As on SQL 2014, you could have configured the linked server not to enlist in a distributed transaction. Although you could try adding "Enlist=false" in the #provstr argument to sp_addlinkedserver

SQL Job reverts run as identity to SQL Server Agent Service Account

I've found a SQL Job(s) on a server which run an SSIS package, I've changed the 'run as' drop down to a proxy account which has permissions to run the package. I will change it to my proxy account, run it a few times. However, when I come back to the server after a while and I'll find that it has reverted from my 'proxy account' to the 'SQL Server Agent Service Account'.
Please let me know if you have any suggestions as to why the identity is changing or where to look for clues as I've not seen anything in the logs which indicate that the identity was changed by the system.
Is proxy you were using to run SSIS packages is set to default? You can default the proxy to run SSIS package while defining job steps using #proxy_name like -
EXEC msdb.dbo.sp_add_jobstep #job_id=#jobId, #step_name=N'SSISPackageCall',
#step_id=1,
#cmdexec_success_code=0,
#on_success_action=1,
#on_success_step_id=0,
#on_fail_action=2,
#on_fail_step_id=0,
#retry_attempts=0,
#retry_interval=0,
#os_run_priority=0, #subsystem=N'SSIS',
#command=N'/FILE "C:\Package.dtsx" /CHECKPOINTING OFF /REPORTING E',
#database_name=N'master',
#flags=0,
#proxy_name = N'SSISProxyDemo';

SQL mangement user error

When i am creating users in SQL management studio i create them under the server name and then i create them under the database but when i try to log on using the user name and password i cant. getting erro saying
> TITLE: Connect to Server
Cannot connect to LAPTOP-RED\SQLEXPRESS.
ADDITIONAL INFORMATION:
A connection was successfully established with the server, but then an error occurred during the login process. (provider: Shared Memory Provider, error: 0 - No process is on the other end of the pipe.) (Microsoft SQL Server, Error: 233)
For help, click: http://go.microsoft.com/fwlink?ProdName=Microsoft+SQL+Server&EvtSrc=MSSQLServer&EvtID=233&LinkId=20476
BUTTONS:
OK
And the suggested solution from the help link is:
User Action
Use the SQL Server Surface Area Configuration tool to allow SQL Server
to accept remote connections. For more information about the SQL
Server Surface Area Configuration Tool, see Surface Area Configuration
for Services and Connections.
Which is what you have to do. By default the SQL Express Server isn't configured to allow remote connections.
hi I faced same issue in MicroSoft sql server 2008.
this error occurs while user limit exceeded, as you have set max connection to 1 and if someone is already logged in (or using any webpage which access your server) then it will not allow anyone to access directly or indirectly. to solve this issue simply follow following steps:
stop all web services.
open services.msc using RUN and ****restart sql server** and do not start any service which uses your sql server, so that you will be able to log in using sql server management studio.
now open sql server management studio and click on New Query button.
It will ask for user name and password use your login name and password.
run these scripts one by one sp_configure 'user connections', 0
go
6.reconfigure with override
after this restart your sql server it will show a confirmation message click on OK.
Bingo
It works. please don't forgot to vote ;-)