0

I follow all your blogs all helped me in my real-time issues. From last 2 days I'm facing connectivity issues to SQL server even though all the parameters are correct and cross verified with your blogs and everything is fine.

MY ISSUE:

We have hosting server in which we provide databases for clients, the problem here is from last 2 days I'm facing problem while generating script for database with data, initially the server is connected and able to start the activity but the problem is at the last step it is throwing an error stating as follows and some times it is working fine, I really not sure what was the issue, could you please help me on this? I will be thankful to you.

Note: Instance is Default, firewall is turned off, ping and tracert reports are fine.

The error I'm getting is as follows:

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) (.Net SqlClient Data Provider)


For help, click: http://go.microsoft.com/fwlink?ProdName=Microsoft+SQL+Server&EvtSrc=MSSQLServer&EvtID=53&LinkId=20476

------------------------------
Error Number: 53
Severity: 20
State: 0
------------------------------

Program Location:

   at System.Data.SqlClient.SqlInternalConnection.OnError(SqlException exception, Boolean breakConnection)
   at System.Data.SqlClient.TdsParser.ThrowExceptionAndWarning(TdsParserStateObject stateObj)
   at System.Data.SqlClient.TdsParser.Connect(ServerInfo serverInfo, SqlInternalConnectionTds connHandler, Boolean ignoreSniOpenTimeout, Int64 timerExpire, Boolean encrypt, Boolean trustServerCert, Boolean integratedSecurity, SqlConnection owningObject, Boolean withFailover)
   at System.Data.SqlClient.SqlInternalConnectionTds.AttemptOneLogin(ServerInfo serverInfo, String newPassword, Boolean ignoreSniOpenTimeout, Int64 timerExpire, SqlConnection owningObject, Boolean withFailover)
   at System.Data.SqlClient.SqlInternalConnectionTds.LoginNoFailover(String host, String newPassword, Boolean redirectedUserInstance, SqlConnection owningObject, SqlConnectionString connectionOptions, Int64 timerStart)
   at System.Data.SqlClient.SqlInternalConnectionTds.OpenLoginEnlist(SqlConnection owningObject, SqlConnectionString connectionOptions, String newPassword, Boolean redirectedUserInstance)
   at System.Data.SqlClient.SqlInternalConnectionTds..ctor(DbConnectionPoolIdentity identity, SqlConnectionString connectionOptions, Object providerInfo, String newPassword, SqlConnection owningObject, Boolean redirectedUserInstance)
   at System.Data.SqlClient.SqlConnectionFactory.CreateConnection(DbConnectionOptions options, Object poolGroupProviderInfo, DbConnectionPool pool, DbConnection owningConnection)
   at System.Data.ProviderBase.DbConnectionFactory.CreateNonPooledConnection(DbConnection owningConnection, DbConnectionPoolGroup poolGroup)
   at System.Data.ProviderBase.DbConnectionFactory.GetConnection(DbConnection owningConnection)
   at System.Data.ProviderBase.DbConnectionClosed.OpenConnection(DbConnection outerConnection, DbConnectionFactory connectionFactory)
   at System.Data.SqlClient.SqlConnection.Open()
   at Microsoft.SqlServer.Management.Smo.DataEnumerator.get_Connection()
   at Microsoft.SqlServer.Management.Smo.DataEnumerator.MoveNext()
   at Microsoft.SqlServer.Management.SqlManagerUI.Scripting.ScriptObjectContainer.AppendDataScriptAsInsertStatements(ScriptWriter scriptWriter, IEnumerable fragment)
   at Microsoft.SqlServer.Management.SqlManagerUI.Scripting.ScriptObjectContainer.AppendDataScriptFragment(ScriptWriter scriptWriter, IEnumerable fragment)
   at Microsoft.SqlServer.Management.SqlManagerUI.Scripting.ScriptObjectContainer.AppendDataScript(ScriptWriter scriptWriter)
   at Microsoft.SqlServer.Management.SqlManagerUI.Scripting.ScriptObjectContainer.Script(ScriptWriter scriptWriter)
   at Microsoft.SqlServer.Management.SqlManagerUI.Scripting.ScriptedObjectCollection.ScriptAll(ScriptWriter scriptWriter)
   at Microsoft.SqlServer.Management.SqlManagerUI.Scripting.DependencyScriptHandler.ScriptCore(ScriptWriter scriptWriter)
   at Microsoft.SqlServer.Management.SqlManagerUI.Scripting.ScriptHandler.Script(ScriptWriter scriptWriter)
   at Microsoft.SqlServer.Management.SqlManagerUI.Scripting.ScriptHandler.Script(ScriptWriter scriptWriter)
   at Microsoft.SqlServer.Management.SqlManagerUI.Scripting.ScriptHandler.Script(ScriptWriter scriptWriter)
   at Microsoft.SqlServer.Management.SqlManagerUI.Scripting.ScriptHandler.Script(ScriptWriter scriptWriter)
   at Microsoft.SqlServer.Management.SqlManagerUI.Scripting.ScriptHandler.Script(ScriptWriter scriptWriter)
   at Microsoft.SqlServer.Management.SqlManagerUI.Scripting.ScriptHandler.Script(ScriptWriter scriptWriter)
   at Microsoft.SqlServer.Management.SqlManagerUI.Scripting.ScriptHandler.Script(ScriptWriter scriptWriter)
   at Microsoft.SqlServer.Management.SqlManagerUI.Scripting.ScriptHandler.Script(ScriptWriter scriptWriter)
   at Microsoft.SqlServer.Management.SqlManagerUI.Scripting.ScriptHandler.Script(ScriptWriter scriptWriter)
   at Microsoft.SqlServer.Management.SqlManagerUI.Scripting.ScriptHandler.Script(ScriptWriter scriptWriter)
   at Microsoft.SqlServer.Management.SqlManagerUI.Scripting.ScriptHandler.Script(ScriptWriter scriptWriter)
   at Microsoft.SqlServer.Management.SqlManagerUI.Scripting.ScriptHandler.Script(ScriptWriter scriptWriter)
   at Microsoft.SqlServer.Management.SqlManagerUI.Scripting.SingleScriptTarget.OnScriptingFinished(Object source, EventArgs e)
   at System.EventHandler.Invoke(Object sender, EventArgs e)
   at Microsoft.SqlServer.Management.SqlManagerUI.Scripting.ScriptProcessor.OnScriptingCompleted()
   at Microsoft.SqlServer.Management.SqlManagerUI.Scripting.ScriptProcessor.GenerateScript()
   at Microsoft.SqlServer.Management.SqlManagerUI.Scripting.ScriptingEngine.GenerateScript()
   at Microsoft.SqlServer.Management.SqlManagerUI.GenerateScriptMaker.DoScript()
   at Microsoft.SqlServer.Management.SqlManagerUI.GenScriptWizForm.Script()

Please give me any suggestion where I have to check for the RCA of the same.

Nony

0

Check the SQL Server log for any message at that time. If your connecting login has default database other than master then following scenario may be related.

One of our application generated same error in dev that you mentioned. It was due to fact that application login was not able to open default database because database not accessible at that time. SQL Server log was showing following error

Login failed for user 'loginName'. Reason: Failed to open the database 'DBName' specified in the login properties.

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Not the answer you're looking for? Browse other questions tagged or ask your own question.