zoukankan      html  css  js  c++  java
  • oracle数据库表空间扩容方法

    1. 先查询表空间在物理磁盘上存放的位置,注意使用sysdba的账号登陆。

    SELECT tablespace_name, 
    file_id, 
    file_name, 
    round(bytes / (1024 * 1024), 0) total_space 
    FROM dba_data_files 
    ORDER BY tablespace_name; 

    2. 需要扩容的表空间是DW_STG_TBS,目前的文件分配序号是DW_STG_TBS20.dbf,

        所以在接下来的要增加的文件的名称从21开始,我们一次行增加20个文件,脚本如下。

        其中设置的每个文件初始分配空间为7g, autoextend on为自动增长大小,oracle单个文件大小最大不超过32g.

    --增加Stage层表空间
    alter tablespace DW_STG_TBS
    add datafile  '/u01/app/oracle/oradata/crm001/DW_STG_TBS21.dbf' size 7167M autoextend on ;
    alter tablespace DW_STG_TBS
    add datafile  '/u01/app/oracle/oradata/crm001/DW_STG_TBS22.dbf' size 7167M autoextend on ;
    alter tablespace DW_STG_TBS
    add datafile  '/u01/app/oracle/oradata/crm001/DW_STG_TBS23.dbf' size 7167M autoextend on ;
    alter tablespace DW_STG_TBS
    add datafile  '/u01/app/oracle/oradata/crm001/DW_STG_TBS24.dbf' size 7167M autoextend on ;
    alter tablespace DW_STG_TBS
    add datafile  '/u01/app/oracle/oradata/crm001/DW_STG_TBS25.dbf' size 7167M autoextend on ;
    alter tablespace DW_STG_TBS
    add datafile  '/u01/app/oracle/oradata/crm001/DW_STG_TBS26.dbf' size 7167M autoextend on ;
    alter tablespace DW_STG_TBS
    add datafile  '/u01/app/oracle/oradata/crm001/DW_STG_TBS27.dbf' size 7167M autoextend on ;
    alter tablespace DW_STG_TBS
    add datafile  '/u01/app/oracle/oradata/crm001/DW_STG_TBS28.dbf' size 7167M autoextend on ;
    alter tablespace DW_STG_TBS
    add datafile  '/u01/app/oracle/oradata/crm001/DW_STG_TBS29.dbf' size 7167M autoextend on ;
    alter tablespace DW_STG_TBS
    add datafile  '/u01/app/oracle/oradata/crm001/DW_STG_TBS30.dbf' size 7167M autoextend on ;
    alter tablespace DW_STG_TBS
    add datafile  '/u01/app/oracle/oradata/crm001/DW_STG_TBS31.dbf' size 7167M autoextend on ;
    alter tablespace DW_STG_TBS
    add datafile  '/u01/app/oracle/oradata/crm001/DW_STG_TBS32.dbf' size 7167M autoextend on ;
    alter tablespace DW_STG_TBS
    add datafile  '/u01/app/oracle/oradata/crm001/DW_STG_TBS33.dbf' size 7167M autoextend on ;
    alter tablespace DW_STG_TBS
    add datafile  '/u01/app/oracle/oradata/crm001/DW_STG_TBS34.dbf' size 7167M autoextend on ;
    alter tablespace DW_STG_TBS
    add datafile  '/u01/app/oracle/oradata/crm001/DW_STG_TBS35.dbf' size 7167M autoextend on ;
    alter tablespace DW_STG_TBS
    add datafile  '/u01/app/oracle/oradata/crm001/DW_STG_TBS36.dbf' size 7167M autoextend on ;
    alter tablespace DW_STG_TBS
    add datafile  '/u01/app/oracle/oradata/crm001/DW_STG_TBS37.dbf' size 7167M autoextend on ;
    alter tablespace DW_STG_TBS
    add datafile  '/u01/app/oracle/oradata/crm001/DW_STG_TBS38.dbf' size 7167M autoextend on ;
    alter tablespace DW_STG_TBS
    add datafile  '/u01/app/oracle/oradata/crm001/DW_STG_TBS39.dbf' size 7167M autoextend on ;
    alter tablespace DW_STG_TBS
    add datafile  '/u01/app/oracle/oradata/crm001/DW_STG_TBS40.dbf' size 7167M autoextend on ;

    3. 将以上SQL在PL/SQL中执行,完成后查询结果如下:

    4. 使用本博客中另外一篇文章[ORACLE数据库存储空间使用情况查询]中的SQL语句查询表空间大小

  • 相关阅读:
    kafka 幂等生产者及事务(kafka0.11之后版本新特性)
    git 忽略 .idea文件
    Java Scala 混合编程导致 编译失败 ,【找不到符号】问题解决
    Starting sshd: /var/empty/sshd must be owned by root and not group or world-writable.
    Spark RDD持久化、广播变量和累加器
    PSQLException: FATAL: no pg_hba.conf entry for host "127.0.0.1", user "ambari", database "ambari", SSL off
    PostgreSQL:Java使用CopyManager实现客户端文件COPY导入
    ThreadLocal的使用及原理分析
    gradlew和gradle的区别
    Managing Large State in Apache Flink®: An Intro to Incremental Checkpointing
  • 原文地址:https://www.cnblogs.com/30go/p/5853824.html
Copyright © 2011-2022 走看看