问题提出:
〉DROP USER USER1 CASCADE
ERROR:ORA-01940: cannot drop a user that is currently connected
由于当前用户正连接到,所以无法删除
解决办法:
1、查询此用户的会话进程,
SQL〉SELECT SID,SERIAL# FROM V$SESSION WHERE USERNAME='USER1'; ----------------记得大写、虽然创建用户时需要用大写
SID SERIAL#
---------- ----------
24 25341
86 18117
2、结束此用户的所有会话
SQL>ALTER SYSTEM KILL SESSION '24,25341';
System altered.
SQL>ALTER SYSTEM KILL SESSION '86,18117';
System altered.
3、删除用户
SQL〉DROP USER USER1 CASCADE;
SQL> select sid,serial#,status from v$session where username='NC2012';
SID SERIAL# STATUS
---------- ---------- ------------------------
104 1713 INACTIVE
106 8 INACTIVE
107 8 INACTIVE
116 14 INACTIVE
136 2334 INACTIVE
272 8 KILLED
324 21 KILLED
7 rows selected.
SQL> alter system kill session '272,8'; --------------------kill一个 进程状态就变成“ 272 8 KILLED”
System altered.
SQL> DROP USER NC2012 CASCADE;
User dropped.
SQL>
1.在pl/sql中用如下命令创建表空间
create tablespace energy_winter logging datafile '\opt\oradata\dev\energy_winter.dbf'
size 32m autoextend on next 32m maxsize 2048m extent management local ;
2.删除该表空间
drop tablespace energy_winter;
3.再重新创建该表空间
create tablespace energy_winter logging datafile '\opt\oradata\dev\energy_winter.dbf'
size 32m autoextend on next 32m maxsize 2048m extent management local ;
出现如下错误:
ORA-01119: 创建数据库文件 'energy_winter ' 时出错
ORA-27038: skgfrcre: 文件存在
OSD-04010: 指定了 <create> 选项, 但文件已经存在
解决方法:
create 语句使用 reuse 即可:
create tablespace 'EPCDBA_TAB ' datafile ' ' size xx reuse; |
如:
create tablespace energy_winter logging datafile '\opt\oradata\dev\energy_winter.dbf'
size 32m reuse autoextend on next 32m maxsize 2048m extent management local;