Problem

One task that you may need to do as a DBA is to move the system databases from one location to another.  The documentation that is found on the Microsoft site is helpful, but the steps are more geared toward moving one database at a time.  In this tip we look at a streamlined process of moving all system databases at the same time.

Solution

There are few Microsoft KB articles that show you step by step on how to move the SQL Server system databases from one location to another location.  The steps for moving SQL Server 2000 system databases is much more convoluted than moving SQL Server 2005, 2008 or 2008R2 databases.

The following KB articles show you step by step how to move the system databases, but the process does not need to be as long as the details show.


Moving all SQL Server 2005, SQL Server 2008 or SQL Server 2008R2 System Databases

Once you have reviewed the KB articles above, you can follow these steps to move all system databases at once.

  1. Update the -d and -l startup parameters for SQL Server for the new location of the master data and log file
  2. Issue ALTER DATABASE commands to change the file location for the model, msdb and tempdb database files
  3. Stop SQL Server
  4. Move the MDF and LDF files to the new locations specified in steps 1 and 2 for the master, model and msdb databases
  5. Start SQL Server
  6. Delete the old tempdb files

In addition to the master, model, msdb and tempdb databases SQL Server 2005 introduces the mssqlsystemresourcedatabase.  Microsoft recommends not moving this database, but if you do want to move this database as well you will follow these steps.  Note you cannot move the mssqlsystemresource database for SQL Server 2008 or SQL Server 2008R2.

  1. Update the -d and -l registry startup parameters for SQL Server for the new location of the master data and log file
  2. Issue ALTER DATABASE commands to change the file location for the model, msdb and tempdb database files
  3. Stop SQL Server
  4. Move the MDF and LDF files to the new locations specified in steps 1 and 2 for the master, model and msdb databases
  5. Put SQL Server in minimal configuration mode by adding these two startup parameters -f and -T3608 and then start SQL Server
  6. Issue ALTER DATABASE commands for the mssqlsystemresource MDF and LDF files using same path as the master database
  7. Move the MDF and LDF files to the location specified in step 6 for the mssqlsystemresource database
  8. Stop SQL Server
  9. Remove the startup options added in step 5
  10. Start SQL Server
  11. Delete the old tempdb files

Moving all SQL Server 2000 System Databases

Once you have reviewed the KB articles above, you can follow these steps to move all system databases at once.

  1. Update the -d and -l startup parameters for SQL Server for the new location of the master data and log file
  2. Issue ALTER DATABASE commands to change the file location for the tempdb database files
  3. Stop SQL Server
  4. Move the MDF and LDF files to the new location specified in steps 1 for the master database
  5. Put SQL Server in single user mode by adding these three startup parameters -c, -m and -T3608 and then start SQL Server
  6. Detach the msdb and model databases
  7. Move the MDF and LDF files to the new location for the model and msdb databases
  8. Attach the model database from its new location
  9. Stop SQL Server
  10. Remove the startup options added in step 5
  11. Start SQL Server
  12. Attach the msdb database
  13. Delete the old tempdb files

Although it still seems like a lot of steps this will cut down on the need to stop and start SQL Server as much if you move one database at a time.  As you can see moving all of the databases for SQL Server 2005, 2008 and 2008R2 is much easier than moving the databases for SQL Server 2000 especially if you do not move the mssqlsystemresource database.

Next Steps

转:Move all SQL Server system databases at one time的更多相关文章

  1. The Windows account sa does not exist and cannot be provisioned as a SQL Server system administrator

    今天遇到一个案例,在使用命令修改一个测试服务器(SQL Server 2014标准版)的服务器排序规则时,遇到了下面错误信息 (具体账号信息脱敏处理,随机生成一个账号密码) The Windows a ...

  2. Exam 70-462 Administering Microsoft SQL Server 2012 Databases 复习帖

    好吧最近堕落没怎么看书,估计这个月前是考不过了,还是拖到国庆之后考试吧.想着自己复习考试顺便也写点自己的复习的概要,这样一方面的给不准备背题库的童鞋有简便的复习方法(好吧不被题库的同学和我一样看MSD ...

  3. SQL Server System.Data.SqlClient.SqlException:已成功于服务器建立连接,但是在 登录前的握手期间发生错误

    一.错误描述 错误名称如上.整体错误如下: System.Data.EntityException 基础提供程序在Open上失败--> System.Data.SqlClient.SqlExce ...

  4. System Databases in SQL Server

    https://docs.microsoft.com/en-us/sql/relational-databases/databases/system-databases SQL Server incl ...

  5. P6 Professional Installation and Configuration Guide (Microsoft SQL Server Database) 16 R1

    P6 Professional Installation and Configuration Guide (Microsoft SQL Server Database) 16 R1       May ...

  6. SQL Server 2012 无人值守安装(加入新实例)

    方法1,通过指定条个參数安装 setup.exe /Q /IACCEPTSQLSERVERLICENSETERMS /ACTION=install /PID=<validpid> /FEA ...

  7. Migrating Oracle on UNIX to SQL Server on Windows

    Appendices Published: April 27, 2005 On This Page Appendix A: SQL Server for Oracle Professionals Ap ...

  8. Microsoft SQL Server Version List [sqlserver 7.0-------sql server 2016]

    http://sqlserverbuilds.blogspot.jp/   What version of SQL Server do I have? This unofficial build ch ...

  9. Microsoft SQL Server Version List(SQL Server 版本)

    原帖地址 What version of SQL Server do I have? This unofficial build chart lists all of the known Servic ...

随机推荐

  1. Labview实现脉波调制( PAM )

    Labview实现脉波调制( PAM ) 根据定义为脉冲振幅调制 生成一个正弦信号,得到其幅值输入给一个方波信号的幅值 这个等价于一个方波信号和一个正弦信号相乘 得到的PAM信号通过观察其频率可以发现 ...

  2. C++中常见的几种异常类型

    1.C++具有完善的异常捕获机制,采用try{}  catch(){}机制,这是C语言无法比拟的 2.常见的几种异常: bad_alloc:       请求分配内存失败, operator new ...

  3. 2014103《JAVA程序设计》第一周学习总结

    本周,在刻苦看了三天课本之后,终于对JAVA这门课程有了一定的认识.了解了JAVA的前世今生,JAVA的三大平台:Java SE.Java EE与Java ME.其中Java SE又可分为四个主要的部 ...

  4. UITableView基本使用和cell的属性

    在ios的UI中UITableView是个常用且强大的控件 基本使用: 1>设置代理,一般把控制器设为代理:self.tableView.delegate = self; 2>遵守代理的协 ...

  5. 阿里云:linux 一键安装web环境

    参考地址:http://www.cnblogs.com/ada-zheng/p/3724957.html

  6. 通过手机Web实现手机摇一摇的功能

    经常我们玩微信都会用到查到附近的人,都是在app上实现手机摇一摇的功能.现在,我们将此技术搬移到手机web上,供大家学习,主要是用到HTML5的重要特性就是DeviceOrientation:官方文档 ...

  7. 802.11 wireless 六

    802.11 wireless 6Bluetooth蓝牙1.无线个人网络(WPAN)的无线电系统2.普通链路范围 10米/0dBm(100米/20dBm)3.传输频率在2.402 GHZ和2.480 ...

  8. WebServices中Xml的序列化

    一.定义序列化实体类 [System.Xml.Serialization.XmlRoot("Custome_Xml_Root_Name")] //自定义生成的Xml根目录名称 pu ...

  9. poj 1269 Intersecting Lines

    题目链接:http://poj.org/problem?id=1269 题目大意:给出四个点的坐标x1,y1,x2,y2,x3,y3,x4,y4,前两个形成一条直线,后两个坐标形成一条直线.然后问你是 ...

  10. NYOJ-73 比大小 AC 分类: NYOJ 2014-01-17 21:29 195人阅读 评论(0) 收藏

    典型的大数题目,这只是大数的比较,到时还有大数加减乘除,更加还有乘方,对于大数,一般用数组或者字符串,因为其他的结构类型一般都没有那么大 的范围!! 这道题目需要你仔细回想怎么比较俩个数字的大小,考虑 ...