Oracle user-maneged recovery (1)

Source: Internet
Author: User

Oracle user-maneged recovery (1) I. disable database recovery in non-archive mode. shutdown immediate; shut down the database 2. use the operating system command to copy the latest backup (data files and control files, if log files are backed up) 3. incomplete recovery recover database until cancel using backup; 4. reset the log to open the database alter database open resetlogs; 2. SQL for offline recovery of data files or tablespaces> create table t1 tablespace tbs_sf as select * from dba_objects; -- create a test table to a specified tablespace SQL> select file_id, file_name from dba_data_files where TABLESPACE_NAME = 'tbs _ SF '; -- We can see the data file no. 26 FILE_ID FILE_NAME ---------- running 26/database/oradata/skyread/sf01.dbf SQL> alter database datafile 26 offline drop; -- the data file is offline, which is a simulated fault, the restoration is equivalent to copying a new file from the backup and returning it to the Database altered. SQL> select count (*) from t1; -- visible tables that cannot view the tablespace select count (*) from t1 * ERROR at line 1: ORA-00376: file 26 cannot be read at this timeORA-01110: data file 26: '/database/oradata/skyread/sf01.dbf' SQL> select hxfil file_id, fhsta status, fhscn, fhrba_seq seq from x $ kcvfh where hxfil = 26; FILE_ID status scn seq ------------ ------------------ ---------- 26 4 122693804311 2SQL> select GROUP #, BYTES, ARCHIVED, STATUS, SEQUENCE # from v $ log; -- the red log is not overwritten, you can restore GROUP # bytes arc status sequence # ---------- --- ---------------- ---------- 1 536870912 yes inactive 1 2 536870912 no current 2 3 536870912 yes unused 0 4 536870912 yes unused 0 5 536870912 yes unused 0SQL> recover datafile 26; -- Restore Media recovery complete. SQL> alter database datafile 26 online; Database altered. SQL> select count (*) from t1; COUNT (*) ---------- 50483 III. full recovery conditions in archive mode: 1. set as an archived valid backup 2. effective backup so far, all archives are in 3. advantages of redo log files not archived: 1. only the damaged files need to be restored. 2. the submitted data will not be lost. 3. you can recover the database when it is opened (non-system space and undo space) SQL> alter Database datafile 26 offline drop; -- simulate a fault and the data file damages the database altered. SQL> select GROUP #, BYTES, ARCHIVED, STATUS, SEQUENCE # from v $ log; GROUP # bytes arc status sequence # ---------- --- -------------- ---------- 1 536870912 yes inactive 1 2 536870912 no current 2 3 536870912 yes unused 0 4 536870912 yes unused 0 5 536870912 yes unused 0SQL> select * from v $ recover_file; -- view the data FILE to be recovered # ONLINE _ error change # TIME ---------------------- ------- begin ----------------------- 26 OFFLINE 122693905229 2013-04-27 15: 05: 39SQL> alter system switch logfile; -- perform multiple times to overwrite the SQL> select GROUP #, BYTES, ARCHIVED, STATUS, SEQUENCE # from v $ log; -- The GROUP # bytes arc status sequence # ---------------------- --- -------------------------------- 1 536870912 yes active 6 2 536870912 no current 7 3 536870912 yes inactive 3 4 536870912 yes active 4 5 536870912 YES ACTIVE 5 SQL> select * from v $ recovery_log; -- the archive THREAD # SEQUENCE # TIME ARCHIVE_NAME ---------------------- ----------------------- restore 1 2 2013-04-25 16:24:26/database/oradata/arch/restore> recover automatic datafile 26; -- use auto mode to automatically apply archiving and redo log files to restore Media recovery complete. SQL> alter database datafile 26 online; -- change the online Database altered of the data file. SQL> select count (*) from t1; COUNT (*) ------------------ 50483

Related Article

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.