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

Shrink Log files

 declare @dbn varchar(max), @dbf varchar(max), @cmd varchar(max)

declare  CURS cursor for

SELECT 

    db.name AS [Database Name], 

    mf.name AS [Logical Name] 

FROM 

     sys.master_files AS mf

     INNER JOIN sys.databases AS db ON

            db.database_id = mf.database_id

where mf.type_desc = 'LOG' and db.database_id > 4;


open CURS;

FETCH NEXT FROM curs INTO @dbn, @dbf


WHILE @@FETCH_STATUS = 0

BEGIN

--print @dbn; print @dbf

select @cmd=''

select @cmd = 'use ['+@dbn+']; ALTER DATABASE ['+@dbn+'] MODIFY FILE (NAME = '''+@dbf+''', SIZE = 64, FILEGROWTH = 16MB); DBCC SHRINKFILE('''+@dbf+''',64);';

--print @cmd;

exec (@cmd);

FETCH NEXT FROM curs INTO @dbn, @dbf

end 

close CURS;

deallocate CURS;

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. Все работает. Повторное монтирование образа виртуальной машины проходит успешно