sp_setreptable

Enables or disables replication for an Adaptive Server table or displays the current replication status of a table.

Syntax

sp_setreptable [table_name [, {'true' | 'false' | 'never'} 
     [, {owner_on | owner_off | null}] [, use_index]]]

Parameters

Examples

Usage

  • Use sp_setreptable with no parameters to display a list of replicated tables in the database.

  • Use sp_setreptable table_name without true or false to display the current replication status of the table.

  • When you include the owner_on option, multiple tables with the same table name but different owners may be replicated to replicate and warm standby databases. Make sure that the replication definition on the table also includes owner information or replication may fail.

  • If a table has been marked for replication with sp_setreptable, you can change the owner mode with the sp_setrepdefmode system procedure.

  • The replication index status order of precedence is: column, table, database. For example, in a database marked for replication using indexes, the table status overrides the index status.

  • When a large table containing one or more text, unitext, image, or rawobject columns is marked for replication, the internal process is performed in a single transaction and may take a long time. To speed up the process, use the use_index option to create a global nonclustered index for every text, unitext, image, or rawobject column.

  • With use_index, a shared-table lock is held while the global nonclustered index is created.

  • Replication of the Transact-SQL writetext command requires access to the data row pointing to the text page where the database stores the LOB data. To allow access to this data row, Adaptive Server uses either a backlink pointer in the first text page or indexes created for replication. The process of creating indexes at the column, table or database level requires an intensive operation to provide the information to support replication.

    With an Adaptive Server version 15.7 SP100 and later database that you did not upgrade from an earlier version, sp_reptostandby takes effect immediately because by default, Adaptive Server creates and maintains text and image backlinking pointers to the database. Therefore, setting up replication for a table does not require the creation of indexes. Adaptive Server ignores the use_index parameter if the information needed to replicate LOB columns is already available in the form of backlinkingpointers.

    However, if you have upgraded from, or are using a database that you created with a version of Adaptive Server earlier than 15.7 SP100, setting up replication may take a longer time due to the creation of indexes. To reduce processing time, run dbcc shrinkdb_setup at the relevant level—column, table, or database, to create backlinking pointers and to ensure the backlinking status is up to date.

    dbcc shrinkdb_setup marks as suspect, replication indexes of columns, tables, or databases that you previously marked with use_index. You can use dbcc reindex to drop indexes for these objects if you do not require the indexes any longer.

  • You cannot use drop index to manually drop indexes created for text, unitext, image, or rawobject replication. You can use only the supported replication stored procedures sp_reptostandby, sp_setreptable, and sp_setrepcol to change the replication index status.

Permissions

sp_setreptable requires “sa” or “dbo” permission or replication_role.

Related reference
sp_reptostandby
sp_setrepcol
sp_setrepdefmode
sp_setreplicate
sp_setrepproc