首頁  >  文章  >  資料庫  >  修改sqlserver2008默认的数据库文件保存路径

修改sqlserver2008默认的数据库文件保存路径

WBOY
WBOY原創
2016-06-07 15:54:011680瀏覽

在配置工具中,右键服务器,然后选择属性。 然后数据库设置,再配置数据库默认位置 方法二,直接使用sql语句修改 USE [ master ] GO EXEC xp_instance_regwrite N HKEY_LOCAL_MACHINE , N Software\Microsoft\MSSQLServer\MSSQLServer , N DefaultData , REG

在配置工具中,右键服务器,然后选择属性。

然后数据库设置,再配置数据库默认位置

 

方法二,直接使用sql语句修改

<code style="margin: 0px; padding: 0px;"><span class="kwd" style="margin: 0px; padding: 0px;">USE<span class="pln" style="margin: 0px; padding: 0px;"> <span class="pun" style="margin: 0px; padding: 0px;">[<span class="pln" style="margin: 0px; padding: 0px;">master<span class="pun" style="margin: 0px; padding: 0px;">]<span class="pln" style="margin: 0px; padding: 0px;">
GO
<span class="kwd" style="margin: 0px; padding: 0px;">EXEC<span class="pln" style="margin: 0px; padding: 0px;"> xp_instance_regwrite N<span class="str" style="margin: 0px; padding: 0px;">&#39;HKEY_LOCAL_MACHINE&#39;<span class="pun" style="margin: 0px; padding: 0px;">,<span class="pln" style="margin: 0px; padding: 0px;"> N<span class="str" style="margin: 0px; padding: 0px;">&#39;Software\Microsoft\MSSQLServer\MSSQLServer&#39;<span class="pun" style="margin: 0px; padding: 0px;">,<span class="pln" style="margin: 0px; padding: 0px;"> N<span class="str" style="margin: 0px; padding: 0px;">&#39;DefaultData&#39;<span class="pun" style="margin: 0px; padding: 0px;">,<span class="pln" style="margin: 0px; padding: 0px;"> REG_SZ<span class="pun" style="margin: 0px; padding: 0px;">,<span class="pln" style="margin: 0px; padding: 0px;"> N<span class="str" style="margin: 0px; padding: 0px;">&#39;E:\YourData&#39;<span class="pln" style="margin: 0px; padding: 0px;">
GO
<span class="kwd" style="margin: 0px; padding: 0px;">EXEC<span class="pln" style="margin: 0px; padding: 0px;"> xp_instance_regwrite N<span class="str" style="margin: 0px; padding: 0px;">&#39;HKEY_LOCAL_MACHINE&#39;<span class="pun" style="margin: 0px; padding: 0px;">,<span class="pln" style="margin: 0px; padding: 0px;"> N<span class="str" style="margin: 0px; padding: 0px;">&#39;Software\Microsoft\MSSQLServer\MSSQLServer&#39;<span class="pun" style="margin: 0px; padding: 0px;">,<span class="pln" style="margin: 0px; padding: 0px;"> N<span class="str" style="margin: 0px; padding: 0px;">&#39;DefaultLog&#39;<span class="pun" style="margin: 0px; padding: 0px;">,<span class="pln" style="margin: 0px; padding: 0px;"> REG_SZ<span class="pun" style="margin: 0px; padding: 0px;">,<span class="pln" style="margin: 0px; padding: 0px;"> N<span class="str" style="margin: 0px; padding: 0px;">&#39;E:\YourLogs&#39;<span class="pln" style="margin: 0px; padding: 0px;">
GO </span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></code>
陳述:
本文內容由網友自願投稿,版權歸原作者所有。本站不承擔相應的法律責任。如發現涉嫌抄襲或侵權的內容,請聯絡admin@php.cn