oracle 创建表空间,用户并授权

时间:2023-03-08 16:59:12

1. 查看所有表空间及存储路径

select file_name, tablespace_name from dba_data_files;

2. 创建表空间

CREATE TABLESPACE xstream_tbs DATAFILE
'/opt/oracle/app/oradata/orcl/xstream_tbs.dbf' SIZE 25M
REUSE AUTOEXTEND ON MAXSIZE UNLIMITED;

3. 创建用户并指定表空间

CREATE USER xstrmadmin IDENTIFIED BY admin
DEFAULT TABLESPACE xstream_tbs
QUOTA UNLIMITED ON xstream_tbs;

4. 授权

grant create session to xstrmadmin;
grant select any table to xstrmadmin;
grant unlimited tablespace to xstrmadmin;
grant create any table to xstrmadmin;
grant drop any table to xstrmadmin;
grant insert any table to xstrmadmin;
grant update any table to xstrmadmin;
grant connect,resource,dba to xstrmadmin;

各权限顾名思义,在此不做详细说明