Skip to content
Rowsafe
Docs

Your first restore

A 20-minute practice run that never touches your real data.

Practise a restore now, not during an outage. You make a practice database, delete rows on purpose, and get them back with Rewind. About 20 minutes.

Before you start

  • The database's first backup has finished (Quickstart).
  • You are an owner or admin. Members can't restore.
  • Free disk for a copy: about 1.3 × the database size + 1 GB. Rowsafe tells you if there isn't enough.

Make a practice database

Open the server, then Databases & users → Create database. Name it practice. You don't need the password it shows. Create databases and users.

Add a table with 100 rows

The one SQL step, because it's your data. On the server:

sudo -u postgres psql -d practice
CREATE TABLE customers (id int PRIMARY KEY, name text);
INSERT INTO customers SELECT g, 'Customer ' || g FROM generate_series(1, 100) AS g;

In Docker: docker compose exec postgres psql -U postgres -d practice (your own service name and user).

Rowsafe needs a primary key to compare and bring back rows.

Wait two minutes, then delete 40 rows

Waiting makes the "before" moment easy to spot.

DELETE FROM customers WHERE id <= 40;
SELECT count(*) FROM customers;   -- 60

Find the moment

Open the database, then Rewind → Find the moment. Pick deleted rows and the last hour. You see your delete: 40 rows from customers, to the second. Click Rewind to just before this. Find the moment.

Restore a copy

Click Restore a copy. Production keeps running. It takes about as long as a Proof run.

The copy has no network port, so no app connects to it by mistake. It deletes itself after 24 hours by default. Restore a copy.

Compare with production

On the copy's card, click Compare with production and pick customers. You should see Missing in production: 40. Compare with production.

Bring the rows back

Select the table, click Bring back 40 missing rows and type the database name. Rowsafe sets a Mark first, then puts back only the missing rows, in one transaction. Bring back rows.

SELECT count(*) FROM customers;   -- 100 again

Clean up

  • The copy: Delete on its card, or let it expire.
  • The practice database: in Databases & users, its menu → Remove database, then type its name.

Note how long the copy took: a real one on this database takes about as long.

Other ways to practise

  • With a Mark. Set one before you delete (on the database's page, or rowsafe mark app before-practice). Then on Marks, click Restore a copy at this Mark. Marks.
  • On another server. Fork the database to another of your servers. That's close to what Restore to another server does when a server is lost.

Rewinding the whole database is not a practice step

Rewind the whole database replaces your live database and stops PostgreSQL while it works. Never practise it on production.

Edit on GitHub