After a long time to learn to create an Oracle tablespace, so share with you, after reading this article you certainly have a lot of gains, hope this article can teach you more things.
1. Query the free space first
- Select Tablespace_name,file_id,block_id,bytes,blocks from Dba_free_space;
2. Increase the Oracle table space
First, query the data file name, size and path information, the following statement:
- Select Tablespace_name,file_id,bytes,file_name from Dba_data_files;
3. Modify the file size statement as follows
- ALTER DATABASE DataFile
- ' Need to add a path to the data file, which is the path queried above
- ' Resize 800M;
4. Create Oracle Tablespace
- 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 is not limited in size
- 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 that the size of the zone is the same, default is 1M
- 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 500K indicates that the area is the same sized as 500K
- 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 size of the area is changed automatically with the size of the table, large table uses the large Area small table to use the cell
- Create Tablespace Sales
- DataFile '/home/app/oracle/oradata/oracle8i/sales01.dbf ' size 800M
- Autoextend on
- Next 50M
- MaxSize 1000M
- temporary;
- Temporary creating a dictionary management Temp table space
- Create temporary tablespace sales
- Tempfile '/home/app/oracle/oradata/oracle8i/sales01.dbf ' size 800M
- Autoextend on
- Next 50M
- MaxSize 1000M
- Creates a local administrative temporary tablespace, and if it is a temporary tablespace, datafile in all statements is changed to Tempfile
- 8i system default Create dictionary manage temporary tablespace to create local manage temporary tablespace add temporary tablespace keyword
- You must not use the Atuoallocate parameter when creating a local administrative temporary tablespace, and the system creates uniform management by default
- To add a data file to the tablespace:
- Alter TABLESPACE sales Add
- DataFile '/home/app/oracle/oradata/oracle8i/sales02.dbf ' size 800M
- Autoextend on Next 50M
- MaxSize 1000M;
Create a locally managed temporary Oracle Tablespace, if it is a temporary tablespace, all statements in DataFile are replaced by the tempfile8i system by default to create a dictionary management temporary tablespace, to create a local administrative temporary tablespace to add temporary tablespace keyword When creating a local administrative temporary tablespace, you must not use the Atuoallocate parameter, the system creates uniform management by default
To add a data file to the tablespace:
- Alter TABLESPACE sales Add
- DataFile '/home/app/oracle/oradata/oracle8i/sales02.dbf ' size 800M
- Autoextend on Next 50M
- MaxSize 1000M;
5. Change Auto-extended properties:
- 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;
The above introduction to create an Oracle tablespace, here to share with you, hope to be useful to everyone.