HiveBrain v1.2.0
Get Started
← Back to all entries
patternsqlMinor

Reindexing / rebuild Indexes on Linked Server tables

Submitted by: @import:stackexchange-dba··
0
Viewed 0 times
tablesreindexingindexesrebuildserverlinked

Problem

I am trying to run the below query to rebuild the index on a table on the Linked server, but it is not working. Can any one please let me know what I am doing wrong?

ALTER INDEX ALL ON [LinkedServerName].[dbname].[dbo].[tablename] REBUILD 
WITH (FILLFACTOR = 90)


This is giving me below error:


Cannot find the object "[LinkedServerName].[dbname].[dbo].[tablename]" because it does not exist or you do not have permissions.

Solution

Four-part-naming syntax is not supported for ALTER INDEX.

Try this:

EXEC ('ALTER INDEX ALL ON [dbname].[dbo].[tablename] REBUILD WITH (FILLFACTOR = 90);') 
AT LinkedServerName;

Code Snippets

EXEC ('ALTER INDEX ALL ON [dbname].[dbo].[tablename] REBUILD WITH (FILLFACTOR = 90);') 
AT LinkedServerName;

Context

StackExchange Database Administrators Q#159354, answer score: 7

Revisions (0)

No revisions yet.