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切换表空间(原内容:目标内容)

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值