Oracle中 drop user 和 drop user cascade 的区别

dropuser仅仅是删除用户,

dropuser××cascade会删除此用户名下的所有表和视图。

user
Specifytheusertobedropped.OracleDatabasedoesnotdropuserswhoseschemas
containobjectsunlessyouspecifyCASCADEorunlessyoufirstexplicitlydropthe
user'sobjects.

CASCADE
SpecifyCASCADEtodropallobjectsintheuser'sschemabeforedroppingtheuser.You
mustspecifythisclausetodropauserwhoseschemacontainsanyobjects.

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

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

2.Ifthisclauseresultsintablesbeingdropped,thenthedatabasealsodropsalldomainindexescreatedoncolumnsofthosetablesandinvokesappropriatedroproutines.
如果用户的schema中有表,则在删除表的时候自动删除与该表相关的索引。

3.OracleDatabaseinvalidates,butdoesnotdrop,thefollowingobjectsinotherschemas:
删除用户时,下列在其他用户中的objects不会被删除,只会被置为无效

3.1Viewsorsynonymsforobjectsinthedroppeduser'sschema
视图,同义词


3.2Storedprocedures,functions,orpackagesthatqueryobjectsinthedroppeduser'sschema
存储过程,函数,包

4.OracleDatabasedoesnotdropmaterializedviewsinotherschemasthatarebasedontablesinthedroppeduser'sschema.However,becausethebasetablesnolongerexist,thematerializedviewsintheotherschemascannolongerberefreshed.
其他用户建立的基于被删除用户的物化视图不会被删除,只是不能在刷新了。

5.OracleDatabasedropsalltriggersintheuser'sschema.
用户模式下的所有触发器全部被删除

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

------------------------------------------------------------------------------

Blog:http://blog.youkuaiyun.com/tianlesoftware

网上资源:http://tianlesoftware.download.youkuaiyun.com

相关视频:http://blog.youkuaiyun.com/tianlesoftware/archive/2009/11/27/4886500.aspx

DBA1群:62697716();DBA2群:62697977

<!--EndFragment-->
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值