April 4, 2015 at 8:38 pm
Hi All,
I am running Ola maintenance script with the following parameters which runs fine.
EXECUTE dbo.IndexOptimize
@databases = 'USER_DATABASES',
@FragmentationLow = NULL,
@FragmentationMedium = 'INDEX_REORGANIZE,INDEX_REBUILD_ONLINE,INDEX_REBUILD_OFFLINE',
@FragmentationHigh = 'INDEX_REBUILD_ONLINE,INDEX_REBUILD_OFFLINE',
@FragmentationLevel1 = 5,
@FragmentationLevel2 = 30,
@sortinTempdb = 'Y'
but when I run it with trying to exclude one of the database as follows, i get a error invalid parameter.
EXECUTE dbo.IndexOptimize
@databases = 'USER_DATABASES', -databasename,
@FragmentationLow = NULL,
@FragmentationMedium = 'INDEX_REORGANIZE,INDEX_REBUILD_ONLINE,INDEX_REBUILD_OFFLINE',
@FragmentationHigh = 'INDEX_REBUILD_ONLINE,INDEX_REBUILD_OFFLINE',
@FragmentationLevel1 = 5,
@FragmentationLevel2 = 30,
@sortinTempdb = 'Y'
Can some one help me what I am doing wrong here.
Thanks in advance.
April 5, 2015 at 11:54 am
for the specific database you exclude, is it a database snapshot, or offline or read only ?
Lowell
April 5, 2015 at 7:09 pm
qur7 (4/4/2015)
Hi All,I am running Ola maintenance script with the following parameters which runs fine.
EXECUTE dbo.IndexOptimize
@databases = 'USER_DATABASES',
@FragmentationLow = NULL,
@FragmentationMedium = 'INDEX_REORGANIZE,INDEX_REBUILD_ONLINE,INDEX_REBUILD_OFFLINE',
@FragmentationHigh = 'INDEX_REBUILD_ONLINE,INDEX_REBUILD_OFFLINE',
@FragmentationLevel1 = 5,
@FragmentationLevel2 = 30,
@sortinTempdb = 'Y'
but when I run it with trying to exclude one of the database as follows, i get a error invalid parameter.
EXECUTE dbo.IndexOptimize
@databases = 'USER_DATABASES', -databasename,
@FragmentationLow = NULL,
@FragmentationMedium = 'INDEX_REORGANIZE,INDEX_REBUILD_ONLINE,INDEX_REBUILD_OFFLINE',
@FragmentationHigh = 'INDEX_REBUILD_ONLINE,INDEX_REBUILD_OFFLINE',
@FragmentationLevel1 = 5,
@FragmentationLevel2 = 30,
@sortinTempdb = 'Y'
Can some one help me what I am doing wrong here.
Thanks in advance.
The answer you seek is in Ola's documentation and outside your single quotes. 😉
--Jeff Moden
Change is inevitable... Change for the better is not.
April 6, 2015 at 12:19 am
Who is yeah to fire several even wall his this headline police lippy strumming mom here an accident yeah and axiom here ASI here see all Ask Me here and more than me down bring said yeah motion on series CNN's not sure home and wrong here axle with world testo xl[/url] I was not him your mom yourself for however who needs one week is each and their head yes hales in Alaska already right away his house p he/she/it I muscles some time do you have a larger size yeah Roxy Delano you know how most offal you know taxes VAT home if you are you feel I am workingyeah you decide to use your blue anyway I will be home at something citizens that entrenching little more endurable are the stronger as Italian Foreign for why didn't you just ask and let trauma sure there's already a week from the Mac or not.
For information presentation topics ======>>>> http://testolimitfacts.com/testo-xl/
April 6, 2015 at 5:41 am
Try to remove the piece of code in bold:
EXECUTE dbo.IndexOptimize
@databases = 'USER_DATABASES', -databasename,
@FragmentationLow = NULL,
@FragmentationMedium = 'INDEX_REORGANIZE,INDEX_REBUILD_ONLINE,INDEX_REBUILD_OFFLINE',
@FragmentationHigh = 'INDEX_REBUILD_ONLINE,INDEX_REBUILD_OFFLINE',
@FragmentationLevel1 = 5,
@FragmentationLevel2 = 30,
@sortinTempdb = 'Y'
April 6, 2015 at 6:47 am
Hi Jeff,
Thanks for the reply. so will this be correct version.
EXECUTE dbo.IndexOptimize
@databases = USER_DATABASES, -databasename,
@FragmentationLow = NULL,
@FragmentationMedium = 'INDEX_REORGANIZE,INDEX_REBUILD_ONLINE,INDEX_REBUILD_OFFLINE',
@FragmentationHigh = 'INDEX_REBUILD_ONLINE,INDEX_REBUILD_OFFLINE',
@FragmentationLevel1 = 5,
@FragmentationLevel2 = 30,
@SortinTempdb = 'Y'
Regards,
April 6, 2015 at 6:51 am
qur7 (4/6/2015)
Hi Jeff,Thanks for the reply. so will this be correct version.
EXECUTE dbo.IndexOptimize
@databases = USER_DATABASES, -databasename,
@FragmentationLow = NULL,
@FragmentationMedium = 'INDEX_REORGANIZE,INDEX_REBUILD_ONLINE,INDEX_REBUILD_OFFLINE',
@FragmentationHigh = 'INDEX_REBUILD_ONLINE,INDEX_REBUILD_OFFLINE',
@FragmentationLevel1 = 5,
@FragmentationLevel2 = 30,
@SortinTempdb = 'Y'
Regards,
I believe that you need the @databases stuff to all be included in single quotes if I recall Ola's documentation correctly. Kind of like you did for @FragmentationMedium.
--Jeff Moden
Change is inevitable... Change for the better is not.
April 6, 2015 at 7:16 am
Pl. see the following example posted on ola's site:
EXECUTE dbo.IndexOptimize @databases = 'USER_DATABASES',
@FragmentationLow = NULL,
@FragmentationMedium = 'INDEX_REORGANIZE,INDEX_REBUILD_ONLINE,INDEX_REBUILD_OFFLINE',
@FragmentationHigh = 'INDEX_REBUILD_ONLINE,INDEX_REBUILD_OFFLINE',
@FragmentationLevel1 = 5,
@FragmentationLevel2 = 30
You need to put the database name in single quotes and remove the comment " -databasename,".
HTH
---------------------------------------------------
"Thare are only 10 types of people in the world:
Those who understand binary, and those who don't."
April 6, 2015 at 7:24 am
I understand, but with this way who would I exclude one database , my understanding is , using 'user_databases' runs it against all the user databases.
I would like to run it against all the databases except one name "databasename"
April 6, 2015 at 7:27 am
So it be some thing like this.
EXECUTE dbo.IndexOptimize
@databases = 'USER_DATABASES, -name_of_the_database_tobe_excluded',
@FragmentationLow = NULL,
@FragmentationMedium = 'INDEX_REORGANIZE,INDEX_REBUILD_ONLINE,INDEX_REBUILD_OFFLINE',
@FragmentationHigh = 'INDEX_REBUILD_ONLINE,INDEX_REBUILD_OFFLINE',
@FragmentationLevel1 = 5,
@FragmentationLevel2 = 30,
@SortinTempdb = 'Y'
April 6, 2015 at 7:31 am
ok, i see what the others were saying now.
https://ola.hallengren.com/sql-server-index-and-statistics-maintenance.html
EXECUTE dbo.IndexOptimize @databases = 'USER_DATABASES, -Prod',
Lowell
April 6, 2015 at 7:33 am
qur7 (4/6/2015)
So it be some thing like this.EXECUTE dbo.IndexOptimize
@databases = 'USER_DATABASES, -name_of_the_database_tobe_excluded',
@FragmentationLow = NULL,
@FragmentationMedium = 'INDEX_REORGANIZE,INDEX_REBUILD_ONLINE,INDEX_REBUILD_OFFLINE',
@FragmentationHigh = 'INDEX_REBUILD_ONLINE,INDEX_REBUILD_OFFLINE',
@FragmentationLevel1 = 5,
@FragmentationLevel2 = 30,
@SortinTempdb = 'Y'
This is correct.
If you are looking for index maintenance, the better option would be to use Minion reindex http://bit.ly/MinionIdx
Jason...AKA CirqueDeSQLeil
_______________________________________________
I have given a name to my pain...MCM SQL Server, MVP
SQL RNNR
Posting Performance Based Questions - Gail Shaw[/url]
Learn Extended Events
April 6, 2015 at 7:46 am
Great, That's what I was looking for.... Thanks a Bunch guys.
Regards,
April 7, 2015 at 5:58 am
-databasename, "-" should be "--" for comment
April 7, 2015 at 6:07 am
Sossoliso (4/7/2015)
-databasename, "-" should be "--" for comment
No, because it's not a comment.
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
Viewing 15 posts - 1 through 15 (of 19 total)
You must be logged in to reply to this topic. Login to reply