@echo off
:dosmenu
REM Ñ¡Ôñ²Ëµ¥
echo Windows ·þÎñÆô¶¯»ò¹Ø±Õ By hope 2008Äê2ÔÂ7ÈÕ
echo.
echo [1]Æô¶¯Sql Server2005 [2]¹Ø±ÕSql Server2005
echo [3]Æô¶¯Oracle9i [4]¹Ø±ÕOracle9i
echo.
echo ÆäËü¼üÍ˳ö±¾³ÌÐò
echo.
set /P CHS= ÇëÑ¡Ôñ·þÎñ: [1],[2],[3],[4]
if /I "%CHS%"=="1" (
goto aaaa
)
if /I "%CHS%"=="2" (
goto bbbb
)
if /I "%CHS%"=="3" (
goto cccc
)
if /I "%CHS%"=="4" (
goto dddd
)
goto close
:aaaa
REM Æô¶¯Sql Server2005
net start MSSQLSERVER
pause
cls
goto dosmenu
:bbbb
REM ¹Ø±ÕSql Server2005
net stop MSSQLSERVER
pause
cls
goto dosmenu
:cccc
REM Æô¶¯Oracle9I
net start "OracleServiceHOPE"
net start "OracleOraHome92TNSListener"
pause
cls
goto dosmenu
:dddd
REM Æô¶¯Oracle9I
net stop "OracleOraHome92TNSListener"
net stop "OracleServiceHOPE"
pause
cls
goto dosmenu
:close
R ......
@echo off
:dosmenu
REM Ñ¡Ôñ²Ëµ¥
echo Windows ·þÎñÆô¶¯»ò¹Ø±Õ By hope 2008Äê2ÔÂ7ÈÕ
echo.
echo [1]Æô¶¯Sql Server2005 [2]¹Ø±ÕSql Server2005
echo [3]Æô¶¯Oracle9i [4]¹Ø±ÕOracle9i
echo.
echo ÆäËü¼üÍ˳ö±¾³ÌÐò
echo.
set /P CHS= ÇëÑ¡Ôñ·þÎñ: [1],[2],[3],[4]
if /I "%CHS%"=="1" (
goto aaaa
)
if /I "%CHS%"=="2" (
goto bbbb
)
if /I "%CHS%"=="3" (
goto cccc
)
if /I "%CHS%"=="4" (
goto dddd
)
goto close
:aaaa
REM Æô¶¯Sql Server2005
net start MSSQLSERVER
pause
cls
goto dosmenu
:bbbb
REM ¹Ø±ÕSql Server2005
net stop MSSQLSERVER
pause
cls
goto dosmenu
:cccc
REM Æô¶¯Oracle9I
net start "OracleServiceHOPE"
net start "OracleOraHome92TNSListener"
pause
cls
goto dosmenu
:dddd
REM Æô¶¯Oracle9I
net stop "OracleOraHome92TNSListener"
net stop "OracleServiceHOPE"
pause
cls
goto dosmenu
:close
R ......
ÏàÐźܶàASP+MSSQLµÄÍøÕ¾¶¼Óб»ÈË×¢Èë¹ýµÄ¾Àú£¬Êý¾Ý¿â±íÖжàÁËһЩ±í£¬ÀàËÆÒÔϵıíD99_tmp,D99_cmd£¬kill_kk¡£
D99_tmp£¨subdirectory,depth,fileÈý¸ö×ֶΣ¬ÀïÃæµÄÊý¾Ý¶¼ÊÇÍøÕ¾ÎļþºÍĿ¼£©
MSSQLÊý¾Ý¿â´æÔÚ¼¸¸öΣÏÕµÄÀ©Õ¹´æ´¢¹ý³Ì£¬Ä¬ÈÏPublic×é¿ÉÖ´ÐÐȨÏÞ£¬SQL×¢ÈëÕß¿ÉÀûÓô˶ÁÈ¡ÎļþĿ¼¼°Óû§×飬²¢¿Éͨ¹ýÏÈдÈëÊý¾Ý¿âÈ»ºóµ¼³öΪÎļþµÄ·½·¨Íù·þÎñÆ÷дÈëΣÏսű¾½øÒ»²½ÌáȨ£¬»òÖ±½ÓʹÓÃijЩ´æ´¢¹ý³ÌÖ´ÐÐÃüÁÈçxp_cmdshell¡£
xp_cmdshell¿ÉÒÔÈÃϵͳ¹ÜÀíÔ±ÒÔ²Ù×÷ϵͳÃüÁîÐнâÊÍÆ÷µÄ·½Ê½Ö´Ðиø¶¨µÄÃüÁî×Ö·û´®£¬²¢ÒÔÎı¾Ðз½Ê½·µ»ØÈκÎÊä³ö£¬ÊÇÒ»¸ö¹¦Äܷdz£Ç¿´óµÄÀ©Õ¹´æ´¢¹ý³Ì¡£Ò»°ãµÄºÚ¿Í¹¥»÷SQL
Serverʱ£¬Ê×ÏȲÉÓõķ½·¨ÊÇÖ´ÐÐmasterÀ©Õ¹´æ´¢¹ý³Ìxp_cmdshellÃüÁîÀ´ÆÆ»µÊý¾Ý¿â£¬ÎªÁËÊý¾Ý¿â°²È«Æð¼û£¬×îºÃ½ûֹʹÓÃxp_cmdShell.
Ò»°ãÇé¿öÏ£¬xp_cmdshell¶Ô¹ÜÀíÔ±À´ËµÒ²ÊDz»±ØÒªµÄ£¬xp_cmdshellµÄÏû³ý²»»á¶ÔServerÔì³ÉÈκÎÓ°Ïì¡£
¿ÉÒÔ½«xp_cmdshellÏû³ý£º
Use Master
Exec sp_dropextendedproc N 'xp_cmdshell'
Go
Èç¹ûÐèÒªµÄ»°£¬¿ÉÒÔ°Ñxp_cmdshell»Ö¸´»ØÀ´£º
Use Master
Exec sp_addextendedproc N
'xp_cmdshell',N 'xplog70.dll'
Go
¿ÉÒÔÏû³ýµÄ´ ......
Ëø»úÖÆ
NOLOCKºÍREADPASTµÄÇø±ð¡£
1. ¿ªÆôÒ»¸öÊÂÎñÖ´ÐвåÈëÊý¾ÝµÄ²Ù×÷¡£
BEGIN TRAN t
INSERT INTO Customer
SELECT 'a','a'
2. Ö´ÐÐÒ»Ìõ²éѯÓï¾ä¡£
SELECT * from Customer WITH (NOLOCK)
½á¹ûÖÐÏÔʾ"a"ºÍ"a"¡£µ±1ÖÐÊÂÎñ»Ø¹öºó£¬ÄÇôa½«³ÉΪÔàÊý¾Ý¡£(×¢:1ÖеÄÊÂÎñδÌá½») ¡£NOLOCK±íÃ÷ûÓжÔÊý¾Ý±íÌí¼Ó¹²ÏíËøÒÔ×èÖ¹ÆäËüÊÂÎñ¶ÔÊý¾Ý±íÊý¾ÝµÄÐ޸ġ£
SELECT * from Customer
ÕâÌõÓï¾ä½«Ò»Ö±ËÀËø£¬Ö±µ½ÅÅËûËø½â³ý»òÕßËø³¬Ê±ÎªÖ¹¡£(×¢:ÉèÖÃËø³¬Ê±SET LOCK_TIMEOUT 1800)
SELECT * from Customer WITH (READPAST)
ÕâÌõÓï¾ä½«ÏÔʾaδÌύǰµÄ״̬£¬µ«²»Ëø¶¨Õû¸ö±í¡£Õâ¸öÌáʾָÃ÷Êý¾Ý¿âÒýÇæ·µ»Ø½á¹ûʱºöÂÔ¼ÓËøµÄÐлòÊý¾ÝÒ³¡£
3. Ö´ÐÐÒ»Ìõ²åÈëÓï¾ä¡£
BEGIN TRAN t
INSERT INTO Customer
SELECT 'b','b'
COMMIT TRAN t
Õâ¸öʱºò£¬¼´Ê¹²½Öè1µÄÊÂÎñ»Ø¹ö£¬ÄÇôaÕâÌõÊý¾Ý½«¶ªÊ§£¬¶øb¼ÌÐø²åÈëÊý¾Ý¿âÖС£
NOLOCK
1£® Ö´ÐÐÈçÏÂÓï¾ä¡£
BEGIN TRAN ttt
SELECT * from Customer WITH (NOLOCK)
WAITFOR delay '00:00:20'
COMMIT TRAN ttt
×¢£ºNOLOCK²»¼ÓÈκÎËø£¬¿ÉÒÔÔöɾ²é¸Ä¶ø²»Ëø¶¨¡£
INSERT INTO Customer SELECT 'a','b' –²»Ëø¶¨
......
Ëø»úÖÆ
NOLOCKºÍREADPASTµÄÇø±ð¡£
1. ¿ªÆôÒ»¸öÊÂÎñÖ´ÐвåÈëÊý¾ÝµÄ²Ù×÷¡£
BEGIN TRAN t
INSERT INTO Customer
SELECT 'a','a'
2. Ö´ÐÐÒ»Ìõ²éѯÓï¾ä¡£
SELECT * from Customer WITH (NOLOCK)
½á¹ûÖÐÏÔʾ"a"ºÍ"a"¡£µ±1ÖÐÊÂÎñ»Ø¹öºó£¬ÄÇôa½«³ÉΪÔàÊý¾Ý¡£(×¢:1ÖеÄÊÂÎñδÌá½») ¡£NOLOCK±íÃ÷ûÓжÔÊý¾Ý±íÌí¼Ó¹²ÏíËøÒÔ×èÖ¹ÆäËüÊÂÎñ¶ÔÊý¾Ý±íÊý¾ÝµÄÐ޸ġ£
SELECT * from Customer
ÕâÌõÓï¾ä½«Ò»Ö±ËÀËø£¬Ö±µ½ÅÅËûËø½â³ý»òÕßËø³¬Ê±ÎªÖ¹¡£(×¢:ÉèÖÃËø³¬Ê±SET LOCK_TIMEOUT 1800)
SELECT * from Customer WITH (READPAST)
ÕâÌõÓï¾ä½«ÏÔʾaδÌύǰµÄ״̬£¬µ«²»Ëø¶¨Õû¸ö±í¡£Õâ¸öÌáʾָÃ÷Êý¾Ý¿âÒýÇæ·µ»Ø½á¹ûʱºöÂÔ¼ÓËøµÄÐлòÊý¾ÝÒ³¡£
3. Ö´ÐÐÒ»Ìõ²åÈëÓï¾ä¡£
BEGIN TRAN t
INSERT INTO Customer
SELECT 'b','b'
COMMIT TRAN t
Õâ¸öʱºò£¬¼´Ê¹²½Öè1µÄÊÂÎñ»Ø¹ö£¬ÄÇôaÕâÌõÊý¾Ý½«¶ªÊ§£¬¶øb¼ÌÐø²åÈëÊý¾Ý¿âÖС£
NOLOCK
1£® Ö´ÐÐÈçÏÂÓï¾ä¡£
BEGIN TRAN ttt
SELECT * from Customer WITH (NOLOCK)
WAITFOR delay '00:00:20'
COMMIT TRAN ttt
×¢£ºNOLOCK²»¼ÓÈκÎËø£¬¿ÉÒÔÔöɾ²é¸Ä¶ø²»Ëø¶¨¡£
INSERT INTO Customer SELECT 'a','b' –²»Ëø¶¨
......
How is MSSQL using memory?
http://www.sqlhacks.com/Administration/Memory-Usage
Memory is one the most important factor affecting MSSQL performance.
As an administrator, you should be monitoring the memory
regularly. When Microsoft SQL Server runs out of memory, it will use
virtual memory: ie: disk paging, which will grind MSSQL to a halt.
You can keep track of the memory with dbcc memorystatus
.
Applies to:
Microsoft SQL Server 2005
Microsoft SQL Server 2008
Memorystatus
DBCC
MEMORYSTATUS
Memory Manager KB
------------------------------ --------------------
VM Reserved 538308
VM Committed 129888
AWE Allocated 0
Reserved Memory 1024
Reserved Memory In Use 0
(5 row(s) affected)
Memory node Id = 0 KB
------------------------------ --------------------
VM Reserved 534148
VM Committed 125880
AWE Allocated ......
²éѯÓï¾äÖ»ÒªÕâÑùд,¾Í¿ÉÒÔËæ»úÈ¡³ö¼Ç¼ÁË
SQL="Select top 6 * from Dv_bbs1 where isbest = 1 and layer = 1 order by newID() desc"
ÔÚACCESSÀï
SELECT top 15 id from tablename order by rnd(id)
SQL Server£º
Select TOP N * from TABLE Order By NewID()
Access£º
Select TOP N * from TABLE Order By Rnd(ID)
Rnd(ID) ÆäÖеÄIDÊÇ×Ô¶¯±àºÅ×ֶΣ¬¿ÉÒÔÀûÓÃÆäËûÈκÎÊýÖµÀ´Íê³É£¬±ÈÈçÓÃÐÕÃû×Ö¶Î(UserName)
Select TOP N * from TABLE Order BY Rnd(Len(UserName))
MySql£º
Select * from TABLE Order By Rand() Limit 10
SQLÊý¾Ý¿âÓиönewidº¯Êý£¬¿ÉÒԺܷ½±ãµÄÓÃSQLÓï¾äµÃµ½±íÖеÄËæ»úÊý¾Ý¡£µ«accessÊý¾Ý¿âûÕâô·½±ã£¬ËäÈ»ÓиöRnd£¬¿ÉÒÔͨ¹ý“select top 10 * from tb order by rnd(id)”µÃµ½Ëæ»úÊý¾Ý£¬¿ÉϧÔÚVBÖÐʹÓ㬲úÉúµÄËæ»úÐòÁÐÊÇÒ»ÑùµÄ¡£
ÓÐÈË˵ÔÚ³ÌÐòÖмÓÉÏRandomize³õʼ»¯Ëæ»úÖÖ×Ó£¬ÄÇôÕâֻ˵¶ÔÁËÒ»°ë£¬ÔÚ³ÌÐòÖмòµ¥µÄ¼ÓÉÏRandomize£¬ÊÇû×÷Óõģ¬µÀÀíºÜ¼òµ¥£¬Randomize²»¿ÉÄÜÓ°ÏìSQLÓï¾äÖеÄrnd,ÄÇÖ»²»¹ýÊǸö×Ö·û´®£¬SQLÓï¾äÊǷŵ½jetÖÐÈ¥Ö´Ðеġ£
ǰЩÌìÔÚÂÛ̳ÉÏ¿´µ½ÓÐÈË˵ÓÃtime£¬ÄÇôֻÓÃrnd(time)ÕâÑùÊDz»Ðеģ¬rndÖбØÐëÒª°üº ......
²éѯÓï¾äÖ»ÒªÕâÑùд,¾Í¿ÉÒÔËæ»úÈ¡³ö¼Ç¼ÁË
SQL="Select top 6 * from Dv_bbs1 where isbest = 1 and layer = 1 order by newID() desc"
ÔÚACCESSÀï
SELECT top 15 id from tablename order by rnd(id)
SQL Server£º
Select TOP N * from TABLE Order By NewID()
Access£º
Select TOP N * from TABLE Order By Rnd(ID)
Rnd(ID) ÆäÖеÄIDÊÇ×Ô¶¯±àºÅ×ֶΣ¬¿ÉÒÔÀûÓÃÆäËûÈκÎÊýÖµÀ´Íê³É£¬±ÈÈçÓÃÐÕÃû×Ö¶Î(UserName)
Select TOP N * from TABLE Order BY Rnd(Len(UserName))
MySql£º
Select * from TABLE Order By Rand() Limit 10
SQLÊý¾Ý¿âÓиönewidº¯Êý£¬¿ÉÒԺܷ½±ãµÄÓÃSQLÓï¾äµÃµ½±íÖеÄËæ»úÊý¾Ý¡£µ«accessÊý¾Ý¿âûÕâô·½±ã£¬ËäÈ»ÓиöRnd£¬¿ÉÒÔͨ¹ý“select top 10 * from tb order by rnd(id)”µÃµ½Ëæ»úÊý¾Ý£¬¿ÉϧÔÚVBÖÐʹÓ㬲úÉúµÄËæ»úÐòÁÐÊÇÒ»ÑùµÄ¡£
ÓÐÈË˵ÔÚ³ÌÐòÖмÓÉÏRandomize³õʼ»¯Ëæ»úÖÖ×Ó£¬ÄÇôÕâֻ˵¶ÔÁËÒ»°ë£¬ÔÚ³ÌÐòÖмòµ¥µÄ¼ÓÉÏRandomize£¬ÊÇû×÷Óõģ¬µÀÀíºÜ¼òµ¥£¬Randomize²»¿ÉÄÜÓ°ÏìSQLÓï¾äÖеÄrnd,ÄÇÖ»²»¹ýÊǸö×Ö·û´®£¬SQLÓï¾äÊǷŵ½jetÖÐÈ¥Ö´Ðеġ£
ǰЩÌìÔÚÂÛ̳ÉÏ¿´µ½ÓÐÈË˵ÓÃtime£¬ÄÇôֻÓÃrnd(time)ÕâÑùÊDz»Ðеģ¬rndÖбØÐëÒª°üº ......
Sql2005ÖÐʹÓÃow_number() partition½øÐзÖ×éʵÑ飬
SQL£º
select * from stu
select id,row_number() over (partition by snm order by id) from stu
½á¹û£º
id snm
----------------
111 111V
111 111W
222 222N
333 3123
444 3123
555 3123
666 3232
777 3232
--·Ö×éºóµÄ½á¹û
id
------------
111 1
111 1
222 1
333 1
444 2
555 3
666 1
777 2
¿ÉÒÔ×¢Òâµ½·Ö×éºÍÌØÊâ±ê¼ÇµÄ½á¹ûÈçÉÏÃæËùʾ ......
×ܼǼÊý:86; ×ÜÒ³Êý:15; ÿҳ6 Ìõ;
Ê×Ò³ ÉÏÒ»Ò³ [1] 2
[3] [4] [5] [6] [7] [8] [9] [10] ÏÂÒ»Ò³ βҳ