Migrating Database File Locations

Source: Internet
Author: User


--1, modify file logical location--1) query file logical name, SELECT name Logical_name, physical_name as Currentlocation, State_descfrom Sys.master_ Fileswhere database_id = db_id (' Test ')--2) modify ALTER DATABASE test MODIFY FILE (NAME = test, FILENAME = ' M:\Program files\sq L server2008r2\test.mdf ') ALTER DATABASE Test MODIFY FILE (NAME = test_log, FILENAME = ' M:\Program files\sql server2008r2 \test_log.ldf ')
--2, offline or stop database alter test SET OFFLINE

–3, physically move the database files to the new location. –4, online or start the database ALTER test SET online–5, view effects SELECT name Logical_name, physical_name as Currentlocation, State_desc From sys.master_files WHERE database_id = db_id (' Test ') – Reference: http://msdn.microsoft.com/zh-cn/library/ms345483 (v= sql.90). aspx

Migrating Database File Locations

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.