# olef storage

Source: https://olef.dev/docs/reference/cli/storage

Generated from **Olef 3.18.0**. [All olef commands](https://olef.dev/docs/reference/commands) · [ocloud commands](https://olef.dev/docs/reference/ocloud) · [Capabilities](https://olef.dev/docs/reference/capabilities)

These entries describe available commands, not a sequence to run. Check prerequisites before changing app, device, or cloud state. Global options are listed in the [command catalog](https://olef.dev/docs/reference/commands#global-options).

## olef storage

Inspect SQLite/Room databases, SharedPreferences, and Jetpack DataStore

```bash
olef storage --help
```

Output: **json**.

### olef storage ls

List databases, SharedPreferences, and DataStore files in a debuggable app

```bash
olef storage ls --help
```

Output: **json**.

| Argument | Description |
| --- | --- |
| `--app <APP>` | App package or configured app alias. Defaults to configured app |
| `--json` | Accepted for compatibility; output is always JSON. |

### olef storage db

Inspect or query SQLite/Room databases

```bash
olef storage db --help
```

Output: **json**.

#### olef storage db schema

Print tables and `sqlite_schema` definitions for a database

```bash
olef storage db schema --help
```

Output: **json**.

| Argument | Description |
| --- | --- |
| `<database>` | **Required.** Database filename (e.g. `app.db`) or relative path under `databases/` or `no_backup/` |
| `--app <APP>` | App package or configured app alias |
| `--quiescent` | Force-stop the app for a deterministic quiescent snapshot before reading Conflicts with: `live`. |
| `--live` | Query live open SQLiteDatabase instances through the attached runtime agent Conflicts with: `quiescent`. |
| `--max-db-bytes <MAX_DB_BYTES>` | Maximum database size to copy to host (default 64 MiB) Default: `67108864`. |
| `--json` | Accepted for compatibility; output is always JSON. |

#### olef storage db query

Run a strictly read-only SQL query against an app database

```bash
olef storage db query --help
```

Output: **json**.

| Argument | Description |
| --- | --- |
| `<database>` | **Required.** Database filename (e.g. `app.db`) or relative path under `databases/` or `no_backup/` |
| `<sql>` | **Required.** Single read-only SQL `SELECT` / `WITH` statement |
| `--app <APP>` | App package or configured app alias |
| `--param <PARAMS>` | Positional bind parameter as a JSON scalar (repeatable) |
| `--max-rows <MAX_ROWS>` | Maximum rows to return (1..=1000) Default: `100`. |
| `--offset <OFFSET>` | Row offset for pagination Default: `0`. |
| `--timeout-ms <TIMEOUT_MS>` | Query execution timeout in milliseconds (1..=10000) Default: `2000`. |
| `--quiescent` | Force-stop the app for a deterministic quiescent snapshot before querying Conflicts with: `live`. |
| `--live` | Run the read-only query against the live in-process database via the runtime agent Conflicts with: `quiescent`. |
| `--allow-columns <ALLOW_COLUMNS>` | Additional column names permitted unredacted when global `--redact` is active |
| `--max-db-bytes <MAX_DB_BYTES>` | Maximum database size to copy to host (default 64 MiB) Default: `67108864`. |
| `--json` | Accepted for compatibility; output is always JSON. |

#### olef storage db exec

Execute a transactional write SQL statement against a live app database (`--live` runtime)

```bash
olef storage db exec --help
```

Output: **json**.

| Argument | Description |
| --- | --- |
| `<database>` | **Required.** Database filename (e.g. `app.db`) or relative path under `databases/` or `no_backup/` |
| `<sql>` | **Required.** SQL statement to run inside an explicit transaction |
| `--app <APP>` | App package or configured app alias |
| `--live` | Explicit acknowledgement of live in-process execution (always runs live) |
| `--param <PARAMS>` | Positional bind parameter as a JSON scalar (repeatable) |
| `--timeout-ms <TIMEOUT_MS>` | Execution timeout in milliseconds (1..=10000) Default: `5000`. |
| `--json` | Accepted for compatibility; output is always JSON. |

### olef storage prefs

Read or modify SharedPreferences XML files

```bash
olef storage prefs --help
```

Output: **json**.

#### olef storage prefs get

Read all entries or one key from a SharedPreferences XML file

```bash
olef storage prefs get --help
```

Output: **json**.

| Argument | Description |
| --- | --- |
| `<name>` | **Required.** SharedPreferences name (e.g. `app_prefs` or `shared_prefs/app_prefs.xml`) |
| `<key>` | Optional single key to read |
| `--app <APP>` | App package or configured app alias |
| `--allow-keys <ALLOW_KEYS>` | Keys permitted unredacted when global `--redact` is active |
| `--json` | Accepted for compatibility; output is always JSON. |

#### olef storage prefs set

Set a typed SharedPreferences value (live via runtime when running, or atomic `--restart`)

```bash
olef storage prefs set --help
```

Output: **json**.

| Argument | Description |
| --- | --- |
| `<name>` | **Required.** SharedPreferences name |
| `<key>` | **Required.** Preference key |
| `<value>` | Value to write. Use `--value-env` for secrets |
| `--value-env <ENV>` | Read the preference value from this environment variable (never echoed) Conflicts with: `value`. |
| `--type <KIND>` | Value type Default: `string`. Values: `string`, `int`, `long`, `float`, `bool`, `string-set`. |
| `--restart` | Force-stop, write atomically (removing stale `.xml.bak`), relaunch, and read back |
| `--app <APP>` | App package or configured app alias |
| `--json` | Accepted for compatibility; output is always JSON. |

#### olef storage prefs rm

Remove a SharedPreferences key (live via runtime when running, or atomic `--restart`)

```bash
olef storage prefs rm --help
```

Output: **json**.

| Argument | Description |
| --- | --- |
| `<name>` | **Required.** SharedPreferences name |
| `<key>` | **Required.** Preference key to delete |
| `--restart` | Force-stop, delete atomically (removing stale `.xml.bak`), relaunch, and read back |
| `--app <APP>` | App package or configured app alias |
| `--json` | Accepted for compatibility; output is always JSON. |

### olef storage datastore

Decode Jetpack Preferences DataStore or raw Proto DataStore files

```bash
olef storage datastore --help
```

Output: **json**.

#### olef storage datastore read

Decode a Jetpack Preferences DataStore (`.preferences_pb`) or raw Proto DataStore file

```bash
olef storage datastore read --help
```

Output: **json**.

| Argument | Description |
| --- | --- |
| `<name>` | **Required.** DataStore filename (e.g. `settings.preferences_pb`) or relative `files/datastore/...` path |
| `--app <APP>` | App package or configured app alias |
| `--format <FORMAT>` | Wire format decoding mode Default: `auto`. Values: `auto`, `preferences-pb`, `proto-raw`. |
| `--allow-keys <ALLOW_KEYS>` | Keys or field numbers permitted unredacted when global `--redact` is active |
| `--json` | Accepted for compatibility; output is always JSON. |
