您的位置:首页 > 运维架构 > Linux

误删数据文件的处理(环境为linux)

2013-06-06 12:13 337 查看
[oracle@orahost ~]$ sqlplus / as sysdba

SQL*Plus: Release 10.2.0.1.0 - Production on Mon Dec 3 15:14:38 2012

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              83887696 bytes

Database Buffers          197132288 bytes

Redo Buffers                2973696 bytes

Database mounted.

Database opened.

SQL> desc dba_data_files

 Name                                      Null?    Type

 ----------------------------------------- -------- ----------------------------

 FILE_NAME                                          VARCHAR2(513)

 FILE_ID                                            NUMBER

 TABLESPACE_NAME                                    VARCHAR2(30)

 BYTES                                              NUMBER

 BLOCKS                                             NUMBER

 STATUS                                             VARCHAR2(9)

 RELATIVE_FNO                                       NUMBER

 AUTOEXTENSIBLE                                     VARCHAR2(3)

 MAXBYTES                                           NUMBER

 MAXBLOCKS                                          NUMBER

 INCREMENT_BY                                       NUMBER

 USER_BYTES                                         NUMBER

 USER_BLOCKS                                        NUMBER

 ONLINE_STATUS                                      VARCHAR2(7)

SQL> col file_name for a30

SQL> select file_name,tablespace_name from dba_data_files;

FILE_NAME                      TABLESPACE_NAME

------------------------------ ------------------------------

/oracle/oradata/orcl/users01.d USERS

bf

/oracle/oradata/orcl/sysaux01. SYSAUX

dbf

/oracle/oradata/orcl/undotbs01 UNDOTBS1

.dbf

/oracle/oradata/orcl/system01. SYSTEM

dbf

FILE_NAME                      TABLESPACE_NAME

------------------------------ ------------------------------

SQL> col file_name for a60

SQL> l

  1* select file_name,tablespace_name from dba_data_files

SQL> r

  1* select file_name,tablespace_name from dba_data_files

FILE_NAME

------------------------------------------------------------

TABLESPACE_NAME

------------------------------

/oracle/oradata/orcl/users01.dbf

USERS

/oracle/oradata/orcl/sysaux01.dbf

SYSAUX

/oracle/oradata/orcl/undotbs01.dbf

UNDOTBS1

FILE_NAME

------------------------------------------------------------

TABLESPACE_NAME

------------------------------

/oracle/oradata/orcl/system01.dbf

SYSTEM

SQL> !date

Mon Dec  3 15:19:07 CST 2012

SQL> !rm -fr /oracle/oradata/orcl/users01.dbf

SQL> 

SQL> 

SQL> 

SQL> 

SQL> 

SQL> 

SQL> 

SQL> 

SQL> !      

[oracle@orahost ~]$ ps -ef | grep -v grep

UID        PID  PPID  C STIME TTY          TIME CMD

root         1     0  0 14:54 ?        00:00:00 init [3]                                              

root         2     1  0 14:54 ?        00:00:00 [migration/0]

root         3     1  0 14:54 ?        00:00:00 [ksoftirqd/0]

root         4     1  0 14:54 ?        00:00:00 [watchdog/0]

root         5     1  0 14:54 ?        00:00:00 [events/0]

root         6     1  0 14:54 ?        00:00:00 [khelper]

root         7     1  0 14:54 ?        00:00:00 [kthread]

root        10     7  0 14:54 ?        00:00:00 [kblockd/0]

root        11     7  0 14:54 ?        00:00:00 [kacpid]

root        48     7  0 14:54 ?        00:00:00 [cqueue/0]

root        51     7  0 14:54 ?        00:00:00 [khubd]

root        53     7  0 14:54 ?        00:00:00 [kseriod]

root       116     7  0 14:54 ?        00:00:00 [pdflush]

root       118     7  0 14:54 ?        00:00:00 [kswapd0]

root       119     7  0 14:54 ?        00:00:00 [aio/0]

root       268     7  0 14:54 ?        00:00:00 [kpsmoused]

root       292     7  0 14:54 ?        00:00:00 [ata/0]

root       293     7  0 14:54 ?        00:00:00 [ata_aux]

root       296     7  0 14:54 ?        00:00:00 [scsi_eh_0]

root       301     7  0 14:54 ?        00:00:00 [kstriped]

root       310     7  0 14:54 ?        00:00:00 [ksnapd]

root       321     7  0 14:55 ?        00:00:00 [kjournald]

root       347     7  0 14:55 ?        00:00:00 [kauditd]

root       384     1  0 14:55 ?        00:00:00 /sbin/udevd -d

root      1172     7  0 14:55 ?        00:00:00 [kmpathd/0]

root      1173     7  0 14:55 ?        00:00:00 [kmpath_handlerd]

root      1196     7  0 14:55 ?        00:00:00 [kjournald]

root      1430     7  0 14:55 ?        00:00:00 [iscsi_eh]

root      1475     7  0 14:55 ?        00:00:00 [ib_addr]

root      1482     7  0 14:55 ?        00:00:00 [ib_mcast]

root      1483     7  0 14:55 ?        00:00:00 [ib_inform]

root      1484     7  0 14:55 ?        00:00:00 [local_sa]

root      1486     7  0 14:55 ?        00:00:00 [iw_cm_wq]

root      1488     7  0 14:55 ?        00:00:00 [ib_cm/0]

root      1490     7  0 14:55 ?        00:00:00 [rdma_cm]

root      1502     1  0 14:55 ?        00:00:00 brcm_iscsiuio

root      1509     1  0 14:55 ?        00:00:00 iscsid

root      1510     1  0 14:55 ?        00:00:00 iscsid

root      1770     1  0 14:55 ?        00:00:00 auditd

root      1772  1770  0 14:55 ?        00:00:00 /sbin/audispd

root      1805     1  0 14:55 ?        00:00:00 syslogd -m 0

root      1808     1  0 14:55 ?        00:00:00 klogd -x

rpc       1855     1  0 14:55 ?        00:00:00 portmap

root      1886     7  0 14:55 ?        00:00:00 [rpciod/0]

root      1892     1  0 14:55 ?        00:00:00 rpc.statd

root      1926     1  0 14:55 ?        00:00:00 rpc.idmapd

dbus      1951     1  0 14:55 ?        00:00:00 dbus-daemon --system

root      1976     1  0 14:55 ?        00:00:00 /usr/sbin/hcid

root      1982     1  0 14:55 ?        00:00:00 /usr/sbin/sdpd

root      1999     1  0 14:55 ?        00:00:00 [krfcommd]

root      2046     1  0 14:55 ?        00:00:00 pcscd

root      2061     1  0 14:55 ?        00:00:00 /usr/sbin/acpid

68        2079     1  0 14:55 ?        00:00:00 hald

root      2080  2079  0 14:55 ?        00:00:00 hald-runner

68        2088  2080  0 14:55 ?        00:00:00 hald-addon-acpi: listening on acpid socket /var/run/acpid.socket

68        2092  2080  0 14:55 ?        00:00:00 hald-addon-keyboard: listening on /dev/input/event0

root      2102  2080  0 14:55 ?        00:00:00 hald-addon-storage: polling /dev/hdc

root      2123     1  0 14:55 ?        00:00:00 /usr/bin/hidd --server

root      2152     1  0 14:55 ?        00:00:00 automount

root      2174     1  0 14:55 ?        00:00:00 ./hpiod

root      2179     1  0 14:55 ?        00:00:00 python ./hpssd.py

root      2197     1  0 14:55 ?        00:00:00 /usr/sbin/sshd

root      2211     1  0 14:55 ?        00:00:00 cupsd

root      2230     1  0 14:55 ?        00:00:00 xinetd -stayalive -pidfile /var/run/xinetd.pid

root      2244     1  0 14:55 ?        00:00:00 gpm -m /dev/input/mice -t exps2

root      2258     1  0 14:55 ?        00:00:00 crond

xfs       2296     1  0 14:56 ?        00:00:00 xfs -droppriv -daemon

root      2310     1  0 14:56 ?        00:00:00 anacron -s

root      2323     1  0 14:56 ?        00:00:00 /usr/sbin/atd

avahi     2404     1  0 14:56 ?        00:00:00 avahi-daemon: running [orahost.local]

avahi     2405  2404  0 14:56 ?        00:00:00 avahi-daemon: chroot helper

root      2436     1  0 14:56 ?        00:00:00 /usr/sbin/smartd -q never

root      2440     1  0 14:56 tty1     00:00:00 /sbin/mingetty tty1

root      2441     1  0 14:56 tty2     00:00:00 /sbin/mingetty tty2

root      2442     1  0 14:56 tty3     00:00:00 /sbin/mingetty tty3

root      2443     1  0 14:56 tty4     00:00:00 /sbin/mingetty tty4

root      2444     1  0 14:56 tty5     00:00:00 /sbin/mingetty tty5

root      2445     1  0 14:56 tty6     00:00:00 /sbin/mingetty tty6

root      2446     1  0 14:56 ?        00:00:00 /bin/su -l oracle -c sh -c 'cd /oracle/product/10.2.0/db_1/log/orahost/cssd;  ulimit -c unlimited; exec /oracle/product/10.2.0/db_1/bin/ocssd '

root      2582     1  0 14:56 ?        00:00:00 /usr/bin/python -tt /usr/sbin/yum-updatesd

root      2584     1  0 14:56 ?        00:00:00 /usr/libexec/gam_server

oracle    2620  2446  0 14:57 ?        00:00:00 /oracle/product/10.2.0/db_1/bin/ocssd.bin

root      2675  2197  0 14:59 ?        00:00:00 sshd: root@pts/0 

root      2677  2675  0 14:59 pts/0    00:00:00 -bash

root      2709  2677  0 14:59 pts/0    00:00:00 su - oracle

oracle    2710  2709  0 14:59 pts/0    00:00:00 -bash

root      2998     7  0 15:11 ?        00:00:00 [pdflush]

oracle    3024  2710  0 15:14 pts/0    00:00:00 sqlplus   as sysdba

oracle    3027     1  0 15:14 ?        00:00:00 ora_pmon_orcl

oracle    3029     1  0 15:14 ?        00:00:00 ora_psp0_orcl

oracle    3031     1  0 15:14 ?        00:00:00 ora_mman_orcl

oracle    3033     1  0 15:14 ?        00:00:00 ora_dbw0_orcl

oracle    3035     1  0 15:14 ?        00:00:00 ora_lgwr_orcl

oracle    3037     1  0 15:14 ?        00:00:00 ora_ckpt_orcl

oracle    3039     1  0 15:14 ?        00:00:00 ora_smon_orcl

oracle    3041     1  0 15:14 ?        00:00:00 ora_reco_orcl

oracle    3043     1  0 15:14 ?        00:00:00 ora_cjq0_orcl

oracle    3045     1  0 15:14 ?        00:00:00 ora_mmon_orcl

oracle    3047     1  0 15:14 ?        00:00:00 ora_mmnl_orcl

oracle    3049     1  0 15:14 ?        00:00:00 ora_d000_orcl

oracle    3051     1  0 15:14 ?        00:00:00 ora_s000_orcl

oracle    3053  3024  0 15:14 ?        00:00:01 oracleorcl (DESCRIPTION=(LOCAL=YES)(ADDRESS=(PROTOCOL=beq)))

oracle    3055     1  0 15:14 ?        00:00:00 ora_arc0_orcl

oracle    3057     1  0 15:14 ?        00:00:00 ora_arc1_orcl

oracle    3059     1  0 15:14 ?        00:00:00 ora_arc2_orcl

oracle    3061     1  0 15:14 ?        00:00:00 ora_qmnc_orcl

oracle    3071     1  0 15:15 ?        00:00:00 ora_q000_orcl

oracle    3073     1  0 15:15 ?        00:00:00 ora_q001_orcl

oracle    3086     1  0 15:19 ?        00:00:00 ora_j000_orcl

oracle    3088  3024  0 15:19 pts/0    00:00:00 /bin/bash

oracle    3118  3088  0 15:19 pts/0    00:00:00 ps -ef

[oracle@orahost ~]$ ps -ef | grep dbw | grep -v grep

oracle    3033     1  0 15:14 ?        00:00:00 ora_dbw0_orcl

[oracle@orahost ~]$ ll /porc/3033/fd

ls: /porc/3033/fd: No such file or directory

[oracle@orahost ~]$ ll/proc/3033/fd/

bash: ll/proc/3033/fd/: No such file or directory

[oracle@orahost ~]$ ll /proc/3033/fd/

total 0

lr-x------ 1 oracle dba 64 Dec  3 15:21 0 -> /dev/null

lr-x------ 1 oracle dba 64 Dec  3 15:21 1 -> /dev/null

lrwx------ 1 oracle dba 64 Dec  3 15:21 10 -> /oracle/admin/orcl/adump/ora_3025.aud

lr-x------ 1 oracle dba 64 Dec  3 15:21 11 -> /dev/zero

lr-x------ 1 oracle dba 64 Dec  3 15:21 12 -> /dev/zero

lr-x------ 1 oracle dba 64 Dec  3 15:21 13 -> /oracle/product/10.2.0/db_1/rdbms/mesg/oraus.msb

lrwx------ 1 oracle dba 64 Dec  3 15:21 14 -> /oracle/product/10.2.0/db_1/dbs/hc_orcl.dat

lrwx------ 1 oracle dba 64 Dec  3 15:21 15 -> /oracle/product/10.2.0/db_1/dbs/lkORCL

lrwx------ 1 oracle dba 64 Dec  3 15:21 16 -> /oracle/oradata/orcl/control01.ctl

lrwx------ 1 oracle dba 64 Dec  3 15:21 17 -> /oracle/oradata/orcl/control02.ctl

lrwx------ 1 oracle dba 64 Dec  3 15:21 18 -> /oracle/oradata/orcl/control03.ctl

lrwx------ 1 oracle dba 64 Dec  3 15:21 19 -> /oracle/oradata/orcl/system01.dbf

lr-x------ 1 oracle dba 64 Dec  3 15:21 2 -> /dev/null

lrwx------ 1 oracle dba 64 Dec  3 15:21 20 -> /oracle/oradata/orcl/undotbs01.dbf

lrwx------ 1 oracle dba 64 Dec  3 15:21 21 -> /oracle/oradata/orcl/sysaux01.dbf

lrwx------ 1 oracle dba 64 Dec  3 15:21 22 -> /oracle/oradata/orcl/users01.dbf (deleted)

lrwx------ 1 oracle dba 64 Dec  3 15:21 23 -> /oracle/oradata/orcl/temp01.dbf

lr-x------ 1 oracle dba 64 Dec  3 15:21 24 -> /oracle/product/10.2.0/db_1/rdbms/mesg/oraus.msb

lr-x------ 1 oracle dba 64 Dec  3 15:21 3 -> /dev/null

lr-x------ 1 oracle dba 64 Dec  3 15:21 4 -> /dev/null

l-wx------ 1 oracle dba 64 Dec  3 15:21 5 -> /oracle/admin/orcl/udump/orcl_ora_3025.trc

l-wx------ 1 oracle dba 64 Dec  3 15:21 6 -> /oracle/admin/orcl/bdump/alert_orcl.log

lrwx------ 1 oracle dba 64 Dec  3 15:21 7 -> /oracle/product/10.2.0/db_1/dbs/lkinstorcl (deleted)

l-wx------ 1 oracle dba 64 Dec  3 15:21 8 -> /oracle/admin/orcl/bdump/alert_orcl.log

lrwx------ 1 oracle dba 64 Dec  3 15:21 9 -> /oracle/product/10.2.0/db_1/dbs/hc_orcl.dat

[oracle@orahost ~]$ pwd

/oracle

[oracle@orahost ~]$ cp /proc/3033/fd/22 /oracle/oradata/orcl/users01.dbf

[oracle@orahost ~]$ cd /oracle/oradata/orcl/

[oracle@orahost orcl]$ ls -ltr

total 943384

-rw-r----- 1 oracle dba  20979712 Nov 19 11:28 temp01.dbf

-rw-r----- 1 oracle dba  52429312 Dec  3 15:14 redo03.log

-rw-r----- 1 oracle dba  52429312 Dec  3 15:14 redo02.log

-rw-r----- 1 oracle dba   5251072 Dec  3 15:25 users01.dbf

-rw-r----- 1 oracle dba  26222592 Dec  3 15:25 undotbs01.dbf

-rw-r----- 1 oracle dba 503324672 Dec  3 15:25 system01.dbf

-rw-r----- 1 oracle dba 251666432 Dec  3 15:25 sysaux01.dbf

-rw-r----- 1 oracle dba  52429312 Dec  3 15:25 redo01.log

-rw-r----- 1 oracle dba   7061504 Dec  3 15:25 control03.ctl

-rw-r----- 1 oracle dba   7061504 Dec  3 15:25 control02.ctl

-rw-r----- 1 oracle dba   7061504 Dec  3 15:25 control01.ctl

[oracle@orahost orcl]$ exit

exit

SQL> shutdown

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              83887696 bytes

Database Buffers          197132288 bytes

Redo Buffers                2973696 bytes

Database mounted.

ORA-01113: file 4 needs media recovery

ORA-01110: data file 4: '/oracle/oradata/orcl/users01.dbf'

SQL> alter database datafile 4 offine;

alter database datafile 4 offine

                          *

ERROR at line 1:

ORA-01916: keyword ONLINE, OFFLINE, RESIZE, AUTOEXTEND or END/DROP expected

SQL> alter database datafile 4 offine drop;

alter database datafile 4 offine drop

                          *

ERROR at line 1:

ORA-01916: keyword ONLINE, OFFLINE, RESIZE, AUTOEXTEND or END/DROP expected

SQL> recover datafile 4;

Media recovery complete.

SQL> alter database open;

Database altered.

SQL> desc dba_data_files

 Name                                      Null?    Type

 ----------------------------------------- -------- ----------------------------

 FILE_NAME                                          VARCHAR2(513)

 FILE_ID                                            NUMBER

 TABLESPACE_NAME                                    VARCHAR2(30)

 BYTES                                              NUMBER

 BLOCKS                                             NUMBER

 STATUS                                             VARCHAR2(9)

 RELATIVE_FNO                                       NUMBER

 AUTOEXTENSIBLE                                     VARCHAR2(3)

 MAXBYTES                                           NUMBER

 MAXBLOCKS                                          NUMBER

 INCREMENT_BY                                       NUMBER

 USER_BYTES                                         NUMBER

 USER_BLOCKS                                        NUMBER

 ONLINE_STATUS                                      VARCHAR2(7)

SQL> col file_name for a46

SQL> select file_name,online_status from dba_data_files;

FILE_NAME                                      ONLINE_

---------------------------------------------- -------

/oracle/oradata/orcl/users01.dbf               ONLINE

/oracle/oradata/orcl/sysaux01.dbf              ONLINE

/oracle/oradata/orcl/undotbs01.dbf             ONLINE

/oracle/oradata/orcl/system01.dbf              SYSTEM

当数据库没有关闭,可以通过此方法将数据文件cp回来。但是要是将数据库关闭的话。
首先用rman全库备下。

SQL> !

[oracle@orahost ~]$ rman target /

Recovery Manager: Release 10.2.0.1.0 - Production on Mon Dec 3 15:35:42 2012

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

connected to target database: ORCL (DBID=1327540369)

RMAN> backup database;

Starting backup at 03-DEC-12

using target database control file instead of recovery catalog

allocated channel: ORA_DISK_1

channel ORA_DISK_1: sid=197 devtype=DISK

channel ORA_DISK_1: starting full datafile backupset

channel ORA_DISK_1: specifying datafile(s) in backupset

input datafile fno=00001 name=/oracle/oradata/orcl/system01.dbf

input datafile fno=00003 name=/oracle/oradata/orcl/sysaux01.dbf

input datafile fno=00002 name=/oracle/oradata/orcl/undotbs01.dbf

input datafile fno=00004 name=/oracle/oradata/orcl/users01.dbf

channel ORA_DISK_1: starting piece 1 at 03-DEC-12

channel ORA_DISK_1: finished piece 1 at 03-DEC-12

piece handle=/oracle/flash_recovery_area/ORCL/backupset/2012_12_03/o1_mf_nnndf_TAG20121203T153550_8crolq09_.bkp tag=TAG20121203T153550 comment=NONE

channel ORA_DISK_1: backup set complete, elapsed time: 00:00:56

channel ORA_DISK_1: starting full datafile backupset

channel ORA_DISK_1: specifying datafile(s) in backupset

including current control file in backupset

including current SPFILE in backupset

channel ORA_DISK_1: starting piece 1 at 03-DEC-12

channel ORA_DISK_1: finished piece 1 at 03-DEC-12

piece handle=/oracle/flash_recovery_area/ORCL/backupset/2012_12_03/o1_mf_ncsnf_TAG20121203T153550_8cronjny_.bkp tag=TAG20121203T153550 comment=NONE

channel ORA_DISK_1: backup set complete, elapsed time: 00:00:03

Finished backup at 03-DEC-12

RMAN> quit

Recovery Manager complete.

[oracle@orahost ~]$ exit

exit
SQL> !rm -fr /oracle/oradata/orcl/users01.dbf

SQL> shutdown abort

ORACLE instance shut down.

SQL> startup

ORACLE instance started.
Total System Global Area  285212672 bytes

Fixed Size                  1218992 bytes

Variable Size              83887696 bytes

Database Buffers          197132288 bytes

Redo Buffers                2973696 bytes

Database mounted.

ORA-01157: cannot identify/lock data file 4 - see DBWR trace file

ORA-01110: data file 4: '/oracle/oradata/orcl/users01.dbf'

SQL> !

[oracle@orahost ~]$ ps -ef | grep dbw | grep -v grep

oracle    3357     1  0 15:47 ?        00:00:00 ora_dbw0_orcl

*****************************************************************************************************************************************************

[oracle@orahost ~]$ ll /proc/3357/fd/

total 0

lr-x------ 1 oracle dba 64 Dec  3 15:48 0 -> /dev/null

lr-x------ 1 oracle dba 64 Dec  3 15:48 1 -> /dev/null

lrwx------ 1 oracle dba 64 Dec  3 15:48 10 -> /oracle/admin/orcl/adump/ora_3349.aud

lr-x------ 1 oracle dba 64 Dec  3 15:48 11 -> /dev/zero

lr-x------ 1 oracle dba 64 Dec  3 15:48 12 -> /dev/zero

lr-x------ 1 oracle dba 64 Dec  3 15:48 13 -> /oracle/product/10.2.0/db_1/rdbms/mesg/oraus.msb

lrwx------ 1 oracle dba 64 Dec  3 15:48 14 -> /oracle/product/10.2.0/db_1/dbs/hc_orcl.dat

lrwx------ 1 oracle dba 64 Dec  3 15:48 15 -> /oracle/product/10.2.0/db_1/dbs/lkORCL

lrwx------ 1 oracle dba 64 Dec  3 15:48 16 -> /oracle/oradata/orcl/control01.ctl

lrwx------ 1 oracle dba 64 Dec  3 15:48 17 -> /oracle/oradata/orcl/control02.ctl

lrwx------ 1 oracle dba 64 Dec  3 15:48 18 -> /oracle/oradata/orcl/control03.ctl

l-wx------ 1 oracle dba 64 Dec  3 15:48 2 -> /oracle/admin/orcl/bdump/orcl_dbw0_3357.trc

lr-x------ 1 oracle dba 64 Dec  3 15:48 3 -> /dev/null

lr-x------ 1 oracle dba 64 Dec  3 15:48 4 -> /dev/null

l-wx------ 1 oracle dba 64 Dec  3 15:48 5 -> /oracle/admin/orcl/udump/orcl_ora_3349.trc

l-wx------ 1 oracle dba 64 Dec  3 15:48 6 -> /oracle/admin/orcl/bdump/alert_orcl.log

lrwx------ 1 oracle dba 64 Dec  3 15:48 7 -> /oracle/product/10.2.0/db_1/dbs/lkinstorcl (deleted)

l-wx------ 1 oracle dba 64 Dec  3 15:48 8 -> /oracle/admin/orcl/bdump/alert_orcl.log

lrwx------ 1 oracle dba 64 Dec  3 15:48 9 -> /oracle/product/10.2.0/db_1/dbs/hc_orcl.dat

*******8可以看到里面没有删除的/oracle/oradata/orcl/users01.dbf 这个文件

***************************************************************************************************************************************************

[oracle@orahost ~]$ rman target /
Recovery Manager: Release 10.2.0.1.0 - Production on Mon Dec 3 15:49:00 2012
Copyright (c) 1982, 2005, Oracle.  All rights reserved.
connected to target database: ORCL (DBID=1327540369, not open)
RMAN> exit              

Recovery Manager complete.

[oracle@orahost ~]$ exit

exit
SQL> alter database datafile 4 offine;

alter database datafile 4 offine

                          *

ERROR at line 1:

ORA-01916: keyword ONLINE, OFFLINE, RESIZE, AUTOEXTEND or END/DROP expected

SQL> recover datafile 4;

ORA-00283: recovery session canceled due to errors

ORA-01110: data file 4: '/oracle/oradata/orcl/users01.dbf'

ORA-01157: cannot identify/lock data file 4 - see DBWR trace file

ORA-01110: data file 4: '/oracle/oradata/orcl/users01.dbf'

SQL> !

[oracle@orahost ~]$ rman target /
Recovery Manager: Release 10.2.0.1.0 - Production on Mon Dec 3 15:50:12 2012
Copyright (c) 1982, 2005, Oracle.  All rights reserved.
connected to target database: ORCL (DBID=1327540369, not open)
RMAN> restore datafile 4;
Starting restore at 03-DEC-12

using target database control file instead of recovery catalog

allocated channel: ORA_DISK_1

channel ORA_DISK_1: sid=210 devtype=DISK
channel ORA_DISK_1: starting datafile backupset restore

channel ORA_DISK_1: specifying datafile(s) to restore from backup set

restoring datafile 00004 to /oracle/oradata/orcl/users01.dbf

channel ORA_DISK_1: reading from backup piece /oracle/flash_recovery_area/ORCL/backupset/2012_12_03/o1_mf_nnndf_TAG20121203T153550_8crolq09_.bkp

channel ORA_DISK_1: restored backup piece 1

piece handle=/oracle/flash_recovery_area/ORCL/backupset/2012_12_03/o1_mf_nnndf_TAG20121203T153550_8crolq09_.bkp tag=TAG20121203T153550

channel ORA_DISK_1: restore complete, elapsed time: 00:00:03

Finished restore at 03-DEC-12
RMAN> recover datafile 4;
Starting recover at 03-DEC-12

using channel ORA_DISK_1
starting media recovery

media recovery complete, elapsed time: 00:00:03
Finished recover at 03-DEC-12
RMAN> sql 'alter database open;' ;
sql statement: alter database open;

RMAN-00571: ===========================================================

RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ===============

RMAN-00571: ===========================================================

RMAN-03009: failure of sql command on default channel at 12/03/2012 15:50:49

RMAN-11003: failure during parse/execution of SQL statement: alter database open;

ORA-00911: invalid character
RMAN> sql 'alter database open ';
sql statement: alter database open
RMAN> exit

Recovery Manager complete.

[oracle@orahost ~]$ exit

exit
SQL> select status from v$instance;
STATUS

------------

OPEN
SQL> col file_name for a50

SQL> select file_name,online_status from dba_data_files;
FILE_NAME                                          ONLINE_

-------------------------------------------------- -------

/oracle/oradata/orcl/users01.dbf                   ONLINE

/oracle/oradata/orcl/sysaux01.dbf                  ONLINE

/oracle/oradata/orcl/undotbs01.dbf                 ONLINE

/oracle/oradata/orcl/system01.dbf                  SYSTEM
 

以上,是对数据文件误删除后的处理,当然前提是数据库没有关闭,通过可以分析出/proc目录的意义,通过google,找到了关于这方面的一点资料如下:

/proc 文件系统可以用于获取运行中的进程的信息。在 /proc 中有一些编号的子目录。每个编号的目录对应一个进程 id (PID)。这样,每一个运行中的进程 /proc 中都有一个用它的 PID 命名的目录。这些子目录中包含可以提供有关进程的状态和环境的重要细节信息的文件。

        可见,此次操作,主要是依赖与linux的操作系统的特性,不是oracle的特性,仅仅是相当于将该数据文件备份后,删除掉,然啊后再用备份的数据文件代替原文件,所以AIX等系统,要是没有这个特性,是不适用的。需要进一步的验证。

感谢网络上的提供试验和知识的资料!
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: