Ò׽ؽØͼÈí¼þ¡¢µ¥Îļþ¡¢Ãâ°²×°¡¢´¿ÂÌÉ«¡¢½ö160KB

SQL ServerÊý¾Ý¿âÊÂÎñÈÕÖ¾´æ´¢ÐòÁÐ

Èç¹ûÄãµÄÊý¾Ý¿âÔËÐÐÔÚÍêÕû»òÊÇÅúÁ¿ÈÕÖ¾»Ö¸´Ä£Ê½Ï£¬ÄÇôÄã¾ÍÐèҪʹÓÃ×÷Òµ(job)À´¶¨ÆÚ±¸·ÝÊÂÎñÈÕÖ¾£¬±£³ÖÄãµÄÊÂÎñÎļþ´óС´¦ÔÚÒ»¸ö¿É¹ÜÀíµÄ·¶Î§¡£µ±ÄãÐèÒª»¹Ô­ÊÂÎñÈÕ־ʱ£¬Äã¾ÍÐèÒª°´ÕÕ´´½¨ÊÂÎñÈÕÖ¾µÄ˳ÐòÀ´»Ö¸´ËüÃÇ¡£Äã¿ÉÒԲο¼´æÔÚmsdb..backupset±íÖеÄÐÅÏ¢À´È·¶¨»¹Ô­ÎļþµÄ˳Ðò£¬Ê¹ÓÃFirstLSNºÍLastLSNÁеÄÖµ×÷²Î¿¼¡£µ±Ä㱸·Ýʱ£¬ÕâЩ±¸·ÝÐÅÏ¢¾Í»á´æÔÚbackupset±íÖÐ
Ö»ÒªÐòÁд¦ÓÚά»¤×´Ì¬Ï£¬Äã¾Í¿ÉÒÔʹÓöÔÓ¦µÄÈÕÖ¾°ÑÊý¾Ý»Ö¸´µ½ÈÎÒâ»Ö¸´µãÉÏ¡£²»ÐÒµÄÊÇ£¬ÓÐЩʵÀýµÄÐòÁÐÒѾ­±»Ëð»µÁË¡£ÏÂÃæÁ½ÖÖÇé¿öÆÕͨÊÇÒýÆðË𻵵ÄÔ­Òò£º
Êý¾Ý¿âµÄ»Ö¸´Ä£Ðͱ»Çл»µ½Á˼òµ¥(SIMPLE)ºó£¬Ôٴα»Çл»»ØÍêÕû»òÊÇÅúÁ¿ÈÕÖ¾¡£
Backup logÃüÁîÔËÐÐʱ£¬¸½´øÁËTRUNCATE_ONLY/NO_LOGÑ¡Ïî¡£
µ±ÉÏÃæÁ½ÖÖÇé¿ö·¢Éúʱ£¬ÄãÐèÒª¼´¿É×öÒ»¸öÊý¾Ý¿âµÄÍêÕû±¸·Ý£¬×÷ΪÊÂÎñÈÕÖ¾»Ö¸´µÄеĻָ´µã¡£ÄÇôÄãÈçºÎÅжÏÐòÁÐÒѾ­±»ÆÆ»µÁËÄØ£¿
ÔÚSQL Server 2000ÖУ¬ÕâȷʵÓеãÂé·³¡£¼ÙÈçÊý¾Ý¿â»Ö¸´Ä£ÐÍÒѾ­±»¸ü¸ÄÁË£¬»òÊDZ¸·ÝʱÈÕÖ¾ÒѾ­±»½Ø¶ÏÁË£¬ÄÇôµ±¸ü¸Äºó£¬ÄãµÚÒ»´Î±¸·ÝÊÂÎñÈÕ־ʱ£¬SQL Server 2000»áÏÔʾÈçÏÂÊä³ö£º
There is no current database backup. This log backup cannot be used to roll forward a preceding database backup.
Processed 1 pages for database 'logtest', file 'logtest_log' on file 1.
BACKUP LOG successfully processed 1 pages in 0.078 seconds (0.019 MB/sec).
×¢ÒâÕâ½ö½öÊǸöÏûÏ¢¡£ËäÈ»±¸·ÝÒÀÈ»»á³É¹¦Íê³É£¬µ«È´²»¿ÉÓá£ÒòΪÕâÊǸö¼Æ»®×÷Òµ£¬ËùÒÔÄãʲô¶¼¿´²»µ½£¬²»¹ýµ±ÊÂÎñÈÕÖ¾±»½Ø¶Ïʱ£¬ÔÚWindowsʼþÈÕÖ¾ÖÐÊÇÏà¹Ø¾¯¸æÈÕÖ¾µÄ¡£¡£
×¢Ò⣺Èç¹ûÄãÕýÔÚʹÓÃSQL Server 2000£¬ÄÇôÈÕÖ¾ÊÂÎñ¶ÔÓÚÊý¾Ý¿âÊǷdz£ÖØÒªµÄ£¬ËùÒÔÒªÔÚWindowsʼþÈÕÖ¾Öв»¼ä¶ÏµÄ¼à¿ØÈÕÖ¾ÊÂÎñʼþ¡£
¼ÙÈçÄã¼ÈûÓйØ×¢¾¯¸æÏûÏ¢£¬Ò²Ã»Óмà¿ØWindowsʼþÈÕÖ¾£¬ÄÇô»ù±¾ÉÏÄã¾ÍÊÇÓÐÒ»Åú²»¿É»Ö¸´µÄÊÂÎñÈÕÖ¾±¸·Ý¡£SQL Server²»Ó¦¸Ã¾¯¸æÎÒÃÇÂ𣿲»Ó¦¸ÃÍ£Ö¹ÎÞЧµÄ±¸·ÝÂ𣿼ÙÈçÄãÕýÔÚʹÓÃSQL Server 2005£¬ÄÇô´ð°¸¿Ï¶¨ÊÇÓ¦¸ÃµÄ£¬¶øÇÒËüÒ²ÊÇÕâô×öµÄ¡£ÏÂÃæ¾ÍÊǵ±ÈÕÖ¾±¸·ÝÐòÁб»»Ù»µÊ±ÏÔʾµÄÏûÏ¢:
Server: Msg 4214, Level 16, State 1, Line 1
BACKUP LOG cannot be performed because there is no current database backup.
Server: Msg 3013, Level 16, State 1, Line 1
BACKUP LOG is terminating abnormally.
ÊDz»ÊǺöàÁË¡£×ÜÖ®£¬Èç¹ûÄãÕýÔÚʹÓÃSQL Server 2000£¬ÄãÐèÒª¹Ø×


Ïà¹ØÎĵµ£º

¶¯Ì¬SQLÓï¾ä

¶¯Ì¬Óï¾ä
1 :ÆÕͨSQLÓï¾ä¿ÉÒÔÓÃexecÖ´ÐÐ
Select * from tableName
exec('select * from tableName')
exec sp_executesql N'select * from tableName' -- Çë×¢Òâ×Ö·û´®Ç°Ò»¶¨Òª¼ÓN
2:×Ö¶ÎÃû£¬±íÃû£¬Êý¾Ý¿âÃûÖ®Àà×÷Ϊ±äÁ¿Ê±£¬±ØÐëÓö¯Ì¬SQL
declare @fname varchar(20)
set @fname = 'FiledName'
Select @fnam ......

SQL*LoaderʹÓÃÖ¸ÄÏ

Oracle µÄSQL*LOADER¿ÉÒÔ½«ÍⲿÊý¾Ý¼ÓÔص½Êý¾Ý¿â±íÖС£ÏÂÃæÊÇSQL*LOADERµÄ»ù±¾Ìص㣺
1£©ÄÜ×°È벻ͬÊý¾ÝÀàÐÍÎļþ¼°¶à¸öÊý¾ÝÎļþµÄÊý¾Ý
2£©¿É×°Èë¹Ì¶¨¸ñʽ£¬×ÔÓɶ¨½çÒÔ¼°¿É¶È³¤¸ñʽµÄÊý¾Ý
3£©¿ÉÒÔ×°Èë¶þ½øÖÆ£¬Ñ¹ËõÊ®½øÖÆÊý¾Ý
4£©Ò»´Î¿É¶Ô¶à¸ö±í×°ÈëÊý¾Ý
5£©Á¬½Ó¶à¸öÎïÀí¼Ç¼װµ½Ò»¸ö¼Ç¼ÖÐ
6£©¶ÔÒ»µ¥¼Ç¼·Ö½âÔÙ×°Èëµ½± ......

¸öÈË×ܽáµÄ¼¸Ìõ±È½ÏÓÐÒâ˼µÄsqlÓï¾ä


 
--------------------------------------------------------------------
-- ×÷ÕߣºÕÅ°®¹ú
-- ÈÕÆÚ£º2010-01-23 15:00:17
-- ÃèÊö: һЩ±È½ÏÓÐÒâ˼µÄSQLÓï¾ä
-- Version:
--    Microsoft SQL Server 2005 - 9.00.3042.00 (Intel X86)
--    Feb  9 2007 22:47:0 ......

Èճ̰²ÅÅÉú³ÉµÄsqlÓï¾ä

select *
from
(select [id]=row_number() over (order by getdate()),
        date=convert(varchar(8),dateadd(dd,number,'2010-01-01'),112)
        from
        (select number from master..spt ......

SQL½Å±¾´´½¨±í

if exists(select * from sysobjects where name='atzk')--ÅжÏÊÇ·ñ´æÔڴ˱í
drop table atzk
go
create table atzk
(
  nid int identity(1,1) primary key,--nid×Ô¶¯±àºÅ£¬²¢ÉèΪÖ÷¼ü¡£
  mytitle varchar(50) not null,--֪ͨµÄ±êÌâ¡£
  mycontents varchar(200)--·¢²¼Í¨ÖªµÄÄÚÈÝ¡£
 ) ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØͼ | ¸ÓICP±¸09004571ºÅ