The procedures in this topic require the Logic name of the database files. To obtain the name, query the name column in the "sys.master_files" catalog view.
>select * from sys.master_files
To move a data or log file as part of a planned relocation, follow these steps:
1. Run the following statement.
>ALTER DATABASE database_name SET OFFLINE;
2. Move the file or files to the new location.
3. For each file moved, run the following statement.
>ALTER DATABASE database_name MODIFY FILE ( NAME = logical_name, FILENAME = 'new_path\os_file_name' );
4. Run the following statement.
>ALTER DATABASE database_name SET ONLINE;
5. Verify the file change by running the following query.
>SELECT name, physical_name AS CurrentLocation, state_desc FROM sys.master_files
WHERE database_id = DB_ID(N'<database_name>');
沒有留言:
張貼留言