Generate DBCC SHRINKFILE shrink file command in small size as time
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#Generate shrink script using Powershell | |
clear | |
$strDB = 'MyDB' | |
$strFile = 'MyDBdata' | |
$iIntveral = 1000 | |
$iTotal = 10000 | |
$iMinMB = 1001 | |
for ($iTotal ; $iTotal -gt $iMinMB; $iTotal=$iTotal-$iIntveral) | |
{ | |
Write-Host ' USE ['$strDB']' `n ` | |
'GO' `n ` | |
'DBCC SHRINKFILE (N'''$strFile''' ,'$iTotal')' `n ` | |
'GO' | |
} | |
# Done |
No comments:
Post a Comment