多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 恢复过程中滥用的更多相关文章

  1. 阿里云RDS for MySQL备份文件+binlog恢复过程中碰到的一些问题

    1.一开始通过官方下载有的压缩包安装,碰到各种依赖问题,最后采用YUM安装 1.通过yum安装percona-Xtrabackup 1.1 先安装依赖: yum install perl-DBI yu ...

  2. MySQL · 引擎特性 · InnoDB 崩溃恢复过程

    MySQL · 引擎特性 · InnoDB 崩溃恢复过程 在前面两期月报中,我们详细介绍了 InnoDB redo log 和 undo log 的相关知识,本文将介绍 InnoDB 在崩溃恢复时的主 ...

  3. SQL Server 恢复过程

    在恢复过程中.只会分析那些自最后一个检查点之后发生的更改,以确定是否需要重做还是撤销. 在最后一个检查点之前完成的操作都会精确的反应到数据文件中,恢复过程不需要做其它的事. 第一阶段: 分析. 这个阶 ...

  4. centOS6.4 extundelete工具恢复rm -rf 删除的目录

    PS:补充下,我在fedora 19上运行的时候遇到的一个问题: [root@localhost extundelete-]# ./configure Configuring extundelete ...

  5. 高性能Linux服务器 第6章 ext3文件系统反删除利器ext3grep extundelete工具恢复rm -rf 误删除的文件

    高性能Linux服务器 第6章  ext3文件系统反删除利器ext3grep  extundelete工具恢复rm -rf 误删除的文件 只能用于ext3文件系统!!!!!!!高俊峰(高性能Linux ...

  6. centOS6.4 extundelete工具恢复rm -rf 删除的目录[转]

    原文:http://www.cnblogs.com/patf/p/3368765.html PS:补充下,我在fedora 19上运行的时候遇到的一个问题: 1 [root@localhost ext ...

  7. linux系统中不小心执行了rm -rf ./* 怎么办?解决:文件系统的备份与恢复

    XFS提供了 xfsdump 和 xfsrestore 工具协助备份XFS文件系统中的数据.xfsdump 按inode顺序备份一个XFS文件系统.centos7选择xfs格式作为默认文件系统,而且不 ...

  8. 用extundelete恢复rm -rf删的文件

    “慎用rm -rf命令,除非你知道此命令带来的后果.”这是一条Linux用户守则,虽然大多数用户都明白这条语句的含义,但是我觉得还需要完善一下,为这条语句加 上一个使用前提:在你确认自己拥有清醒头脑, ...

  9. Linux 中如何避免 rm -rf /*

    Linux 的删除命令中 rm中没有回收站的概念,一旦文件被删除比较难还原.更可怕的是rm -rf /*,连自己都能删 这命令太危险了,弄错了就核爆了,带来的损失的巨大的.比如 Gitlab.com ...

随机推荐

  1. ecshop购物流程中去掉email邮箱

    首先打开includes\lib_order.php,在第1688行左右找到并删除 !empty($consignee['email']) && 接着打开js\shopping_flo ...

  2. Codeforces Round #256 (Div. 2) D. Multiplication Table(二进制搜索)

    转载请注明出处:viewmode=contents" target="_blank">http://blog.csdn.net/u012860063?viewmod ...

  3. poj2348(博弈)

    poj2348 给定两个数a,b,大的数能减少小的数的倍数,不能是的数小于0,谁先使得数等于0,谁就赢了 有三种情况 ① a % b ==0  这个状态是必胜的 ② a - b < b  这个状 ...

  4. 状态压缩dp(hdu2167,poj2411)

    hdu2167 http://acm.hdu.edu.cn/showproblem.php?pid=2167 给定一个N*N的板子,里面有N*N个数字,选中一些数字,使得和最大 要求任意两个选中的数字 ...

  5. 挺好用的SQLSERVER数据库自动备份工具SQLBackupAndFTP(功能全面)

    原文:挺好用的SQLSERVER数据库自动备份工具SQLBackupAndFTP(功能全面) 挺好用的SQLSERVER数据库自动备份工具SQLBackupAndFTP(功能全面) 这个工具主要就是自 ...

  6. java战斗系列-战斗MAVENPW结构

     实战中MAVEN私服的搭建 利用maven来管理项目的构建,报告和文档已经成为了我们如今的共识,不论什么开源软件基本都在使用,当然我们如今的大部分公司也基本都在使用,我把曾经使用maven的一些经 ...

  7. libpomelo 增加编译静态库cocos2d-x xcode 工程

    离 https://github.com/NetEase/libpomelo 下载最新版本.拉开拉链,静态库 ./pomelo_gyp -DTO=ios ./build_ios ./build_ios ...

  8. rsync+inotify 实现资源服务器的同步目录下的文件变化时,备份服务器的同步目录更新,以资源服务器为准,去同步其他客户端

    测试环境: 资源服务器(主服务器):192.168.200.95 备份服务器(客户端):192.168.200.89 同步目录:/etc/test 同步时使用的用户名hadoop密码12345 实验目 ...

  9. 191. Number of 1 Bits Leetcode Python

    Write a function that takes an unsigned integer and returns the number of '1' bits it has (also know ...

  10. Oracle 11G CRUD操作监控单个表

    前言:    线上oracle数据库有张表的数据有些乱,依据应用db的log和应用的log也没有检查出来谁改动了.所以决定把这张单表做个具体的insert.update.delete监控.一:使用数据 ...