# Render Free Postgres Expired? How to Back Up and Move Your Database

Render's free Postgres expires 30 days after creation, then gets deleted. How to dump it with pg_dump, restore it elsewhere, and avoid it happening again.

URL: https://blog.dockhosting.dev/render-free-postgres-expired
Published: 2026-11-06 · Updated: 2026-11-06 · Author: Doughmi ILYAS

## Summary

- Render's free PostgreSQL databases expire 30 days after creation; you then have 14 days to upgrade before the database is deleted.
- Back up first with pg_dump using the database's external URL, then restore with pg_restore into any PostgreSQL host.
- To stop it happening again, move to a free database that doesn't expire or to a paid plan; don't rely on recreating it every month.

**Render's free PostgreSQL databases expire 30 days after they're created.** After that, Render gives you a **14-day grace period** to upgrade to a paid instance, and then the database is deleted. If you got the expiry email or your app suddenly can't connect, here's how to save your data in about 10 minutes and move it somewhere it won't expire again.

> **Do this first:** Take a backup **now**, even if you plan to upgrade. A `pg_dump` file on your laptop is the only copy you fully control.

## Why your Render database expired

Render's [free tier docs](https://render.com/docs/free) say free Postgres instances expire 30 days after creation. Render [shortened this from 90 days](https://render.com/changelog/free-postgresql-instances-now-expire-after-30-days-previously-90). The free tier is designed for trying Render, not for keeping data long-term. Free Postgres also has 256 MB of RAM and 1 GB of storage. Paid Render Postgres starts at $6/month.

You have three options:

1. **Upgrade on Render** (from $6/month) and keep everything where it is.
2. **Recreate a free database every month** and re-import your data. This works, but it's fragile, and one missed month loses everything.
3. **Move to a host whose free database doesn't expire**, or to one you'll pay for anyway.

Whichever you pick, the backup steps are the same.

## Step 1: Get the external connection string

In the Render dashboard, open your database and copy the **External Database URL**. It looks like this:

```text
postgresql://USER:PASSWORD@HOST.render.com/DBNAME
```

Keep it out of your shell history. Put it in a variable for this session only:

```bash
export RENDER_DB_URL='postgresql://…'   # paste yours
```

## Step 2: Back up with pg_dump

Use a `pg_dump` whose major version is the same as or newer than the server's version:

```bash
pg_dump --format=custom --no-owner --no-acl \
  --file=render-backup.dump "$RENDER_DB_URL"
```

- `--format=custom` makes a compressed file that `pg_restore` can restore selectively.
- `--no-owner --no-acl` drops Render-specific roles, so the dump restores cleanly on another host.

Check that the backup isn't empty:

```bash
pg_restore --list render-backup.dump | head
```

Want a plain SQL file you can read? Use `--format=plain --file=render-backup.sql` instead.

## Step 3: Create the new database

On **DockHosting**, create a PostgreSQL database in the dashboard (PostgreSQL 16 by default) and attach it to your project. The Free plan's database is 500 MB and **never expires**. Larger plans give 2 GB (Hobby), 5 GB (Pro) or 20 GB (Team) per database.

> **Importing from your laptop:** Restoring a dump from your own machine uses **public database access**, which is available on Hobby ($4/month) and up. Plan changes are prorated, so you can upgrade for the import and stay on Hobby (daily backups, always-on apps), or move back to Free later if your data fits in 500 MB.

Any PostgreSQL host works for the next step. Just use its external connection string.

## Step 4: Restore with pg_restore

```bash
export NEW_DB_URL='postgresql://…'   # the new database's connection string

pg_restore --no-owner --no-acl --dbname="$NEW_DB_URL" render-backup.dump
```

For a plain SQL dump, use `psql "$NEW_DB_URL" -f render-backup.sql` instead.

Then check that your data arrived:

```bash
psql "$NEW_DB_URL" -c "select count(*) from users;"   # use one of your tables
```

On DockHosting you can also run quick checks with `dock db sql` from the CLI.

## Step 5: Point your app at the new database

If your app reads `DATABASE_URL`, there's nothing to change in the code. On DockHosting, attaching the database injects `DATABASE_URL` into your app automatically, over a private network. On another host, update the variable and redeploy.

Framework examples are in [connecting your app to managed PostgreSQL](/connect-app-to-managed-postgresql).

## Common restore errors

| Error | Fix |
|---|---|
| `role "xyz" does not exist` | Re-run with `--no-owner --no-acl`. |
| `pg_dump: server version mismatch` | Install a `pg_dump` that's the same major version as the server, or newer. |
| `extension "…" is not available` | Create the extension on the new database first, or remove it if unused. |
| `relation already exists` | You're restoring into a non-empty database. Use a fresh one, or add `--clean`. |

## How to avoid this next time

- **Use a database that doesn't expire.** DockHosting's free database never expires.
- **Automate backups.** Paid DockHosting plans include daily backups (kept 3, 7 or 30 days). On any host, a weekly `pg_dump` costs nothing.
- **Keep your connection string in `DATABASE_URL`** so moving hosts is a config change, not a code change.

Comparing free tiers before you pick? See [free backend hosting in 2026](/free-backend-hosting) and [the best Heroku alternatives](/best-heroku-alternatives-2026).

## FAQ

### How long does Render's free Postgres last?

30 days from creation. After it expires, Render gives you a 14-day grace period to upgrade to a paid instance before the database is deleted. Render shortened this from 90 days.

### Can I recover a Render free database after it's deleted?

Plan as if you can't. Take a pg_dump backup before the grace period ends. Once the instance is deleted, don't count on getting the data back.

### Is there a free PostgreSQL database that doesn't expire?

Yes. DockHosting's Free plan includes one managed PostgreSQL database with 500 MB that doesn't pause or expire. It's reachable from your apps over a private network through DATABASE_URL.

### Do I need to change my app's code to switch databases?

Usually not. If your app reads its connection string from DATABASE_URL, point that variable at the new database and redeploy.
