0. 查看数据库文件名和物理文件名 SELECT name, physical_name AS current_file_location FROM sys.master_files 1. 运行命令 USE master; -- Run from master ALTER DATABASE db MODIFY FILE (name='db', filename='C:\NewPath\Database.mdf'); ALTER DATABASE db MODIFY FILE (name='db_
(DB:MyPost) USE masterGO-- Create database via attachCREATE DATABASE [MyPost] ON ( FILENAME = N'C:\var\opt\mssql\data\MyPost.mdf'), ( FILENAME = N'C:\var\opt\mssql\data\MyPost_log.ldf') FOR ATTACH;GO