1.导出。
[omm@gauss001 user1]$ gs_dump -U user1 -W User01#123 -f /home/omm/backup/user1.tar -p 30100 db1 -F t
gs_dump[user='user1'][localhost][port='30100'][db1][2024-04-09 14:53:54]: The total objects number is 449.
gs_dump[user='user1'][localhost][port='30100'][db1][2024-04-09 14:53:54]: [100.00%] 449 objects have been dumped.
gs_dump[user='user1'][localhost][port='30100'][db1][2024-04-09 14:53:54]: dump database db1 successfully
gs_dump[user='user1'][localhost][port='30100'][db1][2024-04-09 14:53:54]: total time: 3785 ms
2.恢复
db1=> truncate table test1;
TRUNCATE TABLE
db1=> truncate table test2;
TRUNCATE TABLE
--这里不做清理也是可以的。恢复时自动删除。
gs_restore -U user1 -W User01#123 /home/omm/backup/user1.tar -p 30100 -d db1 -e -c
[omm@gauss001 user1]$ gs_restore -U user1 -W User01#123 /home/omm/backup/user1.tar -p 30100 -d db1 -e -c
start restore operation ...
table test1 complete data imported !
table test2 complete data imported !
Finish reading 8 SQL statements!
end restore operation ...
restore operation successful
total time: 46 ms
db1=> select * from test1;
1
2
3
db1=> select * from test2;
1 | 薛双奇1
2 | 薛双奇2