понедельник, 15 апреля 2024 г.

SQL replication monitoring

 --SELECT * FROM [distribution].dbo.MSReplication_monitordata WHERE status not in(1,2,3,4)


SELECT * FROM [distribution].dbo.MSReplication_monitordata 

where not( agent_type=1 and status=2)

and not(agent_type = 2 and status=3)


3--2 - error



/*

agent_type

1 = Snapshot Agent

2 = Log Reader Agent

3 = Distribution Agent

4 = Merge Agent

9 = Queue Reader Agent


status

1 = Started

2 = Succeeded

3 = In progress

4 = Idle

5 = Retrying

6 = Failed

*/

-- 1 = Snapshot Agent / 2 = Succeeded

SELECT * FROM [distribution].dbo.MSReplication_monitordata where agent_type=1 and status<>2 

-- 2 = Log Reader Agent / 3 = In progress

SELECT * FROM [distribution].dbo.MSReplication_monitordata where agent_type=2 and status <>3

-- 3 = Distribution Agent / 3 = In progress, 4 = Idle 

SELECT * FROM [distribution].dbo.MSReplication_monitordata where agent_type=3 and (status <>3 or status <>4)



SELECT count(1) FROM [distribution].dbo.MSReplication_monitordata 

where 

(agent_type=1 and status<>2)

or (agent_type=2 and status <>3)

or (agent_type=3 and (status <>3 and status <>4) )


SELECT * FROM [distribution].dbo.MSReplication_monitordata 

понедельник, 12 февраля 2024 г.

Re-register VSS Writers for Server 2012-2016

 

  1. Create a batch file by:
    1. Copy the following list:
      • net stop vss
      • net stop swprv
      • regsvr32 /s ole32.dll
      • regsvr32 /s oleaut32.dll
      • regsvr32 /s vss_ps.dll
      • vssvc /register
      • regsvr32 /s /i swprv.dll
      • regsvr32 /s /i eventcls.dll
      • regsvr32 /s es.dll
      • regsvr32 /s stdprov.dll
      • regsvr32 /s vssui.dll
      • regsvr32 /s msxml.dll
      • regsvr32 /s msxml3.dll
      • regsvr32 /s msxml4.dll
      • vssvc /register
      • net start swprv
      • net start vss
    2. Open a blank text file
    3. Paste the copied list
    4. Save As fixvss.bat to an easily accessible location like the desktop of the workstation
  2. Right-click batch file > Run as administrator
  3. Immediately reboot device

пятница, 26 января 2024 г.

SureBackup NAS mounts

 восстановление работы SureBackup Testlab

  An error occurred during host configuration. 192.168.88.6: Fault "PlatformConfigFaultFault", detail "Operation failed, diagnostics report: Unable to get console path for volume, VeeamBackup_TS-FS01"  
[24.08.2023 12:38:19] <10> Error         An error occurred during host configuration. . Failed to mount NFS volume (192.168.88.6:/VeeamBackup_TS-FS01). 192.168.88.6: Fault "PlatformConfigFaultFault", detail "Operation failed, diagnostics report: Unable to get console path for volume, VeeamBackup_TS-FS01"  

  An error occurred during host configuration. 192.168.88.6: Fault "PlatformConfigFaultFault", detail "Operation failed, diagnostics report: Unable to get console path for volume, VeeamBackup_TS-FS01"  
[24.08.2023 12:38:19] <10> Error         An error occurred during host configuration. . Failed to mount NFS volume (192.168.88.6:/VeeamBackup_TS-FS01). 192.168.88.6: Fault "PlatformConfigFaultFault", detail "Operation failed, diagnostics report: Unable to get console path for volume, VeeamBackup_TS-FS01"  



Fault "DuplicateNameFault", detail "<DuplicateNameFault xmlns="urn:vim25" xsi:type="DuplicateName" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"><name>VeeamBackup_srv-bkp2


 Лечение такое:  
1. Заходим в консоль ESXi и смотрим список подключений
[root@esxi:~] esxcfg-nas -l
в моем случае пусто
2. Отключаем VeeamBackup_TS-FS01, где TS-FS01 имя сервера
[root@esxi:~] esxcfg-nas -d VeeamBackup_TS-FS01
IORM: failed to disable IORM: Unable to get console path for volume, VeeamBackup_TS-FS01
NAS volume VeeamBackup_TS-FS01 deleted.
3. Все работает. Повторное монтирование образа виртуальной машины проходит успешно

пятница, 15 декабря 2023 г.

MSDistribution cleanup

 EXEC dbo.sp_MSdistribution_cleanup @min_distretention = 0, @max_distretention = 24


select count(*) from distribution..msrepl_commands

select count(*) from distribution..msrepl_transactions


go

DECLARE @rowcountCom int = 5000000

DELETE TOP(@rowcountCom) MSrepl_commands WITH (PAGLOCK) 

FROM MSrepl_commands 

WITH (INDEX(ucMSrepl_commands)) 



DELETE TOP(@rowcountCom) MSrepl_commands WITH (PAGLOCK) 

FROM MSrepl_commands 

WITH (INDEX(ucMSrepl_commands)) 



DELETE TOP(@rowcountCom) MSrepl_commands WITH (PAGLOCK) 

FROM MSrepl_commands 

WITH (INDEX(ucMSrepl_commands)) 


go

DELETE TOP(@rowcountCom) MSrepl_commands WITH (PAGLOCK) 

FROM MSrepl_commands 

WITH (INDEX(ucMSrepl_commands)) 


понедельник, 17 апреля 2023 г.

Read acces to SQL JOBS

 use msdb

CREATE USER "Group_or_USer" FOR LOGIN "Group_or_USer"";
ALTER ROLE SQLAgentReaderRole add member "Group_or_USer""

Read access to Stored Procedures

use [Database]


SELECT N'GRANT VIEW DEFINITION ON '

    + QUOTENAME(SPECIFIC_SCHEMA)

    + N'.'

    + QUOTENAME(SPECIFIC_NAME)

    + N' to "Group_or_User";'

FROM INFORMATION_SCHEMA.ROUTINES

WHERE ROUTINE_TYPE = 'PROCEDURE';

пятница, 11 ноября 2022 г.

Fail2Ban 65535 elements in IPSET limit

Edit file /etc/fail2ban/action.d/iptables-ipset-proto4.conf

add/change maxelem parameter:
actionstart = ipset --create f2b-<name> iphash hashsize 32768 maxelem 200000

Save file, than restart Fail2Ban service. To check applied parameter execute
# ipset -L | grep "Header"