作者 阿九【转载时请务必以超链接形式标明文章原始出处和作者信息】
今天发现有个表空间快满了,想添加两个数据文件,结果报错 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这个参数的说明
If you increase the value of |