标签云
asm恢复 bbed bootstrap$ dul kcbzib_kcrsds_1 kccpb_sanity_check_2 kcratr_nab_less_than_odr MySQL恢复 obet ORA-00312 ORA-00704 ORA-00742 ORA-01110 ORA-01200 ORA-01555 ORA-01578 ORA-01595 ORA-600 2662 ORA-600 2663 ORA-600 3020 ORA-600 4000 ORA-600 4137 ORA-600 4193 ORA-600 4194 ORA-600 16703 ORA-600 kcbzib_kcrsds_1 ORA-600 KCLCHKBLK_4 ORA-600 kcratr_nab_less_than_odr ORA-15042 ORA-15196 ORACLE 12C oracle dul ORACLE PATCH Oracle Recovery Tools oracle加密恢复 oracle勒索 oracle勒索恢复 oracle异常恢复 ORACLE恢复 Oracle 恢复 ORACLE数据库恢复 oracle碎片 OSD-04016 YOUR FILES ARE ENCRYPTED 比特币加密文章分类
- MongoDB (1)
- MongoDB恢复 (1)
- Others (2)
- 中间件 (2)
- WebLogic (2)
- 操作系统 (112)
- 数据库 (1,883)
- DB2 (22)
- MySQL (82)
- Oracle (1,708)
- Data Guard (53)
- EXADATA (8)
- GoldenGate (24)
- ORA-xxxxx (168)
- ORACLE 12C (72)
- ORACLE 18C (6)
- ORACLE 19C (15)
- ORACLE 21C (3)
- Oracle 23ai (8)
- Oracle ASM (72)
- Oracle Bug (8)
- Oracle RAC (56)
- Oracle 安全 (6)
- Oracle 开发 (28)
- Oracle 监听 (29)
- Oracle备份恢复 (662)
- Oracle安装升级 (108)
- Oracle性能优化 (62)
- 专题索引 (5)
- 勒索恢复 (91)
- PostgreSQL (37)
- pdu工具 (7)
- PostgreSQL恢复 (13)
- SQL Server (34)
- SQL Server恢复 (14)
- TimesTen (7)
- 达梦数据库 (5)
- 达梦恢复 (3)
- 生活娱乐 (2)
- 至理名言 (11)
- 虚拟化 (2)
- VMware (2)
- 软件开发 (51)
- Asp.Net (9)
- JavaScript (12)
- PHP (2)
- 小工具 (34)
- MongoDB (1)
-
最近发表
- aix平台Oracle数据库由于断电无法启动故障处理
- 断电引起ORA-600 3005故障处理
- 记录一次云存储资源到期之后引起的数据库恢复
- Firebird 损坏数据库数据抢救工具—firebirdext
- Oracle 19c 202610补丁(RUs+OJVM)-19.33
- 由于con$.con#值达到极限,触发数据库增加约束报ORA-600 12807错误
- MongoDB 离线提取工具—mongoext
- .bres勒索病毒加密数据库dmp文件可恢复
- ORA-600 krsm_mrp_rebuild_lf_list.lno_mismatch
- 记录一次0丢失的ORA-00354: 损坏重做日志块标头故障恢复
- 不当数据库恢复操作导致一个月数据丢失
- obet快速修复oracle 位图损坏块
- 不太常见的10.2.0.1的oracle redo损坏恢复
- obet forcecopy功能抢救硬件故障中的数据文件
- kcratr_nab_less_than_odr和system坏块故障处理
- 通过obet 恢复system坏块,打开数据库
- obet dbv功能完整说明
- 分享一例运行在aix上的sap系统数据库恢复过程
- OBET-Oracle Block Editor Tool使用说明
- 几乎动用了所有手段的Oracle故障恢复
标签归档:单个pg文件恢复
PostgreSQL恢复工具—pdu恢复单个表文件
在某些情况下,比如我们需要对单个的PostgreSQL库的表文件进行恢复(比如文件系统损坏,drop库/表,truncate表等原因,然后找到了部分oid文件),可以使用pdu对其进行完美恢复(相比pg_filedump也方便很多),具体操作步骤:
1. 由于只有单个表文件,无法获取字典信息,因此需要应用厂商/客户提供具体表创建语句
his5_dms=# CREATE TABLE t_xff ( his5_dms(# id bigint, his5_dms(# hospital_id bigint, his5_dms(# parent_id bigint, his5_dms(# disease_code varchar(60), his5_dms(# disease_name varchar(60), his5_dms(# type smallint, his5_dms(# py varchar(60), his5_dms(# wb varchar(60), his5_dms(# sc varchar(20), his5_dms(# order_no int, his5_dms(# state smallint, his5_dms(# create_datetime timestamp(6), his5_dms(# create_id bigint, his5_dms(# edit_datetime timestamp(6), his5_dms(# edit_id bigint, his5_dms(# search_path varchar(300), his5_dms(# diagnosis_sort int, his5_dms(# category_name varchar(40), his5_dms(# input_option varchar(40), his5_dms(# category_class smallint, his5_dms(# memo1 varchar(300), his5_dms(# memo2 varchar(300), his5_dms(# other_code varchar(60), his5_dms(# other_name varchar(60), his5_dms(# special_disease_flag smallint his5_dms(# ); CREATE TABLE
2. 把oid文件pdu放到restore库中
[root@xifenfeidg public]# pwd /tmp/pdu/restore/public [root@xifenfeidg public]# ls -l total 7144 -rw-r--r--. 1 root root 7315456 Mar 2 21:04 123456 [root@xifenfeidg public]#
3. 使用add语句在pdu加载数据类型
restore.public=# add 123456 t_xff bigint,bigint,bigint,varchar,varchar,smallint,varchar,varchar,varchar,
int,smallint,timestamp,bigint,timestamp,bigint,varchar,int,varchar,varchar,
smallint,varchar,varchar,varchar,varchar,smallint;
添加完成,请用\dt;查看可unload的表
restore.public=# \dt;
|--------------------------------------------------|
| 表名 | 表大小 |
|--------------------------------------------------|
| t_xff | 6.98 MB |
|--------------------------------------------------|
仅显示表大小排名前 1 的表名
4.使用pdu恢复表数据
restore.public=# unload t_xff; 正在解析表 <t_xff>. 已解析数据页: 893, 已解析数据: 46998 条 <t_xff>-<restore/public/123456> 解析完成, 894 个数据页 ,共计 46998 条数据. 成功 46998 条; 失败【0】条 COPY文件路径为:<restore/public/t_xff.csv> restore.public=# unload COPY; COPY命令导出完成, 文件路径: restore/COPY/public_copy.sql
5.导入数据到pg库中
his5_dms=# \i restore/COPY/public_copy.sql SET COPY 46998 his5_dms=# select count(1) from t_xff; count ------- 46998 (1 row) his5_dms=# \x Expanded display is on. his5_dms=# select * from t_xff limit 1; -[ RECORD 1 ]--------+--------------------------- id | 323839 hospital_id | 0 parent_id | 301 disease_code | 57.8900x003 disease_name | 腹腔镜下膀胱颈悬吊术 type | 2 py | fqjxpgjxds wb | eeqgeeceks sc | order_no | 0 state | 1 create_datetime | 2022-09-29 15:22:58.588492 create_id | edit_datetime | edit_id | search_path | 301, diagnosis_sort | category_name | input_option | category_class | 3 memo1 | memo2 | other_code | other_name | special_disease_flag | 0

加我微信(17813235971)
加我QQ(107644445)

