Solved

Knowing where database files are placed SQL 2008

Posted on 2013-01-16
3
292 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 143

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

NFR key for Veeam Backup for Microsoft Office 365

Veeam is happy to provide a free NFR license (for 1 year, up to 10 users). This license allows for the non‑production use of Veeam Backup for Microsoft Office 365 in your home lab without any feature limitations.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Load balancing is the method of dividing the total amount of work performed by one computer between two or more computers. Its aim is to get more work done in the same amount of time, ensuring that all the users get served faster.
Never store passwords in plain text or just their hash: it seems a no-brainier, but there are still plenty of people doing that. I present the why and how on this subject, offering my own real life solution that you can implement right away, bringin…
Via a live example, show how to backup a database, simulate a failure backup the tail of the database transaction log and perform the restore.
Using examples as well as descriptions, and references to Books Online, show the documentation available for datatypes, explain the available data types and show how data can be passed into and out of variables.

808 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