Score:-1

Backup MSSQL database via disk (no SSMS no command line)

cn flag

Our Windows server is having issues but before running disk repair, I want to take a backup. At the moment I'm using SystemRescure (the Linux utility) and I have successfully saved files.

The only problem I have is that I need to take a backup of MSSQL databases. Now for obvious reasons I can't use SSMS software nor command line to get it because MSSQL is not running and it can't be started since I'm on Linux just browsing the hard disk.

What options do I have? I was thinking of saving all database files (tables, indexes ecc.) but:

  • I have no idea where MSSQL stores them
  • I suspect that I can't do anything with such files. I mean probably I can't magically import them on a new server
Score:2
lr flag

By default MSSQL stores the database files in the following location:

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

Where XX depends on the Microsoft SQL Version. However its possible that this is changed in the past!

You should be able to copy database files and attach them to another Microsoft SQL Instance which has the same version or higher.

Per database you most likely have the following files:

  • <db_name>.mdb: The primary data file
  • <db_name>.ldf: Log File
  • <db_name>.ndf: Secondary Data File (Not necessarily every database has a secondary data file)

Make sure you recover all of these files.

After recovery you can attach the databases on another Microsoft SQL server with the following query (or via the SSMS GUI)

USE [master]
GO
create database <DatabaseName> ON
(name='LogicalName of the Data file', FileName='Data File Name'),
(name='LogicalName of the Log file', FileName='Log File Name')
FOR ATTACH;
I sit in a Tesla and translated this thread with Ai:

mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.