Step 6: Understand the Oracle tablespace status

Source: Internet
Author: User

I like Oracle tablespace very much. I also like to sum up the experience and lessons on Oracle tablespace status in my work. Let's talk about this in detail.

1. query the Oracle tablespace status

 
 
  1. select tablespace_name,status from dba_tablespaces; 

2. Change the Oracle tablespace status

 
 
  1. alter tablespace book offline/online/read only/read write; 

Offline/online/read-only/read/write

3. Move data files

 
 
  1. select tablespace_name,file_name from dba_data_files;  
  2. alter tablespace book offline; 

Move the file to the new directory.

 
 
  1. alter tablespace book rename datafile '/u01/oradata/oracle8i/sales01.dbf' to '/u02/oradata/oracle8i/sales01.dbf'; 

4. Modify the online/offline attributes of data files

In archivelog Mode

 
 
  1. alter database datafile '/u01/oradata/oracle8i/sales01.dbf' offline; 

Noarchivelog Mode

 
 
  1. alter database datafile '/u01/oradata/oracle8i/sales01.dbf' offline drop; 

5. Convert the data dictionary tablespace to the local management tablespace

 
 
  1. select tablespace_name,extent_management,allocation_type from dba_tablespace;  
  2. exec dbms_space_admin.tablespace_migrate_to_local('book') 

System tablespace and temporary tablespace temp cannot be converted

 
 
  1. exec dbms_space_admin.tablespace_migrate_from_local('book')  

6. delete a tablespace

 
 
  1. drop tablespace student including contents; 

Including contents deletes tablespaces and entities

 
 
  1. create table test(id number(3)) tablespace test_tablesapce; 

The table space status in Oracle is described above. Here I will share my understanding and discuss it with you.

  1. How to unlock Oracle in a database
  2. Five key points of Oracle password management
  3. Unlock an Oracle user on the command line
  4. Database security risks caused by default Oracle Administrators
  5. Three operations of the VB. net undo tablespace

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.