Oracle ORA-01653:unable to extend table tabeName by 8192 i tablespace

Recently insert more than 5,000 ten thousand questions data reproducibility of the test environment to the environment with PL / SQL. Problems encountered during insertion as follows:

ORA-01653: unable to extend table table_space.table_name by 128 in tablespace 

Probably it means that the lack of table_space table space, this problem there are two cases: one is the automatic extension table space is not open; the other is really not enough space, has reached the upper limit is automatically extended.
So the steps we solve the problem is to first check the Oracle database table space, and then look at the automatic extension of all the data files in the table space is open; if indeed the table space is not enough, then we need to expand the table space for the .
Specific steps are as follows:

  1. Execute the following SQL statement in PL / SQL:
 SELECT a.tablespace_name "表空间名",
a.bytes / 1024 / 1024 "表空间大小(M)",
(a.bytes - b.bytes) / 1024 / 1024 "已使用空间(M)",
b.bytes / 1024 / 1024 "空闲空间(M)",
round(((a.bytes - b.bytes) / a.bytes) * 100, 2) "使用比"
FROM (SELECT tablespace_name, sum(bytes) bytes
FROM dba_data_files
GROUP BY tablespace_name) a,
(SELECT tablespace_name, sum(bytes) bytes, max(bytes) largest
FROM dba_free_space
GROUP BY tablespace_name) b
WHERE a.tablespace_name = b.tablespace_name
ORDER BY ((a.bytes - b.bytes) / a.bytes) DESC

"Table space (M)" means that all the table space data files in total in the operating system disk space occupied size;
for example: USER_DATA table space has two data files, datafile1 to 300MB, datafile2 is 400MB, then USER_DATA table space " table space size "is 700MB.
"Used space (M)" indicates the number of table space has been used;
"free space (M)" indicates how much remaining space table;
"using ratio" means the percentage that has been used;
2. such as viewing from step 1 to the table table_space the percentage of space has been used more than 90%, you can view the table space for a total of several data files, whether each data file automatically extended, automatically extend the maximum.

 SELECT file_name,
tablespace_name,
bytes / 1024 / 1024 "bytes MB",
maxbytes / 1024 / 1024 "maxbytes MB"
FROM dba_data_files
WHERE tablespace_name = 'table_space';

3. Check whether MSMS table space is automatically extended:

 SELECT file_id, file_name, tablespace_name, autoextensible, increment_by
FROM dba_data_files
WHERE tablespace_name = 'USER_DATA'
ORDER BY file_id desc;

View "autoextensible" corresponding value is YES or NO, if NO, explain automatic extensions MSMS table space is not open, changed to YES on it.
MSMS table space such as the current size of 0.9GB, but the maximum for each data file is only 1GB, the data file is about full, then we need to expand the table space.
Expansion of table space is divided into two ways: one is to increase the size of data files; one is to increase the number of data files.
3.1 First, find out the path of the data file and table space corresponding

 SELECT * FROM dba_data_files t WHERE t.tablespace_name='表空间名称';

- find the full path of the data file corresponding to the space table, corresponding to the path FILE_NAME field.
3.2 Solution one: to increase the data file:

 alter database datafile '全路径的数据文件名称' resize ***M;

- increase the size of a data file corresponding to the table space inside *** M.
3.3 Solution two: Increase the data file
gets created table space statement:

 SELECT dbms_metadata.get_ddl('TABLESPACE', 'table_space') FROM dual;

3.3.1 confirm adequate disk space, add a data file using the df command to check [Linux]

 alter tablespace 表空间名称 add datafile '全路径的数据文件名称' size ***M
autoextend on maxsize 20G;

- Added a data file, the full path of the data file name for the new full path of the file name of the data file. Size *** M, extensions automatically opens, and the maximum extension of the data file is 20G.
3.3.2 Verify that the increase of data files:

 SELECT file_name, file_id, tablespace_name
FROM dba_data_files
WHERE tablespace_name = '表空间名称'

3.3.4 If you delete the table space data file:

 altertablespace 表空间名称
DROP datafile '数据文件的全路径/数据文件名.dbf '

PS: Table space is generally allow idle percentage remained above 10%, and the data file size should not exceed 2G. When the table is insufficient space, either resieze datafile, or increase datafile.
Transfer: http://blog.sina.com.cn/s/blog_9d4799c701017pw1.html

Published 46 original articles · won praise 13 · views 60000 +

Guess you like

Origin blog.csdn.net/luliuliu1234/article/details/83066121