当前位置:网站首页>5. Oracle tablespace

5. Oracle tablespace

2022-07-05 06:22:00 Cold leaves elegant_

  1. Create a table space that is automatically partitioned under local management USERTBS1, The corresponding data file is 20m
create tablespace usertbs1 datafile 'D:\app\Snakewood\oradata\orcl\usertbs1.dbf' size 20m;

 Insert picture description here

  1. Create a table space under local management mode USERTBS2, The size of each partition is 512K
create tablespace usertbs2 datafile 'D:\app\Snakewood\oradata\mydba\usertbs2.dbf' size 20m extent management local uniform size 512k;

 Insert picture description here

  1. modify USERTBS1 Table space size , Change the data file of the table space to automatic expansion , Maximum 100M
alter database datafile 'D:\app\Snakewood\oradata\mydba\usertbs1.dbf' autoextend on next 5m maxsize 100m;

 Insert picture description here

  1. by USERTBS2 Add a data file to the table space , size 20M
alter tablespace usertbs2 add datafile 'D:\app\Snakewood\oradata\mydba\usertbs2_1.dbf' size 20m;

 Insert picture description here

  1. Create a temporary table space TEMPTBS1, And set it as the default temporary table space of the database
create temporary tablespace temptbs1 tempfile 'D:\app\Snakewood\oradata\mydba\ temptbs1_1.dbf' size 20m extent management local uniform size 16m;
alter database default temporary tablespace temptbs1;

 Insert picture description here

  1. Use SQL Command to USERTBS1 Tablespaces perform online and offline state transitions
Alter tablespace USERTBS1 offline;
Alter tablespace USERTBS1 online;

 Insert picture description here

  1. Create a SC surface (SNO,CNO,GRADE), increase tablespace users Words and expressions , And then USERS The tablespace is set to read-only , Try to SC Add a record to the table
create table SC (  
  SNO    varchar2(20)  primary key,  
  CNO    varchar2(20) not null,  
  GRADE  number(3)  not null
)
tablespace users;
alter tablespace users read only;
 
insert into SC values (‘B201801’,’C0101’,98);

 Insert picture description here
 Insert picture description here

  1. Create a rollback table space UNDOTBS2, And as the undo tablespace of the database
create undo tablespace UNDOTBS2 datafile ‘D:\app\Snakewood\oradata\mydba\ UNDOTBS2_1.DBF’ size 20m;

 Insert picture description here

  1. take USERTBS1 Tablespace renamed to USERTBS01
alter tablespace USERTBS1 rename to USERTBS01;

 Insert picture description here

  1. Delete tablespace USERTBS2, Delete the contents and data files of the table space at the same time
drop tablespace USERTBS2 including contents and datafiles;

 Insert picture description here

原网站

版权声明
本文为[Cold leaves elegant_]所创,转载请带上原文链接,感谢
https://yzsam.com/2022/186/202207050620029629.html