Skip to content

Advanced: Sqlite

ChuckPa edited this page Oct 16, 2026 · 1 revision
  • .SQLITE - (Hidden developer/debugging command): Built-in SQLite Shell
    • Overview: .sqlite launches a small, self-contained interactive SQLite shell built directly into DBRepair, using the exact same statically-linked SQLite/ICU build the rest of the tool uses. It always starts connected to a scratch in-memory database; use .open to connect to a real file. Useful for inspecting database state directly (checking FTS index health, row counts, schema, or running ad-hoc SQL) without needing a separate SQLite binary that understands Plex's ICU collation/tokenizer.

    • Availability: Must be typed in full. It is not part of the numbered menu and does not appear in Show.

    • Dot-commands available inside the shell:

.bail on|off        - Stop (nonzero exit) on the first statement error.
                      Off by default.
.close              - Close the active connection; reports whether the
                      handle actually cleared.
.dbinfo             - Show page size, page count, encoding, and
                      auto_vacuum mode.
.echo on|off        - Print each statement's SQL text before its
                      output. Off by default.
.exit / .quit       - Leave the shell.
.ftsinfo <table>    - Show row counts for an FTS4 table's shadow
                      tables (_content/_segments/_segdir/_docsize/_stat).
.indexes [pattern]  - List indexes, optionally filtered by table
                      name pattern.
.open [--readonly|--readwrite|--create] <file>
                    - Close the current connection and open <file>.
                      Opens READ-ONLY by default (unlike sqlite3).
                      --readwrite and --create are required to open
                      read-write; they behave identically
                      (read-write, create if missing). --readonly is
                      accepted but is already the default. Also accepts
                      the short forms RO/RW/CREATE.
.schema [pattern]   - Show CREATE statements, optionally filtered
                      by name pattern.
.slots              - List the 4-slot connection pool: which slot is
                      active, its path, and open/closed state.
.tables [pattern]   - List tables/views, optionally filtered by
                      name pattern.

Any other input is treated as SQL and executed against the active connection.

  • Example: Checking FTS health from the command line without a separate SQLite build:
./DBRepair .sqlite
sqlite> .open /path/to/com.plexapp.plugins.library.db
sqlite> .ftsinfo fts4_metadata_titles_icu

Back

Clone this wiki locally