Jump to content

Need help with simple test for progressbar


GreenHouse
 Share

Recommended Posts

Howdy gents(and girls?),

I can't figure out what the best way to get this progress bar to be accurate when running the sqlmaint.exe util to create a backup of a database.

here's my code:

Run($SQLmaintPath & 'sqlmaint.exe -D ' & $ImpactDB & ' -BkUpDB -BkUpMedia DISK -UseDefDir', '', @SW_HIDE)

ProgressOn("Progress Meter", "Increments every second", "0 percent", '', '', 16)

$ProcessChecker = ProcessExists('sqlmaint.exe')

$i = 0

While $ProcessChecker <> 0
    $ProcessChecker = ProcessExists('sqlmaint.exe')
    $i += 1
    Sleep(1000)
    ProgressSet( $i, $i & " percent")
WEnd

ProgressSet(100 , "Done", "Complete")
sleep(500)
ProgressOff()

Any ideas or direction to look in would be greatly appreciated.

Thanks,

- Pas

Link to comment
Share on other sites

I think I know what your doing if Im right your trying to make a progress bar show the progress of the backup but you just have it run 100 seconds and have it just stop when back is done to make it acutrate you'll have to read the memory of the SQL program to see what database its backing up exp there are 1000 databases the bar will show 50% when its at 500/1000 and will be done at 1000/1000

Thats all I can think of if you can give me full script that I can run to backup your database or something else I can do it for you bu with what you gave me I dont have that program or an SQL database that allows outside accsess

Hope it helps

Link to comment
Share on other sites

Run('C:\Program Files\Microsoft SQL Server\MSSQL\Binn\sqlmaint.exe -D DATABASENAME -BkUpDB -BkUpMedia DISK -UseDefDir', '', @SW_HIDE)

ProgressOn("Progress Meter", "Increments every second", "0 percent", '', '', 16)

$ProcessChecker = ProcessExists('sqlmaint.exe')

$i = 0

While $ProcessChecker <> 0
    $ProcessChecker = ProcessExists('sqlmaint.exe')
    $i += 1
    Sleep(1000)
    ProgressSet( $i, $i & " percent")
WEnd

ProgressSet(100 , "Done", "Complete")
sleep(500)
ProgressOff()

Replace the DATABASENAME with the name of the database you want to backup. If you have SQL 2000 installed you should have the sqlmaint.exe utility in C:\Program Files\Microsoft SQL Server\MSSQL\Binn\ path.

The problem is that I do not know how long it will take for this commandline utility to complete the database backup. (I guess it depends on the size of the database).

Thanks for your offer to help.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...