1.cmd
2.SQL> sqlplus/nolog;
3.SQL> conn/as sysdba;
4.
SQL> CREATE TEMPORARY TABLESPACE DB_TEMP
TEMPFILE 'D:\app\Administrator\oradata\yx\DB_TEMP.DBF'
SIZE 32M
AUTOEXTEND ON
NEXT 32M MAXSIZE UNLIMITED
EXTENT MANAGEMENT LOCAL;
5.
SQL> CREATE TABLESPACE DB_DATA
LOGGING
DATAFILE 'D:\app\Administrator\oradata\yx\DB_DATA.DBF'
SIZE 32M
AUTOEXTEND ON
NEXT 32M MAXSIZE UNLIMITED
EXTENT MANAGEMENT LOCAL;
6.
SQL> CREATE USER loginName IDENTIFIED BY password
ACCOUNT UNLOCK
DEFAULT TABLESPACE DB_DATA
TEMPORARY TABLESPACE DB_TEMP;
7.
SQL> GRANT CONNECT,RESOURCE TO 帐号; --表示把 connect,resource权限授予loginName 用户
SQL> GRANT DBA TO loginName ; --表示把 dba权限授予给NEWUSER用户
授予用户操作表空间的权限:
grant unlimited tablespace to loginName;
grant create tablespace to loginName;
grant alter tablespace to loginName;
grant drop tablespace to loginName;
grant manage tablespace to loginName;
授予用户操作表的权限:
grant create table to konglin; (包含有create index权限, alter table, drop table权限)
授予用户操作视图的权限:
grant create view to konglin; (包含有alter view, drop view权限)
授予用户操作触发器的权限:
grant create trigger to konglin; (包含有alter trigger, drop trigger权限)
授予用户操作存储过程的权限:
grant create procedure to konglin;(包含有alter procedure, drop procedure 和function 以及 package权限)
授予用户操作序列的权限:
grant create sequence to konglin; (包含有创建、修改、删除以及选择序列)
授予用户回退段权限:
grant create rollback segment to konglin;
grant alter rollback segment to konglin;
grant drop rollback segment to konglin;
授予用户同义词权限:
grant create synonym to konglin;(包含drop synonym权限)
grant create public synonym to konglin;
grant drop public synonym to konglin;
授予用户关于用户的权限:
grant create user to konglin;
grant alter user to konglin;
grant become user to konglin;
grant drop user to konglin;
授予用户关于角色的权限:
grant create role to konglin;
授予用户操作概要文件的权限
grant create profile to konglin;
grant alter profile to konglin;
grant drop profile to konglin;
允许从sys用户所拥有的数据字典表中进行选择
grant select any dictionary to konglin;
grant create session to zhangsan;
grant unlimited tablespace to zhangsan;
grant create table to zhangsan;
grante drop table to zhangsan;
grant insert table to zhangsan;
grant update table to zhangsan;
grant all to public;
8.查看权限
select * from user_sys_privs;
select * from user_tab_privs;
select * from zhangsan.tablename
9.删除用户和表空间
步骤一:删除user
drop user ×× cascade
说明:删除了user,只是删除了该user下的schema objects,是不会删除相应的tablespace的。
步骤二: 删除tablespace
DROP TABLESPACE tablespace_name INCLUDING CONTENTS AND DATAFILES;
drop tablespace tablespace_name;
drop tablespace tablespace_name including contents;
drop tablespace tablespace_name including datafiles;
drop tablespace tablespace_name including contents and datafiles;