How to Fix SQL Server Error 7391 (Msg 7391)

Published
Length
3 min read

Luis Felipe Dias

All posts

You see sql server error 7391 when a linked server cannot start a distributed transaction. You fix it by setting up the transaction coordinator and network rules between both servers. This failure stops cross-server queries that change data or run inside a transaction block. Teams often see it right after a server move, firewall change, or OS update. What causes sql server error 7391 on linked servers In SQL Server, message 7391 is a severity 16 error from the database engine. The engine rep

Your coding agents run with your access.

Claude Code reaches prod with a developer's credentials, and approval prompts get clicked through. hoop.dev checks every query, masks sensitive data, and holds risky changes for a human.

You see sql server error 7391 when a linked server cannot start a distributed transaction. You fix it by setting up the transaction coordinator and network rules between both servers.

This failure stops cross-server queries that change data or run inside a transaction block. Teams often see it right after a server move, firewall change, or OS update.

What causes sql server error 7391 on linked servers

In SQL Server, message 7391 is a severity 16 error from the database engine. The engine reports that the OLE DB provider could not begin a distributed transaction. When one server updates another through a linked server, both hosts must coordinate that work. They use a background transaction service to make sure the change succeeds on both sides. If either host cannot reach the other host's transaction service, the query fails right away.

Several setup gaps can trigger this failure in your data center or cloud network. First, the transaction coordinator service might be stopped on the local or remote machine. Second, network transaction rules may be turned off in the local host settings. Third, a firewall between the two database hosts may block the dynamic ports needed. Fourth, the two hosts might fail to trust each other during the network handshake. Cloned virtual machines with duplicate internal identifiers can also break this handshake between hosts.

How to diagnose and fix the failure safely

Start by checking if the transaction coordinator service is running on both database machines. If the service is stopped on either side, start it and set it for startup. Next, check the component rules on both hosts so network transactions can flow in and out. Make sure the service account has the right to talk over the network.

Next, check the network path between the two database servers. Both machines must resolve each other by host name, not just by IP address. Verify that your firewall allows traffic for the transaction coordinator and its dynamic port range. Do not turn off the firewall entirely to make the error go away. Opening all ports exposes your database hosts to big risks on the internal network.

Kubernetes API Server Access + End-to-End Encryption: architecture patterns and best practices

Continue reading? Get the full guide.

Free. No spam. Unsubscribe anytime.

Also review the permissions and login mapping used by your linked server setup. A database user is the identity of a login when it connects to a database. Never map a linked server to a high-privilege login just to bypass a failure. For instance, the fixed owner role can perform all maintenance activities and drop the database. Instead, grant only the exact read or write roles needed on the target database. If a cross-server query only reads data, check if it needs a distributed transaction. Running simple read queries outside a distributed transaction block can avoid this error too.

Preventing linked server failures during daily work

Linked server errors often happen when engineers run ad-hoc write scripts across database links. You can reduce these issues by limiting who can run cross-server transactions in production. Give engineers scoped roles for daily checks, and review all cross-server changes before they run. Masking rules can also rewrite sensitive fields like emails or card numbers in query results.

Check SQL Server batches and results on the wire

SQL Server logins and roles decide who connects. They do not check what each TDS batch does or mask sensitive values in returned rows. With hoop.dev, you run an open-source proxy, a sidecar for your SQL Server, inline in the TDS wire protocol. On every batch an AI agent or engineer runs against production, hoop.dev decides to pass, mask, block, or hold it for human review.

Before a batch hits the server, hoop.dev guardrails refuse disallowed actions with a native TDS error or hold risky statements for approval. On the way back, hoop.dev data masking rewrites sensitive values in supported result columns in memory, and every decision is logged. Explore the MIT-licensed project on GitHub.

Frequently asked questions

What does severity 16 mean for message 7391?

Severity 16 means the error is a general failure that the user or admin can fix. It does not crash the database engine, bust it stops the current query right away.

Can a firewall cause sql server error 7391 even if the configured port is open?

Yes, standard database queries use the main database port, but distributed transactions need extra ports. The transaction coordinator uses its own port range to verify commits between both servers.

Should I give the linked server user full admin rights to fix this?

No, message 7391 is a transaction coordination issue, not a table permission error. Giving broad database roles creates security risks and will not fix a blocked transaction service.

The query runs. The emails stay hidden.