Solved

Knowing where database files are placed SQL 2008

Posted on 2013-01-16
3
288 Views
Last Modified: 2013-01-18
Is the master database always placed in C:\Program Files\Microsoft SQL Server\MSSQL$<Instancename>\Data ? If the instance is down, how weould I find it if it where placed elsewhere?
Where is the placement of the other attached custom databases stored? Master database? Other places?
0
Comment
Question by:itnifl
3 Comments
 
LVL 57

Assisted Solution

by:Raja Jegan R
Raja Jegan R earned 65 total points
ID: 38786112
Not necessarily, you can place master and system databases under any location.
If the instance is down, then it would be difficult to identify the files location.
You can use the below query to find the file location of all databases:

select DB_NAME(dbid),* from sys.sysaltfiles
0
 
LVL 142

Accepted Solution

by:
Guy Hengel [angelIII / a3] earned 65 total points
ID: 38786116
the entry point is the master database; of which the location is specified in the startup options:
http://msdn.microsoft.com/en-us/library/ms190737%28v=sql.105%29.aspx
and hence yes, the master db could be anywhere on the disk...

from there, the master db contains the references to the other databases and their files.
0
 
LVL 42

Assisted Solution

by:EugeneZ
EugeneZ earned 65 total points
ID: 38786558
you can pre- record all this info as per above posted info
and \or from registry via , for example, script from
the post
http://sqlandme.com/2012/01/05/sql-server-identifying-default-data-directory-for-multiple-instances-through-registry/
or like this
declare @SQLDataRoot varchar(500)
exec master..xp_instance_regread
   @rootkey='HKEY_LOCAL_MACHINE',
   @key='SOFTWARE\Microsoft\MSSQLServer\Setup',
   @value_name='SQLDataRoot',
   @value=@SQLDataRoot output

also you can use registry via regedit to find this info as well

and\or powershell ,  WMS ,etc
0

Featured Post

Highfive Gives IT Their Time Back

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

This article explains how to reset the password of the sa account on a Microsoft SQL Server.  The steps in this article work in SQL 2005, 2008, 2008 R2, 2012, 2014 and 2016.
The Delta outage: 650 cancelled flights, more than 1200 delayed flights, thousands of frustrated customers, tens of millions of dollars in damages – plus untold reputational damage to one of the world’s most trusted airlines. All due to a catastroph…
This video shows, step by step, how to configure Oracle Heterogeneous Services via the Generic Gateway Agent in order to make a connection from an Oracle session and access a remote SQL Server database table.
Viewers will learn how to use the SELECT statement in SQL to return specific rows and columns, with various degrees of sorting and limits in place.

746 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

9 Experts available now in Live!

Get 1:1 Help Now