After a long period of learning to create Oracle tablespaces, I would like to share with you that you will certainly have a lot of gains after reading this article. I hope this article will teach you more things.
1. First query free space
1 |
select tablespace_name,file_id,block_id,bytes,blocks
from dba_free_space; |
2. Add Oracle tablespace
First, query the data file name, size, and path information. The statement is as follows:
1 |
select tablespace_name,file_id,bytes,file_name
from dba_data_files; |
3. The statement for modifying the file size is as follows:
123 |
alter database datafile 'The path of the data file to be added, that is, the path found above ' resize 800M; |
4. Create an oracle tablespace
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960 |
create tablespace test datafile '/home/app/oracle/oradata/oracle8i/test01.dbf'
size 8M autoextend on next 5M maxsize 10M; create tablespace sales datafile '/home/app/oracle/oradata/oracle8i/sales01.dbf'
size 800M autoextend on next 50M maxsize unlimited Maxsize Unlimited Yes. The size is unrestricted. create tablespace sales datafile '/home/app/oracle/oradata/oracle8i/sales01.dbf'
size 800M autoextend on next 50M maxsize 1000M extent management local uniform; Unform indicates the same partition size. The default value is 1 m. create tablespace sales datafile '/home/app/oracle/oradata/oracle8i/sales01.dbf'
size 800M autoextend on next 50M maxsize 1000M extent management local uniform
size 500K; unform size
500 k indicates the same partition size, which is K create tablespace sales datafile '/home/app/oracle/oradata/oracle8i/sales01.dbf'
size 800M autoextend on next 50M maxsize 1000M extent management local autoallocate; Autoallocate indicates that the partition size changes automatically and dynamically with the table size. Large tables use small tables in large regions and small tables use cells. create tablespace sales datafile '/home/app/oracle/oradata/oracle8i/sales01.dbf'
size 800M autoextend on next 50M maxsize 1000M temporary ; temporary Create a dictionary to manage temporary tablespace create temporary tablespace sales tempfile '/home/app/oracle/oradata/oracle8i/sales01.dbf'
size 800M autoextend on next 50M maxsize 1000M Create a temporary tablespace for local management. If it is a temporary tablespace, replace datafile in all statements with tempfile. By default, the 8i system creates a temporary tablespace for dictionary management. To create a temporary tablespace for local management, add temporary Tablespace keyword Do not use the atuoallocate parameter when creating local temporary tablespace management. The system creates the uniform management mode by default. Add data files to the tablespace: alter tablespace sales add datafile '/home/app/oracle/oradata/oracle8i/sales02.dbf'
size 800M autoextend on
next 50M maxsize 1000M; |
Create
Create a local temporary Oracle tablespace. If it is a temporary tablespace, replace the datafile in all statements with the tempfile8i system, and create a dictionary to manage the temporary tablespace.
Add temporary to the temporary tablespace for local management
The atuoallocate parameter cannot be used when the tablespace keyword is used to create a temporary tablespace for local management. The system creates the uniform management mode by default.
Add data files to the tablespace:
1234 |
alter tablespace sales add datafile '/home/app/oracle/oradata/oracle8i/sales02.dbf'
size 800M autoextend on
next 50M maxsize 1000M; |
5. Modify auto scaling attributes:
12345 |
alter database datafile '/home/app/oracle/oradata/oracle8i/sales01.dbf' , '/home/app/oracle/oradata/oracle8i/sales02.dbf' '/home/app/oracle/oradata/oracle8i/sales01.dbf autoextend off ; |
6. delete a tablespace:
1 |
drop tablespace xxx including contents and
datafiles |
The preceding section describes how to create an oracle tablespace. Here we will share it with you and hope it will be useful to you.