add dead-pc-recovery
All checks were successful
Deploy triz-docs to civital server / build-and-deploy (push) Successful in 1h8m32s
All checks were successful
Deploy triz-docs to civital server / build-and-deploy (push) Successful in 1h8m32s
This commit is contained in:
parent
31a80bc72c
commit
1a461e1847
@ -0,0 +1,8 @@
|
||||
{
|
||||
"label": "Dead PC Recovery",
|
||||
"position": 2,
|
||||
"link": {
|
||||
"type": "generated-index",
|
||||
"description": "Guide for extracting database files from a failing or non-booting PC."
|
||||
}
|
||||
}
|
||||
26
docs/database-operations/dead-pc-recovery/index.md
Normal file
26
docs/database-operations/dead-pc-recovery/index.md
Normal file
@ -0,0 +1,26 @@
|
||||
---
|
||||
sidebar_position: 1
|
||||
title: "Overview"
|
||||
---
|
||||
|
||||
# Overview
|
||||
|
||||
---
|
||||
|
||||
This guide covers how to physically extract database files from a client's PC when the machine is failing or the database service cannot start, so that data can be saved to a USB drive and restored on a working machine.
|
||||
|
||||
There are two possible situations when you arrive at a client site:
|
||||
|
||||
| **Situation** | **What it means** | **Procedure** |
|
||||
| ----------------------------------------------------- | --------------------------------------------- | ---------------------------------------------------- |
|
||||
| **A — Windows boots, but the DB service won't start** | You can navigate the file system normally | Go directly to Part A |
|
||||
| **B — Windows does not boot at all** | You need a live Linux USB to access the drive | Go to Part B first, then follow the extraction steps |
|
||||
|
||||
---
|
||||
|
||||
# What to Bring
|
||||
|
||||
Before going on-site, make sure you have:
|
||||
- A **USB drive** with enough space (at least as large as the client's database, ideally 2x).
|
||||
- A **bootable Linux live USB** (Ubuntu LTS recommended) — only needed if the PC doesn't boot.
|
||||
- This guide, either printed or on your phone.
|
||||
68
docs/database-operations/dead-pc-recovery/windows-boots.md
Normal file
68
docs/database-operations/dead-pc-recovery/windows-boots.md
Normal file
@ -0,0 +1,68 @@
|
||||
---
|
||||
sidebar_position: 2
|
||||
title: "Part A — Windows Boots"
|
||||
---
|
||||
|
||||
# Part A — Windows Boots, Service is Down
|
||||
|
||||
---
|
||||
|
||||
In this case you can work directly in Windows Explorer or a command prompt. The database service does not need to be running to copy the files.
|
||||
|
||||
---
|
||||
|
||||
## A1 — SQL Server: Locate and Copy the Files
|
||||
|
||||
SQL Server databases consist of up to three file types, all of which you need:
|
||||
|
||||
| **File** | **Extension** | **Contains** |
|
||||
| ------------------- | ------------- | ---------------------------------- |
|
||||
| Primary data file | `.mdf` | The database schema and data |
|
||||
| Secondary data file | `.ndf` | Overflow data (not always present) |
|
||||
| Transaction log | `.ldf` | Transaction history |
|
||||
|
||||
**Default file locations by SQL Server version:**
|
||||
|
||||
| **Version** | **Default Data Path** |
|
||||
| --------------- | ----------------------------------------------------------------------- |
|
||||
| SQL Server 2012 | `C:\Program Files\Microsoft SQL Server\MSSQL11.MSSQLSERVER\MSSQL\DATA\` |
|
||||
| SQL Server 2014 | `C:\Program Files\Microsoft SQL Server\MSSQL12.MSSQLSERVER\MSSQL\DATA\` |
|
||||
| SQL Server 2016 | `C:\Program Files\Microsoft SQL Server\MSSQL13.MSSQLSERVER\MSSQL\DATA\` |
|
||||
| SQL Server 2017 | `C:\Program Files\Microsoft SQL Server\MSSQL14.MSSQLSERVER\MSSQL\DATA\` |
|
||||
| SQL Server 2019 | `C:\Program Files\Microsoft SQL Server\MSSQL15.MSSQLSERVER\MSSQL\DATA\` |
|
||||
| SQL Server 2022 | `C:\Program Files\Microsoft SQL Server\MSSQL16.MSSQLSERVER\MSSQL\DATA\` |
|
||||
| SQL Server 2025 | `C:\Program Files\Microsoft SQL Server\MSSQL17.MSSQLSERVER\MSSQL\DATA\` |
|
||||
|
||||
**Steps:**
|
||||
1. Open **Windows Explorer** and navigate to the data path for the installed SQL Server version (see table above).
|
||||
2. Identify the files belonging to the target database. They will be named after the database, e.g. `ClientDB.mdf`, `ClientDB_log.ldf`.
|
||||
3. Copy **all three file types** (`.mdf`, `.ndf` if present, `.ldf`) to your USB drive. Do not rename them.
|
||||
4. Verify the copy completed without errors before ejecting the USB.
|
||||
|
||||
**Notes:**
|
||||
- **Custom paths:** The client may have installed SQL Server with a non-default data path. If the files are not in the paths above, check the Windows Registry at: `HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Microsoft SQL Server\<instance>\MSSQLServer` Look for the `DefaultData` and `DefaultLog` keys.
|
||||
- **Do not try to copy the system databases** (`master`, `model`, `msdb`, `tempdb`). Only copy the client's user database files.
|
||||
|
||||
---
|
||||
|
||||
## A2 — PostgreSQL: Locate and Copy the Files
|
||||
|
||||
PostgreSQL stores all databases in a single directory called `PGDATA`. Unlike SQL Server, you do not copy individual files — you copy the **entire data directory**.
|
||||
|
||||
**Default file locations by PostgreSQL version:**
|
||||
|
||||
| **Version** | **Default Data Path** |
|
||||
| ------------- | -------------------------------------- |
|
||||
| PostgreSQL 12 | `C:\Program Files\PostgreSQL\12\data\` |
|
||||
| PostgreSQL 13 | `C:\Program Files\PostgreSQL\13\data\` |
|
||||
| PostgreSQL 14 | `C:\Program Files\PostgreSQL\14\data\` |
|
||||
| PostgreSQL 15 | `C:\Program Files\PostgreSQL\15\data\` |
|
||||
| PostgreSQL 16 | `C:\Program Files\PostgreSQL\16\data\` |
|
||||
|
||||
**Steps:**
|
||||
- Open **Windows Explorer** and navigate to the `data` folder for the installed PostgreSQL version (see table above).
|
||||
- Copy the **entire `data` folder** to your USB drive. This single folder contains everything needed.
|
||||
- Note the PostgreSQL version number from the folder path — you will need it when restoring.
|
||||
|
||||
**Notes:**
|
||||
- **Note the version.** For each database in the cluster there is a subdirectory within `PGDATA/base`, named after the database's OID. Because these internal identifiers are version-specific, the data directory must be restored on a machine running the **exact same PostgreSQL version**.
|
||||
101
docs/database-operations/dead-pc-recovery/windows-dead.md
Normal file
101
docs/database-operations/dead-pc-recovery/windows-dead.md
Normal file
@ -0,0 +1,101 @@
|
||||
---
|
||||
sidebar_position: 3
|
||||
title: "Part B — Windows Does Not Boot"
|
||||
---
|
||||
|
||||
# Part B — Windows Does Not Boot (Linux Live USB)
|
||||
|
||||
---
|
||||
|
||||
If the client's PC will not boot into Windows, you will use a Linux live environment to access the hard drive and copy the database files.
|
||||
|
||||
---
|
||||
|
||||
## B1 — Boot from the Linux Live USB
|
||||
|
||||
1. Insert your bootable Ubuntu USB into the dead PC.
|
||||
2. Power on the PC and enter the **Boot Menu** (usually `F8`, `F11`, or `F12` — varies by manufacturer).
|
||||
3. Select your USB drive from the boot menu.
|
||||
4. When Ubuntu loads, choose **"Try Ubuntu"** (do not install).
|
||||
|
||||
---
|
||||
|
||||
## B2 — Mount the Windows Drive
|
||||
|
||||
Ubuntu may mount the Windows drive automatically. If not:
|
||||
1. Open the **Files** application (file manager). The Windows drive should appear in the left sidebar — click it to mount it.
|
||||
2. If it doesn't appear, open a **Terminal** and run:
|
||||
|
||||
```bash
|
||||
# List all available drives and partitions
|
||||
sudo fdisk -l
|
||||
```
|
||||
|
||||
Look for a partition of type `NTFS` with the size matching the client's main drive (e.g., `/dev/sda3`). Then mount it:
|
||||
|
||||
```bash
|
||||
sudo mkdir -p /mnt/windows
|
||||
sudo mount -t ntfs-3g /dev/sda3 /mnt/windows
|
||||
```
|
||||
|
||||
Replace `/dev/sda3` with the correct partition name from `fdisk -l`.
|
||||
|
||||
3. Verify the drive is mounted:
|
||||
|
||||
```bash
|
||||
ls /mnt/windows
|
||||
```
|
||||
|
||||
You should see the familiar Windows folders: `Users`, `Program Files`, `Windows`, etc.
|
||||
|
||||
---
|
||||
|
||||
## B3 — Mount the USB Drive
|
||||
|
||||
1. Plug in your USB drive. Ubuntu will mount it automatically under `/media/ubuntu/`.
|
||||
2. Find the exact mount point:
|
||||
|
||||
```bash
|
||||
ls /media/ubuntu/
|
||||
```
|
||||
|
||||
Note the folder name (it will be the USB drive label, e.g., `SUPPORT_USB`). Your full USB path will be something like `/media/ubuntu/SUPPORT_USB`.
|
||||
|
||||
---
|
||||
|
||||
## B4 — SQL Server: Copy Files from the Dead Drive
|
||||
|
||||
Navigate to the SQL Server data directory and copy the files:
|
||||
|
||||
```bash
|
||||
# Adjust the MSSQL version folder (MSSQL14=2017, MSSQL15=2019, MSSQL16=2022)
|
||||
ls "/mnt/windows/Program Files/Microsoft SQL Server/MSSQL15.MSSQLSERVER/MSSQL/DATA/"
|
||||
```
|
||||
|
||||
You will see all `.mdf`, `.ndf`, and `.ldf` files listed. Copy the client's database files to the USB:
|
||||
|
||||
```bash
|
||||
# Create a folder on the USB for organization
|
||||
mkdir -p /media/ubuntu/SUPPORT_USB/SQLServer_Recovery
|
||||
|
||||
# Copy the target database files (replace ClientDB with the actual name)
|
||||
sudo cp "/mnt/windows/Program Files/Microsoft SQL Server/MSSQL15.MSSQLSERVER/MSSQL/DATA/ClientDB.mdf" \ /media/ubuntu/SUPPORT_USB/SQLServer_Recovery/
|
||||
|
||||
sudo cp "/mnt/windows/Program Files/Microsoft SQL Server/MSSQL15.MSSQLSERVER/MSSQL/DATA/ClientDB_log.ldf" \ /media/ubuntu/SUPPORT_USB/SQLServer_Recovery/
|
||||
|
||||
# If a secondary file exists, copy it too
|
||||
sudo cp "/mnt/windows/Program Files/Microsoft SQL Server/MSSQL15.MSSQLSERVER/MSSQL/DATA/ClientDB.ndf" \ /media/ubuntu/SUPPORT_USB/SQLServer_Recovery/ 2>/dev/null || true
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## B5 — PostgreSQL: Copy Files from the Dead Drive
|
||||
|
||||
```bash
|
||||
# Create a folder on the USB
|
||||
mkdir -p /media/ubuntu/SUPPORT_USB/PostgreSQL_Recovery
|
||||
|
||||
# Copy the entire data directory (adjust version number as needed)
|
||||
sudo cp -r "/mnt/windows/Program Files/PostgreSQL/15/data" \
|
||||
/media/ubuntu/SUPPORT_USB/PostgreSQL_Recovery/
|
||||
```
|
||||
Loading…
Reference in New Issue
Block a user