rm-rf 恢复过程中滥用
多DBA一定rm -rf讨厌它,也许有一天自己将数据库,以消除一个中午,然后。那么就没有一个……这种情况下,……这个不幸真的发生,你真的无药可救?不必要,有解决方法。也许你遇到不幸时,有一天。你可以用它来拯救自己。里做恢复操作的前提是没有可用的rman备份。或者数据库冷备份等,也就是说,没有不论什么备份。
一、登陆SQLPLUS,并启动数据库
[oracle@ora10g ~]$ sqlplus / as sysdba
SQL*Plus: Release 10.2.0.1.0 - Production on Mon Aug 25 12:37:50 2014
Copyright (c) 1982, 2005, Oracle. All rights reserved.
Connected to an idle instance.
SQL> startup
ORACLE instance started.
Total System Global Area 285212672 bytes
Fixed Size 1218992 bytes
Variable Size 96470608 bytes
Database Buffers 184549376 bytes
Redo Buffers 2973696 bytes
Database mounted.
Database opened.
--查看实例初始化状态
SQL> select status from v$instance;
STATUS
------------
OPEN
--查看实例名
SQL> show parameter name;
NAME TYPE VALUE
------------------------------------ ----------- ------------------------------
db_file_name_convert string
db_name string ora10g
db_unique_name string ora10g
global_names boolean FALSE
instance_name string ora10g
lock_name_space string
log_file_name_convert string
service_names string ora10g
SQL> exit
Disconnected from Oracle Database 10g Enterprise Edition Release 10.2.0.1.0 - Production
With the Partitioning, OLAP and Data Mining options
二、模拟rm -rf误操作
[oracle@ora10g ~]$ cd /u01/app/oracle/oradata
[oracle@ora10g oradata]$ ll
total 4
drwxr-x--- 2 oracle oinstall 4096 Aug 25 11:15 ora10g
[oracle@ora10g oradata]$ pwd
/u01/app/oracle/oradata
[oracle@ora10g oradata]$ rm -rf ora10g
[oracle@ora10g oradata]$ exit
logout
[root@ora10g ~]# su - oracle
[oracle@ora10g ~]$ sqlplus / as sysdba
SQL*Plus: Release 10.2.0.1.0 - Production on Mon Aug 25 12:43:58 2014
Copyright (c) 1982, 2005, Oracle. All rights reserved.
Connected to:
Oracle Database 10g Enterprise Edition Release 10.2.0.1.0 - Production
With the Partitioning, OLAP and Data Mining options
SQL> select count(*) from dba_objects;
select count(*) from dba_objects
*
ERROR at line 1:
ORA-00604: error occurred at recursive SQL level 1
ORA-01116: error in opening database file 1
ORA-01110: data file 1: '/u01/app/oracle/oradata/ora10g/system01.dbf'
ORA-27041: unable to open file
Linux Error: 2: No such file or directory
Additional information: 3
SQL> select count(*) from dba_segments;
select count(*) from dba_segments
*
ERROR at line 1:
ORA-00604: error occurred at recursive SQL level 1
ORA-01116: error in opening database file 1
ORA-01110: data file 1: '/u01/app/oracle/oradata/ora10g/system01.dbf'
ORA-27041: unable to open file
Linux Error: 2: No such file or directory
Additional information: 3
因为数据文件都被删除,当中包含system01.dbf。是存放数据字典的容器,想要再訪问数据字典中得视图。当然是不可能的了,所以这里会报错。找不到文件,故障出现
--查看alert.log日志文件
[root@ora10g ~]# tailf /u01/app/oracle/admin/ora10g/bdump/alert_ora10g.log
ARCH shutting down
ARC2: Archival stopped
Mon Aug 25 12:45:38 2014
Errors in file /u01/app/oracle/admin/ora10g/bdump/ora10g_j000_3037.trc:
ORA-12012: error on auto execute of job 1
ORA-01116: error in opening database file 2
ORA-01110: data file 2: '/u01/app/oracle/oradata/ora10g/undotbs01.dbf'
ORA-27041: unable to open file
Linux Error: 2: No such file or directory
Additional information: 3
Mon Aug 25 12:46:43 2014
Errors in file /u01/app/oracle/admin/ora10g/bdump/ora10g_j000_3070.trc:
ORA-12012: error on auto execute of job 1
ORA-01116: error in opening database file 2
ORA-01110: data file 2: '/u01/app/oracle/oradata/ora10g/undotbs01.dbf'
ORA-27041: unable to open file
Linux Error: 2: No such file or directory
Additional information: 3
--查看dbwr进程,推断须要恢复文件句柄所在文件夹
SQL> !ps -ef|grep ora_dbw
oracle 2912 1 0 12:37 ? 00:00:00 ora_dbw0_ora10g
oracle 3078 3032 0 12:48 pts/3 00:00:00 /bin/bash -c ps -ef|grep ora_dbw
oracle 3080 3078 0 12:48 pts/3 00:00:00 grep ora_dbw
事实上这个时候,全部oracle的进程都还在。都是以ora_开头的都是oracle的后台进程:
SQL> !ps -ef|grep ora_
oracle 2906 1 0 12:37 ?
00:00:00 ora_pmon_ora10g
oracle 2908 1 0 12:37 ? 00:00:00 ora_psp0_ora10g
oracle 2910 1 0 12:37 ?
00:00:00 ora_mman_ora10g
oracle 2912 1 0 12:37 ? 00:00:00 ora_dbw0_ora10g
oracle 2914 1 0 12:37 ? 00:00:00 ora_lgwr_ora10g
oracle 2916 1 0 12:37 ? 00:00:00 ora_ckpt_ora10g
oracle 2918 1 0 12:38 ? 00:00:01 ora_smon_ora10g
oracle 2920 1 0 12:38 ? 00:00:00 ora_reco_ora10g
oracle 2922 1 0 12:38 ?
00:00:00 ora_cjq0_ora10g
oracle 2924 1 0 12:38 ?
00:00:01 ora_mmon_ora10g
oracle 2926 1 0 12:38 ? 00:00:00 ora_mmnl_ora10g
oracle 2928 1 0 12:38 ? 00:00:00 ora_d000_ora10g
oracle 2930 1 0 12:38 ? 00:00:00 ora_s000_ora10g
oracle 2934 1 0 12:38 ?
00:00:00 ora_arc0_ora10g
oracle 2936 1 0 12:38 ?
00:00:00 ora_arc1_ora10g
oracle 2941 1 0 12:38 ? 00:00:00 ora_qmnc_ora10g
oracle 2943 1 0 12:38 ? 00:00:00 ora_q000_ora10g
oracle 2945 1 0 12:38 ? 00:00:00 ora_q001_ora10g
oracle 3077 1 0 12:48 ?
00:00:00 ora_j000_ora10g
oracle 3085 3032 0 12:49 pts/3 00:00:00 /bin/bash -c ps -ef|grep ora_
oracle 3087 3085 0 12:49 pts/3 00:00:00 /bin/bash -c ps -ef|grep ora_
由此可知,我们须要的被删除的文件句柄在/proc/2912/fd下
三、開始恢复误删除的文件
--恢复数据文件和控制文件
SQL> exit
Disconnected from Oracle Database 10g Enterprise Edition Release 10.2.0.1.0 - Production
With the Partitioning, OLAP and Data Mining options
[oracle@ora10g ~]$ cd /proc/2912
[oracle@ora10g 2912]$ ll
total 0
dr-xr-xr-x 2 oracle oinstall 0 Aug 25 12:51 attr
-r-------- 1 oracle oinstall 0 Aug 25 12:51 auxv
-r--r--r-- 1 oracle oinstall 0 Aug 25 12:48 cmdline
-rw-r--r-- 1 oracle oinstall 0 Aug 25 12:51 coredump_filter
-r--r--r-- 1 oracle oinstall 0 Aug 25 12:51 cpuset
lrwxrwxrwx 1 oracle oinstall 0 Aug 25 12:51 cwd -> /u01/app/oracle/product/10.2.0/db_1/dbs
-r-------- 1 oracle oinstall 0 Aug 25 12:51 environ
lrwxrwxrwx 1 oracle oinstall 0 Aug 25 12:51 exe -> /u01/app/oracle/product/10.2.0/db_1/bin/oracle
dr-x------ 2 oracle oinstall 0 Aug 25 12:51 fd
-r-------- 1 oracle oinstall 0 Aug 25 12:51 limits
-rw-r--r-- 1 oracle oinstall 0 Aug 25 12:51 loginuid
-r--r--r-- 1 oracle oinstall 0 Aug 25 12:37 maps
-rw------- 1 oracle oinstall 0 Aug 25 12:51 mem
-r--r--r-- 1 oracle oinstall 0 Aug 25 12:51 mounts
-r-------- 1 oracle oinstall 0 Aug 25 12:51 mountstats
-rw-r--r-- 1 oracle oinstall 0 Aug 25 12:51 oom_adj
-r--r--r-- 1 oracle oinstall 0 Aug 25 12:51 oom_score
lrwxrwxrwx 1 oracle oinstall 0 Aug 25 12:51 root -> /
-r--r--r-- 1 oracle oinstall 0 Aug 25 12:51 schedstat
-r-------- 1 oracle oinstall 0 Aug 25 12:51 smaps
-r--r--r-- 1 oracle oinstall 0 Aug 25 12:37 stat
-r--r--r-- 1 oracle oinstall 0 Aug 25 12:51 statm
-r--r--r-- 1 oracle oinstall 0 Aug 25 12:48 status
dr-xr-xr-x 3 oracle oinstall 0 Aug 25 12:51 task
-r--r--r-- 1 oracle oinstall 0 Aug 25 12:51 wchan
[oracle@ora10g 2912]$ cd fd
[oracle@ora10g fd]$ ls -ltr
total 0
lr-x------ 1 oracle oinstall 64 Aug 25 12:51 0 -> /dev/null
l-wx------ 1 oracle oinstall 64 Aug 25 12:51 6 -> /u01/app/oracle/admin/ora10g/bdump/alert_ora10g.log
l-wx------ 1 oracle oinstall 64 Aug 25 12:51 5 -> /u01/app/oracle/admin/ora10g/udump/ora10g_ora_2904.trc
lr-x------ 1 oracle oinstall 64 Aug 25 12:51 4 -> /dev/null
lr-x------ 1 oracle oinstall 64 Aug 25 12:51 3 -> /dev/null
lr-x------ 1 oracle oinstall 64 Aug 25 12:51 2 -> /dev/null
lr-x------ 1 oracle oinstall 64 Aug 25 12:51 1 -> /dev/null
lrwx------ 1 oracle oinstall 64 Aug 25 12:51 9 -> /u01/app/oracle/product/10.2.0/db_1/dbs/hc_ora10g.dat
l-wx------ 1 oracle oinstall 64 Aug 25 12:51 8 -> /u01/app/oracle/admin/ora10g/bdump/alert_ora10g.log
lrwx------ 1 oracle oinstall 64 Aug 25 12:51 7 -> /u01/app/oracle/product/10.2.0/db_1/dbs/lkinstora10g (deleted)
lrwx------ 1 oracle oinstall 64 Aug 25 12:51 23 -> /u01/app/oracle/oradata/ora10g/temp01.dbf (deleted)
lrwx------ 1 oracle oinstall 64 Aug 25 12:51 22 -> /u01/app/oracle/oradata/ora10g/example01.dbf (deleted)
lrwx------ 1 oracle oinstall 64 Aug 25 12:51 21 -> /u01/app/oracle/oradata/ora10g/users01.dbf (deleted)
lrwx------ 1 oracle oinstall 64 Aug 25 12:51 20 -> /u01/app/oracle/oradata/ora10g/sysaux01.dbf (deleted)
lrwx------ 1 oracle oinstall 64 Aug 25 12:51 19 -> /u01/app/oracle/oradata/ora10g/undotbs01.dbf (deleted)
lrwx------ 1 oracle oinstall 64 Aug 25 12:51 18 -> /u01/app/oracle/oradata/ora10g/system01.dbf (deleted)
lrwx------ 1 oracle oinstall 64 Aug 25 12:51 17 -> /u01/app/oracle/oradata/ora10g/control03.ctl (deleted)
lrwx------ 1 oracle oinstall 64 Aug 25 12:51 16 -> /u01/app/oracle/oradata/ora10g/control02.ctl (deleted)
lrwx------ 1 oracle oinstall 64 Aug 25 12:51 15 -> /u01/app/oracle/oradata/ora10g/control01.ctl (deleted)
lrwx------ 1 oracle oinstall 64 Aug 25 12:51 14 -> /u01/app/oracle/product/10.2.0/db_1/dbs/lkORA10G
lrwx------ 1 oracle oinstall 64 Aug 25 12:51 13 -> /u01/app/oracle/product/10.2.0/db_1/dbs/hc_ora10g.dat
lr-x------ 1 oracle oinstall 64 Aug 25 12:51 12 -> /dev/zero
lr-x------ 1 oracle oinstall 64 Aug 25 12:51 11 -> /dev/zero
lrwx------ 1 oracle oinstall 64 Aug 25 12:51 10 -> /u01/app/oracle/admin/ora10g/adump/ora_2904.aud
[oracle@ora10g fd]$
watermark/2/text/aHR0cDovL2Jsb2cuY3Nkbi5uZXQvYWFyb244MjE5/font/5a6L5L2T/fontsize/400/fill/I0JBQkFCMA==/dissolve/70/gravity/SouthEast" alt="">
分析:能够看句柄7,15-23的文件末尾被标记(deleted),这是由刚才的rm -rf操作所导致的。误删除后仅仅要Oracle数据库未重新启动,进程就不会停止,那么就能够通过/proc/#oracle进程号/fd文件夹中的文件句柄号。来对这些被delete的文件进行恢复,方法就是cp文件句柄到原路径,注意一点这里假设不是在fd文件夹,那就要用绝对路径来指定文件句柄,假设删除文件后就。又对数据库进行了关闭操作。那就无解了
--手动创建ora10g实例名命名的文件夹并cp句柄到详细路径
[oracle@ora10g fd]$ mkdir /u01/app/oracle/oradata/ora10g/
[oracle@ora10g fd]$ cp 7 /u01/app/oracle/product/10.2.0/db_1/dbs/lkinstora10g
[oracle@ora10g fd]$ cp 23 /u01/app/oracle/oradata/ora10g/temp01.dbf
[oracle@ora10g fd]$ cp 22 /u01/app/oracle/oradata/ora10g/example01.dbf
[oracle@ora10g fd]$ cp 21 /u01/app/oracle/oradata/ora10g/users01.dbf
[oracle@ora10g fd]$ cp 20 /u01/app/oracle/oradata/ora10g/sysaux01.dbf
[oracle@ora10g fd]$ cp 19 /u01/app/oracle/oradata/ora10g/undotbs01.dbf
[oracle@ora10g fd]$ cp 18 /u01/app/oracle/oradata/ora10g/system01.dbf
[oracle@ora10g fd]$ cp 17 /u01/app/oracle/oradata/ora10g/control03.ctl
[oracle@ora10g fd]$ cp 16 /u01/app/oracle/oradata/ora10g/control02.ctl
[oracle@ora10g fd]$ cp 15 /u01/app/oracle/oradata/ora10g/control01.ctl
注意。这里一定要注意权限问题。要用oracle用户去cp,假设用root去cp出来的文件,oracle进程是没有权限操作的,当然。你也能够在用root恢复完后,再chown一下:
[root@ora10g fd]# chown oracle.oinstall /u01/app/oracle -R
可是一定要注意,必须等所有数据文件恢复后才干够做chown操作,由于一旦运行了该操作,原来的ora_进程会停止!!。你再也无法恢复丢失的数据了。!!这也是为什么推荐用oralce用户来cp的原因
[root@ora10g fd]# ps -ef | grep ora_dbw
oracle 1 0 13:50 ? 00:00:02 ora_dbw0_ora10g
root 4012 3825 0 15:15 pts/3 00:00:00 grep ora_dbw
[root@ora10g fd]# chown oracle.oinstall /u01/ -R
[root@ora10g fd]# cd /proc/3470
-bash: cd: /proc/3470: No such file or directory
[root@ora10g fd]# ps -ef | grep ora_dbw
root 4026 3825 0 15:18 pts/3 00:00:00 grep ora_dbw
[root@ora10g fd]# ps -ef | grep ora_
root 4036 3825 0 15:22 pts/3 00:00:00 grep ora_
[root@ora10g fd]#
--再次查看fd文件夹下得文件状态
[oracle@ora10g fd]$ ls -ltr
total 0
lr-x------ 1 oracle oinstall 64 Aug 25 12:51 0 -> /dev/null
l-wx------ 1 oracle oinstall 64 Aug 25 12:51 6 -> /u01/app/oracle/admin/ora10g/bdump/alert_ora10g.log
l-wx------ 1 oracle oinstall 64 Aug 25 12:51 5 -> /u01/app/oracle/admin/ora10g/udump/ora10g_ora_2904.trc
lr-x------ 1 oracle oinstall 64 Aug 25 12:51 4 -> /dev/null
lr-x------ 1 oracle oinstall 64 Aug 25 12:51 3 -> /dev/null
lr-x------ 1 oracle oinstall 64 Aug 25 12:51 2 -> /dev/null
lr-x------ 1 oracle oinstall 64 Aug 25 12:51 1 -> /dev/null
lrwx------ 1 oracle oinstall 64 Aug 25 12:51 9 -> /u01/app/oracle/product/10.2.0/db_1/dbs/hc_ora10g.dat
l-wx------ 1 oracle oinstall 64 Aug 25 12:51 8 -> /u01/app/oracle/admin/ora10g/bdump/alert_ora10g.log
lrwx------ 1 oracle oinstall 64 Aug 25 12:51 7 -> /u01/app/oracle/product/10.2.0/db_1/dbs/lkinstora10g (deleted)
lrwx------ 1 oracle oinstall 64 Aug 25 12:51 23 -> /u01/app/oracle/oradata/ora10g/temp01.dbf (deleted)
lrwx------ 1 oracle oinstall 64 Aug 25 12:51 22 -> /u01/app/oracle/oradata/ora10g/example01.dbf (deleted)
lrwx------ 1 oracle oinstall 64 Aug 25 12:51 21 -> /u01/app/oracle/oradata/ora10g/users01.dbf (deleted)
lrwx------ 1 oracle oinstall 64 Aug 25 12:51 20 -> /u01/app/oracle/oradata/ora10g/sysaux01.dbf (deleted)
lrwx------ 1 oracle oinstall 64 Aug 25 12:51 19 -> /u01/app/oracle/oradata/ora10g/undotbs01.dbf (deleted)
lrwx------ 1 oracle oinstall 64 Aug 25 12:51 18 -> /u01/app/oracle/oradata/ora10g/system01.dbf (deleted)
lrwx------ 1 oracle oinstall 64 Aug 25 12:51 17 -> /u01/app/oracle/oradata/ora10g/control03.ctl (deleted)
lrwx------ 1 oracle oinstall 64 Aug 25 12:51 16 -> /u01/app/oracle/oradata/ora10g/control02.ctl (deleted)
lrwx------ 1 oracle oinstall 64 Aug 25 12:51 15 -> /u01/app/oracle/oradata/ora10g/control01.ctl (deleted)
lrwx------ 1 oracle oinstall 64 Aug 25 12:51 14 -> /u01/app/oracle/product/10.2.0/db_1/dbs/lkORA10G
lrwx------ 1 oracle oinstall 64 Aug 25 12:51 13 -> /u01/app/oracle/product/10.2.0/db_1/dbs/hc_ora10g.dat
lr-x------ 1 oracle oinstall 64 Aug 25 12:51 12 -> /dev/zero
lr-x------ 1 oracle oinstall 64 Aug 25 12:51 11 -> /dev/zero
lrwx------ 1 oracle oinstall 64 Aug 25 12:51 10 -> /u01/app/oracle/admin/ora10g/adump/ora_2904.aud
对文件进行恢复以后,直接查询fd文件夹下的文件状态,依旧能够看到是(deleted)的,可是没关系,实际上文件已经恢复成功了
--开启还有一个session查看文件是否已经恢复
[root@ora10g ~]# su - oracle
[oracle@ora10g ~]$ cd /u01/app/oracle/oradata/ora10g
[oracle@ora10g ora10g]$ ll
total 914656
-rw-r----- 1 oracle oinstall 7061504 Aug 25 13:03 control01.ctl
-rw-r----- 1 oracle oinstall 7061504 Aug 25 13:03 control02.ctl
-rw-r----- 1 oracle oinstall 7061504 Aug 25 13:03 control03.ctl
-rw-r----- 1 oracle oinstall 104865792 Aug 25 13:00 example01.dbf
-rw-r----- 1 oracle oinstall 251666432 Aug 25 13:01 sysaux01.dbf
-rw-r----- 1 oracle oinstall 503324672 Aug 25 13:02 system01.dbf
-rw-r----- 1 oracle oinstall 20979712 Aug 25 12:59 temp01.dbf
-rw-r----- 1 oracle oinstall 31465472 Aug 25 13:01 undotbs01.dbf
-rw-r----- 1 oracle oinstall 5251072 Aug 25 13:00 users01.dbf
[oracle@ora10g ora10g]$ pwd
/u01/app/oracle/oradata/ora10g
[oracle@ora10g ora10g]$
--恢复在线日志文件
[oracle@ora10g fd]$ ps -ef | grep ora_lgwr
oracle 2914 1 0 12:37 ?
00:00:01 ora_lgwr_ora10g
oracle 3255 2999 0 13:09 pts/2 00:00:00 grep ora_lgwr
[oracle@ora10g fd]$ cd /proc/2914/fd
[oracle@ora10g fd]$ ls -ltr
total 0
lr-x------ 1 oracle oinstall 64 Aug 25 13:09 0 -> /dev/null
l-wx------ 1 oracle oinstall 64 Aug 25 13:09 5 -> /u01/app/oracle/admin/ora10g/udump/ora10g_ora_2904.trc
lr-x------ 1 oracle oinstall 64 Aug 25 13:09 4 -> /dev/null
lr-x------ 1 oracle oinstall 64 Aug 25 13:09 3 -> /dev/null
l-wx------ 1 oracle oinstall 64 Aug 25 13:09 2 -> /u01/app/oracle/admin/ora10g/bdump/ora10g_lgwr_2914.trc
lr-x------ 1 oracle oinstall 64 Aug 25 13:09 1 -> /dev/null
lrwx------ 1 oracle oinstall 64 Aug 25 13:09 9 -> /u01/app/oracle/product/10.2.0/db_1/dbs/hc_ora10g.dat
l-wx------ 1 oracle oinstall 64 Aug 25 13:09 8 -> /u01/app/oracle/admin/ora10g/bdump/alert_ora10g.log
lrwx------ 1 oracle oinstall 64 Aug 25 13:09 7 -> /u01/app/oracle/product/10.2.0/db_1/dbs/lkinstora10g (deleted)
l-wx------ 1 oracle oinstall 64 Aug 25 13:09 6 -> /u01/app/oracle/admin/ora10g/bdump/alert_ora10g.log
lrwx------ 1 oracle oinstall 64 Aug 25 13:09 26 -> /u01/app/oracle/oradata/ora10g/temp01.dbf (deleted)
lrwx------ 1 oracle oinstall 64 Aug 25 13:09 25 -> /u01/app/oracle/oradata/ora10g/example01.dbf (deleted)
lrwx------ 1 oracle oinstall 64 Aug 25 13:09 24 -> /u01/app/oracle/oradata/ora10g/users01.dbf (deleted)
lrwx------ 1 oracle oinstall 64 Aug 25 13:09 23 -> /u01/app/oracle/oradata/ora10g/sysaux01.dbf (deleted)
lrwx------ 1 oracle oinstall 64 Aug 25 13:09 22 -> /u01/app/oracle/oradata/ora10g/undotbs01.dbf (deleted)
lrwx------ 1 oracle oinstall 64 Aug 25 13:09 21 -> /u01/app/oracle/oradata/ora10g/system01.dbf (deleted)
lrwx------ 1 oracle oinstall 64 Aug 25 13:09 20 -> /u01/app/oracle/oradata/ora10g/redo03.log (deleted)
lrwx------ 1 oracle oinstall 64 Aug 25 13:09 19 -> /u01/app/oracle/oradata/ora10g/redo02.log (deleted)
lrwx------ 1 oracle oinstall 64 Aug 25 13:09 18 -> /u01/app/oracle/oradata/ora10g/redo01.log (deleted)
lrwx------ 1 oracle oinstall 64 Aug 25 13:09 17 -> /u01/app/oracle/oradata/ora10g/control03.ctl (deleted)
lrwx------ 1 oracle oinstall 64 Aug 25 13:09 16 -> /u01/app/oracle/oradata/ora10g/control02.ctl (deleted)
lrwx------ 1 oracle oinstall 64 Aug 25 13:09 15 -> /u01/app/oracle/oradata/ora10g/control01.ctl (deleted)
lrwx------ 1 oracle oinstall 64 Aug 25 13:09 14 -> /u01/app/oracle/product/10.2.0/db_1/dbs/lkORA10G
lrwx------ 1 oracle oinstall 64 Aug 25 13:09 13 -> /u01/app/oracle/product/10.2.0/db_1/dbs/hc_ora10g.dat
lr-x------ 1 oracle oinstall 64 Aug 25 13:09 12 -> /dev/zero
lr-x------ 1 oracle oinstall 64 Aug 25 13:09 11 -> /dev/zero
lrwx------ 1 oracle oinstall 64 Aug 25 13:09 10 -> /u01/app/oracle/admin/ora10g/adump/ora_2904.aud
[oracle@ora10g fd]$
能够看到。依据ora_lgwr进程找到的/proc//fd文件夹下,也有刚才恢复过得数据文件句柄,但句柄的编号,和刚才在/proc/2912/fd以下是不一致的,这也就说明,这些进程在执行的时候,各自有各自的文件句柄编号。互不影响。因为刚才已经对数据文件和控制文件进行了恢复,此时,仅仅须要再对online redo logfile进行恢复就可以
--開始恢复online redo logfile
[oracle@ora10g fd]$ cp 20 /u01/app/oracle/oradata/ora10g/redo03.log
[oracle@ora10g fd]$ cp 19 /u01/app/oracle/oradata/ora10g/redo02.log
[oracle@ora10g fd]$ cp 18 /u01/app/oracle/oradata/ora10g/redo01.log
--在还有一个session中查看online redo log是否已经恢复
[oracle@ora10g ora10g]$ ll
total 1068436
-rw-r----- 1 oracle oinstall 7061504 Aug 25 13:03 control01.ctl
-rw-r----- 1 oracle oinstall 7061504 Aug 25 13:03 control02.ctl
-rw-r----- 1 oracle oinstall 7061504 Aug 25 13:03 control03.ctl
-rw-r----- 1 oracle oinstall 104865792 Aug 25 13:00 example01.dbf
-rw-r----- 1 oracle oinstall 52429312 Aug 25 13:12 redo01.log
-rw-r----- 1 oracle oinstall 52429312 Aug 25 13:12 redo02.log
-rw-r----- 1 oracle oinstall 52429312 Aug 25 13:12 redo03.log
-rw-r----- 1 oracle oinstall 251666432 Aug 25 13:01 sysaux01.dbf
-rw-r----- 1 oracle oinstall 503324672 Aug 25 13:02 system01.dbf
-rw-r----- 1 oracle oinstall 20979712 Aug 25 12:59 temp01.dbf
-rw-r----- 1 oracle oinstall 31465472 Aug 25 13:01 undotbs01.dbf
-rw-r----- 1 oracle oinstall 5251072 Aug 25 13:00 users01.dbf
[oracle@ora10g ora10g]$
--又一次登录数据库,进行dml操作
[oracle@ora10g fd]$ sqlplus / as sysdba
SQL*Plus: Release 10.2.0.1.0 - Production on Mon Aug 25 13:14:25 2014
Copyright (c) 1982, 2005, Oracle. All rights reserved.
Connected to:
Oracle Database 10g Enterprise Edition Release 10.2.0.1.0 - Production
With the Partitioning, OLAP and Data Mining options
SQL> select count(*) from dba_objects;
COUNT(*)
----------
50314
此时数据库能够正常dml了,可是关闭后再开启数据库,会报600错误:
SQL> shutdown immediate
Database closed.
Database dismounted.
ORACLE instance shut down.
SQL> startup
ORACLE instance started.
Total System Global Area 285212672 bytes
Fixed Size 1218992 bytes
Variable Size 96470608 bytes
Database Buffers 184549376 bytes
Redo Buffers 2973696 bytes
Database mounted.
ORA-00600: internal error code, arguments: [kcratr1_lastbwr], [], [], [], [],
[], [], []
--查看alert.log
Mon Aug 25 13:19:16 2014
ALTER DATABASE MOUNT
Mon Aug 25 13:19:20 2014
Setting recovery target incarnation to 2
Mon Aug 25 13:19:21 2014
Successful mount of redo thread 1, with mount id 4175423764
Mon Aug 25 13:19:21 2014
Database mounted in Exclusive Mode
Completed: ALTER DATABASE MOUNT
Mon Aug 25 13:19:21 2014
ALTER DATABASE OPEN
Mon Aug 25 13:19:21 2014
Beginning crash recovery of 1 threads
Mon Aug 25 13:19:21 2014
Started redo scan
Mon Aug 25 13:19:21 2014
Errors in file /u01/app/oracle/admin/ora10g/udump/ora10g_ora_3320.trc:
ORA-00600: internal error code, arguments: [kcratr1_lastbwr], [], [], [], [], [], [], []
Mon Aug 25 13:19:22 2014
Aborting crash recovery due to error 600--终止实例恢复
依据Metalink note ID: [393984.1]文档的说明。出现该问题的解决办法是oracle不能运行实例恢复。手工完毕介质恢复后即能够打开
SQL> shutdown immediate
ORA-01109: database not open
Database dismounted.
ORACLE instance shut down.
SQL> startup mount
ORACLE instance started.
Total System Global Area 285212672 bytes
Fixed Size 1218992 bytes
Variable Size 96470608 bytes
Database Buffers 184549376 bytes
Redo Buffers 2973696 bytes
Database mounted.
SQL> recover database
Media recovery complete.
SQL> alter database open;
Database altered.
SQL> select count(*) from dba_objects;
COUNT(*)
----------
50314
SQL>
--再次验证数据文件
SQL> !ps -ef | grep ora_
oracle 3464 1 0 13:50 ? 00:00:00 ora_pmon_ora10g
oracle 3466 1 0 13:50 ?
00:00:00 ora_psp0_ora10g
oracle 3468 1 0 13:50 ?
00:00:00 ora_mman_ora10g
oracle 3470 1 0 13:50 ? 00:00:00 ora_dbw0_ora10g
oracle 3472 1 0 13:50 ? 00:00:00 ora_lgwr_ora10g
oracle 3474 1 0 13:50 ?
00:00:01 ora_ckpt_ora10g
oracle 3476 1 0 13:50 ?
00:00:01 ora_smon_ora10g
oracle 3478 1 0 13:50 ? 00:00:00 ora_reco_ora10g
oracle 3480 1 0 13:50 ? 00:00:01 ora_cjq0_ora10g
oracle 3482 1 0 13:50 ? 00:00:01 ora_mmon_ora10g
oracle 3484 1 0 13:50 ? 00:00:00 ora_mmnl_ora10g
oracle 3486 1 0 13:50 ? 00:00:00 ora_d000_ora10g
oracle 3488 1 0 13:50 ? 00:00:00 ora_s000_ora10g
oracle 3493 1 0 13:50 ? 00:00:00 ora_arc0_ora10g
oracle 3495 1 0 13:50 ? 00:00:00 ora_arc1_ora10g
oracle 3499 1 0 13:51 ?
00:00:00 ora_qmnc_ora10g
oracle 3513 1 0 13:51 ?
00:00:00 ora_q000_ora10g
oracle 3515 1 0 13:51 ? 00:00:00 ora_q001_ora10g
oracle 3565 1 0 14:04 ? 00:00:00 ora_j000_ora10g
oracle 3568 3278 0 14:04 pts/5 00:00:00 /bin/bash -c ps -ef | grep ora_
SQL> !ls -ltr /proc//fd
total 0
lrwx------ 1 oracle oinstall 64 Aug 25 14:04 9 -> /u01/app/oracle/product/10.2.0/db_1/dbs/hc_ora10g.dat
l-wx------ 1 oracle oinstall 64 Aug 25 14:04 8 -> /u01/app/oracle/admin/ora10g/bdump/alert_ora10g.log
lrwx------ 1 oracle oinstall 64 Aug 25 14:04 7 -> /u01/app/oracle/product/10.2.0/db_1/dbs/lkinstora10g (deleted)
l-wx------ 1 oracle oinstall 64 Aug 25 14:04 6 -> /u01/app/oracle/admin/ora10g/bdump/alert_ora10g.log
l-wx------ 1 oracle oinstall 64 Aug 25 14:04 5 -> /u01/app/oracle/admin/ora10g/udump/ora10g_ora_3462.trc
lr-x------ 1 oracle oinstall 64 Aug 25 14:04 4 -> /dev/null
lr-x------ 1 oracle oinstall 64 Aug 25 14:04 3 -> /dev/null
l-wx------ 1 oracle oinstall 64 Aug 25 14:04 2 -> /u01/app/oracle/admin/ora10g/bdump/ora10g_lgwr_3472.trc
lrwx------ 1 oracle oinstall 64 Aug 25 14:04 13 -> /u01/app/oracle/product/10.2.0/db_1/dbs/hc_ora10g.dat
lr-x------ 1 oracle oinstall 64 Aug 25 14:04 12 -> /dev/zero
lr-x------ 1 oracle oinstall 64 Aug 25 14:04 11 -> /dev/zero
lrwx------ 1 oracle oinstall 64 Aug 25 14:04 10 -> /u01/app/oracle/admin/ora10g/adump/ora_3462.aud
lr-x------ 1 oracle oinstall 64 Aug 25 14:04 1 -> /dev/null
lr-x------ 1 oracle oinstall 64 Aug 25 14:04 0 -> /dev/null
lrwx------ 1 oracle oinstall 64 Aug 25 14:04 26 -> /u01/app/oracle/oradata/ora10g/temp01.dbf
lrwx------ 1 oracle oinstall 64 Aug 25 14:04 25 -> /u01/app/oracle/oradata/ora10g/example01.dbf
lrwx------ 1 oracle oinstall 64 Aug 25 14:04 24 -> /u01/app/oracle/oradata/ora10g/users01.dbf
lrwx------ 1 oracle oinstall 64 Aug 25 14:04 23 -> /u01/app/oracle/oradata/ora10g/sysaux01.dbf
lrwx------ 1 oracle oinstall 64 Aug 25 14:04 22 -> /u01/app/oracle/oradata/ora10g/undotbs01.dbf
lrwx------ 1 oracle oinstall 64 Aug 25 14:04 21 -> /u01/app/oracle/oradata/ora10g/system01.dbf
lrwx------ 1 oracle oinstall 64 Aug 25 14:04 20 -> /u01/app/oracle/oradata/ora10g/redo03.log
lrwx------ 1 oracle oinstall 64 Aug 25 14:04 19 -> /u01/app/oracle/oradata/ora10g/redo02.log
lrwx------ 1 oracle oinstall 64 Aug 25 14:04 18 -> /u01/app/oracle/oradata/ora10g/redo01.log
lrwx------ 1 oracle oinstall 64 Aug 25 14:04 17 -> /u01/app/oracle/oradata/ora10g/control03.ctl
lrwx------ 1 oracle oinstall 64 Aug 25 14:04 16 -> /u01/app/oracle/oradata/ora10g/control02.ctl
lrwx------ 1 oracle oinstall 64 Aug 25 14:04 15 -> /u01/app/oracle/oradata/ora10g/control01.ctl
lrwx------ 1 oracle oinstall 64 Aug 25 14:04 14 -> /u01/app/oracle/product/10.2.0/db_1/dbs/lkORA10G
SQL>
此时数据文件都已经正常了,每次启动数据库实例后,进程都会再/proc下生成一个相应的以进程号命名的文件夹,存放操作中涉及到的文件句柄,此时lgwr进程相应的文件夹已经变为3472,而原来的2914文件夹已经不存在了
--------------------------------------------------------------------------------------
第2次測试(创建完表并插入2条数据后。不提交,直接删除/u01/app/oracle/oradata/ora10g/下的所有文件)
[oracle@ora10g fd]$ sqlplus / as sysdba
SQL*Plus: Release 10.2.0.1.0 - Production on Mon Aug 25 15:57:57 2014
Copyright (c) 1982, 2005, Oracle. All rights reserved.
Connected to:
Oracle Database 10g Enterprise Edition Release 10.2.0.1.0 - Production
With the Partitioning, OLAP and Data Mining options
SQL> select count(*) from dba_objects;
COUNT(*)
----------
SQL> create user aaron8219 identified by oracle;
User created.
SQL> grant dba to aaron8219;
Grant succeeded.
SQL> conn aaron8219/oracle
Connected.
SQL> create table test1(int number);
Table created.
SQL> select count(*) from dba_objects;
COUNT(*)
----------
SQL> insert into test1 values(1);
1 row created.
SQL> insert into test1 values(2);
1 row created.
SQL> select * from test1;
INT
----------
1
2
SQL> select group#,status,members from v$log;
GROUP# STATUS MEMBERS
---------- ---------------- ----------
1 CURRENT 1
2 UNUSED 1
3 INACTIVE 1
SQL> exit --注意,这里运行exit会触发隐式提交,也就是说,insert的语句已经从buffer中写入了redo01.log中
Disconnected from Oracle Database 10g Enterprise Edition Release 10.2.0.1.0 - Production
With the Partitioning, OLAP and Data Mining options
[oracle@ora10g fd]$ cd /u01/app/oracle/oradata
[oracle@ora10g oradata]$ cd ora10g
[oracle@ora10g ora10g]$ ll
total 1068440
-rw-r----- 1 oracle oinstall 7061504 Aug 25 16:01 control01.ctl
-rw-r----- 1 oracle oinstall 7061504 Aug 25 16:01 control02.ctl
-rw-r----- 1 oracle oinstall 7061504 Aug 25 16:01 control03.ctl
-rw-r----- 1 oracle oinstall 104865792 Aug 25 15:52 example01.dbf
-rw-r----- 1 oracle oinstall 52429312 Aug 25 16:01 redo01.log
-rw-r----- 1 oracle oinstall 52429312 Aug 25 15:52 redo02.log
-rw-r----- 1 oracle oinstall 52429312 Aug 25 15:52 redo03.log
-rw-r----- 1 oracle oinstall 251666432 Aug 25 16:01 sysaux01.dbf
-rw-r----- 1 oracle oinstall 503324672 Aug 25 15:57 system01.dbf
-rw-r----- 1 oracle oinstall 20979712 Aug 25 15:50 temp01.dbf
-rw-r----- 1 oracle oinstall 31465472 Aug 25 15:57 undotbs01.dbf
-rw-r----- 1 oracle oinstall 5251072 Aug 25 15:52 users01.dbf
--删除数据库文件。模拟故障
[oracle@ora10g ora10g]$ rm -rf *.*
[oracle@ora10g ora10g]$ ll
total 0
[oracle@ora10g ora10g]$ ps -ef | grep ora_lgwr
oracle 1 0 15:52 ? 00:00:01 ora_lgwr_ora10g
oracle 6784 2999 0 16:02 pts/2 00:00:00 grep ora_lgwr
[oracle@ora10g ora10g]$ cd /proc/4566/fd
[oracle@ora10g fd]$ ll
total 0
lr-x------ 1 oracle oinstall 64 Aug 25 16:02 0 -> /dev/null
lr-x------ 1 oracle oinstall 64 Aug 25 16:02 1 -> /dev/null
lrwx------ 1 oracle oinstall 64 Aug 25 16:02 10 -> /u01/app/oracle/admin/ora10g/adump/ora_4556.aud
l-wx------ 1 oracle oinstall 64 Aug 25 16:02 11 -> /u01/app/oracle/product/10.2.0/db_1/cfgtoollogs/dbca/ora10g/mkplug_v3_ora10g.log
lr-x------ 1 oracle oinstall 64 Aug 25 16:02 12 -> /dev/zero
lr-x------ 1 oracle oinstall 64 Aug 25 16:02 13 -> /dev/zero
lrwx------ 1 oracle oinstall 64 Aug 25 16:02 14 -> /u01/app/oracle/product/10.2.0/db_1/dbs/hc_ora10g.dat
lrwx------ 1 oracle oinstall 64 Aug 25 16:02 15 -> /u01/app/oracle/product/10.2.0/db_1/dbs/lkORA10G
lrwx------ 1 oracle oinstall 64 Aug 25 16:02 16 -> /u01/app/oracle/oradata/ora10g/control01.ctl (deleted)
lrwx------ 1 oracle oinstall 64 Aug 25 16:02 17 -> /u01/app/oracle/oradata/ora10g/control02.ctl (deleted)
lrwx------ 1 oracle oinstall 64 Aug 25 16:02 18 -> /u01/app/oracle/oradata/ora10g/control03.ctl (deleted)
lrwx------ 1 oracle oinstall 64 Aug 25 16:02 19 -> /u01/app/oracle/oradata/ora10g/redo01.log (deleted)
l-wx------ 1 oracle oinstall 64 Aug 25 16:02 2 -> /u01/app/oracle/admin/ora10g/bdump/ora10g_lgwr_4566.trc
lrwx------ 1 oracle oinstall 64 Aug 25 16:02 20 -> /u01/app/oracle/oradata/ora10g/redo02.log (deleted)
lrwx------ 1 oracle oinstall 64 Aug 25 16:02 21 -> /u01/app/oracle/oradata/ora10g/redo03.log (deleted)
lrwx------ 1 oracle oinstall 64 Aug 25 16:02 22 -> /u01/app/oracle/oradata/ora10g/system01.dbf (deleted)
lrwx------ 1 oracle oinstall 64 Aug 25 16:02 23 -> /u01/app/oracle/oradata/ora10g/undotbs01.dbf (deleted)
lrwx------ 1 oracle oinstall 64 Aug 25 16:02 24 -> /u01/app/oracle/oradata/ora10g/sysaux01.dbf (deleted)
lrwx------ 1 oracle oinstall 64 Aug 25 16:02 25 -> /u01/app/oracle/oradata/ora10g/users01.dbf (deleted)
lrwx------ 1 oracle oinstall 64 Aug 25 16:02 26 -> /u01/app/oracle/oradata/ora10g/example01.dbf (deleted)
lrwx------ 1 oracle oinstall 64 Aug 25 16:02 27 -> /u01/app/oracle/oradata/ora10g/temp01.dbf (deleted)
lr-x------ 1 oracle oinstall 64 Aug 25 16:02 3 -> /dev/null
lr-x------ 1 oracle oinstall 64 Aug 25 16:02 4 -> /dev/null
l-wx------ 1 oracle oinstall 64 Aug 25 16:02 5 -> /u01/app/oracle/admin/ora10g/udump/ora10g_ora_4556.trc
l-wx------ 1 oracle oinstall 64 Aug 25 16:02 6 -> /u01/app/oracle/admin/ora10g/bdump/alert_ora10g.log
lrwx------ 1 oracle oinstall 64 Aug 25 16:02 7 -> /u01/app/oracle/product/10.2.0/db_1/dbs/lkinstora10g (deleted)
l-wx------ 1 oracle oinstall 64 Aug 25 16:02 8 -> /u01/app/oracle/admin/ora10g/bdump/alert_ora10g.log
lrwx------ 1 oracle oinstall 64 Aug 25 16:02 9 -> /u01/app/oracle/product/10.2.0/db_1/dbs/hc_ora10g.dat
--恢复数据库文件
[oracle@ora10g fd]$ cp 7 /u01/app/oracle/product/10.2.0/db_1/dbs/lkinstora10g
[oracle@ora10g fd]$ cp 16 /u01/app/oracle/oradata/ora10g/control01.ctl
[oracle@ora10g fd]$ cp 17 /u01/app/oracle/oradata/ora10g/control02.ctl
[oracle@ora10g fd]$ cp 18 /u01/app/oracle/oradata/ora10g/control03.ctl
[oracle@ora10g fd]$ cp 19 /u01/app/oracle/oradata/ora10g/redo01.log
[oracle@ora10g fd]$ cp 20 /u01/app/oracle/oradata/ora10g/redo02.log
[oracle@ora10g fd]$ cp 21 /u01/app/oracle/oradata/ora10g/redo03.log
[oracle@ora10g fd]$ cp 22 /u01/app/oracle/oradata/ora10g/system01.dbf
[oracle@ora10g fd]$ cp 23 /u01/app/oracle/oradata/ora10g/undotbs01.dbf
[oracle@ora10g fd]$ cp 24 /u01/app/oracle/oradata/ora10g/sysaux01.dbf
[oracle@ora10g fd]$ cp 25 /u01/app/oracle/oradata/ora10g/users01.dbf
[oracle@ora10g fd]$ cp 26 /u01/app/oracle/oradata/ora10g/example01.dbf
[oracle@ora10g fd]$ cp 27 /u01/app/oracle/oradata/ora10g/temp01.dbf
--恢复数据库相关文件后登陆sqlplus,进行dml操作
[oracle@ora10g fd]$ sqlplus / as sysdba
SQL*Plus: Release 10.2.0.1.0 - Production on Mon Aug 25 16:10:03 2014
Copyright (c) 1982, 2005, Oracle. All rights reserved.
Connected to:
Oracle Database 10g Enterprise Edition Release 10.2.0.1.0 - Production
With the Partitioning, OLAP and Data Mining options
SQL> select count(*) from dba_objects;
COUNT(*)
----------
SQL> select * from aaron8219.test1;
INT
----------
1
2
SQL> select group#,status,members from v$log;
GROUP# STATUS MEMBERS
---------- ---------------- ----------
1 CURRENT 1
2 UNUSED 1
3 INACTIVE 1
当前在线日志文件和恢复前一致。是redo01.log
SQL> archive log list
Database log mode Archive Mode
Automatic archival Enabled
Archive destination USE_DB_RECOVERY_FILE_DEST
Oldest online log sequence 1
Next log sequence to archive 2
Current log sequence 2
SQL> alter system switch logfile;
System altered.
SQL> archive log list
ORA-03113: end-of-file on communication channel
切换一次日志后,实例被终止。能够从alert.log中看到:
[root@ora10g oradata]# tailf /u01/app/oracle/admin/ora10g/bdump/alert_ora10g.log
...
Mon Aug 25 16:13:05 2014
Thread 1 advanced to log
sequence 3
Current log# 2 seq# 3 mem# 0: /u01/app/oracle/oradata/ora10g/redo02.log
Mon Aug 25 16:13:05 2014
Errors in file /u01/app/oracle/admin/ora10g/bdump/ora10g_arc0_4586.trc:
ORA-00322: Message 322 not found; No message file for product=RDBMS, facility=ORA; arguments: [1] [1]
ORA-00312: Message 312 not found; No message file for product=RDBMS, facility=ORA; arguments: [1] [1] [/u01/app/oracle/oradata/ora10g/redo01.log]
Mon Aug 25 16:13:05 2014
Errors in file /u01/app/oracle/admin/ora10g/bdump/ora10g_arc0_4586.trc:
ORA-00322: Message 322 not found; No message file for product=RDBMS, facility=ORA; arguments: [1] [1]
ORA-00312: Message 312 not found; No message file for product=RDBMS, facility=ORA; arguments: [1] [1] [/u01/app/oracle/oradata/ora10g/redo01.log]
Mon Aug 25 16:13:05 2014
ARC0: Failed to archive thread 1 sequence 2 (0)
ARCH: Archival stopped, error occurred. Will continue retrying
Mon Aug 25 16:13:05 2014
ORACLE Instance ora10g - Archival Error
Mon Aug 25 16:13:05 2014
ORA-16038: Message 16038 not found; No message file for product=RDBMS, facility=ORA; arguments: [1] [2]
ORA-00312: Message 312 not found; No message file for product=RDBMS, facility=ORA; arguments: [1] [1] [/u01/app/oracle/oradata/ora10g/redo01.log]
Mon Aug 25 16:13:05 2014
Errors in file /u01/app/oracle/admin/ora10g/bdump/ora10g_arc0_4586.trc:
ORA-16038: Message 16038 not found; No message file for product=RDBMS, facility=ORA; arguments: [1] [2]
ORA-00312: Message 312 not found; No message file for product=RDBMS, facility=ORA; arguments: [1] [1] [/u01/app/oracle/oradata/ora10g/redo01.log]
Mon Aug 25 16:13:08 2014
********************* ATTENTION: ********************
The controlfile header block returned by the OS
has a sequence number that is too old.
The controlfile might be corrupted.
PLEASE DO NOT ATTEMPT TO START UP THE INSTANCE
without following the steps below.
RE-STARTING THE INSTANCE CAN CAUSE SERIOUS DAMAGE
TO THE DATABASE, if the controlfile is truly corrupted.
In order to re-start the instance safely,
please do the following:
(1) Save all copies of the controlfile for later
analysis and contact your OS vendor and Oracle support.
(2) Mount the instance and issue:
ALTER DATABASE BACKUP CONTROLFILE TO TRACE;
(3) Unmount the instance.
(4) Use the script in the trace file to
RE-CREATE THE CONTROLFILE and open the database.
*****************************************************
Instance terminated by USER, pid = 6994
--关闭实例,又一次启动
SQL> shutdown immediate
ORA-24324: service handle not initialized
ORA-01041: internal error. hostdef extension doesn't exist
SQL> exit
Disconnected from Oracle Database 10g Enterprise Edition Release 10.2.0.1.0 - Production
With the Partitioning, OLAP and Data Mining options
[oracle@ora10g fd]$ sqlplus / as sysdba
SQL*Plus: Release 10.2.0.1.0 - Production on Mon Aug 25 16:17:05 2014
Copyright (c) 1982, 2005, Oracle. All rights reserved.
Connected to an idle instance.
SQL> startup
ORACLE instance started.
Total System Global Area 285212672 bytes
Fixed Size 1218992 bytes
Variable Size 92276304 bytes
Database Buffers 188743680 bytes
Redo Buffers 2973696 bytes
Database mounted.
Database opened.
SQL> select * from aaron8219.test1;
INT
----------
1
2
SQL>
能够看到,这次数据并没有丢失。insert的2条数据因为exit退出SQLPLUS时触发了隐式提交。已经被写入数据文件里,而如今又通过操作系统文件句柄的方式恢复出来了,假设要避免隐式提交,能够在还有一个session中对数据库文件进行删除
总结:
当我们进行Linux操作系统命令rm的时候。切忌不可任意加-rf參数。就算一定要用,也要确定再三后才干运行,否则对于数据库而言。能够说是灾难性的。这里仅仅是測试了一下删除/u01/app/oracle/oradata/下的所有文件,试想一下。假设你当初运行的是rm -rf /u01呢?可能情况就要更加复杂一点了,恢复须要的步骤也就很多其它了。
由于是在数据库open状态下直接进行了破坏性操作,对于redo buffer还来不及写入online redo logfile的那部分操作。肯定是会丢失的。(在我的第2次測试中。并没有丢失未提交数据。是由于触发了隐式提交),由于我们通过文件句柄号恢复出来的日志文件里,并不一定包括数据库的最新变更,即便如此,对于rm -rf误操作的恢复,还是有一定意义的。至少能够在你没有不论什么备份的情况下,多提供了一根救命稻草来解救你的数据库,再次强调一下,rm
-rf后,千万不要着急地关闭数据库重新启动!
!。否则等待库巴!!
!
版权声明:本文博客原创文章,博客,未经同意,不得转载。
rm-rf 恢复过程中滥用的更多相关文章
- 阿里云RDS for MySQL备份文件+binlog恢复过程中碰到的一些问题
1.一开始通过官方下载有的压缩包安装,碰到各种依赖问题,最后采用YUM安装 1.通过yum安装percona-Xtrabackup 1.1 先安装依赖: yum install perl-DBI yu ...
- MySQL · 引擎特性 · InnoDB 崩溃恢复过程
MySQL · 引擎特性 · InnoDB 崩溃恢复过程 在前面两期月报中,我们详细介绍了 InnoDB redo log 和 undo log 的相关知识,本文将介绍 InnoDB 在崩溃恢复时的主 ...
- SQL Server 恢复过程
在恢复过程中.只会分析那些自最后一个检查点之后发生的更改,以确定是否需要重做还是撤销. 在最后一个检查点之前完成的操作都会精确的反应到数据文件中,恢复过程不需要做其它的事. 第一阶段: 分析. 这个阶 ...
- centOS6.4 extundelete工具恢复rm -rf 删除的目录
PS:补充下,我在fedora 19上运行的时候遇到的一个问题: [root@localhost extundelete-]# ./configure Configuring extundelete ...
- 高性能Linux服务器 第6章 ext3文件系统反删除利器ext3grep extundelete工具恢复rm -rf 误删除的文件
高性能Linux服务器 第6章 ext3文件系统反删除利器ext3grep extundelete工具恢复rm -rf 误删除的文件 只能用于ext3文件系统!!!!!!!高俊峰(高性能Linux ...
- centOS6.4 extundelete工具恢复rm -rf 删除的目录[转]
原文:http://www.cnblogs.com/patf/p/3368765.html PS:补充下,我在fedora 19上运行的时候遇到的一个问题: 1 [root@localhost ext ...
- linux系统中不小心执行了rm -rf ./* 怎么办?解决:文件系统的备份与恢复
XFS提供了 xfsdump 和 xfsrestore 工具协助备份XFS文件系统中的数据.xfsdump 按inode顺序备份一个XFS文件系统.centos7选择xfs格式作为默认文件系统,而且不 ...
- 用extundelete恢复rm -rf删的文件
“慎用rm -rf命令,除非你知道此命令带来的后果.”这是一条Linux用户守则,虽然大多数用户都明白这条语句的含义,但是我觉得还需要完善一下,为这条语句加 上一个使用前提:在你确认自己拥有清醒头脑, ...
- Linux 中如何避免 rm -rf /*
Linux 的删除命令中 rm中没有回收站的概念,一旦文件被删除比较难还原.更可怕的是rm -rf /*,连自己都能删 这命令太危险了,弄错了就核爆了,带来的损失的巨大的.比如 Gitlab.com ...
随机推荐
- [Unity3D]Unity3D游戏开发之飞机大战项目解说
大家好,我是秦元培,欢迎大家继续关注我的博客,我的博客地址是blog.csdn.net/qinyuanpei. 首先感谢大家对我博客的关注,今天我想和大家分享的是一个飞机大战的项目.这是一个比較综合的 ...
- UIPinchGestureRecognizer 的scale使用
使用 UIPinchGestureRecognizer 手势可以放大或缩小UIImageView视图.放大或缩小的值是根据 UIPinchGestureRecognizer 的scale决定.这个值在 ...
- linux下多进程的调试
linux下多进程的调试: (1)follow-fork-mode set follow-fork-mode [parent | child] ---- fork之后选择调试父进 ...
- 矩阵快速幂---BestCoder Round#8 1002
当要求递推数列的第n项且n很大时,怎么快速求得第n项呢?可以用矩阵快速幂来加速计算.我们可以用矩阵来表示数列递推公式比如fibonacci数列 可以表示为 [f(n) f(n-1)] = [f(n ...
- android 设置默认启动network mode
network mode常见类型 WCDMA preferred : 0 GSM only : 1 WCDMA only : 2 GSM UMTS : 3 CDMA : 4 ... (参考RILCon ...
- HTTP请求WebTool
/// <summary> /// 执行HTTP POST请求. /// </summary> /// <param name="url">请求 ...
- 如何处理 Windows Phone 8 动态砖变成黑白砖
原文:如何处理 Windows Phone 8 动态砖变成黑白砖 ? 问题的来龙去脉 我的 Windows Phone 8 动态砖变成黑白砖,所有图示和文字变成黑白,该如何处理? ? 问题的发生原因 ...
- LayoutInflater使用
在实际工作中,事先写好的布局文件往往不能满足我们的需求,有时会依据情况在代码中自己定义控件,这就须要用到LayoutInflater.LayoutInflater在Android中是“扩展”的意思,作 ...
- Java 大数类
划分结果存在数组.供应商下标0 在剩下的标记1 import java.math.BigInteger; import java.util.Scanner; public class Main { p ...
- DS-5/RVDS4.0变量初始化错误
最近总是有各种调试时的错误,内存错误一般,我无意中发现的所有全局变量失败,也就是说,全局变量声明之后,颂值早期值误. 初值明明是0x12345674,最后变为了0xBA141234,出现了移位现象 測 ...