SQL ServerʵÏÖÊý¾Ý¿â¶¨Ê±×Ô¶¯±¸·Ý
ÔÚSQL ServerÖгöÓÚÊý¾Ý°²È«µÄ¿¼ÂÇ£¬ËùÒÔÐèÒª¶¨Æڵı¸·ÝÊý¾Ý¿â¡£¶ø±¸·ÝÊý¾Ý¿âÒ»°ãÓÖÊÇÔÚÁ賿ʱ¼ä»ù±¾Ã»ÓÐÊý¾Ý¿â²Ù×÷µÄʱºò½øÐУ¬ËùÒÔÎÒÃDz»¿ÉÄÜÒªÇó¹ÜÀíԱÿÌìÊص½ÍíÉÏ1µãÈ¥±¸·ÝÊý¾Ý¿â¡£ÒªÊµÏÖÊý¾Ý¿âµÄ¶¨Ê±×Ô¶¯±¸·Ý£¬×î³£Óõķ½Ê½¾ÍÊÇʹÓÃSQL Server´úÀíÖеÄ×÷Òµ¡£Æô¶¯SQL Server Agent·þÎñ£¬È»ºóÔÚÆäÖÐн¨×÷Òµ£¬×÷ÒµÖÐÌí¼Ó1¸ö±¸·Ý²½Ö裬ÀàÐÍÊÇT-SQL½Å±¾£¬È»ºóÔÚÃüÁîÖÐÊäÈëÈçÏÂSQLÓï¾ä£¬¸ÃÓï¾äʵÏÖÁ˶ÔÊý¾Ý¿âTestDB1µÄÍêÕû±¸·Ý£¬±¸·ÝÎļþÔÚCÅÌBackupÎļþ¼ÐÖУ¬ÎļþÃû¾ÍÊÇTestDB1+µ±Ê±±¸·ÝµÄÈÕÆÚ×Ö·û´®.bak¡£
declare @name varchar(250)
set @name='C:\Backup\TestDB1_'+
convert(varchar(50),getdate(),112)+'.bak'
BACKUP DATABASE [TestDB1] TO
DISK = @name
WITH NOFORMAT, NOINIT,
NAME = N'TestDB1-ÍêÕû Êý¾Ý¿â ±¸·Ý',
SKIP, NOREWIND, NOUNLOAD
´´½¨ºÃ²½ÖèÒԺ󣬽ÓÏÂÀ´¾ÍÊÇ´´½¨¼Æ»®£¬´´½¨¼Æ»®µÄ²Ù×÷Ê®·Ö¼òµ¥£¬½çÃæÉÏ˵Ã÷µÄºÜÏêϸÁË£¬ÎҾͲ»¶à˵ÁË¡£ÁíÍ⻹¿ÉÒÔÅäÖþ¯±¨ºÍ֪ͨ£¬²»¹ýÒ»°ãºÜÉÙÓÃÕâ¸ö¡£
ʹÓÃSQL×÷ÒµÖÐÖ´ÐÐSQL½Å±¾½øÐб¸·ÝµÄ·½·¨ËäÈ»ÒѾºÜ¼òµ¥ÁË£¬µ«ÊÇÖÁÉÙ»¹ÊÇҪȥдBACKUP½Å±¾£¬ÕâµãÓÐЩÈ˾õµÃ²»Ë¬£¬ÄÇÓÐûÓиü¼òµ¥£¬¸üÀÁµÄ·½·¨À´ÊµÏÖÊý¾Ý¿âµÄ×Ô¶¯¶¨Ê±±¸·ÝÄØ£¿ÓУ¬ÄǾÍÊǓά»¤¼Æ»®”¡£
“ά»¤¼Æ»®”ÊÇÔÚSSMSµÄ¶ÔÏó×ÊÔ´¹ÜÀíÖГ¹ÜÀ픽ڵãÏÂÃ档ʹÓÃά»¤¼Æ»®¿ÉÒÔͨ¹ý¿ÉÊÓ»¯µÄ²Ù×÷£¬Ö»µãµãÊó±ê¾Í¿ÉÒÔ´´½¨Êý¾Ý¿âά»¤µÄSSIS°ü£¬È»ºóÈÔÈ»ÊÇͨ¹ýSQL Server×÷ÒµµÄ·½Ê½À´ÔËÐС£Î¬»¤¼Æ»®ÓëÇ°Ãæ˵µ½µÄ±¸·Ý·½·¨±¾ÖʵIJ»Í¬¾ÍÊÇ£ºÎ¬»¤¼Æ»®ÊÇSSIS°ü£¬ÉÏÃæµÄÊÇT-SQL½Å±¾¡£
¼ÙÉèÎÒÃÇÏÖÔÚÓÐÒ»¸öÉú²úϵͳµÄÊý¾Ý¿âÐèÒª½øÐб¸·Ý£¬ÓÉÓÚÊý¾Ý¿âÖеÄÊý¾ÝºÜ¶à£¬Êý¾ÝÎļþºÜ´ó£¬Èç¹ûÿ´Î¶¼½øÐÐÍêÕû±¸·ÝÄÇôӲÅÌÕ¼ÓÃÁ˺ܴó¿Õ¼ä£¬¶øÇÒ±¸·Ýʱ¼äºÜ³¤£¬Î¬»¤ÆðÀ´Ò²ºÜÂé·³¡£¶Ô´ËÎÒÃÇ¿ÉÒÔ²ÉÓÃÍêÕû±¸·Ý+²îÒ챸·ÝµÄ·½Ê½£¬Ã¿ÖÜÈÕ½øÐÐÒ»´ÎÍêÕû±¸·Ý£¬Ã¿ÌìÍíÉϽøÐÐÒ»´Î²îÒ챸·Ý¡£Ê¹ÓòîÒ챸·Ý¿ÉÒÔ¼õС±¸·ÝÎļþµÄ´óС£¬Í¬Ê±»¹¿ÉÒÔÌá¸ß±¸·ÝµÄËٶȣ¬²»¹ýȱµã¾ÍÊDZØÐëʹÓÃÉÏÒ»´ÎÍêÕû±¸·ÝµÄÎļþºÍ²îÒ챸·ÝµÄÎļþ²ÅÄÜ»¹Ô²îÒ챸·Ýʱ¿ÌµÄÊý¾Ý¿â£¬µ¥¶ÀÖ»ÓвîÒ챸·ÝÎļþÊÇûÓÐÒâÒå¡£
ÏÂÃæÎÒÀ´½²Ò»ÏÂÈçºÎͨ¹ýά»¤¼Æ»®À´ÊµÏÖÍêÕû±¸·Ý+²îÒ챸·Ý£º
£¨1£©ÔÚSSMSµÄ¶ÔÏó×ÊÔ´¹ÜÀíÆ÷ÖÐÓÒ»÷“ά»¤¼Æ»®”£¬Ñ¡Ôñ“ά»¤¼Æ»®Ï
Ïà¹ØÎĵµ£º
ʹÓÃscott/tigerÓû§ÏµÄemp±íºÍdept±íÍê³ÉÏÂÁÐÁ·Ï°£¬±íµÄ½á¹¹ËµÃ÷ÈçÏÂ
empÔ±¹¤±í(empnoÔ±¹¤ºÅ/enameÔ±¹¤ÐÕÃû/job¹¤×÷/mgrÉϼ¶±àºÅ/hiredateÊܹÍÈÕÆÚ/salн½ð/commÓ¶½ð/deptno²¿ÃűàºÅ)
dept²¿Ãűí(deptno²¿ÃűàºÅ/dname²¿ÃÅÃû³Æ/locµØµã)
¹¤×Ê £½ н½ð £« Ó¶½ð
1£®ÁгöÖÁÉÙÓÐÒ»¸öÔ±¹¤µÄËùÓв¿ÃÅ
2£®Áгöн½ð±È& ......
ÔÚÒøÐнðÈÚϵͳÖУ¬ÎÒÃdz£³£¶¼ÒªÊµÏÖÒøÐÐתÕËÕâÑùµÄÒµÎñ²Ù×÷£¬¶øÕâÖÖ½ðÈÚϵͳ²¢·¢ÐÔÏ൱¸ß£¬ÐèÒª¿¼ÂǵÄÈçºÎÌá¸ßÐÔÄܺͱ£Ö¤°²È«ÐÔµÈÏà¹ØµÄÎÊÌ⡣ʹÓô洢¹ý³ÌÀ´ÊµÏÖÒøÐÐתÕËÊÇÒ»¸öºÜºÃµÄÑ¡Ôñ¡£
SQL SERVERÊý¾Ý¿âÖеĴ洢¹ý³ÌÏà¶ÔÓÚÓ¦ÓóÌÐòÖÐÀ´²Ù×÷Transact-SQLÓïÑÔµÄÓÅȱµã£º
Óŵ㣺
1. & ......
ÈçºÎµ¼Èë.sqlÎļþµ½mysqlÖУ¿
C:\mysql\bin>mysql -u Óû§Ãû -p Êý¾Ý¿âÃû < c:/test.sql (source "c:\adsense.sql" )
ÖмäµÄ¿Õ¸ñÊÇÒ»¸ö¿Õ¸ñλ¡£
ͬʱʹÓÃ200¶àMBµÄsqlÎļþ¡£
ÀýÈ磺
C:\Program Files\MySQL\bin>mysql -u root -p myrosz & ......
Ëæ×ÅB/SģʽӦÓÿª·¢µÄ·¢Õ¹£¬Ê¹ÓÃÕâÖÖģʽ±àдӦÓóÌÐòµÄ³ÌÐòÔ±Ò²Ô½À´Ô½¶à¡£µ«ÊÇÓÉÓÚÕâ¸öÐÐÒµµÄÈëÃÅÃż÷²»¸ß£¬³ÌÐòÔ±µÄˮƽ¼°¾ÑéÒ²²Î²î²»Æ룬Ï൱´óÒ»²¿·Ö³ÌÐòÔ±ÔÚ±àд´úÂëµÄʱºò£¬Ã»ÓжÔÓû§ÊäÈëÊý¾ÝµÄºÏ·¨ÐÔ½øÐÐÅжϣ¬Ê¹Ó¦ÓóÌÐò´æÔÚ°²È«Òþ»¼¡£Óû§¿ÉÒÔÌá½»Ò»¶ÎÊý¾Ý¿â²éѯ´úÂ룬¸ù¾Ý³ÌÐò·µ»ØµÄ½á¹û£¬»ñµÃijР......
´Ó sql server 2000 ÖÐÌáÈ¡×Ö¶Î˵Ã÷ÎÄ×Ö
SELECT
[Table Name] = i_s.TABLE_NAME,
[Column Name] = i_s.COLUMN_NAME,
[Description] = s.value
from
INFORMATION_SCHEMA.COLUMNS i_s
LEFT OUTER JOIN ......