Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2000 Forums
 SQL Server Administration (2000)
 Data files management

Author  Topic 

AskSQLTeam
Ask SQLTeam Question

0 Posts

Posted - 2005-05-30 : 08:50:33
Gianni writes "Hi all.
I have a database with a single datafile (mdf) of 15Gb.
I need to split the datafile in 2 data files (a new db would be ok).
How can I do ?
thanks in advance,
Gianni"

jen
Master Smack Fu Yak Hacker

4110 Posts

Posted - 2005-05-30 : 23:02:44
quote:
Originally posted by AskSQLTeam

Gianni writes "Hi all.
I have a database with a single datafile (mdf) of 15Gb.
I need to split the datafile in 2 data files (a new db would be ok).
How can I do ?
thanks in advance,
Gianni"



you cannot split it into 2 datafiles (2 mdf's), you can however

From BOL
quote:

B. Create a database specifying multiple data and transaction log files
This example creates a database called Archive with three 100-MB data files and two 100-MB transaction log files. The primary file is the first file in the list and is explicitly specified with the PRIMARY keyword. The transaction log files are specified following the LOG ON keywords. Note the extensions used for the files in the FILENAME option: .mdf is used for primary data files, .ndf is used for the secondary data files, and .ldf is used for transaction log files.

USE master
GO
CREATE DATABASE Archive
ON
PRIMARY ( NAME = Arch1,
FILENAME = 'c:\program files\microsoft sql server\mssql\data\archdat1.mdf',
SIZE = 100MB,
MAXSIZE = 200,
FILEGROWTH = 20),
( NAME = Arch2,
FILENAME = 'c:\program files\microsoft sql server\mssql\data\archdat2.ndf',
SIZE = 100MB,
MAXSIZE = 200,
FILEGROWTH = 20),
( NAME = Arch3,
FILENAME = 'c:\program files\microsoft sql server\mssql\data\archdat3.ndf',
SIZE = 100MB,
MAXSIZE = 200,
FILEGROWTH = 20)
LOG ON
( NAME = Archlog1,
FILENAME = 'c:\program files\microsoft sql server\mssql\data\archlog1.ldf',
SIZE = 100MB,
MAXSIZE = 200,
FILEGROWTH = 20),
( NAME = Archlog2,
FILENAME = 'c:\program files\microsoft sql server\mssql\data\archlog2.ldf',
SIZE = 100MB,
MAXSIZE = 200,
FILEGROWTH = 20)
GO





--------------------
keeping it simple...
Go to Top of Page

eyechart
Master Smack Fu Yak Hacker

3575 Posts

Posted - 2005-05-31 : 02:38:57
As jen said, you can't split the file - but you can add a new on. If you are running out of space, just add a new datafile to the database located on another drive.


-ec
Go to Top of Page
   

- Advertisement -