MSSQL How to modify the default database storage path

Source: Internet
Author: User
Tags mssql mssqlserver

Before we modify the database storage path, we have to do an analysis of the database, we need to know his storage mode! Database The default path is saved in the registration table, we can modify the registry through Xp_instance_regwrite, the following is the way I tried on the 3A network server, you can look at:

First, change the data file default storage path:
EXEC Xp_instance_regwrite
@rootkey = ' HKEY_LOCAL_MACHINE ',
@key = ' Software\microsoft\mssqlserver\mssqlserver ',
@value_name = ' Defaultdata ',
@type =REG_SZ,
@value = ' D:\MSSQL\Data '

Second, change the log file default storage path:
EXEC Master. Xp_instance_regwrite
@rootkey = ' HKEY_LOCAL_MACHINE ',
@key = ' Software\microsoft\mssqlserver\mssqlserver ',
@value_name = ' Defaultlog ',
@type =REG_SZ,
@value = ' D:\MSSQL\Data '

MSSQL How to modify the default database storage path

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.