linux下表空间相关查询及操作

来源:互联网 发布:linux查看home下用户 编辑:程序博客网 时间:2024/05/18 00:01

/*查询表空间相关信息 */

--查看表空间的名称及大小

select t.tablespace_name,round(sum(bytes/(1024*1024)),0) ts_size

  from dba_tablespaces t, dba_data_files d

where t.tablespace_name = d.tablespace_name

 group by t.tablespace_name;
 
--查看表空间物理文件的名称及大小
select tablespace_name,file_id,file_name,round(bytes/(1024*1024),0) total_space
  from dba_data_files
 order by tablespace_name;

--查询用户表空间文件的绝对路径
select name from v$datafile;


/*linux下 oracle11g 创建用户和表空间分为四步 */
/*第1步:创建临时表空间  可以使用默认的临时表空间 */
create temporary tablespace hpeas_temp tempfile '/u01/oracle/oradata/ora11g/hpeas_temp.dbf' size 50m autoextend on next 50m maxsize 20480m extent management local;

/*第2步:创建数据表空间  */
create tablespace hpeas_data logging datafile '/u01/oracle/oradata/ora11g/hpeas_data.dbf' size 50m autoextend on next 50m maxsize 10240m extent management local;

/*第3步:创建用户并指定表空间  */
create user hpeas identified by hpeas default tablespace hpeas_data temporary tablespace temp;

/*第4步:给用户授予权限  */
grant connect,resource,dba to orcl;
原创粉丝点击