How in H2DB get sql dump like in MySql?

后端 未结 2 1298
孤独总比滥情好
孤独总比滥情好 2020-12-02 12:10

I have some questions about H2DB. I have H2DB database which stores data in files, I have 3 files test.18.log.db, test.data.db, test.index.db. I want get sql dump file like

相关标签:
2条回答
  • 2020-12-02 12:43

    If you want to get schema and data, you can use

    SCRIPT TO 'dump.sql';
    

    If you want to get only schema, you can use

    SCRIPT SIMPLE TO 'dump.txt';
    
    0 讨论(0)
  • 2020-12-02 12:51

    Yes, there are multiple solutions. One is to run the SCRIPT SQL statement:

    SCRIPT TO 'fileName'
    

    Another is to use the Script tool:

    java org.h2.tools.Script -url <url> -user <user> -password <password>
    

    Then, there are also the RUNSCRIPT statement and RunScript tool.

    By the way, you should consider upgrading to a more recent version of H2. With newer versions, the two files .data.db and .index.db are combined in to a .h2.db file.

    0 讨论(0)
提交回复
热议问题