Oracle views the properties of a tablespace, modifies the tablespace status, and oracle views
The status attributes of a tablespace mainly include online, offline, read only, and read write, the read-only and read/write statuses are special online situations. By setting the status attribute of the tablespace, we can manage the usage of the table space.
Online
When the table space status is online, access to data in the table space is allowed.
If the tablespace is not in the online status, you can use the alter tablespace statement to change its status to online. The statement is as follows:
Alter tablespace tablespace_name online;
Offline
When the tablespace status is offline, access to data in the tablespace is not allowed. For example, you cannot create a table in a tablespace or read the lamp data in the tablespace. You can back up the table space offline or upgrade and maintain the application.
If the tablespace is not in the offline status, you can use the alter tablespace statement to change its status to offline. The statement is as follows:
Alter tablespace tablespace_name offline parameter;
Here, parameter indicates the parameters that can be used to switch the tablespace to the offline state. The following parameters can be applied.
Normal
Temporary
Immediate
For recover
Read-Only
When the table space status is read only, although the table space data can be accessed, Fan Wen is only limited to reading, but cannot be updated or deleted, the objective is to ensure the data security of tablespaces.
If the tablespace is not read only, you can use the ater tablespace statement to change its status to read only. The statement format is as follows:
Alter tablespace tablespace_name read only;
Note the following before changing the tablespace status to read only:
1. The tablespace must be online.
2. The tablespace cannot contain any transaction rollback segments.
3. The tablespace cannot be in an online database backup period.
Read/write
When the tablespace status is read write, you can access the table space normally, including querying, updating, and operating the data in the table space.
If the tablespace is not in read write status, you can use the alter tablespace statement to change its status to read write. The statement format is as follows:
Alter tablespace tablespace_name read write;
To change the tablespace status to read write, make sure that the tablespace is online.
// View the tablespace status
SQL> select tablespace_name, status from dba_tablespaces;
TABLESPACE_NAME STATUS
---------------------------------------
SYSTEM ONLINE
SYSAUX ONLINE
UNDOTBS1 ONLINE
TEMP ONLINE
USERS ONLINE
MYTEMP ONLINE
TEMPGROUP ONLINE
TEMPGROUP02 ONLINE
MYBIGSPACE ONLINE
BLOCKSPACE ONLINE
INSPUR ONLINE
TESTSPACE ONLINE
TEST ONLINE
13 rows have been selected.
// Modify the tablespace status
SQL> alter tablespace myspace offline;
The tablespace has been changed.
SQL> select tablespace_name, status from dba_tablespaces;
TABLESPACE_NAME STATUS
---------------------------------------
SYSTEM ONLINE
SYSAUX ONLINE
UNDOTBS1 ONLINE
TEMP ONLINE
USERS ONLINE
MYSPACE OFFLINE
The specific operations are not described one by one.
The above is a summary of learning.