`
kalogen
  • 浏览: 865790 次
  • 性别: Icon_minigender_1
  • 来自: 杭州
社区版块
存档分类
最新评论

drop user和drop user cascade的区别

阅读更多

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.

被删除用户建立的其他用户不会被删除

如果该urer刚创建没有表等对象,可以使用drop user命令删除,否则要使用drop user cascade命令删除,此时会将该用户拥有的对象一同删除。

转自 http://hi.baidu.com/amingsc/blog/item/9aa3fc242c0c51094d088d56.html

分享到:
评论

相关推荐

    oracle对象创建

    connect database ...user Create user <user> identified by Alter user <user> default tablespace Alter user <user> quota <size> on ... Drop user <user> [cascade] role Create role Drop role <role>

    Oracle+sde数据备份、恢复

    Oracle+sde数据备份、恢复 从数据库中删除SDE和SDE USER用户 DROP USER SDE CASCADE; DROP USER SDEUSER CASCADE;

    oracletest

    drop user XX 删除用户, 如果要删除的用户已经创建有表了,那就需要在删除时带一个参数 cascade;把该用户的所有表一起删除 新建的用户无法登陆到数据库 show user;查看当前等数据库的用户名 oracle 有多少种...

    oracle创建用户及导入环境dmp

    drop user webbas cascade ;

    常用OracleSQL

    drop user oldoa cascade create tablespace tbsoa DATAFILE 'F:\app\Administrator\oradata\orcl\tbsoa.dbf' size 1024m autoextend on next 30m; create user oldoa identified by oldoa; grant dba to oldoa; ...

    Oracle数据库创建和授权

    DROP USER ELWY CASCADE; -- 创建用户 CREATE USER ELWY IDENTIFIED BY "ELWY" DEFAULT TABLESPACE ELWY_DATA TEMPORARY TABLESPACE ELWY_TEMP; -- 用户授权 GRANT CONNECT,RESOURCE TO ELWY; GRANT UNLIMITED ...

    oracle删除主键查看主键约束及创建联合主键

    ALTER TABLE TABLENAME DROP CONSTRAINTS COLUMN CASCADE; --删除约束 ALTER TABLE TABLENAME DISABLE PRIMARY_COLUMN ; --设置被设置为主键的列为无效 DROP INDEX INDEX_NAME; --删除主键索引 2,查看主键约束 ...

    Oracle中的用户操作、赋权、事务、锁、索引SQL语句.doc

    一、用户操作: 用户锁定和解锁/密码设置: alter user [USER] account lock; alter user [USER] account unlock; alter user scott identified by tiger;...删除用户:drop user [USER] cascade; ........

    数据库建库指令

    drop user cw cascade; drop user nc66 cascade; 创建表空间(SQLPLUS方法,PLSQL不适用 ) --定义表空间 define newtablespace=yonyou2015; --定义表空间文件路径 此处请务必保证正确 文件名可以自行修改 define ...

    oracle 10g 的sqlplus运行sql文件

    drop user gep cascade; create user gep identified by gep default tablespace USERS; grant connect,resource,dba to gep; grant create table to gep; grant select any table to gep; exit

    Linux下Oracle删除用户和表空间的方法

    SQL> drop user userName cascade; 用户已删除 如果用户无法删除,并报错: ERROR at line 1: ORA-01940: cannot drop a user that is currently connected 通过查看用户的进行,并kill用户进程,然后删除用户。 ...

    Oracle事例

    Drop table 表名 cascade constraints; 8:索引管理 <1>.creating function-based indexes sql> create index summit.item_quantity on summit.item(quantity-quantity_shipped); <2>.create a B-tree ...

    DBA常用SQL

    drop table table name cascade constraints; 删除父表的时候把子表也删除(外健) with check option 该列有访问且值等(即条件一致) novalidate enable 约束">第一章:写简单的sql语句 SQL> alter user ...

    最全的oracle常用命令大全.txt

    sql>drop table test c、表空间的创建、删除 六、ORACLE逻辑备份的SH文件 完全备份的SH文件:exp_comp.sh rq=` date +"%m%d" ` su - oracle -c "exp system/manager full=y inctype=complete file=/oracle/...

    oracle命令行删除与创建用户的代码

     drop user user1 cascade; exit oracle命令行创建用户: 代码如下: create user user1 identified by values ‘fa091872a2cc669c’ default tablespace user1 temporary tablespace temp ...

    Oracle数据库系统加固规范.doc

    " " " " " "drop user A cascade;//就这样用户就被删除了 " "判断依据 "标记用户用途,定期建立用户列表,比较是否有非法用 " " "户 " "实施风险 "高 " "重要等级 " " "备注 " " 2 SHG-Oracle-01-01-02 "编号 "SHG-...

    ORCALE语句大全

    删除用户 drop user zhu(cascade) cascade代表删除这个用户对应的所有对象 赋予权限 grant create session to zhu grant all on emp to zhu 权限传递 grant all on emp to zhu with grant option(对象权限) ...

    Oracle 删除用户和表空间详细介绍

    drop user ×× cascade 说明: 删除了user,只是删除了该user下的schema objects,是不会删除相应的tablespace的。 步骤二: 删除tablespace DROP TABLESPACE tablespace_name INCLUDING CONTENTS AND DATAFILES...

    oracle安装及备份

    drop user user_name cascade 清空指定用户的所有数据,但表空间已占用的空间不会释放 create or replace directory expdir as 'c:\bak' grant read,write on directory expdir to nc55 expdp nc55/nc55@ncxh ...

    数据库相关的知识点!

    删除索引:alter table 表名 drop primary key(列名)和alter table 表名 modify 列名 int,drop primary key 4、组合索引:将多个列组合成一个索引 创建组合索引:create iindex 索引名 on 表名(列1,列2) 在使用...

Global site tag (gtag.js) - Google Analytics