Modify a datafile, but in the OS it still has the same space. SQL SERVER

0

Hello people, I have the problem that I have modified a datafile:

use master

ALTER DATABASE tempdb MODIFY FILE
(NAME = 'tempdev', SIZE = 10240)

But within the OS in the path the file keeps occupying the previous space, because this happens ??} Greetings

    
asked by Camilo Vega 30.05.2016 в 16:04
source

2 answers

1

a clarification with this topic, since when using:

ALTER DATABASE con MODIFY FILE 

to change the size of a datafile only works if you want to increase the size of the datafile ALTER DATABASE File and Filegroup Options .

If what you want to do is reduce the size of the datafile, what you should do is use the command

DBCC SHRINKFILE 

As long as inside the data file you have free space, here is the reference for use DBCC SHRINKFILE

Anyway, what happened in your case if you checked a decrease in the size of the datafile after restarting the instance, is that since it is the base of the tempdb system, it is recreated on each restart of the instance of SQL server , so maybe the datafile of this database is very large due to some expensive operations of ordering, group by, etc .., you executed the command

ALTER DATABASE tempdb MODIFY FILE
(NAME = 'tempdev', SIZE = 10240) 

to shrink it, nothing happened and when you rebooted this base recreates the original size, but what the shrink was the behavior of the tempdb and not the execution of your command.

I hope you served.

Greetings

    
answered by 01.06.2016 в 00:23
0

Hello people answering myself to make the changes effective I had to restart the instance. If you increase the size of the datafile there is no need to restart the innstance. Greetings

    
answered by 31.05.2016 в 17:48