标签云
asm恢复 bbed bootstrap$ dul In Memory kcbzib_kcrsds_1 kccpb_sanity_check_2 MySQL恢复 ORA-00312 ORA-00607 ORA-00704 ORA-00742 ORA-01110 ORA-01555 ORA-01578 ORA-08103 ORA-600 2131 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-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 勒索恢复 比特币加密文章分类
- Others (2)
- 中间件 (2)
- WebLogic (2)
- 操作系统 (103)
- 数据库 (1,701)
- DB2 (22)
- MySQL (74)
- Oracle (1,562)
- Data Guard (52)
- EXADATA (8)
- GoldenGate (24)
- ORA-xxxxx (159)
- ORACLE 12C (72)
- ORACLE 18C (6)
- ORACLE 19C (15)
- ORACLE 21C (3)
- Oracle 23ai (8)
- Oracle ASM (68)
- Oracle Bug (8)
- Oracle RAC (53)
- Oracle 安全 (6)
- Oracle 开发 (28)
- Oracle 监听 (28)
- Oracle备份恢复 (571)
- Oracle安装升级 (94)
- Oracle性能优化 (62)
- 专题索引 (5)
- 勒索恢复 (81)
- PostgreSQL (18)
- PostgreSQL恢复 (6)
- SQL Server (27)
- SQL Server恢复 (8)
- TimesTen (7)
- 达梦数据库 (2)
- 生活娱乐 (2)
- 至理名言 (11)
- 虚拟化 (2)
- VMware (2)
- 软件开发 (37)
- Asp.Net (9)
- JavaScript (12)
- PHP (2)
- 小工具 (20)
-
最近发表
- fio测试io,导致磁盘文件系统损坏故障恢复
- ORA-742 写丢失常见bug记录
- Oracle 19c 202501补丁(RUs+OJVM)
- 避免 19c 数据库性能问题需要考虑的事项 (Doc ID 3050476.1)
- Bug 21915719 Database hang or may fail to OPEN in 12c IBM AIX or HPUX Itanium – ORA-742, DEADLOCK or ORA-600 [kcrfrgv_nextlwn_scn] ORA-600 [krr_process_read_error_2]
- ORA-600 ktuPopDictI_1恢复
- impdp导入数据丢失sys授权问题分析
- impdp 创建index提示ORA-00942: table or view does not exist
- 数据泵导出 (expdp) 和导入 (impdp)工具性能降低分析参考
- 19c非归档数据库断电导致ORA-00742故障恢复
- Oracle 19c – 手动升级到 Non-CDB Oracle Database 19c 的完整核对清单
- sqlite数据库简单操作
- Oracle 暂定和恢复功能
- .pzpq扩展名勒索恢复
- Oracle read only用户—23ai新特性:只读用户
- 迁移awr快照数据到自定义表空间
- .hmallox加密mariadb/mysql数据库恢复
- 2025年首个故障恢复—ORA-600 kcbzib_kcrsds_1
- 第一例Oracle 21c恢复咨询
- ORA-15411: Failure groups in disk group DATA have different number of disks.
标签归档:dul恢复plsql
使用DUL挖数据文件恢复非数据外对象方法
在dul进行数据库挖掘恢复的时候,我们可以通过unload table/user等方式来恢复表数据,但是对于一些view,index,trigger,source,seq,Dblink等不能直接通过unload来实现,但是可以通过挖基表来实现相关操作,这里提供了一些处理思路,在实际操作中根据需求,分析数据字典灵活应用
一.view
导出对象
USER$ OBJ$ COL$ VIEW$
执行sql语句
Set pages 10000 Set long 1000 Spool d:\create_view.sql select 'CREATE OR REPLACE VIEW '||O.NAME||' ('|| replace(c.cols,',',','||chr(10))||')'||CHR(10)|| 'as'||chr(10), v.text from user$ u, obj$ o, view$ v, ( SELECT COL.OBJ#, COL.COLS FROM (SELECT OBJ#, COL#, substr(SYS_CONNECT_BY_PATH(NAME,','),2) COLS FROM COL$ WHERE COL# > 0 START WITH COL# = 1 CONNECT BY PRIOR OBJ# = OBJ# AND PRIOR COL# = COL# - 1 ) COL, (SELECT OBJ#, COUNT(*) COLCNT FROM COL$ WHERE COL# > 0 GROUP BY OBJ#) CN WHERE COL.OBJ# = CN.OBJ# AND COL.COL# = CN.COLCNT ) C where u.user#=o.owner# and o.obj# = c.obj# and v.obj# = o.obj# and u.name=upper('&username');
说明
1) 分布执行,不能放置一个脚本文件中执行
2) 每条as后面的select语句可能需要重新格式化
3) Create view 语句最后需要增加”;”
二.source
导出对象
USER$ SOURCE$ OBJ$
执行sql语句
Set pages 10000 Set long 1000 set linse 1000 Spool d:\create_source.sql SELECT DECODE(S.LINE,1,'CREATE OR REPLACE ','')||SOURCE SOURCE FROM USER$ U, OBJ$ O, SOURCE$ S WHERE U.USER# = O.OWNER# AND O.OBJ# = S.OBJ# AND U.NAME = UPPER('&username') -- AND O.NAME = UPPER('&SOURCE_NAME') ORDER BY S.OBJ#, S.LINE;
说明
1) 注意SOURCE中的用户名,如果导入不是相同用户,需要修改该脚本用户名
2) 修改完用户名后,直接执行生成脚本即可
三.Index
导出对象
USER$ OBJ$ COL$ IND$ ICOL$
执行sql
Set pages 10000 Set long 1000 set linse 1000 Spool d:\create_index.sql SELECT 'CREATE '||decode(bitand(IDX.property, 1), 1, 'UNIQUE', '')|| ' INDEX '||I.NAME||' ON '||T.NAME||'('||IDX.PATH||');' INDEX_DDL FROM USER$ U, OBJ$ T, OBJ$ I, ( select I.PROPERTY, I.BO#, I.OBJ#, C.POS#, SUBSTR(sys_connect_by_path(CN.NAME,','),2) path from IND$ I, ICOL$ C, COL$ CN WHERE I.OBJ# = C.OBJ# AND I.BO# = C.BO# AND I.BO# = CN.OBJ# AND C.COL# = CN.INTCOL# start with C.POS#=1 connect by PRIOR I.OBJ# = I.OBJ# AND prior C.POS# = C.POS# - 1 ) IDX, (SELECT I.BO#, I.OBJ#, COUNT(*) COLCNT FROM ICOL$ I GROUP BY I.BO#, I.OBJ#) IDXC WHERE U.USER# = T.OWNER# AND IDX.BO# = T.OBJ# AND IDX.OBJ# = I.OBJ# AND IDX.BO# = IDXC.BO# AND IDX.OBJ# = IDXC.OBJ# AND IDX.POS# = IDXC.COLCNT AND U.NAME = upper('&username') ORDER BY T.NAME, I.NAME;
说明
1) 因为SYS_CONNECT_BY_PATH所以需要10g及其以上版本
2) SQL中没有分区唯一性索引
3) 注意检查sql是否因为行长度不够导致异常
四.Sequence
导出对象
USER$ OBJ$ SEQ$
执行sql语句
Set pages 10000 Set long 1000 set linse 1000 Spool d:\create_sequence.sql SELECT 'CREATE SEQUENCE '|| SEQ_NAME || ' MINVALUE '||minval || ' MAXVALUE '||MAXVAL || ' START WITH '||LASTVAL || ' ' || CYC || ' ' || ORD || DECODE(SIGN(CACHE), 1,' CACHE '|| CACHE, 'NOCACHE') || ';' SEQ_DDL from (select u.name OWNER, o.name SEQ_NAME, s.minvalue MINVAL, s.maxvalue MAXVAL, s.increment$ INC, decode (s.cycle#, 0, 'NOCYCLE', 1, 'CYCLE ') CYC, decode (s.order$, 0, 'NOORDER', 1, 'ORDER') ORD, s.cache, s.highwater LASTVAL from seq$ s, obj$ o, user$ u where u.user# = o.owner# and o.obj# = s.obj# and u.name=upper('&username'));
五.TRIGGER
导出对象
OBJ$ USER$ TRIGGER$
执行sql语句
Set pages 10000 Set long 1000 set linse 1000 Spool d:\create_trigger.sql select 'CREATE OR REPLACE TRIGGER '|| trigger_name || chr(10)|| decode( substr( trigger_type, 1, 1 ), 'A', 'AFTER ', 'B', 'BEFORE ', 'I', 'INSTEAD OF ' ) || triggering_event || ' ON ' || table_owner || '.' || table_name || chr(10) || REF_CLAUSE || chr(10) || decode( instr( trigger_type, 'EACH ROW' ), 0, null, 'FOR EACH ROW' ), trigger_body from ( select trigusr.name owner, trigobj.name trigger_name, decode(t.type#, 0, 'BEFORE STATEMENT', 1, 'BEFORE EACH ROW', 2, 'AFTER STATEMENT', 3, 'AFTER EACH ROW', 4, 'INSTEAD OF', 'UNDEFINED') trigger_type, decode(t.insert$*100 + t.update$*10 + t.delete$, 100, 'INSERT', 010, 'UPDATE', 001, 'DELETE', 110, 'INSERT OR UPDATE', 101, 'INSERT OR DELETE', 011, 'UPDATE OR DELETE', 111, 'INSERT OR UPDATE OR DELETE', 'ERROR') triggering_event, tabusr.name table_owner, tabobj.name table_name, 'REFERENCING NEW AS '||t.refnewname||' OLD AS '||t.refoldname REF_CLAUSE, t.whenclause,decode(t.enabled, 0, 'DISABLED', 1, 'ENABLED', 'ERROR') STATUS, t.definition , t.action# trigger_body from obj$ trigobj, obj$ tabobj, trigger$ t, user$ tabusr, user$ trigusr where (trigobj.obj# = t.obj# and tabobj.obj# = t.baseobject and tabobj.owner# = tabusr.user# and trigobj.owner# = trigusr.user# and bitand(t.property, 63) < 8 )) where table_owner=upper('&username') order by owner, trigger_name;
六. Dblink
导出对象
Sys.link$ sys.user$
执行查询sql
SELECT 'CREATE '||DECODE(U.NAME,'PUBLIC','public ')||'DATABASE LINK '||CHR(10) ||DECODE(U.NAME,'PUBLIC',Null, 'SYS','',U.NAME||'.')|| L.NAME||chr(10) ||'CONNECT TO ' || L.USERID || ' IDENTIFIED BY "'||L.PASSWORD||'" USING '''||L.HOST||'''' ||chr(10)||';' TEXT FROM SYS.LINK$ L, SYS.USER$ U WHERE L.OWNER# = U.USER#;