数据库

本类阅读TOP10

·SQL语句导入导出大全
·SQL Server日期计算
·SQL语句导入导出大全
·SQL to Excel 的应用
·Oracle中password file的作用及说明
·MS SQLServer OLEDB分布式事务无法启动的一般解决方案
·sqlserver2000数据库置疑的解决方法
·一个比较实用的大数据量分页存储过程
·如何在正运行 SQL Server 7.0 的服务器之间传输登录和密码
·SQL中两台服务器间使用连接服务器

分类导航
VC语言Delphi
VB语言ASP
PerlJava
Script数据库
其他语言游戏开发
文件格式网站制作
软件工程.NET开发
InnoDB 中文参考手册 --- 13 出错处理

作者:未知 来源:月光软件站 加入时间:2005-2-28 月光软件站

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.
    文件名,目录名或卷标语法出错



相关文章

相关软件