Oracle创建用户和表空间
- 登录到system或其他用户以创建其他用户
- 创建数据表空间
- 创建用户并制定表
- 给用户授予权限
一、登录到system或其他用户以创建其他用户
二、创建数据表空间
select * from dba_data_files;
![在这里插入图片描述](https://i-blog.csdnimg.cn/blog_migrate/86fbf8d4bbfff54b85e53a72d70dce1d.png)
CREATE TABLESPACE '表空间名'
LOGGING DATAFILE '/home/oracle/tablespace/***.DBF' (表空间的路径)
SIZE 32M (初始大小)
AUTOEXTEND ON (自动扩展)
NEXT 32M MAXSIZE UNLIMITED (自动扩展每次增加32M,最大无限)
EXTENT MANAGEMENT LOCAL;
三、创建用户以及设置密码
CREATE USER username IDENTIFIED BY password
ACCOUNT UNLOCK
DEFAULT TABLESPACE CHENGGUAN;
四、授权给新建的用户
GRANT CONNECT,RESOURCE TO username;
GRANT DBA TO username;
Oracle删除用户和表空间
select * from dba_users;
select * from dba_data_files;
drop user username cascade;
drop tablespace tablespace_name
including contents and datafiles cascade constraint;
- 删除空的表空间,但是不包含物理文件
drop tablespace tablespace_name; - 删除非空表空间,但是不包含物理文件
drop tablespace tablespace_name including contents; - 删除空表空间,包含物理文件
drop tablespace tablespace_name including datafiles; - 删除非空表空间,包含物理文件
drop tablespace tablespace_name including contents and datafiles;