`
java-mans
  • 浏览: 11420472 次
文章分类
社区版块
存档分类
最新评论

sqlserver move database or datafile

 
阅读更多

移动数据或日志文件

1.运行以下语句。
ALTER DATABASE database_name SET OFFLINE;

2.将文件移动到新位置

3.对于已移动的每个文件,请运行以下语句
ALTER DATABASE database_name MODIFY FILE ( NAME = logical_name, FILENAME = 'new_path\os_file_name' );

4.运行以下语句
ALTER DATABASE database_name SET ONLINE;


5.通过运行以下查询来验证文件更改

SELECT name, physical_name AS CurrentLocation, state_desc
FROM sys.master_files
WHERE database_id = DB_ID(N'<database_name>')
go

分享到:
评论

相关推荐

    SQLserver2008系统数据库的迁移.doc

    SQLSERVER2008的系统... 对于empdb,model和msdb 1、修改文件 路径 1、修改文件 路径 --Move tempdb ALTER DATABASE tempdb MODIFY FILE(NAME='tempdev',FILENAME='D:\Database\tempdb.mdf'); ALTER DATABASE tempdb

    Programming.Microsoft.SQL.Server.2012

    Move your database to the cloud with Windows Azure™ SQL Database Develop Windows Phone cloud applications using SQL Data Sync Use SQL Server BI components, including xVelocity in-memory ...

    Database design & Database deployment software BDB 2007 Professional V2.3

    It suppots such database as Oralce,MS SQLServer,MySQL,Access,SQLAnywhere and Sybase. Through the BDB you can quickly build up a database model and do two-way synchronization entities with the ...

    Database design & Database deployment software BDB 2007 Developer V2.3

    It suppots such database as Oralce,MS SQLServer,MySQL,Access,SQLAnywhere and Sybase. Through the BDB you can quickly build up a database model and do two-way synchronization entities with the ...

    SimpleSQL 2.11.0.unitypackage

    Please note that SimpleSQL is a local database solution and cannot connect to server databases - Attach SQLite databases to managers in your scene - No need to move files around for mobile devices! -...

    微软内部资料-SQL性能优化3

    An intent lock indicates that SQL Server wants to acquire a shared (S) lock or exclusive (X) lock on some of the resources lower down in the hierarchy. For example, a shared intent lock placed at the ...

    IBExpert 2009.03.25

    •Copy, move or compare data and even join tables – all from different databases in a single script using IBEBlock. •Speed up and optimize your procedure and trigger programming with the Stored ...

    微软内部资料-SQL性能优化5

    In a nonclustered index, the leaf level contains each index key, plus a bookmark that tells SQL Server where to find the data row corresponding to the key in the index. A bookmark can take one of two ...

    PremiumSoft Navicat Premium Enterprise v11.2.13 (x86 & x64)

    Navicat Premium enables you to easily and quickly transfer data across various database systems, or to a plain text file with designated SQL format and encoding. Also, batch job for different kind of ...

    VB编程资源大全(英文源码 数据库)

    1 , datafile.zip "This sample demonstrates how to do file input and output using Visual Basic. The sample creates a new database file and allows you to view, add, or delete records in this database...

    最全的oracle常用命令大全.txt

    select tablespace_name, file_id, file_name, round(bytes/(1024*1024),0) total_space from dba_data_files order by tablespace_name; 3、查看回滚段名称及大小 select segment_name, tablespace_name, r....

    Expert Oracle Database Architecture 2nd Edition

    If you check the PDF file for the 11.2 SQL reference manual, you’ll find that create table currently starts at page 16-6 and runs on to page 16-79 for a total of 74 pages. The last time I checked ...

    Oracle Essbase 11 Development Cookbook

    Creating a load rule for SQL data load using substitution variables Using MDX in aggregate storage applications Up Chapter 6: Creating Calculation Scripts Introduction Using Essbase Set function ...

    演示如何使用 SqlBulkCopy 类加载数据

    // not use SqlBulkCopy to move data from one table to the other // in the same database. This is for demonstration purposes only. using (SqlConnection destinationConnection = new SqlConnection...

    SQL语法大全

    DATA SOURCE=SQL服务器名称或IP地址;UID=sa;PWD=数据库密码;DATABASE=数据库名称 %&gt; 建立记录集对象: set rs=server.createobject("adodb.recordset") rs.open SQL语句,conn,3,2 3. SQL常用命令使用方法: (1)...

    FastReport.v4.9.81 for.Delphi.BCB.Full.Source企业版含ClientServer中文修正版

    local guidelines (appears when you move or resize an object) ability to work in non-modal mode, mdi child mode Report Preview: thumbnails Print: split a big page to several small pages print ...

    Delphi7.1 Update

    * TClientDataSet doesn‘t save data to file when FileName is set and there is no existing file on disk (Quality Central 2307). * Using the Delphi 7 version of midas.dll to open an XML file that was ...

    CE中文版-启点CE过NP中文.exe

    structure data from PDB files can now be used, and are stored in a database for lookup later dissect structures form can now show a list of known structures (pdb, mono, ...) Added a "revert to saved ...

    asp连接数据库代码实例

    sql="select * from biao where name like '%"&request("keyword")&"%' or id like '%"&request("keyword")&"%' or content like '%"&request("keyword")&"%'" else response.redirect("index.asp") end if set ...

    BobBuilder_app

    Pages in a b+tree are usually implemented as a list or array of child pointers and so while finding and inserting a value is a O(log k) ...process actually has to move children around in the array or list...

Global site tag (gtag.js) - Google Analytics