Wednesday, 10 January 2018

%%Failed to Create Availability Group, SQL Server 2014 error 41042 encountered%%%

Failed to Create Availability Group, SQL Server 2014 error 41042        encountered


We were moving our SQL server boxes from one domain to another domain and after successful movement to the new domain, including windows cluster, Server's ,SQLServers, we have encountered the issues in Always on  availability group while recreating .

We had encountered the error SQL Server 2014 error 41042, Failed to Create  availability group

"Microsoft SQL Server, Error: 41042".


Below are the easy steps to resolve this issue 

Go to Windows Fail over Cluster Manager console  and “delete” the Resources/Listener which you are not able to create.





Then go the below Registry path for all servers where the Availability group exists.

“ HKEY_LOCAL_MACHINE\Cluster\HadrAgNameToldMap

                           Delete the entries  which are not able to create/failed 




Then re- run the wizard!!!!!!!!!!!!!!!!!!!! 









Wednesday, 3 February 2016

Schema Level Refresh in MS SQLServer


Consider a Scenario like, we have two environments Production and Development where having same set of tables with two different schemas based on the environment. So the application is working based on the Schema .

The Schema names are Prod ,Dev and the default schema dbo.
we are doing a Database Refresh activity from Production to Development as a normal DBA practice but after that the application is throwing error like 

                                       “Not able to connect or invalid object exist “

Reason: 

After the Database Restore activity, the Development Database will be replaced with Production Database in the object level also , Dev objects  have been replaced with Prod objects hence DEV application is not able to identify the changed objects having production schema.
In this Scenario, we need to check the objects where any schema level change is required or not after doing the DB Refresh.

Before the Database refresh activity from Production to Development

                                                            Production Database



                                                        
Developmet Database



So After the Database Refresh activity the Development database schema will be changed into production.


So we need to do a Schema level refresh also to make the application fully functional.
Below are the script to use a schema level refresh activity.


declare @sql varchar(8000), @table varchar(1000), @oldschema varchar(1000), @newschema   varchar(1000)

  set @oldschema = 'dbo'
  set @newschema = 'exe'

 while exists(select * from sys.tables where schema_name(schema_id) = @oldschema)

  begin
      select @table = name from sys.tables 
      where object_id in(select min(object_id) from sys.tables where  schema_name(schema_id)  = @oldschema)

    set @sql = 'alter schema ' + @newschema + ' transfer ' + @oldschema + '.' + @table

   exec(@sql)
 end



After the Schema level Change you should see the table like this




If you want to move all tables into a new schema, you can use the undocumented and to be deprecated at some point, sp_MSforeachtable stored procedure:

exec sp_MSforeachtable "ALTER SCHEMA TargetSchema TRANSFER ?"





Friday, 13 November 2015

SQLSvr 2012 Enterprise Failover cluster installation fails with error "Could not find the Database Engine startup handle"


While doing the 2012 SQL Failover Cluster Installation , received the below error in the last stage and not able to start your DB Engine and Agent Services .

SQL Svr 2012 Enterprise EN\ Failover cluster installation fails with error "Could not find the Database Engine startup handle"

In the SQLServer Error Log , we could see the below error message ,

TDSSNIClient initialization failed with error 0x80090331, status code 0x80. Reason: Unable to initialize SSL support. The client and server cannot communicate, because they do not possess a common algorithm

FIX: You cannot use the Transport Layer Security protocol version 1.2 to connect to a server that is running SQL Server 2014 or SQL Server 2012


Resolution

1. Enable TLS 1.0 & SSL 3.0 under [HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\SecurityProviders\SCHANNEL\Protocols\ in windows registry .
2. In case you want to use any other protocol e.g. TLS 1.2 then you have to apply Cumulative Update 6 for SQL Server 2012 SP2 .


Reference 



Thursday, 16 July 2015

Reporting Services Configuration Tool unable to connect Instance error - In windows 2012 server having SQLServer 2008/R2 named instance

When opening the Reporting Services Configuration Manager attempting
to connect to a named instance, no instances are available in the Report Server Instance drop down list, and when the find button is pressed the error

 "No report servers were found.
 Details:
 Invalid Namespace"

Resolution
Go to the path -Microsoft SQL Server\MSRS10.SQL2008\Reporting Services\ReportServer\bin\reportingservices.mof .
Take a backup of the file before modifying
Replace the the instance name in all places with your correct instance 
name in the .mof file . your named instance is SQL2008
//Name = "RS_SQL2008" change to Name = "SQL2008"//
Next Step : Open cmd as Administrator and Run the below command
mofcomp.exe "C:\Program Files\Microsoft SQL Server\MSRS10.SQL2008\Reporting Services\ReportServer\bin\reportingservices.mof"



                                  

After doing this , Please Restart WMI Services from Services.msc
and open Report Service configuration Manager console.
This time you will be able to see the Server and Instance details .
Good Luck 



Saturday, 23 August 2014

HARDWARE REQUIREMENTS FOR SQLSERVER CLUSTER BUILD ON A WINDOWS CLUSTER


  •  Microsoft Windows Server 2008 R2 with SP1 Enterprise Edition is installed on both computers in the cluster.
  • All nodes are added to the domain
  • A domain-level account that is a member of the local administrators group on each node.
  • A dedicated account is recommended.
  • Two PCI network adapters on each node in the cluster.
  • All hardware should be identical, slot for slot, card for card, BIOS, firmware revisions, and so on, for all nodes.
  • This makes configuration easier and eliminates compatibility problems.
  • Static IP addresses for all network interfaces on each node.
  • Each node must have at least two network adapters—one for connection to the client public network and the other for the node-to-node private cluster network
  • All nodes must have two physically independent LANs or virtual LANs for public and private communication.
  • All shared disks, including the quorum disk, must be physically attached to a shared bus.
  • Verify that disks attached to the shared bus can be seen from all nodes.
  • All shared disks must be configured as basic disks with RAID 5 - Logical Array and added to the windows cluster .
  • Required at least 3 shared disk/Mount for DATA, LOG and TEMPDB for each Instance
  • All partitions on the clustered disks must be formatted as NTFS with 64-KB allocation unit.
  • Cluster Quorum Disk Space Recommendation – 1 GB.
  • Quorum Configuration – Node and Disk Majority (Quorum)
  • IP Address and SQL Virtual/Cluster Name for SQL Instance
  • Cluster name will be added in DNS with virtual IP
  • Verify the Node Failover and Storage Failover
  • Configure MSDTC in the Cluster , It requires an IP  and Disk
  • MSDTC Disk Space Recommendation – 1 GB


PRE INSTALLATION CHECKS AND CONFIGURATIONS

Common Software Requirement
  •  SQL Server setup program requires Microsoft Windows Installer 4.5 or later.
  • DOT NET Framework 3.5.1
  • Microsoft Internet Explorer (IE) 6 SP1 or later is required.
  • For client connectivity, SQL Server 2008 R2 also requires the Shared Memory.Named Pipes, or TCP/IP network protocols.
  • SQL Server 2008 R2 Enterprise Edition with Service Pack 1 Software setup files.
  • Collation Settings Requirements for SQLServer


POST INSTALLATION CHECKS AND CONFIGURATIONS 

  • Configure the Possible Owners to the SQL Instance
  • Check the dependencies for SQL Instances which are properly configured
  • Validate Failover of Services and Application which includes all SQL Related Services and  Disks
  • Connect to SQL Instance and verify
  • Add the SQL Service Account ,DBA group in the SQL instance
  • Configure Min Server Memory and Max Memory  for SQL Server Instances depending on the available Physical Memory in the Sever
  • Configure MAX DOP in the SQLServer depends on the number of CPU in the Server.



Monday, 11 August 2014

SQL 2008R2 SP2 installation fails on a Cluster with Windows 2008 R2 64 bit -Error Element not found. (Exception from HRESULT: 0x80070490)


When installing SP2 on a SQL 2008R2  Cluster, the installation fails with no apparent reasons. No errors are listed in the event logs

  Final result:                  The patch installer has failed to update the following instance: <Instance Name >. To determine the reason for failure, review the log files.
  Exit code (Decimal):           -568706566
  Exit facility code:            1562
  Exit error code:               14842
  Exit message:                  The patch installer has failed to update the following instance: <Instance Name >. To determine the reason for failure, review the log files.
  Start time:                    2014-08-09 21:10:32
  End time:                      2014-08-09 21:35:56
  Requested action:              Patch

Instance <,Instance Name> overall summary:
  Final result:                  The patch installer has failed to update the shared features. To determine the reason for failure, review the log files.
  Exit code (Decimal):           -568706566
  Exit facility code:            1562
  Exit error code:               14842
  Exit message:                  Element not found. (Exception from HRESULT: 0x80070490)
  Start time:                    2014-08-09 21:24:36
  End time:                      2014-08-09 21:35:50
  Requested action:              Patch

 Cause :

 The error is caused if there are offline and removed disks inside the cluster

 Resolution:

 1) Run the Windows Cluster Validation Report and see the error   "Element not found." in Disk  Configuration "
 2)The error is caused if there are  offline and removed disks inside the cluster (that are no longer  presented to the server nodes). 
3)Removing the disks and re-run the installer will fix the problem