• 欢迎访问搞代码网站,推荐使用最新版火狐浏览器和Chrome浏览器访问本网站!
  • 如果您觉得本站非常有看点,那么赶紧使用Ctrl+D 收藏搞代码吧

SQL Server 2005/2008 用户数据库文件默_sqlserver

sqlserver 搞代码 3年前 (2018-06-17) 150次浏览 已收录 0个评论

以下仅为参照,如果有多个实例,可能会有些许不同:
本环境是SQL Server 2005 Standard Version 64-bit 和 SQL Server 2008 Standard Version 64-bit 双实例同时安装在一个
Windows Server 2008 Standard Version 64-bit OS上:

代码

复制代码 代码如下:

http://www.gaodaima.com/?p=37469SQL Server 2005/2008 用户数据库文件默_sqlserver

Windows Server 2008 Standard Version 64-bit
SQL Server 2005 Standard Version 64-bit

查询用户库Data文件默认路径:
DECLARE @DefaultData VARCHAR(100)
EXEC master..xp_regread @rootkey=’HKEY_LOCAL_MACHINE’,
@key=’Software/Microsoft/Microsoft SQL Server/MSSQL.1/MSSQLServer’,
@value_name=’DefaultData’,
@[email protected] OUTPUT
SELECT @DefaultData

查询用户库Log文件默认路径:
DECLARE @DefaultLog VARCHAR(100)
EXEC master..xp_regread @rootkey=’HKEY_LOCAL_MACHINE’,
@key=’Software/Microsoft/Microsoft SQL Server/MSSQL.1/MSSQLServer’,
@value_name=’DefaultLog’,
@[email protected] OUTPUT
SELECT @DefaultLog

查询用户库备份文件默认路径:
DECLARE @BackupDirectory VARCHAR(100)
EXEC master..xp_regread @rootkey=’HKEY_LOCAL_MACHINE’,
@key=’Software/Microsoft/Microsoft SQL Server/MSSQL.1/MSSQLServer’,
@value_name=’BackupDirectory’,
@[email protected] OUTPUT
SELECT @BackupDirectory

修改用户库Data文件默认路径:
EXEC master..xp_regwrite
@rootkey=’HKEY_LOCAL_MACHINE’,
@key=’Software/Microsoft/Microsoft SQL Server/MSSQL.1/MSSQLServer’,
@value_name=’DefaultData’,
@type=’REG_SZ’,
@value=’D:/SQL2005/Data’

修改用户库Log文件默认路径:
EXEC master..xp_regwrite
@rootkey=’HKEY_LOCAL_MACHINE’,
@key=’Software/Microsoft/Microsoft SQL Server/MSSQL.1/MSSQLServer’,
@value_name=’DefaultLog’,
@type=’REG_SZ’,
@value=’D:/SQL2005/Log’

修改用户库备份文件默认路径:
EXEC master..xp_regwrite
@rootkey=’HKEY_LOCAL_MACHINE’,
@key=’Software/Microsoft/Microsoft SQL Server/MSSQL.1/MSSQLServer’,
@value_name=’BackupDirectory’,
@type=’REG_SZ’,
@value=’D:/SQL2005/DBBak’

复制代码 代码如下:
Windows Server 2008 Standard Version 64-bit
SQL Server 2008 Standard Version 64-bit

查询用户库Data文件默认路径:
DECLARE @DefaultData VARCHAR(100)
EXEC master..xp_regread @rootkey=’HKEY_LOCAL_MACHINE’,
@key=’Software/Microsoft/Microsoft SQL Server/MSSQL10.SQL2008/MSSQLServer’,
@value_name=’DefaultData’,
@[email protected] OUTPUT
SELECT @DefaultData

查询用户库Log文件默认路径:
DECLARE @DefaultLog VARCHAR(100)
EXEC master..xp_regread @rootkey=’HKEY_LOCAL_MACHINE’,
@key=’Software/Microsoft/Microsoft SQL Server/MSSQL10.SQL2008/MSSQLServer’,
@value_name=’DefaultLog’,
@[email protected] OUTPUT
SELECT @DefaultLog

查询用户库备份文件默认路径:
DECLARE @BackupDirectory VARCHAR(100)
EXEC master..xp_regread @rootkey=’HKEY_LOCAL_MACHINE’,
@key=’Software/Microsoft/Microsoft SQL Server/MSSQL10.SQL2008/MSSQLServer’,
@value_name=’BackupDirectory’,
@[email protected] OUTPUT
SELECT @BackupDirectory

修改用户库Data文件默认路径:
EXEC master..xp_regwrite
@rootkey=’HKEY_LOCAL_MACHINE’,
@key=’Software/Microsoft/Microsoft SQL Server/MSSQL10.SQL2008/MSSQLServer’,
@value_name=’DefaultData’,
@type=’REG_SZ’,
@value=’D:/SQL2008/Data’

修改用户库Log文件默认路径:
EXEC master..xp_regwrite
@rootkey=’HKEY_LOCAL_MACHINE’,
@key=’Software/Microsoft/Microsoft SQL Server/MSSQL10.SQL2008/MSSQLServer’,
@value_name=’DefaultLog’,
@type=’REG_SZ’,
@value=’D:/SQL2008/Log’

修改用户库备份文件默认路径:
EXEC master..xp_regwrite
@rootkey=’HKEY_LOCAL_MACHINE’,
@key=’Software/Microsoft/Microsoft SQL Server/MSSQL10.SQL2008/MSSQLServer’,
@value_name=’BackupDirectory’,
@type=’REG_SZ’,
@value=’D:/SQL2008/DBBak’

欢迎大家阅读《SQL Server 2005/2008 用户数据库文件默_sqlserver,跪求各位点评,若觉得好的话请收藏本文,by 搞代码


喜欢 (0)
[搞代码]
分享 (0)
发表我的评论
取消评论

表情 贴图 加粗 删除线 居中 斜体 签到

Hi,您需要填写昵称和邮箱!

  • 昵称 (必填)
  • 邮箱 (必填)
  • 网址