Advertisement
Guest User

Untitled

a guest
Feb 18th, 2016
79
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.89 KB | None | 0 0
  1. #!/bin/sh
  2.  
  3. db=$1
  4.  
  5. tables=`mysql -ss -u root -p -e "SHOW TABLES" $db`
  6. for i in $tables
  7. do
  8. #Check how many rows has a table
  9. rows=`mysql -u root -p -e "SELECT COUNT(*) FROM $i" -s $db`
  10. # Prepare environment
  11. echo "Restoring table $i"
  12. table=$i
  13. perl create_defs.pl --host=localhost --user=root --password=YOUR_PASSWORD --db=$1 --table=$table > include/table_defs.h.$table
  14. cd include && rm -f table_defs.h && ln -s table_defs.h.$table table_defs.h
  15. cd ..
  16. make clean all
  17. # Restoring rows
  18. found=0
  19. while [ $found -lt 1 ]
  20. do
  21. echo ""
  22. ./constraints_parser -5 -f /var/lib/mysql/ibdata1.recovery >> out.$i
  23. found=1
  24. done
  25. done
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement