prepare-staging
Prepares a target staging folder for restore, selects backup files from the source, and identifies which files still need copying. Supports plan-only and dry-run checks.
Instructions
dbabrain common.cli prepare-staging: A restore's staging folder to make ready for a backup directory's files, and the question of which still have to travel.
Changes or removes something. A command on the emergency-operations list takes confirm: "yes" and a reason in its request, as on the command line.
Request fields (pass them as request):
source: The source host's SSH login: host, port, username and a RESOLVED password or key_file (an absolute path), open_timeout_seconds - never a secret ref: common resolves nothing; platform: linux (also when absent) or windo...
source_dir: The backup directory on the source host.
target: The target host's SSH login: host, port, username and a RESOLVED password or key_file (an absolute path), open_timeout_seconds - never a secret ref: common resolves nothing; platform: linux (also when absent) or windo...
target_dir: The staging directory on the target host - on a windows login a drive path (C:/dbabrain_restore/<restore_id>, either separator); a drive path on any other login is refused.
chain: Read the chain from the source: {db_type (postgresql | oracle | sqlserver), backup_dir (oracle: the path RMAN's catalog names), container (oracle: where RMAN runs), point_in_time (set: the chain that reaches the momen...
include: Path prefixes the restore needs; empty = everything. Stated, it is used as it is; absent,
chainreads it from the source.window_hours: Also copy every file the source wrote in the last N hours, beside the include - copy_selection window. Ignored when include is empty (everything is copied).
make_readable: When something under source_dir is not readable by the login: sudo -n chmod -R a+rX on it first (a live archivelog job writes 0640). Never asks for a password - where sudo needs one it is refused at once and the listi...
space_check: The room the files still to copy must find on the target before the first one moves: free >= bytes x factor. A restore entry's own space_check, handed on by the app; the same object, the same defaults.
staging_marker: The name of the file that marks target_dir as this tool's staging folder: only a marked folder is mirrored, and an unmarked one that shares no file with the source is refused. A restore entry's own staging_marker, han...
replace: Relative paths that travel even when the target holds them at the same size and not older: a copy the caller's checksum gate found different.
plan_only: true: answer only the files the request selects (and the chain, when asked), read from the source; the target is not opened and nothing is prepared.
incoming: Instead of a source (0.39.0): the files the caller already knows, relative to target_dir with their sizes - the target half alone: the folder made, marked and proven writable, the room for the files not there yet at t...
dry_run: With incoming (0.39.0): read only - whether target_dir is there and whose, which files are there already, and whether the rest fit, each a verdict; nothing is made or written. Refused without incoming.
Tool call template
This tool declares no required parameters. Add optional parameters from the input schema as needed.
{
"id": 1,
"jsonrpc": "2.0",
"method": "tools/call",
"params": {
"arguments": {},
"name": "prepare-staging"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| request | No |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| result | Yes |