Nyob rau hauv SQL Server 2005 thiab tom qab versions, shrinking lub tempdb database tsis txawv li shrinking tus neeg siv database tshwj tsis yog rau qhov tseeb tias tempdb resets rau nws configured loj tom qab txhua restart ntawm qhov piv txwv ntawm SQL Server. Nws muaj kev nyab xeeb los khiav qis hauv tempdb thaum tempdb tseem tab tom ua haujlwm.
Puas txo qis database txhim kho kev ua haujlwm?
Tab sis kev txo qis tuaj yeem cuam tshuam koj cov ntaub ntawv kev ua tau zoo, yog tias tsis ua tiav. Shrinking yuav ua rau kom tawg thiab yuav ua rau muaj kev lag luam DB kim. Rov tsim kho cov indexes yog qhov tsim nyog tom qab DB shrink kom txo qhov tawg thiab ua kom muaj kev ua tau zoo.
Yuav ua li cas txo tempdb?
Peb tuaj yeem siv tus SSMS GUI txoj kev kom txo qis TempDB ib yam. Right-click rau TempDB thiab mus rau Tasks. Hauv cov npe ua haujlwm, nyem rau ntawm Shrink, thiab koj tuaj yeem xaiv Database lossis cov ntaub ntawv. Ob qhov kev xaiv database thiab cov ntaub ntawv zoo ib yam li DBCC SHRINKDATABASE thiab DBCC SHRINKFILE cov lus txib peb tau piav qhia ua ntej.
Puas tempdb shrink cia li?
Los ntawm lub neej ntawd, lub tempdb database cia li loj hlob raws li qhov chaw yuav tsum tau, vim tias MAXSIZE ntawm cov ntaub ntawv tau teem rau UNLIMITED. Yog li ntawd, tempdb tuaj yeem loj hlob mus ntxiv kom txog thaum qhov chaw ntawm lub disk uas muaj tempdb tag lawm.
Vim li cas tempdb loj tuaj?
Tempdb kev loj hlob yog feem ntau yog vim cov lus nug tsis zoo, yog li koj tuaj yeem siv SQL Profiler thiab tej zaum lim ntawm Duration rautxiav txim siab seb puas muaj cov txheej txheem khaws cia uas siv ntau tshaj x vib nas this los ua.