Baffled by syntax on EXECUTE dbo.IndexOptimize

  • Hello,

    I came accross this blog (like many other articles) and I cannot make out what is the correct syntax:

    https://www.brentozar.com/archive/2016/04/updating-statistics-ola-hallengrens-scripts/

    I can't copy paste the syntax, because it gives me this:

    Msg 2812, Level 16, State 62, Line 2

    Could not find stored procedure 'dbo.IndexOptimize'.

    People are throwing suggestion, so I try:

    use Mydatabase

    go

    EXECUTE Mydatabase.dbo.IndexOptimize

    This does not work either:

    EXECUTE master.dbo.IndexOptimize

    @databases = N'Mydatabase' ,

    Can someone please give me a sensible explanation? Is this a master procedure or within My SQL Server version is 2008 Epxress and also SQL Serv. 11 Enterprise.

    Thank you,

    Richard

    PS. Other suggestions:

    http://www.sqlservercentral.com/Forums/Topic1094550-149-1.aspx

    And not a clue.

  • richlion2 (11/8/2016)


    Hello,

    I came accross this blog (like many other articles) and I cannot make out what is the correct syntax:

    https://www.brentozar.com/archive/2016/04/updating-statistics-ola-hallengrens-scripts/

    I can't copy paste the syntax, because it gives me this:

    Msg 2812, Level 16, State 62, Line 2

    Could not find stored procedure 'dbo.IndexOptimize'.

    People are throwing suggestion, so I try:

    use Mydatabase

    go

    EXECUTE Mydatabase.dbo.IndexOptimize

    This does not work either:

    EXECUTE master.dbo.IndexOptimize

    @databases = N'Mydatabase' ,

    Can someone please give me a sensible explanation? Is this a master procedure or within My SQL Server version is 2008 Epxress and also SQL Serv. 11 Enterprise.

    Thank you,

    Richard

    PS. Other suggestions:

    http://www.sqlservercentral.com/Forums/Topic1094550-149-1.aspx

    And not a clue.

    Have you created the MaintenanceSolution objects somewhere? Once you have done this, you'll find IndexOptimize in there.

    If you haven't even tried to resolve your issue, please don't expect the hard-working volunteers here to waste their time providing links to answers which you could easily have found yourself.

  • richlion2 (11/8/2016)


    Can someone please give me a sensible explanation? Is this a master procedure or within My SQL Server version is 2008 Epxress and also SQL Serv. 11 Enterprise.

    IndexOptimize is not a built in procedure or function. It's from Ola Hallengren's Index maintenance scripts. You need to download his scripts and install them before you can use them.

    See the link that Phil gave.

    Gail Shaw
    Microsoft Certified Master: SQL Server, MVP, M.Sc (Comp Sci)
    SQL In The Wild: Discussions on DB performance with occasional diversions into recoverability

    We walk in the dark places no others will enter
    We stand on the bridge and no one may pass
  • Thank you Guys, and I do apologise, I should have clicked on the link in the blog for the scripts.

Viewing 4 posts - 1 through 3 (of 3 total)

You must be logged in to reply to this topic. Login to reply