-- 创建表空间

--语法: create tablespace 表空间名 datafile '路径' size 100M [aotuextend to];

create tablespace ytj_data

datafile 'D:/app/Administrator/oradata/ytj_data.DBF'

size 1000M

autoextend on;

--给表空间重命名

-- 语法: alter tablespace 旧名称 rename to 新名称;

alter tablespace newspace rename to myspace;

-- 删除表空间

--[including contents cascade constraints] 并把包含的数据和约束删除

-- 语法: drop tablespace 表空间名 [including contents cascade constraints];

drop tablespace EHR_DATA including contents cascade constraints;

-- 创建一个临时表空间

--语法: create temporary tablespace 临时表空间名 tempfile '路径' size 100M;

create temporary tablespace TEMP

tempfile 'd:/myspace/TEMP.dbf'

size 20M;

-- 创建一个用户,并指定表空间和临时表空间

create user ytj

identified by ytj

default tablespace EHR_DATA

temporary tablespace TEMP;

-- 一个新建的用户,是没有任何权限的,不能连接

-- 给用户授予权限

--连接数据库的权限

grant create session to lisi;

--创建表的权限

grant create table to lisi;

-- 使用表空间的权限

grant unlimited tablespace to lisi;

-- 创建一张用户表

create table tb_user(

u_id number primary key ,

u_name varchar2(50),

u_pass varchar2(20)

);

---查看表空间

select * from tablespace;

Logo

魔乐社区(Modelers.cn) 是一个中立、公益的人工智能社区,提供人工智能工具、模型、数据的托管、展示与应用协同服务,为人工智能开发及爱好者搭建开放的学习交流平台。社区通过理事会方式运作,由全产业链共同建设、共同运营、共同享有,推动国产AI生态繁荣发展。

更多推荐