SQL Agent Job failing - sql

I have a BizTalk Server that has been configured per the instructions for BizTalk disaster recovery using the BizTalk Log Shipping implementation.
On the backup SQL Server, call it SQL02, the "Get Backup History" job fails constantly with the following error:
Executed as user: DOMAIN\User. SQL
Server Network Interfaces: Error
getting enabled protocols list from
registry [xFFFFFFFF]. [SQLSTATE 42000]
(Error 65535) OLE DB provider
"SQLNCLI10" for linked server "SQL01"
returned message "Login timeout
expired". [SQLSTATE 01000] (Error
7412) OLE DB provider "SQLNCLI10" for
linked server "SQL01" returned message
"A network-related or
instance-specific error has occurred
while establishing a connection to SQL
Server. Server is not found or not
accessible. Check if instance name is
correct and if SQL Server is
configured to allow remote
connections. For more information see
SQL Server Books Online.". [SQLSTATE
01000] (Error 7412). The step failed.
This job executes a local stored procedure, which basically executes another stored procedure on a linked server, called SQL01.
When i execute this stored procedure in a query window on SQL02:
EXEC [SQL01].[BizTalkMgmtDb_Prod].[dbo].[sp_GetBackupHistory]
it executes without any errors.
When the SQL agent job attempts to execute the same query it fails with the error above.
Why can i execute the procedure manually and the sql agent job cannot?

I had this same problem and solved it by making sure the job runs against a database to which the job owner has access.

check the sql agent and sql instance users it should have the rights and the users should be common for every instance or must have all the required rights.
In query you connect through a user which has the rights but the sql agent user does not have it (as per my understanding).
check your sql server configuration manager for checking users for services of sql server.

Related

How to use transaction in Linked server

I have a stored procedure which will do the DML operation from SQL query to Oracle DB and unable to use transaction in the Linked server and without the transaction, stored procedure is working as expected.
Server option to “Enable promotion of Distributed Transaction” has already been set to False.
DTC Configuration:
Providers: OraOLEDB.Oracle
Error message:
OLE DB provider "OraOLEDB.Oracle" for linked server "LinkedServer" returned message "Unable to enlist in the transaction.".
The operation could not be performed because OLE DB provider "OraOLEDB.Oracle" for linked server "LinkedServer" was unable to begin a distributed transaction.
All the properties/settings in Linked Server and DTC are followed but still getting the same error. Kindly help here.

SQL Server Agent Connection showing wrong Server

I have inherited another SQL database (Version 15.0.4083.2) and have noted some problems with the SQL Agent. Specifically the Agent is not logging any jobs (as I just discovered trying to check logs to debug an issue). I am seeing the following errors in the agent logs:
[298] SQLServer Error: 53, Named Pipes Provider: Could not open a connection to SQL Server [53]. [SQLSTATE 08001]
[165] ODBC Error: 0, Login timeout expired [SQLSTATE HYT00]
[298] SQLServer Error: 53, A network-related or instance-specific error has occurred while establishing a connection to SQL Server. Server is not found or not accessible. Check if instance name is correct and if SQL Server is configured to allow remote connections. For more information see SQL Server Books Online. [SQLSTATE 08001]
[382] Logon to server 'NotMyClient' failed (ConnLogJobHistory)
(Server name substituted)
This is saying to me that the agent is trying to attach to an incorrect servername/instance. I have then checked the agent properties, i.e. right click on agent, and under Connection it also lists 'NotMyClient'
However when I click on View connection properties the correct IP and computer name.
I have looked at several options for correcting this, but the majoity of answers seem to basically consist of wiping the database, not an option in this case. Also seen a suggestion that the instance name is incorrect, but can see no way of changing the instance name on the server agent.
Any suggestions are greatly appreciated.

Access another SQL Server through stored procedure

I want to access another SQL Server to import and update data of that server's database through a stored procedure.
For that I created linked server using sp_addlinkedserver.
EXEC sp_addlinkedserver
#server = N'LINKEDSERVER'
,#srvproduct=N''
,#provider=N'SQLOLEDB'
,#datasrc=N'[DB-Instance.cuprxxxlj.ap-xxxxxxx-x.rds.amazonaws.com]';
Then try to access by SQL query
SELECT *
FROM [LINKEDSERVER].[DATABASE].[dbo].[TABLE]
And getting errors like
OLE DB provider "SQLNCLI11" for linked server "LINKEDSERVER" returned message "Login timeout expired".
OLE DB provider "SQLNCLI11" for linked server "LINKEDSERVER" returned message "A network-related or instance-specific error has occurred while establishing a connection to SQL Server. Server is not found or not accessible. Check if instance name is correct and if SQL Server is configured to allow remote connections. For more information see SQL Server Books Online.".
Msg 53, Level 16, State 1, Line 0
Named Pipes Provider: Could not open a connection to SQL Server [53].
I had created database instance on amazon server and another is also on the amazon server and both are publicly accessible but don't know why I'm getting Server is not found or not accessible. Am I missing any server site setting or something else?
Please guide me if I am going in wrong direction.
I found the answer. The problem was an instance, I had created "Amazon RDS for SQL Server" which is currently not supporting to "Linked servers".
So I create a new AWS EC2 instance for Windows Server 2012 R2 and then I create Linked servers in it and tried to assess remotely. Now its working fine as I wanted.
Here is detailed document to Running SQL Server Linked Servers on AWS
Thanks.
Maybe try changing the timeout settings?
sp_configure 'remote query timeout', 0
go
reconfigure with override
go
This article explains in detail how to link one AWS Sql Server to another (https://aws.amazon.com/blogs/apn/running-sql-server-linked-servers-on-aws/). I am not certain what is wrong in your case, but this has a lot of steps that I do not see in your description.
And the one thing that does jump out at me is that you haven't configured any login security/access control. So unless the target server is open to the world, I would guess that you have to add that as a minimum.

how to take sql backup without login

I need some help as I am unable to log into a database.
Some Error is coming like...
unable to start service MS SQL SERVER ON SERVER SERVER.(MSCORLIB)
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: name pipes provider, error 40 could not open a connection to sql server) (Microsoft sql server, error :2)
My question is how can I take the backup now because I am unable to login into the sql.
As you have event in 9003 in your Event Log it indicates that you have corrupted master datatbase and you will need to rebuild it.
First check your disks for errors and fix them.
Then you will need to rebuild the master database:
For SQL Server 2005 check this:
http://www.sqlcoffee.com/Troubleshooting007.htm
or
http://thedbavault.blogspot.cz/2013/01/ms-sql-server-2005-rebuild-master.html
Also some recommend to use database file from another instance of the same version of SQL Server.
http://blogs.technet.com/b/fort_sql/archive/2011/02/01/the-easiest-way-to-rebuild-the-sql-server-master-database.aspx
Then you should be able to restore non-corrupted backup copy of your master database.
If you do not have backup of your master database, then you will have to recreate all logins, users, roles, permissions etc.
To backup data without running SQL Server you can only backup database files .mdf, .ldf.

Linked server issue while migrating shards from SQL Server 2005 to 2008 Enterprise R1

I am facing a strange problem during data migration. We "restored" data from 3 shards(on diff SQL Server 2005 machines) to single SQL Server 2008. We have single 2008 server now but the shards are unchanged from 2005.
Now I am trying to exec a SP on Master but I get the following error
Creating SP
OLE DB provider "SQLNCLI10" for linked server "(null)" returned message "Login timeout expired".
OLE DB provider "SQLNCLI10" for linked server "(null)" returned message "A network-related or instance-specific error has occurred while establishing a connection to SQL Server. Server is not found or not accessible. Check if instance name is correct and if SQL Server is configured to allow remote connections. For more information see SQL Server Books Online.".
Msg 53, Level 16, State 1, Line 0
Named Pipes Provider: Could not open a connection to SQL Server [53].
All shards are on SQL Server. We are not using SQLNCLI10 provider. But it's strange to see this error.
My SP use some dynamically created distributed queries in SP.
eg. Shard01.dbo.Update.....
What could possible go wrong.
Solved the problem.
My SP was using a view which was moved restored from 2005 to 2008. 2008 has different shards configurations and SQLNCLI10 was used for OPENROWSET in 2005 but not in 2008 as all the DBs were on same server.
Redefining the view solved the issue.