zoukankan      html  css  js  c++  java
  • 存储管理

    查询预定义表空间:

    SQL> select TABLESPACE_NAME,CONTENTS from dba_tablespaces;

    SQL> select FILE_NAME, TABLESPACE_NAME from dba_data_files;

    创建新表空间:

    SQL> create tablespace tbs01 datafile '/u01/app/oracle/oradata/orcl/tbs01.dbf' SIZE 10M AUTOEXTEND ON NEXT 10M MAXSIZE 100M;

    在指定的表空间中创建表:

    SQL> create table t1 tablespace tbs01 as select * from dba_objects where 1=0;

    SQL> select bytes, blocks, extents, tablespace_name from dba_segments where segment_name='T1';

    SQL> insert into t1 select * from dba_objects;

    SQL> select bytes, blocks, extents, tablespace_name from dba_segments where segment_name='T1';

    SQL> select extent_id, bytes, blocks from dba_extents where segment_name='T1';

    SQL> insert into t1 select * from t1;

    SQL> insert into t1 select * from t1;

    SQL> insert into t1 select * from t1;

    SQL> select bytes, blocks, extents, tablespace_name from dba_segments where segment_name='T1';

    SQL> select extent_id, bytes, blocks from dba_extents where segment_name='T1';

    SQL> insert into t1 select * from t1; 空间不足,报错

    SQL> rollback;

    SQL> select bytes, blocks, extents, tablespace_name from dba_segments where segment_name='T1'; 空间不释放

    SQL> alter table t1 move; 释放空间

    只读表空间:

    SQL> alter tablespace tbs01 read only;

    SQL> delete t1; 禁止dml

    SQL> insert into t1 select * from t1; 禁止dml

    SQL> update t1 set x=1; 失败

     

    SQL> create table t2 (x int) tablespace tbs01; 失败

    SQL> alter table t1 add (x int); 成功

    SQL> drop table t1; 成功

    dml和ddl的区别

     

    改变表空间大小:

    resize,直接调整数据文件大小(推荐)

    autoextend,自动扩展

    add datafile添加数据文件 后期添加的话会自动负载均衡

     

    删除表空间:

    SQL> drop tablespace tbs01 including contents and datafiles;

  • 相关阅读:
    C#和Modbus通信工程
    C#中JS和Flash中AS 3.0通信交互
    创建型-建造者模式(Builder)
    结构型-享元模式(Flyweight)
    行为型-模板方法模式(Template Method)
    创建型-原型模式(Prototype)
    行为型-状态模式(State)
    结构型-桥接模式(Bridge)
    行为型-中介者模式(Mediator)
    行为型-备忘录模式(Memento)
  • 原文地址:https://www.cnblogs.com/shan2017/p/7367381.html
Copyright © 2011-2022 走看看