我使用的是Greenplum DB 4.3版,A表包含我的应用程序的元数据信息,但它被错误地删除了。
有没有办法回滚错误删除的表??
发布于 2015-02-04 16:31:03
如果您使用的是drop table <tablename>,那么什么也帮不上忙-当您提交表文件时,它们就会从文件系统中删除
如果你使用了delete from <tablename>,那么你仍然可以访问这些数据。您需要设置GUC set gp_select_invisible=on -这将允许您查看所有已删除的数据。您需要使用字段xmax来查找被事务删除的数据,我的文章简要介绍了它是如何在幕后工作的:http://0x0fff.com/mvcc-in-transactional-systems/
发布于 2015-02-09 18:27:55
我也有一次被困在上面的情况
如果您更新下面的参数,您还可以检查删除的数据
set gp_select_invisible = on 如果vacuum未运行,则
以下是整个过程
--create a table
create table smpl
( userid integer,
username character varying(35),
password character varying(15),
email character varying(60)
)
--insert some sample date
insert into smpl values(101,'user1','user1','user1@ril.com');
insert into smpl values(103,'user3','user3','user3@ril.com');
insert into smpl values(102,'user2','user2','user2@ril.com');
--Check if data is properly inserted
select *,xmin,xmax,cmin,cmax from smpl (对于新插入的数据,xmax=0)
--delete all data
delete from smpl (已删除数据的最大<>为0)
--if you update below parameter as ON;you can check the deleted data also
set gp_select_invisible = on
select *,xmin,xmax,cmin,cmax from smpl
--vacuum smpl (如果您的朗姆真空删除数据将丢失)
--insert some more data with same id
insert into smpl values(101,'user1','user1','user11@ril.com');
insert into smpl values(103,'user3','user3','user13@ril.com'); (使用xmin和xmax值检查数据)
--if you set it off;you cant check the deleted data
set gp_select_invisible = off
select *,xmin,xmax,cmin,cmax from smpl 谢谢
https://stackoverflow.com/questions/28293769
复制相似问题