InnoDB 中文参考手册 --- 13 出错处理
2024-07-21 02:08:53
供稿:网友
 
innodb 中文参考手册 --- 犬犬(心帆)翻译 13 出错处理
innodb 的出错处理不总是与 ansi sql 指定的一致。依照 ansi 标准,在一个 sql 语句中的任何错误都将引起这条语句的回滚。innodb 有时只回滚语句的一部分,有时则是整个事务。 下面的列表详细说明了 innodb 的出错处理。
 如果用完了表空间内的文件空间,将会得到 mysql 的 'table is full' 错误,innodb 将回滚这条 sql 语句。 事务的死锁或锁定等待的超时将会使 innodb 回滚整个事务。 一个重复键(duplicate key)只会回滚插入的细节行,甚至在如同 insert into ... select ...的一个语句中。这或许会发生改变,所以如果在语句中没有指定 ignore 选项这个语句将产生回滚。 'row too long' 的错误将回滚整个 sql 语句。 其它的错误主要由 mysql 的代码层发现,它们将回滚相应的 sql 语句。
 
13.1 mysql 返回的某些错误代码
  1005 er_cant_create_table 不能建立表。如果错误信息串引用 errno 150,那么表创建失败是由于外键约束没能正确的形成。 1016 er_cant_open_file 不能够通过 .frm 文件在 innodb 数据文件中找到 innodb 表。查看下面的“发现并修复数据字典错误的操作”章节。 1114 er_record_file_full innodb 用光了表空间内的剩余空间。你必须增加一个新的数据文件。 1205 er_lock_wait_timeout 锁等待超时期满。事务被回滚。 1213 er_lock_deadlock 事务死锁。需要重新运行事务。 1216 er_no_referenced_row 当试图增加一个新行时,但是没有父记录存在,外键约束失败。必须先添加父记录。 1217 er_row_is_referenced 删除一个有子记录存在的父行,外键约束失败。必须先删除子记录。
 
13.2 某些操作系统的错误编码
在 unix 系统中,使用 perror 程序来显示操作系统错误编码的含义,它包含在 mysql 的分发中。
下面的列表显示常见的 linux 系统错误代码。 1 eperm
 operation not permitted
 操作不许可 2 enoent
 no such file or directory
 无此文件或目录 3 esrch
 no such process
 无此过程 4 eintr 
 interrupted system call
 系统调用被禁止 5 eio 
 i/o error
 i/o 错误 6 enxio 
 no such device or address
 无此器件或地址 7 e2big 
 arg list too long
 arg 列表太长 8 enoexec 
 exec format error
 exec 格式错误 9 ebadf 
 bad file number
 文件数目错误
 10 echild
 no child processes
 无子过程
 11 eagain
 try again
 再试一遍
 12 enomem
 out of memory 
 内存溢出
 13 eacces
 permission denied 
 许可拒绝
 14 efault
 bad address 
 错误的地址
 15 enotblk
 block device required 
 需要块设备
 16 ebusy
 device or resource busy 
 设备或资源忙
 17 eexist
 file exists 
 文件存在
 18 exdev
 cross-device link 
 跨器链接
 19 enodev
 no such device 
 无此设备
 20 enotdir
 not a directory 
 不是一个目录
 21 eisdir
 is a directory 
 是一个目录
 22 einval
 invalid argument 
 无效的函数自变量
 23 enfile
 file table overflow 
 文件表溢出
 24 emfile
 too many open files
 打开的文件太多
 25 enotty
 inappropriate ioctl for device 
 
 26 etxtbsy
 text file busy 
 文本文件忙
 27 efbig
 file too large
 文件太大
 28 enospc
 no space left on device 
 磁盘空间不足
 29 espipe 
 illegal seek 
 不合法的寻找
 30 erofs 
 read-only file system 
 只读文件系统
 31 emlink 
 too many links
 太多的链接 
 
下面的列表显示常见的 windows 系统错误代码。 1 error_invalid_function
 incorrect function
 函数错误
 2 error_file_not_found
 the system cannot find the file specified
 系统找不到指定文件
 3 error_path_not_found 
 the system cannot find the path specified
 系统找不到指定路径
 4 error_too_many_open_files
 the system cannot open the file
 系统不能打开文件
 5 error_access_denied
 access is denied
 访问被拒绝
 6 error_invalid_handle
 the handle is invalid
 句柄无效
 7 error_arena_trashed
 the storage control blocks were destroyed
 存储控制块被损坏
 8 error_not_enough_memory 
 not enough storage is available to process this command
 没有足够的存储空间执行这个指令
 9 error_invalid_block 
 the storage control block address is invalid
 存储控制块地址无效
 10 error_bad_environment
 the environment is incorrect. 
 环境错误
 11 error_bad_format
 an attempt was made to load a program with an incorrect format.
 以错误的格式尝试装入一个程序
 12 error_invalid_access
 the access code is invalid. 
 存取码无效
 13 error_invalid_data 
 the data is invalid. 
 数据无效
 14 error_outofmemory
 not enough storage is available to complete this operation. 
 没有足够的存储空间来完成这个操作
 15 error_invalid_drive
 the system cannot find the drive specified. 
 系统无法找到指定的驱动器
 16 error_current_directory
 the directory cannot be removed. 
 目录无法被移除
 17 error_not_same_device 
 the system cannot move the file to a different disk drive. 
 系统无法将文件移到不同的磁盘驱动器上
 18 error_no_more_files 
 there are no more files. 
 没有更多的文件
 19 error_write_protect
 the media is write protected.
 媒体写保护 20 error_bad_unit
 the system cannot find the device specified.
 系统无法找到指定的设备
 21 error_not_ready 
 the device is not ready. 
 设备未准备好
 22 error_bad_command 
 the device does not recognize the command. 
 设备不支持这个指令
 23 error_crc
 data error (cyclic redundancy check).
 数据出错(循环冗余检验)
 24 error_bad_length 
 the program issued a command but the command length is incorrect. 
 程序发出指令,但指令长度出错
 25 error_seek
 the drive cannot locate a specific area or track on the disk.
 驱动器无法在磁盘上定位指定的区域或磁道 
 26 error_not_dos_disk
 the specified disk or diskette cannot be accessed. 
 指定的磁盘或磁碟无法访问
 27 error_sector_not_found 
 the drive cannot find the sector requested. 
 驱动器无法找到需要的扇区
 28 error_out_of_paper 
 the printer is out of paper. 
 打印机缺纸
 29 error_write_fault
 the system cannot write to the specified device.
 系统不能够向指定的设备中写入
 30 error_read_fault
 the system cannot read from the specified device. 
 系统无法从指定设备中读入
 31 error_gen_failure
 a device attached to the system is not functioning. 
 系统附着的设备无法运作
 32 error_sharing_violation
 the process cannot access the file because it is being used by another process. 
 进程无法访问该文件因为文件已被其它进程使用
 33 error_lock_violation
 the process cannot access the file because another process has locked a portion of the file. 
 进程无法访问该文件因为文件已被其它进程锁定部分
 34 error_wrong_disk 
 the wrong diskette is in the drive. insert %2 (volume serial number: %3) into drive %1. 
 驱动器中磁盘错误。插入 %2 (盘卷序列号:%3)到驱动器 %1中
 36 error_sharing_buffer_exceeded 
 too many files opened for sharing. 
 太多的文件为共享打开
 38 error_handle_eof
 reached the end of the file. 
 达到文件结束
 39 error_handle_disk_full 
 the disk is full. 
 磁盘已满
 112 error_disk_full 
 the disk is full. 
 磁盘已满
 123 error_invalid_name
 the filename, directory name, or volume label syntax is incorrect. 
 文件名,目录名或卷标语法出错