Table space Status (1). Table space status

Source: Internet
Author: User

Table space Status (1). Table space status

A few days ago, I asked a question about the table space status and exposed my weak basic knowledge. I summarized the following two blog posts to let myself calm down and fill in the relevant knowledge points, and enhance your understanding through practice.

Main reference:

11g Concept

11g Administrator's Guide


ONLINE and OFFLINE statuses of tablespaces

1. As long as the database is OPEN, other tablespaces except the SYSTEM tablespace can be set to online or offline. The reason why the SYSTEM tablespace cannot be set to offline is that the stored data dictionary must be used all the time. Set the tablespace to offline. Possible reasons include maintenance, backup, and recovery.

3. If the tablespace is offline, Oracle will not allow any SQL Execution ON THE OBJECTS IN THE tablespace. Statements that are still active when the tablespace is set to offline are not affected at the transaction level. Oracle will save the rollback data related to these unfinished statements to the SYSTEM tablespace. If the tablespace is set to online, Oracle will apply the rollback data if necessary.

3. In addition to Oracle, no application can read or edit the offline tablespace. Therefore, the table space of offline cannot be exported to other databases.

4. Oracle automatically switches the tablespace status from online to offline in some scenarios. For example, when the database writes the process DBWn, you cannot write the data file in the tablespace several times. An error is returned when you access the offline tablespace. If the problem of disk I/O failure is caused by a media error, the tablespace needs to be restored after the problem is solved.

5. Changing the tablespace to offline may include the following reasons:

(1) scenarios where access to some databases is prohibited.

(2) perform an offline tablespace backup (although the tablespace can be backed up online and in use ).

(3) When updating or maintaining an application, the application and the corresponding table must be temporarily inaccessible.

(4) Rename or re-allocate the data files in the table space.

When the tablespace is set to offline, the database sets all associated data files to offline. However, the following tablespace cannot be set to offline:

> SYSTEM

> UNDO tablespace

> Temporary tablespace

6. If a user sets the tablespace as its default tablespace before setting it to offline, consider whether to change its default tablespace. This is because these users cannot access objects in the offline tablespace.

7. Use the alter tablespace... OFFLINE statement to add the following parameters:

NORMAL: If no error occurs in any data file in the tablespace, The tablespace can be set to offline normally. If a write error occurs, the data files in the tablespace are not set to offline. When offline normal is explicitly used, the database performs a checkpoint event on all data files. NORMAL is the default setting.

TEMPORARY: The tablespace can be temporarily set to offline even if one or more files have an error. When offline temporary is used, the database places data files that are not set to offline and executes the checkpoint event.

If no file is offline but the temporary statement is used, you do not need to restore the media when you set the tablespace to online. However, if one or more files in a tablespace are in the offline state due to a write error, the tablespace can be temporarily set to the offline state. You need to restore the tablespace Before restoring it to the online state.

IMMEDIATE: The tablespace can be immediately set to the offline state. The database does not perform any checkpoint events for data files. When offline immediate is used, you need to restore the media to the table space before the tablespace is set to online. However, if the database is in NOARCHIVELOG mode, the tablespace cannot be immediately set to offline.

8. If you must set the tablespace to the offline state, we recommend that you use the default NORMAL statement first. It will ensure that the restoration operation is not required before the tablespace is set to online, even though the redo log sequence is reset using the later database open restlogs statement after Incomplete recovery.

TEMPORARY can be used only when the tablespace cannot be set to offline in the NORMAL mode. After TEMPORARY is used, you only need to restore the wrong offline files before the tablespace is set to online.

If both NORMAL and TEMPORARY fail, you can use the IMMEDIATE option.

9. If the tablespace is not "clean" and is set to offline (that is, the offline operation is not executed using the NORMAL statement), the media recovery operation must be performed on the tablespace before it is set to online. Otherwise, the database reports an error and the tablespace is still in the offline status.


Lab:

1. Set the tablespace DCSOPEN_TBS to offline.:

SQL> alter tablespace dcsopen_tbs offline;

Tablespace altered.


2. query the data file status:

Select file #, name, status from v $ datafile;

File # name status
-------------------------------------------------------------------

11/oracle/oradata_petest/petest/dcsopen_tbs02.dbf OFFLINE

The status of the data file used by DCSOPEN_TBS has been set to OFFLINE.


3. Try to query the OFFLINE tablespace:

SQL> select * from test;
Select * from test
*
ERROR at line 1:
ORA-00376: file 7 cannot be read at this time
ORA-01110: data file 7: '/oracle/oradata_petest/petest/dcsopen_tbs01.dbf'

An error is reported, indicating that the data file cannot be read.


4. Set the tablespace to online.:

SQL> alter tablespace dcsopen_tbs online;

Tablespace altered.


File # name status
-------------------------------------------------------------------

11/oracle/oradata_petest/petest/dcsopen_tbs02.dbf ONLINE


Not complete...

To be continued...


Is creating a permanent tablespace the same as creating a tablespace? What is the difference between them?

Several concepts can be clarified.
Permanent tablespace:

In general, the tablespaces that store data, system tablespaces, and common users use permanent tablespaces. There are three statuses of permanent tablespaces: read/write, read-only, and offline. They are only available in permanent tablespaces, to configure the ASSM management mode, you can set the logging mode. Select yes to restore the database after a problem occurs and set it as the system default tablespace. In this way, when a user is created, the default tablespace is not specified and is automatically set as the system default tablespace.
Temporary tablespace:
It is generally used for sorting and index creation. The temporary tablespace does not store actual data. Therefore, even if a problem occurs, it does not need to be restored, and no backup is required, therefore, you do not need to record logs. The temporary tablespace can only be in read/write mode, and can only be in the manual management segment space mode. You can set it to the default temporary tablespace of the system. In this way, when a user is created, the default temporary tablespace is not specified and is automatically set as the system default temporary tablespace.
Rollback segment tablespace:
It is used to store the original data in the modified data, And the tablespace In the rollback segment is used to ensure data read consistency.

In oracle, what is the so-called online status?

To put it bluntly, the tablespace is ONLINE or available. Users can
Read/write operations. If you are offline, you cannot read data from it.
From the backup point of view: Backup can be divided into online backup and offline backup. Online backup means that you do not need to close the database and back up it. If you want to back up offline backup, you need to shutdown the database and then back up it.

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.