Moving master database
Moving master database is a bit different process than moving any other system database.This has to be carried out very carefully and here is the process on how to move the master database.
Before doing anything, make sure you are having proper backups.
1.
Stop the SQL Services.
2.
Go to the "SQL Server Configuration Manager".
In SQL Server 2005, Click "Start" >> "All Programs" >> "Microsoft SQL Server 2005" >> "Configuration Tools" >> SQL Server Configuration Manager
In SQL Server 2008, Click "Start" >> "All Programs" >> "Microsoft SQL Server 2008" >> "Configuration Tools" >> SQL Server Configuration Manager
In SQL Server 2005, Click "Start" >> "All Programs" >> "Microsoft SQL Server 2005" >> "Configuration Tools" >> SQL Server Configuration Manager
In SQL Server 2008, Click "Start" >> "All Programs" >> "Microsoft SQL Server 2008" >> "Configuration Tools" >> SQL Server Configuration Manager
3.
In the left pane, click on "SQL Server Services"
4.
Now in the right pane, select the SQL Server
Service component (which looks like "SQL Server
(InstanceName)" ) and go to its properties.
5.
In the "Properties" page, go to the
"Advanced" tab
6.
In the "Startup Parameters", click on the drop list
and modify the parameters -d and -l to the new location where you want the
master data file (master.mdf) and log file (mastlog.ldf) to reside
respectively.
-d stands for the fully qualified data file path of master database.
-l stands for the fully qualified log file path of master database.
-e stands for the fully qualified path of the error log file.
-d stands for the fully qualified data file path of master database.
-l stands for the fully qualified log file path of master database.
-e stands for the fully qualified path of the error log file.
7.
Now move the files manually to the new location.
8.
Start the SQL Services.
Moving model and msdb databases
Moving of model and msdb databases also follow the similar procedure as moving the tempdb database but with some additional steps.
Since these are also system databases, unfortunately we cannot move them just by detach and attach process, as we cannot attach or detach a system database.
Moving model database:
Moving msdb database:
Since these are also system databases, unfortunately we cannot move them just by detach and attach process, as we cannot attach or detach a system database.
Moving model database:
- First get the list of model database files by using this queryselect name,physical_name from sys.master_files whereDB_NAME(database_id)='model'
- Then for each model database file that you need to move, execute statements like below
Alter Database model modifyfile (NAME = 'modeldev' ,FILENAME = 'Drive:\Path\model.mdf') -- Mention the new locationAlter Database model modifyfile (NAME = 'modellog' ,FILENAME = 'Drive:\Path\modellog.ldf') -- Mention the new location - Stop SQL Services
- Move the files manually to the new location
- Start SQL Services
- Verify the new Location
select name,physical_name from sys.master_files whereDB_NAME(database_id)='model'
Moving msdb database:
- First get the list of msdb files by using this queryselect name,physical_name from sys.master_files whereDB_NAME(database_id)='msdb'
- Then for each msdb database file that you need to move, execute statements like below
Alter Database msdb modifyfile (NAME = 'MSDBData' ,FILENAME = 'Drive:\Path\MSDBData.mdf') -- Mention the new locationAlter Database msdb modifyfile (NAME = 'MSDBLog' ,FILENAME = 'Drive:\Path\MSDBLog.ldf') -- Mention the new location - Stop SQL Services
- Move the files manually to the new location
- Start SQL Services
- Verify the new Locationselect name,physical_name from sys.master_files whereDB_NAME(database_id)='msdb'
No comments:
Post a Comment