Pages

Showing posts with label SQL. Show all posts
Showing posts with label SQL. Show all posts

Tuesday, November 10, 2020

Attempting to create a Availability Group Listener after successfully creating a SQL Server 2019 Availability Group fails with: "The WSFC cluster could not bring the Network Name resource with DNS name..."

Problem

You’re attempting to create a Availability Group Listener after successfully creating a SQL Server 2019 Availability Group but receive the following error:

TITLE: Microsoft SQL Server Management Studio

------------------------------

Create failed for Availability Group Listener 'PRD_TX_Listener'. (Microsoft.SqlServer.Smo)

For help, click: https://go.microsoft.com/fwlink?ProdName=Microsoft+SQL+Server&ProdVer=16.100.44091.28+(SMO-master-A)&EvtSrc=Microsoft.SqlServer.Management.Smo.ExceptionTemplates.FailedOperationExceptionText&EvtID=Create+AvailabilityGroupListener&LinkId=20476

------------------------------

ADDITIONAL INFORMATION:

An exception occurred while executing a Transact-SQL statement or batch. (Microsoft.SqlServer.ConnectionInfo)

------------------------------

The WSFC cluster could not bring the Network Name resource with DNS name 'PRD_TX_Listener' online. The DNS name may have been taken or have a conflict with existing name services, or the WSFC cluster service may not be running or may be inaccessible. Use a different DNS name to resolve name conflicts, or check the WSFC cluster log for more information.

The attempt to create the network name and IP address for the listener failed. If this is a WSFC availability group, the WSFC service may not be running or may be inaccessible in its current state, or the values provided for the network name and IP address may be incorrect. Check the state of the WSFC cluster and validate the network name and IP address with the network administrator. Otherwise, contact your primary support provider. (Microsoft SQL Server, Error: 19471)

For help, click: http://go.microsoft.com/fwlink?ProdName=Microsoft%20SQL%20Server&ProdVer=15.00.2000&EvtSrc=MSSQLServer&EvtID=19471&LinkId=20476

------------------------------

BUTTONS:

OK

------------------------------

image

===================================

Create failed for Availability Group Listener 'PRD_TX_Listener'. (Microsoft.SqlServer.Smo)

------------------------------

For help, click: https://go.microsoft.com/fwlink?ProdName=Microsoft+SQL+Server&ProdVer=16.100.44091.28+(SMO-master-A)&EvtSrc=Microsoft.SqlServer.Management.Smo.ExceptionTemplates.FailedOperationExceptionText&EvtID=Create+AvailabilityGroupListener&LinkId=20476

------------------------------

Program Location:

at Microsoft.SqlServer.Management.Smo.SqlSmoObject.CreateImpl()

at Microsoft.SqlServer.Management.SqlManagerUI.AGListenerConfigurationNewModeViewData.DoWorkCore(AGListenerController controller)

at Microsoft.SqlServer.Management.SqlManagerUI.AGListenerConfigurationControl.OnRunNow(Object sender)

at Microsoft.SqlServer.Management.SqlMgmt.PanelExecutionHandler.Run(RunType runType, Object sender)

at Microsoft.SqlServer.Management.SqlMgmt.SqlMgmtTreeViewControl.DoPreProcessExecutionAndRunViews(RunType runType)

at Microsoft.SqlServer.Management.SqlMgmt.SqlMgmtTreeViewControl.ExecuteForSql(PreProcessExecutionInfo executionInfo, ExecutionMode& executionResult)

at Microsoft.SqlServer.Management.SqlMgmt.SqlMgmtTreeViewControl.Microsoft.SqlServer.Management.SqlMgmt.IExecutionAwareSqlControlCollection.PreProcessExecution(PreProcessExecutionInfo executionInfo, ExecutionMode& executionResult)

at Microsoft.SqlServer.Management.SqlMgmt.ViewSwitcherControlsManager.RunNow(RunType runType, Object sender)

===================================

An exception occurred while executing a Transact-SQL statement or batch. (Microsoft.SqlServer.ConnectionInfo)

------------------------------

Program Location:

at Microsoft.SqlServer.Management.Common.ServerConnection.ExecuteNonQuery(String sqlCommand, ExecutionTypes executionType, Boolean retry)

at Microsoft.SqlServer.Management.Common.ServerConnection.ExecuteNonQuery(StringCollection sqlCommands, ExecutionTypes executionType, Boolean retry)

at Microsoft.SqlServer.Management.Smo.ExecutionManager.ExecuteNonQuery(StringCollection queries, Boolean retry)

at Microsoft.SqlServer.Management.Smo.SqlSmoObject.ExecuteNonQuery(StringCollection queries, Boolean includeDbContext, Boolean executeForAlter)

at Microsoft.SqlServer.Management.Smo.SqlSmoObject.CreateImplFinish(StringCollection createQuery, ScriptingPreferences sp)

at Microsoft.SqlServer.Management.Smo.SqlSmoObject.CreateImpl()

===================================

The WSFC cluster could not bring the Network Name resource with DNS name 'PRD_TX_Listener' online. The DNS name may have been taken or have a conflict with existing name services, or the WSFC cluster service may not be running or may be inaccessible. Use a different DNS name to resolve name conflicts, or check the WSFC cluster log for more information.

The attempt to create the network name and IP address for the listener failed. If this is a WSFC availability group, the WSFC service may not be running or may be inaccessible in its current state, or the values provided for the network name and IP address may be incorrect. Check the state of the WSFC cluster and validate the network name and IP address with the network administrator. Otherwise, contact your primary support provider. (.Net SqlClient Data Provider)

------------------------------

For help, click: http://go.microsoft.com/fwlink?ProdName=Microsoft%20SQL%20Server&ProdVer=15.00.2000&EvtSrc=MSSQLServer&EvtID=19471&LinkId=20476

------------------------------

Server Name: BMA-PROD-SQL1

Error Number: 19471

Severity: 16

State: 0

Line Number: 1

 ------------------------------

Program Location:

at Microsoft.SqlServer.Management.Common.ConnectionManager.ExecuteTSql(ExecuteTSqlAction action, Object execObject, DataSet fillDataSet, Boolean catchException)

at Microsoft.SqlServer.Management.Common.ServerConnection.ExecuteNonQuery(String sqlCommand, ExecutionTypes executionType, Boolean retry)

image

Solution

This error is typically displayed if the Cluster Name Object (CNO) in Active Directory does not have permissions to create and read the listener computer object. The CNO name can be found in the Failover Cluster Manager:

image

To correct the issue, simply navigate to the OU containing CNO, which would be where it will attempt to create the listener computer object, right click on the OU and select Delegate Control… to launch the Delegation of Control Wizard:

image

Add the CNO computer object:

image

Select Create a custom task to delegate and click Next:

image

Select This folder, existing objects in this folder, and creation of new objects in this folder then click Next:

image

Select General and Creation/deletion of specific child objects, then locate the following and select the following:

  • Read all properties
  • Create Computer objects
  • Delete Computer objects
image

With the CNO computer object granted the respective permissions, the listener should now create successfully:

image

Attempting to create a SQL Server 2019 Availability Group fails with the error: "The local node is not part of quorum and is therefore unable to process this operation."

Problem

You attempt to create a new SQL Server 2019 Availability Group after configuring a Windows Failover Cluster:

image

… but the following error is presented:

TITLE: Microsoft SQL Server Management Studio

------------------------------

   The local node is not part of quorum and is therefore unable to process this operation. This may be due to one of the following reasons: 

• The local node is not able to communicate with the WSFC cluster.

• No quorum set across the WSFC cluster.

  For more information on recovering from quorum loss, refer to SQL Server Books Online. 

(Microsoft.SqlServer.Management.HadrTasks)

-----------------------------

BUTTONS:

OK

------------------------------

image 

Clicking on the Show details button displays the following:

===================================

The local node is not part of quorum and is therefore unable to process this operation. This may be due to one of the following reasons:

• The local node is not able to communicate with the WSFC cluster.

  • No quorum set across the WSFC cluster.

For more information on recovering from quorum loss, refer to SQL Server Books Online.

   (Microsoft.SqlServer.Management.HadrTasks)

------------------------------

Program Location:

at Microsoft.SqlServer.Management.Hadr.CreateAvailabilityGroupWizardController.CreateDataModel()

at Microsoft.SqlServer.Management.Hadr.CreateAvailabilityGroupWizardController.Initialize()

at Microsoft.SqlServer.Management.TaskForms.SqlWizardController.Microsoft.SqlServer.Management.TaskForms.ISqlWizardController.Initialize(ISqlWizardManager wizardManager)

at Microsoft.SqlServer.Management.TaskForms.SqlWizardManager.LoadWizardController()

at Microsoft.SqlServer.Management.TaskForms.SqlWizardManager.Initialize(String moniker, IContext context, ISqlWizardInfo wizardInfo)

at Microsoft.SqlServer.Management.ActionHandlers.ShowWizardActionHandler.RunTaskForm(IContext context)

at Microsoft.SqlServer.Management.ActionHandlers.DialogBasedActionHandler.RunTaskFormThread(Object contextObject)

image 

Solution

One of the common cause of this error is if the Enable Always On Availability Groups configuration for the SQL Server Services was turned on before you have installed and configured the Windows Failover Cluster:

image

If this is the case, simply disable the Enable Always On Availability Group option, restart the SQL Server Services, re-enable the option, and then restart the service:

image

The New Availability Group should now launch and allow you to create the Always On Availability Group:

imageimageimageimage

The New Availability Group should now launch and allow you to create the Always On Availability Group:

imageimageimage

Friday, November 13, 2015

Unable to connect to SQL server instance with SQL Server Management Studio with administrator account even though domain admins group is assigned with sysadmin permissions

Problem

You’re logged directly into a SQL Server 2012 server with an account that belongs to the domain admins group, launch SQL Server Management Studio and attempt to use Windows Authentication to connect to a database instance but notice that you receive the following error:

image

Cannot connect to <SQLserverName>\<DatabaseInstance>.

Additional information:

Login failed for user ‘<domainName>\<userName>’. (Microsoft SQL Server, Error: 18456)

image

You’ve confirmed that the Domain Admins group is assigned to the Security > Logins folder and assigned sysadmin permissions:

image

You noticed that you do not have this problem if you directly add the account you’re logged in as to the logins folder.

Solution

One of the reasons why this issue occurs is if the SQL server exhibiting this behavior has UAC turned on.  If this is the case, the problem will go away if SQL Server Management Studio as ran as an administrator.

Friday, April 4, 2014

Setting up VMware Horizon View to use SQL Server Express for the Events Database

Problem

You are attempting to to set up VMware Horizon View’s Events logging to a SQL Server Express database but could not View to connect to the SQL server:

image

As soon as the OK button is pressed, the following error is displayed:

An error occurred while attempting to configure the database. Double check the database parameters and ensure that the database is not down, restarting, or otherwise unavailable.

image

Solution

I’ve come across this a while ago when configuring VMware Horizon View events to log to a SQL Express database instance and the reason is because the TCP/IP ports are not configured properly. To correct this, launch the SQL Server Configuration Manager, navigate to SQL Server Configuration Manager –> SQL Server Network Configuration –> Protocols for VIM_SQLEXP –> TCP/IP:

image

Click on the IP Addresses tab:

image

Ensure that the TCP Dynamic Ports and TCP Port values for:

  • IP1
  • IP2
  • IP3
  • IP4
  • IP5
  • IP6

… are cleared with no values:

image

image

Set the TCP Port to 1433 or another number if desired:

image

Restart the SQL Server service to get the changes into effect.

With the changes above applied, the VMware Horizon View events configuration wizard should now be able to connect to the SQL Express database instance.

Thursday, September 12, 2013

Installing Microsoft SQL Server 2012 on Windows Server 2012 throws the error: “Error while enabling Windows feature : NetFx3, Error Code : -2146498298 , Please try enabling Windows feature : NetFx3 from Windows management tools and then run setup again.”

Problem

You’re installing Microsoft SQL Server 2012 on Windows Server 2012 but notice that the install fails with the error:

Error while enabling Windows feature : NetFx3, Error Code : -2146498298 , Please try enabling Windows feature : NetFx3 from Windows management tools and then run setup again. For more information on how to enable Windows features , see http://go.microsoft.com/fwlink/?linkid=227143

image

Solution

The solution is actually quite simple and that is to install .NET Framework 3.5 onto the Windows Server 2012 server via adding features in the Server Manager console:

image 

image

Note the yellow banner in the following screenshot notifying you to specify the installation Windows Server 2012 binaries to proceed:

image 

Make sure you specify the source or the install will fail:

image 

image 

image

With the .NET Framework 3.5 installed, SQL Server 2012 will now install successfully.

Saturday, May 4, 2013

Installing SQL Server 2008 R2 Management Tools fails with the error: “Another version of Microsoft Visual Studio 2008 has been detected on this system that must be updated to SP1. Please update all Visual Studio 2008 installation to SP1 level, by visiting Microsoft Update.”

Problem

You attempt to install SQL Server 2008 R2 Management Tools on a server or desktop:

clip_image001

but notice that it fails with the error:

Another version of Microsoft Visual Studio 2008 has been detected on this system that must be updated to SP1. Please update all Visual Studio 2008 installation to SP1 level, by visiting Microsoft Update.

clip_image001[4]

Your SQL Server 2008 R2 setup operation has been cancelled.

Another version of Microsoft Visual Studio 2008 has been detected on this system that must be updated to SP1.  Please update all Visual Studio 2008 installations to SP1 level, by visiting Microsoft Update.

clip_image001[6]

You attempt to download Microsoft Visual Studio 2008 Service Pack 1 (Installer) from the following URL:

http://www.microsoft.com/en-us/download/details.aspx?id=10986

clip_image001[8]

… but when running the install throws the following error:

Setup has detected that this computer does not meet the requirements to install this update. The following flocking issues must be resolved before you can install Microsoft Visual Studio 2008 SP1 software update.

Installation Requirements:

A compatible version of Visual Studio 2008 was not detected on the system. This update is designed for only the Microsoft Visual Studio 2008 (ENU) product family, and is not compatible with any Express editions.

clip_image001[10]

Solution

This probably was a difficult one to resolve as it took me quite a bit of searching to find a solution and the time it took to find an answer is why I choose to write this post in hopes that I could help someone who may experience the same problem.  What ended up working for me was instructions a user posted in the following thread:

http://social.msdn.microsoft.com/Forums/en-US/sqlsetupandupgrade/thread/baf09c3f-be97-4bc8-b6d7-bdeea2e3719e

I went ahead and located the SP and SPIndex REG_DWORD attributes in the following registry keys:

  • HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Microsoft\DevDiv\VS\Servicing\9.0
  • HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Microsoft\DevDiv\VS\Servicing\9.0\VSR\1033


… and changed the values from 0 to 1:

clip_image001[12]clip_image001[14]

Changed to 1:

clip_image001[16]clip_image001[18]

The user also suggested to change SPName REG_SZ to RTM but I did not have to do this as the install successfully completed with the previous changes:

clip_image001[20]

Wednesday, November 14, 2012

Migrating Citrix XenApp 6.5 data store database from one SQL server to another

I’ve been meaning to write a blog post for migrating Citrix a XenApp 6.5 data store database from one SQL server to another as this is quite common to do whether it’s due to server refreshes, disaster recovery or other similar situations.  First off, there are various Citrix documents available on the internet that describes the process and they are found in the following links:

Data Store Migration Strategies
http://support.citrix.com/article/CTX123111

How to Move or Migrate Data Store on XenApp 6 to another Server
http://blogs.citrix.com/2010/06/03/how-to-move-or-migrate-data-store-on-xenapp-6-to-another-server/

Migrating a Farm Data Store from MSDE to SQL Server Express
http://support.citrix.com/proddocs/topic/xenapp5fp2-w2k3/ps-datastore-migrate-msde.html

The problem I have with these documents are that they don’t describe the process in details and some of them omit various steps.  In a situation where you’re pressed for time or have already been working for extended hours having to response to an emergency, it’s not pleasant at all to fill in the gaps and this is why I thought I’d blog the steps incase I ever find myself in such a situation.

Let’s start with a bit of background information about the environment:

Citrix XenApp version: 6.5

Production SQL Database: SQL Server 2008 R1 | Build: 10.0.5500

Production SQL Database Server and instance: SVR-SQL-04\Citrix

Destination SQL Database: SQL Server 2008 R2 | Build: 10.50.1600

Production SQL Database Server and instance: SVR-SQL-06\Citrix

XenApp Servers:

  • SVR-CXA-01
  • SVR-CXA-02

Stop the IMA (Citrix Independent Management Architecture) Service

The Citrix documentation doesn’t explicitly state that you need to stop the IMA service but logically thinking about it makes me believe that it should be stopped to avoid any writes to the SQL database.  I’ve tried this in a production environment and have not seen any issues but whether you choose to stop it or not will be your choice.

imageimage

Back up XenApp data store Database

Once the IMA service has been stopped on all of your XenApp servers in the farm, proceed with launching Microsoft SQL Server Management Studio on the production SQL server and navigate down to the database:

image

Right click on the database and select Tasks –> Backup:

image

From within the Back Up Database window, remove the default Destination path:

image

… then click on the Add button:

image

In the Select Backup Destination window, click on the … button and navigate to the destination path where you want to backup the database:

image

For this example, we’ll be using the C: and naming the file XenApp65.bak:

image

Click on the OK button and then again in the Select Backup Destination window:

image

In the Back Up Database window, confirm the settings and click on the OK button to proceed with backing up the database:

imageimageimage

Create the XenApp database service account on the new SQL server

Prior to restoring the database, we’ll need to create the XenApp database server account on the new server so that when we restore the database, the restore will retain the service account dbowner assignment:

image

image

image

image

Restore XenApp data store Database

With the XenApp database service account created on the new production SQL server, begin by copying the backed up database file onto the new server:

image

image

… and then proceed with restoring the backed up database by right clicking on the Databases node and select Restore Files and Filegroups…:

image

From within the Restore Files and Filegroups window:

image

… select From device and click on the … button:

image

Within the Select backup devices window, ensure that the Backup media type is selected as File then click on the Add button:

image

Locate the backed up database and click OK:

image

Continue and click on the OK button again:

image

From within the Restore Files and Filegroups window, type in the same XenApp database name into the To database field, ensure that the Restore checkbox is selected and then click on the OK button to commence the restore:

imageimage

image

Note that the database isn’t immediately revealed after the restore so use the F5 button to refresh the list:

imageimage

Updating the DSN for XenApp’s connection to the new SQL server

--------------------------------------------------------------------------------------------------------------------------------------------------------------------

From here, the Citrix blog post:

http://blogs.citrix.com/2010/06/03/how-to-move-or-migrate-data-store-on-xenapp-6-to-another-server/

… suggests that we use the ODBC Data Source Administrator:

image

to reconfigure the mf20.dsn file but what I’ve found in the past is that using this tool adds and somewhat changes certain values in the mf20.dsn.  Note the following differences:

Original mf20.dsn:

image

New mf20.dsn created by the ODBC Data Source Administrator:

image

Note how the ordering is a bit different and the new and modified fields:

  • WSID
  • APP

Since the mf20.dsn is simply a text file, I choose to just use Notepad to edit the parameters.

--------------------------------------------------------------------------------------------------------------------------------------------------------------------

With the previous stated, I personally prefer to just open up the mf20.dsn file located in the directory:

C:\Program Files (x86)\Citrix\Independent Management Architecture

image

… with notepad and edit the following fields:

  • Server

image

Simply update the server FQDN to the new server:

image

Start the IMA service and execute dsmaint config

With the mf20.dsn updated, proceed with starting the IMA service:

image

… then use the dsmaint config command:

dsmaint config /dsn:"c:\Program Files (x86)\Citrix\Independent Management Architecture\mf20.dsn"

… to connect to the data store with new configuration settings:

C:\>dsmaint config /dsn:"c:\Program Files (x86)\Citrix\Independent Management Architecture\mf20.dsn"

Attempting to connect to the data store with new configuration settings.

Successfully connected to the data store.

Configuration successfully changed.

Please restart the IMA Service for changes to take effect.

image

-------------------------------------------------------------------------------------------------------------------------------------------------------------------

Note that if you receive the following error:

C:\Program Files (x86)\Citrix\Independent Management Architecture>dsmaint config /dsn:mf20.dsn

Attempting to connect to the data store with new configuration settings.

Failed to connect to the data store. The settings will be reverted to the previo

us configuration.

Unable to change configuration settings.

Please verify parameters and data source.

C:\Program Files (x86)\Citrix\Independent Management Architecture>

image

It’s because you need to specify the full path to the mf20.dsn file and that simply changing the directory to its location will not work.  The following Citrix KB mentions this: http://support.citrix.com/article/CTX108699

-------------------------------------------------------------------------------------------------------------------------------------------------------------------

Once the dsmaint config executes appropriately, proceed with restarting the IMA service:

image

Verify New Data Source

With the data source updated to point to the new server, proceed with taking the original production database offline:

image

… then opening up the registry on the XenApp server, navigate to:

HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Citrix\IMA\

… then review the value of the DataSourceName key (Type: REG_SZ) to ensure that the path and file is correct:

image

Once the data source registry key has been verified, continue by testing the XenApp server’s functionality but launching applications through the Web Interface.

Repeat for other XenApp Servers

Once we have verified that the updated XenApp server is in working order, proceed by repeating the following steps on each of the other servers in the farm.

Copy the mf20.dsn file to the other servers:

image

Run the following command:

dsmaint config /dsn:"c:\Program Files (x86)\Citrix\Independent Management Architecture\mf20.dsn"

image

Restart the IMA service:

image

Verify the registry DataSourceName key value:

image

Test the XenApp Server by launching applications.

-------------------------------------------------------------------------------------------------------------------------------------------------------------------

Hope this helps anyone out there looking for more detailed instructions on how to migrate a XenApp 6.5 farm’s SQL database to another server.