zoukankan      html  css  js  c++  java
  • Oracle数据库表空间常用操作

    1. 查看所有表空间大小

    SQL> select tablespace_name,sum(bytes)/1024/1024 from dba_data_files group by tablespace_name;

    2. 已经使用的表空间大小

    SQL> select tablespace_name,sum(bytes)/1024/1024 from dba_free_space group by tablespace_name;

    3. 所以使用空间可以这样计算

    select a.tablespace_name,total,free,total-free used from ( select tablespace_name,sum(bytes)/1024/1024 total from dba_data_files group by tablespace_name) a, ( select tablespace_name,sum(bytes)/1024/1024 free from dba_free_space group by tablespace_name) b where a.tablespace_name=b.tablespace_name;

    4. 下面这条语句查看所有segment的大小。

    Select Segment_Name,Sum(bytes)/1024/1024 From User_Extents Group By Segment_Name;

    5. 还有在命令行情况下如何将结果放到一个文件里。

    SQL> spool out.txt;

    SQL> select * from v$database;

    SQL> spool off;

    6.扩展表空间

    alter database datafile 'D:oracle10.1.0oradatadyd' resize 4000m

    7.设置表空间文件为自动增长。

    alter database datafile '/home/oracle/ts01.dbf' autoextend on next 5m maxsize unlimited;

    8.为表空间增加数据文件

    alter tablespace tbs1 add datafile '/u01/app/oracle/oradata/orcl/tbs1_3.dbf' size 10m autoextend on;

  • 相关阅读:
    jquery学习
    java--MVC引入JUnit单元测试
    BAE引擎发布到外网
    ORACLE1.26 综合:游标和动态SQL
    ORACLE1.25 动态SQL
    ORACLE1.24 银行系统操作和游标
    ORACLE1.23 loop,whild.for循环
    ORACLE1.23 if case when
    ORACLE1.22 %type %rowtype
    ORACLE1.21 PLSQL 01
  • 原文地址:https://www.cnblogs.com/itzhangxp/p/3723612.html
Copyright © 2011-2022 走看看