zoukankan      html  css  js  c++  java
  • 建Oracle表空间,指定用户默认表空间,增加数据文件

    建Oracle表空间,指定用户默认表空间,增加数据文件的步骤

    经过长时间学习创建Oracle表空间,于是和大家分享一下,看完本文你肯定有不少收获,希望本文能教会你更多东西。

    sqlplus “/as sysdba”

    >create user itmsplus identified by itmsplus default tablespace TBS_MON temporary tablespace TEMP;

    >grant resource to itmsplus;

    >grant connect to itmsplus;


    修改表空间名字:

    oracle10g以前是不支持修改表空间名的,除非重建;
    oracle10g支持在线更改,语法很简单:
    SQL> ALTER TABLESPACE tablespacename_old RENAME TO tablespacename_new;

    1、先查询空闲空间

    select tablespace_name,file_id,block_id,bytes,blocks from dba_free_space;

    2、增加Oracle表空间

    先查询数据文件名称、大小和路径的信息,语句如下:

    select tablespace_name,file_id,bytes,file_name from dba_data_files;

    3、修改文件大小语句如下

    alter database datafile   '需要增加的数据文件路径,即上面查询出来的路径 'resize 800M;

    4、创建Oracle表空间

    create tablespace test 

    datafile '/home/app/oracle/oradata/oracle8i/test01.dbf' size 8M 

    autoextend on 

    next 5M 

    maxsize 10M;   

    create tablespace sales 

    datafile '/home/app/oracle/oradata/oracle8i/sales01.dbf' 

    size 800M 

    autoextend on 

    next 50M 

    maxsize unlimited 

    maxsize unlimited 是大小不受限制   

    create tablespace sales 

    datafile '/home/app/oracle/oradata/oracle8i/sales01.dbf' 

    size 800M 

    autoextend on 

    next 50M 

    maxsize 1000M 

    extent management local uniform; unform表示区的大小相同,默认为1M  

    create tablespace sales 

    datafile '/home/app/oracle/oradata/oracle8i/sales01.dbf' 

    size 800M 

    autoextend on 

    next 50M 

    maxsize 1000M 

    extent management local uniform size 500K; unform size 500K表示区的大小相同,为500K   

    create tablespace sales 

    datafile '/home/app/oracle/oradata/oracle8i/sales01.dbf' 

    size 800M 

    autoextend on 

    next 50M 

    maxsize 1000M 

    extent management local autoallocate; autoallocate表示区的大小由随表的大小自动动态改变,大表使用大区小表使用小区   

    create tablespace sales 

    datafile '/home/app/oracle/oradata/oracle8i/sales01.dbf' 

    size 800M 

    autoextend on 

    next 50M 

    maxsize 1000M temporary; temporary创建字典管理临时表空间   

    create temporary tablespace sales tempfile '/home/app/oracle/oradata/oracle8i/sales01.dbf' 

    size 800M 

    autoextend on 

    next 50M 

    maxsize 1000M 

    创建本地管理临时表空间,如果是临时表空间,所有语句中的datafile都换为tempfile   

    8i系统默认创建字典管理临时表空间,要创建本地管理临时表空间要加temporary tablespace关键字 

    创建本地管理临时表空间时,不得使用atuoallocate参数,系统默认创建uniform管理方式   

    为表空间增加数据文件: 

    alter tablespace sales 

    add datafile '/home/app/oracle/oradata/oracle8i/sales02.dbf' 

    size 800M 

    autoextend on 

    next 50M 

    maxsize 1000M; 

    为表空间增加数据文件:

    alter tablespace sales add datafile '/home/app/oracle/oradata/oracle8i/sales02.dbf' size 800M autoextend on next 50M maxsize 1000M;

    5、更改自动扩展属性:

    alter database datafile

    '/home/app/oracle/oradata/oracle8i/sales01.dbf',

    '/home/app/oracle/oradata/oracle8i/sales02.dbf' ,

    '/home/app/oracle/oradata/oracle8i/sales01.dbf

    autoextend off;

    以上介绍创建Oracle表空间,在这里拿出来和大家分享一下,希望对大家有用。


  • 相关阅读:
    有固态硬盘的电脑还是不流畅?这些值得了解
    一名神舟笔记本电脑用户的内心独白
    验证码无法显示:Could not initialize class sun.awt.X11GraphicsEnvironment 解决方案
    nginx 负载均衡时,一台tomcat宕机时的问题 自动切换
    tomcat结合nginx使用小结
    金九银十面试突击,卧底去阿里、京东、美团、腾讯带回来的面试题(内含答案)
    干货分享 ▏Jmeter-场景设置/运行/参数化访问地址/【一次性打包呈现】
    各类APP功能测试用例/设计方法/数据库和日记分析——【范本】
    软件测试这些坑,千万不要踩!
    技术面试中,遇到不会回答的问题怎么破?来,教3招!
  • 原文地址:https://www.cnblogs.com/liuzhuqing/p/7480842.html
Copyright © 2011-2022 走看看