Click here to Skip to main content
15,885,027 members
Articles / Programming Languages / SQL
Tip/Trick

Time remaining of Database Shrink

Rate me:
Please Sign up or sign in to vote.
5.00/5 (3 votes)
19 Apr 2011CPOL 22.3K   3   1
Time remaining of Database Shrink
I found a stored procedure already in my database (via legacy), and modified it to display remaining seconds and lapsed seconds.

SQL
SELECT percent_complete, start_time, status, command, estimated_completion_time/1000/60 As 'Minutes to Completion', total_elapsed_time/1000/60 As 'Minutes Elapsed', wait_type, last_wait_type
FROM sys.dm_exec_requests
order by 'Minutes to Completion' desc


This is useful when you must perform a shrink or another time consuming task. It does not give much help besides "start_time" and "status" for ad hoc queries though.

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)


Written By
Chief Technology Officer
United States United States
What I get paid or have been paid to do:
Sports data (NBA, NCAA)
Restaurant data - menus, locations, sales history, foot traffic, dwell time.
IOT - logistics and mining
Trading software and protocols (QuickFIX, Onix, etc).
Price feed development.
Trader simulation tools.
Back office, end of day reporting, NFA compliance.
Performance testing, optimization, and analysis.
Large scale data management, analysis, and visualization.
Worked with most major banks, some electronic exchanges, many data providors, and a few counter-parties:
MISO, PJM, NYISO, NEISO, CAISO, AESO, ERCOT, BOE, CME, CBOE, Eurex, ICE, Morgan Stanley, J.P. Morgan, RBS, EBS, Credit Suisse, Nomura, Barclays, Deutsche Bank, Citibank, UBS, Goldman Sachs, Bear Stearns (defunct), Triaina, Bloomberg
Experience in FX, energies, futures.

Comments and Discussions

 
GeneralUseful tip, 5* Pin
DrABELL24-Apr-11 16:50
DrABELL24-Apr-11 16:50 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.