• oracle 表空间相关介绍及操作


    创建表空间

    CREATE TABLESPACE gbcx DATAFILE ‘D:\oracle_db\product\11.2.0\sjjgpt\GBCX.dbf’ SIZE 10M AUTOEXTEND ON NEXT 20M MAXSIZE
    UNLIMITED EXTENT MANAGEMENT LOCAL SEGMENT SPACE MANAGEMENT AUTO ;

    创建用户

    – Create the user
    create user GBCX
    default tablespace GBCX
    temporary tablespace TEMP
    profile DEFAULT
    password expire
    quota unlimited on gbcx;
    – Grant/Revoke role privileges
    grant connect to GBCX with admin option;
    grant dba to GBCX with admin option;
    grant resource to GBCX with admin option;
    – Grant/Revoke system privileges
    grant select any table to GBCX with admin option;
    grant under any table to GBCX with admin option;
    grant unlimited tablespace to GBCX with admin option;

    注意:创建用户需要和表空间指定起来

    表空间达到上限后怎么扩展

    alter tablespace bdcdj_platform_mul add datafile ‘D:\app\Administrator\oradata\orcl-mul\BDCDJ_PLATFORM_MUL2.DBF’ size 1g autoextend on next 1g maxsize 30g;

    注意:新增的数据空间的名字不能和之前已存在的一致

    表空间为什么最大是32g

    oracle的rowid是使用22位来代表数据块号,因此一个oracle数据文件最多能包含2^22个数据块。

    查看数据块:select value/1024 as “kb” from v$parameter where name=‘db_block_size’

    在这里插入图片描述

    所以,一个表空间的最大值也就是【8*2^22=32g】

    imp 方式导入

    imp bdcdj/123456@LAPTOP-JDDABCUQ/orcl file=E:\oraclebackup\bdcdj.dmp tablespaces=bdcdj full=y;

    说明:
    1、file是dmp文件的绝对路径
    2、tablespaces可以指定导入到的表空间

    impdp 方式导入

    impdp bdcdj_platform_mul/gtis@GTMAP510RT/orcl dumpfile=BDCDJ_PLATFORM20221104.DMP DIRECTORY=data_pump_dir remap_schema=bdcdj_platform:bdcdj_platform_mul remap_tablespace=bdcdj_platform:bdcdj_platform_mul

    说明:
    1、directory是文档,需要将dumpfile的文件放入该路径下
    2、查询文档路径:select * from dba_directories

    在这里插入图片描述

    因此根据此处配置的 data_pump_dir 的目录来看,就需要将 dmp 文件放入到 D:\app\Administrator/admin/orcl/dpdump/ 目录下

    3、通过remap_schema切换用户,通过remap_tablespace切换表空间(原内容:目标内容)

  • 相关阅读:
    如何获得淘宝/天猫app商品详情原数据API数据
    D. Districts Connection
    golang中使用泛型
    Leetcode 2336. Smallest Number in Infinite Set [Python]
    pyclipper和ClipperLib操作多边型
    英语——方法篇——单词——谐音法+拼音法——50个单词记忆
    vue3中自定义Ref
    【OpenCV-Python】教程:3-15 分水岭图像分割
    npm install 报错常见的解决方法
    面向对象编程原则
  • 原文地址:https://blog.csdn.net/qq_38152400/article/details/127880674