2010. 3. 31. 10:16
[MSSQL 2005] system database 경로변경 방법 Work/SQL Server2010. 3. 31. 10:16
굉장히 간단한 방법으로 시스템 데이터베이스를 이동할 수 있다.
물론 서비스 중에는 안된다.
원본 : http://www.sp-configure.com/how-to-change-path-of-system-databases-on-sql-2005/
물론 서비스 중에는 안된다.
원본 : http://www.sp-configure.com/how-to-change-path-of-system-databases-on-sql-2005/
Master
- Open SQL Server Configuration Manager.
- Right Click on SQL Server Service and select properties.
- On SQL Server Proterties window select Advanced tab.
- Select Startup Parameters
- Edit the startup parameters to reflect the new path for –d and -l parameters.
- Stop SQL Service.
- Move the database files to their new locations.
- Start SQL Service.
Model
- Run the following query:
USE master;
GO
alter database model MODIFY FILE (NAME = modeldev,FILENAME=’NEW PATH’);
go
alter database model MODIFY FILE (NAME = modellog,FILENAME=’NEW PATH’);
go - Stop SQL Service.
- Move the database files to their new locations.
- Start SQL Service.
Msdb
- Run the following query:
USE master;
GO
alter database msdb MODIFY FILE (NAME = MSDBData,FILENAME=’NEW PATH’);
go
alter database msdb MODIFY FILE (NAME = MSDBLog,FILENAME=’NEW PATH’);
go - Stop SQL Service.
- Move the database files to their new locations.
- Start SQL Service.
Tempdb
- Run the following query:
USE master;
GO
alter database tempdb MODIFY FILE (NAME = tempdev,FILENAME=’NEW PATH’);
GO
alter database tempdb MODIFY FILE (NAME = templog,FILENAME=’NEW PATH’);
GO - Stop SQL Service.
- Delete the database files as they will be recreated on new locations.
- Start SQL Service.
mssqlsystemresource
- Stop SQL Service.
- Start the services using NET START MSSQLSERVER /f /T3608 (*MSSQLSERVER is for default instance, if you have installed named instance then you need to use NET START MSSQL$Instancename /f /T3608)
- Run the following query from sqlcmd
USE master;
GO
alter database mssqlsystemresource MODIFY FILE (NAME = data,FILENAME=’NEW PATH\mssqlsystemresource.mdf’);
go
alter database mssqlsystemresource MODIFY FILE (NAME = log,FILENAME=’NEW PATH\mssqlsystemresource.ldf’);
go
alter database mssqlsystemresource set READ_ONLY;
go - Stop SQL Service.
- Move the database files to their new locations.
- Start SQL Service.