Skip to main content

Tips: How to move databases using the ALTER DATABASE

By using the ALTER DATABASE statement, you can move any system or user-defined database files except for Resource database files. In order to move the files, it is required to specify the current logical name of the file and the new file path. Moreover, that should include the new file name. Make sure that you can move only the file at a time in this manner.
You can follow the following steps to move data or log files to a new location.
1. Get the logical name of the data and log files associated with the database by typing the following:
USE master
SELECT name, physical_name
FROM sys.master_files
WHERE database_id = DB_ID("Personnel");


2. Take the database you want to work with offline by typing these commands:
ALTER DATABASE Personnel
SET offline
GO

3. Move one file at a time to the new location by typing the following:
ALTER DATABASE Personnel
MODIFY FILE ( NAME = Personnel_Data, FILENAME =
"C:\Data\Personnel_Data.mdf")
GO

4. Repeat the previous step to move other data and log files.

5. Put the database online by typing the following commands:
ALTER DATABASE Personnel
SET online
GO

You can verify the change or changes by typing this:
USE master
SELECT name, physical_name
FROM sys.master_files
WHERE database_id = DB_ID("Personnel");

You can also move full-text catalogs by their logical name. But note that when you specify the new catalog location, you specify only new_path rather than new_path/file_name.To move a full-text catalog file to a new location, follow these steps:

1. Take the database you want to work with offline by typing the following:
ALTER DATABASE database_name
SET offline
GO

2. Move one file at a time to the new location by typing these commands:
ALTER DATABASE database_name
MODIFY FILE ( NAME = logical_name, FILENAME = "new_path".
GO

3. Repeat the previous step to move other full-text catalog files as necessary.

4. Put the database online by typing the following:
ALTER DATABASE database_name
SET online
GO

B   y

Popular posts from this blog

New Micro battery, power packed for high performance

For a size of a few millimetres, the new micro-batteries are powerful enough to jump start a car battery and then quickly charge the cell phone. Researchers from the University of Illinois have developed the micro batteries which can be used to drive compact electronic devices and new applications for radio communications. The micro batteries are so good that they can even out power the super capacitors. The results were published in ‘Nature Communications’ in the April 16 issue. The micro batteries have energy and power and with the researchers tweaking the structure of the micro batteries a little bit, its use can be for wide range applications.

The high performance of the micro battery is based on its 3-dimensional micro-structure. Based on the design of fast charging cathode by Professor Paul Braun’s group, researchers developed the matching anode and integrated it with the fast charging cathode at a micro-scale and made a complete battery with high performance. These batteries cou…

Google Health Login Page is Ready!

Google's Marissa Mayer announced that the Google Health will be launched on 2008. The service of the
Google Health Login Page is ready. It's only the first intro page is displayed and I didn't get passed to the next page. In the same page y0u can see the information displaying on the Google Health. If you point your mouse on the below link you can visit the Google Health Page
https://www.google.com/accounts/ServiceLogin?service=health

With Google Health, you can:
* Build online health profiles that belong to you
* Download medical records from doctors and pharmacies
* Get personalized health guidance and relevant news
* Find qualified doctors and connect to time-saving services
* Share selected information with family or caregivers

This will be a nice development about caring health and this will helps in having some cautious about health.
Inspired

HTC Touch Diamond SmartPhone!

The phones design is an innovative in which the user has the geometric form language to make sure a clutter-free environment for screening content. The San Francisco based studio One & Co collaborated with HTC Taiwan Design team to create Diamond HTC smartphone.







The HTC phone is quite wonderful with design and the rapid development in the smartphone market the HTC has taken innovative steps to capture the SmartPhone market HTC develops these kind of new inventive designs.
Inspired