![吐舌头](http://static.blog.csdn.net/xheditor/xheditor_emot/default/tongue.gif)
![吐舌头](http://static.blog.csdn.net/xheditor/xheditor_emot/default/tongue.gif)
![吐舌头](http://static.blog.csdn.net/xheditor/xheditor_emot/default/tongue.gif)
![吐舌头](http://static.blog.csdn.net/xheditor/xheditor_emot/default/tongue.gif)
![吐舌头](http://static.blog.csdn.net/xheditor/xheditor_emot/default/tongue.gif)
1.创建临时表空间
<span style="font-family:Comic Sans MS;">CREATE TEMPORARY TABLESPACE test
TEMPFILE 'D:\app\oradata\orcl\test.dbf'
SIZE 32M
AUTOEXTEND ON
NEXT 32M MAXSIZE 2048M
EXTENT MANAGEMENT LOCAL;</span>
2.创建用户表空间
<span style="font-family:Comic Sans MS;">CREATE TABLESPACE test_datd
LOGGING
DATAFILE 'D:\app\PRODUCT\10.1.0\ORADATA\ORCL\TEST.DBF'
SIZE 32M
AUTOEXTEND ON
NEXT 32M MAXSIZE 2048M
EXTENT MANAGEMENT LOCAL;</span>
3.创建用户并制定表空间
<span style="font-family:Comic Sans MS;">CREATE USER username IDENTIFIED BY password
DEFAULT TABLESPACE test_data
TEMPORARY TABLESPACE temp;</span>
4.给用户授予权限
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 username;
或者
grant connect to username ;
grant dba to username ;
grant resource to username ;
grant create any sequence to username ;
grant create any table to username ;
grant create any view to username ;
grant delete any table to username ;
grant execute any procedure to username ;
grant insert any table to username ;
grant select any table to username ;
grant unlimited tablespace to username ;
grant update any table to username ;
将role这个角色授与username,也就是说,使username这个用户可以管理和使用role所拥有的资源
GRANT role TO username;
5.查看所有用户
<span style="font-family:Comic Sans MS;">SELECT * FROM DBA_USERS;
SELECT * FROM ALL_USERS;
SELECT * FROM USER_USERS;</span>
6.查看用户系统权限
<span style="font-family:Comic Sans MS;">SELECT * FROM DBA_SYS_PRIVS;
SELECT * FROM USER_SYS_PRIVS;</span>
7.查看用户对象或角色权限
<span style="font-family:Comic Sans MS;">SELECT * FROM DBA_TAB_PRIVS;
SELECT * FROM ALL_TAB_PRIVS;
SELECT * FROM USER_TAB_PRIVS;</span>
8.查看所有角色
<span style="font-family:Comic Sans MS;">SELECT * FROM DBA_ROLES;</span>
9.查看用户或角色所拥有的角色
<span style="font-family:Comic Sans MS;">SELECT * FROM DBA_ROLE_PRIVS;
SELECT * FROM USER_ROLE_PRIVS;</span>
<p style="color: rgb(75, 75, 75); font-size: 12px; line-height: 19.2px;"><span style="font-family:Comic Sans MS;">遇到<span style="font-size: 14px; line-height: 18px;"><strong>no privileges on tablespace 'tablespace '</strong></span></span></p><p style="color: rgb(75, 75, 75); font-size: 12px; line-height: 19.2px;"><span style="font-family:Comic Sans MS;"><span style="font-size: 13px; line-height: 19.2px; color: rgb(0, 0, 255);">alter</span><span style="font-size: 13px; line-height: 19.2px; color: rgb(0, 0, 0);"> </span><span style="font-size: 13px; line-height: 19.2px; color: rgb(255, 0, 255);">user</span><span style="font-size: 13px; line-height: 19.2px; color: rgb(0, 0, 0);"> userquota 10M</span><span style="font-size: 13px; line-height: 19.2px; color: rgb(255, 0, 0);">[</span><span style="font-size: 13px; line-height: 19.2px; color: rgb(255, 0, 0);">unlimited</span><span style="font-size: 13px; line-height: 19.2px; color: rgb(255, 0, 0);">]</span><span style="font-size: 13px; line-height: 19.2px; color: rgb(0, 0, 0);"> </span><span style="font-size: 13px; line-height: 19.2px; color: rgb(0, 0, 255);">on</span><span style="font-size: 13px; line-height: 19.2px; color: rgb(0, 0, 0);"> tablespace;</span></span></p><span style="font-family:verdana, Arial, helvetica, sans-seriff;">
</span>