数据库只读模式,只能查询,做其他dml操作都报错:
ERROR: cannot execute XXXXXX in a read-only transaction
select name,setting,unit,context from pg_settings where name ~* 'read_only';
name setting unit context
default_transaction_read_only on user
transaction_read_only on user
set default_transaction_read_only = off;
truncate tzq_log_t; -- 日志表
-- 针对truncate
select concat('PURGE TABLE ',rcyoriginname,';') from gs_recyclebin
where rcyoriginname in(
select -- t2.nspname,
t1.relname as tablename_in_recyclebin
from pg_class t1
join pg_namespace t2 on (t1.relnamespace=t2.oid)
where t1.relkind = 'r'
and t1.relname ~* '^bin'
and t2.nspname = '模式名'
order by 1
);
-- 针对drop
select concat('PURGE TABLE ',rcyoriginname,';') from gs_recyclebin where rcyname in(
select --t2.nspname,
t1.relname as tablename_in_recyclebin
from pg_class t1
join pg_namespace t2 on (t1.relnamespace=t2.oid)
where t1.relkind = 'r'
and t1.relname ~* '^bin'
and t2.nspname = '模式名'
order by 1);
-- 清空当前用户的回收站
PURGE RECYCLEBIN;
-- 清空指定用户的回收站(需要有相应权限)
PURGE DBA_RECYCLEBIN USER username;
/* 查回收站参数 */
select name,setting,unit,context from pg_settings where name ~* 'bin';
/* 查回收站对象 */
select * from my_recyclebin;
-- truncate drop
/* 恢复对象 */
TIMECAPSULE TABLE "BIN$4BE24EB5475$315BC00A480==$0" TO BEFORE TRUNCATE;
本文发布于:2025-04-04 03:55:00,感谢您对本站的认可!
本文链接:https://www.4u4v.net/it/1743710126583737.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
留言与评论(共有 0 条评论) |