Sanitize a Database¶
Given the example configuration for the sakila
target, we can sanitize the datbase with the snapshot we created in the Snapshot Build and Load example.
Target: sakila - sanitize configuration
Here is our snapshot from the prior example:
Now we're ready to sanitize this snapshot of the sakila
target which can be done with the sanitize
command:
Output:
DBSnapper Agent - Version: 2.0.0-alpha-dev Build Date: 2024-02-20T07:46:10-07:00
DBSnapper Cloud: Enabled
START: Sanitize Snapshot #0, Name: 1708236890_sakila
-> LOADING original Snapshot #0: Name: 1708236890_sakila, Snapshot File: 1708236890_sakila.zip, Dest DB URL: mysql://root:mysql@localhost:3306/sakila_sanitized?tls=false
--> Using engine: mysql-local
--> Using Target: sakila
--> Pulling to local file: /Users/snappy/.dbsnapper/1708236890_sakila.zip
--> Local snapshot already exists at /Users/snappy/.dbsnapper/1708236890_sakila.zip
--> Pulled snapshot 1708236890_sakila to /Users/snappy/.dbsnapper/1708236890_sakila.zip
--> Unzipping snapshot /Users/snappy/.dbsnapper/1708236890_sakila.zip to /var/folders/z5/n821ctqx34nb__xp15r69p9h0000gp/T/dbsnapper-1815162460
--> Dropping and recreating database myl://localhost:3306/sakila_sanitized
-> LOADING Snapshot Completed for Target: sakila
--> Executing sanitization query
--> Building sanitized snapshot
--> Zipping snapshot 1708236890_sakila to /Users/snappy/.dbsnapper/1708236890_sakila.san.zip
--> Sanitized snapshot '1708236890_sakila' created at /Users/snappy/.dbsnapper/1708236890_sakila.san.zip
FINISHED Sanitizing snapshot
When this is finished you can list the sakila
target snapshot:
Output:
In this output, we now see that SANITIZED?
column is true
and the SANFN
column shows the name of the sanitized snapshot file that is located in the working directory.