备份与恢复
=================

sys_dump
---------------------------------------------------------

sys_dump备份成sql格式报错
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

**问题描述：**

KingbaseES sys_dump备份成dump格式可以正常备份，备份成sql格式报错。

.. figure:: images/cluster_FAQ9139.png
   :width:  554px
   :height: 301px

**分析与解决方法：**

在同一主机安装了不同版本的KingbaseES数据库软件，在使用sys_dump备份时，使用了其他版本，导致错误。

如何导出一致时间点的数据
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

**问题描述：**

默认sys_dump 导出的数据是表级的一致性，也就是对表发出copy命令时间点已提交的数据，但由于不同表copy时间点不同，因此，sys_dump导出的数据不是完全一致时间点。如何导出一致时间点数据？

**分析与解决方法：**

Session A: sys_export_snapshot实际返回的是当前事务ID，实际可以不需要isolation level repeatable read。 

.. figure:: images/FAQ31140.png
   :width: 554px
   :height: 125px

Session B: sys_dump --snapshot=00000806-1

Session A: 结束事务

.. note::

   Sesssion B 导出的是Session A 运行sys_export_snapshot时间点已提交的数据，即使在导出过程中其他会话对数据库进行了修改并提交。



sys_restore 
---------------------------------------------------------

sys_restore报错too many Command-line arguments
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

**问题描述：**

sys_restore 报错：sys_restore:error:too many Command-line arguments(first is "system")

**分析与解决方法：**

操作人员在手工输入命令行时，没有区分英文和中文字符，导致命令行执行错误。


sys_rman
---------------------------------------------------------

sys_rman备份报“current time may be rewound”
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

**问题描述：**

sys_rman 报错： current time may be rewound

**分析与解决方法：**

数据库初始化后，系统往回修改了时间（从2029年改回2020年），备份时由于存在比当前时间之后的数据库对象，导致备份失败。

处理：使用sys_dump 导出、导入后，sys_rman 备份正常。

sys_rman OPENSSL问题
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

**问题描述：**

用户使用sys_rman可能会遇到如下错误：

.. code::

   could not load the shared library:crypto/dso/dso_dlfcn.c:113:filename(libssl_conf.so):
   libssl_conf.so: cannot open shared object file: No such file or directory

**分析与解决方法：**

在UOS/Debain的系统中，修改配置文件/etc/profile 增加一行：export OPENSSL_CONF=/etc/ssl/

如果还未能解决问题，可以修改archive_command，在命令行前加“export OPENSSL_CONF=/etc/ssl/”

