Results 1 to 10 of 10

Thread: Optimization

  1. #1
    Join Date
    Jul 2004
    Posts
    268

    Unanswered: Optimization

    Hi All,

    I am writing a script that runs the optimization process. I am not sure how to test it? Any help is greatly appreciated.

  2. #2
    Join Date
    Jun 2003
    Location
    Ohio
    Posts
    12,592
    Provided Answers: 1
    The optimization process?
    If it's not practically useful, then it's practically useless.

    blindman
    www.chess.com: "sqlblindman"
    www.LobsterShot.blogspot.com

  3. #3
    Join Date
    Jul 2004
    Posts
    268
    Sorry, script that uses dbcc dbreindex command. I don't want to use optimization that can be setup through maintenance plan.

  4. #4
    Join Date
    Jan 2003
    Location
    Massachusetts
    Posts
    5,799
    Provided Answers: 11
    Perhaps if you created a table with an index on a guid column, then insert 10,000 rows into it. The GUID index should be considerably fragmented.

  5. #5
    Join Date
    Jun 2003
    Location
    Ohio
    Posts
    12,592
    Provided Answers: 1
    You trying to verify that DBCC is working???

    If your script just runs DBCC commands, then pipe the output of the job to a file (good idea anyway). If there are any errors or messages from DBCC you will find them there.
    If it's not practically useful, then it's practically useless.

    blindman
    www.chess.com: "sqlblindman"
    www.LobsterShot.blogspot.com

  6. #6
    Join Date
    Nov 2004
    Location
    on the wrong server
    Posts
    8,835
    Provided Answers: 6
    unless this is a serious application that takes in thousands of records a day you are not going to have to do this too often.

    here is some light reading on the subject...

    http://www.microsoft.com/technet/pro.../ss2kidbp.mspx
    “If one brings so much courage to this world the world has to kill them or break them, so of course it kills them. The world breaks every one and afterward many are strong at the broken places. But those that will not break it kills. It kills the very good and the very gentle and the very brave impartially. If you are none of these you can be sure it will kill you too but there will be no special hurry.” Earnest Hemingway, A Farewell To Arms.

  7. #7
    Join Date
    Jul 2004
    Posts
    268
    blindman,

    do you have a sample code of how to send a job output to a file?

  8. #8
    Join Date
    Jan 2003
    Location
    Massachusetts
    Posts
    5,799
    Provided Answers: 11
    In the stored procedure sp_add_jobstep, there is a parameter @output_file_name. This is for the output file you would configure on the advanced tab of a job step in EM. Here is part of a much larger script that I have:

    Code:
    exec sp_add_jobstep
    	@job_id = @jobid,
    	@step_id = 1,			--@step_id
    	@step_name = N'DBCC Checks',	--@step_name 
    	@subsystem = 'TSQL',		--@subsystem 
    	@command = @cmd,			--@command
    	@cmdexec_success_code = 0, 	--@cmdexec_success_code
    	@on_success_action = 3,		--@on_success_action
    	@on_success_step_id = 0, 	--@on_success_step_id
    	@on_fail_action = 2,		--@on_fail_action
    	@on_fail_step_id = 0,		--@on_fail_step_id 
    	@database_name = master,	--@database_name
    	@database_user_name = dbo,	--@database_user_name
    	@retry_attempts = 0,		--@retry_attempts
    	@retry_interval = 0,		--@retry_interval 
    	@output_file_name = @LogName,	--@output_file_name 
    	@flags = 4			--@flags (for output file)
    Yeah, I know the comments aren't too helpful. I think I meant to go back and make them prettier at some point. BOL will have the full list of parameters, and their definitions.

  9. #9
    Join Date
    Jun 2003
    Location
    Ohio
    Posts
    12,592
    Provided Answers: 1
    In the Edit Job Step dialog box of Enterprise Manager, go to the Advanced tab and you can set the location of your output file.
    If it's not practically useful, then it's practically useless.

    blindman
    www.chess.com: "sqlblindman"
    www.LobsterShot.blogspot.com

  10. #10
    Join Date
    Jul 2004
    Posts
    268
    Thank you very much for the help.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •