Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can I find out the location of my (localdb) SQL Server 2012 database and back it up?

Tags:

sql-server

I am using VS2012 and I have a database created:

(localdb)\v11.0 (SQL Server 11.0.2100 - T61\Alan) 

How can I find out the physical location of this database. How can I back this up? Can I just make a copy of the files, move these to another location and start the database again.

Here is my connection string:

<add name="DB1Context" connectionString="Data Source=(LocalDb)\v11.0;Initial Catalog=DB1;Integrated Security=SSPI;" providerName="System.Data.SqlClient" /> 
like image 501
Alan2 Avatar asked Aug 13 '13 06:08

Alan2


People also ask

Where is LocalDB stored database?

The system database files for the database are stored in the local AppData path, which is normally hidden. For example, C:\Users\<user>\AppData\Local\Microsoft\Microsoft SQL Server Local DB\Instances\LocalDBApp1\ .

How do I find the path to SQL Server?

Right-click the SQL Server or SQL Browser service and select Properties to open the SQL Server (Instance) or Browser Properties window. 4. The path listed under Path to Executable is the path to the SQL Server or Browser service.


1 Answers

By default, LocalDB database creates “*.mdf” files in the C:/Users/"username" directory.

Link ref: https://docs.asp.net/en/latest/tutorials/first-mvc-app/working-with-sql.html

like image 172
Hung Vu Avatar answered Sep 28 '22 18:09

Hung Vu