1.首先测试rm 误删除数据库文件 [oracle@primary dbwdn]$ ll total -rw-r----- 1 oracle dba Nov : control.ctl -rw-r----- 1 oracle dba Nov : control.ctl -rw-r----- 1 oracle dba Nov : control.ctl -rw-r----- 1 oracle dba Nov : ggs.dbf -rw-r----- 1 oracle dba Nov : perfstat.dbf -rw-r----- 1 oracle dba Nov : redo.log -rw-r----- 1 oracle dba Nov : redo.log -rw-r----- 1 oracle dba Nov : redo.log -rw-r----- 1 oracle dba Nov : shkz_data_.dbf -rw-r----- 1 oracle dba Nov : sysaux.dbf -rw-r----- 1 oracle dba Nov : system.dbf -rw-r----- 1 oracle dba Nov : temp.dbf -rw-r----- 1 oracle dba Nov : test.dbf -rw-r----- 1 oracle dba Nov : undotbs.dbf -rw-r----- 1 oracle dba Nov : users.dbf [oracle@primary dbwdn]$ rm test.dbf 2.找到数据库后台进程dbw0 oracle 1 0 : ? :: ora_dbw0_dbwdn 进程号 3.找到被误删除的数据库文件 [oracle@primary dbwdn]$ ll /proc//fd total 0 lr-x------ 1 oracle oinstall Nov : 0 -> /dev/null lr-x------ 1 oracle oinstall Nov : 1 -> /dev/null lr-x------ 1 oracle oinstall Nov : -> /dev/zero lr-x------ 1 oracle oinstall Nov : -> /dev/zero lr-x------ 1 oracle oinstall Nov : -> /u/app/oracle/product/.2.0/db_1/rdbms/mesg/oraus.msb lrwx------ 1 oracle oinstall Nov : -> /u/app/oracle/product/.2.0/db_1/dbs/hc_dbwdn.dat lrwx------ 1 oracle oinstall Nov : -> /u/app/oracle/product/.2.0/db_1/dbs/lkDBWDN lrwx------ 1 oracle oinstall Nov : -> /u/app/oracle/oradata/dbwdn/control.ctl lrwx------ 1 oracle oinstall Nov : -> /u/app/oracle/oradata/dbwdn/control.ctl lrwx------ 1 oracle oinstall Nov : -> /u/app/oracle/oradata/dbwdn/control.ctl lrwx------ 1 oracle oinstall Nov : -> /u/app/oracle/oradata/dbwdn/system.dbf lrwx------ 1 oracle oinstall Nov : -> /u/app/oracle/oradata/dbwdn/undotbs.dbf lr-x------ 1 oracle oinstall Nov : 2 -> /dev/null lrwx------ 1 oracle oinstall Nov : -> /u/app/oracle/oradata/dbwdn/sysaux.dbf lrwx------ 1 oracle oinstall Nov : -> /u/app/oracle/oradata/dbwdn/users.dbf lrwx------ 1 oracle oinstall Nov : -> /u/app/oracle/oradata/dbwdn/test.dbf (deleted) lrwx------ 1 oracle oinstall Nov : -> /u/app/oracle/oradata/dbwdn/ggs.dbf lrwx------ 1 oracle oinstall Nov : -> /u/app/oracle/oradata/dbwdn/perfstat.dbf lrwx------ 1 oracle oinstall Nov : -> /u/app/oracle/oradata/dbwdn/shkz_data_.dbf lrwx------ 1 oracle oinstall Nov : -> /u/app/oracle/oradata/dbwdn/temp.dbf lr-x------ 1 oracle oinstall Nov : -> /u/app/oracle/product/.2.0/db_1/rdbms/mesg/oraus.msb lr-x------ 1 oracle oinstall Nov : 3 -> /dev/null lr-x------ 1 oracle oinstall Nov : 4 -> /dev/null l-wx------ 1 oracle oinstall Nov : 5 -> /u/app/oracle/admin/dbwdn/udump/dbwdn_ora_.trc l-wx------ 1 oracle oinstall Nov : 6 -> /u/app/oracle/admin/dbwdn/bdump/alert_dbwdn.log lrwx------ 1 oracle oinstall Nov : 7 -> /u/app/oracle/product/.2.0/db_1/dbs/hc_dbwdn.dat l-wx------ 1 oracle oinstall Nov : 8 -> /u/app/oracle/admin/dbwdn/bdump/alert_dbwdn.log 误删除之后,数据库没有重启,系统也没用重启 4.拷贝数据库文件 [oracle@primary ~]$ cp /proc//fd/ /u/app/oracle/oradata/dbwdn/test.dbf [oracle@primary ~]$ cd /u/app/oracle/oradata/dbwdn [oracle@primary dbwdn]$ ls control.ctl control.ctl perfstat.dbf redo.log shkz_data_.dbf system.dbf test.dbf users.dbf control.ctl ggs.dbf redo.log redo.log sysaux.dbf temp.dbf undotbs.dbf 数据库文件找回来了。 5.恢复数据库文件 [oracle@primary dbwdn]$ sqlplus "/as sysdba" SQL*Plus: Release .2.0.5.0 - Production on Tue Nov :: Copyright (c) , , Oracle. All Rights Reserved. Connected to: Oracle Database g Enterprise Edition Release .2.0.5.0 - Production With the Partitioning, OLAP, Data Mining and Real Application Testing options SQL> alter database datafile 5 offline; Database altered. SQL> recover datafile 5; Media recovery complete. SQL> alter database datafile 5 online; Database altered. SQL> shutdown immediate; Database closed. Database dismounted. ORACLE instance shut down. SQL> startup ORACLE instance started. Total System Global Area bytes Fixed Size bytes Variable Size bytes Database Buffers bytes Redo Buffers bytes Database mounted. Database opened. SQL> 成功恢复数据库 注:如果数据库重启之后,还能恢复吗,测试一下: [oracle@primary dbwdn]$ rm users.dbf[oracle@primary dbwdn]$ ps -ef |grep dbw0 oracle 1 0 : ? :: ora_dbw0_dbwdn oracle 0 : pts/1 :: grep dbw0 [oracle@primary dbwdn]$ ll /proc//fd total 0 lr-x------ 1 oracle oinstall Nov : 0 -> /dev/null lr-x------ 1 oracle oinstall Nov : 1 -> /dev/null lr-x------ 1 oracle oinstall Nov : -> /dev/zero lr-x------ 1 oracle oinstall Nov : -> /dev/zero lr-x------ 1 oracle oinstall Nov : -> /u/app/oracle/product/.2.0/db_1/rdbms/mesg/oraus.msb lrwx------ 1 oracle oinstall Nov : -> /u/app/oracle/product/.2.0/db_1/dbs/hc_dbwdn.dat lrwx------ 1 oracle oinstall Nov : -> /u/app/oracle/product/.2.0/db_1/dbs/lkDBWDN lrwx------ 1 oracle oinstall Nov : -> /u/app/oracle/oradata/dbwdn/control.ctl lrwx------ 1 oracle oinstall Nov : -> /u/app/oracle/oradata/dbwdn/control.ctl lrwx------ 1 oracle oinstall Nov : -> /u/app/oracle/oradata/dbwdn/control.ctl lrwx------ 1 oracle oinstall Nov : -> /u/app/oracle/oradata/dbwdn/system.dbf lrwx------ 1 oracle oinstall Nov : -> /u/app/oracle/oradata/dbwdn/undotbs.dbf lr-x------ 1 oracle oinstall Nov : 2 -> /dev/null lrwx------ 1 oracle oinstall Nov : -> /u/app/oracle/oradata/dbwdn/sysaux.dbf lrwx------ 1 oracle oinstall Nov : -> /u/app/oracle/oradata/dbwdn/users.dbf (deleted)lrwx------ 1 oracle oinstall Nov : -> /u/app/oracle/oradata/dbwdn/test.dbf lrwx------ 1 oracle oinstall Nov : -> /u/app/oracle/oradata/dbwdn/ggs.dbf lrwx------ 1 oracle oinstall Nov : -> /u/app/oracle/oradata/dbwdn/perfstat.dbf lrwx------ 1 oracle oinstall Nov : -> /u/app/oracle/oradata/dbwdn/shkz_data_.dbf 数据库没有重启,这个数据文件还能恢复,如果我重启数据库之后,还能看见这个数据文件吗? [oracle@primary dbwdn]$ sqlplus "/as sysdba" SQL*Plus: Release .2.0.5.0 - Production on Tue Nov :: Copyright (c) , , Oracle. All Rights Reserved. Connected to: Oracle Database g Enterprise Edition Release .2.0.5.0 - Production With the Partitioning, OLAP, Data Mining and Real Application Testing options SQL> shutdown immediate; ORA-: error in opening database file 4 ORA-: data file 4: '/u/app/oracle/oradata/dbwdn/users.dbf' ORA-: unable to open file Linux Error: 2: No such file or directory Additional information: 3 SQL> shutdown abort;ORACLE instance shut down. SQL> exit Disconnected from Oracle Database g Enterprise Edition Release .2.0.5.0 - Production With the Partitioning, OLAP, Data Mining and Real Application Testing options [oracle@primary dbwdn]$ sqlplus "/as sysdba" SQL*Plus: Release .2.0.5.0 - Production on Tue Nov :: Copyright (c) , , Oracle. All Rights Reserved. Connected to an idle instance. SQL> startup ORACLE instance started. Total System Global Area bytes Fixed Size bytes Variable Size bytes Database Buffers bytes Redo Buffers bytes Database mounted. ORA-: cannot identify/lock data file 4 - see DBWR trace file ORA-: data file 4: '/u/app/oracle/oradata/dbwdn/users.dbf' SQL> exit Disconnected from Oracle Database g Enterprise Edition Release .2.0.5.0 - Production With the Partitioning, OLAP, Data Mining and Real Application Testing options [oracle@primary dbwdn]$ ll /proc//fd ls: /proc//fd: No such file or directory [oracle@primary dbwdn]$ ps -ef |grep dbw0 oracle 1 0 : ? :: ora_dbw0_dbwdn oracle 0 : pts/1 :: grep dbw0 [oracle@primary dbwdn]$ ll /proc//fd total 0 lr-x------ 1 oracle oinstall Nov : 0 -> /dev/null lr-x------ 1 oracle oinstall Nov : 1 -> /dev/null lr-x------ 1 oracle oinstall Nov : -> /dev/zero lr-x------ 1 oracle oinstall Nov : -> /dev/zero lr-x------ 1 oracle oinstall Nov : -> /u/app/oracle/product/.2.0/db_1/rdbms/mesg/oraus.msb lrwx------ 1 oracle oinstall Nov : -> /u/app/oracle/product/.2.0/db_1/dbs/hc_dbwdn.dat lrwx------ 1 oracle oinstall Nov : -> /u/app/oracle/product/.2.0/db_1/dbs/lkDBWDN lrwx------ 1 oracle oinstall Nov : -> /u/app/oracle/oradata/dbwdn/control.ctl lrwx------ 1 oracle oinstall Nov : -> /u/app/oracle/oradata/dbwdn/control.ctl lrwx------ 1 oracle oinstall Nov : -> /u/app/oracle/oradata/dbwdn/control.ctl l-wx------ 1 oracle oinstall Nov : 2 -> /u/app/oracle/admin/dbwdn/bdump/dbwdn_dbw0_.trc lr-x------ 1 oracle oinstall Nov : 3 -> /dev/null lr-x------ 1 oracle oinstall Nov : 4 -> /dev/null l-wx------ 1 oracle oinstall Nov : 5 -> /u/app/oracle/admin/dbwdn/udump/dbwdn_ora_.trc l-wx------ 1 oracle oinstall Nov : 6 -> /u/app/oracle/admin/dbwdn/bdump/alert_dbwdn.log lrwx------ 1 oracle oinstall Nov : 7 -> /u/app/oracle/product/.2.0/db_1/dbs/hc_dbwdn.dat l-wx------ 1 oracle oinstall Nov : 8 -> /u/app/oracle/admin/dbwdn/bdump/alert_dbwdn.log lrwx------ 1 oracle oinstall Nov : 9 -> /u/app/oracle/product/.2.0/db_1/dbs/lkinstdbwdn (deleted) [oracle@primary dbwdn]$ 已经没法恢复了。 说明需要注意的是,rm误删除文件之后,千万不要慌张,稳住神,不要重启数据库,不要重启动系统。 AIX系统,我没有测试过。 使用备份集恢复上面的数据库文件: [oracle@primary dbwdn]$ rman target / Recovery Manager: Release .2.0.5.0 - Production on Tue Nov :: Copyright (c) , , Oracle. All rights reserved. connected to target database (not started) RMAN> startup nomount; Oracle instance started Total System Global Area bytes Fixed Size bytes Variable Size bytes Database Buffers bytes Redo Buffers bytes RMAN> alter database mount; using target database control file instead of recovery catalog database mounted RMAN> run 2> { 3> allocate channel t1 type to disk; RMAN-: =========================================================== RMAN-: =============== ERROR MESSAGE STACK FOLLOWS =============== RMAN-: =========================================================== RMAN-: error encountered while parsing input commands RMAN-: syntax error: found "to": expecting one of: "double-quoted-string, disk, equal, identifier, single-quoted-string" RMAN-: at line 3 column file: standard input RMAN> run 2> { 3> allocate channel t1 device type disk; 4> restore datafile 4; 5> recover datafile 4; 6> release channel t1; 7> } allocated channel: t1 channel t1: sid= devtype=DISK Starting restore at -NOV- :: channel t1: starting datafile backupset restore channel t1: specifying datafile(s) to restore from backup set restoring datafile to /u/app/oracle/oradata/dbwdn/users.dbf channel t1: reading from backup piece /u/bak/nrctnp_1_1.bak channel t1: restored backup piece 1 piece handle=/u/bak/nrctnp_1_1.bak tag=TAGT channel t1: restore complete, elapsed time: :: Finished restore at -NOV- :: Starting recover at -NOV- :: starting media recovery media recovery complete, elapsed time: :: Finished recover at -NOV- :: released channel: t1 RMAN> alter database open; database opened RMAN> Windows下数据恢复(把回收站清空后的恢复方法): 步骤: 1、单击“开始——运行,然后输入regedit (打开注册表) 2、依次展开:HEKEY——LOCAL——MACHIME/SOFTWARE/microsoft/WINDOWS/ CURRENTVERSION/EXPLORER/DESKTOP/NAMESPACE 在左边空白外点击“新建” ,选择:“主键”,把它命名为“FFO————B——9F——AAFE” 再把右边的“默认”的主键的键值设为“回收站”,然后退出注册表。就OK啦。 3、要重启计算机。 只要机器没有运行过磁盘整理。系统完好.任何时候的文件都可以找回来。
推荐整理分享linux rm误删除数据库文件的恢复方法(linux恢复rm删除目录),希望有所帮助,仅作参考,欢迎阅读内容。
文章相关热门搜索词:linux误删文件,linux rm -rf删除的文件怎么恢复,linux rm -rf删除的文件怎么恢复,linux误删文件,linux恢复rm删除目录,linux rm删除的文件在哪?,linux误删除文件,linux误删除文件,内容如对您有帮助,希望把文章链接给更多的朋友!
linux系统中UMASK权限的用法详细讲解 umask一般是用在你初始创建一个目录或者文件的时候赋予他们的权限。这里要说明两点:1、针对目录来说x权限代表可以进入该目录,所以说对于这个权
虚拟机下安装BackTrack5 (BT5)教程及BT5汉化方法 PS:backtrack安装过程中有2点要注意:第一:复制到%的时候会等大约来分钟;别以为是死机了!第二:登录账户和密码:root/toor(个人感觉还是Ubuntu的
linux vim配置文件(经典实用,值得珍藏) 此vim配置有以下优点:1,按F5可以直接编译并执行C、C++、java代码以及执行shell脚本,按F8可进行C、C++代码的调试2,自动插入文件头,新建C、C++源文件