Oracle Basic Statement (chapter fifth, database logical storage structure management)

Source: Internet
Author: User

1. Use the SYS user to log in to SQL Plus as SYSDBA and use view V$tablespace to view tablespace information

SELECT * from V$tablespace;

2. View View Dba_tablespaces View the properties and online status of all tablespaces

SELECT tablespace_name, CONTENTS, STATUS from dba_tablespaces;--table space name, table space content, tablespace state

3. Other (slightly)

4. CREATE TABLE Space

CREATE tablespace < tablespace name > datafile < data file name > Size < data file size > EXTENT MANAGEMENT LOCAL autoallocate;

--Local management table space,autoallocate specifies the table space is managed by the system, the minimum interval 64KB; corresponds to autoallocate uniform

CREATE tablespace < tablespace name > datafile < data file name > Size < data file size > EXTENT MANAGEMENT LOCAL UNIFORM size 12 8K;

-- Local management table space, uniform Specify a minimum interval of 128KB

CREATE bigfile tablespace < tablespace name > datafile < data file name > Size < data file size >;

--bigfile keyword to create a large file tablespace

CREATE Temporary tablespace < temp tablespace name > tempfile < temporary file name > size < temp files Initial size > Reuse EXTENT MANAGEMENT LOCAL UNIFORM SIZE 128K;

--temporary tablespace, temporary tablespace is not allowed to use autoallocate, must use UNIFORM,Reuse Description Temporary file can be reused.

5. Segment Management in table space

CREATE tablespace < tablespace name > datafile < data file name > Size < data file size > EXTENT MANAGEMENT LOCAL Autoallocate SEGMENT space MANAGEMENT auto;--Table spaces for automatic segment management

CREATE tablespace < tablespace name > datafile < data file name > Size < data file size > EXTENT MANAGEMENT LOCAL Autoallocate SEGMENT space MANAGEMENT MANUAL;--Table spaces for manual segment management

6. Data block management in table space

CREATE tablespace < tablespace name > datafile < data file name > Size < data file size > EXTENT MANAGEMENT LOCAL Autoallocate BLOCKSIZE 8K;--table space for automatic segment management

7. Undo Table Space

CREATE undo tablespace < tablespace name > datafile < data file name > Size < data file size > reuse;--undo Table Space

DROP Tablespace < table space name >;--Delete table space

Drop tablespace < tablespace name > including contents;--Delete table space while deleting the segment

DROP tablespace < tablespace name > including CONTENTS and datafiles; --Delete the table space while deleting the segments and data files

8. Modify Table Space

ALTER tablespace < tablespace name > RENAME to < new name >;--rename

ALTER tablespace < tablespace name > add datafile < data file name > Size < data file size >;--Add data file

ALTER tablespace < temp tablespace name > add tempfile < temporary file name > size < temporary files Initial size >;--add temporary file to temporary tablespace

Alter Tablespace < tablespace name > RESIZE < data file size >;--Modify large file tablespace size

ALTER Talbespace < tablespace name > OFFLINE;--set tablespace to offline state

ALTER Talbespace < tablespace name > online ;--set table space to online status

ALTER Talbespace < table space name >Read only;--read-only table space

ALTER Talbespace < tablespace name > Read Write;--Readable and writable

9. Other query statements and table space groups (slightly)

10. Assigning temporary table space groups to users, etc. (slightly)

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.