# Database disk image malformed after a crash

**URL:** <https://forum.storj.io/t/database-disk-image-malformed-after-a-crash/5708>\
**Category:** FAQ\
**Tags:** iscsi, database\
**Created:** [April 7, 2020, 8:44am UTC](https://forum.storj.io/t/database-disk-image-malformed-after-a-crash/5708 "2020-04-07T08:44:26Z")\
**Posts on this page:** 1\
**Showing post:** 4

<div class="post-metadata">

**Author:** ![Alexey](https://storj.bcdn.literatehosting.com/user_avatar/forum.storj.io/alexey/32/41_2.png) [@Alexey](https://forum.storj.io/u/Alexey)\
**Post date:** [April 7, 2020, 9:24pm UTC](https://forum.storj.io/t/database-disk-image-malformed-after-a-crash/5708/4 "2020-04-07T21:24:50Z")

</div>

Make sure that you used version of sqlite3 not older than v3.25.2.  
If it’s, then your `orders.db` is heavily corrupted. In such case we will recreate it.

1. Stop the storagenode
2. Remove the `orders.db`
3. Execute either with a local sqlite3 or with a docker:

```auto
sqlite3 orders.db
CREATE TABLE unsent_order (
                                                satellite_id BLOB NOT NULL,
                                                serial_number BLOB NOT NULL,

                                                order_limit_serialized BLOB NOT NULL, -- serialized pb.OrderLimit
                                                order_serialized BLOB NOT NULL, -- serialized pb.Order
                                                order_limit_expiration TIMESTAMP NOT NULL, -- when is the deadline for sending it

                                                uplink_cert_id INTEGER NOT NULL,

                                                FOREIGN KEY(uplink_cert_id) REFERENCES certificate(cert_id)
                                        );
CREATE TABLE order_archive_ (
                                                satellite_id BLOB NOT NULL,
                                                serial_number BLOB NOT NULL,

                                                order_limit_serialized BLOB NOT NULL,
                                                order_serialized BLOB NOT NULL,

                                                uplink_cert_id INTEGER NOT NULL,

                                                status INTEGER NOT NULL,
                                                archived_at TIMESTAMP NOT NULL,

                                                FOREIGN KEY(uplink_cert_id) REFERENCES certificate(cert_id)
                                        );
CREATE UNIQUE INDEX idx_orders ON unsent_order(satellite_id, serial_number);
CREATE TABLE versions (version int, commited_at text);
CREATE INDEX idx_order_archived_at ON order_archive_(archived_at);
.exit

```

1. Try to start storagenode
2. Look into logs

---

_[View the full topic](https://forum.storj.io/t/database-disk-image-malformed-after-a-crash/5708)._
