
数据库限制规范
列出数据库功能及相关对象的取值限制。限制存在于数据库的多个层级:
1.硬编码限制(Hard-coded Limit):
数据库内部设定的绝对上限值,不可超越
2.操作系统限制(OS Limit):
任何给定操作系统可能施加更严格限制
数据库限制分为四类:
一.Datatype Limits
二.Physical Database Limits
三.Logical Database Limits
四.Process and Runtime Limit
本文主要介绍:Datatype Limits
一.Datatype Limits


1.BFILE
Limit:
Maximum size: 2^64 bytes (18.44 exabytes) or OS file size limit, whichever is the lower value
2^64 字节(18.44 EB) 或 操作系统文件大小限制(取两者中的较低值)
Maximum size of a file name(文件名): 255 characters
Maximum size of a directory name(目录名): 128 bytes
Maximum number of open BFILEs(可打开的 BFILE 文件数量上限): see Comments
Comments:
The maximum number of BFILEs is limited by the value of the SESSION_MAX_OPEN_FILES initialization parameter, which is itself limited by the maximum number of open files the operating system will allow.
BFILE 的最大数量受限于 SESSION_MAX_OPEN_FILES 初始化参数的值,而该参数本身受操作系统允许的最大打开文件数限制。

2.BLOB
Limit:
Maximum size: (4 GB - 1) * DB_BLOCK_SIZE initialization parameter (8 TB to 128 TB)
(4 GB - 1) × DB_BLOCK_SIZE(初始化参数值),范围 8 TB 至 128 TB
Comments:
The number of LOB columns per table is limited only by the maximum number of columns per table (that is, 1000 if MAX_COLUMNS = STANDARD and 4096 if MAX_COLUMNS = EXTENDED).
每表的 LOB 列数量仅受表的最大列数限制(即:当 MAX_COLUMNS = STANDARD 时为 1000 列;当 MAX_COLUMNS = EXTENDED 时为 4096 列)。
表的绝对最大列数为 1000 或 4096,具体取决于初始化参数 MAX_COLUMNS 的值。然而,当创建对象表(或包含对象类型、嵌套表、可变数组或 REF 类型的关联表)时,Oracle 会将用户自定义类型的列映射为关系列,此过程实际产生计入最大列数限制的隐藏列。
3.CHAR
Limit:
Maximum size: 2000 bytes
Comments:
None
4.CLOB
Limit:
Maximum size: (4 GB - 1) * DB_BLOCK_SIZE initialization parameter (8 TB to 128 TB)
Comments:
The number of LOB columns per table is limited only by the maximum number of columns per table (that is, 1000 if MAX_COLUMNS = STANDARD and 4096 if MAX_COLUMNS = EXTENDED).
5.JSON
Limit:
Maximum size: 32 MB
Comments:
None
6.Literals (characters or numbers in SQL or PL/SQL)
Limit:
Maximum size: 4000 characters
Comments:
None
7.LONG
Limit:
Maximum size: 2 GB - 1
Comments:
Only one LONG column is allowed per table.
每表仅允许存在一个 LONG 列
Footnote 2
All forms of LONG data types (LONG, LONG RAW, LONG VARCHAR, LONG VARRAW) were deprecated in Oracle8i Release 8.1.6. For succeeding releases, the LONG data type was provided for backward compatibility with existing applications. In new applications developed with later releases, Oracle strongly recommends that you use the CLOB or NCLOB data type for storing large amounts of character data.
所有形式的 LONG 数据类型(LONG, LONG RAW, LONG VARCHAR, LONG VARRAW)已在 Oracle8i Release 8.1.6 中废弃。
版本演进说明:
后续版本保留 LONG 类型仅为兼容旧版应用
强烈建议:新开发应用使用 CLOB(字符大对象)或 NCLOB(国家字符大对象)存储海量文本数据。

8.NCHAR
Limit:
Maximum size: 2000 bytes
Comments:
None

9.NCLOB
Limit:
Maximum size: (4 GB - 1) * DB_BLOCK_SIZE initialization parameter (8 TB to 128 TB)
Comments:
The number of LOB columns per table is limited only by the maximum number of columns per table (that is, 1000 if MAX_COLUMNS = STANDARD and 4096 if MAX_COLUMNS = EXTENDED).
10.NUMBER
Limit:
999…(38 9’s) x10^125 maximum value
-999…(38 9’s) x10^125 minimum value
最大值:999…(38个9) × 10^125
最小值:-999…(38个9) × 10^125
Comments:
Can be represented to full 38-digit precision (the mantissa)
Can be represented to full 38-digit precision (the mantissa)
可完整表示 38 位精度(尾数部分)
数学表示精准性:
999…(38 9’s) → 999…(38个9)(显式标注重复位数)

11.NVARCHAR2
Limit:
Maximum size: 4000 bytes, or 32767 bytes if the MAX_STRING_SIZE initialization parameter is set to EXTENDED
最大尺寸:
4000 字节;若初始化参数 MAX_STRING_SIZE 设置为 EXTENDED,则为 32767 字节
Comments:
None
NVARCHAR2 本质
Unicode 原生存储:专为存储国际化字符设计,采用 国家字符集(NLS_NCHAR_CHARACTERSET) 编码(通常为 UTF-8/UTF-16)
变长特性:仅占用实际数据长度 + 长度标识位的存储空间
语义安全:字符长度(CHAR)与字节长度(BYTE)分离,避免乱码


12.Precision
Limit:
38 significant digits
38 位有效数字
Comments:
None
精度(Precision)的定义
在 Oracle 中,精度指数据类型中有效数字的最大位数(不含小数点及符号位),是数值型数据(如 NUMBER、FLOAT)的核心属性。

13.RAW
Limit:
Maximum size: 2000 bytes, or 32767 bytes if the MAX_STRING_SIZE initialization parameter is set to EXTENDED
Comments:
None
RAW 数据类型本质:
二进制原始数据存储:直接存储未加工的二进制数据(无字符集转换)

典型应用场景:
- 密码学数据存储
CREATE TABLE user_credentials (
user_id NUMBER,
salt RAW(16), -- AES 加密盐值
token RAW(32) -- SHA-256 认证令牌
);
- 网络协议解析
– 存储IP帧头(20字节固定头)
CREATE TABLE network_packets (
packet_id RAW(14), -- MAC地址(6字节)+ 时间戳(8字节)
ip_header RAW(20) -- IPv4头部
);
等。
14.VARCHAR2
Limit:
Maximum size: 4000 bytes, or 32767 bytes if the MAX_STRING_SIZE initialization parameter is set to EXTENDED
Comments:
None
参考翻译自:
https://docs.oracle.com/en/database/oracle/oracle-database/23/refrn/database-limits.html
欢迎关注我的公众号《IT小Chen》
467

被折叠的 条评论
为什么被折叠?



