一、关于创建数据表空间、角色、用户
1、创建表空间(空间名称:wspace)
CREATE TABLESPACE wspace DATAFILE 'D:\app\Administrator\oradata\orcl\wspaceDATA.dbf' SIZE 500M autoextend on next 20m maxsize 2048m;2、创建角色(角色名称:WROLE)
CREATE ROLE WROLE NOT IDENTIFIED;
GRANT CONNECT TO WROLE;
GRANT DBA TO WROLE;
GRANT RESOURCE TO WROLE;
3、创建用户、并赋予角色(用户名:who;密码:)
create user who identified by "123456" default tablespace wspace profile DEFAULT ACCOUNT UNLOCK;
grant WROLE to who;grant unlimited tablespace to who;
同时配置用户密码永不过期:alter profile default limit password_life_time unlimited;
二、导入导出(cmd 命令窗口)
exp who/123456@orcl file=d:/da.dmp owner=(who)
IMP who/123456@orcl BUFFER=64000 FILE=d:/da.dmp FROMUSER=who TOUSER=who
IMP 常见错误:
IMP 00017:由于oracle错误 1658 :表空间分配过小造成;
三、表空间和数据文件的删除
1、查看当前用户的默认表空间
select username,default_tablespace from user_users;
2、删除表空间
drop tablespace wspace including contents and datafiles;
3、删除用户
drop user username cascade;
四、关闭用户连接
1、查询 (使用system用户)
select username,sid,serial# from v$session;
---- 此处获取 获取要关闭连接的用户的SPID
2、关闭连接
alter system kill session 'sid,serial#';