Sqlserver修改文件目录,包括系统数据库

 

 

转载: https://blog.csdn.net/zengcong2013/article/details/50354546/

 

修改系统数据库SQL

 
alter database master modify file ( name = master, filename ='C:\Program Files (x86)\Microsoft SQL Server\MSSQL.1\MSSQL\Data1\master.mdf');
alter database master modify file ( name = mastlog, filename ='C:\Program Files (x86)\Microsoft SQL Server\MSSQL.1\MSSQL\Data1\mastlog.ldf');

alter database model modify file ( name = modeldev, filename ='C:\Program Files (x86)\Microsoft SQL Server\MSSQL.1\MSSQL\Data1\model.mdf');
alter database model modify file ( name = modellog, filename ='C:\Program Files (x86)\Microsoft SQL Server\MSSQL.1\MSSQL\Data1\modellog.ldf');
 
alter database msdb modify file ( name = MSDBData, filename ='C:\Program Files (x86)\Microsoft SQL Server\MSSQL.1\MSSQL\Data1\MSDBData.mdf');
alter database msdb modify file ( name = MSDBLog, filename ='C:\Program Files (x86)\Microsoft SQL Server\MSSQL.1\MSSQL\Data1\MSDBLog.ldf');
  
alter database tempdb modify file ( name = tempdev, filename ='C:\Program Files (x86)\Microsoft SQL Server\MSSQL.1\MSSQL\Data1\tempdb.mdf');
alter database tempdb modify file ( name = templog, filename ='C:\Program Files (x86)\Microsoft SQL Server\MSSQL.1\MSSQL\Data1\templog.ldf');
 
 

  

 

注意: 执行完成后,由于系统权限问题,必须将SQL服务改为管理员登录

 

posted @ 2021-12-08 11:51  人生为卒  阅读(318)  评论(0编辑  收藏  举报