关于db_files和maxdatafiles的问题(r4笔记第31天)
时间:2022-05-04
本文章向大家介绍关于db_files和maxdatafiles的问题(r4笔记第31天),主要内容包括其使用实例、应用技巧、基本知识点总结和需要注意事项,具有一定的参考价值,需要的朋友可以参考一下。
昨天在做生产监控的时候发现有个库的表空间不够了,就发邮件给客户的dba去处理,但是得到的反馈是尝试添加的时候发现已经超过了数据文件的最大数限制。这个错误毫无疑问就是"ORA-00059: Maximum Number Of db_files Exceeded" 一看到这个问题,一下子感觉就头大了。这个参数是在创建数据库的时候就应该考虑到的。竟然没有考虑周全,如果控制文件中的maxdatafiles没有值太小,只能重建控制文件了。如果本身数据文件的数量超过了最大限制,甚至还需要考虑重建数据库,如果碰到这种事就太郁闷了。 查看oracle的文档,赫然可以看到以下的参数是需要在创建数据库(尤其是RAC)中需要考虑的。
- ACTIVE_INSTANCE_COUNT
- ARCHIVE_LAG_TARGET
- CLUSTER_DATABASE
- CLUSTER_DATABASE_INSTANCES
- CONTROL_FILES
- DB_BLOCK_SIZE
- DB_DOMAIN
- DB_FILES
- DB_NAME
- DB_RECOVERY_FILE_DEST
- DB_RECOVERY_FILE_DEST_SIZE
- DB_UNIQUE_NAME
- UNDO_MANAGEMENT 对于参数db_files的解释如下:
Property |
Description |
---|---|
Parameter type |
Integer |
Default value |
200 |
Modifiable |
No |
Range of values |
Minimum: the largest among the absolute file numbers of the datafiles in the databaseMaximum: operating system-dependent |
Basic |
No |
Real Application Clusters |
Multiple instances must have the same value. |
当前库是11gR2版本,默认值是200。 在其它版本中的情况关于maxdatafiles的情况如下:
---------------- V7 8.0.5 8.1.6 9.2 10.1 10.2
—————————————————-------- -------- ------ -------- -------- --------
UNIX Per TS 1022 1022 1022 1022 1022
Per DB 1022 65536 65536 65534 65334 65334
VMS Per TS 1022 - - - 1022
Per DB 1022 65536 - 65334
WINDOWS Per TS 1022 1022
Per DB 1022 65536 65536 65534 65334 65334 11g中对datafiles略有增长,为65533,表空间中最大数据文件数也是1022,根据操作系统可能还要略微低一些。回到两个参数db_files和maxdatafiles,db_files是一个"soft" limit,而maxdatafiles是一个“hard" limit.maxdatafiles是在create database语句中包含的,写入了controlfile,如果要修改maxdatafiles,则需要重建控制文件。db_files则是在实例级别的限制,这个值需要小于maxdatafiles,但是可以在参数文件中根据需要来做变更。具体可以参考MOS Doc ID 119507.1,里面给出了详细的解决步骤,就不再赘述了。SOLVING ORA-1118 and ORA-1165 :
------------------------------
The following are possible options to get around these errors :
1. You should verify that you haven't reached a hard limit for MAXDATAFILES
imposed by the Operating System. This limit can be found in the O/S specific
documentation.
If MAXDATAFILES is already equal to the maximum value, then you must
restructure the database by reducing the number of datafiles associated with
each individual tablespace:
a) export the objects from the tablespace
b) drop the tablespace
c) recreate the tablespace with less datafiles
d) import the objects back into the tablespace
In some cases, if the datafile size is too small, it might be usefull to
resize the datafiles. Make sure that you keep the datafile size lower than
the Operating System limitation on file sizes :
> ALTER DATABASE DATAFILE 'D:OradataOrcldatafileusr01.dbf' RESIZE 500M;
Query DBA_SEGMENTS to find out all objects belonging to a particular
tablespace.
2. Increase the MAXDATAFILES parameter. It is possible for you to increase
the MAXDATAFILES limit without recreating the entire database. This is done
by recreating the control file only.
3. Especially for Oracle8+ you should make sure that you do not encounter an
error against the maximum number of open database files (DB_FILES). It is
more likely that the value for DB_FILES is too low since the controlfile in
Oracle8 expands automatically as long as the number of the added datafile is
lower then the value for DB_FILES. Normally the error message should
indicate this:
ORA-00059 : maximum number of DB_FILES exceeded
4. Recreate the database. Since the MAXDATAFILES parameter is specified
upon database creation, recreating the database allows you to increase
this parameter.
In addition to your operating system documentation, you may want to
reference the following bulletins:
O7 - Creating an Oracle 7.X Database under Unix - Note:10280.1 RECREATING THE CONTROL FILE:
----------------------------
In Oracle7 or higher, you can create the control file. In addition, you can get
Oracle to create the script for you. To do this, perform the following steps:
1. With the database mounted or open, issue the following commands:
SQL> alter database backup controlfile to trace;
SQL> exit
2. A trace file will have been generated in your 'user_dump_dest'.
User_dump_dest is an init.ora parameter, and can be found by
issuing:
SQL> show parameter user_dump_dest
The easiest way to locate the correct trace is to look at its date. A
file will exist with the current date and time. The naming convention
for these files is operating system specific.
3. Once the file is located, search through the file for the word "CONTROL"
You should find:
# The following commands will create a new control file and use it
# to open the database.
# No data other than log history will be lost. Additional logs may
ETC.ETC.
4. Copy this trace file to some location and rename it to end it ".sql",
for this example, it is called "recr_con.sql".
5. Edit the "recr_con.sql" deleting the trace header information. Then
increase the value that you find next to the word "MAXDATAFILES".
6. Shutdown the database (NORMAL or IMMEDIATE, but not ABORT).
7. Take a full database backup at this time.
8. Remove the current control files. It is essential to remove all control
files, otherwise, you will receive an error. In addition, you CANNOT
REUSE the control file, since the size of the control file will increase
when you increase MAXDATAFILES.
9. Create the controlfile within SQLDBA:
SQL> connect internal [if using sqldba or svrmgrl]
or
connect / as sysdba [if using sqlplus]
SQL> @recr_con.sql
SQL> alter database open noresetlogs;
If you receive a "Statement processed" message, then your database is
now back up and running with a higher datafile limit. It is recommended
to shutdown at this time and take a full backup.
CREATE CONTROLFILE SYNTAX:
-------------------------
The following is information on the create control file syntax, this
information is fully documented in the Oracle SQL Reference Manual.
The syntax of this command is similar to CREATE DATABASE.
The defaults for any missing clauses are the same as the
DATABASE defaults for CREATE DATABASE.
CREATE CONTROLFILE [REUSE]
SET DATABASE name
[LOGFILE filespec [, filespec] ...]
RESETLOGS | NORESETLOGS
[MAXLOGFILES integer]
[DATAFILE filespec [, filespec] ...]
[MAXDATAFILES integer]
[MAXINSTANCES integer]
[ARCHIVELOG | NOARCHIVELOG]
[SHARED | EXCLUSIVE]
- 次小生成树
- HDU 4786Fibonacci Tree(最小生成树)
- HDU 1847 Good Luck in CET-4 Everybody!(找规律版巴什博奕)
- HDU 4764 Stone(巴什博奕)
- 博弈论入门之巴什博奕
- 理清字符集和字符编码关系
- 我是如何巧妙渗入安全脉搏的(附官方还原详情)
- vscode编写插件详细过程
- zabbix最新SQL注入漏洞+EXP
- 本地密码检索工具 – LaZagne Project
- 我是如何在SQLServer中处理每天四亿三千万记录的
- 程序猿是如何解决SQLServer占CPU100%的
- 记一次SQLServer的分页优化兼谈谈使用Row_Number()分页存在的问题
- 分享一个自制的 .net线程池1
- JavaScript 教程
- JavaScript 编辑工具
- JavaScript 与HTML
- JavaScript 与Java
- JavaScript 数据结构
- JavaScript 基本数据类型
- JavaScript 特殊数据类型
- JavaScript 运算符
- JavaScript typeof 运算符
- JavaScript 表达式
- JavaScript 类型转换
- JavaScript 基本语法
- JavaScript 注释
- Javascript 基本处理流程
- Javascript 选择结构
- Javascript if 语句
- Javascript if 语句的嵌套
- Javascript switch 语句
- Javascript 循环结构
- Javascript 循环结构实例
- Javascript 跳转语句
- Javascript 控制语句总结
- Javascript 函数介绍
- Javascript 函数的定义
- Javascript 函数调用
- Javascript 几种特殊的函数
- JavaScript 内置函数简介
- Javascript eval() 函数
- Javascript isFinite() 函数
- Javascript isNaN() 函数
- parseInt() 与 parseFloat()
- escape() 与 unescape()
- Javascript 字符串介绍
- Javascript length属性
- javascript 字符串函数
- Javascript 日期对象简介
- Javascript 日期对象用途
- Date 对象属性和方法
- Javascript 数组是什么
- Javascript 创建数组
- Javascript 数组赋值与取值
- Javascript 数组属性和方法
- conda管理C源代码程序的时候总是出现库文件冲突或者缺失
- 如何获取非模式生物KEGG PATHWAY的基因集并用clusterProfile做GSEA?
- 通过视频着色进行自监督跟踪
- Python爬虫:一些常用的爬虫技巧总结
- 带你用 Python 实现自动化群控(入门篇)
- Chrome终于上线这项重磅功能,中国用户苦等多年!
- YOLO 算法最全综述:从 YOLOv1 到 YOLOv5
- 《JavaScript ES6 函数式编程入门经典》读书笔记
- Java9-Reactive Stream API响应式编程
- mybatis-plus增删改查以及前后端分离模式下的项目应用
- docker(常用软件安装)
- PyTorch版:集成注意力和MobileNet的YOLOv4
- 从源代码级别看懂MinIO对象存储网关的实现
- 4种主流超参数调优技术
- 一分钟学Python| 面向对象(上)