HOW: ???? ??????? ?? SQL Server ???????

?????? ????????? ?????? ?????????
???? ???????: 224587 - ??? ???????? ???? ????? ????? ??? ???????.
????? ???? | ?? ????

?? ??? ??????

??????

???? ??? ??????? ???? ????? ????? ??????? ????? SQL Server ?????? ??????. ??????? ?????? ?????? ????? ??????? ????? ?? ??????? ??? ?????? ????? ???? ??? ?????????. ????? ??????? ????????:
  • ???.
  • ????? ???? ??????.
  • ????? ??????? ???????.
  • ?????? ????? ?? ????????? ?? ????????? ??????? ?? ???? ????? ?????.
???? ??? ??????? ????? ?????? ???? ????? ??????. ???? ?????? ???? ?? "????? ??????? ?? Microsoft ????? ?????? ?????? ?????? ?????? ???????? ?????? ?????.

???? ????? ??????? SQL


???? ????? ??????? SQL ???? ???? ??? ??????? ????? SQL Server 7.0 ?? ???? ????, ???????. ???? ????? ??????? SQL ???? ?? ?????? ?????? ???? ??????? ???? ???? ??? ?????? ?????? ??????? ??? ???? ??????? ????. ??????? ???? ????? ??????? SQL ????????? ?? ????? ???? Windows NT Microsoft ? ??? ??????????? ??????? ?????? ?? ??? ??? ??? ??? ???? ????? ????????? ??? ?? ???? ???? ??? ???????? ?????? ?? ????? ??????.

?? ???? ???? ??????

1. ????? ???? ????? ??????? SQL ??????? ????? ?????. ?????? ????? ???? ??????? ???????:
  1. ???? ???? ????? ??????? SQL.
  2. ?? ??????? ?????? ???? ??? ??????.
  3. ???? ?? ????? ???? ???? ??????? ??????? ???? ????? ????????.
  4. ???? ??? ?????.
  5. ????? ???? ?????.
  6. ?? ??????? ???? ??? ??? ???? ?? ???? ??? ????.
  7. ?? ??????? ??? ? ????? ??? ???? ?????? ???????? ??? ???.
  8. ??? ????? ??????? ??????? ?????? ????? ??????? ??????? ?????? ????? ??:

    ?? ??? ??????????? ??? ??????
    ?????????? ??????????
    ???? ??????CursorPrepare???? ??? ????? ??? ????? ???? ??? ????? SQL ???????? ODBC ?? OLEDB ?? ??????? - DB.
    ??? ? ?????????? ???? ?????????????? ??? ????? ??? ???????? ?????? ???? ?? ???? ????? ?????? ??? ??????. ???? ?????? ?? ????? ??????? ?? ???????? ??????. ??? ????? ????????? ?? ?????? ??????: UpdateStats ?????? ?????? ???? ??? ??? ?? ????? ?????? ???????? ????? ??????.
    misc.???????????? ??? ????? ??? ????? ?????? ?? ??????? ?? ??? ????.
    misc.UpdateStats ?????????? ??? ????? ??? ??? ?? ????? ?????? ???????? ??????? ????????.
    misc.exec ????? SQL???? ??? ????? ??? ?? ODBC OLE DB ?? ??????? - DB ??????? ????? SQL ???????? ???? ?????? ?? ??????.
    misc.??? ??????????? ??? ????? ???? ??? ?? ????? SQL ???????? ???? ?? ???????.
    misc.????? SQL???? ??? ????? ??? ?? ????? ODBC ?? ????? ?????? OLE DB ????? ????? Transact-SQL ???? ?? ?????? ?????????.
    misc.unprepare SQL??? ????? ???? ??? ????? ODBC ?? ????? ?????? OLE DB ????? unprepared Transact-SQL ???? ?? ?????? ?????????.
    ????? ???????????????? ??? ????? ??? ????? ????? ????.
    ????? ???????? ??????????? ??? ????? ??? ????? ???? ????? ????.
    ????? ?????????? ?????????? ??? ????? ??? ???? ????? ?????? ??? ??? ????? ???? ???? ????? ??????? SQL.
    ??????? ?????SP: ????????? ??? ????? ??? ?????? ????? ???? ??? ???????.
    ??????? ?????SP: ????? ????????? ??? ????? ??? ??? ?? ????? ???? recompiled ????? ???????.
    ??????? ?????SP: ??????????? ??? ????? ??? ??? ????? ???? ???????.
    ??????? ?????SP: StmtCompleted???? ??? ????? ??? ????? ????? ?? ????? ???? ???????.
    TSQL:SQL:BatchCompleted???? ??? ????? ??? ????? ???? SQL ????????. ???? ?????? ?? ??????? ???? ?? ???????.
    TSQL:SQL:StmtCompleted???? ??? ????? ??? ????? SQL ???????? ?????. ???? ?????? ?? ??????? ???? ?? ???????.
    TSQL:RPC: ????????? ??? ????? ??? ??? ?? ????? ??????? ????? ???? (RPC).
  9. ??? ??? ??????? ????? ?? ???? ????? ?????? ???? ?? ????????? (???? ?????) ?? ????? ??????? ?????? ???? ???? ?????? ??????? ????? ????? ? ????? ????? ??????? ???????:

    ?? ??? ??????????? ??? ??????
    TSQL:SQL:BatchStarting???? ??? ????? ??? ????? ?????? SQL ????????. ???? ?????? ?? ??????? ??? ??????.
    TSQL:SQL:StmtStarting???? ??? ????? ??? ????? ????? SQL ????????. ???? ?????? ?? ??????? ??? ??????.
    TSQL:RPC: ??????????? ??? ????? ??? ????? ??????? ??????? ?????? (RPC).
    ??????? ?????SP: StmtStarting???? ??? ????? ????? ??? ??? ????? ????? ?? ????? ???? ???????.


    ????? ??? ???? ????? ?? ???? ??????? ???? ?? ??????? ??? ???? ??????
  10. ?? ????? ??????? "????? ??????" ? ???? ?? ????? ??????? ???????:

    ?? SQL Server 2000

    ??? ?????

    ??? ????????

    LoginSid

    spid

    ??? ?????

    TextData

    IntegerData

    BinaryData

    ?????

    cpu

    ????

    ????

    ??? ???????

    ?????? NT ?????

    DBUserName


    ?? SQL Server 7.0

    ??? ?????

    ??? ????????

    ????? ?????

    spid

    ??? ?????

    ????

    ??? ???? ????????

    ???????? ????????

    ?????

    cpu

    ????

    ????

    ??? ???????

    ?????? NT ?????

    ??? ???????? SQL

?????? ??? ??????? ??? ??????? ???? ????? ??????? SQL ???? SQL Server 7.0 ? SQL Server 2000 ????????.


2. ??????? "?????? ??????" ??????? Windows NT ? SQL Server ????????. ?????? ????? ???? ??????? ???????:
  1. ??? ????? ????? ???? Windows NT.
  2. ?? ??????? ???? ???? ??? ?????.
  3. ?? ??????? ??????? ???? ??? ?????.
  4. ??? ??? ??? ????? ????? ?????? ??????. ????? ??? ?????? ?????? ??????? ?????? ???????.
  5. ?? ??????? ????? ? ???? ??? ????? ??? ?????.
  6. ????? ???? ????????. ?? ?? Windows NT ? SQL Server ????????.
  7. ???? ?????? ?? ??????? ??????? ???? ??? ????? ?? ???? ??? ???? ???? ???.

?????? ??? ??????? ??????? ???? ??? ??? ??????? ?????? ?????? ?? "????? ??????? ?? Microsoft:
150934????? ????? ??? ????? ???? ?? NT ??????? ????????

3. ???????? ?????? ????.

?????? ?? ??? ??? ??? ???? ????? ????? ?????? ?????? sp_who:
exec sp_who
????? ??? ????? ??? ???? blk. ???? ??????? ??? ??????? ??? ??????? ???? ??? ???? ???. ????? ??? ??????? ???? ???? ?? ???? ???? ???? ???? ???? ??? ??????.

?????? ????? ???? sp_who ??????? ?????? ?????? ?????? ?? ??? ??? ??? ?????. ????? ?? ?? ??? ??????? ????? ???????? ????? ??? ???? ????. ?????? ??? ??????? ??????? ???? ??? ??? ??????? ?????? ?????? ?? "????? ??????? ?? Microsoft:
251004INF: ????? ?????? ??????? SQL Server 7.0

????? ??????? ??? ??????? ????????

????? ?????? ??? ?????? ?????? ???? ????? ??????? SQL ?????? ?????? ???????? ??? ????? ???? ???? ???. ??? ?? ???? ??? ???? ???? ??? ????? ????? ???? ??????? ?? ???? ??? ????. ??????? ???????? ?? ??? ????????? ?? ?????? ??? ???? ????? ??? ???? ???? ??? ??????.


????? ?????

  1. ???? ?? ???.

    ??? ??? ???? blk ?? ????? sp_who ??? ????? ? ???? ??? ??? ???? ??? ??? ?????? ????? ??. ??? ?? ??? ?????? ????? ?????, ???? ?? ????? ???????? ???? ??? ?? ????? ??? ???? ????? ????. ?????? ??? ??????? ??????? ???? ??? ??? ??????? ?????? ?????? ?? "????? ??????? ?? Microsoft:
    224453INF: ??? ?????? ?? ?????? SQL Server 7.0 ?? 2000 ??? ????????
  2. ???? ??????? ???? ????? ??????? SQL.

    ??? ??? ???????? ???? ????? ??????? SQL ?????? ???? ?????? ?? ?? ????? ??????. ?? ??? ??? ???? ??? ?? ???? ????? ???? ?? ??? ????? ??????. ???? ??????. ???? ???? ????? ??????? SQL ?????????? ???? ?????? ???? ???? ??? ???????? ????????. ??? ????????? ????? (???? ??? ????? ??? ??????? ???) ? ???? ???? ????? ??????? SQL ?????? ???????? ???????? ?????? ????? ????? ???????? ?? ?????? ??????? (?????) ?????? ????? ???????? ?????? ????? ???????. ????? ????? ???? ????? ?? ???? ???? ?????? ??? ??? ????? ??? (?? ??????? ????? ? ???? ??? ???). ????? ????? ??? ???????? ???? ????? ??????? SQL ??? ???? ???? SQL (?? ??????? ???? ??? ??? "??? ???? ? ???? ??? ???? ????) ? ?? ?? ?????? ????????? SQL ????? ????.

    ?? ????? ????? ??????? ??? ??? ??? ???? ?????? ??????. ??? ??? ?????? ??? ??????? ??? ???? ??? ?????? ????? ???????? ???? ?? ??????? ??? ??? ????? ??????. ??? ???? ??? ??? ??? ?? ?????? ????? (?? ??????? ???? ???? ??? ??? ????) ?? ????? ???? (?? ??????? ???? ???? ??? ???) ??? ????????. ??? ????? ??? ??? ???? ?????? ??????? ?? ???? ???? ?????? ???????? ???? ??? ???? ?????; ??? ?? ???? ????. ???? ????? ? ????? ????? ?????? ???????? ??? ?????? ???????? ?? ????? ?????? ?????.

    ?????? ?????? ?? ???? ????? ?????? ???? ????? ??????? SQL ????? ???? ????? ???? ???? ????? ?????? ?? ??????? ??? ??????.

    ?????? ?????? ?????? "??? ?????":

    a. ?? ??????? ???? ???? ??? ?????.

    b. ?? ????? ??????? "????? ??????" ? ?????? ?? ?????? ???? ??? ????? ??? ????? ??????? ??? ????? ??? ????? ???? ????? ???? ??? ????? ?????????.

    c. ???? ??? "?????".

    ??????? ??? ?????? ??? ????? ????? ??? ???? ??? ?? ??????? ??? SQL Server ? ?????. ????? ?? ??? ?????? ?? ??????? ???????:

    SP:RECOMPILE

    ???? ??? ????? ??? ??? ?? ????? ???? recompiled ????? ???????. ????? ????? ?????? ???? ??? ?? SQL Server ?? ????? ??????? ??? ??????? ??????? ??????? ????? ?? ????? ?????????.

    ?????? ??? ???? ?? ????????? ??? ??????? ??????? ???????? recompilations ??????? ??????, ???? ??? ??? ??????? ?????? ?????? ?? "????? ??????? ?? Microsoft:
    243586INF: ????? ????? Recompilation ??????? ?????


    ????????

    ???? ????? ?????? ??? ??? ?? ????? ??????? ?????? ????. ??? ????? ????? ??? ??????? ?????:

    ???????? ????? ????????? ???? ???? ?? ????? ???????.

    - ?? -

    ?? ????? ???? ???????.

    ??? ??? ??? ?????? ?????? ?? ???? ??? ??? ?? ???? ?????? ????????? ????? ????.

    ?????? ??? ??????? ??????? ???? ??? ??? ??????? ?????? ?????? ?? "????? ??????? ?? Microsoft:
    243589HOW TO: ??????? ????? - ????? ????????? SQL Server 7.0 ?? ???
    ???????? ?? ?????? ??? ????????? ???? ????? ?????? ?????? ?????? ???? ?? ??? ??????? ?????? ?? ???? ???????? ?????? ??????? ??? ????? ?????? ??????? (SPID) ???? ??????? (??? ????? ??????? ????? ????? SPID = x). ????? SQL:StmtStarting ?? SQL:BatchStartingSP:StmtStarting ?????? ???? ????? ?????? ????????? ???? ?????? ?? ?????. ????? ????? ?? ???? "??? ?????" ????? ??? ?????? ?????? ?????? (?? ??????? ????? ? ???? ??? ???).

    ????? PREPARED SQL ? EXEC SQL

    ????? ????? SQL ???? ??? ?? ????? ODBC ?? ????? ?????? OLE DB ????? ????? ????? SQL ???????? ?? ?????? ?????????. ????? ????? SQL ????? Exec ??? ??????? ??????? ?????? ????? ????? ?????? ???.

    ?????? ??? ???? ????? ??? ??????? ?????. ????? ?????? ??? ?? ????? ????? ????? SQL ??? ????? ?? ?????? ??? ????. ???? ??? ?????? ????? ??????? ??????? ???? ???? ?? ??? ??? ????? ???????. ????? ??? ?? ???? ??? ??????? SQL ????? Exec ???? ?? ??? ??????? ????? SQL. ?? ???? ??????? ?????? ??? ??? ??????? SQL ????? Exec ??? ??????? ????? SQL ?? ???? ??? ??? ??????? ??? ????? ??? ??????? ???? ?????/???????. ?? ?????? ??? ?????? ????? ??? ???? ???? ??????? ??? ?????. ?????? ??? ???? ?? ????????? ??? ????? ?????? SQL ???? ??????? "????? ?????? SQL" ?? SQL Server 7.0 ????????.

    ??? ?? ??? ??? ??????? SQL ????? Exec ????? ??? ???? ???? ???? ?? ??? ??????? SQL ????? ??????? ?? ?? ???? ????? ????? ??????? ???? ?????/???????. ?????? ??? ??????? ??????? ???? ??? ??? ??????? ?????? ?????? ?? "????? ??????? ?? Microsoft:
    243588HOW: ???? ????????? Ad-Hoc ???????

    ?? SQL Server 2000 roundtrips ?????? ?? ?????/??????? ??? ??? ???? ? ???? ???? ???? ??? 3-5 ??? ??? ????? ?????. ??? ???? ???? ??????? ?? ????? ???? ??????? ????? ??????? ??? ?????? ???? ?? ??? ?????.

    ????? ???? ????????

    ???? ??? ????? ??? ????????? ????????? ?????? ?? ??????? ?????? ??? ??????? ???? ??? ?????. ???? ??? ??? ?? ????????? ?? ????? ????? ????? ??? ???? ???? ??? ????? ????????. ?????? ?? ????? ???? ????? ? SQL Server ??? ?? ??? ???????? ????????? ??? ??????? ???????? ????? ???? ?????? ????? ???????. ??? ????? ?? ?? ???? ??? ??????? ????? ???? ??????. ??? ????? ??? ??????? ???? ????????? ???? ??????? ???? ?? ??????? ?? ?? ???? ??????? ??????? ?? ????? ?????Microsoft ?????? ??? ????? ????? ??? ????? ???? ??? ?????????:
    243589HOW TO: ??????? ????? - ????? ????????? SQL Server 7.0 ?? ???

    ??? ??? ??????? ???????? ?????? ????? ??????? ????? ??? ??? ???? ???? ?? ?????? ?? ??????????? ??????? ????? ?????. ??? ??????? ?? ??? ????? ?? ???????? ?????? SQL Server ?? autostats ? ?? ?? ????? ???? ????????. ????? ???? ?????????? ???? ????? ??????? ??? ????????? ?? ??? ????? ??? ?? ???? ?????? ?? ??? ?????? ??? ?????? ??? ??? ???? ????? ????? ???????? ?????? ???????.

    ??? ??? ?? ????? ?????? ??? ???? ???????, ?????? ??????? ????? ???? ???? ?????.

    ?????? ????? ?????? ?????? ?????:

    a. ?? ??????? ???? ???? ??? ?????.

    ?? ????? ??????? "????? ??????" ? ?????? ?? ?????? ???? ????? ??? ????? ??????? ??? ????? ??? ????? ???? ????? ???? ??? ????? ?????????.

    c. ????? ???? ????????? ???????? TSQL ??? ????? ??????? "???????" ? ? ?????? ???????.

    d. ???? ??? "?????".

    ?? ???? ??????? ??? ??? ????? ?????? ?????? ??? ?????? SQL ????? ?? ????????? ??? ??????? slowest. ?? ????? ???? ????? ??? ??? ?? ??? ??? ???? ??????? ???? ?????? ??? ???? ?? ????? ???? ???? ??? ??????? ?????. ????? ????? ??????? ??? ??? ????? ???? ?????? ??? ????? ????? ??? ?????? ???? ? ???? ????? ????? ?? ????? ??????. ???? ?? ??????????? ?? ??? ???? ????? ???? ???? ???. ??? ?? ?????? ???????? ????? ???????. ??? ?? ????? ???? ?????? ????? ???? ????? ????????? ???? ??? ????? ??????? ??????? ??? ?? ??? ?????? ??? ????? ??????.

    ?? ???? ???? ??? ???? ?? ????????? ?? ????? ????? ???? ??????? ??????? ?? "????? ??????? ?? Microsoft:
    243589HOW TO: ??????? ????? - ????? ????????? SQL Server 7.0 ?? ???
    ??? ??? ??? ??? ????????? ??????? ??????? ???? ???? ?????? ?? ??? ? ?????? ??????? SQL ?? ??????? ?? "?????? ??????" ??????? (????? ??????) ????? ? ???? ??????? ??????? ?? "????? ??????? ?? Microsoft:
    243588HOW: ???? ????????? Ad-Hoc ???????
    ??? ????? ???????? ????????:

    ???? ?? ???? gained ?????? ???? ????? ??????? ?????? ?? ???? ??? ????? ???????? ?????? ?? ?????? ??????. ???? ??? ??? ??????? ?????? ????????:

    ??? ??? ??????? CPU ????, ???????? ?????? CPU ?????? ?? ?? ????????? ?????????? ???? ?? ????? CPU. ????? ???? ?? "?????" ?? "???" ????? ?? ??? ????? ????????? ???? ?????? ??? ??????? ?????. ????? ???? CPU ???????? ????? ?? ??? ??????? ???? ??? ???? ??? IO ?????.

    ??? ??? ????? IO ?????? ??????? ??? "???????" ? "?????? ???????. ??? ???? ??? ?????NT ??? ???????? ???? ???????? SQL ???????? ?? ??? ???? ????????? ??????? ????? ?????.

    ???? ???????? ??? ???? ????? ????????? ???? ??? ?? ????? ?? ????? ??? ???? ??? ??????. ????? ?????? ??? ?? ????? ????? ?? ???? ????? ?? ????? ?? SQL Server 7.0 ????????.

    ?? ?????? ???? ?? ??? ???? ?? ????? ??? ??? ????? ???? ??? ???? ???????. ?? ???? SPID ???? ??? ??? ????? ?????? ?????? ???? ???? SPID ??? ???????.

    ?? ????? ??????? ????? ?? ??? ?????? ??? ????????? ???? ??? ?? ???? ??? ??? ??? ?? ???? ?????? ??????? ?? ??? ??????? ?????.
  3. ???? ??????? "?????? ??????".

    ??? ?????? ?????? ????? ???????? ?????? ???. ?? ???? ?????? SQL Server ? ??????? ??? ?? ????? ???? ???? ????????? underpowered ?????? ??????? ?? ??????? ??????. ?? ???? ?? ???? ???????? ????? ??? ????? ?? ??????? ???? ???? ?????? ??????? ? SQL Server. ??? ????? ???? ???????? ???????:

  • ????: ??????

    ??????: ???????

    ????: SQL Server

  • ????: ???????

    ??????: % Processor Time

    ????: ????? ?? ???? ???????

  • ??????: ????? ??????

    ????? ?????? Avg. Disk ??????: ???

    ????: ????? ?? ???? ????? ??????

  • ??????: ???????? ??????: SQL SQL

    SQL ??????: ???????/???????
???? ?? ????? ??? ???? ???? ?? ??? ??? ?????? ?? ???? ??? ????: ?? ????? ????? ? ??? ??? ????????? CPU ?? ????? IO ????? ? ??????? ??? ????????? ?? ????? ???? ????? ??????? ?????? ?? ??? ??????? ??? ????? ????? ????? ???????. ?? ???? ??? ????? CPU ???? ????? ????? ?? recompilations ??????? ?????? ?? compilations ????????? ??????? ?? ??????? ????? ?????? ??????? ??????. ??? ?? ???? ?????? ?????? ????? ?? ??? ??????? ?????? ?????? ????????? ?????? ?? ???????. ???? ??? ????? ?????? ????? ????? ?????? ??? ?????? ?? ????? ?????? ?? ???? ???? "??? ?????.

???????

???? ???????: 224587 - ????? ??? ??????: 14/????/1428 - ??????: 4.3
????? ???
  • Microsoft SQL Server 7.0 Standard Edition
????? ??????: 
kbmt kbproductlink kbhowtomaster kbhowto kbinfo KB224587 KbMtar
????? ????
???: ??? ????? ??? ?????? ???????? ?????? ????? ???? ????? ?????????? ????? ?? ????????? ?????? ????. ???? ???? ?????????? ???? ?? ???????? ???????? ?????? ????????? ????? ????????? ???????? ????? ???????? ?????? ?? ?????? ??? ?? ???????? ???????? ?? ????? ??????? ?????? ??? ??????? ?????? ??. ?????? ?? ???? ??? ??????? ???????? ????? ?? ???? ????? ?????? ??? ????? ??? ????? ??????? ?? ????? ?? ?????? ??? ??? ??????? ??????? ?? ????? ????? ????? ????? ?????. ?? ????? ???? ?????????? ??????? ??? ????? ?? ??????? ?? ????? ?????? ?? ??? ????? ?? ????? ??????? ?? ???????? ?? ??? ???????. ???? ???? ?????????? ???????? ??? ????? ?????? ??????? ??????
???? ??? ????? ??????? ?????? ??????????224587

????? ???????

 

Contact us for more help

Contact us for more help
Connect with Answer Desk for expert help.
Get more support from smallbusiness.support.microsoft.com