Oracle数据库创建表空间

--Oracle数据库创建表空间

create tablespace new_taspace 

--表空间名

DATAFILE 'D:NEWTABLESPACE.DBF'   --表空间关联的数据文件和位置

size 200M --文件初始大小

autoextend on next 20MB MAXSIZE 400MB; --文件大小可自动扩展,每次扩展20MB,最大400MB

复制代码
--创建表空间

create tablespace new_taspace1 

--表空间关联的数据文件和位置

DATAFILE 'D:NEWTABLESPACE1.DBF' 

--文件初始大小

SIZE 200M
复制代码

--日志文件
Logging
extent management local
segment space management  auto; --以分号结束

--删除表空间把物理文件一并删除
drop tablespace new_taspace  including contents and datafiles

--创建用户
create user orders
identified by 123456
default tablespace new_taspace; --给用户创建默认表空间

--给用户赋予角色
grant connect,resource to orders
grant dba from orders

--撤销用户管理员角色

revoke dba from orders

--添加访问某张表的权限

grant select on tep to orders

--创建图书表
create table book(
id number(11) primary key,
bookname varchar2(50) not null,
price number(11,2) not null,
storage number(11) not null
)

原文地址:https://www.cnblogs.com/Suk1M/p/4523414.html