RepliCel database Solaris rm datafile recovery-use a handle to accidentally delete data files for recovery

Source: Internet
Author: User
Tags dba

There was a client recovery request this morning, and he accidentally used the RM-RF oradata command in the Solaris system to delete all the data files under one partition. Now do not know how to do, ask us to give support. Check it out. found that the database is not crash, it seems that directly consider the use of handle recovery
ROOT@CNISORCLSVR # Uname-a
SunOS cnisorclsvr 5.9 generic_112233-08 sun4u SPARC sunw,sun-fire-880
ROOT@CNISORCLSVR # Ps-ef|grep LGWR
Oracle 597 1 0 Mar 05? 17:14 Ora_lgwr_xifenfei
Root 28069 28043 0 18:51:17 pts/2 0:00 grep LGWR
ROOT@CNISORCLSVR # ls-ltr
Total 189348454
-r--r--r--1 Oracle DBA 657920 APR 26 2002 12
C---------1 root sys, Mar 27 2004 8
C---------1 root sys, Mar 27 2004 10
-RW-R-----0 Oracle DBA 34359730176 Nov 12 2013 291
-RW-R-----0 Oracle DBA 1073750016 Nov 13 2013 293
D---------1 Root 0 Mar 5 19:31 11
-RW-R-----1 Oracle DBA 1758 5 22:04 9
-RW-RW----1 Oracle DBA 5 22:04 13
s---------0 Root 0 Mar 8 00:45 14
-RW-R-----1 Oracle DBA 1887444992 12 03:27 289
-RW-R-----1 Oracle DBA 943726592 12 11:17 290
-RW-R-----0 Oracle DBA 4294975488 13 00:09 292
-RW-R-----0 Oracle DBA 268443648 13 01:33 288
-RW-R-----0 Oracle DBA 536879104 13 01:33 279
-RW-R-----1 Oracle DBA 134225920 13 01:33 278
-RW-R-----0 Oracle DBA 134225920 13 01:33 269
-RW-R-----1 Oracle DBA 268443648 13 01:33 267
-RW-R-----1 Oracle DBA 148119552 13 01:33 266
-RW-R-----1 Oracle DBA 10493952 13 01:33 265
-RW-R-----1 Oracle DBA 26222592 13 01:33 264
-RW-R-----1 Oracle DBA 62922752 13 01:33 263
-RW-R-----1 Oracle DBA 20979712 13 01:33 262
-RW-R-----0 Oracle DBA 134225920 13 01:33 287
-RW-R-----1 Oracle DBA 209723392 13 01:33 285
-RW-R-----0 Oracle DBA 536879104 13 01:33 283
-RW-R-----1 Oracle DBA 67117056 13 01:33 282
-RW-R-----0 Oracle DBA 536879104 13 01:33 281
-RW-R-----0 Oracle DBA 536879104 13 01:33 280
-RW-R-----0 Oracle DBA 536879104 13 01:33 276
-RW-R-----0 Oracle DBA 1073750016 13 01:33 275
-RW-R-----0 Oracle DBA 2214600704 13 01:33 274
-RW-R-----0 Oracle DBA 134225920 13 01:33 273
-RW-R-----0 Oracle DBA 536879104 13 01:33 272
C---------1 root sys, 2 Mar 13 02:00 5
C---------1 root sys, 2 Mar 13 02:00 4
C---------1 root sys, 2 Mar 13 02:00 3
C---------1 root sys, 2 Mar 13 02:00 2
C---------1 root sys, 2 Mar 13 02:00 1
C---------1 root sys, 2 Mar 13 02:00 0
--W-------1 Oracle DBA 4640842 13 04:43 7
--W-------1 Oracle DBA 4640842 13 04:43 6
-RW-R-----0 Oracle DBA 1207967744 13 18:21 271
-RW-R-----0 Oracle DBA 15929974784 13 18:39 284
-RW-R-----0 Oracle DBA 134225920 13 18:45 277
-RW-R-----0 Oracle DBA 2122326016 13 18:46 286
-RW-R-----0 Oracle DBA 9261031424 13 18:47 270
-RW-R-----0 Oracle DBA 18253619200 13 18:47 268
-RW-R-----1 Oracle DBA 134225920 13 18:51 261
-RW-R-----1 Oracle DBA 524296192 13 18:51 260
-RW-R-----1 Oracle DBA 104858112 13 18:52 259
-RW-R-----1 Oracle DBA 1941504 13 18:52 258
-RW-R-----1 Oracle DBA 1941504 13 18:52 257
-RW-R-----1 Oracle DBA 1941504 13 18:52 256

Sql> Select File#,name from v$datafile wehre name like '/disk% ';

file# NAME
---------- --------------------------------------------------
9/disk/oradata/xifenfei/xifenfei.dbf
10/disk/oradata/xifenfei/cssn.dbf
11/disk/oradata/xifenfei/ncssn.dbf
12/disk/oradata/xifenfei/csic_rds.dbf
13/disk/oradata/xifenfei/csic_cssn.dbf
14/disk/oradata/xifenfei/cnis_i.dbf
15/disk/oradata/xifenfei/cnis.dbf
16/disk/oradata/xifenfei/trswcm6_cssn.dbf
17/disk/oradata/xifenfei/trswcm6_cssn_plugins.dbf
18/disk/oradata/xifenfei/digiref.dbf
20/disk/oradata/xifenfei/trswcm.dbf
21/disk/oradata/xifenfei/trswcm52_nslc.dbf
22/disk/oradata/xifenfei/trswcm52_plugins_nslc.dbf
24/disk/oradata/xifenfei/trswcm_plugins.dbf
25/disk/oradata/xifenfei/cnis_all.dbf
27/disk/oradata/xifenfei/undotbs01.dbf
28/disk/oradata/xifenfei/trs_ids02.dbf
29/disk/oradata/xifenfei/xdb02.dbf
In Solaris is more depressed, although entered the FD directory, but can not know which file handles are deleted, which is normal, so there is no way, can only use lsof further analysis
ROOT@CNISORCLSVR # pkgadd-d Lsof-4.80-sol9-sparc-local

The following packages are available:
1 ibmlsof lsof
(SPARC) 4.80

Select package (s) you wish to process (or ' all "to process)
All packages). (Default:all) [?,??, Q]: All

Processing package instance <IBMlsof> from </tmp/lsof-4.80-sol9-sparc-local>

Lsof
(SPARC) 4.80
Vic Abell
Using </usr/local> as the package base directory.
# # Processing Package information.
# # Processing System Information.
# # Verifying disk space requirements.
# # Checking for conflicts with packages already installed.

The following files are already installed on the system and are being
Used by another package:
*/usr/local/bin <attribute Change only>

*-conflict with a file which does not belong to any package.

Do your want to install conflicting files [y,n,?, Q] Y
# # Checking for setuid/setgid programs.

The following files are being installed with setuid and/or
Permissions
/usr/local/bin/lsof <setgid sys>
/usr/local/bin/sparcv7/lsof <setgid sys>
/usr/local/bin/sparcv9/lsof <setgid sys>

Do your want to install as setuid/setgid files [y,n,?, Q] Y

Installing lsof as <IBMlsof>

# # Installing Part 1 of 1.
/usr/local/bin/lsof
/usr/local/bin/sparcv7/lsof
/usr/local/bin/sparcv9/lsof
/usr/local/doc/lsof/00.readme. The
/usr/local/doc/lsof/00credits
/usr/local/doc/lsof/00dcache
/usr/local/doc/lsof/00dialects
/usr/local/doc/lsof/00dist
/usr/local/doc/lsof/00faq
/usr/local/doc/lsof/00lsof-l
/usr/local/doc/lsof/00manifest
/usr/local/doc/lsof/00porting
/usr/local/doc/lsof/00quickstart
/usr/local/doc/lsof/00readme
/usr/local/doc/lsof/00test
/usr/local/doc/lsof/00xconfig
/usr/local/doc/lsof/lsof.man
/usr/local/man/man8/lsof.8
[Verifying class <none>]

Installation of <IBMlsof> was successful.

ROOT@CNISORCLSVR #./lsof-p 597
COMMAND PID USER FD TYPE DEVICE size/off NODE NAME
Oracle 597 Oracle CWD VDIR 85,5 2048 106299/export/home/oracle/app/product/9.2.0/dbs
Oracle 597 Oracle TXT VREG 85,5 61272672 2332/export/home/oracle/app/product/9.2.0/bin/oracle
............
Oracle 597 Oracle 260u VREG 85,5 524296192 106517/export/home/oracle/oradata/xifenfei/system01.dbf
Oracle 597 Oracle 261u VREG 85,5 134225920 106518/export/home/oracle/oradata/xifenfei/undotbs01.dbf
............
Oracle 597 Oracle 268u VREG 118,70 18253619200 109/disk (/DEV/DSK/C2T600A0B800029CEFA0000036C491B270BD0S6)
Oracle 597 Oracle 269u VREG 118,70 134225920 110/disk (/DEV/DSK/C2T600A0B800029CEFA0000036C491B270BD0S6)
Oracle 597 Oracle 270u VREG 118,70 9261031424 111/disk (/DEV/DSK/C2T600A0B800029CEFA0000036C491B270BD0S6)
............
Oracle 597 Oracle 293u VREG 118,70 1073750016 14/disk (/DEV/DSK/C2T600A0B800029CEFA0000036C491B270BD0S6)
To this point, basically positioning the/disk part is the data we need to recover, so we can navigate to the handle and then combine the data file information and use the CP command to recover the file directly. Then the database level recover and online.
Cd/proc/597/fd
CP 269/DISK/ORADATA/CNISORA2/CSSN.DBF
Chown oracle:dba/disk/oradata/xifenfei/cssn.dbf

sql> recover datafile 10;
ORA-00283: Recovery session canceled due to error
ORA-01124: Unable to recover data file 10-file in use or in recovery
ORA-01110: Data file: '/DISK/ORADATA/XIFENFEI/CSSN.DBF '


sql> ALTER DATABASE datafile offline;

The database has changed.

sql> recover datafile 10;
Complete media recovery.
sql> ALTER DATABASE datafile online;

The database has changed.
So far basically restore completed, fortunately, the database is not crash, encounter such problems, do not blindly shut down the database. Another database backup is more important than anything

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.