This article shows how to restore a DB snapshot from Staging or Production on Adobe Commerce on cloud infrastructure.
Choose the most appropriate for your case:
The steps are:
Using sFTP, navigate to the location where the database snapshot has been placed, usually on the first server/node of your cluster (For example: /mnt/recovery-<recovery_id>
).
Copy the database dump file (For example: <cluster ID>.sql.gz
for Production or <cluster ID_stg>.sql.gz
for Staging) to your local computer.
Make sure you have set up the SSH tunnel to connect to the database remotely: SSH and sFTP: SSH tunneling in our developer documentation.
Connect to the database.
mysql -h <db-host> -P <db-port> -p -u <db-user> <db-name>
Drop the database; at the MariaDB prompt, enter:
(For Production)
drop database <cluster ID>;
(For Staging)
drop database <cluster ID_stg>;
Enter the following command to import the snapshot:
(For Production)
zcat <cluster ID>.sql.gz | sed -e 's/DEFINER[ ]*=[ ]*[^*]*\*/\*/' | mysql -h 127.0.0.1 -P <db-port> -p -u <db-user> <db-name>
(For Staging)
zcat <cluster ID_stg>.sql.gz | sed -e 's/DEFINER[ ]*=[ ]*[^*]*\*/\*/' | mysql -h 127.0.0.1 -P <db-port> -p -u <db-user> <db-name>
The steps are:
Navigate to the location where the database snapshot has been placed, usually on the first server/node of your cluster (For example: /mnt/recovery-<recovery_id>
).
To drop and re-create the cloud database, first connect to the database:
mysql -h 127.0.0.1 -P <db-port> -p -u <db-user> <db-name>
Drop the database; at the MariaDB prompt, enter:
(For Production)
drop database <cluster ID>;
(For Staging)
drop database <cluster ID_stg>;
Enter the following command to import the snapshot:
(For Production)
zcat <cluster ID>.sql.gz | sed -e 's/DEFINER[ ]*=[ ]*[^*]*\*/\*/' | mysql -h 127.0.0.1 -p -u <db-user> <db-name>
(For Staging)
zcat <cluster ID_stg>.sql.gz | sed -e 's/DEFINER[ ]*=[ ]*[^*]*\*/\*/' | mysql -h 127.0.0.1 -p -u <db-user> <db-name>
In our developer documentation: