(09) read-only tablespaces that are often forgotten

Source: Internet
Author: User

In database management, some historical data or basically unchanged data is put into the read-only tablespace. Because such tablespaces can only be read but not DML.

It can effectively prevent accidental modification or deletion, so it is suitable for storing the above types of data. In addition, it also has a benefit in backup, because it is read-only, that is, it does not change,

You only need to set it to read-only and back up once. You can ignore this feature in future backup, which can reduce the pressure on a backup. This causes people to ignore it slowly.

Case 1: The tablespace is indeed backed up once, but is ignored later. The backup cannot be found during recovery.
This situation is related to administrators, and it is important to formulate reasonable specifications.
Case 2: When restoring, most of the data will not be about restoring the read-only tablespace. However, the database you want to restore does have read-only tablespace.
However, you may not remember or be clear about this. Therefore, it is ignored during restoration. While the Oracle command ignores the read-only tablespace, it can be restored successfully.
The consequences of this situation are huge and small, depending on luck.

Create and restore a read-only tablespace.

Set and query read-only tablespaces:
1. Set a tablespace as a read-only tablespace
    create tablespace XCL_DATA datafile '/u01/app/oracle/xcldb/xcl_data01dbf' size 1m;    alter tablespace XCL_DATA read only;   

2. Check the current read-only tablespace and corresponding data files in the database in the lower view.
 SELECT t.tablespace_name tbs_name,          d.file_id    tbsf_id,  d.file_name  tbsf_name   FROM  dba_tablespaces t,dba_data_files d    WHERE t.tablespace_name=d.tablespace_name  AND t.status='READ ONLY';
Backup recovery:

Scenario 1: Full-Database Backup contains read-only tablespace
In this case, when RMAN is restored, the most important thing is to add check readonly to specify that the read-only tablespace should be forcibly restored.
Backup:
Backup database;
Recovery:
Restore database check readonly;
Recover database check readonly;

 
Case 2: Back up the read-only tablespace separately. Skip it during full-database backup.
Backup:
Backup tablespace XCL_DATA;
Backup database skip readonly;

Recovery:
Restore database;
Restore tablespace XCL_DATA;
Recover database;


Case 3: The data files in the read-only tablespace are backed up separately in the cold backup mode. The read-only tablespace is skipped during full-database backup.
Backup:
A. Use host copy or copy to copy all data files in the read-only tablespace to another directory for backup.
B. Back up all databases
Backup database skip readonly;

Recovery:
A. restore database;
B. Restore the read-only tablespace data file backed up in another directory.
C. recover database;

 
This situation is different. In the past, we had to "alter tablespace... begin backup" to put the tablespace in the online backup mode, and then back up the data file.

The read-only tablespace can directly copy data files.


MAIL: xcl_168@aliyun.com

BLOG: http://blog.csdn.net/xcl168


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.