--- title: "Schedule snapshots of a database" description: "Set a TIR DBaaS database to take snapshots every 6 hours, daily, weekly or on a cron schedule, choose how many to keep, and turn it off." content_type: "how-to" product: "tir-dbaas" platform: "TIR" url: "/tir/tir-dbaas/how-to/schedule-snapshots/" topic: ["snapshots"] --- # Schedule snapshots of a database A snapshot schedule takes snapshots of a database on a timetable, so each one is taken for you. You choose how often, at what time, and how many scheduled snapshots to keep. Older scheduled snapshots are removed as new ones arrive. ## Before you begin - A database in any status except **Terminating** or **Failed**. You can set a schedule while the database is **Stopped**, too. - The update and create permissions for DBaaS in the project. See [TIR Access Control](/tir/tir-iam/). ## Set the schedule 1. On the database's details page, open the **Snapshots** tab and select **Schedule Snapshot**. The first schedule starts as **Daily** at 02:00 IST, keeping 7 snapshots. 2. In **Snapshot Frequency**, choose how often to take a snapshot: - **Every 6 hours** takes a snapshot at 00:00, 06:00, 12:00 and 18:00 IST. - **Daily** takes one snapshot a day at the time you set in **Run At (IST)**. - **Weekly** takes one snapshot a week, on the **Day of Week** you choose, at the time you set in **Run At (IST)**. - **Custom Cron** takes snapshots on a timetable you write as a cron expression. 3. For **Daily** or **Weekly**, set **Run At (IST)** to an hour from 00 to 23 and a minute from 00 to 59. A snapshot adds disk load while it runs, so choose an hour when the database is quiet. 4. For **Custom Cron**, enter a five-field cron expression in **Cron Expression (IST)**: minute (0–59), hour (0–23), day of month (1–31), month (1–12) and weekday (0–6). For example, `30 7 * * *` takes a snapshot every day at 07:30 IST. Once the expression is valid, TIR gives the next three runs so that you can check it. 5. In **Snapshots to Keep**, enter how many scheduled snapshots to keep, from 1 to 60. 6. Select **Schedule Snapshot**. All schedule times are in Indian Standard Time (Asia/Kolkata). TIR turns automatic snapshots on. The schedule, with its next run, is spelled out above the list on the **Snapshots** tab and under **Automatic Snapshots** on the **Overview** tab. ## How scheduled snapshots are taken and kept - Each scheduled snapshot is listed on the **Snapshots** tab as **Scheduled**. On **Activity Timeline**, it is recorded as "Scheduled snapshot created" by **Snapshot schedule**. - A scheduled snapshot is taken only while the database is **Running**. A run that falls while the database is **Stopped** is skipped. - After each scheduled snapshot, the schedule deletes the oldest scheduled snapshots beyond your **Snapshots to Keep** number. - The schedule deletes only scheduled snapshots and leaves manual ones in place. If you lower **Snapshots to Keep**, the extra scheduled snapshots stay until the next scheduled snapshot, which removes them. To keep the data in a scheduled snapshot that is about to be removed, restore it into a new database first. ## Change the schedule 1. On the **Snapshots** tab, select **Edit Schedule**. 2. Change the frequency, the time or **Snapshots to Keep**. 3. Select **Save Schedule**. If the new schedule cannot be applied, the old one stays, and you can try again. ## Turn the schedule off 1. On the **Snapshots** tab, select **Edit Schedule**. 2. Select **Turn Off Schedule**. Automatic snapshots stop, and every snapshot already taken is kept. You can open the schedule and turn it off in any database status. When you set a schedule again, it starts from your last settings. Deleting a database also turns its schedule off. See [Delete a database](/tir/tir-dbaas/how-to/delete-a-database/). To take a snapshot now, see [Take a snapshot of a database](/tir/tir-dbaas/how-to/take-a-snapshot/). To bring back data from any snapshot, see [Restore a database from a snapshot](/tir/tir-dbaas/how-to/restore-from-a-snapshot/).