Database files

I have a database that includes 4 files (2 data files and 2 log files)
file name file Type group size path file name

file1 Rows data Primary 107 c:\library1 file1.mdf
file2 Rows data Primary 1 c:\library2 file2.mdf
file1_log Journal Non applicable 1 c:\library1 file1.ldf
file2_log Journal Non applicable 22 c:\library2 file2.ldf

I do not know how two new files were created

I would like to make only two files

I tried to save it and restorer, but I do not arrivves

during the restoration, the system requested 4 files

do you have a solution


[code]use MyDatabase;


dbcc shrinkfile(file2, EmptyFile);
alter database MyDatabase remove file file2;

dbcc shrinkfile(file2_log, EmptyFile);
alter database MyDatabase remove file file2_log;[/code]HTH

thanks, but
there is no risk of data loss, because the file size is not 0

That's why you need to use the EmptyFile option. It moves the data out of one file into another file(s) in the same filegroup. After its empty, you remove the empty file. From your description, it sounded like you wanted to remove two of the four files.


it is superb, thank you