GBase 8a 备份恢复gcrcman

GBase提供备份恢复工具gcrcman,支持库级备份、表级备份

使用前需要安装pexpect

官网下载ptyprocess · PyPI

官网下载pexpect · PyPI 

[root@bogon opt]# tar -zxvf pexpect-4.8.0.tar.gz
[root@bogon opt]# tar -zxvf ptyprocess-0.7.0.tar.gz

[root@bogon opt]# cd /opt/pexpect-4.8.0/
[root@bogon pexpect-4.8.0]# python /opt/pexpect-4.8.0/setup.py install

[root@bogon pexpect-4.8.0]# cd /opt/ptyprocess-0.7.0
[root@bogon ptyprocess-0.7.0]# python setup.py install

表备份

[gbase@bogon bin]$ mkdir -p /home/gbase/backuptest/
[gbase@bogon bin]$ gcrcman.py -d /home/gbase/backuptest/ -p gbase20110531 -U gbase -P gbase

gcrcman>backup table test.t2 level 0
03.12 20:03:53  BackUp table vcname000001.test.t2 start 
--------------------------------------------
03.12 20:03:54  node (192.168.61.173)  backup table begin 
03.12 20:03:54  node (192.168.61.174)  backup table begin 
03.12 20:03:54  node (192.168.61.175)  backup table begin 
03.12 20:04:12  node (192.168.61.173)  backup table success 
03.12 20:04:12  node (192.168.61.174)  backup table success 
03.12 20:04:12  node (192.168.61.175)  backup table success 
--------------------------------------------
03.12 20:04:12  BackUp table vcname000001.test.t2 end 
gcrcman>show backup
cycle	point	level	time
0	0	0	2023-03-12 20:03:54

[gbase@bogon bin]$ cd /home/gbase/backuptest/
[gbase@bogon backuptest]$ ll
total 0
drwxrwxr-x 3 gbase gbase 96 Mar 12 20:04 GclusterData_coordinator1_node2

表恢复

[gbase@bogon bin]$ gcrcman.py -d/home/gbase/backuptest/ -p Gbase20110531! -U root -P gbase
gcrcman>show backup  
cycle	point	level	time
0	0	0	2023-03-12 20:03:54
gcrcman>recover table test.t2
03.12 20:13:55  check Table topology start 
--------------------------------------------
03.12 20:13:55  node (192.168.61.173)  check table topology begin 
03.12 20:13:56  node (192.168.61.173)  check table topology success 
--------------------------------------------
03.12 20:13:56  check table topology success 
03.12 20:13:56  check Table BackUp start 
--------------------------------------------
03.12 20:13:56  node (192.168.61.173)  check table backup begin 
03.12 20:13:56  node (192.168.61.174)  check table backup begin 
03.12 20:13:56  node (192.168.61.175)  check table backup begin 
03.12 20:14:05  node (192.168.61.173)  check table backup success 
03.12 20:14:05  node (192.168.61.174)  check table backup success 
03.12 20:14:05  node (192.168.61.175)  check table backup success 
--------------------------------------------
03.12 20:14:05  check table BackUp success 
03.12 20:14:05  refresh table vcname000001.test.t2 start 
03.12 20:14:05  node (192.168.61.173)  recreate table begin 
03.12 20:14:06  node (192.168.61.173)  recreate table success 
03.12 20:14:06  refresh table vcname000001.test.t2 end 
03.12 20:14:06  Recover table vcname000001.test.t2 start 
--------------------------------------------
03.12 20:14:06  node (192.168.61.173)  Recover table begin 
03.12 20:14:06  node (192.168.61.174)  Recover table begin 
03.12 20:14:06  node (192.168.61.175)  Recover table begin 
03.12 20:14:21  node (192.168.61.173)  Recover table success 
03.12 20:14:21  node (192.168.61.174)  Recover table success 
03.12 20:14:21  node (192.168.61.175)  Recover table success 
--------------------------------------------
03.12 20:14:21  Recover table vcname000001.test.t2 success, please refresh it! 


[gbase@bogon bin]$ gccli -uroot -pGbase20110531!

GBase client 9.5.3.27.14_patch.1b41b5c1. Copyright (c) 2004-2023, GBase.  All Rights Reserved.

gbase> refresh table test.t2;       
Query OK, 0 rows affected (Elapsed: 00:00:00.01)

gbase> select * from test.t2;
+------+
| no   |
+------+
|    2 |
+------+
1 row in set (Elapsed: 00:00:00.01)

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
gbase 8a 是一款国产的高性能关系型数据库管理系统,与MySQL是两款不同的数据库软件,因此不能直接使用MySQL的驱动来连接gbase 8a。 不过,gbase 8a提供了自己的ODBC驱动,可以使用ODBC的方式来连接gbase 8a数据库。在Java中,我们可以使用JDBC-ODBC桥来连接gbase 8a数据库,具体步骤如下: 1. 安装gbase 8a ODBC驱动,可以从gbase官网下载或联系gbase技术支持获取下载链接。 2. 配置ODBC数据源,在控制面板中打开“ODBC数据源”窗口,添加一个gbase的数据源,填写相应的连接信息。 3. 在Java中使用JDBC-ODBC桥来连接gbase 8a数据库,示例代码如下: ``` String url = "jdbc:odbc:yourdataresource"; // 数据源名称 String user = "username"; // 数据库用户名 String password = "password"; // 数据库密码 Class.forName("sun.jdbc.odbc.JdbcOdbcDriver"); Connection conn = DriverManager.getConnection(url, user, password); ``` 在上述代码中,"jdbc:odbc:yourdataresource" 中的 "yourdataresource" 是ODBC数据源的名称,user 和 password 分别是gbase 8a数据库的用户名和密码。通过 Class.forName() 加载 JDBC-ODBC桥的驱动程序,在 DriverManager.getConnection() 方法中传入连接字符串、用户名和密码来获取连接对象。 4. 进行数据库操作,使用JDBC标准的API进行数据库操作,例如: ``` Statement stmt = conn.createStatement(); ResultSet rs = stmt.executeQuery("SELECT * FROM tableName"); while (rs.next()) { int id = rs.getInt("id"); String name = rs.getString("name"); //处理查询结果 } rs.close(); stmt.close(); conn.close(); ``` 以上就是使用JDBC-ODBC桥连接gbase 8a数据库的基本步骤,希望对您有所帮助。

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值