这五个需要自定义名字
test_tablespace :表空间名
test_tablespace_ext.dbf:表空间文件名
test_user:用户名
testpassword:用户登录密码
testnewpassword:新密码
-- 创建表空间,初始值1G,自动增长,每次增长1G,最大30G
create tablespace test_tablespace datafile '+DATA/shzgdb/datafile/test_tablespace_ext.dbf' size 1G AUTOEXTEND ON NEXT 1G MAXSIZE 30g;
-- 给表空间创建用户
create user test_user identified by testpassword default tablespace test_tablespace ;
-- 修改用户密码
alter user test_user identified by testnewpassword;
-- 给用户授权
grant connect,resource,dba to test_user ;
grant create session to test_user ;
-- 授权表给用户只能针对每张表去授权,因此可以批量生成授权语句
select 'grant select on '|| table_name||' to test_user;' from user_tables;