当前位置: 代码迷 >> SQL >> 透过SQL管理表空间、用户、授权
  详细解决方案

透过SQL管理表空间、用户、授权

热度:76   发布时间:2016-05-05 12:15:03.0
通过SQL管理表空间、用户、授权
--创建表空间CREATE TABLESPACE CRMDBDATAFILE '/opt/oracle/app/oradata/testdb/crm.dbf' SIZE 500MAUTOEXTEND ON NEXT 100M;--创建用户create  user  CRM  identified   by   password  default   tablespace  CRMDB;--给用户赋权限grant  dba  to  CRM;---删除用户及数据drop user CRM cascade;--修改用户密码alter user sys identified by system;--查看表空间使用情况select a.tablespace_name,       a.bytes / 1024 / 1024 "Sum MB",       (a.bytes - b.bytes) / 1024 / 1024 "used MB",       b.bytes / 1024 / 1024 "free MB",       round(((a.bytes - b.bytes) / a.bytes) * 100, 2) "percent_used"  from (select tablespace_name, sum(bytes) bytes          from dba_data_files         group by tablespace_name) a,       (select tablespace_name, sum(bytes) bytes, max(bytes) largest          from dba_free_space         group by tablespace_name) b where a.tablespace_name = b.tablespace_name order by ((a.bytes - b.bytes) / a.bytes) desc --查看表空间文件地址select name from v$datafile;

?

  相关解决方案