达梦DM8自带备份工具console备份失败的问题
最近学习达梦DM8数据库使用,其提供了一个图形界面的备份工具,位于tool目录下,名称叫console,使用中发现总是备份失败,通过命令行备份工具dmrman备份后,用该工具尝试恢复也报错,检查目录发现备份数据是恢复到了data目录,但数据文件拥有者变成root用户了,不是数据库安装用户dmdba,怀疑是由于console使用root用户启动的问题
尝试用dmdba用户启动console工具,报错如下
[dmdba@localhost tool]$ ./console
<title>Invalid Configuration Location</title>Locking is not possible in the
directory "/dm8/tool/configuration/org.eclipse.osgi". A common reason is
that the file system or Runtime Environment does not support file locking
for that location. Please choose a different location, or disable file
locking passing "-Dosgi.locking=none" as a VM argument.
/dm8/tool/configuration/org.eclipse.osgi/.manager/.fileTableLock (权限不够)
检查/tool/configuration/目录,发现org.eclipse.osgi目录用户是root。
-rw-r--r-- 1 dmdba dinstall 4114 1\u6708 27 16:48 1611737311297.log
-rwxr-xr-x 1 dmdba dinstall 623 1\u6708 26 08:07 config.ini
drwxr-xr-x 3 root root 163 1\u6708 26 08:15 org.eclipse.core.runtime
drwxr-xr-x 3 root root 22 1\u6708 26 08:11 org.eclipse.equinox.app
drwxr-xr-x 2 dmdba dinstall 26 1\u6708 26 08:07 org.eclipse.equinox.simpleconfigurator
drwxr-xr-x 4 root root 89 1\u6708 26 08:15 org.eclipse.osgi
在root用户下修改目录拥有者为dmdba
[root@localhost configuration]# chown dmdba:dinstall -R org.eclipse.osgi/
[root@localhost configuration]# ls -al
\u603b\u7528\u91cf 20
drwxr-xr-x 6 dmdba dinstall 207 1\u6708 27 17:11 .
drwxr-xr-x 9 dmdba dinstall 4096 1\u6708 27 17:11 ..
-rw-r--r-- 1 dmdba dinstall 4114 1\u6708 27 16:48 1611737311297.log
-rw-r--r-- 1 dmdba dinstall 3682 1\u6708 27 17:11 1611738679719.log
-rwxr-xr-x 1 dmdba dinstall 623 1\u6708 26 08:07 config.ini
drwxr-xr-x 3 root root 163 1\u6708 26 08:15 org.eclipse.core.runtime
drwxr-xr-x 3 root root 22 1\u6708 26 08:11 org.eclipse.equinox.app
drwxr-xr-x 2 dmdba dinstall 26 1\u6708 26 08:07 org.eclipse.equinox.simpleconfigurator
drwxr-xr-x 4 dmdba dinstall 89 1\u6708 26 08:15 org.eclipse.osgi
再次尝试用dmdba用户启动console,这次报错是
[dmdba@localhost tool]$ ./console
An error has occurred. See the log file
/dm8/tool/configuration/1611738779714.log.
查看/dm8/tool/configuration/1611738779714.log日志文件,可以看到报错
java.lang.IllegalStateException: The platform metadata area could not be
written: /dm8/tool/workspace/console/.metadata. By default the platform
writes its content
检查/dm8/tool/workspace/console/目录,发现拥有者也是root,修改目录拥有者
[root@localhost workspace]# ls -al
\u603b\u7528\u91cf 4
drwxr-xr-x 6 dmdba dinstall 61 1\u6708 26 08:15 .
drwxr-xr-x 9 dmdba dinstall 4096 1\u6708 27 17:12 ..
drwxr-xr-x 3 root root 23 1\u6708 26 08:15 console
drwxr-xr-x 3 dmdba dinstall 23 1\u6708 26 08:11 help
drwxr-xr-x 4 dmdba dinstall 29 1\u6708 26 08:07 local
drwxr-xr-x 3 root root 55 1\u6708 26 08:11 manager
[root@localhost workspace]# chown dmdba:dinstall -R console/
[root@localhost workspace]# ls -al
\u603b\u7528\u91cf 4
drwxr-xr-x 6 dmdba dinstall 61 1\u6708 26 08:15 .
drwxr-xr-x 9 dmdba dinstall 4096 1\u6708 27 17:18 ..
drwxr-xr-x 3 dmdba dinstall 23 1\u6708 26 08:15 console
drwxr-xr-x 3 dmdba dinstall 23 1\u6708 26 08:11 help
drwxr-xr-x 4 dmdba dinstall 29 1\u6708 26 08:07 local
drwxr-xr-x 3 root root 55 1\u6708 26 08:11 manager
再次尝试用dmdba用户启动console,这次可以正常启动了,测试备份及恢复成功,问题解决