Identifying dropped databases, tables, and other objects and restoring them using Time Travel
Time Travel can be used to recover tables, schemas, and even complete databases. In this recipe, we are given a scenario where a database and other objects have been deleted. We will identify what has been deleted and recover them back to the previous state.
Getting ready
You will need to be connected to your Snowflake instance via the web UI or the SnowSQL client to execute this recipe.
How to do it…
We will first create a database, then two schemas in that database, and some tables within those schemas. We will then gradually delete the tables, schemas, and eventually the complete database. Then we will try to recover them through the Time Travel feature:
- We will start by creating a new database, followed by the creation of a schema. To do so, run the following SQL:
CREATE DATABASE C8_R3; CREATE SCHEMA SCHEMA1;
- Next, we will create a test table called
CUSTOMER...