Quantcast
Channel: SQL Server High Availability and Disaster Recovery forum
Viewing all 4532 articles
Browse latest View live

what's primary diference bwteen Always on availability groups and Always on Basic availability groups

$
0
0

We plan to use SQL Server 2016 Standard to configure Always on Basic availability groups that support with this edition. However, we are not clear what are primary diference and limitations of Always on Basic availability group compared with the traditional (advanced) Alwayson Availability groups with Enterprise Edition in practice. 

We intend to use Always on Basic availability groups to support SQL database failover automatically to work with our Gentec Security center SQL Alwayson failover mode.

Thnaks,

John


AlwayOn Failover Issue

$
0
0

If Network adapter fails in AlwaysOn Primary Server.

Does it trigger failover AlwaysOn AG  form Primary to Secondary node in Synchronos Mode?

Changing node votes

$
0
0

I was reviewing the configuration of a SQL AO AG yesterday and noticed that someone had changed the votes on 2 of the nodes. I am trying to figure out why this would have been done and what the results are from this change.

This particular AG is built on 3 Windows 2012R2 servers with SQL 2014. There are 2 servers in the primary datacenter and 1 server in the backup datacenter. The 2 servers in the primary site are in automatic failover and the backup site node is set to manual failover. DB01 is the primary node with all databases active there.

The node weight has been changed from the normal, each node has a vote, to the backup site node has no vote and the primary site nodes each have 1 vote with one node having a current vote of 1 and the other node having a current vote of 0. we are not using a fileshare witness. Here is what it looks like in failover cluster manager.

Given this configuration, What would happen if DB02 shut down? would the cluster shutdown the remaining nodes (and the SQL AG) because there is no fsw and DB03 has no vote? Or would the cluster failover to db01 and the current vote would be 1? Can someone explain what might be the possible outcomes using this?

TIA

SQL2k12 Crashed During Restart

$
0
0

Hello,

SQL2k12, Ent ed 11.0.7469.6 (X64) running on Win2k8 OS. Does not happen all the time. This morning, after windows patching successfully, when the service tried to start I suppose, it crashed. Here is the partial capture. Was able to restart the service after this without any issue:

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

Date8/25/2018 5:37:42 AM
LogSQL Server (Archive #1 - 8/25/2018 5:37:00 AM)

Sourcespid21s

Message
*   Exception Address = 00000000EC0D0430 Module(UNKNOWN+0000000000000000)

----

Date8/25/2018 5:37:42 AM
LogSQL Server (Archive #1 - 8/25/2018 5:37:00 AM)

Sourcespid21s

Message
*   Exception Code    = c0000005 EXCEPTION_ACCESS_VIOLATION

----

Date8/25/2018 5:37:42 AM
LogSQL Server (Archive #1 - 8/25/2018 5:37:00 AM)

Sourcespid21s

Message
*   Access Violation occurred writing address 00000000EC0D0430

Your  thoughts on this will be greatly appreciated.

Victor


Victor

SQL 2014 and SQL 2016 AG restore steps best option for local and DR solutions.

$
0
0

I am wanting to restore a database to SQL 2014/2016.

Can you remove all user databases from a AG group and still have a viable AG group?

In others words, can we readd database to an empty AG group?

Also trying to figure out what is the best way to restore a database which is in an AG group which is three SQL nodes.

SQL server 1 = test db (primary)

SQL server 2 = test db (replica 1)   backups occurring on this replica

SQL server 3= test db (replica  2) 

If we want to do a restore do we need to remove all three test db from the AG,... before we restore all three test db?   Is this AG still viable when we remove all the databases from the AG Group? ( no data bases left in the AG group ).  We then restore the databases on three replicas then readd to the AG?  we would restore on the primary SQL server 1 then readd all three servers to the AG group,... will SQL server 2 and SQL server 3 just synchronize.

Or can do we remove the test db (primary) from the AG while making both replica 1 and replica 2 not synchronizing (Is there an option not to synchronize?)?   Next restore test db (primary) since it is removed from the AG.  Replica 1 and Replica 2 are set not to synch ( is this an option ) while still in the AG.  test db (primary) which has been  restored is added back to the AG then all three servers are set to synch.  

Or can we remove test db (primary ) from the AG.  Next remove from the AG and delete both test db (replica 1) and test db (replica 2). We now have an empty AG ( no servers ).  Do a restore on test db (primary) then add to the AG.  Will both SQL server 2 (replica 1) and SQL server 2 (replica 2) automatically recreate both these replicas if set to synchronize?

What is the best way to do the above??  Please provide detailed steps.

And if we have a AG which stretches across the WAN ( two different data centers ), how do we do a restore.  If data center A is primary and data center B is the DR how do we do a restore?   Please provide detailed steps.  Replication is asynch between the data centers.


dsk


SQL Always On

$
0
0

Dears,

We want to configure SQL AlwaysOn between two sites, but we have some limitations please advise if the below scenario works:

  • I read a thread where its saying that SQL 2014 standard supports SQL AlwaysON but for each Database we need to configure an Availability Group.
  • We have One SQL  Enterprise and One SQL  Standard can we configure AlwaysON by taking into consideration the limitation for SQL 2014 Standard?
  • We have one SQL server Physical and one virtual in the second site, can we configure always on between these two servers?

Conclusion: we need to configure SQL always on between two sites :

  • Site 1: Physical server + SQL Enterprise
  • Site 2: Virtual server  + SQL Standard

Best Regards,

Always On FCI on workgroup clusters in WS2016

$
0
0

Hi,  I have questions about SQL FCI (Failover Cluster Instances) on Workgroup clusters in WS2016.

I've read the following blogs about WS2016 workgroup clusters.

 https://blogs.msdn.microsoft.com/clustering/2015/08/17/workgroup-and-multi-domain-clusters-in-windows-server-2016/ 

It mentions that SQL Server workload is supported for Workgroup clusters.

Now I'd like to confirm the following.

Q1) SQL FCI configuration is supported on workgroup clusters ? 

I've tried to find any information how to configure about SQL FCI on workgroup clusters, but I could not find it. All I found are how to configure about SQL AG (availability group). This is why I asked this question here.

Q2) If Q1) is yes, are there any pointers or information how to configure.

Any information are really appreciated.

Thanks,

Tadao

MultiSubnet Stretch Cluster configuration with Windows Server 2016

$
0
0

We are planning to setup a 3 node Multi subnet AAG between 2 datacenters. Our primary datacenter is Washington DC and  DR is San Jose. These are my inital thoughts. If I missed anything or if any other best practices can be added, please guide me 

1) 2 nodes in DC, 1  Node in SJ

2) Cloud-based witness in Azure blob storage 

3) Enable Site awareness to group primary nodes together  - This should also decrease the node weight of DR nodes 

4) The entire cluster will be on VM's. Is it better to create a different network for AAG replication? 

Does the DR node need to have any quorum votes at all? The idea is to have a manual failover option whenever required. 

Do we have to tune the TTL values? For any application which might not support the "multisubnetfailover" parameter?


Automatic Seeding Failures

$
0
0

Hi

We are running a two Server Always On HADR system with enabled Automatic Seeding. Both SQL Servers are Microsoft SQL Server Enterprise (64-bit) with Build 14.0.3029.16 and both are running on Windows Server 2016 Standard (10.0). Assigned memory is 4096 MB to 432128 MB. Disk space is enough on both servers and performance Tuning options like "Lock pages in memory" are set.

From time to time the automatic Seeding process will not start. In the DMV sys.dm_hadr_automatic_seeding the current_state is CHECK_IF_SEEDING_NEEDED and after a couple of seconds it changes to FAILED. The failure_state_desc then shows "Seeding Check Message Timeout".

The last database we had this problem was just 8 GB. The Problem can be easily solved by removing the DB from the Availability Group and adding it again. Then it is working without problems.

Where can I enhance this timeout?

What could delay the check if seeding needed?

Do you need more information?

Thanks for the help.

Kind Regards

Dominic

Always on Readable secondary.

$
0
0

i am trying to change the Readable secondary option to YES, but it does not give option 

the only option available is NO,

please assist,


k

Configure SQL Server AlwaysOn Availability Group on a Multi-Subnet Cluster

$
0
0

Hi All,

Configured  SQL Server Always On Availability Group on a Multi-Subnet Cluster. Now we have to setup the backup strategy . on which server we have to run the backup jobs either primary or secondary  

how to understand HADR_AR_CRITICAL_SECTION_ENTRY

$
0
0

Hi,

I found many times today, if there are two large databases are in recovery status(trying to catch up in availability group), the other databases needs recovery will be waiting.

The full story is I am fixing a broken availability group node, initially one large database is doing recovery, I fixed several other small databases(remove from ag, apply log backups and add it back in AG), then I started another large database, so in total there are two large databases doing recovery, I tried to started the third one "alter database db3 set hadr off" which is a small database, and it just hang there, it is suspended due to wait type hadr_ar_critical_section_entry:

"

Occurs when an Always On DDL statement or Windows Server Failover Clustering command is waiting for exclusive read/write access to the runtime state of the local replica of the associated availability group.

 Applies to: SQL Server 2012 through SQL Server 2016.

"

I am not sure how the logic works in the background, can anyone shed some lights? thanks!

Here are the server/version details:

Microsoft SQL Server 2014 (SP2) (KB3171021) - 12.0.5000.0 (X64) 

50GB memory and 12 cores assigned to this instance.

Distributed availability groups

$
0
0
can we have load balancing across replicas in distributed AG
I know we can have in Always on Availability Group but distributed Availability Group it is not working between the distributed sites.

is there any alternative for load balance with listener ?

HADR_AR_CRITICAL_SECTION_ENTRY waits during failover.

$
0
0

Hey guys, how are you?

I got a huge wait for this on a failover (90min):

Does anybody could help understanding what needs to be written and where?

It is not clear to me what really is runtime state and what could prevent a failover to finish as expected.

Thank you.


Luiz Mercante | MCITP SQL 2008 | MCTS SQL 2008 | MTA Database Fundamentals | MCTS Windows Apps | MCTS Windows Network | MCP 2003 | sqldicas@outlook.com | http://sqldicas.com.br --> Se a resposta foi útil de alguma forma, classifique como resposta ou vote como útil.

one listener for two availability groups

$
0
0

i have Basic availability gorup, i have one listener and working with AG1,

now i have second AG2 and i need to same listerner, not sure how to.

please assist.


k


AG databases went into 'Synchronizing/In recovery' after upgrading to 2014

$
0
0
We have 3 replica AG setup. 2 replicas are in sync/automatic failover, the other(DR Server, different subnet) in asynchronous/manual mode…All these replicas were on sql server 2012, Recently we upgraded DR server to 2014. Since then we have a problem, the AG databases in 2014 instance went into ‘Synchronizing/ in recovery’ state…The SQL server error log has message, the recovery couldn’t start for the database ‘XYZ’…We tried to create a new database and add it to AG , it works for fine for other two 2012 replicas, but on 2014 we see the same issue…Is there any workout to fix it or upgrading other replicas to 2014 is the only available solution..Quick help would greatly be appreciated

Is the any issue with sql 2012 (sp3 cu10) alwayson and vmware vmotion ?

$
0
0

Best regards,

I found it instable after a vmotion.

lumiga.

Main Site using SQL Cluster, need AlwaysOn for DR

$
0
0

Hi All,

At my HQ I'm using 2 node configured SQL failover cluster SQL Server 2012 SP3 multiple instance (Active - Active)

I want to build 1 node at DR site running on top SQL Server 2016, but I want to use AlwaysOn capabilities. Any recommendation about the design configuration ? is it supported running different version ?

many thanks for your help


Please remember to click “Mark as Answer” on the post that helps you, and to click “Unmark as Answer” if a marked post does not actually answer your question. This can be beneficial to other community members reading the thread. Krisna Ismayanto | My blogs: Krisna Ismayanto | Twitter:@ikrisna

Sync_logins stored proc does not work in Always On

$
0
0

hi,

On a daily basis at 2:00 AM this sp is executed regardless a failover happened or not and most of times I am receiving errors:

I find three casusitry

1-Could not drop login domain\user as the user is currently logged i as the user is currently logged in.

Amended looking for sessions and applying KILL before to do the DROP and CREATE

2-The server principal domain\user already exists.

It does not make any sense because my stored procedure is callingsp_validatelogins

3-Cannot find the login domain\user, because it does not exist or you do not have permission.

same than point 2.

I am wondering how to trigger this sp only when a failover happen

CREATE PROCEDURE [dbo].[ScriptLogins]

AS

SET NOCOUNT ON

DECLARE
	@StatementToRun VARCHAR(MAX) = ''
	,@CurrentRow INT
	,@TotalRows INT
	,@sid VARBINARY(85)
	,@name SYSNAME
	,@type CHAR(1)
	,@is_disabled INT
	,@default_database_name SYSNAME
	,@hasaccess INT
	,@denylogin INT
	,@password_hash VARBINARY(256)
	,@PasswordHashString NVARCHAR(300)
	,@SIDString NVARCHAR(100)
	,@is_policy_checked VARCHAR(3)
	,@is_expiration_checked VARCHAR(3)
	,@RoleName SYSNAME
	,@LoginName SYSNAME
	,@PermState NVARCHAR(60)
	,@PermName SYSNAME
	,@Class TINYINT
	,@ClassDesc NVARCHAR(60)
	,@MajorID INT
	,@SubLoginName SYSNAME
	,@SubEndPointName SYSNAME

/**********************************************************************
Usage:

Run from the instance that the logins will be created on:
DECLARE @StatementToRun VARCHAR(MAX)
SELECT @StatementToRun = StatementToRun FROM OPENQUERY("linkedservername", 'EXEC master.dbo.ScriptLogins')
EXEC (@StatementToRun)
**********************************************************************/

/**********************************************************************
Credits:

Created by Tomas Lind 2014
http://media.tomaslind.net/2014/02/ScriptLogins.txt

Most of the functionality in this procedure is copied from two sources:

Microsoft Support: sp_help_revlogin
(http://support.microsoft.com/kb/918992)

SQLSoldier: dba_CopyLogins
(http://www.sqlsoldier.com/wp/wp-content/uploads/Scripts/dba_CopyLogins.sql)

**********************************************************************/


/**********************************************************************
@sp_validatelogins
Results from sp_validatelogins is used to filter out users
no longer in AD.
**********************************************************************/
DECLARE @sp_validatelogins TABLE
    (
        [sid] VARBINARY(85) NOT NULL
        ,NTLogin SYSNAME NOT NULL
    )
 
INSERT INTO @sp_validatelogins
EXEC sp_validatelogins


/**********************************************************************
@Logins
The logins to transfer
**********************************************************************/
DECLARE @Logins TABLE
	(
		LoginId INT IDENTITY(1,1) NOT NULL PRIMARY KEY
		,[sid] VARBINARY(85) NOT NULL
		,[name] SYSNAME NOT NULL
		,[type] CHAR(1) NOT NULL
		,is_disabled INT NOT NULL
		,default_database_name SYSNAME NOT NULL
		,hasaccess INT NOT NULL
		,denylogin INT NOT NULL
		,password_hash VARBINARY(256) NULL
		,is_policy_checked VARCHAR(3) NULL
		,is_expiration_checked VARCHAR(3) NULL
	)
INSERT
	@Logins ([sid], [name], [type], is_disabled, default_database_name, hasaccess, denylogin, password_hash, is_policy_checked, is_expiration_checked)
SELECT
	principals.[sid]
	,principals.[name]
	,principals.[type]
	,principals.is_disabled
	,principals.default_database_name
	,logins.hasaccess
	,logins.denylogin
	,sqllogins.password_hash
	,CASE sqllogins.is_policy_checked WHEN 1 THEN 'ON' WHEN 0 THEN 'OFF' ELSE NULL END
	,CASE sqllogins.is_expiration_checked WHEN 1 THEN 'ON' WHEN 0 THEN 'OFF' ELSE NULL END
FROM
	sys.server_principals AS principals
LEFT OUTER JOIN
	sys.syslogins AS logins
ON
	principals.[name] = logins.[name]
LEFT OUTER JOIN
	sys.sql_logins AS sqllogins
ON
	principals.principal_id = sqllogins.principal_id
WHERE
	principals.[type] IN ('S', 'U', 'G') --S = SQL login, U = Windows login, G = Windows group
AND
	principals.[sid] <> 0x01 --sa even if it is renamed
AND
	principals.[name] NOT LIKE '##%' --system users
AND
	principals.[name] NOT LIKE 'BUILTIN%' --system users
AND
	principals.[name] NOT LIKE 'NT %' --system users
AND
	SUBSTRING(principals.[name], 1, ABS(CHARINDEX('\', principals.[name])-1)) <> SUBSTRING(@@SERVERNAME, 1, ABS(CHARINDEX('\', @@SERVERNAME)-1)) --local machine users
AND
	principals.[name] NOT IN (SELECT NTLogin FROM @sp_validatelogins) --users no longer in AD.


/**********************************************************************
@Roles
The roles to transfer
**********************************************************************/
DECLARE @Roles TABLE
	(
		RoleId INT IDENTITY(1,1) NOT NULL PRIMARY KEY
		,RoleName SYSNAME NOT NULL
		,LoginName SYSNAME NOT NULL
	)

INSERT
	@Roles (RoleName, LoginName)
SELECT
	role_principals.name
	,login_principals.name
FROM
	sys.server_role_members AS role_members
JOIN
	sys.server_principals AS role_principals
ON
	role_members.role_principal_id = role_principals.principal_id
JOIN
	sys.server_principals AS login_principals
ON
	role_members.member_principal_id = login_principals.principal_id
WHERE
	login_principals.[type] IN ('S', 'U', 'G') --S = SQL login, U = Windows login, G = Windows group
AND
	login_principals.[sid] <> 0x01 --sa even if it is renamed
AND
	login_principals.[name] NOT LIKE '##%' --system users
AND
	login_principals.[name] NOT LIKE 'BUILTIN%' --system users
AND
	login_principals.[name] NOT LIKE 'NT %' --system users
AND
	SUBSTRING(login_principals.[name], 1, ABS(CHARINDEX('\', login_principals.[name])-1)) <> SUBSTRING(@@SERVERNAME, 1, ABS(CHARINDEX('\', @@SERVERNAME)-1)) --local machine users
AND
	login_principals.[name] NOT IN (SELECT NTLogin FROM @sp_validatelogins) --users no longer in AD.
AND
	role_principals.[type] = 'R'


/**********************************************************************
@Permissions
The permissions to transfer
**********************************************************************/
DECLARE @Permissions TABLE
	(
		PermissionId INT IDENTITY(1,1) NOT NULL PRIMARY KEY
		,LoginName SYSNAME NOT NULL
		,PermState NVARCHAR(60) NOT NULL
		,PermName SYSNAME NOT NULL
		,Class TINYINT NOT NULL
		,ClassDesc NVARCHAR(60) NOT NULL
		,MajorID INT NOT NULL
		,SubLoginName SYSNAME NULL
		,SubEndPointName SYSNAME NULL
	)

INSERT
	@Permissions (LoginName, PermState, PermName, Class, ClassDesc, MajorID, SubLoginName, SubEndPointName)
SELECT
	Tprincipals.name COLLATE database_default
	,Tpermissions.state_desc
	,Tpermissions.[permission_name]
	,Tpermissions.class
	,Tpermissions.class_desc
	,Tpermissions.major_id
	,TServerPrincipal.name COLLATE database_default
	,Tendpoints.name COLLATE database_default
FROM
	sys.server_principals AS Tprincipals
JOIN
	sys.server_permissions AS Tpermissions
ON
	Tprincipals.principal_id = Tpermissions.grantee_principal_id
LEFT OUTER JOIN
	sys.server_principals AS TServerPrincipal
ON
	TServerPrincipal.principal_id = Tpermissions.major_id
AND
	Tpermissions.class = 101
LEFT OUTER JOIN
	sys.endpoints AS Tendpoints
ON
	Tendpoints.endpoint_id = Tpermissions.major_id
AND
	Tpermissions.class = 105
WHERE
	Tprincipals.[type] IN ('S', 'U', 'G') --S = SQL login, U = Windows login, G = Windows group
AND
	Tprincipals.[sid] <> 0x01 --sa even if it is renamed
AND
	Tprincipals.[name] NOT LIKE '##%' --system users
AND
	Tprincipals.[name] NOT LIKE 'BUILTIN%' --system users
AND
	Tprincipals.[name] NOT LIKE 'NT %' --system users
AND
	SUBSTRING(Tprincipals.[name], 1, ABS(CHARINDEX('\', Tprincipals.[name])-1)) <> SUBSTRING(@@SERVERNAME, 1, ABS(CHARINDEX('\', @@SERVERNAME)-1)) --local machine users
AND
	Tprincipals.[name] NOT IN (SELECT NTLogin FROM @sp_validatelogins) --users no longer in AD.


/**********************************************************************
Add the logins to the script
**********************************************************************/
SELECT @TotalRows = COUNT(*), @CurrentRow = 1 FROM @Logins

WHILE @CurrentRow <= @TotalRows BEGIN

	SELECT @sid = [sid] ,@name = [name] ,@type = [type] ,@is_disabled = is_disabled ,@default_database_name = default_database_name ,@hasaccess = hasaccess, @denylogin = denylogin, @password_hash = password_hash, @is_policy_checked = is_policy_checked, @is_expiration_checked = is_expiration_checked
	FROM @Logins
	WHERE LoginId = @CurrentRow

	IF (@type IN ('G', 'U')) BEGIN --NT authenticated account/group
		SET @StatementToRun = @StatementToRun +
			CHAR(13) + CHAR(13) + '
			IF EXISTS (SELECT * FROM sys.server_principals WHERE [name] = ''' + @name + ''') BEGIN
				DROP LOGIN ' + QUOTENAME(@name) + '
			END
			IF EXISTS (SELECT * FROM sys.databases WHERE [name] = ''' + @default_database_name + ''') BEGIN
				CREATE LOGIN ' + QUOTENAME(@name) + ' FROM WINDOWS WITH DEFAULT_DATABASE = [' + @default_database_name + ']' + '
			END
			ELSE BEGIN
				CREATE LOGIN ' + QUOTENAME(@name) + ' FROM WINDOWS WITH DEFAULT_DATABASE = [master]
			END'
	END
    ELSE BEGIN --SQL Server authentication
		SET @PasswordHashString = '0x' + CAST('' AS XML).value('xs:hexBinary(sql:variable("@password_hash"))', 'nvarchar(300)')
		SET @SIDString = '0x' + CAST('' AS XML).value('xs:hexBinary(sql:variable("@sid"))', 'nvarchar(100)')

		SET @StatementToRun = @StatementToRun +
			CHAR(13) + CHAR(13) + '
			IF EXISTS (SELECT * FROM sys.server_principals WHERE [name] = ''' + @name + ''') BEGIN
				DROP LOGIN ' + QUOTENAME(@name) + '
			END
			IF EXISTS (SELECT * FROM sys.databases WHERE [name] = ''' + @default_database_name + ''') BEGIN
				CREATE LOGIN ' + QUOTENAME(@name) + ' WITH PASSWORD = ' + @PasswordHashString + ' HASHED, SID = ' + @SIDString + ', DEFAULT_DATABASE = [' + @default_database_name + ']' + '
			END
			ELSE BEGIN
				CREATE LOGIN ' + QUOTENAME(@name) + ' WITH PASSWORD = ' + @PasswordHashString + ' HASHED, SID = ' + @SIDString + ', DEFAULT_DATABASE = [master]
			END'

			IF (@is_policy_checked IS NOT NULL) BEGIN
				SET @StatementToRun = @StatementToRun + '
			ALTER LOGIN ' + QUOTENAME(@name) + ' WITH CHECK_POLICY = ' + @is_policy_checked
			END
			IF (@is_expiration_checked IS NOT NULL) BEGIN
				SET @StatementToRun = @StatementToRun + ', CHECK_EXPIRATION = ' + @is_expiration_checked
			END

	END

	IF (@denylogin = 1) BEGIN -- login is denied access
		SET @StatementToRun = @StatementToRun + '; DENY CONNECT SQL TO ' + QUOTENAME(@name)
    END
    ELSE IF (@hasaccess = 0) BEGIN -- login exists but does not have access
		SET @StatementToRun = @StatementToRun + '; REVOKE CONNECT SQL TO ' + QUOTENAME(@name)
    END
    IF (@is_disabled = 1) BEGIN -- login is disabled
		SET @StatementToRun = @StatementToRun + '
			ALTER LOGIN ' + QUOTENAME(@name) + ' DISABLE'
    END

	SET @CurrentRow = @CurrentRow + 1
END


/**********************************************************************
Add the roles to the script
**********************************************************************/
SELECT @TotalRows = COUNT(*), @CurrentRow = 1 FROM @Roles

WHILE @CurrentRow <= @TotalRows BEGIN
	SELECT @RoleName = RoleName, @LoginName = LoginName
	FROM @Roles
	WHERE RoleId = @CurrentRow

	SET @StatementToRun = @StatementToRun + 
	CHAR(13) + '
			EXEC sp_addsrvrolemember @rolename = ' + @RoleName + ', @loginame = ' + QUOTENAME(@LoginName)

	SET @CurrentRow = @CurrentRow + 1
END


/**********************************************************************
Add the permisssions to the script
**********************************************************************/
SELECT @TotalRows = COUNT(*), @CurrentRow = 1 FROM @Permissions

WHILE @CurrentRow <= @TotalRows BEGIN
	SELECT @LoginName = LoginName, @PermState = PermState, @PermName = PermName, @Class = Class, @ClassDesc = ClassDesc, @MajorID = MajorID, @SubLoginName = SubLoginName, @SubEndPointName = SubEndPointName
	FROM @Permissions
	WHERE PermissionId = @CurrentRow

	SET @StatementToRun = @StatementToRun + 
	CHAR(13) + '
			' + @PermState + ' ' + @PermName + ' ' +
			CASE @Class WHEN 101 THEN 'ON LOGIN::' + QUOTENAME(@SubLoginName) WHEN 105 THEN 'ON ' + @ClassDesc + '::' + QUOTENAME(@SubEndPointName)  ELSE '' END +
			' TO ' + QUOTENAME(@LoginName)

	SET @CurrentRow = @CurrentRow + 1
END

SELECT @StatementToRun AS StatementToRun
GO

Thanks,

SSAG Database regularly falls in either "Not Synchronizing" or "Restoring" mode...

$
0
0

Hello,

I’ve setup my new SCOM 1807 lab with my databases (OperationsManager&OperationsManagerDW) in 2 independent SQL Server 2016 Always On Availability groups. Here are the variables behind my problem:

 

  • my lab is running in Hyper-V on my laptop computer; and
  • I regularly put my laptop to sleep and, on rare occasions, it gets patched and rebooted without my being able to gracefully shut down my lab;
  • I regularly leave my second database server, DB2, offline, running both availability groups on my primary database server, DB1

 

Now normally, one wouldn’t expect the above to pose a problem. That said, I regularly see one or both of my databases in one of the following modes, which renders my lab completely useless:

 

  • Not Synchronizing
  • Restoring

 

When this happens, I have to shut down the entire lab, and bring it back online. Sometime, I need to do this a few times before everything returns to normal operations…until the problem returns…

 

Does anyone have any insights as to what might be going on?
Viewing all 4532 articles
Browse latest View live


<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>