ORA-00059:maximum number of DB_FILES exceed 解决


作者 阿九【转载时请务必以超链接形式标明文章原始出处和作者信息】


今天发现有个表空间快满了,想添加两个数据文件,结果报错 ORA-00059:maximum number of DB_FILES exceed

查看系统的db_files参数为:200,而数据文件总数也确实为200,报这个错误正常。


SQL> show parameter db_files


NAME                                 TYPE        VALUE
------------------------------------ ----------- ------------------------------
db_files                             integer     200
SQL>

SQL> select count(1) from dba_data_files;


  COUNT(1)
----------
      200


SQL>


使用oerr 工具可以参看到如下信息:

ORA-00059: maximum number of DB_FILES exceeded Cause: The value of the DB_FILES initialization parameter was exceeded. Action: Increase the value of the DB_FILES parameter and warm start.

报这个错误的原因是因为数据文件数量已经达到db_files这个参数的值,如果想增加数据文件的数量,必须修改db_files参数值,然后重启数据库。

而修改db_files参数值,还必须明确另一个参数的值,那就是存在于控制文件中的 maxdatafiles。


db_files和maxdatafiles的关系与区别


区别:

存在位置不同

db_files存在于spfile文件或pfile文件中。

maxdatafiles存在于控制文件中,该值可以在创建数据库时指定。


关系

当db_files<maxdatafiles时,那么只需要修改db_files的值,并重启数据库即可解决ORA-00059。

当db_files=maxdatafiles时,则需要重新创建控制文件,并修改db_files值,重启数据库来解决该问题。


查看控制文件中的maxdatafiles值可以通过创建控制文件的追踪文件来查看

SQL> alter database backup controlfile to trace;


数据库已更改。


SQL>

在udump目录下,找到最新的追踪文件,即为新生成的控制文件的追踪文件。


该数据库的maxdatafiles值为2048,因此我只需修改db_files的参数值就可以解决该问题。

由于是RAC数据库,因此在修改的时候需要加上 sid='*' 这个参数。修改的顺序为(这是我个人实施的顺序):

1、在所有节点上分别执行命令:

alter system set db_file=1024 scope=spfile sid='*'; #注意,这里的sid没有指明用那个节点的sid,*表示所有节点

注:我当时执行的时候考虑到设置了 sid='*' 这个参数,因此只在一个节点上执行,当重启另一节点数据库时候报错,

具体错误信息忘记保存,意思就是当前所使用的db_files的值和另一个节点不匹配。因此我又在该节点执行了一次如上的命令,再次重启数据库成功。

2、关闭所有节点数据库。

3、顺序重启所有节点数据库。

注:这里要注意,是关闭所有节点后,再依次重启,不然会造成db_files值和另一节点不匹配的报错。


至此,问题解决,再添加数据文件成功。


如下是官方关于db_files这个参数的说明

PropertyDescription
Parameter typeInteger
Default value200
ModifiableNo
Range of valuesMinimum: the largest among the absolute file numbers of the datafiles in the database

Maximum: operating system-dependent

BasicNo
Real Application ClustersYou must set this parameter for every instance, and multiple instances must have the same value.


DB_FILES specifies the maximum number of database files that can be opened for this database. The maximum valid value is the maximum number of files, subject to operating system constraint, that will ever be specified for the database, including files to be added by ADD DATAFILE statements.

If you increase the value of DB_FILES, then you must shut down and restart all instances accessing the database before the new value can take effect. If you have a primary and standby database, then they should have the same value for this parameter.




评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值