linux系统下从/proc中找回误删除的控制文件

--linux系统下从/proc中找回误删除的控制文件

SYS@PROD3> select name from v$controlfile;

NAME
----------------------------------------------------------------------------------------------------
/home/oracle/db1/control01.ctl

SYS@PROD3> !rm -rf /home/oracle/db1/control01.ctl  --模拟删除

SYS@PROD3> exit
Disconnected from Oracle Database 11g Enterprise Edition Release 11.2.0.3.0 - Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options
[oracle@ocm1 ~]$ exit
logout
[root@ocm1 ~]# lsof |grep /home/oracle/db1/control01.ctl  --lsof(list open files)是一个列出当前系统打开文件的工具
oracle    3954    oracle  256u      REG      253,0   9519104   11075755 /home/oracle/db1/control01.ctl (deleted)
oracle    3956    oracle  256u      REG      253,0   9519104   11075755 /home/oracle/db1/control01.ctl (deleted)
oracle    3958    oracle  256uW     REG      253,0   9519104   11075755 /home/oracle/db1/control01.ctl (deleted)
oracle    3964    oracle  258u      REG      253,0   9519104   11075755 /home/oracle/db1/control01.ctl (deleted)
oracle    3998    oracle  257u      REG      253,0   9519104   11075755 /home/oracle/db1/control01.ctl (deleted)
[root@ocm1 ~]# cd /proc/3954/fd/  --/proc/N/fd 包含进程相关的所有的文件描述符
[root@ocm1 fd]# ll
total 0
lr-x------ 1 oracle oinstall 64 Mar 18 20:41 0 -> /dev/null
l-wx------ 1 oracle oinstall 64 Mar 18 20:41 1 -> /dev/null
lr-x------ 1 oracle oinstall 64 Mar 18 20:41 10 -> /dev/zero
lr-x------ 1 oracle oinstall 64 Mar 18 20:41 11 -> /dev/zero
lrwx------ 1 oracle oinstall 64 Mar 18 20:41 12 -> /u01/app/oracle/product/11.2.0/dbhome_1/dbs/hc_PROD3.dat
lr-x------ 1 oracle oinstall 64 Mar 18 20:41 13 -> /u01/app/oracle/product/11.2.0/dbhome_1/rdbms/mesg/oraus.msb
lr-x------ 1 oracle oinstall 64 Mar 18 20:41 14 -> /proc/3954/fd
lr-x------ 1 oracle oinstall 64 Mar 18 20:41 15 -> /dev/zero
lrwx------ 1 oracle oinstall 64 Mar 18 20:41 16 -> /u01/app/oracle/product/11.2.0/dbhome_1/dbs/hc_PROD3.dat
lrwx------ 1 oracle oinstall 64 Mar 18 20:41 17 -> /u01/app/oracle/product/11.2.0/dbhome_1/dbs/lkPROD3
l-wx------ 1 oracle oinstall 64 Mar 18 20:41 2 -> /dev/null
lr-x------ 1 oracle oinstall 64 Mar 18 20:41 20 -> /u01/app/oracle/product/11.2.0/dbhome_1/rdbms/mesg/oraus.msb
lrwx------ 1 oracle oinstall 64 Mar 18 20:41 256 -> /home/oracle/db1/control01.ctl (deleted)
lrwx------ 1 oracle oinstall 64 Mar 18 20:41 257 -> /home/oracle/db1/system01.dbf
lrwx------ 1 oracle oinstall 64 Mar 18 20:41 258 -> /home/oracle/db1/sysaux01.dbf
lrwx------ 1 oracle oinstall 64 Mar 18 20:41 259 -> /home/oracle/db1/undotbs01.dbf
lrwx------ 1 oracle oinstall 64 Mar 18 20:41 260 -> /home/oracle/db1/users01.dbf
lrwx------ 1 oracle oinstall 64 Mar 18 20:41 261 -> /home/oracle/db1/t1.dbf
lrwx------ 1 oracle oinstall 64 Mar 18 20:41 262 -> /home/oracle/db1/temp01.dbf
lr-x------ 1 oracle oinstall 64 Mar 18 20:41 3 -> /dev/null
lr-x------ 1 oracle oinstall 64 Mar 18 20:41 4 -> /dev/null
lr-x------ 1 oracle oinstall 64 Mar 18 20:41 5 -> /dev/null
lr-x------ 1 oracle oinstall 64 Mar 18 20:41 6 -> /dev/null
lrwx------ 1 oracle oinstall 64 Mar 18 20:41 7 -> /u01/app/oracle/product/11.2.0/dbhome_1/dbs/hc_PROD3.dat
lr-x------ 1 oracle oinstall 64 Mar 18 20:41 8 -> /dev/null
lr-x------ 1 oracle oinstall 64 Mar 18 20:41 9 -> /dev/null
[root@ocm1 fd]# cp -v 256 /home/oracle/db1/control01.ctl
`256' -> `/home/oracle/db1/control01.ctl'
[root@ocm1 fd]# chown oracle:oinstall /home/oracle/db1/control01.ctl 
[root@ocm1 fd]# su - oracle

[oracle@ocm1 ~]$ export ORACLE_SID=PROD3
[oracle@ocm1 ~]$ sqlplus / as sysdba

SQL*Plus: Release 11.2.0.3.0 Production on Sat Mar 18 20:43:16 2017

Copyright (c) 1982, 2011, Oracle.  All rights reserved.


Connected to:
Oracle Database 11g Enterprise Edition Release 11.2.0.3.0 - Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options

SYS@PROD3> startup force
ORACLE instance started.

Total System Global Area  958341120 bytes
Fixed Size		    1348972 bytes
Variable Size		  281021076 bytes
Database Buffers	  671088640 bytes
Redo Buffers		    4882432 bytes
Database mounted.
Database opened.

你可能感兴趣的:(Oracle,Backup/Recovery)