oracle 删除用户和用户下的数据
有两种方法,一种是drop user username;还有一种是 drop user username cascade;官方的说明如下:Dropping a Database User: ExampleIf user Sidney's schema contains no objects, then you can drop sidney by issuing the statement:DRO
·
有两种方法,一种是drop user username;
还有一种是 drop user username cascade;
官方的说明如下:
Dropping a Database User: Example If user Sidney's schema contains no objects, then you can drop sidney by issuing the statement:
DROP USER sidney;
If Sidney's schema contains objects, then you must use the CASCADE clause to drop sidney and the objects:
DROP USER sidney CASCADE;
drop user username必须是这个用户下面没有任何对象;这样才可以使用这个命令,否则就会报错;
如果用户下面有对象,就得用drop user username cascade来删除这个用户以及这个用户下的所有对象了;
同时删除多个用户的话,可以用下面的方法
select 'drop user ' || username || ' cascade' || ';'
from dba_users
可以在后面根据需要加上筛选条件。
把生成的语句,批量执行就可以了。
更多推荐
已为社区贡献3条内容
所有评论(0)