SQL 2000 無logÎļþ»Ö復
ÓÉÓÚÖÖÖÖÔÒò£¬ÎÒÃÇÈç¹ûµ±Ê±½ö½ö±¸·ÝÁËmdfµµ£¬ÄÇô»Ö¸´ÆðÀ´¾ÍÊÇÒ»¼þºÜÂé·³µÄÊÂÇéÁË¡£
Èç¹ûÄúµÄmdfµµÊǵ±Ç°×ÊÁÏ¿â²úÉúµÄ£¬ÄÇôºÜ½ÄÐÒ£¬Ò²ÐíÄãʹÓÃsp_attach_db»òÕßsp_attach_single_file_db¿ÉÒÔ»Ö¸´×ÊÁϿ⣬µ«ÊÇ»á³öÏÖÀàËÆÏÂÃæµÄÌáʾ×ÊѶ
É豸Æô¶¯´íÎó¡£ÎïÀíµµ°¸Ãû 'C:\Program Files\Microsoft SQL Server\MSSQL\data\test_Log.LDF' ¿ÉÄÜÓÐÎó¡£
ÒÑ´´½¨ÃûΪ 'C:\Program Files\Microsoft SQL Server\MSSQL\Data\test_log.LDF' µÄÐÂÈÕÖ¾µµ¡£
µ«ÊÇ£¬Èç¹ûÄúµÄ×ÊÁÏ¿âµµÊÇ´ÓÆäËûµçÄÔÉϸ´ÖƹýÀ´µÄ£¬ÄÇôºÜ²»ÐÒ£¬Ò²ÐíÉÏÊö°ì·¨¾ÍÐв»Í¨ÁË¡£ÄãÒ²Ðí»áµÃµ½ÀàËÆÏÂÃæµÄ´íÎó×ÊѶ
ËÅ·þÆ÷: ÏûÏ¢ 1813£¬¼¶±ð 16£¬×´Ì¬ 2£¬ÐÐ 1
δÄÜ´ò¿ªÐÂ×ÊÁÏ¿â 'test'¡£CREATE DATABASE ½«ÖÕÖ¹¡£
É豸Æô¶¯´íÎó¡£ÎïÀíµµ°¸Ãû 'd:\test_log.LDF' ¿ÉÄÜÓÐÎó¡£
Ôõô°ìÄØ£¿±ð׿±£¬ÏÂÃæÎÒÃǾÙÀý˵Ã÷»Ö¸´°ì·¨¡£
A£®ÎÒÃÇʹÓÃÔ¤É跽ʽ½¨Á¢Ò»¸ö¹©»Ö¸´Ê¹ÓõÄ×ÊÁÏ¿â(Èçtest)¡£¿ÉÒÔÔÚSQL Server Enterprise ManagerÀïÃ潨Á¢¡£
B£®Í£µô×ÊÁÏ¿âËÅ·þÆ÷¡£
C£®½«¸Õ²Å²úÉúµÄ×ÊÁÏ¿âµÄÈÕÖ¾µµtest_log.ldfɾ³ý£¬ÓÃÒª»Ö¸´µÄ×ÊÁÏ¿âmdfµµ¸²¸Ç¸Õ²ÅÉú³ÉµÄ×ÊÁÏ¿â×ÊÁϵµ°¸test_data.mdf¡£
D£®Æô¶¯×ÊÁÏ¿âËÅ·þÆ÷¡£´Ëʱ»á¿´µ½×ÊÁÏ¿âtestµÄ״̬Ϊ“´íÎó”¡£Õâʱºò²»ÄܶԴË×ÊÁÏ¿â½øÐÐÈκβÙ×÷¡£
E£®ÉèÖÃ×ÊÁÏ¿âÔÊÐíÖ±½Ó×÷ҵϵͳ±í¡£´Ë²Ù×÷¿ÉÒÔÔÚSQL Server Enterprise ManagerÀïÃæÑ¡Ôñ×ÊÁÏ¿âËÅ·þÆ÷£¬°´ÓÒ¼ü£¬Ñ¡Ôñ“ÊôÐÔ”£¬ÔÚ“ËÅ·þÆ÷ÉèÖÔҳÃæÖн«“ÔÊÐí¶ÔϵͳĿ¼ֱ½ÓÐ޸ĔһÏîÑ¡ÖС£Ò²¿ÉÒÔʹÓÃÈçÏÂÓï¾äÀ´ÊµÏÖ¡£
use master
go
sp_configure 'allow updates',1
go
reconfigure with override
go
F£®ÉèÖÃtestΪ½ô¼±ÐÞ¸´Ä£Ê½
update sysdatabases set status=-32768 where dbid=DB_ID('test')
´Ëʱ¿ÉÒÔÔÚSQL Server Enterprise ManagerÀïÃæ¿´µ½¸Ã×ÊÁÏ¿â´¦ÓړΨ¶Á\ÖÃÒÉ\ÍÑ»ú\½ô¼±Ä£Ê½”¿ÉÒÔ¿´µ½×ÊÁÏ¿âÀïÃæµÄ±í£¬µ«Êǽö½öÓÐϵͳ±í
G£®ÏÂÃæÖ´ÐÐÕæÕýµÄ»Ö¸´²Ù×÷£¬Öؽ¨×ÊÁÏ¿âÈÕÖ¾µµ
dbcc rebuild_log('test','C:\Program Files\Microsoft SQL Server\MSSQL\Data\test_log.ldf')
Ö´Ðйý³ÌÖУ¬Èç¹ûÓöµ½ÏÂÁÐÌáʾ×ÊѶ£º
Ë
Ïà¹ØÎĵµ£º
1. ¸´ÖƱí½á¹¹
Sql´úÂë
1. select * into B from A where 1=0;
select * into B from A where 1=0;
2.¸´ÖƱí¼Ç¼ ¸´ÖÆijЩ×Ö¶Î
Sql´úÂë
1. insert into B(a, b, c) select d, e, f from A;
insert into B(a, b, c) select d, e, f from A;
¸´Ö ......
asc °´ÉýÐòÅÅÁÐ
desc °´½µÐòÅÅÁÐ
ÏÂÁÐÓï¾ä²¿·ÖÊÇMssqlÓï¾ä£¬²»¿ÉÒÔÔÚaccessÖÐʹÓá£
SQL·ÖÀࣺ
DDL—Êý¾Ý¶¨ÒåÓïÑÔ(CREATE£¬ALTER£¬DROP£¬DECLARE)
DML—Êý¾Ý²Ù×ÝÓïÑÔ(SELECT£¬DELETE£¬UPDATE£¬INSERT)
DCL—Êý¾Ý¿ØÖÆÓïÑÔ(GRANT£¬REVOKE£¬COMMIT£¬ROLLBACK)
Ê×ÏÈ,¼òÒª½éÉÜ»ù´¡Óï¾ä£º
1¡¢ËµÃ÷£º´´½¨Êý ......
SQLÌṩÁËËÄÖÖÄ£ºýÆ¥Å䷽ʽ
1£¬%£º±íʾÈÎÒâ0¸ö»ò¶à¸ö×Ö·û¡£¿ÉÆ¥ÅäÈÎÒâÀàÐͺͳ¤¶ÈµÄ×Ö·û£¬ÓÐЩÇé¿öÏÂÈôÊÇÖÐÎÄ£¬ÇëÔËÓÃÁ½¸ö°Ù·ÖºÅ£¨%%£©±íʾ¡£
±ÈÈç SELECT * from [user] WHERE u_name LIKE '%Èý%'
½«»á°Ñu_nameΪ“ÕÅÈý”£¬“ÕÅèÈý”¡¢“Èý½Å蔣¬“ÌÆÈý²Ø”µÈµÈÓГÈý& ......
1¡¢±à³ÌÓïÑÔÓëOracleÊý¾Ý¿â
1.1¡¢´æ´¢µÄÓëÄäÃûµÄPL/SQL³ÌÐò¿é
Óë´æ´¢µÄPL/SQL³ÌÐò¿éÏà±È£¬ÄäÃûµÄPL/SQL³ÌÐò¿éЧÂʽϵͣ¬´ËÍâÓÉÓÚ¿ÉÄÜÔÚ¶ą̀»úÆ÷Öй«²¼Ô´´úÂ룬»¹»áÒý·¢¹ÜÀíÎÊÌâ¡£
1.2¡¢PL/SQL¶ÔÏó
PL/SQL¶ÔÏó¾ßÓÐÏÂÁÐ5ÖÖÀàÐÍ£º
¹ý³Ì
º¯Êý
³ÌÐò°ü
³ÌÐò°üÖ÷Ìå
´¥·¢Æ÷
2¡¢¹ý³Ì¡¢º¯ÊýÒÔ¼°³ÌÐò°ü
2.1¡¢¹ý³ÌÓëº¯Ê ......
MDX º¯Êý²Î¿¼
SQL Server 2008 Áª»ú´ÔÊ飨2009 Äê 7 Ô£©
MDX º¯Êý²Î¿¼ (MDX)
Microsoft SQL Server Analysis Services ÔÊÐíÔÚ¶àά±í´ïʽ (MDX) Óï·¨ÖÐʹÓú¯Êý¡£º¯Êý¿ÉÒÔÔÚÈκÎÓÐЧµÄ MDX Óï¾äÖÐʹÓ㬲¢ÇÒ¾³£ÓÃÓÚ²éѯ¡¢×Ô¶¨Òå»ã×ܶ¨ÒåÒÔ¼°ÆäËû¼ÆËã¡£ ±¾½Ú½éÉÜ Analysis Services ¸½´øµÄ MDX º¯Êý¡£
¿ÉÒÔʹÓÃÏÂÃæÕâÐ ......