# 22. Virtuoso Functions Guide - repl_status

Chapter Contents | Prev | Next
Keyword Search:
www.openlinksw.com
docs.openlinksw.com
Book Home
Contents
Preface
Virtuoso Functions Guide
Administration
Aggregate Functions
Array Manipulation
BPEL APIs
Backup
Compression
Cursor
Date & Time Manipulation
Debug
Dictionary Manipulation
Encoding & Decoding
File Manipulation
Free Text
Hashing / Cryptographic
LDAP
Locale
Mail
Miscellaneous
Number
Remote SQL Data Source
Replication
repl_add_cr
repl_add_dav_cr
repl_add_snapshot_cr
repl_create_snapshot...
repl_create_snapshot...
repl_drop_snapshot_p...
repl_drop_snapshot_s...
repl_grant
repl_init_copy
repl_init_snapshot
repl_publish
repl_pub_add
repl_pub_init_image
repl_pub_remove
repl_revoke
repl_sched_init
repl_server
repl_server_name
repl_snp_server
repl_stat
repl_subscribe
repl_unpublish
repl_unsubscribe
repl_update_snapshot
repl_disconnect
repl_new_log
repl_purge
repl_server_rename
repl_status
repl_sync
repl_sync_all
repl_text
repl_this_server
sub_schedule
SOAP
SQL
String
Transaction
Type Mapping
UDDI
User Defined Types & The CLR
Virtuoso Java PL API
Virtuoso Server Extension Interface (VSEI)
Web Server & Internet
XML
XPATH & XQUERY
Functions Index

## repl_status

returns status of a published or subscribed publication
repl_status (in publisher varchar, in publication varchar, out level integer, out stat integer);
Description

Given a publisher and publication name this returns the status of the publication on the local server.

Parameters
publisher – Name of the publisher.
publication – Name of the publication.
level – If the publisher is the name of the local server this returns the next transaction number to be assigned to a transaction as the level output parameter. If the publisher is other than the local server this returns the transaction number of the last transaction of that publication that has successfully been replicated to the local database as the level output parameter.
stat – The stat output parameter reflects the current state of the subscription. If the publisher is the local server the stat is always 0. Otherwise it has the following possible values:

- 0 - off The subscription exists but there is no present or past activity..
- 1 - syncing - A sync has successfully been requested and transactions are coming from the publisher at the present time.
- 2 - in sync - The syncing phase has terminated and and this server is in sync with the publisher. This does not mean all the publisher's published transactions have at all times been replayed but this does mean that the sync request reached the end of the replication transaction log and that the servers were in sync at that moment.
- 3 - disconnected by remote - The remote has disconnected this subscriber. This may be for various reasons, including that this subscriber has fallen too far behind in replaying the published transaction and has thus fallen out of sync. This state means that a resync can be retried with the repl_sync() function.
- 4 - disconnected locally - This state is set for forward (publisher to subscriber) accounts when the corresponding pushback account is disconnected because of replication queue overflow. This state means that a resync can be retried with the repl_sync() function.
- 5 - waiting for local disconnect - Local disconnect is about to happen for this account. This state is set for forward (publisher to subscriber) accounts when corresponding pushback account is disconnected because of replication queue overflow. This state means that "disconnected locally" state will be set for this account when next replication message for this account arrives. This state means that a resync can be retried with the repl_sync() function.

Example
Retriving the subscription status

This example shows an analogue of the REPL_STAT() function.

    create procedure MY_REPL_STAT ()
    {
      declare server, account, status varchar;
      declare level, stat integer;
      status := vector ('OFF', 'SYNCING', 'IN SYNC', 'REMOTE DISCONNECTED', 'DISCONNECTED', 'TO DISCONNECT');
      result_names (server, account, level, stat);
      for select SERVER, ACCOUNT from DB.DBA.SYS_REPL_ACCOUNTS do
        {
          repl_status (SERVER, ACCOUNT, level, stat);
            result (SERVER, ACCOUNT, level, aref (status, stat));
        }
    };

See Also

sub_schedule()

repl_disconnect()

repl_grant()

repl_init_copy()

repl_new_log()

repl_pub_add()

repl_pub_init_image()

repl_pub_remove()

repl_publish()

repl_revoke()

repl_sched_init()

repl_server()

repl_server_rename()

repl_stat()

repl_subscribe()

repl_sync()

repl_sync_all()

repl_text()

repl_this_server()

repl_unpublish()

repl_unsubscribe()