Home > Database > Mysql Tutorial > body text

oracle12 creates user-specified table space (code)

不言
Release: 2019-02-12 11:43:06
forward
4030 people have browsed it

The content of this article is about creating user-specified table space (code) in oracle12. It has certain reference value. Friends in need can refer to it. I hope it will be helpful to you. .

--1.创建临时空间
create temporary tablespace zyj_temp
tempfile 'D:\app2\user\virtual\oradata\orcl\zyj_temp.dbf'
size 50m
autoextend on
next 50m maxsize 20480m
extent management local;
--2.创建数据表空间
create tablespace zyj_data
logging
datafile 'D:\app2\user\virtual\oradata\orcl\zyj_data.dbf'
size 50m
autoextend on
next 50m maxsize 20480m
extent management local;
--3.创建用户并指定表空间
---刚开始用户名为zyj,提示错误ORA-65096:公用用户名或角色名无效,网上查资料,说是取名前缀必须为c##,所以用户名也变成了c##zyj
--首次创建用户时提示zyj_data表空间不存,重启了服务就创建成功
create user c##zyj identified by 1234
default tablespace zyj_data
temporary tablespace zyj_temp;
--4.授权给c##zyj,ps:根据需要设置权限
GRANT CREATE ANY VIEW,DROP ANY VIEW,CONNECT,RESOURCE,CREATE SESSION,DBA TO c##zyj;


--------删除用户及表空间
drop user c##zyj cascade;
DROP TABLESPACE zyj_data INCLUDING CONTENTS AND DATAFILES;
--删除空的表空间,但是不包含物理文件
drop tablespace tablespace_name;
--删除非空表空间,但是不包含物理文件
drop tablespace tablespace_name including contents;
--删除空表空间,包含物理文件
drop tablespace tablespace_name including datafiles;
--删除非空表空间,包含物理文件
drop tablespace tablespace_name including contents and datafiles;
--如果其他表空间中的表有外键等约束关联到了本表空间中的表的字段,就要加上CASCADE CONSTRAINTS
drop tablespace tablespace_name including contents and datafiles CASCADE CONSTRAINTS;

select tablespace_name from DBA_tablespaces;
Copy after login


The above is the detailed content of oracle12 creates user-specified table space (code). For more information, please follow other related articles on the PHP Chinese website!

Related labels:
source:cnblogs.com
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template