ITPub博客

首页 > 数据库 > 数据库开发技术 > Moving the tempdb database(SQL server)

Moving the tempdb database(SQL server)

原创 数据库开发技术 作者:lkptantan 时间:2008-04-08 15:20:15 0 删除 编辑

Moving the tempdb database

You can move tempdb files by using the ALTER DATABASE statement.
1.Determine the logical file names for the tempdb database by using sp_helpfile as follows:
use tempdb
go
sp_helpfile
go
The logical name for each file is contained in the name column. This example uses the default file names of tempdev and templog.
2.Use the ALTER DATABASE statement, specifying the logical file name as follows:
use master
go
Alter database tempdb modify file (name = tempdev, filename = 'E:Sqldatatempdb.mdf')
go
Alter database tempdb modify file (name = templog, filename = 'E:Sqldatatemplog.ldf')
go
You should receive the following messages that confirm the change:
Message 1
File 'tempdev' modified in sysaltfiles. Delete old file after restarting SQL Server.
Message 2
File 'templog' modified in sysaltfiles. Delete old file after restarting SQL Server.
3.Using sp_helpfile in tempdb will not confirm these changes until you restart SQL Server.
4.Stop and then restart SQL Server.
[@more@]

Moving the tempdb database

You can move tempdb files by using the ALTER DATABASE statement.
1.Determine the logical file names for the tempdb database by using sp_helpfile as follows:
use tempdb
go
sp_helpfile
go
The logical name for each file is contained in the name column. This example uses the default file names of tempdev and templog.
2.Use the ALTER DATABASE statement, specifying the logical file name as follows:
use master
go
Alter database tempdb modify file (name = tempdev, filename = 'E:Sqldatatempdb.mdf')
go
Alter database tempdb modify file (name = templog, filename = 'E:Sqldatatemplog.ldf')
go
You should receive the following messages that confirm the change:
Message 1
File 'tempdev' modified in sysaltfiles. Delete old file after restarting SQL Server.
Message 2
File 'templog' modified in sysaltfiles. Delete old file after restarting SQL Server.
3.Using sp_helpfile in tempdb will not confirm these changes until you restart SQL Server.
4.Stop and then restart SQL Server.

来自 “ ITPUB博客 ” ,链接:https://blog.itpub.net/167898/viewspace-1002068/ ,如需转载,请注明出处,否则将追究法律责任。

请登录后发表评论 登录
全部评论
  • 博文量
    122
  • 访问量
    619593