oracle 03-06 表空间

Managing Database Storage Structures

Objectives
After completing this lesson, you should be able to:
• Describe the storage存储 of table row data in blocks
• Create and manage tablespaces
• Obtain获取 tablespace information

管理数据库存储结构

 目标

完成本课程后,您应该能够:

•描述表行数据在块中的存储

•创建和管理表空间

•获取表空间信息

 创建表空间

SYSTEM的地址才有操作系统写权限

数据文件都是已.dbf为结尾

填好地址/文件名.dbf后点加号添加

一般不勾选重用现有文件,如果文件名已被用过,会将旧表清空 

 表空间存储目录:

/u01/app/oracle/oradata/ORCL

 

 

[oracle@yf ~]$ sqlplus 用户登陆命令

SQL*Plus: Release 18.0.0.0.0 - Production on Wed Jun 17 17:43:03 2020
Version 18.3.0.0.0

Copyright (c) 1982, 2018, Oracle. All rights reserved.

Enter user-name: jsmith   输入用户名
Enter password:            输入密码

???:
Oracle Database 18c Enterprise Edition Release 18.0.0.0.0 - Production
Version 18.3.0.0.0

SQL> show user     查看当前用户
USER ? "JSMITH"

SQL> create table t2 (col1 number) ;  创建表到user空间下

SQL> create table t2 (col1 number) tablespace inventory;  创建表到inventory空间下

SQL> desc user_tables; 列出指定表或视图中的所有列

SQL> select tablespace_name from user_tables where table_name='T2';  查看t2表在不在,特别注意:表名t2一定要用大写,否则查不到。

TABLESPACE_NAME
------------------------------
INVENTORY

Oracle 预置表空间

Tablespaces Created by Default: Overview
• EXAMPLE (optional) 测试数据
• SYSAUX  系统表空间,数据字典,一般用户表或对象存在系统表空间里
• SYSTEM  系统辅助表空间 AWR EM
• TEMP  临时表空间 order by 排序操作等,会临时存在这里
• UNDOTBS1  支持DML语句的rollback
• USERS  用户表空间

A database can have a mixture of Oracle-managed and unmanaged files. 对的

Enlarging the Database
You can enlarge the database in the following ways:
• Create a new tablespace.
• Add a data file to an existing smallfile tablespace.
• Increase the size of a data file.
• Provide for the dynamic growth of a data file.
SYSTEM
tablespace
INVENTORY
tablespace

扩大数据库

可以通过以下方式放大数据库:

•创建新表空间。

•将数据文件添加到现有的smallfile表空间。

•增加数据文件的大小。

•提供数据文件的动态增长。

系统

表空间

库存

表空间

SQL> alter database move datafile '/u01/app/oracle/oradata/ORCL/inventory01.dbf' to '/u01/app/oracle/oradata/ORCL/inventory03.dbf';

将inventory01变成inventory03 12C中的新功能,可在线文件移动、更名

SQL> select file_name from dba_data_files;  查看当前数据文件名称

FILE_NAME
--------------------------------------------------------------------------------
/u01/app/oracle/oradata/ORCL/system01.dbf
/u01/app/oracle/oradata/ORCL/sysaux01.dbf
/u01/app/oracle/oradata/ORCL/undotbs01.dbf
/u01/app/oracle/oradata/ORCL/users01.dbf
/u01/app/oracle/oradata/ORCL/inventory03.dbf
/u01/app/oracle/oradata/ORCL/inventory02.dbf

原文地址:https://www.cnblogs.com/cloud7777/p/13154320.html