SQL Server2000ÖУ¬Èç¹ûÊý¾Ý¿âÎļþ£¨·ÇϵͳÊý¾Ý¿âÎļþ£©Óöµ½´íÎóµÄʱºò£¬ÎÒÃǸÃÔõô°ì¡£ÒÔÏÂÊDZÊÕßÒÔÇ°µÄ±Ê¼Ç¡£½öÊÊÓÃÓÚ·Çmaster,msdbµÄÊý¾Ý¿â¡£
˵Ã÷ÈçÏ£º
1 ½¨Ò»¸ö²âÊÔÊý¾Ý¿âtest(Êý¾Ý¿âÀàÐÍΪÍêÈ«) 2 ½¨Ò»¸ö±í£¬²åÈëµã¼Ç¼ create table a(c1 varchar(2)) go insert into a values('aa') go insert into a values('bb') go 3 ×÷ÍêÈ«±¸·Ý£¬µ½Îļþtest_1.bak 4 ÔÚ×÷Ò»µãÐÞ¸Ä insert into a values('cc') go create table b(c1 int) go insert into b values(1) go insert into b values(2) go 5 shutdown Êý¾Ý¿â·þÎñÆ÷ 6 ÓÃultraedit±à¼Êý¾Ý¿âÎļþtest_data.mdf,Ëæ±ãÐ޸ĵã×Ö½ÚÄÚÈÝ,Ï൱ÓÚÊý¾Ý¿âÔâµ½ÖÂÃüµÄË𻵡£ 7 Æô¶¯Êý¾Ý¿â£¬²¢ÇÒÔËÐÐÆóÒµ¹ÜÀíÆ÷£¬µã¿ªÊý¾Ý¿â£¬¿´µ½test±ä³É»ÒÉ«£¬¶øÇÒÏÔʾÖÃÒÉ¡£ 8 ÔËÐÐisql -SLocalhost -Usa -P 1> backup log test TO DISK='D:Program FilesMicrosoft SQL ServerMSSQLBACKUP est_2.bak' WITH NO_TRUNCATE 2>go ÒÑ´¦Àí 2 Ò³£¬ÕâЩҳÊôÓÚÊý¾Ý¿â 'test' µÄÎļþ 'TEST_Log'£¨Î»ÓÚÎļþ 1 ÉÏ£©¡£ BACKUP LOG ²Ù×÷³É¹¦µØ´¦ÀíÁË 2 Ò³£¬»¨·ÑÁË 0.111 Ã루0.087 MB/Ã룩¡£
9 ½øÐлָ´×îÀϵÄÍêÈ«±¸·Ý 1> RESTORE DATABASE test FROM DISK='D:Program FilesMicrosoft SQL ServerMSSQL BACKUP est_1.bak' WITH NORECOVERY 2> go ÒÑ´¦Àí 96 Ò³£¬ÕâЩҳÊôÓÚÊý¾Ý¿â 'test' µÄÎļþ 'TEST_Data'£¨Î»ÓÚÎļþ 1 ÉÏ£©¡£ ÒÑ´¦Àí 1 Ò³£¬ÕâЩҳÊôÓÚÊý¾Ý¿â 'test' µÄÎļþ 'TEST_Log'£¨Î»ÓÚÎļþ 1 ÉÏ£©¡£ RESTORE DATABASE ²Ù×÷³É¹¦µØ´¦ÀíÁË 97 Ò³£¬»¨·ÑÁË 0.107 Ã루7.368 MB/Ã룩¡£
10 »Ö¸´×î½üµÄÈÕÖ¾ 1> RESTORE LOG test FROM DISK='D:Program FilesMicrosoft SQL ServerMSSQLBACKU P est_2.bak' WITH RECOVERY 2> go ÒÑ´¦Àí 2 Ò³£¬ÕâЩҳÊôÓÚÊý¾Ý¿â 'test' µÄÎļþ 'TEST_Log'£¨Î»ÓÚÎļþ 1 ÉÏ£©¡£ RESTORE LOG ²Ù×÷³É¹¦µØ´¦ÀíÁË 2 Ò³£¬»¨·ÑÁË 0.056 Ã루0.173 MB/Ã룩¡£
Êý¾ÝÒѾÍêÈ«»Ö¸´ÁË£¬¿ÉÒÔʹÓÃÁË¡£ select * from a go
×ܽᣬDBAÓ¦¸ÃÓÐÒ»¸öÍêÉƵÄÊý¾Ý¿â±¸·Ý¼Æ»®¡£±¾ÀýÖУ¬Èç¹ûûÓÐÒ»¸öÍêÈ«±¸·ÝµÄ»°£¬Êý¾Ý¿âµÄ»Ö¸´¾Í²»¿ÉÄÜ¡£ |