Oracle创建表空间、新增用户

--查询表空间
SELECT tablespace_name,
file_id,
file_name,
round(bytes / (1024 * 1024), 0) total_space
FROM dba_data_files
ORDER BY tablespace_name;


--创建表空间"newTabSpace"
CREATE TABLESPACE "newTabSpace"
    NOLOGGING
    DATAFILE '/xxxx/xxxx/xxxx/xxx' SIZE 1024m AUTOEXTEND ON
    NEXT 100m MAXSIZE 20000m;

--创建用户"NEWUSER",密码为“NEWPASSWORD123”,分配给表空间“newTabSpace”
CREATE USER NEWUSER IDENTIFIED BY NEWPASSWORD123 DEFAULT TABLESPACE newTabSpace;

--授权
GRANT UNLIMITED TABLESPACE TO newTabSpace;
GRANT CREATE SESSION TO newTabSpace;
GRANT CREATE TABLE,CREATE VIEW,CREATE TRIGGER, CREATE SEQUENCE,CREATE PROCEDURE TO NEWUSER;
GRANT DBA TO NEWUSER;

 

你可能感兴趣的:(Oracle,SQL)