oracle表空间管理

创建临时表空间:
CREATE TEMPORARY TABLESPACE job_temp
TEMPFILE ‘G:\oracle\product\10.2.0\oradata\orcl\job_temp.dbf‘--临时表空间物理地址
SIZE 32M
AUTOEXTEND ON
NEXT 32M MAXSIZE 2048M
EXTENT MANAGEMENT LOCAL;

CREATE TABLESPACE job_data
LOGGING
DATAFILE ‘G:\oracle\product\10.2.0\oradata\orcl\job.DBF‘--表空间所在物理地址
SIZE 32M
AUTOEXTEND ON
NEXT 32M MAXSIZE 2048M
EXTENT MANAGEMENT LOCAL;
创建用户
CREATE USER job IDENTIFIED BY job--用户名job密码job
DEFAULT TABLESPACE job_data
TEMPORARY TABLESPACE job_temp;

给用户授权
GRANT
  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 job;
查看用户所拥有的角色
SELECT * FROM USER_ROLE_PRIVS;

给用户授权:
GRANT RESOURCE to job



-----------------------------------------------查看用户权限---------------------------------------------------------

查看所有用户

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;



删除表空间
DROP TABLESPACE JOB_TEMP INCLUDING CONTENTS AND DATAFILES;
删除用户
drop user szy cascade
--默认表空间,修改用户默认表空间
alter user job default tablespace job_data


清空回收站
PURGE recyclebin;

查看当前用户的表
    select table_name from user_tables;

要查看用户的表要对象的用户为job,My objects
 

郑重声明:本站内容如果来自互联网及其他传播媒体,其版权均属原媒体及文章作者所有。转载目的在于传递更多信息及用于网络分享,并不代表本站赞同其观点和对其真实性负责,也不构成任何其他建议。