Recommended reserve hard disk space is not present on the Hyper-V host - hyper-v

Running the TFS 2010 Best Practices Analyzer gives the following warning:
Recommended reserve hard disk space is not present on the Hyper-V host
The help page suggests to resolve these warnings, follow the instructions in Configuring Lab Management for the First Time.
The only thing I can see on that page is a reference to setting a memory reserve of 1024 - nothing about disk space.
So what is the correct value to set the to?

The limit is hard-coded in Get-HostDetails.ps1 (Located by default in "C:\Program Files (x86)\Microsoft Team Foundation Server 2010 Power Tools\Best Practices Analyzer\scripts\Get-HostDetails.ps1")
This script raises the warning if the reserve disk space is less than 100 GB
# reserve hdd should be 100 GB
if([double]$h.DiskSpaceReserveMB -lt 100*1024)
{
$ax.InSufficientReserveHDD = $true
}

Related

RavenDB Restore Stuck

We are trying to restore Ravendb from the backup file. We are using Raven studio. The restore process copied index files from the backup to the new location but it's stuck at the below step:
Esent Restore: Restore Begin
Esent Restore: 18 1001
I couldn't see any other logs or exceptions.
The backup size is around 123 GB.
How do I fix this stuck process?
After lots of investigation, I found the issue.
Seems the IIS application pool was configured to recycle itself every 20 min. So, after 20 mins, RavenDB was used to kill the restore process.
I found the issue by monitoring the Resouce Monitor -> CPU -> Process Manager tab. You should able to see the Raven process doing loads of write operations during restore and should able to monitor when service gets stopped.

SQL Server : installation fails with error code 0x851A001A – Wait on the Database Engine recovery handle failed

Details:
SQL Server 2017 (Developer or Express edition)
Windows 2011 OS
I have followed this article already but no avail https://blog.sqlauthority.com/2017/01/27/sql-server-sql-installation-fails-error-code-0x851a001a-wait-database-engine-recovery-handle-failed/
Feature: Database Engine Services
Status: Failed
Reason for failure: An error occurred during the setup process of the feature.
Next Step: Use the following information to resolve the error, uninstall this feature, and then run the setup process again.
Component name: SQL Server Database Engine Services Instance Features
Component error code: 0x851A001A
Error description: Wait on the Database Engine recovery handle failed. Check the SQL Server error log for potential causes.
Error help link: https://go.microsoft.com/fwlink?LinkId=20476&ProdName=Microsoft+SQL+Server&EvtSrc=setup.rll&EvtID=50000&ProdVer=14.0.1000.169&EvtType=0xD15B4EB2%400x4BDAF9BA%401306%4026&EvtType=0xD15B4EB2%400x4BDAF9BA%401306%4026
WHAT IS THE CAUSE?
this is caused by the sector size of the disks.
During service startup, SQL Server begins the database recovery process to ensure database consistency. Part of this database recovery process involves consistency checks on the underlying filesystem before attempting the activity of the opening system and user database files.
On systems running Windows 11, some new storage devices and device drivers will expose a disk sector size greater than the supported 4 KB sector size.
When this occurs, SQL Server will be unable to start due to the unsupported file system as SQL Server currently supports sector storage sizes of 512 bytes and 4 KB.
You can confirm that you encounter this specific issue by running the command:
fsutil fsinfo sectorinfo E:
Look for the value PhysicalBytesPerSectorForAtomicity, returned in bytes. A value of 4096 indicates a sector storage size of 4 KB.
HOW TO FIX IT!
Simply follow the instructions on this page.
https://learn.microsoft.com/en-us/troubleshoot/sql/admin/troubleshoot-os-4kb-disk-sector-size#resolutions
if you don't want to change the os, you should try this resolution on the above site.
You can add a registry key which will cause the behavior of Windows 11 and later to be similar to Windows 10. This will force the sector size to be emulated as 4 KB in size. To add the ForcedPhysicalSectorSizeInBytes registry key, use the Registry Editor, or you can run one of the following commands in Windows command prompt or PowerShell, executed as an administrator.
After you change the registry, you must restart the device and then reinstall the program. Otherwise, this method will not work!

How to increase the size of disk in Azure via the portal?

I am unable to resize my disk's size on Azure Portal.
The option is disabled even though my machine is in stopped state.
How can I accomplish this?
You can try with PowerShell. The script you need is:
$vm.StorageProfile.OSDisk.DiskSizeGB = 1023
Update-AzureRmVM -ResourceGroupName $rgName -VM $vm
For better understanding check this link Microsoft docs

Repair Suspected TFS database

i am using this T-SQL to repair my TFS suspected database
EXEC sp_resetstatus [TFS_Projects];
ALTER DATABASE [TFS_Projects] SET EMERGENCY
DBCC checkdb([TFS_Projects])
ALTER DATABASE [TFS_Projects] SET SINGLE_USER WITH ROLLBACK IMMEDIATE
DBCC CheckDB ([TFS_Projects], REPAIR_ALLOW_DATA_LOSS)
ALTER DATABASE [TFS_Projects] SET MULTI_USER
but when i use this T-SQL i will get error
Database 'TFS_Projects' cannot be opened due to inaccessible files or insufficient memory or disk space.
how can i repair my SQL database?
i am using SQL Server 2012
UPDATE 1:
this error will Occurred in line :
DBCC checkdb([TFS_Projects])
UPDATE 2:
i have 20GB free on hard drive that my mdf and ldf on it
UPDATE 3:
i can not chek Autogrow becuase when i right click on db the error will appear
mdf and ldf is not readonly
and i am loged in by windows administartor, and loged in sql server by sa
1) If possible add more hard drive space either by removing of unnecessary files from hard drive or add new hard drive with larger size.
2) Check if the database is set to Autogrow on.
3) Check if the account which is trying to access the database has enough permission to perform operation.
4) Make sure that .mdf and .ldf file are not marked as read only on operating system file system level.
Found here: http://blog.sqlauthority.com/2007/08/02/sql-server-fix-error-945-database-cannot-be-opened-due-to-inaccessible-files-or-insufficient-memory-or-disk-space-see-the-sql-server-error-log-for-details/
i update my answer becuase old answer is dangerous and will damage TFS database!
this answer is from microsoft : http://msdn.microsoft.com/en-us/library/jj620932.aspx
To back up your databases
Launch TFSBackup.exe.
The TFSBackup.exe tool is in the Tools folder where you installed Team Foundation Server. The default location is C:\Program Files\Microsoft Team Foundation Server 12.0\Tools.
In Source SQL Server Instance, enter the name of the SQL Server instance that hosts the TFS databases you want to back up and choose Connect.
In Select databases to backup, choose the databases to back up.
Need help? List of TFS 2010 databases on MSDN; List of TFS 2012 databases on MSDN.
In Backup Databases to, enter the name of a network share that is configured with read/write access for Everyone, or accept the default location in the file system of the SQL Server you connected to in step 2.
Note Note
If you want to overwrite backups stored in this network location, you can choose Overwrite existing database backups at this location.
Choose Backup Now.
The Backup tool reports progress on each database being backed up.
Choose Close.
Restore your data
To restore your TFS data
Launch TFSRestore.exe.
The TFSRestore.exe tool is in the Tools folder where you installed Team Foundation Server. The default location is C:\Program Files\Microsoft Team Foundation Server 12.0\Tools.
In Target SQL Server Instance, enter the SQL Server instance you will use as the data tier and choose Connect.
Choose Add Share and enter the UNC path to the network share that is configured with read/write access to Everyone where you stored the backups of your TFS data. For example, \servername\sharename.
If the backup files are located on the file system of the server that is running TFSRestore.exe, you can use the drop down box to select a local drive.
Note Note
The service account for the instance of SQL Server you identified at the start of this procedure must have read access to this share.
In the left hand navigation pane, choose the network share or local disk you identified in the previous step.
The TFS Restore Tool displays the database backups stored on the file share.
Select the check boxes for the databases you want to restore to the SQL Server you identified at the start of this procedure.
Important note Important
For SharePoint, you must only restore the WSS_Content database. Do not restore the WSS_AdminContent or WSS_Config databases. You want the new SharePoint Foundation versions of these databases, not the ones from the previous version of SharePoint or from a SharePoint installation running on any other server.
Choose Overwrite the existing database(s) and then choose Restore.
The Database Restore Tool restores your data and displays progress reports.
Choose Close.
Probably your database is corrupt either due to an unexpected server restart or filesystem corruption. You can use CheckDB to check for issues & remove the suspect status. However, the best bet is to restore it from a working backup.
Some reasons for when this happens are
Database is corupted
database files are being "opened" or held by some process (operating system, other program(s)...)
Not enough disk space for SQL Server
Insufficient memory (RAM) for SQL Server
Unexpected SQL Server shutdown caused by power failure
How to repair a suspect database

Restore Database from URL (Azure storage) fails without further details

On a Windows Azure VM running Windows 2008 R2 and SQL 2012 Enterprise SP1 CU5, I'm trying to restore a backup stored in Azure as a page blob with the new functionality RESTORE DATABASE FROM URL.
So far I've done it several times with backups up to 60GB in size (uncompressed) and it works like a charm.
However, there is a particular backup 32GB in size that I can't restore. It fails with the following error message:
Msg 3013, Level 16, State 1, Line 2
RESTORE DATABASE is terminating abnormally.
No further information is provided as to why it fails. If I download the same backup from to the local hard drive I can restore it without problem. I tried executing
dbcc traceon(3004,3605,-1)
to get more info and I can see that the DB is restored successfully, then it zeroes in the log file and after that completes is when it fails.
There isn't any error message in the SQL logs, neither in Windows Event log.
There is plenty of free space on that hard drive.
VM and storage are in the same datacenter and I've followed all best practices in building the environment.
EDIT> I noticed the following lines in Event viewer AFTER the database is restored and BEFORE it starts restoring the LOG file (in other words, while the log file is being zeroed)
SQLVDI: Loc=CVDS::Close. Desc=Open devices!. ErrorCode=(0). Process=2900. Thread=1104. Client. Instance=MSSQLSERVER. VD=Global\https://url/stuff/xx.bak_SQLVDIMemoryName_0.
SQLVDI: Loc=SignalAbort. Desc=Client initiates abort. ErrorCode=(0). Process=2900. Thread=1104. Client. Instance=MSSQLSERVER. VD=Global\https://url/stuff/xx.bak_SQLVDIMemoryName_0.
SQLVDI: Loc=TriggerAbort. Desc=invoked. ErrorCode=(0). Process=1508. Thread=2008. Server. Instance=MSSQLSERVER. VD=Global\https://url/stuff/xx.bak_SQLVDIMemoryName_0.
Is it possible that the connection to Azure storage times out before the zeroing finishes and thus the RESTORE fails? If so, how do I change this timeout?
You may wish to try enabling instant file initialization (it solved the problem for me). To do this you need to grant the SQL service account the 'Perform volume maintenance tasks' permission in security policy.
For instructions, see:http://blogs.msdn.com/b/sql_pfe_blog/archive/2009/12/23/how-and-why-to-enable-instant-file-initialization.aspx
With thanks to this 'question' for providing the answer:https://stackoverflow.com/questions/20692592/restoring-large-database-backups-from-azure-blob-storage-to-sql-server-2012-in-a
For anyone having this issue i found a different workaround.
Rather than creating the backup Log file to store on Azure blob storage, i changed that part of the script generated before execution to store it to local disk.
I'm unsure as to why the log file is not successfully being created when SQL attempts to write it to the blob storage.
Here is a segment of the script in questiona fter my amendmants :-
USE [master]
BACKUP LOG [RealTime] TO DISK = N'C:\Program Files\Microsoft SQL Server\MSSQL12.MSSQL14\MSSQL\Backup\YourDb_LogBackup_2015-07-07_09-04-17.bak'
WITH NOFORMAT, NOINIT, NAME = N'YourDb_LogBackup_2015-07-07_09-04-17', NOSKIP, NOREWIND, NOUNLOAD, NORECOVERY , STATS = 5
Leave the rest of the script generated to RESTORE the database as is.