文档详情

sql创建用户、表空间.doc

发布:2018-05-04约2.52千字共3页下载文档
文本预览下载声明
创建用户、指定默认表空间 和临时空间 create user cs identified by cs default tablespace test temporary tablespace temp cs 用户名; identified by cs 密码 default tabliespace 默认表空间 temporary tablespace 临时表空间 alter user hillary identified by cc 修改 用户密码 删除表空间的操作 一个用户要删除数据库的表空间,首先该用户要具备drop tablespace的权限 在当前用户下执行以下语句来查询确认 select a2.username,a1.privilege from dba_sys_privs a1 , user_role_privs a2 where a1.privilege = DROP TABLESPACE and a1.grantee =a2.granted_role drop?tablespace?空间名?including?contents?and?datafiles? //创建空间 ? create?tablespace?test ? datafile?c:\oracle\oradata\orcl9\test.dbf?size?50M ? default?storage?(initial?500K? ? Next?500K ? minextents?1 ? maxextents?unlimited ? pctincrease?0);? //Oracle创建用户权限 //创建用户 ? create?user?lxg?identified?by?lxg?default?tablespace?test; ? //授权  ? grant?resource,connect,dba?to?test;?(多个系统权限用逗号分开) 删除用户 drop?user?lxg?cascade? 增加表空间 alter?tablespace?chinawater?add?datafile?c:\oracle\oradata\orcl9\ADDCHINAWATER.dbf?size?200M? 创建用户 create?user?userName?identified?by?password;? 创建用户 userName,密码为 password 2 给用户授权 grant?dba?to?lxg;--授予DBA权限 ? grant?unlimited?tablespace?to?lxg;--授予不限制的表空间 ? grant?select?any?table?to?lxg;--授予查询任何表 ? grant?select?any?dictionary?to?lxg;--授予?查询?任何字典? grant create session to lxg;--授予 登录权限 alter user lxg account unlock – 解锁用户 alter user lxg account lock -- 锁定用户 1.查看所有用户 ? ?select * from dba_users; ? ?select * from all_users; ? ?select * from user_users;//当前 ? ?查看所有的表空间 ? ??select * from dba_tablespaces; ? ??select * from user_tablespaces; 3.查看用户表空间使用情况 ????select a.file_id FileNo, ? ? ? ?a.tablespace_name Tablespace_name, ? ? ? ?a.bytes Bytes, ? ? ? ?a.bytes - sum(nvl(b.bytes, 0)) Used, ? ? ? ?sum(nvl(b.bytes, 0)) Free, ? ? ? ?sum(nvl(b.bytes, 0)) / a.bytes * 100 %free ????from dba_data_files a, dba_free_space b ????where a.file_id = b.file_id(+) ????group by a.tablespace_name, a.file_id, a.bytes ????order by a.tablespace_name; 4.查看用户系统权限 ? ? select * from dba_sys_privs; ? ? select * from all_sys_privs; ? ? select *
显示全部
相似文档