Friday, March 30, 2012

MDF and LDF file locations

Is it possible to relocate the data and/or the log files after they have bee
n
assigned a location? Thanks everyone for your help."coenzyme" <coenzyme@.discussions.microsoft.com> wrote in message
news:6827AE2A-BCDD-49BC-B98E-4B14F414D465@.microsoft.com...
> Is it possible to relocate the data and/or the log files after they have
been
> assigned a location? Thanks everyone for your help.
There are several ways of doing this.
One method is to do a backup and restore.
Look at the MOVE TO option in RESTORE in the BOL.
Rick Sawtell
MCT, MCSD, MCDBA|||yes,
1. detach and attach
2. backup and restore
Aleksandar Grbic
MCDBA, Senior Database Administrator
"coenzyme" wrote:

> Is it possible to relocate the data and/or the log files after they have b
een
> assigned a location? Thanks everyone for your help.|||You could run sp_detach_db, move the files to the new location, and then
run sp_attach_db. Another method is to backup and then restore.
"coenzyme" <coenzyme@.discussions.microsoft.com> wrote in message
news:6827AE2A-BCDD-49BC-B98E-4B14F414D465@.microsoft.com...
> Is it possible to relocate the data and/or the log files after they have
been
> assigned a location? Thanks everyone for your help.

MDF and LDF file locations

Is it possible to relocate the data and/or the log files after they have been
assigned a location? Thanks everyone for your help.
"coenzyme" <coenzyme@.discussions.microsoft.com> wrote in message
news:6827AE2A-BCDD-49BC-B98E-4B14F414D465@.microsoft.com...
> Is it possible to relocate the data and/or the log files after they have
been
> assigned a location? Thanks everyone for your help.
There are several ways of doing this.
One method is to do a backup and restore.
Look at the MOVE TO option in RESTORE in the BOL.
Rick Sawtell
MCT, MCSD, MCDBA
|||yes,
1. detach and attach
2. backup and restore
Aleksandar Grbic
MCDBA, Senior Database Administrator
"coenzyme" wrote:

> Is it possible to relocate the data and/or the log files after they have been
> assigned a location? Thanks everyone for your help.
|||You could run sp_detach_db, move the files to the new location, and then
run sp_attach_db. Another method is to backup and then restore.
"coenzyme" <coenzyme@.discussions.microsoft.com> wrote in message
news:6827AE2A-BCDD-49BC-B98E-4B14F414D465@.microsoft.com...
> Is it possible to relocate the data and/or the log files after they have
been
> assigned a location? Thanks everyone for your help.

MDF and LDF file locations

Is it possible to relocate the data and/or the log files after they have been
assigned a location? Thanks everyone for your help."coenzyme" <coenzyme@.discussions.microsoft.com> wrote in message
news:6827AE2A-BCDD-49BC-B98E-4B14F414D465@.microsoft.com...
> Is it possible to relocate the data and/or the log files after they have
been
> assigned a location? Thanks everyone for your help.
There are several ways of doing this.
One method is to do a backup and restore.
Look at the MOVE TO option in RESTORE in the BOL.
Rick Sawtell
MCT, MCSD, MCDBA|||yes,
1. detach and attach
2. backup and restore
--
Aleksandar Grbic
MCDBA, Senior Database Administrator
"coenzyme" wrote:
> Is it possible to relocate the data and/or the log files after they have been
> assigned a location? Thanks everyone for your help.|||You could run sp_detach_db, move the files to the new location, and then
run sp_attach_db. Another method is to backup and then restore.
"coenzyme" <coenzyme@.discussions.microsoft.com> wrote in message
news:6827AE2A-BCDD-49BC-B98E-4B14F414D465@.microsoft.com...
> Is it possible to relocate the data and/or the log files after they have
been
> assigned a location? Thanks everyone for your help.sql

mdf and ldf file extensions

Hello All,
One of my customers created a database in SQL 2K SP3a. He gave the data
file LDF extension and log file MDF extension.
When I do sp_helpdb 'dbname', the extensions are pointing to the correct
files, meaning LDF is pointing to the data file and MDF is pointing to the
log file just as he designed.
My question is: is it just a standard suggested by Microsoft to name the
data file with MDF extension and log file with LDF and NDF extensions? Is
there going to be any repercussions later on if we name the files with wrong
extensions.
I though it was odd that SQL Server let the files be named with wrong
extensions in the first place.
Any ideas?
Thanks,
BivaThis will not confuse SQL Server. SQL Server doesn't rely
on the file name extension to determine the type of the
file or how it deals with the file. But it may be
confusing to a DBA, and wouldn't be considered best
practice from a naming convention standpoint.
If you don't like the current naming, you can detach the
database, rename the files to the conventional extensions,
and then attach the database using the renamed files.
Linchi
>--Original Message--
>Hello All,
>One of my customers created a database in SQL 2K SP3a.
He gave the data
>file LDF extension and log file MDF extension.
>When I do sp_helpdb 'dbname', the extensions are pointing
to the correct
>files, meaning LDF is pointing to the data file and MDF
is pointing to the
>log file just as he designed.
>My question is: is it just a standard suggested by
Microsoft to name the
>data file with MDF extension and log file with LDF and
NDF extensions? Is
>there going to be any repercussions later on if we name
the files with wrong
>extensions.
>I though it was odd that SQL Server let the files be
named with wrong
>extensions in the first place.
>Any ideas?
>Thanks,
>Biva
>
>.
>|||> My question is: is it just a standard suggested by Microsoft to name the
> data file with MDF extension and log file with LDF and NDF extensions?
The pedantic part of me is tugging to correct this. By default, at least.
Data files have MDF (and NDF extensions, in the case of multiple files).
Log files have LDF extensions (whether singular or multiple).
You can certainly override this behavior. I'm not certain that there are
any advantages of doing so, and I can certainly think of some drawbacks.
But there it is.
--
Aaron Bertrand
SQL Server MVP|||Hi Biva,
Thank you for using MSDN Newsgroup! It's my pleasure to assist you with
your issue.
You concern is if the MDF, NDF, LDF is just a suggested standard by
Microsoft and if there problem when change the extension to these files,
right?
When create a database, you should set a filename of the data, log, etc.
These fine name and extension should be specified (they are 'os_file_name'
when you refer it to 'create database' in BOL, SQL Server Books Online).
Although 'os_file_name' can be any valid operating system file name, the
name more clearly reflects the purpose of the file if you use the following
recommended extensions.
You can create a database like this:
USE master
GO
CREATE DATABASE Sales
ON
( NAME = Sales_dat,
FILENAME = 'c:\program files\microsoft sql
server\mssql\data\saledat.mdfx',
SIZE = 10,
MAXSIZE = 50,
FILEGROWTH = 5 )
LOG ON
( NAME = 'Sales_log',
FILENAME = 'c:\program files\microsoft sql
server\mssql\data\salelog.ldfx',
SIZE = 5MB,
MAXSIZE = 25MB,
FILEGROWTH = 5MB )
GO
As we know, the system table 'master' will control the user databases and
operation of SQL Server as a whole by keeping track of all information of
them. When you use:
Use master
Go
Select * from sysdatabases
You will get the fileinformation of sales with the extension you defined,
that is
'c:\program files\microsoft sql server\mssql\data\saledat.mdfx'
and you can create table or execute other operations on it.
But if you revise the extension of the file and thenuse the database again,
the SQL Server will notify you that the file is not exist although there
may be someway de recover. It is strongly suggested you to keep the
suggested file extension by Microsoft.
Hope this answered your questions. If you still have more concern about it,
please feel free to post new message here and I am ready to help!
Best regards
Baisong Wei
Microsoft Online Support
----
Get Secure! - www.microsoft.com/security
This posting is provided "as is" with no warranties and confers no rights.
Please reply to newsgroups only. Thanks.

MDF and LDF at the same drive

Dear All,
My Database Server is using RAID 5.
I put the mdf and ldf file of my database at the same drive.
Does it affect the SQL Server Performance?
Thanks
Robert Lie
The best thing would be not to use Raid 5 due to performance.
For best overall performance, locate the database files (.mdf) and log files
(.ldf) on separate arrays in your server to isolate potentially conflicting
reads and writes. [6.5, 7.0, 2000] Updated 12-20-2004
*****
To store your database files (.mdf), the best performance is gained by
storing them using RAID 10 arrays. If this is too expensive, then RAID 5 is
the next best bet. Each RAID array (5 or 10) should have as many physical
disks in the array as the controller will support. This allows reads and
writes to be performed simultaneously on each physical drive in the array,
significantly boosting disk I/O. [6.5, 7.0, 2000] Updated 12-20-2004
From: http://www.sql-server-performance.co...rver_setup.asp
HTH, Jens Suessmeyer.

http://www.sqlserver2005.de

"Robert Lie" <robert.lie24@.gmail.com> schrieb im Newsbeitrag
news:%23xPXnqWSFHA.2788@.TK2MSFTNGP09.phx.gbl...
> Dear All,
> My Database Server is using RAID 5.
> I put the mdf and ldf file of my database at the same drive.
> Does it affect the SQL Server Performance?
> Thanks
> Robert Lie
|||Hi Robert,
yes but it only becomes a problem in very large databases, the ldf (log
file) should be on a drive of its own in a perfect world and using RAID5 for
it is overkill and will slow it's performance as the log file is written to
sequentially and most other things including the mdf file are written to
randomly. Again this is only a concirn is big installations and if you have
a spare physical drive then the ldf file could be put on that.
Regards
Alex White MCDBA MCSE
http://www.intralan.co.uk
"Robert Lie" <robert.lie24@.gmail.com> wrote in message
news:%23xPXnqWSFHA.2788@.TK2MSFTNGP09.phx.gbl...
> Dear All,
> My Database Server is using RAID 5.
> I put the mdf and ldf file of my database at the same drive.
> Does it affect the SQL Server Performance?
> Thanks
> Robert Lie
|||Hi,
It is always recommended to put Data files and Log files in multiple drives,
it will be even better if you put the files in drives belongs to different
disk controllers.
This will help you to reduce the disk I/O and eventually the better
performance.
But incase if your volume pd transaction is less then you may not have any
I/O issues, inthis case you can keep both the files in same drives which
belongs to same disk controller. And monitor the Disk Queue length , all
hardware resorce usage using Perfmon.
If you find every thing is normal then you are good. See the website
http://www.sql-server-performance.com/ for more performanace monitoring and
tuning options.
Thanks
Hari
SQL server MVP
"Robert Lie" <robert.lie24@.gmail.com> wrote in message
news:%23xPXnqWSFHA.2788@.TK2MSFTNGP09.phx.gbl...
> Dear All,
> My Database Server is using RAID 5.
> I put the mdf and ldf file of my database at the same drive.
> Does it affect the SQL Server Performance?
> Thanks
> Robert Lie

MDF and LDF at the same drive

Dear All,
My Database Server is using RAID 5.
I put the mdf and ldf file of my database at the same drive.
Does it affect the SQL Server Performance?
Thanks
Robert LieThe best thing would be not to use Raid 5 due to performance.
For best overall performance, locate the database files (.mdf) and log files
(.ldf) on separate arrays in your server to isolate potentially conflicting
reads and writes. [6.5, 7.0, 2000] Updated 12-20-2004
*****
To store your database files (.mdf), the best performance is gained by
storing them using RAID 10 arrays. If this is too expensive, then RAID 5 is
the next best bet. Each RAID array (5 or 10) should have as many physical
disks in the array as the controller will support. This allows reads and
writes to be performed simultaneously on each physical drive in the array,
significantly boosting disk I/O. [6.5, 7.0, 2000] Updated 12-20-2004
From: http://www.sql-server-performance.com/sql_server_setup.asp
HTH, Jens Suessmeyer.
http://www.sqlserver2005.de
"Robert Lie" <robert.lie24@.gmail.com> schrieb im Newsbeitrag
news:%23xPXnqWSFHA.2788@.TK2MSFTNGP09.phx.gbl...
> Dear All,
> My Database Server is using RAID 5.
> I put the mdf and ldf file of my database at the same drive.
> Does it affect the SQL Server Performance?
> Thanks
> Robert Lie|||Hi Robert,
yes but it only becomes a problem in very large databases, the ldf (log
file) should be on a drive of its own in a perfect world and using RAID5 for
it is overkill and will slow it's performance as the log file is written to
sequentially and most other things including the mdf file are written to
randomly. Again this is only a concirn is big installations and if you have
a spare physical drive then the ldf file could be put on that.
--
Regards
Alex White MCDBA MCSE
http://www.intralan.co.uk
"Robert Lie" <robert.lie24@.gmail.com> wrote in message
news:%23xPXnqWSFHA.2788@.TK2MSFTNGP09.phx.gbl...
> Dear All,
> My Database Server is using RAID 5.
> I put the mdf and ldf file of my database at the same drive.
> Does it affect the SQL Server Performance?
> Thanks
> Robert Lie|||Hi,
It is always recommended to put Data files and Log files in multiple drives,
it will be even better if you put the files in drives belongs to different
disk controllers.
This will help you to reduce the disk I/O and eventually the better
performance.
But incase if your volume pd transaction is less then you may not have any
I/O issues, inthis case you can keep both the files in same drives which
belongs to same disk controller. And monitor the Disk Queue length , all
hardware resorce usage using Perfmon.
If you find every thing is normal then you are good. See the website
http://www.sql-server-performance.com/ for more performanace monitoring and
tuning options.
Thanks
Hari
SQL server MVP
"Robert Lie" <robert.lie24@.gmail.com> wrote in message
news:%23xPXnqWSFHA.2788@.TK2MSFTNGP09.phx.gbl...
> Dear All,
> My Database Server is using RAID 5.
> I put the mdf and ldf file of my database at the same drive.
> Does it affect the SQL Server Performance?
> Thanks
> Robert Lie

MDF / LDF

Hello,

I recently deleted the directory
C:\Program Files\Microsoft SQL Server\MSSQL\Data

On my production database server.
I managed using undelete software to get back most of the LDF/MDF files
and reattached them.

But there are a few that simply do not reattach.
Ive tried using

sp_attach_db
sp_attach_single_db

But to no avail.

I realise that the databases were not unattached properly.

Is there a way to get the databases back into Enterprise Manager?
Without starting again or using an expensive product like
officerecovery.com SQL to recover?

I appreciate anybodies help on this.
GurdipYou didn't mention backups. Does that mean you don't have any backups?

What does "do not reattach" mean? Do you get an error message? It might
be possible to advise you better if we knew that and the exact
sp_attach statement you used.

Before you do anything at all please, please take a backup!

--
David Portas
SQL Server MVP
--|||(gurdipv@.gmail.com) writes:
> I recently deleted the directory
> C:\Program Files\Microsoft SQL Server\MSSQL\Data
> On my production database server.
> I managed using undelete software to get back most of the LDF/MDF files
> and reattached them.
> But there are a few that simply do not reattach.
> Ive tried using
> sp_attach_db
> sp_attach_single_db
> But to no avail.
> I realise that the databases were not unattached properly.
> Is there a way to get the databases back into Enterprise Manager?
> Without starting again or using an expensive product like
> officerecovery.com SQL to recover?

If the error message are what I fear, the answer is: yes, you may be able
to get the databases back, but those ways are dangerous and can lead to
severe corruption, and requires complete understanding of what you are
up to. If those databases are dear to you, you should open a case with
Microsoft support.

But start with posting the error message, so we can verify that the problem
is not a more trivial one.

--
Erland Sommarskog, SQL Server MVP, esquel@.sommarskog.se

Books Online for SQL Server SP3 at
http://www.microsoft.com/sql/techin.../2000/books.asp