Code
-- 创建表空间(以管理员身份登陆)
CREATE TEMPORARY TABLESPACE All_Test_TEMP
TEMPFILE 'D:\ORACLE\ORADATA\MYDB\AllTestTemp.dbf'
SIZE 32M
AUTOEXTEND ON
NEXT 32M MAXSIZE 2048M
EXTENT MANAGEMENT LOCAL;
-- 删除表空间
DROP TABLESPACE All_Test INCLUDING CONTENTS AND DATAFILES;
-- 创建用户表空间
CREATE TABLESPACE All_Test
LOGGING
DATAFILE 'D:\ORACLE\ORADATA\MYDB\AllTest.dbf'
SIZE 256M
AUTOEXTEND ON
NEXT 32M MAXSIZE 4096M
EXTENT MANAGEMENT LOCAL;
-- 创建用户并指定表空间
CREATE USER ALLTEST IDENTIFIED BY alltest
DEFAULT TABLESPACE All_Test
TEMPORARY TABLESPACE All_Test_TEMP;
-- 给用户授予仅限
GRANT UNLIMITED TABLESPACE,CREATE SESSION, CREATE ANY TABLE, CREATE ANY VIEW ,CREATE ANY INDEX, CREATE ANY PROCEDURE,
ALTER ANY TABLE, ALTER ANY PROCEDURE,
DROP ANY TABLE, DROP ANY VIEW, DROP ANY INDEX, DROP ANY PROCEDURE,
SELECT ANY TABLE, INSERT ANY TABLE, UPDATE ANY TABLE, DELETE ANY TABLE
TO ALLTEST;
-- 查看所有用户
SELECT * FROM DBA_USERS;
SELECT * FROM ALL_USERS;
SELECT * FROM USER_USERS;
-- 查看用户系统权限
SELECT * FROM DBA_SYS_PRIVS;
SELECT * FROM USER_SYS_PRIVS;
-- 查看用户对象或角色对象
SELECT * FROM DBA_TAB_PRIVS;
SELECT * FROM ALL_TAB_PRIVS;
SELECT * FROM USER_TAB_PRIVS;
-- 查看所有角色
SELECT * FROM DBA_ROLES;
-- 查看所有用户所拥有的所有的角色
SELECT * FROM DBA_ROLE_PRIVS;
SELECT * FROM USER_ROLE_PRIVS;
-- 创建表空间(以管理员身份登陆)
CREATE TEMPORARY TABLESPACE All_Test_TEMP
TEMPFILE 'D:\ORACLE\ORADATA\MYDB\AllTestTemp.dbf'
SIZE 32M
AUTOEXTEND ON
NEXT 32M MAXSIZE 2048M
EXTENT MANAGEMENT LOCAL;
-- 删除表空间
DROP TABLESPACE All_Test INCLUDING CONTENTS AND DATAFILES;
-- 创建用户表空间
CREATE TABLESPACE All_Test
LOGGING
DATAFILE 'D:\ORACLE\ORADATA\MYDB\AllTest.dbf'
SIZE 256M
AUTOEXTEND ON
NEXT 32M MAXSIZE 4096M
EXTENT MANAGEMENT LOCAL;
-- 创建用户并指定表空间
CREATE USER ALLTEST IDENTIFIED BY alltest
DEFAULT TABLESPACE All_Test
TEMPORARY TABLESPACE All_Test_TEMP;
-- 给用户授予仅限
GRANT UNLIMITED TABLESPACE,CREATE SESSION, CREATE ANY TABLE, CREATE ANY VIEW ,CREATE ANY INDEX, CREATE ANY PROCEDURE,
ALTER ANY TABLE, ALTER ANY PROCEDURE,
DROP ANY TABLE, DROP ANY VIEW, DROP ANY INDEX, DROP ANY PROCEDURE,
SELECT ANY TABLE, INSERT ANY TABLE, UPDATE ANY TABLE, DELETE ANY TABLE
TO ALLTEST;
-- 查看所有用户
SELECT * FROM DBA_USERS;
SELECT * FROM ALL_USERS;
SELECT * FROM USER_USERS;
-- 查看用户系统权限
SELECT * FROM DBA_SYS_PRIVS;
SELECT * FROM USER_SYS_PRIVS;
-- 查看用户对象或角色对象
SELECT * FROM DBA_TAB_PRIVS;
SELECT * FROM ALL_TAB_PRIVS;
SELECT * FROM USER_TAB_PRIVS;
-- 查看所有角色
SELECT * FROM DBA_ROLES;
-- 查看所有用户所拥有的所有的角色
SELECT * FROM DBA_ROLE_PRIVS;
SELECT * FROM USER_ROLE_PRIVS;