查看或更改数据文件和日志文件的默认位置View or Change the Default Locations for Data and Log Files

适用于:Applies to: 是SQL ServerSQL Server(所有支持的版本)yesSQL ServerSQL Server (all supported versions) 适用于:Applies to: 是SQL ServerSQL Server(所有支持的版本)yesSQL ServerSQL Server (all supported versions)

保护数据文件和日志文件的最佳做法是确保它们受访问控制列表 (ACL) 保护。The best practice for protecting your data files and log files is to ensure that they are protected by access control lists (ACLs). 对创建这些文件的根目录设置 ACL。Set the ACLs on the directory root under which the files are created.

查看或更改数据库文件的默认位置View or change the default locations for database files

  1. 在对象资源浏览器中,右键单击你的服务器,然后单击“属性”。In Object Explorer, right-click on your server and click Properties.

  2. 在该“属性”页的左面板中,单击“数据库设置”选项卡。In the left panel on that Properties page, click the Database settings tab.

  3. “数据库默认位置” 中,查看新的数据文件和日志文件的当前默认位置。In Database default locations, view the current default locations for new data files and new log files. 若要更改默认位置,请在 “数据”“日志” 字段中输入新的默认路径名,或者单击浏览按钮找到并选择路径名。To change a default location, enter a new default pathname in the Data or Log field, or click the browse button to find and select a pathname.

注意: 更改默认位置之后,必须停止并重新启动 SQL Server 服务以完成更改。NOTE: After changing the default locations, you must stop and start the SQL Server service to complete the change.

另请参阅See also

CREATE DATABASE (SQL Server Transact-SQL) CREATE DATABASE (SQL Server Transact-SQL)
创建数据库Create a Database