Oracle 用户 对 表空间 配额(quota ) 说明
2011-05-11 20:56
453 查看
一.官网的说明
Oracle官网对quota的定义如下:
Alimitonaresource,suchasalimitontheamountofdatabasestorageusedbyadatabaseuser.AdatabaseadministratorcansettablespacequotasforeachOracleDatabaseusername.
有关OracleQuota这块,只在Oracle的安全管理这块搜到了一些内容。
ManagingSecurityforOracleDatabaseUsers
http://download.oracle.com/docs/cd/E11882_01/network.112/e16543/users.htm#DBSEG10220
1.1AssigningaTablespaceQuotafortheUser
Youcanassigneachuseratablespacequotaforanytablespace(exceptatemporarytablespace).Assigningaquotaaccomplishesthefollowing:
(1)Userswithprivilegestocreatecertaintypesofobjectscancreatethoseobjectsinthespecifiedtablespace.
(2)OracleDatabaselimitstheamountofspacethatcanbeallocatedforstorageofauser'sobjectswithinthespecifiedtablespacetotheamountofthequota.
Bydefault,auserhasnoquotaonanytablespaceinthedatabase.Iftheuserhastheprivilegetocreateaschemaobject,thenyoumustassignaquotatoallowtheusertocreateobjects.Ataminimum,assignusersaquotaforthedefaulttablespace,andadditionalquotasforothertablespacesinwhichtheycancreateobjects.
ThefollowingCREATEUSERstatementassignsthefollowingquotasforthetest_tsanddata_tstablespaces:
CREATEUSERjward
IDENTIFIEDBYpassword
DEFAULTTABLESPACEdata_ts
QUOTA100MONtest_ts
QUOTA500KONdata_ts
TEMPORARYTABLESPACEtemp_ts
PROFILEclerk;
--在创建用户的时候,就指定用户在特定表空间上的配额
Youcanassignausereitherindividualquotasforaspecificamountofdiskspaceineachtablespaceoranunlimitedamountofdiskspaceinalltablespaces.Specificquotaspreventauser'sobjectsfromusingtoomuchspaceinthedatabase.
--配额的指定可以禁止用户的对象使用过多的表空间
Youcanassignquotastoausertablespacewhenyoucreatetheuser,oraddorchangequotaslater.(YoucanfindexistinguserquotasbyqueryingtheUSER_TS_QUOTASview.)。
Ifanewquotaislessthantheoldone,thenthefollowingconditionsremaintrue:
(1)Ifauserhasalreadyexceededanewtablespacequota,thentheobjectsofauserinthetablespacecannotbeallocatedmorespaceuntilthecombinedspaceoftheseobjectsislessthanthenewquota.
(2)Ifauserhasnotexceededanewtablespacequota,orifthespaceusedbytheobjectsoftheuserinthetablespacefallsunderanewtablespacequota,thentheuser'sobjectscanbeallocatedspaceuptothenewquota.
1.2RestrictingtheQuotaLimitsforUserObjectsinaTablespace
YoucanrestrictthequotalimitsforuserobjectsinatablespacebyusingtheALTERUSERSQLstatementtochangethecurrentquotaoftheusertozero.
Afteraquotaofzeroisassigned,theobjectsoftheuserinthetablespaceremain,andtheusercanstillcreatenewobjects,buttheexistingobjectswillnotbeallocatedanynewspace.
Forexample,youcouldnotinsertdataintooneofthisuser'sexitingtables.TheoperationwillfailwithanORA-1536spacequotaexceededfortableserror.
1.3GrantingUserstheUNLIMITEDTABLESPACESystemPrivilege
Topermitausertouseanunlimitedamountofanytablespaceinthedatabase,granttheusertheUNLIMITEDTABLESPACEsystemprivilege.Thisoverridesallexplicittablespacequotasfortheuser.Ifyoulaterrevoketheprivilege,thenyoumustexplicitlygrantquotastoindividualtablespaces.Youcangrantthisprivilegeonlytousers,nottoroles.
BeforegrantingtheUNLIMITEDTABLESPACEsystemprivilege,youmustconsidertheconsequencesofdoingso.
Advantage:
Youcangrantauserunlimitedaccesstoalltablespacesofadatabasewithonestatement.
Disadvantages:
(1)Theprivilegeoverridesallexplicittablespacequotasfortheuser.
(2)YoucannotselectivelyrevoketablespaceaccessfromauserwiththeUNLIMITEDTABLESPACEprivilege.Youcangrantselectiveorrestrictedaccessonlyafterrevokingtheprivilege.
1.4ListingAllTablespaceQuotas
UsetheDBA_TS_QUOTASviewtolistalltablespacequotasspecificallyassignedtoeachuser.Forexample:
Whenspecificquotasareassigned,theexactnumberisindicatedintheMAX_BYTEScolumn.Thisnumberisalwaysamultipleofthedatabaseblocksize,soifyouspecifyatablespacequotathatisnotamultipleofthedatabaseblocksize,thenitisroundedupaccordingly.Unlimitedquotasareindicatedby-1.
二.Quota说明
配额大小指的是用户指定使用表空间的的大小。在1.1节里提到,默认情况下,用户对所有表空间都是没有配额的,即不受空间的限制。查看几个用户的创建脚本来验证一下:
CREATEUSERSYSTEM
IDENTIFIEDBY<password>
DEFAULTTABLESPACESYSTEM
TEMPORARYTABLESPACETEMP
PROFILEDEFAULT
ACCOUNTUNLOCK;
--2RolesforSYSTEM
GRANTAQ_ADMINISTRATOR_ROLETOSYSTEMWITHADMINOPTION;
GRANTDBATOSYSTEMWITHADMINOPTION;
ALTERUSERSYSTEMDEFAULTROLEALL;
--5SystemPrivilegesforSYSTEM
GRANTGLOBALQUERYREWRITETOSYSTEM;
GRANTCREATEMATERIALIZEDVIEWTOSYSTEM;
GRANTCREATETABLETOSYSTEM;
GRANTUNLIMITEDTABLESPACETOSYSTEMWITHADMINOPTION;
GRANTSELECTANYTABLETOSYSTEM;
CREATEUSERDAVE
IDENTIFIEDBY<password>
DEFAULTTABLESPACEUSERS
TEMPORARYTABLESPACETEMP
PROFILEDEFAULT
ACCOUNTUNLOCK;
--2RolesforDAVE
GRANTCONNECTTODAVE;
GRANTRESOURCETODAVE;
ALTERUSERDAVEDEFAULTROLEALL;
--1SystemPrivilegeforDAVE
GRANTUNLIMITEDTABLESPACETODAVE;
从这2个脚本来看,默认情况下,都会对用户赋unlimitedtablespace的权限。这是是在创建的时候指定的,当我们的用户创建好之后,我们也可以修改用户的配额。
有关用户的配额的操作说明
1.创建用户时,指定限额
SQL>conn/assysdba;
Connected.
SQL>createuseranqingidentifiedbyanqingdefaulttablespaceuserstemporarytablespacetempquota10Monusers;
Usercreated.
查询用户配额的信息:
SQL>selecttablespace_name,username,max_bytesfromDBA_TS_QUOTASwhereusername='ANQING';
TABLESPACE_NAMEUSERNAMEMAX_BYTES
--------------------------------------------------
USERSANQING10485760
2.更改用户的表空间限额:
不对用户做表空间限额控制:
SQL>grantunlimitedtablespacetoanqing;
Grantsucceeded.
这种方式是全局性的.即修改用户多所有表空间的配额。
如果我们想改某个具体的,即针对用户的某个特定的表空间,可以使用如下SQL:
SQL>alteruseranqingquotaunlimitedonusers;
Useraltered.
查看配额:
SQL>selecttablespace_name,username,max_bytesfromDBA_TS_QUOTASwhereusername='ANQING';
TABLESPACE_NAMEUSERNAMEMAX_BYTES
--------------------------------------------------
USERSANQING-1
这时候max_bytes为-1,即不受限制。
3.回收用户对表空间的配额:
同样两种方式,
全局:
SQL>revokeunlimitedtablespacefromanqing;
Revokesucceeded.
在查看配额,已经没有了相关信息:
SQL>selecttablespace_name,username,max_bytesfromDBA_TS_QUOTASwhereusername='ANQING';
norowsselected
针对某个特定的表空间:
SQL>alteruseranqingquota0onusers;
Useraltered.
-------------------------------------------------------------------------------------------------------
Blog:http://blog.csdn.net/tianlesoftware
Email:dvd.dba@gmail.com
DBA1群:62697716(满);DBA2群:62697977(满)DBA3群:62697850(满)
DBA超级群:63306533(满);DBA4群:83829929DBA5群:142216823
聊天群:40132017聊天2群:69087192
--加群需要在备注说明Oracle表空间和数据文件的关系,否则拒绝申请
Oracle官网对quota的定义如下:
Alimitonaresource,suchasalimitontheamountofdatabasestorageusedbyadatabaseuser.Adatabaseadministratorcanset
有关OracleQuota这块,只在Oracle的安全管理这块搜到了一些内容。
ManagingSecurityforOracleDatabaseUsers
1.1AssigningaTablespaceQuotafortheUser
Youcanassigneachuseratablespacequotaforanytablespace(exceptatemporarytablespace).Assigningaquotaaccomplishesthefollowing:
(1)Userswithprivilegestocreatecertaintypesofobjectscancreatethoseobjectsinthespecifiedtablespace.
(2)OracleDatabaselimitstheamountofspacethatcanbeallocatedforstorageofauser'sobjectswithinthespecifiedtablespacetotheamountofthequota.
Bydefault,auserhasnoquotaonanytablespaceinthedatabase.Iftheuserhastheprivilegetocreateaschemaobject,thenyoumustassignaquotatoallowtheusertocreateobjects.Ataminimum,assignusersaquotaforthedefaulttablespace,andadditionalquotasforothertablespacesinwhichtheycancreateobjects.
ThefollowingCREATEUSERstatementassignsthefollowingquotasforthetest_tsanddata_tstablespaces:
CREATEUSERjward
IDENTIFIEDBYpassword
DEFAULTTABLESPACEdata_ts
QUOTA100MONtest_ts
QUOTA500KONdata_ts
TEMPORARYTABLESPACEtemp_ts
PROFILEclerk;
--在创建用户的时候,就指定用户在特定表空间上的配额
Youcanassignausereitherindividualquotasforaspecificamountofdiskspaceineachtablespaceoranunlimitedamountofdiskspaceinalltablespaces.Specificquotaspreventauser'sobjectsfromusingtoomuchspaceinthedatabase.
--配额的指定可以禁止用户的对象使用过多的表空间
Youcanassignquotastoausertablespacewhenyoucreatetheuser,oraddorchangequotaslater.(YoucanfindexistinguserquotasbyqueryingtheUSER_TS_QUOTASview.)。
Ifanewquotaislessthantheoldone,thenthefollowingconditionsremaintrue:
(1)Ifauserhasalreadyexceededanewtablespacequota,thentheobjectsofauserinthetablespacecannotbeallocatedmorespaceuntilthecombinedspaceoftheseobjectsislessthanthenewquota.
(2)Ifauserhasnotexceededanewtablespacequota,orifthespaceusedbytheobjectsoftheuserinthetablespacefallsunderanewtablespacequota,thentheuser'sobjectscanbeallocatedspaceuptothenewquota.
1.2RestrictingtheQuotaLimitsforUserObjectsinaTablespace
YoucanrestrictthequotalimitsforuserobjectsinatablespacebyusingtheALTERUSERSQLstatementtochangethecurrentquotaoftheusertozero.
Afteraquotaofzeroisassigned,theobjectsoftheuserinthetablespaceremain,andtheusercanstillcreatenewobjects,buttheexistingobjectswillnotbeallocatedanynewspace.
Forexample,youcouldnotinsertdataintooneofthisuser'sexitingtables.TheoperationwillfailwithanORA-1536spacequotaexceededfortableserror.
1.3GrantingUserstheUNLIMITEDTABLESPACESystemPrivilege
Topermitausertouseanunlimitedamountofanytablespaceinthedatabase,granttheusertheUNLIMITEDTABLESPACEsystemprivilege.Thisoverridesallexplicittablespacequotasfortheuser.Ifyoulaterrevoketheprivilege,thenyoumustexplicitlygrantquotastoindividualtablespaces.Youcangrantthisprivilegeonlytousers,nottoroles.
BeforegrantingtheUNLIMITEDTABLESPACEsystemprivilege,youmustconsidertheconsequencesofdoingso.
Advantage:
Youcangrantauserunlimitedaccesstoalltablespacesofadatabasewithonestatement.
Disadvantages:
(1)Theprivilegeoverridesallexplicittablespacequotasfortheuser.
(2)YoucannotselectivelyrevoketablespaceaccessfromauserwiththeUNLIMITEDTABLESPACEprivilege.Youcangrantselectiveorrestrictedaccessonlyafterrevokingtheprivilege.
1.4ListingAllTablespaceQuotas
UsetheDBA_TS_QUOTASviewtolistalltablespacequotasspecificallyassignedtoeachuser.Forexample:
SELECT*FROMDBA_TS_QUOTAS;
TABLESPACEUSERNAMEBYTESMAX_BYTESBLOCKSMAX_BLOCKS
------------------------------------------------------
USERSJFEE05120000250
USERSDCRANNEY0-10-1
Whenspecificquotasareassigned,theexactnumberisindicatedintheMAX_BYTEScolumn.Thisnumberisalwaysamultipleofthedatabaseblocksize,soifyouspecifyatablespacequotathatisnotamultipleofthedatabaseblocksize,thenitisroundedupaccordingly.Unlimitedquotasareindicatedby-1.
二.Quota说明
配额大小指的是用户指定使用表空间的的大小。在1.1节里提到,默认情况下,用户对所有表空间都是没有配额的,即不受空间的限制。查看几个用户的创建脚本来验证一下:
CREATEUSERSYSTEM
IDENTIFIEDBY<password>
DEFAULTTABLESPACESYSTEM
TEMPORARYTABLESPACETEMP
PROFILEDEFAULT
ACCOUNTUNLOCK;
--2RolesforSYSTEM
GRANTAQ_ADMINISTRATOR_ROLETOSYSTEMWITHADMINOPTION;
GRANTDBATOSYSTEMWITHADMINOPTION;
ALTERUSERSYSTEMDEFAULTROLEALL;
--5SystemPrivilegesforSYSTEM
GRANTGLOBALQUERYREWRITETOSYSTEM;
GRANTCREATEMATERIALIZEDVIEWTOSYSTEM;
GRANTCREATETABLETOSYSTEM;
GRANTUNLIMITEDTABLESPACETOSYSTEMWITHADMINOPTION;
GRANTSELECTANYTABLETOSYSTEM;
CREATEUSERDAVE
IDENTIFIEDBY<password>
DEFAULTTABLESPACEUSERS
TEMPORARYTABLESPACETEMP
PROFILEDEFAULT
ACCOUNTUNLOCK;
--2RolesforDAVE
GRANTCONNECTTODAVE;
GRANTRESOURCETODAVE;
ALTERUSERDAVEDEFAULTROLEALL;
--1SystemPrivilegeforDAVE
GRANTUNLIMITEDTABLESPACETODAVE;
从这2个脚本来看,默认情况下,都会对用户赋unlimitedtablespace的权限。这是是在创建的时候指定的,当我们的用户创建好之后,我们也可以修改用户的配额。
有关用户的配额的操作说明
1.创建用户时,指定限额
SQL>conn/assysdba;
Connected.
SQL>createuseranqingidentifiedbyanqingdefaulttablespaceuserstemporarytablespacetempquota10Monusers;
Usercreated.
查询用户配额的信息:
SQL>selecttablespace_name,username,max_bytesfromDBA_TS_QUOTASwhereusername='ANQING';
TABLESPACE_NAMEUSERNAMEMAX_BYTES
--------------------------------------------------
USERSANQING10485760
2.更改用户的表空间限额:
不对用户做表空间限额控制:
SQL>grantunlimitedtablespacetoanqing;
Grantsucceeded.
这种方式是全局性的.即修改用户多所有表空间的配额。
如果我们想改某个具体的,即针对用户的某个特定的表空间,可以使用如下SQL:
SQL>alteruseranqingquotaunlimitedonusers;
Useraltered.
查看配额:
SQL>selecttablespace_name,username,max_bytesfromDBA_TS_QUOTASwhereusername='ANQING';
TABLESPACE_NAMEUSERNAMEMAX_BYTES
--------------------------------------------------
USERSANQING-1
这时候max_bytes为-1,即不受限制。
3.回收用户对表空间的配额:
同样两种方式,
全局:
SQL>revokeunlimitedtablespacefromanqing;
Revokesucceeded.
在查看配额,已经没有了相关信息:
SQL>selecttablespace_name,username,max_bytesfromDBA_TS_QUOTASwhereusername='ANQING';
norowsselected
针对某个特定的表空间:
SQL>alteruseranqingquota0onusers;
Useraltered.
-------------------------------------------------------------------------------------------------------
Blog:
Email:dvd.dba@gmail.com
DBA1群:62697716(满);DBA2群:62697977(满)DBA3群:62697850(满)
DBA超级群:63306533(满);DBA4群:83829929DBA5群:142216823
聊天群:40132017聊天2群:69087192
--加群需要在备注说明Oracle表空间和数据文件的关系,否则拒绝申请
相关文章推荐
- Oracle 用户 对 表空间 配额(quota ) 说明
- Oracle 用户 对 表空间 配额(quota ) 说明
- Oracle 用户对表空间配额quota说明
- Oracle 用户 对 表空间 配额(quota ) 说明
- Oracle 用户 对 表空间 配额(quota ) 说明
- Oracle 用户 对 表空间 配额(quota ) 说明
- Oracle 用户 对 表空间 配额(quota ) 说明
- Oracle 用户 对 表空间 配额(quota ) 说明
- Oracle 用户对表空间配额quota说明
- Oracle 用户 对 表空间 配额(quota ) 说明
- Oracle 用户 对 表空间 配额(quota )
- ORACLE 表空间不足与用户配额(限额)不足的问题解决
- Oracle 创建用户、修改用户信息、为用户分配权限、为用户分配表空间配额、删除用户
- ORACLE 表空间不足与用户配额(限额)不足的问题解决
- 获取oracle中某一用户某一表空间下的表、列注释说明的SQL查询语句
- ORACLE 表空间不足与用户配额(限额)不足的问题解决
- ORACLE中查找所有表,查找用户权限,修改表空间配额的命令
- 【Oracle】创建用户配额总是不足的解决问题 quota
- Oracle 创建用户、修改用户信息、为用户分配权限、为用户分配表空间配额、删除用户
- 用户表空间限额(Oracle User Space Quota )