Below script will help to get the Database mdf & ldf files size, used space, Free space in MB.
If we have free space in the file then will shrink to reclaim the space.
I used the same script in one of my environment to get details for used and free space in the file.
If huge free space in master datafile then shrink the file and run rebuild index.
Note: It should be done in non business hours only.
- Open SSMS
- Connect SQL server
- Run the below query