NinjaTrader repair

4 min read

NinjaTrader unable to open database file: diagnose before repair

Read the error code and file path before repair. Separate access failures from corruption, preserve the right backup components, and avoid deleting recovery journals.

Illustration of a locked database cylinder beside a backup copy and a repair key.

Quick answer

An “unable to open database file” message does not by itself prove corruption. Capture the full error and path, distinguish an access failure from a lock or corruption code, and preserve a backup before changing the database.

Read the code, not just the word “database”

If the error includes a SQLite result code, use it to narrow the investigation. These codes describe different failures; a generic startup message may not expose one.

Reported codeWhat it establishesNext evidence to collect
CANTOPEN (14)SQLite could not open a file, which may be the main database or a temporary file.Full path and any accompanying Windows access or storage error.
BUSY (5) or LOCKED (6)An access conflict. BUSY usually involves another connection; LOCKED can involve the same connection or shared cache.Other running instances and the activity at the failure time.
READONLY (8)The connection cannot perform the requested write.The Windows identity and access to the affected location.
CORRUPT (11)SQLite reports database corruption.Original database, accompanying files, logs and available backups before repair.

Check the exact path and the Windows account

Copy the reported path into the incident record. Check whether that location exists under the Windows account running NinjaTrader, and whether it is local, redirected to OneDrive, or on unavailable storage. A file visible under another account does not establish that this process can use it.

NinjaTrader’s 8.1.5 release notes document a warning when the Documents folder is on OneDrive. If the reported path includes OneDrive, record the sync state and whether the files are available locally. That is a specific lead, not proof that syncing caused this error. Preserve the files and follow the applicable support procedure before relocating Documents.

After a normal shutdown, check Task Manager for a remaining NinjaTrader process before starting another copy. If one is stuck, first establish the account’s current orders and positions through the provider; a frozen window cannot confirm them. A leftover process is a clue, not a diagnosis of corruption.

A workspace backup is not a database backup

If NinjaTrader still opens, disconnect its connections and select Tools > Export > Backup File. Choose the components you need. Database (Historical trade data) preserves local trade-execution history; Workspaces preserves layouts; Templates covers saved feature settings. Log and Trace files preserve diagnostic activity. Include configuration and NinjaScript files when the repair could affect them.

Choose a destination outside the folders you will modify, then confirm the named archive exists. The backup’s selected components matter more than its filename.

If NinjaTrader cannot open, the in-app export is unavailable. Preserve the affected files with the platform fully closed and follow support’s file-copy instructions. Do not copy only the main .sqlite file while it is active, or delete adjacent -wal or -journal files as “cleanup.” SQLite documents that interrupted-transaction recovery can depend on those accompanying files.

Reset DB, Repair DB and workspace restore do different jobs

NinjaTrader’s Reset DB removes the selected historical order and execution records. It does not remove chart data or reset simulation accounts. It is therefore not a general fix for an inaccessible path, a frozen chart or every launch failure.

The official guide says Repair DB should be used when directed by NinjaTrader support. Restore Workspace instead retrieves a saved workspace version. Record which operation is proposed and which data it changes before using it.

If startup fails only while a particular workspace loads, follow the workspace diagnostic path. Switching the visible workspace does not close the others: NinjaTrader allows several to remain open. An add-on or strategy restore error likewise needs its own error details instead of an assumed database reset.

Give support a record that separates the causes

Keep this record in the private support case; remove account identifiers and personal paths from public posts. After a repair, check both that the original error has stopped and that the expected local history, workspace and strategy settings remain. If the error returns at the same step, send that sequence instead of repeatedly resetting the database.

  • Exact message, numeric code if present, full file path, and first failure time with time zone.
  • NinjaTrader version, Windows account in use, and the update, crash or storage change immediately before the failure.
  • Whether the same error occurs on a clean launch or only when one workspace or add-on loads.
  • Logs and trace files covering that attempt, plus backup time, selected components and the result of each repair already attempted.

Official sources

NinjaTrader recovery

Keep recovery tied to the intended setup

Ninja Watchdog includes tools for common launch and database-maintenance problems, plus configured platform, connection and strategy recovery. An unresolved database access or corruption error still needs diagnosis. Email alerts are available today; SMS and WhatsApp alerts are coming soon.

Start 30-day free trial