H2 SCRIPT命令是否像快照一样工作? [英] Does the H2 SCRIPT command work like a snapshot?

查看:326
本文介绍了H2 SCRIPT命令是否像快照一样工作?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

H2数据库具有称为SCRIPT的命令来备份内容和/或结构。它可以在数据库运行时执行。



我的问题是:SCRIPT是否像快照一样工作?它只接收语句和数据库内容,直到发出SCRIPT命令为止吗?



$ b

编辑 b

为了澄清这个问题,SCRIPT的用法有两个模糊之处:




  • SCRIPT确保事务安全/ a>
  • SCRIPT产生的输出是否小于BACKUP?



解决方案

我要求这个问题, code> SCRIPT 命令在开始时锁定每个表(用于读取)。因此,生成的SQL脚本在事务上是一致的。请注意,其他操作在操作完成之前被阻塞(即使使用多线程选项)。


SCRIPT产生较小的输出比BACKUP?


这取决于数据。通常SQL脚本有点小,但不多。当使用压缩时,它相当小。脚本的主要优点是你有一个人类可读的备份,这不是绑定到软件(H2的文件格式可能会改变,但SQL不会)。


H2 database has a command called SCRIPT to backup content and/or structure. It can be performed while the database is running.

My question is: Does SCRIPT work like a snapshot? Does it only take statement and database content up until the SCRIPT command is issued? Or does it try to take additional statements performed by other processes into account while SCRIPT is being executed?

EDIT

To clarify the question, there are two ambiguities about the usage of SCRIPT:

  • Does SCRIPT guarantee transactional safety/consistency while performed when database is running?
  • Is SCRIPT producing a smaller output than BACKUP?

I am asking this question to know whether I should interrupt some queries while performing a backup of my database.

解决方案

The SCRIPT command locks each table (for reading) at the beginning. So the resulting SQL script is transactionally consistent. Please note other operations are blocked until the operation is complete (even when using the multi-threaded option).

Is SCRIPT producing a smaller output than BACKUP?

It depends on the data. Usually the SQL script is a bit smaller, but not much. It is quite a lot smaller when using compression. The main advantage of the script is that you have a human readable backup which is not tied that much to the software (the file format of H2 might change, but SQL will not).

这篇关于H2 SCRIPT命令是否像快照一样工作?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆