标签云
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-01595 ORA-08103 ORA-600 2131 ORA-600 2662 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,763)
- DB2 (22)
- MySQL (76)
- Oracle (1,605)
- Data Guard (52)
- EXADATA (8)
- GoldenGate (24)
- ORA-xxxxx (166)
- ORACLE 12C (72)
- ORACLE 18C (6)
- ORACLE 19C (15)
- ORACLE 21C (3)
- Oracle 23ai (8)
- Oracle ASM (69)
- Oracle Bug (8)
- Oracle RAC (54)
- Oracle 安全 (6)
- Oracle 开发 (28)
- Oracle 监听 (28)
- Oracle备份恢复 (588)
- Oracle安装升级 (97)
- Oracle性能优化 (62)
- 专题索引 (5)
- 勒索恢复 (86)
- PostgreSQL (30)
- pdu工具 (6)
- PostgreSQL恢复 (9)
- SQL Server (32)
- SQL Server恢复 (13)
- TimesTen (7)
- 达梦数据库 (3)
- 达梦恢复 (1)
- 生活娱乐 (2)
- 至理名言 (11)
- 虚拟化 (2)
- VMware (2)
- 软件开发 (39)
- Asp.Net (9)
- JavaScript (12)
- PHP (2)
- 小工具 (22)
-
最近发表
- .sstop勒索加密数据库恢复
- 解决一次硬件恢复之后数据文件0kb的故障恢复case
- Error in invoking target ‘libasmclntsh19.ohso libasmperl19.ohso client_sharedlib’问题处理
- ORA-01171: datafile N going offline due to error advancing checkpoint
- linux环境oracle数据库被文件系统勒索加密为.babyk扩展名溯源
- ORA-600 ksvworkmsgalloc: bad reaper
- ORA-600 krccfl_chunk故障处理
- Oracle Recovery Tools恢复案例总结—202505
- ORA-600 kddummy_blkchk 数据库循环重启
- 记录一次asm disk加入到vg通过恢复直接open库的案例
- CHECKDB 发现了 N 个分配错误和 M 个一致性错误
- 达梦数据库dm.ctl文件异常恢复
- Oracle Recovery Tools修复ORA-00742、ORA-600 ktbair2: illegal inheritance故障
- 可能是 tempdb 空间用尽或某个系统表不一致故障处理
- 11.2.0.4库中遇到ORA-600 kcratr_nab_less_than_odr报错
- [MY-013183] [InnoDB] Assertion failure故障处理
- Oracle 19c 202504补丁(RUs+OJVM)-19.27
- Oracle Recovery Tools修复ORA-600 6101/kdxlin:psno out of range故障
- pdu完美支持金仓数据库恢复(KingbaseES)
- 虚拟机故障引起ORA-00310 ORA-00334故障处理
分类目录归档:Linux
dd操作数据文件
1.dd主要参数
Copy a file, converting and formatting according to the operands. bs=BYTES force ibs=BYTES and obs=BYTES cbs=BYTES convert BYTES bytes at a time count=BLOCKS copy only BLOCKS input blocks ibs=BYTES read BYTES bytes at a time if=FILE read from FILE instead of stdin obs=BYTES write BYTES bytes at a time of=FILE write to FILE instead of stdout seek=BLOCKS skip BLOCKS obs-sized blocks at start of output skip=BLOCKS skip BLOCKS ibs-sized blocks at start of input
2.拷贝数据文件头部
[oracle@node1 chf]$ dd if=system01.dbf of=/tmp/dd_xifenfei01.dbf bs=8192 count=1 1+0 records in 1+0 records out 8192 bytes (8.2 kB) copied, 6.2e-05 seconds, 132 MB/s [oracle@node1 chf]$ ll /tmp/dd_xifenfei01.dbf -rw-r--r-- 1 oracle oinstall 8192 01-13 16:49 /tmp/dd_xifenfei01.dbf BBED> set filename '/tmp/dd_xifenfei01.dbf' FILENAME /tmp/dd_xifenfei01.dbf BBED> set block 1 BLOCK# 1 BBED> dump File: ././dd_xifenfei01.dbf (0) Block: 1 Offsets: 0 to 511 Dba:0x00000000 ------------------------------------------------------------------------ 00a20000 0000c0ff 00000000 00000000 64590000 00200000 00a30200 7d7c7b7a a0810000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 <32 bytes per line> BBED> set block 2 BBED-00309: out of range block number (2) BBED> set offset 8190 OFFSET 8190 BBED> dump File: ././dd_xifenfei01.dbf (0) Block: 1 Offsets: 8190 to 8191 Dba:0x00000000 ------------------------------------------------------------------------ 0000 <32 bytes per line> --证明只有1个数据块(8192),并且拷贝数据文件头部成功
3.模拟创建文件
[oracle@node1 tmp]$ ll /tmp/dd_xifenfei02.dbf -h -rw-r--r-- 1 oracle oinstall 1.0G 01-13 16:58 /tmp/dd_xifenfei02.dbf
4.拷贝数据块到一个文件中
[oracle@node1 chf]$ dd if=/tmp/dd_xifenfei01.dbf of=/tmp/dd_xifenfei02.dbf bs=8192 count=1 1+0 records in 1+0 records out 8192 bytes (8.2 kB) copied, 6e-05 seconds, 137 MB/s [oracle@node1 chf]$ bbed Password: BBED: Release 2.0.0.0.0 - Limited Production on Fri Jan 13 17:01:02 2012 Copyright (c) 1982, 2011, Oracle and/or its affiliates. All rights reserved. ************* !!! For Oracle Internal Use only !!! *************** BBED> set filename '/tmp/dd_xifenfei02.dbf' BBED> set block 1 BLOCK# 1 BBED> dump File: ././dd_xifenfei02.dbf (0) Block: 1 Offsets: 0 to 511 Dba:0x00000000 ------------------------------------------------------------------------ 00a20000 0000c0ff 00000000 00000000 64590000 00200000 00a30200 7d7c7b7a a0810000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 <32 bytes per line> BBED> set block 2 BBED-00309: out of range block number (2) BBED> set offset 8190 OFFSET 8190 BBED> dump File: ././dd_xifenfei02.dbf (0) Block: 1 Offsets: 8190 to 8191 Dba:0x00000000 ------------------------------------------------------------------------ 0000 <32 bytes per line>
通过对比在2步骤中拷贝出来的数据文件头部,证明现在已经把该头部拷贝到了3步骤创建的新文件中
恢复被rm意外删除数据文件
一.模拟数据文件删除
[oracle@node1 ~]$ sqlplus / as sysdba SQL*Plus: Release 11.2.0.3.0 Production on Sat Dec 31 22:00:52 2011 Copyright (c) 1982, 2011, Oracle. All rights reserved. --数据库版本 Connected to: Oracle Database 11g Enterprise Edition Release 11.2.0.3.0 - 64bit Production With the Partitioning, Oracle Label Security, OLAP, Data Mining, Oracle Database Vault and Real Application Testing options --所有数据文件 SQL> select name from v$datafile; NAME -------------------------------------------------------------------------------- /opt/oracle/oradata/ora11g/system01.dbf /opt/oracle/oradata/ora11g/sysaux01.dbf /opt/oracle/oradata/ora11g/undotbs01.dbf /opt/oracle/oradata/ora11g/users01.dbf /opt/oracle/oradata/ora11g/example01.dbf --删除example01.dbf数据文件 SQL> !rm /opt/oracle/oradata/ora11g/example01.dbf SQL> !ls -l /opt/oracle/oradata/ora11g/example01.dbf ls: /opt/oracle/oradata/ora11g/example01.dbf: 没有那个文件或目录 --因为数据文件被删除,创建表失败 SQL> create table t_xifenfei tablespace example 2 as select * from dba_tables; as select * from dba_tables * ERROR at line 2: ORA-01116: error in opening database file 5 ORA-01110: data file 5: '/opt/oracle/oradata/ora11g/example01.dbf' ORA-27041: unable to open file Linux-x86_64 Error: 2: No such file or directory Additional information: 3
二.找回数据文件
--查找dbw进程spid [oracle@node1 ~]$ ps -ef|grep dbw|grep -v grep oracle 18387 1 0 Dec22 ? 00:00:12 ora_dbw0_ora11g --查看该进程所有文件句柄 [oracle@node1 ~]$ ll /proc/18387/fd 总计 0 lr-x------ 1 oracle oinstall 64 12-31 22:03 0 -> /dev/null l-wx------ 1 oracle oinstall 64 12-31 22:03 1 -> /dev/null lr-x------ 1 oracle oinstall 64 12-31 22:03 10 -> /dev/zero lr-x------ 1 oracle oinstall 64 12-31 22:03 11 -> /dev/zero lr-x------ 1 oracle oinstall 64 12-31 22:03 12 -> /opt/oracle/product/11.2.0/db_1/rdbms/mesg/orazhs.msb lrwx------ 1 oracle oinstall 64 12-31 22:03 13 -> /opt/oracle/product/11.2.0/db_1/dbs/hc_ora11g.dat lr-x------ 1 oracle oinstall 64 12-31 22:03 14 -> /proc/18387/fd lr-x------ 1 oracle oinstall 64 12-31 22:03 15 -> /dev/zero lr-x------ 1 oracle oinstall 64 12-31 22:03 16 -> /opt/oracle/product/11.2.0/db_1/rdbms/mesg/oraus.msb lrwx------ 1 oracle oinstall 64 12-31 22:03 17 -> /opt/oracle/product/11.2.0/db_1/dbs/hc_ora11g.dat lrwx------ 1 oracle oinstall 64 12-31 22:03 18 -> /opt/oracle/product/11.2.0/db_1/dbs/lkORA11G lr-x------ 1 oracle oinstall 64 12-31 22:03 19 -> /opt/oracle/product/11.2.0/db_1/rdbms/mesg/orazhs.msb l-wx------ 1 oracle oinstall 64 12-31 22:03 2 -> /dev/null lr-x------ 1 oracle oinstall 64 12-31 22:03 20 -> /opt/oracle/product/11.2.0/db_1/rdbms/mesg/oraus.msb lrwx------ 1 oracle oinstall 64 12-31 22:03 21 -> socket:[441562] lrwx------ 1 oracle oinstall 64 12-31 22:03 256 -> /opt/oracle/oradata/ora11g/control01.ctl lrwx------ 1 oracle oinstall 64 12-31 22:03 257 -> /opt/oracle/oradata/ora11g/system01.dbf lrwx------ 1 oracle oinstall 64 12-31 22:03 258 -> /opt/oracle/oradata/ora11g/sysaux01.dbf lrwx------ 1 oracle oinstall 64 12-31 22:03 259 -> /opt/oracle/oradata/ora11g/undotbs01.dbf lrwx------ 1 oracle oinstall 64 12-31 22:03 260 -> /opt/oracle/oradata/ora11g/users01.dbf lrwx------ 1 oracle oinstall 64 12-31 22:03 261 -> /opt/oracle/oradata/ora11g/example01.dbf (deleted) lrwx------ 1 oracle oinstall 64 12-31 22:03 262 -> /opt/oracle/oradata/ora11g/temp01.dbf lr-x------ 1 oracle oinstall 64 12-31 22:03 3 -> /dev/null lr-x------ 1 oracle oinstall 64 12-31 22:03 4 -> /dev/null lrwx------ 1 oracle oinstall 64 12-31 22:03 5 -> /opt/oracle/product/11.2.0/db_1/dbs/hc_ora11g.dat lr-x------ 1 oracle oinstall 64 12-31 22:03 6 -> /dev/null lr-x------ 1 oracle oinstall 64 12-31 22:03 7 -> /dev/null lr-x------ 1 oracle oinstall 64 12-31 22:03 8 -> /dev/null lr-x------ 1 oracle oinstall 64 12-31 22:03 9 -> /dev/null --通过句柄恢复数据文件[被删除数据文件会被标示(deleted)] [oracle@node1 ~]$ cp /proc/18387/fd/261 /opt/oracle/oradata/ora11g/example01.dbf --确认该数据文件已经恢复成功 [oracle@node1 ~]$ ll /opt/oracle/oradata/ora11g/example01.dbf -rw-r----- 1 oracle oinstall 362422272 12-31 22:05 /opt/oracle/oradata/ora11g/example01.dbf
三.数据文件online
SQL> alter database datafile 5 offline; Database altered. SQL> recover datafile 5; Media recovery complete. SQL> alter database datafile 5 online; Database altered. SQL> create table t_xifenfei tablespace example 2 as select * from dba_tables; Table created.
四.补充说明
在意外使用os命令删除掉数据文件时,千万不要慌张重启数据库或者操作系统,可以通过dbwn进程相关句柄找回数据文件
发表在 Linux, Oracle备份恢复
7 条评论
Linux中文件大小限制
在日常的维护中,偶尔总担心某个文件会不会因为太大(超过系统限制大小),导致工作不正常。查找了一些资料,这里对文件大小限制的情况做个记录,以便以后做到心中有底
一、文件大小限制列表
二、查看数据块大小
1、直接查看操作磁盘(Block size)
[root@bas ~]# tune2fs -l /dev/sda2 tune2fs 1.35 (28-Feb-2004) Filesystem volume name: /home ………… Block size: 4096 Fragment size: 4096 ………… Journal backup: inode blocks
2、查看某个文件(IO Block)
[oracle@bas backup]$ stat full_back.dmp File: `full_back.dmp' Size: 429687808000 Blocks: 840054384 IO Block: 4096 regular file Device: 812h/2066d Inode: 13 Links: 1 Access: (0644/-rw-r--r--) Uid: ( 501/ oracle) Gid: ( 501/oinstall) Access: 2011-12-18 02:00:25.000000000 +0800 Modify: 2011-12-18 20:49:31.000000000 +0800 Change: 2011-12-18 20:49:31.000000000 +0800