Successful recovery failure experiment using file descriptors in Linux

Source: Internet
Author: User
There are many ways to recover data, such as hot and cold backup and flash back to the database. If you delete data files directly from the operating system OS, there are some preferred methods in the LinuxUnix environment.

There are many ways to recover data, such as hot and cold backup and flash back to the database. If you delete data files directly from the operating system OS, there are some preferred methods in Linux/Unix environments.

Accidental data deletion is a "low-level error" that is often encountered by junior O & M personnel. Some experienced veterans sometimes get lost when they are tired and calm ". Once a data file is deleted by mistake, restoring the database with the least impact and the most rapid means is the top priority.

There are many ways to recover data, such as hot and cold backup and flash back to the database. If you delete data files directly from the operating system OS, there are some preferred methods to use in Linux/Unix environments. One of them is the File Description ).

-------------------------------------- Split line --------------------------------------

Recommended reading:

RMAN: Configure an archive log deletion policy

Basic Oracle tutorial-copying a database through RMAN

Reference for RMAN backup policy formulation

RMAN backup learning notes

Oracle Database Backup encryption RMAN Encryption

-------------------------------------- Split line --------------------------------------

1. Talk about File Description.

Different operating systems use different methods to manage CPU, memory, and storage files.

In Linux and Unix, file descriptors are used for file management. To open a file, a process calls the kernel function of the operating system. The kernel returns a file descriptor. This descriptor is also used to perform read and write operations on files. When deleting a file, the operating system determines that all file descriptors are released before deleting the file.

Our misoperation occurs in the running database system, although the file is deleted on the operating system is invisible. However, some existing file descriptors are stored in the Oracle database process. By using these file descriptors, we may find the file information to restore the data files.

Therefore, in the event of accidental deletion, do not worry about three points: calm mind, application disconnection, and on-site maintenance.

However, in practice, this fast recovery technology is not successful. To restore data using file descriptors, you must not close the database or automatically remove data files from database processes. This article starts with two experiments to introduce the operation methods and prerequisites.

2. Build an experiment environment

We chose Linux 2.6 kernel and Oracle 11g for the test. Note: In a production environment, such an experiment cannot be conducted. Complete backup is also required during the test.

[Oracle @ bspdev ~] $ Uname-

Linux bspdev. localdomain 2.6.18-308. el5 #1 SMP Tue Feb 21 20:05:41 EST 2012 i686 i686 i386 GNU/Linux

SQL> select * from v $ version;

BANNER

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

Oracle Database 11g Enterprise Edition Release 11.2.0.1.0-Production

PL/SQL Release 11.2.0.1.0-Production

CORE 11.2.0.1.0 Production

TNS for Linux: Version 11.2.0.1.0-Production

NLSRTL Version 11.2.0.1.0-Production

Create a dedicated tablespace, user, and data table for testing.

SQL> create tablespace rmdtest datafile '/u01/oradata/WILSON/datafile/rmdtest01.dbf' size 1000 m

2 extent management local uniform size 1 m

3 segment space management auto;

Tablespace created

SQL> create user rmtest identified by rmtest default tablespace rmdtest;

User created

SQL> grant resource, connect to rmtest;

Grant succeeded

SQL> grant select any dictionary to rmtest;

Grant succeeded

SQL> create table rm_tab as select * from dba_objects;

Table created

SQL> insert into rm_tab select * from rm_tab;

72731 rows inserted

SQL> commit;

Commit complete

The data table T is in the tablespace file of the experiment environment.

SQL> select tablespace_name, bytes/1024/1024 M from dba_segments where owner = 'rmtest' and segment_name = 'rm _ TAB ';

TABLESPACE_NAME M

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

RMDTEST 17

Make sure there is a good backup!

RMAN> list backup;

List of Backup Sets

==============================

BS Key Type LV Size Device Type Elapsed Time Completion Time

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

135 Full 1.39g disk 00:03:13 02-FEB-14

BP Key: 135 Status: AVAILABLE Compressed: NO Tag: TAG20140202T012300

(Space reasons, omitted ......)

Piece Name:

Piece Name:/u01/flash_recovery_area/WILSON/autobackup/2014_02_02/o1_mf_s_8381_779_9gtckx4s _. bkp

SPFILE Included: Modification time: 02-FEB-14

SPFILE db_unique_name: WILSON

Control File Included: Ckp SCN: 5370719 Ckp time: 02-FEB-14

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.