How mssql mdf file only when the reduction

1, first create a new database of the same name, and then stop the sql services, delete the new database .ldf files.
2, the file you want to attach the .mdf database covering just the new .mdf file, and restart the service.
At this time only a .mdf database file DATA directory, start Server Management Studio SQL
3, the new query, execute the following SQL
use Database db_name masterGoalter the SET emergencygo
4, rebuild the database log file
alter database db_name Rebuild Log on (name = log_name, filename = 'C: \ log_name.ldf')
. 5, set a database to multi-user mode. alter database dbname set multi_user

Guess you like

Origin www.cnblogs.com/jiamiemie/p/11821907.html