13

I'm upgrading from SQL Server 2005 to 2008. I've detached the database I need, but can't find it on the file system.

Where does a default installation of SQL Server 2005 store these?

p.campbell
  • 98,673
  • 67
  • 256
  • 322
kirk.burleson
  • 1,211
  • 2
  • 18
  • 29

7 Answers7

13

try this, run this query

use model
go
SELECT physical_name FROM sys.database_files

in my case on my laptop it is in this folder

C:\Program Files\Microsoft SQL Server\MSSQL10.MSSQLSERVER\MSSQL\DATA\

SQLMenace
  • 132,095
  • 25
  • 206
  • 225
13

You can also use management studio to look at the properties>files of any database - that will show the files and their growth settings.

Sam
  • 7,543
  • 7
  • 48
  • 62
6

By default, in \Program Files\Microsoft SQL Server\

SLaks
  • 868,454
  • 176
  • 1,908
  • 1,964
  • not always true, especially not on a server, for example on my server Log files are on the L drive and data files on the U and V drives..it is determined by the model database – SQLMenace Aug 17 '10 at 00:04
  • 1
    @SQLMenace: He's asking about a _default_ installation – SLaks Aug 17 '10 at 00:05
  • I see, it also depends what you mean by default, our default is L for logs, M for system, T for tempdb and rest of userDB – SQLMenace Aug 17 '10 at 00:08
  • 1
    @SQLMenace: But that's not a default _installation_. – SLaks Aug 17 '10 at 00:18
5

The default locations for SQL Server 2005 are:

  • \Microsoft SQL Server\MSSQL.1\MSSQL\ for the Database Engine
  • \Microsoft SQL Server\MSSQL.2\OLAP\ for Analysis Services
  • \Microsoft SQL Server\MSSQL.3\RS\ for Reporting Services

See HERE for more details.

Sometimes you can't look at the properties if one of the systems files is corrupt.

JBrooks
  • 9,901
  • 2
  • 28
  • 32
1

you can always go to SQL Server Management Studio and right click on the database, than select proprieties, than go on the angle Files, you will see two files displayed in a table on is MDF file and Log file , check the path ! go to that folder, your database is the MDF file !

PS : to be able to copy i think you have to terminate the SqlServer Processes, that's a little dirty way isn't, but it's fast and i use it, works for me !

KADEM Mohammed
  • 1,650
  • 2
  • 23
  • 45
1

Go to C Drive --> Program Files --> Microsoft SQL Server --> MSSQLXX --> MSSQL -- > DATA

The Data Folder has mdf and log files both.

Gaurav
  • 123
  • 7
0

You should probably do a database export from management studio so there aren't any compatibility issues.

Byron Whitlock
  • 52,691
  • 28
  • 123
  • 168