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

SQL Server Óï¾ä

Êý¾Ý¿â£º
1¡¢  ´´½¨Êý¾Ý¿âµÄÓï·¨£º
if exists (select * from sysdatabases where name='DT_name')   /*ÅжÏÊÇ·ñ´æÔÚ£¬ÊÇÔòɾ³ý*/
drop database DT_name
create database database_name
on          primary  /* Ö¸¶¨Ö÷ÒªÎļþ×飬ÆäÖеÚÒ»¸öÖ÷ÒªÎļþ */
(
name = data1,   /* Ö÷Êý¾ÝÎļþµÄÂß¼­Ãû */
filename =‘µØÖ·\data1.mdf’; /* Ö÷Êý¾ÝÎļþµÄÎïÀí µØÖ·¡¢Ãû³Æ */
size = 10MB,    /* ³õʼ´óС*/
maxsize = 100MB,          /* ×î´ó´óС */
filegrowth = 10%          /* Ôö³¤ÂÊ */
),
filegroup group_NAME      /* ·ÇÖ÷ÒªÎļþ×é */
(
name = data2,
filename =‘µØÖ·\data2.ndf’£»
size = 10MB,
maxsize = 100MB,
filegrowth = 10%
)...
log on      /*Ö¸¶¨ÊÂÎñÈÕÖ¾Îļþ*/
(
name = data3,   /* ÈÕÖ¾ÎļþµÄÂß¼­Ãû */
filename =‘µØÖ·\data3.ldf’; /* ÈÕÖ¾ÎļþµÄÎïÀí µØÖ·¡¢Ãû³Æ */
size = 5MB,
maxsize = 100MB,
filegrowth = 5%
)...
 
2¡¢  ÐÞ¸ÄÓï¾ä£º
alter database database_name +
1)  Ìí¼ÓÎļþ£ºadd [log|] file (...)
2)  ÐÞ¸ÄÎļþ£ºmodify file(name =‘ÎļþÃû’£¬ÐÞ¸ÄÄÚÈÝ)
3)  ɾ³ýÎļþ£ºremove [log|] file “file_name”
4)  Îļþ×飺
j Ìí¼Ó£ºadd filegroup Îļþ×éÃû³Æ go alter database Êý¾Ý¿â add file (...)
k ɾ³ý£ºremove filegroup Îļþ×éÃû³Æ ( ×¢Ò⣺³ý·ÇÎļþ×é²»°üº¬ÈκÎÊý¾ÝÎļþ£¬
·ñÔòÎÞ·¨É¾³ý )
 
 
񡜧
1¡¢  ´´½¨±í£º
create table table_name
(
ÁÐÃû#1   Êý¾ÝÀàÐÍ£¬
...
ÁÐÃû#n   Êý¾ÝÀàÐÍ£¬
)
1)   Ö÷¼üÔ¼Êø£ºprimary key
2)   Íâ¼üÔ¼Êø£ºforeign key               
j [Constraint constraint_name]
Foreign key(Íâ¼üÁÐÃû) references Ö÷±íÃû(Ö÷¼üÁÐ)
k ±íÒѾ­´æÔÚµÄÇé¿öÔÚ:
ALTER TABLE table_name
ADD FOREIGN KEY (Íâ¼üÁÐÃû)
REFERENCES table_primary(Ö÷¼üÁÐ)


Ïà¹ØÎĵµ£º

¸ßЧSQL²éѯ֮Ë÷Òý£¨VI£©

ÎÒÃÇÏÈ¿´ NestedLoop ºÍ MergeJoin µÄËã·¨£¨ÒÔÏÂΪÒýÓ㬼û RicCC µÄ¡¶ ͨÍùÐÔÄÜÓÅ»¯µÄÌìÌà - µØÓü JOIN ·½·¨ËµÃ÷ ¡· ):
==================================
NestedLoop:
   foreach rowA in tableA where tableA.col2=?
    {
    search rowsB from tableB where tableB.c ......

¸ßЧSQL²éѯ֮Ë÷Òý£¨III£©

ÏÈ˵˵ÕâЩÎóÇø¡£Ëùν“ÎóÇø”£¬ÓÐһЩÊÇÐÂÊÖºÜÈÝÒ×·¸µÄ´íÎó»òÕߺÜÈÝÒ׺öÂÔµÄÎÊÌ⣬ÁíÍâһЩ£¬ÔòÊÇÏñ“ºÄ×Ó³ÔÁËÑλá±ä³Éòùòð”Ò»Ñù£¬ÈÃÎÒÃÇ´ÓС¾ÍÈÏΪÊÇÕýÈ·µÄÊÂÇé¡£ÈçÏ£º
1¡¢   ±íÉϲ»¹ÜÓõÃ×ÅÓò»×Å£¬¶¼¼Ó¸ö¾Û¼¯Ë÷Òý¡£
ÎÒÃÇÖªµÀ£¬±íÒÔÁ½ÖÖ·½Ê½×éÖ¯ÎïÀí´æ´¢£ºÓоۼ¯Ë÷ÒýµÄ“¾Û¼¯± ......

¾­µäSQLÓï¾ä

 Ò»¡¢»ù´¡
1¡¢ËµÃ÷£º´´½¨Êý¾Ý¿â
CREATE DATABASE database-name
2¡¢ËµÃ÷£ºÉ¾³ýÊý¾Ý¿â
drop database dbname
3¡¢ËµÃ÷£º±¸·Ýsql server
--- ´´½¨ ±¸·ÝÊý¾ÝµÄ device
USE master
EXEC sp_addumpdevice 'disk', 'testBack', 'c:\mssql7backup\MyNwind_1.dat'
--- ¿ªÊ¼ ±¸·Ý
BACKUP DATABASE pubs TO testBack ......

ʵÏÖSQL Server 2008Êý¾ÝѹËõ

ΪʲôÐèÒªÊý¾ÝѹËõ
¡¡¡¡Ê×ÏÈ¿ÉÄÜÐèÒªÌÖÂÛµÄÎÊÌâ¾ÍÊÇΪʲôÔÚ´æ´¢³É±¾²»¶Ï½µµÍµÄ½ñÌ죬΢Èí»¹ÒªÉ··Ñ¿àÐĵØÔÚSQL ServerÖÐʵÏÖ²¢ÇÒ²»¶Ï¸Ä½øÊý¾ÝѹËõ¼¼ÊõÄØ?
¡¡¡¡¾¡¹Ü´æ´¢³É±¾ÒѾ­²»ÔÙÊÇ´«Í³ÒâÒåÉϵÄÊ×Òª¿¼ÂÇÒòËØ£¬µ«ÊÇÕâ²¢²»´ú±íÊý¾Ý¿â³ß´ç²»ÊÇÒ»¸öÎÊÌ⣬ÒòΪÊý¾Ý¿â³ß´ç³ýÁË»áÓ°Ïìµ½´æ´¢³É±¾Ö®Í⣬»¹¼«´óµØ¹ØÁªµ½¹ÜÀí³É±¾º ......

SQL Server DBCCÃüÁî


¡ô1.DBCC CacheStats £ºÏÔʾ´æÔÚÓÚµ±Ç° buffer Cache ÖеĶÔÏóµÄÐÅÏ¢£¬ÀýÈç £ºhitrates ±àÒëµÄ¶ÔÏóºÍÖ´Ðмƻ®
 
DBCC CACHESTATS
 
¡¡¡¡´ÓÕâ¸öÃüÁî¿ÉÒԵõ½Ò»Ð©¹Ø¼üµÄͳ¼ÆÐÅÏ¢£º
¡¡¡¡Hit Ratio£ºÏÔʾÌض¨¶ÔÏó¿ÉÒÔÔÚSql ServerµÄ»º´æÖб»ÃüÖеİٷֱȣ¬Õâ¸öÊýÖµÔ½´ó£¬Ô½ºÃ
¡¡¡¡Object Count£ºÏÔ ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØͼ | ¸ÓICP±¸09004571ºÅ