Basic Commands
All keywords are case-insensitive.
The following list of commands is meant to be an overview of basic and most used Dbvisit Replicate commands. For details (and the full list of commands) see Full Command-Line Reference.
Managing the processes
There is no 'Start process_name command.
The processes cannot be started from the dbvrep console. Start the process from the command line using the --daemon option instead.
[oracle@src ~]$ dbvrep --daemon --ddcfile /home/oracle/TESTSUITE1/TESTSUITE1-MINE.ddc start MINE Initializing......done DDC loaded from database (230 variables). Dbvisit Replicate version Copyright (C) Dbvisit Software Limited. All rights reserved. DDC file /home/oracle/TESTSUITE1/TESTSUITE1-MINE.ddc loaded. Starting process MINE...started
SHUTDOWN process_name
Connect to MINE/APPLY/FETCHER and request it to shut down.
SHUTDOWN ALL means requesting all processes defined in DDC to shut down.
dbvrep> shutdown all Dbvisit Replicate APPLY process shutting down. Dbvisit Replicate FETCHER process shutting down. Dbvisit Replicate MINE process shutting down.
PAUSE process_name
Connect to the FETCHER/MINE/APPLY process and pause the process.
dbvrep> pause apply Apply requested to pause
RESUME process_name
Connect to the FETCHER/MINE/APPLY process and resume the process.
dbvrep> resume apply Apply requested to resume
Managing conflicts
LIST CONFLICT
List the current conflict(s). This information is obtained from Dbvisit Replicate internal table DBRSAPPLY_CONFLICT_LOG on the APPLY side.
dbvrep> list conflict current Information for conflict 8576010028511: Table: SCOTT.CONF at transaction 0009.02f.00003ffc at SCN 29913656 SQL text (with replaced bind values): insert into SCOTT."CONF" (ID,VALUE) values (3, 'c') Error: ORA-00001: unique constraint (SCOTT.PK_ID) violated Handled as: RETRY
After the all conflicts were resolved:
dbvrep> list conflict last Information for conflict 8576010038761: Table: SCOTT.CONF at transaction 0002.000.00004102 at SCN 29918665 SQL text (with replaced bind values): insert into SCOTT."CONF" (ID,VALUE) values (6, 'f') Error: ORA-00001: unique constraint (SCOTT.PK_ID) violated Handled as: RETRY Resolved at: 15.12.2012 01:00:34 Resolved as: STATEMENT IGNORED
In 2-way replication if there is a conflict with APPLY1, then the CHOOSE REPLICATION command first has to be issued before the list conflict command will list the actual conflict of the APPLY1 process. See the CHOOSE REPLICATION command.
RESOLVE
Contacts APPLY and resolves current conflict.
dbvrep> resolve conflict 8576010038761 as ignore Conflict resolution set.
Managing the replication
LIST PROGRESS
Show tabular overview of MINE/APPLY records processed and conflicts. You can optionally specify a schema to filter the results to a particular database schema (this is source schema if renaming is used). Use ALL to see everything including Dbvisit Replicate internal tables.
dbvrep> list progress Progress of replication TESTSUITE1: total/this execution -------------------------------------------------------------------------------------------------------------------------------------------- SCOTT.CONF: 100% Mine:4/4 Unrecov:0/0 Applied:4/4 Conflicts:0/0 Last:15/12/2012 03:02:53/OK SCOTT.CONF2: 100% Mine:6/6 Unrecov:0/0 Applied:6/6 Conflicts:0/0 Last:15/12/2012 03:02:53/OK -------------------------------------------------------------------------------------------------------------------------------------------- 2 tables listed.
LIST STATS
Display statistics for number of rows processed/minute and/or lag between MINE and APPLY. The lag can be displayed in terms of time or SCN difference; the number of rows per minute can be shown globally or for specified table.
By default, the number of rows processed/minute represents APPLY performance; use LIST STATS TOTAL MINE to see MINE statistics.
dbvrep> list stats total APPLY: Cumulative totals for all tables: *** Total statistics since 15.12.2012 02:26:15 (last 24 hours) *** Total inserts/minute: 659.20 Total updates/minute: 5.99 Total deletes/minute: 0.00 Total operations/minute: 665.19 Total commits/minute: 18.64 Total rollbacks/minute: 18.64 *** Total statistics since 15.12.2012 03:57:13 (last 1 hour) *** Total inserts/minute: 0.08 Total updates/minute: 0.08 Total deletes/minute: 0.00 Total operations/minute: 0.16 Total commits/minute: 22.13 Total rollbacks/minute: 22.13 *** Total statistics since 15.12.2012 04:53:15 (last 5 minutes) *** Total inserts/minute: 0.00 Total updates/minute: 0.00 Total deletes/minute: 0.00 Total operations/minute: 0.00 Total commits/minute: 24.50 Total rollbacks/minute: 24.50 *** Total statistics since 15.12.2012 02:26:15 (since last started) *** Total inserts/minute: 659.20 Total updates/minute: 5.99 Total deletes/minute: 0.00 Total operations/minute: 665.19 Total commits/minute: 18.64 Total rollbacks/minute: 18.64 *** Total statistics since 15.12.2012 02:26:15 (whole history) *** Total inserts/minute: 659.20 Total updates/minute: 5.99 Total deletes/minute: 0.00 Total operations/minute: 665.19 Total commits/minute: 18.64 Total rollbacks/minute: 18.64
PREPARE
This adds tables or schemas to the replication. Prepares a schema/table for replication and declares that their content is in sync as of now. If a schema is prepared and DDL replication is enabled, new tables created in this schema in future will be also prepared and replicated.
Create a new schema on both Source and Target database.
SQL> conn sys/oracle@src as sysdba Connected. SQL> create user new_schema identified by new_schema; User created. SQL> grant connect, resource to new_schema; Grant succeeded. SQL> conn sys/oracle@trg as sysdba Connected. SQL> create user new_schema identified by new_schema; User created. SQL> grant connect, resource to new_schema; Grant succeeded.
Prepare the schema:
dbvrep> prepare schema new_schema Connecting to running mine [new_schema]: [Schema prepared (2 internal records).]
The PREPARE command enables DDL replication unless NODDL option is specified. Therefore a new table will be automatically prepared and replicated to the Target database:
SQL> conn new_schema/new_schema@src Connected. SQL> create table tab1 (i number primary key, a varchar2(5)); Table created. SQL> insert into tab1 values (1, 'a'); 1 row created. SQL> commit; Commit complete.
dbvrep> list progress Progress of replication TESTSUITE1: total/this execution ------------------------------------------------------------------------------------------------------------------ NEW_SCHEMA.TAB1: 100% Mine:1/1 Unrecov:0/0 Applied:1/1 Conflicts:0/0 Last:18/12/2012 14:36:10/OK ------------------------------------------------------------------------------------------------------------------ 1 tables listed.
It's not necessary to replicate the whole schema. Dbvisit Replicate can also replicate individual tables.
There are some prerequisites to preparing the table. The table needs to exist on both the source and target, appropriate privileges have to be given to the Dbvisit Replicate owner and historical data needs to be loaded to the target table. For details please see Manually Replicating new objects (adding new tables).
dbvrep> prepare table oe.promotions Connecting to running apply [oe.promotions]: [Apply table added.] Connecting to running mine [oe.promotions]: [Table prepared (4 internal records).] Table oe.promotions instantiated at SCN 33550622
SQL> insert into oe.promotions values (5, 'test promo');
dbvrep> list progress Progress of replication TESTSUITE1: total/this execution -------------------------------------------------------------------------------------------------------------------------------------------- OE.PROMOTIONS: 100% Mine:1/1 Unrecov:0/0 Applied:1/1 Conflicts:0/0 Last:21/12/2012 02:57:51/OK -------------------------------------------------------------------------------------------------------------------------------------------- 1 tables listed.
UNPREPARE
Removes tables or schemas from the replication. Unprepares a schema/table for replication and declares that this object should no longer be replicated.
dbvrep> unprepare table oe.promotions dbvrep> unprepare schema new_schema dbvrep>
Managing the settings
SET
Sets configuration variable in memory and DDC DB. This setting will be permanent. See memory_set for setting in memory only and which are not permanent.
dbvrep> set MINE.MINE_PLOG = /home/oracle/TESTSUITE1/mine/%S.%E Variable MINE_PLOG set to /home/oracle/TESTSUITE1/mine/%S.%E for process MINE.
SHOW
With no parameter or with ALL, shows all configuration variables, as they are seen by current process. It does not reread DDC file nor DDC DB to update the settings.
With variable, shows variable value. (For * and also for all processes.)
dbvrep> show setup_script_path MINE.SETUP_SCRIPT_PATH = /home/oracle/TESTSUITE1 FETCHER.SETUP_SCRIPT_PATH = /home/oracle/TESTSUITE1 *.SETUP_SCRIPT_PATH = APPLY.SETUP_SCRIPT_PATH = /home/oracle/TESTSUITE1
HELP
Shows general help, help for specific command or help for a variable.
dbvrep> help list LIST: Reports. LIST MINE|APPLY REDOLOGS|PLOGS: Display status of plogs and redologs on mine/apply. LIST PROGRESS [schema | PLSQL]: show table of current progress of mine/apply. This can be shown on-line in the status bar by setting DDC variable STATUS_BAR to 'LIST' or 'STATUS+LIST'; full list of PL/SQL replication is stored in DBRSAPPLY_DDL_HISTORY. LIST PREPARE: show tables prepared for replication. LIST OBSOLETE REDO [THREAD thread]: show which redo logs are no longer needed by mine. LIST CONFLICT { id|CURRENT|LAST }: show information about conflict (current one, last one or by specified id). LIST STATUS: show status bar text. LIST STATS {ALL|TIME|SCN|TOTAL|TOTAL mine/apply | schema.table }: list statistics for all tables or specified table - number of operations per minute and/or process lags in seconds or SCNs.
2-way or One-to-many replication
CHOOSE REPLICATION
By default all commands in the Dbvisit Replicate console work with the default processes MINE and APPLY. The choose replication command is useful when working with 2-way or one-to-many replication where there are multiple processes such as MINE, APPLY, MINE1 and APPLY1.
The CHOOSE REPLICATION command selects all processes for the indicated replication (so both MINE and APPLY processes).
Example:
dbvrep> CHOOSE REPLICATION MINE1
The above command will choose the replication pair that is associated with MINE1. Typically this is MINE1->APPLY1.
The CHOOSE REPLICATION command is needed prior to issuing commands to list conflicts, resolve conflicts and set conflicts with the APPLY1 process.