Chinaunix首页 | 论坛 | 博客
  • 博客访问: 239192
  • 博文数量: 59
  • 博客积分: 0
  • 博客等级: 民兵
  • 技术积分: 592
  • 用 户 组: 普通用户
  • 注册时间: 2014-04-01 12:51
个人简介

你们都是我的客户,所以,我对你们是透明的

文章分类

全部博文(59)

文章存档

2016年(29)

2015年(30)

分类: Oracle

2016-03-16 14:30:27

数据库不要关闭
SQL> select file#,name from v$datafile;
     FILE# NAME
---------- ----------------------------------------
         1 /oracle/oradata/orcl/system01.dbf
         2 /oracle/oradata/orcl/undotbs01.dbf
         3 /oracle/oradata/orcl/sysaux01.dbf
         4 /oracle/oradata/orcl/users01.dbf

删除users01.dbf
[root@10g ~]# rm -f /oracle/oradata/orcl/users01.dbf

查看句柄文件
[oracle@10g oracle]$ ps -ef | grep dbw
oracle   23120     1  0 14:12 ?        00:00:00 ora_dbw0_orcl
oracle   23312  4141  0 14:15 pts/2    00:00:00 grep dbw

[oracle@10g oracle]$ cd /proc/23120/fd
[oracle@10g fd]$ ls -rtl
total 0
lrwx------ 1 oracle oinstall 64 Mar 16 14:16 9 -> /oracle/app/oracle/product/11.2.0/dbhome_1/dbs/hc_orcl.dat
lr-x------ 1 oracle oinstall 64 Mar 16 14:16 8 -> /dev/zero
lr-x------ 1 oracle oinstall 64 Mar 16 14:16 7 -> /proc/23120/fd
lr-x------ 1 oracle oinstall 64 Mar 16 14:16 6 -> /oracle/app/oracle/product/11.2.0/dbhome_1/rdbms/mesg/oraus.msb
lr-x------ 1 oracle oinstall 64 Mar 16 14:16 5 -> /dev/null
lr-x------ 1 oracle oinstall 64 Mar 16 14:16 4 -> /dev/null
lr-x------ 1 oracle oinstall 64 Mar 16 14:16 3 -> /dev/null
lrwx------ 1 oracle oinstall 64 Mar 16 14:16 258 -> /oracle/oradata/orcl/control03.ctl
lrwx------ 1 oracle oinstall 64 Mar 16 14:16 257 -> /oracle/oradata/orcl/control02.ctl
lrwx------ 1 oracle oinstall 64 Mar 16 14:16 256 -> /oracle/oradata/orcl/control01.ctl
l-wx------ 1 oracle oinstall 64 Mar 16 14:16 2 -> /dev/null
lrwx------ 1 oracle oinstall 64 Mar 16 14:16 10 -> /oracle/app/oracle/product/11.2.0/dbhome_1/dbs/lkORCL
l-wx------ 1 oracle oinstall 64 Mar 16 14:16 1 -> /dev/null
lr-x------ 1 oracle oinstall 64 Mar 16 14:16 0 -> /dev/null
lrwx------ 1 oracle oinstall 64 Mar 16 14:18 263 -> /oracle/oradata/orcl/temp01.dbf
lrwx------ 1 oracle oinstall 64 Mar 16 14:18 262 -> /oracle/oradata/orcl/users01.dbf (deleted)
lrwx------ 1 oracle oinstall 64 Mar 16 14:18 261 -> /oracle/oradata/orcl/sysaux01.dbf
lrwx------ 1 oracle oinstall 64 Mar 16 14:18 260 -> /oracle/oradata/orcl/undotbs01.dbf
lrwx------ 1 oracle oinstall 64 Mar 16 14:18 259 -> /oracle/oradata/orcl/system01.dbf
lr-x------ 1 oracle oinstall 64 Mar 16 14:18 11 -> /oracle/app/oracle/product/11.2.0/dbhome_1/rdbms/mesg/oraus.msb

复制回去
[oracle@10g fd]$ cp 262 /oracle/oradata/orcl/users01.dbf

恢复数据文件
SQL> alter database datafile 4 offline;
Database altered.

SQL> recover datafile 4;
Media recovery complete.

SQL> select open_mode from v$database;
OPEN_MODE
--------------------
READ WRITE

SQL> alter database datafile 4 online;
Database altered.

关闭数据库就不能这样恢复了

PS:数据库打不开时得不到文件号,可以
一、bbed
BBED> set filename '/oracle/oradata/orcl/anty01.dbf';
        FILENAME        /oracle/oradata/orcl/anty01.dbf
BBED> p kcvfh.kcvfhrfn      --------------->相对文件号
ub4 kcvfhrfn                                @368      0x00000005

SQL> select to_char(00000005,'xxxxxxxxxxxxx') from dual;
TO_CHAR(000000
--------------
             5
SQL>

二、od
[root@10g fd]# ls -rtl
total 0
lrwx------ 1 oracle oinstall 64 Mar 19 21:47 9 -> /oracle/app/oracle/product/11.2.0/dbhome_1/dbs/hc_orcl.dat
lr-x------ 1 oracle oinstall 64 Mar 19 21:47 8 -> /dev/zero
lr-x------ 1 oracle oinstall 64 Mar 19 21:47 7 -> /proc/3329/fd
lr-x------ 1 oracle oinstall 64 Mar 19 21:47 6 -> /oracle/app/oracle/product/11.2.0/dbhome_1/rdbms/mesg/oraus.msb
lr-x------ 1 oracle oinstall 64 Mar 19 21:47 5 -> /dev/null
lr-x------ 1 oracle oinstall 64 Mar 19 21:47 4 -> /dev/null
lr-x------ 1 oracle oinstall 64 Mar 19 21:47 3 -> /dev/null
lrwx------ 1 oracle oinstall 64 Mar 19 21:47 263 -> /oracle/oradata/orcl/temp01.dbf
lrwx------ 1 oracle oinstall 64 Mar 19 21:47 262 -> /oracle/oradata/orcl/users01.dbf
lrwx------ 1 oracle oinstall 64 Mar 19 21:47 261 -> /oracle/oradata/orcl/sysaux01.dbf
lrwx------ 1 oracle oinstall 64 Mar 19 21:47 260 -> /oracle/oradata/orcl/undotbs01.dbf
lrwx------ 1 oracle oinstall 64 Mar 19 21:47 259 -> /oracle/oradata/orcl/system01.dbf
lrwx------ 1 oracle oinstall 64 Mar 19 21:47 258 -> /oracle/oradata/orcl/control03.ctl
lrwx------ 1 oracle oinstall 64 Mar 19 21:47 257 -> /oracle/oradata/orcl/control02.ctl
lrwx------ 1 oracle oinstall 64 Mar 19 21:47 256 -> /oracle/oradata/orcl/control01.ctl
l-wx------ 1 oracle oinstall 64 Mar 19 21:47 2 -> /dev/null
lr-x------ 1 oracle oinstall 64 Mar 19 21:47 11 -> /oracle/app/oracle/product/11.2.0/dbhome_1/rdbms/mesg/oraus.msb
lrwx------ 1 oracle oinstall 64 Mar 19 21:47 10 -> /oracle/app/oracle/product/11.2.0/dbhome_1/dbs/lkORCL
l-wx------ 1 oracle oinstall 64 Mar 19 21:47 1 -> /dev/null
lr-x------ 1 oracle oinstall 64 Mar 19 21:47 0 -> /dev/null
lrwx------ 1 oracle oinstall 64 Mar 19 22:25 264 -> /oracle/oradata/orcl/anty01.dbf
lrwx------ 1 oracle oinstall 64 Mar 19 22:46 12 -> socket:[13461]
[root@10g fd]#

数据文件一个操作系统头8192+偏移量368=8560(368是bbed看到的)
[root@10g fd]#
[root@10g fd]# od -j 8560 x1 264 | head -1
od: x1: No such file or directory
0020560 000005 000000 000000 000000 000000 000000 000000 000000
[root@10g fd]#


阅读(1846) | 评论(0) | 转发(0) |
0

上一篇:oracle手工建库

下一篇:rman恢复小测

给主人留下些什么吧!~~