Cloud hosted DEV VM in DB conversion file size issue.
Issue: The latest PROD database cannot be restored to DEV VM because the MSSQL data drive does not have enough free space for the file.
DB file size: 410 GB (But the actual MSSQL Data drive has a maximum size limit to 375 GB).
Note: Workaround solution temporary options. But long term needs to look for clean-up routine configured.
Workaround Solution 1:
Prerequisites:
Stop all AX & MR & SQL & WWW related services
Open disk management
Steps:
Unallocated space from "TempDB storage (I)" => 100 GB (102400 MB)
Original size is 148 GB.
This would need to be review once usage from dev end. This is DB used for TempDB storage for SQL Server.
Copy files from drive H & I and move it to J folder as backup.
Delete those drive partition (H & I) from disk management
Now it would be having unallocated space as 500+GB
Right Click -> Drive G and extend volume and enter 102400 MB (100 GB) and finish
Create new volume for H Drive and name as "MSSQL Logs" for 445 GB
Create new volume for I Drive and name as "TempDB storage" for 50 GB or whatever available.
Now G drive for MSSQL data will have additional space on it and Whatever files backup earlier on Step 2, get back to respective drive folders.
Run this statement (To have SQL connectivity based on service login) from command prompt
icacls "I:\TEMPDB_STORAGE" /grant "NT SERVICE\MSSQLSERVER:(OI)(CI)F" /T
icacls "H:\MSSQL_LOGS" /grant "NT SERVICE\MSSQLSERVER:(OI)(CI)F" /T
Restart VM and after VM get started, start all AX & MR & WWW & SQL related services.
Check, you should be able to login to SSMS.
Build compile (for POL & AVA model) & DB Sync
Workaround Solution 2:
Create new .ndf file (On any other drive) and attach to that data file on DB (AxDB) as another primary data file.
Permanent solution:
Look for highly transact/consumed tables (OOB/Custom) clean-up activities configured in our system.