文章目录
- 一、预先准备
- 1. 现象
- 2. 异常信息
- 3. 分析
- 二、解决方案
- 2.1. 登录oracle
- 2.2. 查看ARCHIVED LOG空间占用率
- 2.3. 查看元空间大小
- 2.4. 整空间上限
- 2.5. 结果验证
一、预先准备
1. 现象
场景1:
昨天尝试通过plsqldev尝试连接oracle数据库,报错,提示ORA-00257: 归档程序错误。在释放之前仅限于内部连接
场景2:
sonarqube 数据库oracle 执行代码扫描时抛出Cannot create PoolableConnectionFactory (ORA-00257: 归档程序错误。在释放之前仅限于内部连接
2. 异常信息
Caused by: java.sql.SQLException: Cannot create PoolableConnectionFactory (ORA-00257: 归档程序错误。在释放之前仅限于内部连接
)at org.apache.commons.dbcp2.BasicDataSource.createPoolableConnectionFactory(BasicDataSource.java:2385)at org.apache.commons.dbcp2.BasicDataSource.createDataSource(BasicDataSource.java:2110)at org.apache.commons.dbcp2.BasicDataSource.getConnection(BasicDataSource.java:1563)at org.sonar.db.profiling.NullConnectionInterceptor.getConnection(NullConnectionInterceptor.java:31)at org.sonar.db.profiling.ProfiledDataSource.getConnection(ProfiledDataSource.java:317)at org.sonar.db.DefaultDatabase.checkConnection(DefaultDatabase.java:116)... 30 common frames omitted
Caused by: java.sql.SQLException: ORA-00257: 归档程序错误。在释放之前仅限于内部连接at oracle.jdbc.driver.T4CTTIoer11.processError(T4CTTIoer11.java:494)at oracle.jdbc.driver.T4CTTIoer11.processError(T4CTTIoer11.java:441)at oracle.jdbc.driver.T4CTTIoer11.processError(T4CTTIoer11.java:436)at oracle.jdbc.driver.T4CTTIoauthenticate.processError(T4CTTIoauthenticate.java:546)at oracle.jdbc.driver.T4CTTIfun.receive(T4CTTIfun.java:623)at oracle.jdbc.driver.T4CTTIfun.doRPC(T4CTTIfun.java:252)at oracle.jdbc.driver.T4CTTIoauthenticate.doOSESSKEY(T4CTTIoauthenticate.java:519)at oracle.jdbc.driver.T4CConnection.logon(T4CConnection.java:615)at oracle.jdbc.driver.PhysicalConnection.connect(PhysicalConnection.java:688)at oracle.jdbc.driver.T4CDriverExtension.getConnection(T4CDriverExtension.java:39)at oracle.jdbc.driver.OracleDriver.connect(OracleDriver.java:691)at org.apache.commons.dbcp2.DriverConnectionFactory.createConnection(DriverConnectionFactory.java:53)at org.apache.commons.dbcp2.PoolableConnectionFactory.makeObject(PoolableConnectionFactory.java:291)at org.apache.commons.dbcp2.BasicDataSource.validateConnectionFactory(BasicDataSource.java:2395)at org.apache.commons.dbcp2.BasicDataSource.createPoolableConnectionFactory(BasicDataSource.java:2381)... 35 common frames omitted
2022.11.02 13:12:39 WARN web[][o.a.c.u.SessionIdGeneratorBase] Creation of SecureRandom instance for session ID generation using [SHA1PRNG] took [225] milliseconds.
3. 分析
archivedlog达到了数据库设置的空间限制
二、解决方案
2.1. 登录oracle
通过后台sqlplus登入数据库,执行命令:
[root@sonar ~]$ su - oracle
[oracle@sonar ~]$ sqlplus / as sysdba
通过查询,得知原因是archivedlog达到了数据库设置的空间限制。
2.2. 查看ARCHIVED LOG空间占用率
查看ARCHIVED LOG这一项的空间占用率已接近100%
select * from v$flash_recovery_area_usage;
附上:操作记录
SQL> select * from v$flash_recovery_area_usage;FILE_TYPE PERCENT_SPACE_USED PERCENT_SPACE_RECLAIMABLE NUMBER_OF_FILES
---------------------------------------- ------------------ --------------
CONTROL FILE 0 0 0REDO LOG 0 0 0ARCHIVED LOG 0 5059 99.99 FILE_TYPE PERCENT_SPACE_USED PERCENT_SPACE_RECLAIMABLE NUMBER_OF_FILES
---------------------------------------- ------------------------------------------- ---
BACKUP PIECE 0 0 0IMAGE COPY 0 0 0FLASHBACK LOG 0 0 0FILE_TYPE PERCENT_SPACE_USED PERCENT_SPACE_RECLAIMABLE NUMBER_OF_FILES
---------------------------------------- ------------------------------------------- ---
FOREIGN ARCHIVED LOG 0 0 0
7 rows selected.
2.3. 查看元空间大小
show parameter db_recover
发现之前设置的空间大小为200G,查看磁盘空间,发现还有几百G空间。
附上:操作记录
SQL> show parameter db_recover;NAME TYPE VALUE
------------------------------------ ---------------------------------------------------
db_recovery_file_dest string /u01/oracle/fast_recovery_area
db_recovery_file_dest_size big integer 200G
SQL>
2.4. 整空间上限
使用如下命令调整空间上限:
alter system set db_recovery_file_dest_size=300G scope=both;
附上:操作记录
SQL> alter system set db_recovery_file_dest_size=300G scope=both;
System altered.
SQL>
此处我将空间上限调整为300G。
可以使用上述提到的命令验证是否修改成功。
2.5. 结果验证
修改完之后再尝试使用plsqldev连接数据库,可以连接成功了。