当前位置:网站首页>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 .
边栏推荐
- c语言oj得pe,ACM入门之OJ~
- - Oui. Net Distributed Transaction and Landing Solution
- 零道云新UI设计中
- [C language] merge sort
- 95后阿里P7晒出工资单:狠补了这个,真香...
- Wildcard selector
- [quick start of Digital IC Verification] 3. Introduction to the whole process of Digital IC Design
- 实操演示:产研团队如何高效构建需求工作流?
- JVMRandom不可设置种子|问题追溯|源码追溯
- 深度學習 卷積神經網絡(CNN)基礎
猜你喜欢
基础篇——配置文件解析
Jvmrandom cannot set seeds | problem tracing | source code tracing
Parler de threadlocal insecurerandom
图嵌入Graph embedding学习笔记
Autumn byte interviewer asked you any questions? In fact, you have stepped on thunder
Database logic processing function
Go language | 01 wsl+vscode environment construction pit avoidance Guide
计算lnx的一种方式
【数字IC验证快速入门】8、数字IC中的典型电路及其对应的Verilog描述方法
Debezium series: record the messages parsed by debezium and the solutions after the MariaDB database deletes multiple temporary tables
随机推荐
淺淺的談一下ThreadLocalInsecureRandom
通配符选择器
IC科普文:ECO的那些事儿
处理文件和目录名
C - sequential structure
【数字IC验证快速入门】9、Verilog RTL设计必会的有限状态机(FSM)
1: Citation;
中金财富在网上开户安全吗?
[quick start of Digital IC Verification] 3. Introduction to the whole process of Digital IC Design
sun. misc. Base64encoder error reporting solution [easy to understand]
618 "low key" curtain call, how can baiqiushangmei join hands with the brand to cross the "uncertain era"?
解决php无法将string转换为json的办法
【数字IC验证快速入门】2、通过一个SoC项目实例,了解SoC的架构,初探数字系统设计流程
随机数生成的四种方法|Random|Math|ThreadLocalRandom|SecurityRandom
[C language] string function and Simulation Implementation strlen & strcpy & strcat & StrCmp
Leetcode skimming: binary tree 16 (path sum)
SecureRandom那些事|真伪随机数
港股将迎“最牛十元店“,名创优品能借IPO突围?
Zero cloud new UI design
Securerandom things | true and false random numbers