Thursday, July 9, 2026

.::: SOP Restore table production without lost data in MariaDB :::.

 

1. server

source 
ip         : 10.10.10.90 
db         : teguhthdb
table    : pembelian 

destination
ip         : 10.10.10.90 
db         : teguhth
table    : pembelian 
 
 
2. capture pembelian source 
 

3. capture pembelian destination

4. backup table pembelian from source 

mysqldump -u root -p teguhthdb pembelian > table_teguhthdb_pembelian_source.sql ;

mariadb-dump -u root -p teguhthdb pembelian > table_teguhthdb_pembelian_source.sql ;
 


5. backup table pembelian from destination before replace 

mysqldump -u root -p teguhth pembelian > table_teguhth_pembelian_desc.sql ;

mariadb-dump -u root -p teguhth pembelian > table_teguhth_pembelian_desc.sql ;

 
6. rename table pembelian destination (teguhth)

use teguhth
rename table pembelian to pembelian_backup;
 

7. restore table pembelian destination (teguhth) using source 

use teguhth

source table_teguhthdb_pembelian_source.sql;

source /data/source/table_teguhthdb_pembelian_source.sql;

 


8. check table after resource 
use teguhth
select * from pembelian;
select * from pembelian_backup;

 


9. insert table pembelian using restore using table pembelian_backup;

insert ignore into pembelian select * from pembelian_backup;
 


10. check table after insert into  
use teguhth
select * from pembelian;
 




No comments:

Post a Comment

Popular Posts