Creates a replication definition for replicating a database or a database object.
create database replication definition db_repdef with primary at server_name.db [ [ not ] replicate DDL ] [ [ not ] replicate setname setcont ] [ [ not ] replicate setname setcont ] [ [ not ] replicate setname setcont ] [ [ not ] replicate setname setcont ]
setname ::= { tables | functions | transactions | system procedures }
setcont ::= [ in ( [ owner1.]name1 [, [owner2.]name2 [, ... ] ] ) ]
Name of the database replication definition.
Name of the primary server/database combination. For example: TOKYO.dbase.
Tells Replication Server whether or not to send DDL to subscribing databases. If “replicate DDL” is not included, or the clause includes “not,” DDL is not sent to the replicate database.
Tells Replication Server whether or not to send objects in the setname category to the replicate database.
If you omit the system procedures setname or include the not option, Replication Server does not replicate the system procedures.
If you omit replicate tables, functions, or transactions setname or include the not option, Replication Server replicates all objects of the setname category.
An owner of a table or a user who executes a transaction. Replication Server does not process owner information for functions or system procedures.
You can replace owner with a space surrounded by single quotes or with an asterisk.
A space (‘ ‘) – indicates no owner.
An asterisk (*) – indicates all owners. Thus, for example, *.publisher means all tables named publisher, regardless of owner.
The name of a table, function, transaction, or system procedure.
You can replace name with a space surrounded by single quotes or with an asterisk.
A space (‘ ‘) – indicates no name. For example, maintuser.’ ‘ means all unnamed maintenance user transactions.
An asterisk (*) – indicates all names. Thus, for example, robert.* means all tables (or transactions) owned by robert.
Creates a database replication definition rep_1B. This database replication definition specifies that only tables employee and employee_address are replicated:
create database replication definition rep_1B with primary at PDS.pdb replicate tables in (employee, employee_address)
Creates a database replication definition rep_2. In this example, the database my_db is replicated, DDL is replicated, but system procedures are not replicated:
create database replication definition rep_2 with primary at dsA.my_db replicate DDL
not replicate system procedures
create database replication definition lets you replicate all, all with some exceptions, or only some of, the tables, functions, transactions, and system procedures from the primary database.
Use create database replication definition alone or in conjunction with table and function replication definitions.
With only a database replication definition, that is, without table or function replication definitions, Replication Server cannot transform data. However, it can perform minimal column replication. This data replication behavior is similar to that of a default warm standby.
For a database replication definition to replicate encrypted columns without using a table level replication definition, you must define the encryption key for the encrypted column with INIT_VECTOR NULL and PAD NULL. If a table in the database includes encrypted columns where the encryption key was created with random padding (the default) or initialization vectors, a table level replication definition is required to ensure database consistency.
Database replication definitions are global objects. They are replicated to all Replication Servers that have a route from the defining Replication Server.
Database replication definitions do not affect request function replication.
Table and function filters are not implemented if table and function subscriptions exist.
Replication Server does not process owner information for functions and system procedures.
Replication Server always uses owner information provided in the database replication definition.
Replication Server does not use owner information provided in a table replication definition if the table is marked with sp_reptostandby.
Replication Server only uses owner information provided in a table replication definition if the table is marked by sp_setreptable with the owner_on clause.
alter database replication definition, drop database replication definition