Two diseases, SYSTEM table space shortage error
First, the diseases:
PLSQL login error:
ORA-00604: error recursive SQL layer appears
ORA-01653: table not by extending (in the table space).
ORA-02002: Error writing audit trail record
Second, pathology:
1, table space shortage
2, database audit function has been turned on to cause (SYS.AUD $ table)
Third, the cause of positioning:
Connect to the database:
The Oracle su # # sqlplus / nolog SQL > conn / AS sysdba // reconnect SQL > the Startup Mount; // pending SQL > the ALTER Database Open ; // open the database
Execute the following SQL, see the table space usage
SELECT UPPER(F.TABLESPACE_NAME) "TABLESPACE_NAME", D.TOT_GROOTTE_MB "TABLESPACE_SIZE(M)", D.TOT_GROOTTE_MB - F.TOTAL_BYTES "TABLESPACE_USED(M)", TO_CHAR (ROUND((D.TOT_GROOTTE_MB - F.TOTAL_BYTES) / D.TOT_GROOTTE_MB * 100,2),'990.99') "TABLESPACE_USED_BI", F.TOTAL_BYTES "TABLESPACE_FREE(M)" FROM (SELECT TABLESPACE_NAME, ROUND(SUM(BYTES) /(1024 * 1024), 2) TOTAL_BYTES, ROUND(MAX(BYTES) /(1024 * 1024), 2) MAX_BYTES FROM SYS.DBA_FREE_SPACE GROUP BY TABLESPACE_NAME) F, (SELECT DD.TABLESPACE_NAME, ROUND(SUM(DD.BYTES) / (1024 * 1024), 2) TOT_GROOTTE_MB FROM SYS.DBA_DATA_FILES DD GROUP BY DD.TABLESPACE_NAME) D WHERE D.TABLESPACE_NAME = F.TABLESPACE_NAME ORDER BY 4 DESC;
SYSTEM table space usage ratio has reached 99.81.
Fourth, the treatment:
Table space is insufficient treatment:
Program: If table space is not self-energizing, self-energizing mode is modified to. (Not suitable for this reason)
First see if the table space increment
SQL > select FILE_NAME,TABLESPACE_NAME,AUTOEXTENSIBLE from dba_data_files;
YES Description is auto-incremented
If NO then execute the following SQL, modification mode:
SQL > alter database datafile '/home/app/XXX/oradata/XXX/system01.dbf' AUTOEXTEND ON NEXT 50M MAXSIZE UNLIMITED;
Note: SYSTEM according to their corresponding data file path fill, 50M for each increment of size.
Option II: the expansion of table space corresponding to the size of the data file (not suitable for this reason)
Available corresponding table space file has a 32G.
Table predetermined space corresponding to the data file can not exceed 32G.
If you can not reach the corresponding file size by expanding the table space, SQL is:
SQL > alter database datafile '/home/app/XXX/oradata/XXX/system01.dbf' resize 32000M;
Option Three: Add a data file SYSTEM02.DBF the SYSTEM table space (not suitable reason for the problem)
Size: 500M, from small increases: 50M
SQL> alter tablespace "SYSTEM" add datafile '/home/app/XXX/oradata/XXX/system02.dbf' SIZE 500M AUTOEXTEND ON NEXT 50M MAXSIZE UNLIMITED;
注:一个表空间能对应多个数据文件,但一个数据文件只能对应一个表空间
方案四:清空AUD$表数据并关闭审计功能(根本原因,笔者使用了该方案)
1、查sys.aud$及其索引 占用大小
SQL> SELECT t.owner, t.segment_name,SUM(bytes)/1024/1024/1024 as SIZE_G FROM dba_segments t WHERE t.tablespace_name = 'SYSTEM' and t.segment_name='AUD$' GROUP BY t.owner,t.segment_name ORDER BY SUM(bytes) desc;
可怕,就是这个审计表,达到了31个G了,问题就在此。
2、清空AUD$:
SQL> truncate table AUD$;
3、查看审计功能
SQL> show parameter audit
4、关闭审计功能:
SQL> alter system set audit_trail='none' scope=spfile;
如果只是清理 AUD$表,问题已经解决,但是时间久后,问题还是会复现,如果不需要审计数据可以关闭审计功能永久解决。
注:此上方案解决后,需要重启
SQL> shutdown immediate; //关闭 SQL> startup mount; //挂起 SQL> alter database open; //打开数据库
转自:https://blog.csdn.net/heshushun/article/details/80899839