ºìÁªLinuxÃÅ»§
Linux°ïÖú

SybaseÊý¾Ý¿âÈÕÖ¾¹ý´óµ¼Ö²»ÄÜÆô¶¯

·¢²¼Ê±¼ä:2006-10-24 00:43:33À´Ô´:ºìÁª×÷Õß:ckernel
¡¡¡¡ÎÊ£ºÓиöÎÊÌâÎÊһϣ¬¹ØÓÚSYBASEµÄ£ºÎÒ´ò¿ªÊý¾Ý¿â×ÜÊÇÌáÐÑ£ºcannot open transaction log file-----cannot use log file "hms2000.log" since it is shorter than experted¡£ÎÒÖ±½Óɾ³ýÁËÈÕÖ¾£¬Ò²²»ÄÜÕý³£Æô¶¯£¬ËµÕÒ²»µ½Îļþ¡£

¡¡¡¡ÇëÎÊÕâÊÇÔõô»ØÊ°¡£¿¸½Éϳö´íµÄÈÕÖ¾¼Ç¼£º

[code]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 Files\sybase\Êý¾Ý·þÎñÆ÷\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 Files\sybase\Êý¾Ý·þÎñÆ÷\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[/code]

¡¡¡¡´ð£ºÊ×ÏÈҪȷ¶¨µÄÒ»µã£ºÖ±½Óɾ³ýÈÕÖ¾µÄ·½·¨ÊDz»¿ÉÈ¡µÄ¡£ÄúµÄÕâ¸öÎÊÌ⣬ÊÇÒòΪÈÕ־ûÓм°Ê±ÕûÀíµ¼ÖÂ×ÔÉí¹ý´ó£¬Ê¹Êý¾Ý¿â²»ÄÜÕý³£Æô¶¯¡£

¡¡¡¡ÎÒÃÇÖªµÀ£¬SYBASE¡¡SQL ServerÓÃÊÂÎñ£¨Transaction£©À´¸ú×ÙËùÓÐÊý¾Ý¿âµÄ±ä»¯¡£ÊÂÎñÊÇSQL¡¡ServerµÄ¹¤×÷µ¥Ôª¡£Ò»¸öÊÂÎñ°üº¬Ò»Ìõ»ò¶àÌõ×÷ΪÕûÌåÖ´ÐеÄT -SQLÓï¾ä¡£Ã¿¸öÊý¾Ý¿â¶¼ÓÐ×Ô¼ºµÄÊÂÎñÈÕÖ¾£¨Transaction¡¡Log£©£¬¼´ÏµÍ³±í£¨Syslogs£©¡£ÊÂÎñÈÕÖ¾×Ô¶¯¼Ç¼ÿ¸öÓû§·¢³öµÄÿ¸öÊÂÎñ¡£ÈÕÖ¾¶ÔÓÚÊý¾Ý¿âµÄÊý¾Ý°²È«ÐÔ¡¢ÍêÕûÐÔÖÁ¹ØÖØÒª£¬ÎÒÃǽøÐÐ

¡¡¡¡Êý¾Ý¿â¿ª·¢ºÍά»¤±ØÐëÊìÖªÈÕÖ¾µÄÏà¹ØÖªÊ¶¡£

¡¡¡¡Ò»¡¢SYBASE¡¡SQL Server ÈçºÎ¼Ç¼ºÍ¶ÁÈ¡ÈÕÖ¾ÐÅÏ¢

¡¡¡¡SYBASE¡¡SQL ServerÊÇÏȼÇLogµÄ»úÖÆ¡£Ã¿µ±Óû§Ö´Ðн«ÐÞ¸ÄÊý¾Ý¿âµÄÓï¾äʱ£¬SQL¡¡Server¾Í»á×Ô¶¯µØ°Ñ±ä»¯Ð´ÈëÈÕÖ¾¡£Ò»ÌõÓï¾äËù²úÉúµÄËùÓб仯¶¼±»¼Ç¼µ½ÈÕÖ¾ºó£¬ËüÃǾͱ»Ð´µ½Êý¾ÝÒ³ÔÚ»º³åÇøµÄ¿½±´Àï¡£¸ÃÊý¾ÝÒ³±£´æÔÚ»º³åÇøÖУ¬Ö±µ½±ðµÄÊý¾ÝÒ³ÐèÒª¸ÃÄÚ´æÊ±£¬¸ÃÊý¾ÝÒ³²Å±»Ð´µ½´ÅÅÌÉÏ¡£ÈôÊÂÎñÖеÄijÌõÓï¾äûÄÜÍê³É£¬SQL¡¡Server½«»Ø¹öÊÂÎñ²úÉúµÄËùÓб仯¡£ÕâÑù¾Í±£Ö¤ÁËÕû¸öÊý¾Ý¿âϵͳµÄÒ»ÖÂÐÔºÍÍêÕûÐÔ¡£

¡¡¡¡¶þ¡¢ÈÕÖ¾É豸

¡¡¡¡LogºÍÊý¾Ý¿âµÄDataÒ»Ñù£¬ÐèÒª´æ·ÅÔÚÊý¾Ý¿âÉ豸ÉÏ£¬¿ÉÒÔ½«LogºÍData´æ·ÅÔÚͬһÉ豸ÉÏ£¬Ò²¿ÉÒÔ·Ö¿ª´æ·Å¡£Ò»°ãÀ´Ëµ£¬Ó¦¸Ã½«Ò»¸öÊý¾Ý¿âµÄ DataºÍLog´æ·ÅÔÚ²»Í¬µÄÊý¾Ý¿âÉ豸ÉÏ¡£ÕâÑù×öÓÐÈçϺô¦£ºÒ»ÊÇ¿ÉÒÔµ¥¶ÀµØ±¸·Ý?Backup¡¡ÊÂÎñÈÕÖ¾£»¶þÊÇ·ÀÖ¹Êý¾Ý¿âÒçÂú£»ÈýÊÇ¿ÉÒÔ¿´µ½LogµÄ¿Õ¼äʹÓÃÇé¿ö¡£

¡¡¡¡Ëù½¨LogÉ豸µÄ´óС£¬Ã»ÓÐÊ®·Ö¾«È·µÄ·½·¨À´È·¶¨¡£Ò»°ãÀ´Ëµ£¬¶ÔÓÚн¨µÄÊý¾Ý¿â£¬LogµÄ´óСӦΪÊý¾Ý¿â´óСµÄ30% ×óÓÒ¡£LogµÄ´óС»¹È¡¾öÓÚÊý¾Ý¿âÐÞ¸ÄµÄÆµ·±³Ì¶È¡£Èç¹ûÊý¾Ý¿âÐÞ¸ÄÆµ·±£¬ÔòLogµÄÔö³¤Ê®·ÖѸËÙ¡£ËùÒÔ˵Log¿Õ¼ä´óСÒÀÀµÓÚÓû§ÊÇÈçºÎʹÓÃÊý¾Ý¿âµÄ¡£´ËÍ⣬»¹ÓÐÆäËüÒòËØÓ°ÏìLog´óС£¬ÎÒÃÇÓ¦¸Ã¸ù¾Ýʵ¼Ê²Ù×÷Çé¿ö¹À¼ÆLog´óС£¬²¢¼ä¸ôÒ»¶Îʱ¼ä¾Í¶ÔLog½øÐб¸·ÝºÍÇå³ý¡£

¡¡¡¡Èý¡¢ÈÕÖ¾µÄÇå³ý

¡¡¡¡Ëæ×ÅÊý¾Ý¿âµÄʹÓã¬Êý¾Ý¿âµÄLogÊDz»¶ÏÔö³¤µÄ£¬±ØÐëÔÚËüÕ¼Âú¿Õ¼ä֮ǰ½«ËüÃÇÇå³ýµô¡£Çå³ýLogÓÐÁ½ÖÖ·½·¨£º

¡¡¡¡1.×Ô¶¯Çå³ý·¨

¡¡¡¡¿ª·ÅÊý¾Ý¿âÑ¡Ïî Trunc Log on Chkpt£¬Ê¹Êý¾Ý¿âϵͳÿ¸ôÒ»¶Îʱ¼ä×Ô¶¯Çå³ýLog¡£´Ë·½·¨µÄÓŵãÊÇÎÞÐëÈ˹¤¸ÉÔ¤£¬ÓÉSQL¡¡Server×Ô¶¯Ö´ÐУ¬²¢ÇÒÒ»°ã²»»á³öÏÖLogÒçÂúµÄÇé¿ö£»È±µãÊÇÖ»Çå³ýLog¶ø²»×ö±¸·Ý¡£

¡¡¡¡2.ÊÖ¶¯Çå³ý·¨

¡¡¡¡Ö´ÐÐÃüÁî¡°dump transaction¡±À´Çå³ýLog¡£ÒÔÏÂÁ½ÌõÃüÁî¶¼¿ÉÒÔÇå³ýÈÕÖ¾£º

[code]dump transaction with truncate_only
dump transaction with no_log[/code]

¡¡¡¡Í¨³£É¾³ýÊÂÎñÈÕÖ¾Öв»»îÔ¾µÄ²¿·Ö¿ÉʹÓá°dump transaction with trancate_only¡±ÃüÁÕâÌõÃüÁîд½øÊÂÎñÈÕ־ʱ£¬»¹Òª×ö±ØÒªµÄ²¢·¢ÐÔ¼ì²é¡£SYBASEÌṩ¡°dump transaction with no_log¡±À´´¦ÀíijЩ·Ç³£½ôÆÈµÄÇé¿ö£¬Ê¹ÓÃÕâÌõÃüÁîÓкܴóµÄΣÏÕÐÔ£¬SQL¡¡Server»áµ¯³öÒ»Ìõ¾¯¸æÐÅÏ¢¡£ÎªÁ˾¡Á¿È·±£Êý¾Ý¿âµÄÒ»ÖÂÐÔ£¬ÄãÓ¦½«Ëü×÷Ϊ¡°×îºóÒ»ÕС±¡£

¡¡¡¡ÒÔÉÏÁ½ÖÖ·½·¨Ö»ÊÇÇå³ýÈÕÖ¾£¬¶ø²»×öÈÕÖ¾±¸·Ý£¬ÈôÏ뱸·ÝÈÕÖ¾£¬Ó¦Ö´ÐС°dump transaction database_name to dumpdevice¡±ÃüÁî¡£

¡¡¡¡ËÄ¡¢¹ÜÀíÅÓ´óµÄÊÂÎñ

¡¡¡¡ÓÐЩ²Ù×÷»á´óÅúÁ¿µØÐÞ¸ÄÊý¾Ý£¬Èç´óÁ¿Êý¾ÝµÄÐ޸ģ¨Update£©¡¢É¾³ýÒ»¸ö±íµÄËùÓÐÊý¾Ý£¨Delete£©¡¢´óÁ¿Êý¾ÝµÄ²åÈ루Insert£©£¬ÕâÑù»áʹLogÔö³¤ËٶȺܿ죬ÓÐÒçÂúµÄΣÏÕ¡£ÏÂÃæ¸ø´ó¼Ò½éÉÜÒ»ÏÂÈçºÎ²ð·Ö´óÊÂÎñ£¬ÒÔ±ÜÃâÈÕÖ¾µÄÒçÂú¡£

¡¡¡¡ÀýÈçÖ´ÐС°update tab_a set col_a=0¡±ÃüÁîʱ£¬Èô±ítab_aºÜ´ó£¬Ôò´ËUpdate¶¯×÷ÔÚδÍê³É֮ǰ¾Í¿ÉÄÜʹLogÒçÂú£¬ÒýÆð1105´íÎó£¨Log Full£©£¬¶øÇÒÖ´ÐÐÕâÖÖ´óµÄÊÂÎñËù²úÉúµÄ¶ÀÕ¼Ëø£¨Exclusive Table Lock£©£¬»á×èÖ¹ÆäËûÓû§ÔÚÖ´ÐÐUpdate²Ù×÷ÆÚ¼äÐÞ¸ÄÕâ¸ö±í£¬Õâ¾ÍÓпÉÄÜÒýÆðËÀËø¡£Îª±ÜÃâÕâЩÇé¿ö·¢Éú£¬ÎÒÃÇ¿ÉÒÔ°ÑÕâ¸ö´óµÄÊÂÎñ·Ö³É¼¸¸öСµÄÊÂÎñ£¬²¢Ö´ÐС°dump transaction¡±¶¯×÷¡£

¡¡¡¡ÉÏÀýÖеÄÇé¿ö¾Í¿ÉÒÔ·Ö³ÉÁ½¸ö»ò¶à¸öСµÄÊÂÎñ£º

[code]update tab_a set col_a=0 where col_b>x
go
dump transaction database_name with truncate_only
go
update tab_a set col_a=0 where col_b <=x
go
dump transaction database_name with truncate_only
go[/code]

¡¡¡¡ÕâÑù£¬Ò»¸ö´óµÄÊÂÎñ¾Í±»·Ö³ÉÁ½¸ö½ÏСµÄÊÂÎñ¡£

¡¡¡¡°´ÕÕÉÏÊö·½·¨¿ÉÒÔ¸ù¾ÝÐèÒªÈÎÒâ²ð·Ö´óµÄÊÂÎñ¡£ÈôÕâ¸öÊÂÎñÐèÒª±¸·Ýµ½½éÖÊÉÏ£¬Ôò²»Óá°with truncate_only¡±Ñ¡Ïî¡£ÈôÖ´ÐС°dump transaction with truncate_only¡±ÃüÁӦ¸ÃÏÈÖ´ÐС°dump database¡±¡£ÒÔ´ËÀàÍÆ£¬ÎÒÃÇ¿ÉÒÔ¶Ô±íɾ³ý¡¢±í²åÈëµÈ´óÊÂÎñ×öÏàÓ¦µÄ²ð·Ö¡£
ÎÄÕÂÆÀÂÛ

¹²ÓÐ 0 ÌõÆÀÂÛ