Convert db to sql

Free online DB to SQL converter

Convert supported DB files into editable SQL scripts for migration, backup, or inspection.

Convert DB to SQL online - free

Uploading…
Selected files exceed the 75 MB total limit. Please select fewer or smaller files.

Your file is processed instantly and never stored on our servers.

How it works

  1. 1/3

    Upload your .db file

    Click to browse to select your file you want to convert or simply drag & drop your file into selected area.

  2. 2/3

    Perform .db to .sql conversion

    After successful file upload, click to convert when you are ready.

  3. 3/3

    Download converted .sql file

    Conversion result is ready to download.

How to convert db to sql file

A program that imports SQL scripts, or a team that needs readable database source for migration and archiving, may require a database file to be exported as .sql. The conversion produces text containing schema and data instead of the original binary database file.

What the DB format is

.db is a generic extension, not a single database format. SQLite commonly uses .db, .sqlite, and .sqlite3 files; applications, mobile devices, desktop software, and embedded systems use them to store local data. Other .db files may belong to Microsoft Access, Berkeley DB, dBase-related software, or an application-specific database.

A SQLite database is a self-contained file containing tables, indexes, views, triggers, and stored records. The filename extension does not identify the internal format, so the creating application or the file header must be checked before choosing an exporter. Renaming a file to .sql does not convert it.

What the SQL format is

An .sql file is plain text containing SQL statements such as CREATE TABLE, INSERT, CREATE INDEX, CREATE VIEW, and CREATE TRIGGER. A compatible database engine executes these statements to recreate some or all of the source schema and data.

SQL text can be inspected, edited, stored in version control, backed up, and imported into another database. SQL dialects differ, however: a dump generated by SQLite may need changes before it runs in MySQL, MariaDB, PostgreSQL, or another engine.

How to convert a SQLite DB file

  1. Make a backup of the original file and close software that may still be writing to it.
  2. Check its integrity with the SQLite command-line program:

sqlite3 input.db "PRAGMA integrity_check;"

  1. Export the complete database, including its schema and rows:

sqlite3 input.db .dump > output.sql

The dump usually includes transaction statements, table definitions, indexes, views, triggers, and row inserts. To export one table instead of the complete database, use the table name with the dump command, for example sqlite3 input.db ".dump users" > users.sql.

  1. Test the result by importing it into a new database:

sqlite3 restored.db < output.sql

For a database that may be changing, create a consistent working copy with SQLite's backup command before dumping it:

sqlite3 input.db ".backup 'working.db'"
sqlite3 working.db .dump > output.sql

SQLite desktop applications can perform the same operation through menus such as Database → Export → SQL; the exact menu names depend on the program. If no software installation is desired, supported files can be converted on 101convert.com for free. Do not upload databases containing confidential, personal, or regulated information unless its handling is permitted.

How to convert other DB files

Identify the database engine before exporting. An Access database should be opened with Microsoft Access or migrated through an appropriate ODBC connection; an Access query's SQL view is not necessarily a complete dump of the database. Berkeley DB and application-specific files require their own utilities or the software that created them.

For an already identified MySQL or MariaDB database, use the vendor utility rather than treating an arbitrary file with a .db extension as SQLite:

mysqldump database_name > output.sql

For PostgreSQL, use:

pg_dump --format=p database_name > output.sql

These commands export a database server or named database, not an unknown standalone .db file. A database's native export tool is required when the file format is not documented or recognized.

Compatibility and quality limits

An SQL dump preserves only the objects supported by its exporter. SQLite's dump normally preserves ordinary tables, indexes, views, triggers, and data, but it does not reproduce file permissions, encryption settings, application configuration, external files, or every implementation detail of virtual tables.

When moving the dump to another engine, review identifier quoting, type declarations, AUTOINCREMENT, boolean and date handling, INTEGER PRIMARY KEY behavior, conflict clauses, trigger syntax, foreign keys, collations, and engine-specific pragmas. Test the imported database with representative queries and constraints.

SQL dumps are plain text and may contain all stored records, so protect them like the source database. Large databases produce large files; ZIP or gzip compression reduces storage and transfer size but does not change the exported content.

Frequently asked questions

Is the DB to SQL converter free?

Yes, converting DB to SQL on 101convert.com is completely free. No registration, email address or installation is required. If you need a higher file size limit or want to convert more files at once, see our plans.

How large can my DB file be?

You can upload DB files up to 50 MB and convert up to 20 files at once in a single batch.

What happens to my uploaded files?

Files are processed automatically and deleted from our servers within a few minutes after conversion. We never view or share your files.

Do I need to install any software to convert DB to SQL?

No. The DB to SQL conversion runs entirely online in your browser and works on Windows, Mac, Linux, Android and iPhone.

Did the conversion fail?

In most cases, the cause is an incorrect file format. Please upload a valid DB file for this DB to SQL conversion. Occasionally, the issue may be on our side. We analyze recurring conversion failures and disable or fix the converter if we detect a defect.