SQL> delete user itp2;
delete user itp2
       *
第 1 行出现错误:
ORA-00903: 表名无效
SQL> drop user itp2;
drop user itp2
*
第 1 行出现错误:
ORA-01940: 无法删除当前已连接的用户
SQL> drop user itp2;
用户已删除。
SQL> drop user itp;
drop user itp
*
第 1 行出现错误:
ORA-01922: 必须指定 CASCADE 以删除 'ITP'
SQL> drop user itp cascade;
用户已删除。
SQL>
drop user ; 仅仅是删除用户,
drop user ×× cascade ;会删除此用户名下的所有表和视图。

user
Specify the user to be dropped. Oracle Database does not drop users whose schemas 
contain objects unless you specify CASCADE or unless you first explicitly drop the 
user's objects.

CASCADE 
Specify CASCADE to drop all objects in the user's schema before dropping the user. You 
must specify this clause to drop a user whose schema contains any objects.

使用cascade参数可以删除该用户的全部objects。要说明的如下:

1 If the user's schema contains tables, then Oracle Database drops the tables and 
automatically drops any referential integrity constraints on tables in other schemas 
that refer to primary and unique keys on these tables.

如果用户的schema中有表,则在删除表的时候自动删除与该表相关的主键和外键。

2 If this clause results in tables being dropped, then the database also drops all 
domain indexes created on columns of those tables and invokes appropriate drop 
routines. 
如果用户的schema中有表,则在删除表的时候自动删除与该表相关的索引。

3 Oracle Database invalidates, but does not drop, the following objects in other 
schemas:
删除用户时,下列在其他用户中的objects不会被删除,只会被置为无效

1 Views or synonyms for objects in the dropped user's schema
视图,同义词

2 Stored procedures, functions, or packages that query objects in the dropped 
user's schema
存储过程,函数,包

4 Oracle Database does not drop materialized views in other schemas that are based 
on tables in the dropped user's schema. However, because the base tables no 
longer exist, the materialized views in the other schemas can no longer be 
refreshed.
其他用户建立的基于被删除用户的物化视图不会被删除,只是不能在刷新了。

5 Oracle Database drops all triggers in the user's schema.
用户模式下的所有触发器全部被删除

6 Oracle Database does not drop roles created by the user
被删除用户建立的其他用户不会被删除

drop user和drop user cascade的区别的更多相关文章

  1. Oracle中drop user和drop user cascade的区别

    drop user : 仅仅是删除用户,drop user username cascade :会删除此用户名下的所有表和视图. userSpecify the user to be dropped. ...

  2. oracle--drop user 和 drop user cascade 的区别【转载】

    drop user : 仅仅是删除用户, drop user ×× cascade :会删除此用户名下的所有表和视图. user Specify the user to be dropped. Ora ...

  3. 主外键 设置 on update cascade 和on delete cascade 的区别

    on update cascade 和on delete cascade 的区别 这是数据库外键定义的一个可选项,用来设置当主键表中的被参考列的数据发生变化时,外键表中响应字段的变换规则的.updat ...

  4. mysql 用drop和delete方法删除用户的区别

    在学习drop方法删除用户时,按照书上讲的一直没操作成功,后来到网上查了点其他资料,才弄明白drop的方法,贴出来和大家分享一下. (方法一)drop user 用户名; 语法:drop user 用 ...

  5. (转载)mysql 用drop和delete方法删除用户的区别

    (转载)http://hi.baidu.com/yymagento/item/56c3f6184bce8347e75e06db 在学习drop方法删除用户时,按照书上讲的一直没操作成功,后来到网上查了 ...

  6. delete、truncate、drop三种删除语句联系与区别

    相同点: 1.truncate和不带where子句的delete.以及drop都会删除表内的数据. 2.drop.truncate都是DDL语句(数据定义语言),执行后会自动提交. 不同点: 1. t ...

  7. drop、delete和truncate三者的区别

    相同点:1.truncate和不带where子句的delete.以及drop都会删除表内的数据.2.drop.truncate都是DDL语句(数据定义语言),执行后会自动提交.不同点:1. trunc ...

  8. sql 外键 on update cascade 和 on delete cascade 作用区别?

    这是数据库外键定义的一个可选项,用来设置当主键表中的被参考列的数据发生变化时,外键表中响应字段的变换规则的.update 则是主键表中被参考字段的值更新,delete是指在主键表中删除一条记录:on ...

  9. oracle中delete、truncate、drop的区别

    oracle中delete.truncate.drop的区别 标签: deleteoracletable存储 2012-05-23 15:12 7674人阅读 评论(0) 收藏 举报  分类: ora ...

随机推荐

  1. 【转】每天一个linux命令目录

    原文网址:http://www.cnblogs.com/peida/archive/2012/12/05/2803591.html 开始详细系统的学习linux常用命令,坚持每天一个命令,所以这个系列 ...

  2. linux日志分析

    转一位大神的笔记. 日志管理: 1.基于服务的 2.基于时间的 /var/log/wtmp,/var/run/utmp,/var/log/lastlog(lastlog),/var/log/btmp( ...

  3. Oracle 11gR2 RAC 常用维护操作 说明

    一.启动和停止集群 在Oracle 11gR2 下的RAC,架构发生了变化.CRS的信息也是放在ASM 实例里的,所以要关asm,必须关闭crs, 如果还使用了acfs的话,一关crs那么acfs里的 ...

  4. 阿里巴巴Java开发手册-集合处理

    1. [强制]关于 hashCode 和 equals 的处理,遵循如下规则:      1) 只要重写 equals ,就必须重写 hashCode .      2) 因为 Set 存储的是不重复 ...

  5. Centos替换默认源

    将默认的国外源替换为国内的网易的源 参考帮助文档:http://mirrors.163.com/.help/centos.html 查看本机版本:cat /etc/redhat-release 先安装 ...

  6. gcc gdb调试 (二)

    GDB的命令概貌——————— 启动gdb后,就你被带入gdb的调试环境中,就可以使用gdb的命令开始调试程序了,gdb的命令可以使用help命令来查看,如下所示: /home/hchen> g ...

  7. 【刷题】Search in a Big Sorted Array

    原题戳我. 题目 Description Given a big sorted array with positive integers sorted by ascending order. The ...

  8. 小峰mybatis(4)mybatis使用注解配置sql映射器

    主流开发还是使用xml来配置:使用注解配置比较快,但是不支持所有功能:有些功能还是得用配置文件: 一.基本映射语句: @Inert @Update @Delete @Select 二.结果集映射语句 ...

  9. 操作系统:Android(Google公司开发的操作系统)

    ylbtech-操作系统:Android(Google公司开发的操作系统) Android是一种基于Linux的自由及开放源代码的操作系统.主要使用于移动设备,如智能手机和平板电脑,由Google(谷 ...

  10. C#中char空值的几种表示方式

    C#中char空值的几种表示方式 在C#中char类型的表示方式通常是用单引号作为分隔符,而字符串是用双引号作为分隔符. 例如: 程序代码 程序代码 char a = 'a'; char b = 'b ...