oracle表空间创建

1、创建永久表空间,大小为10M,自动扩展,增量为5M,最大文件大小为1G。

SQL> create tablespace user_commerce01 datafile '/u01/app/oracle/oradata/orcl/user_commerce01.dbf' size 10M autoextend on next 5M maxsize 1G;

Tablespace created.

SQL> select tablespace_name,file_id,block_id,bytes,blocks from dba_free_space where Tablespace_name='USER_COMMERCE01';

TABLESPACE         FILE_ID   BLOCK_ID      BYTES     BLOCKS
---------- ---------- ---------- ---------- ----------
USER_COMMERCE01          2        128    9437184       1152

2、创建只读表空间,文件大小10M,自动扩展,增量5M,最大数据文件1M。

SQL> create tablespace user_commerce02 datafile '/u01/app/oracle/oradata/orcl/user_commerce02.dbf' size 10M autoextend on next 5M maxsize 1G;

Tablespace created.

SQL> alter tablespace user_commerce02 read only;

Tablespace altered.

3、创建临时表空间大小为5M,其他保持默认值

SQL> create temporary tablespace user_commerce_temp tempfile '/u01/app/oracle/oradata/orcl/user_commerce_temp.dbf' size 5M;

Tablespace created.

SQL> select tablespace_name from dba_temp_files;

TABLESPACE
----------
TEMP
USER_COMMERCE_TEMP

4、创建大文件表空间,文件大小为3M,其他保持默认值

SQL> create tablespace user_commerce_big datafile '/u01/app/oracle/oradata/user_commerce_big.dbf' size 3M;

Tablespace created.

5、创建撤销表空间,文件大小为3M,其他保持默认值

SQL> create undo tablespace user_commerce_undo datafile  '/u01/app/oracle/oradata/user_commerce_undo.dbf' size 3M;

Tablespace created.

6、查看新创建的表空间

SQL> select tablespace_name,status,contents from dba_tablespaces;

TABLESPACE_NAME                STATUS    CONTENTS
------------------------------ --------- ---------------------
SYSTEM                         ONLINE    PERMANENT
SYSAUX                         ONLINE    PERMANENT
UNDOTBS1                       ONLINE    UNDO
TEMP                           ONLINE    TEMPORARY
USERS                          ONLINE    PERMANENT
CNBUGSDB                       ONLINE    PERMANENT
USER_COMMERCE01                ONLINE    PERMANENT
USER_COMMERCE02                READ ONLY PERMANENT
USER_COMMERCE_TEMP             ONLINE    TEMPORARY
USER_COMMERCE_BIG              ONLINE    PERMANENT
USER_COMMERCE_UNDO             ONLINE    UNDO

11 rows selected.

发表评论

后才能评论