Table of Contents:
  1. 表空间的分类
    1. 表空间的操作

      Oracle基础-表空间

      Reading Time:The full text has 387 words, estimated reading time: 2 minutes
      Creation Date:2017-07-21
      Article Tags:
      Previous Article:Oracle基础-数据表
      Next Article:Oracle数据类型
       
      BEGIN

      表空间的分类

      1. 永久表空间:表,视图,存储过程
      2. 临时表空间:数据库操作过程中的中间执行的过程,执行完后会被释放掉
      3. Undo表空间:保存数据表修改前的信息储存。

      表空间的操作

      1. 创建表空间:create tablespace ts_name datafile 'D:\oracle\data\firstspace.dbf' size 20M autoextend on next 5M maxsize 500M;创建名为firstspace的表空间,文件名及路径为D:\oracle\data\firstspace.dbf,初始大小为20M,开启自动拓展,每次加5M,最大上限为500M。
      2. 查看表空间名及路径:select ts_name, file_name from dba_data_files;
      3. 查看用户信息:select user_id,username,default_tablespace from dba_users order by username;
      4. 修改默认表空间为firstspace:alter database default tablespace ts_name;此时默认表空间为firstspace而不是users。
      5. 更改表空间名称:alter tablespace ts_name rename to username;此时表空间名firstspace改为username。
      6. 创建用户:create user ct identified by ct123? default tablespace users temporary tablespace temp;创建用户ct,密码为ct123?,默认表空间为users,临时表空间为temp。
      7. 用户表空间的数据字典,dba_tablespaces、user_tablespaces和dba_users、user_users
      8. 设置表空间的脱机的状态:alter tablespace ts_name offline;
      9. 设置表空间的联机状态:alter tablespace ts_name online;
      10. 修改表空间为只读状态:alter tablespace ts_name read only;
      11. 修改表空间为读写状态:alter tablespace ts_name read write;
      12. 表空间增加数据文件:alter tablespace ts_name add datafile '/path/xxx.dbf' size 20M;
      13. 表空间删除数据文件:alter tablespace ts_name drop datafile '/path/xxx.dbf';
      14. 仅删除表空间:drop tablespace ts_name;
      15. 删除表空间并同时删除对应表空间下的所有内容及文件:drop tablespace ts_name including contents and datafiles;
      FINISH
      Previous Article:Oracle基础-数据表
      Next Article:Oracle数据类型

      Random Articles
      Life Countdown
      default