WEB开发网
开发学院数据库Sybase Sybase数据库:日志过大导致不能启动 阅读

Sybase数据库:日志过大导致不能启动

 2008-03-27 15:09:07 来源:WEB开发网   
核心提示:问:有个问题问一下,关于SYBASE的:我打开数据库总是提醒:cannot open transaction log file-cannot use log file "hms2000.log" since it is shorter than experted,Sybase数据库:日志过大导致不能

问:有个问题问一下,关于SYBASE的:我打开数据库总是提醒:cannot open transaction log file-----cannot use log file "hms2000.log" since it is shorter than experted。我直接删除了日志,也不能正常启动,说找不到文件。请问这是怎么回事啊?附上出错的日志记录:

I. 10/09 09:58:38. Sybase Adaptive Server Anywhere Network Server Version 7.0.2.1402
I. 10/09 09:58:38. This software contains confidential and trade secret information of
I. 10/09 09:58:38. Sybase, Inc. Use, duplication or disclosure of the software and
I. 10/09 09:58:38. documentation by the U.S. Government is subject to restrictions set forth
I. 10/09 09:58:38. in a license agreement between the Government and Sybase, Inc. or other
I. 10/09 09:58:38. written agreement specifying the Government's rights to use the software
I. 10/09 09:58:38. and any applicable FAR provisions, for example, FAR 52.227-19.
I. 10/09 09:58:38. 
I. 10/09 09:58:38. Copyright 1989-2000 Sybase, Inc. All rights reserved.
I. 10/09 09:58:38. All unpublished rights reserved.
I. 10/09 09:58:38. 
I. 10/09 09:58:38. Sybase, Inc. 6475 Christie Avenue, Emeryville, CA 94608, USA
I. 10/09 09:58:38. Networked Seat (per-seat) model. Access to the server is limited to 99 seat(s).
I. 10/09 09:58:38. This server is licensed to:
I. 10/09 09:58:38.  lb
I. 10/09 09:58:38.  
I. 10/09 09:58:38. 10240K of memory used for caching
I. 10/09 09:58:38. Minimum cache size: 10240K, maximum cache size: 230848K
I. 10/09 09:58:38. Using a maximum page size of 1024 bytes
I. 10/09 09:58:38. Starting database "XXXXXXX" (C:Program Filessybase数据服务器XXXXXXX.db) at Sun Oct 09 2005 09:58
I. 10/09 09:58:38. Database recovery in progress
I. 10/09 09:58:38.  Last checkpoint at Sat Oct 08 2005 19:15
I. 10/09 09:58:38.  Checkpoint log...
I. 10/09 09:59:03.  Transaction log: XXXXXXX.LOG...
E. 10/09 09:59:03. Error: Cannot open transaction log file -- Can't use log file "XXXXXXX.LOG" since it is shorter than expected
I. 10/09 09:59:03. Error: Cannot open transaction log file -- Can't use log file "XXXXXXX.LOG" since it is shorter than expected
E. 10/09 09:59:03. Cannot open transaction log file -- Can't use log file "XXXXXXX.LOG" since it is shorter than expected
I. 10/09 09:59:04. Database server stopped at Sun Oct 09 2005 09:59
I. 10/09 10:58:33. Sybase Adaptive Server Anywhere Network Server Version 7.0.2.1402
I. 10/09 10:58:33. This software contains confidential and trade secret information of
I. 10/09 10:58:33. Sybase, Inc. Use, duplication or disclosure of the software and
I. 10/09 10:58:33. documentation by the U.S. Government is subject to restrictions set forth
I. 10/09 10:58:33. in a license agreement between the Government and Sybase, Inc. or other
I. 10/09 10:58:33. written agreement specifying the Government's rights to use the software
I. 10/09 10:58:33. and any applicable FAR provisions, for example, FAR 52.227-19.
I. 10/09 10:58:33. 
I. 10/09 10:58:33. Copyright 1989-2000 Sybase, Inc. All rights reserved.
I. 10/09 10:58:33. All unpublished rights reserved.
I. 10/09 10:58:33. 
I. 10/09 10:58:33. Sybase, Inc. 6475 Christie Avenue, Emeryville, CA 94608, USA
I. 10/09 10:58:33. Networked Seat (per-seat) model. Access to the server is limited to 99 seat(s).
I. 10/09 10:58:33. This server is licensed to:
I. 10/09 10:58:33.  lb
I. 10/09 10:58:33.  
I. 10/09 10:58:33. 10240K of memory used for caching
I. 10/09 10:58:33. Minimum cache size: 10240K, maximum cache size: 230848K
I. 10/09 10:58:33. Using a maximum page size of 1024 bytes
I. 10/09 10:58:33. Starting database "XXXXXXX" (C:Program Filessybase数据服务器XXXXXXX.db) at Sun Oct 09 2005 10:58
I. 10/09 10:58:33. Database recovery in progress
I. 10/09 10:58:33.  Last checkpoint at Sat Oct 08 2005 19:15
I. 10/09 10:58:33.  Checkpoint log...
I. 10/09 10:58:55.  Transaction log: XXXXXXX.LOG...
E. 10/09 10:58:55. Error: Cannot open transaction log file -- Can't use log file "XXXXXXX.LOG" since it is shorter than expected
I. 10/09 10:58:55. Error: Cannot open transaction log file -- Can't use log file "XXXXXXX.LOG" since it is shorter than expected
E. 10/09 10:58:55. Cannot open transaction log file -- Can't use log file "XXXXXXX.LOG" since it is shorter than expected
I. 10/09 10:58:57. Database server stopped at Sun Oct 09 2005 10:58

答:首先要确定的一点:直接删除日志的方法是不可取的。您的这个问题,是因为日志没有及时整理导致自身过大,使数据库不能正常启动。

我们知道,SYBASE SQL Server用事务(Transaction)来跟踪所有数据库的变化。事务是SQL Server的工作单元。一个事务包含一条或多条作为整体执行的T-SQL语句。每个数据库都有自己的事务日志(Transaction Log),即系统表(Syslogs)。事务日志自动记录每个用户发出的每个事务。日志对于数据库的数据安全性、完整性至关重要,我们进行数据库开发和维护必须熟知日志的相关知识。

一、SYBASE SQL Server 如何记录和读取日志信息

SYBASE SQL Server是先记Log的机制。每当用户执行将修改数据库的语句时,SQL Server就会自动地把变化写入日志。一条语句所产生的所有变化都被记录到日志后,它们就被写到数据页在缓冲区的拷贝里。该数据页保存在缓冲区中,直到别的数据页需要该内存时,该数据页才被写到磁盘上。若事务中的某条语句没能完成,SQL Server将回滚事务产生的所有变化。这样就保证了整个数据库系统的一致性和完整性。

二、日志设备

Log和数据库的Data一样,需要存放在数据库设备上,可以将Log和Data存放在同一设备上,也可以分开存放。一般来说,应该将一个数据库的Data和Log存放在不同的数据库设备上。这样做有如下好处:一是可以单独地备份Backup事务日志;二是防止数据库溢满;三是可以看到Log的空间使用情况。

所建Log设备的大小,没有十分精确的方法来确定。一般来说,对于新建的数据库,Log的大小应为数据库大小的30%左右。Log的大小还取决于数据库修改的频繁程度。如果数据库修改频繁,则Log的增长十分迅速。所以说Log空间大小依赖于用户是如何使用数据库的。此外,还有其它因素影响Log大小,我们应该根据实际操作情况估计Log大小,并间隔一段时间就对Log进行备份和清除。

1 2  下一页

Tags:Sybase 数据库 日志

编辑录入:爽爽 [复制链接] [打 印]
赞助商链接