当前位置:网站首页>Oracle tablespace management
Oracle tablespace management
2022-07-05 20:11:00 【Mr. Li, a genius】
Everything is inferior 、 Only reading is high
Articles are constantly updated , You can search by wechat 【 Xiaoqi JAVA interview 】 First time reading , reply 【 Information 】 Access to benefits , reply 【 project 】 Get the source code of the project , reply 【 The resume template 】 Get resume template , reply 【 Learning Roadmap 】 Get a learning roadmap .

List of articles
- One 、 Overview of table spaces
- Two 、 The creation of a table space
- 3、 ... and 、 Table space maintenance
- 1、 Set the default tablespace
- 2、 Rename a table space
- 3、 Modify the state of the table space
- 4、 Modify the size of the data file corresponding to the table space
- 5、 Increase the data space of the table
- 6、 Delete the data file of the tablespace
- 7、 Modify the data file to auto extend
- 8、 Modify the name or location of the data file
- 9、 Backup of table space
- 10、 Delete tablespace
- Four 、 Table space query
- 5、 ... and 、 summary
One 、 Overview of table spaces
In order to facilitate the management and optimization of the database ,oracle The database is divided into logical areas of many table spaces , One oracle The database has one or more tablespaces , A tablespace corresponds to one or more physical database files . Tablespaces and data files are closely linked , interdependence , Create data files while creating table spaces , Empathy , When adding data files, you should also specify the table space . The database is physically determined by the size and number of data files , Logically, it is determined by the size and number of table spaces .
Table space is the basic method of data management , All user objects are placed in a tablespace , That is, users can create user objects only when they have the right to use the space , Otherwise, it is not allowed to create objects . While creating the tablespace , It is necessary to reasonably plan the storage settings of the table space , Allocate storage space of appropriate size .
1、 Table space properties
1、 type
2、 Management style
3、 Different matching methods
4、 Section management mode
2、 Type of tablespace
1、 Permanent table space
By default, both the system table space and the table space used by ordinary users are permanent table spaces .
2、 Temporary table space
Usually used to store sql Statement processing table and index information , Its space does not store actual data .
3、 Undo tablespace
This type is mainly used for transaction rollback , Provide read consistency . The database can have multiple drop table spaces at the same time , But only one undo tablespace can be activated at any time .
4、 Large file table space
Large file tablespaces are stored in a single data file , A single data file can be up to 128TB.
3、 The state of the table space
1、 Online status
Data can only be online , To access the data .
2、 Read write status
By default, all table spaces are read-write , Users with appropriate permissions can read and write the data of the table space .
3、 Read only status
The table space is read-only, which means that users can only read the data in the table space , You cannot modify the data of a tablespace .
4、 Offline
If a table space is set to offline state , It means that users cannot access the table space temporarily .
Two 、 The creation of a table space
In actual database tablespace management , According to the specific application , Create different types of table spaces , For example, the table space used for storing table data , Table space dedicated to storing indexes, etc .
1、 Table space creation syntax
create tablespace tablespace_name
datafile file_name datafile_options
storage_options
among :tablespace_name Name the tablespace to be created ,file_name Is the name of the corresponding data file ,datafile_options Is the data file option ,Storage_options Is the storage structure option .
2、 Create a permanent table space , Set the initial size of the table space to 100MB, Automatically expand to 100MB, No maximum size limit , And the table space is online , Generate log
create tablespace tspace 1 datafile 'c:\oracle\tspace1.dbf' size 100m
autoextend on next 100m maxsize unlimited logging online permanent;
3、 ... and 、 Table space maintenance
1、 Set the default tablespace
Create a new user , If you do not specify a tablespace , The default permanent table space is system, The default temporary table space is temp, So if there are multiple users , Then all users should compete to use system and temp Table space , It will greatly affect oracle The efficiency of the system , The database administrator can modify the default permanent table space and temporary table space , The basic syntax is as follows .
alter database default [temporary] tablespace New tablespace name
Case study : Put the temporary table space tspace4 Change to the default temporary table space
alter database default temporary tablespace tspace4;
Case study : hold tspace3 Change to the default permanent table space .
alter database default tablespace tspace3;
2、 Rename a table space
Case study : Set the table space tspace3 It is amended as follows tspace3_1
alter tablespace tspace3 renatspaceme to tspace3_1;
3、 Modify the state of the table space
modify tspace Is online
alter tablespace tspace online;
Set tablespace tspace Is offline
alter tablespace tspace offline;
Set tablespace tspace Is read-only
alter tablespace tspace read only;
Set tablespace tspace In read-write status .
alter tablespace tspace read write;
4、 Modify the size of the data file corresponding to the table space
The grammar is as follows
alter database datafile Data files resize New file size
Modify the table space tspace7 One of the corresponding data file sizes
alter database datafile 'c:\oracle\tspace7_1.dbf' resize 100MB;
5、 Increase the data space of the table
alter tablespace Tablespace name add datafile Data files size file size ;
6、 Delete the data file of the tablespace
alter tablespace Tablespace name drop datafile Data file name ;
7、 Modify the data file to auto extend
Set the table space tspace7 The data file of is set to automatic expansion
alter database datafile 'c:\oracle\tspace7_3.dbf' autoextend on next 10MB;
8、 Modify the name or location of the data file
alter tablespace Tablespace name rename datafile Data file name to New data file name
9、 Backup of table space
alter tablespace tspace 1 begin backup;
10、 Delete tablespace
drop tablespace tspace7;
Four 、 Table space query
Query the name of the tablespace 、 The management mode of the district 、 Information such as the management method of segments and table space types .
select tablespace_name,extent_management,allocation_type,contents from dba_tablespaces;
Check the name of the tablespace 、 File and space size
select tablespace_name,file_name,round(bytes/(1024*1024),0) total_space from dba_data_files;
5、 ... and 、 summary
The relevant contents here have not been sorted out yet , The article continues to be updated later , Recommended collection .
The commands involved in the article must be typed several times each like me , Only in the process of knocking can you find out whether you really master the command .
You can search by wechat 【 Xiaoqi JAVA interview 】 First time reading , reply 【 Information 】 Access to benefits , reply 【 project 】 Get the source code of the project , reply 【 The resume template 】 Get resume template , reply 【 Learning Roadmap 】 Get a learning roadmap .
边栏推荐
- selenium 元素信息
- Flume series: interceptor filtering data
- 2023年深圳市绿色低碳产业扶持计划申报指南
- leetcode刷题:二叉树11(平衡二叉树)
- How to safely and quickly migrate from CentOS to openeuler
- Debezium series: record the messages parsed by debezium and the solutions after the MariaDB database deletes multiple temporary tables
- 【数字IC验证快速入门】3、数字IC设计全流程介绍
- . Net distributed transaction and landing solution
- Go language | 01 wsl+vscode environment construction pit avoidance Guide
- Leetcode(347)——前 K 个高频元素
猜你喜欢

Unity编辑器扩展 UI控件篇

Leetcode brush questions: binary tree 11 (balanced binary tree)

ROS2专题【01】:win10上安装ROS2

2023年深圳市绿色低碳产业扶持计划申报指南

浅浅的谈一下ThreadLocalInsecureRandom

Base du réseau neuronal de convolution d'apprentissage profond (CNN)

14. Users, groups, and permissions (14)

S7-200smart uses V90 Modbus communication control library to control the specific methods and steps of V90 servo

Fundamentals of deep learning convolutional neural network (CNN)

走入并行的世界
随机推荐
Rainbond 5.7.1 支持对接多家公有云和集群异常报警
Fundamentals of deep learning convolutional neural network (CNN)
618 "low key" curtain call, how can baiqiushangmei join hands with the brand to cross the "uncertain era"?
USACO3.4 “破锣摇滚”乐队 Raucous Rockers - DP
14. Users, groups, and permissions (14)
The difference between ID selector and class selector
Debezium series: record the messages parsed by debezium and the solutions after the MariaDB database deletes multiple temporary tables
[C language] string function and Simulation Implementation strlen & strcpy & strcat & StrCmp
【数字IC验证快速入门】9、Verilog RTL设计必会的有限状态机(FSM)
Process file and directory names
Leetcode brush question: binary tree 14 (sum of left leaves)
浅浅的谈一下ThreadLocalInsecureRandom
.Net分布式事务及落地解决方案
Wechat applet regular expression extraction link
国信证券在网上开户安全吗?
Go language | 01 wsl+vscode environment construction pit avoidance Guide
1: Citation;
基金网上开户安全吗?去哪里开,可以拿到低佣金?
[quick start of Digital IC Verification] 3. Introduction to the whole process of Digital IC Design
Wildcard selector