[Experiment-video process] oracle hot backup-single tablespace-backup and recovery operation demonstration

Source: Internet
Author: User

[Experiment-video process] oracle hot backup-single tablespace-backup and recovery operation demonstration

[Experiment-video process] oracle hot backup-single tablespace-backup and recovery operation demonstration

Restore a tablespace

1. Create a tablespace

drop tablespace test_backup  including contents and datafiles;CREATE TABLESPACE test_backup DATAFILE '/u01/app/oracle/oradata/orcl/test_back.dbf' SIZE 10M  autoextend on;

2. Write test data and create a test table

drop table test_backup purge;CREATE TABLE test_backup( aa NUMBER, bb VARCHAR2(10)) TABLESPACE test_backup;

3. Insert test data, the first one.

 insert into test_backup values (1,'test_back1'); commit;

4. Set the backup mode for the database

SQL> ALTER TABLESPACE test_backup BEGIN BACKUP;Tablespace altered.

5. copy the data file to the backup file.

host cp /u01/app/oracle/oradata/orcl/test_back.dbf /home/backup/xuejiayue/ 

6. End backup mode

SQL> ALTER TABLESPACE test_backup END BACKUP;Tablespace altered.

7. Switch logs

SQL> ALTER SYSTEM SWITCH LOGFILE;System altered.

8. Insert the data again and insert the second data (the backup is completed now ).

SQL> insert into test_backup values (2,'test_back2');1 row created.SQL> commit;Commit complete.

9. Simulate faults and delete database files

host rm -rf /u01/app/oracle/oradata/orcl/test_back.dbf

10. Restart the database

SQL> shutdown immediate;Database closed.Database dismounted.ORACLE instance shut down.startup 

11. Data File error should be reported in the test data table.

SQL> select * from test_backup;select * from test_backup *ERROR at line 1:ORA-00376: file 6 cannot be read at this timeORA-01110: data file 6: '/u01/app/oracle/oradata/orcl/test_back.dbf'

12. Recover a single tablespace database file in the database.

SQL> ALTER DATABASE DATAFILE 6 OFFLINE DROP 2 ;Database altered.SQL> host cp /home/backup/xuejiayue/test_back.dbf /u01/app/oracle/oradata/orcl/test_back.dbf SQL> RECOVER DATAFILE 6Media recovery complete.SQL> ALTER DATABASE DATAFILE 6 ONLINE;Database altered.

12. Test Data after recovery is completed.

SQL> select * from test_backup; AA BB---------- ---------- 1 test_back1 2 test_back2

The result is: both data files are in !!!

Video address
Http://v.youku.com/v_show/id_XMTM2MzI0NjcyMA==.html

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.