Is there any tool or script available?
I think what you're looking for is:
sqlite x.db .dump > output.sql
This will dump the SQL to regenerate a database