Appearance
Replication SQL Commands
This section contains a summary of the SQL commands that pertain to replication tasks. Full syntax descriptions of these commands are in the main SQL Commands section.
CREATE, ALTER, DROP REMOTE SERVER
The following commands create, alter, and drop remote servers. To set up replication, you must create a remote server object in the source system that identifies the host name of the target system.
CREATE [OR REPLACE] REMOTE SERVER name
WITH (HOST remote_address, SQL_PORT remote_port)
ALTER REMOTE SERVER name
WITH (HOST remote_address, SQL_PORT remote_port)
DROP REMOTE SERVER [IF EXISTS] name
For more details, see:
ALTER DATABASE ADD REPLICA
Use the following command to create a new replica object, which connects a source database to a remote server and database.
ALTER DATABASE local_database_name
ADD REPLICA replica_name TO remote_server
WITH (ALIAS remote_database_name, FREQUENCY seconds, ...)
For more details, see ALTER DATABASE ADD REPLICA.
ALTER DATABASE DROP REPLICA
Use the following command to drop a replica object that is no longer in use for replication.
ALTER DATABASE database_name DROP REPLICA replica_name
For more details, see ALTER DATABASE DROP REPLICA.
ALTER DATABASE ALTER REPLICA
Use the following command to alter an existing replica:
ALTER DATABASE local_database_name
ALTER REPLICA replica_name
START [ { NEW | EXISTING } chain ] |
PAUSE |
RESUME |
FORCE |
PROMOTE [ WITH DATA LOSS ]
WITH (FREQUENCY seconds)
For more details, see ALTER DATABASE ALTER REPLICA.
CREATE DATABASE
This command creates an empty database in HOT_STANDBY
mode so it can be used as the target database for replication.
CREATE DATABASE name WITH (HOT_STANDBY ON)
For more details, see CREATE DATABASE.
ALTER DATABASE SET HOT_STANDBY OFF
Use the following command if you need to take a replica database out of HOT_STANDBY
mode:
ALTER DATABASE premdb_replica1_db SET HOT_STANDBY OFF;
ROLLBACK DATABASE Command
The following command is used as part of a failover procedure to roll back a database to a previous snapshot. You may also need to run it manually in some situations.
ROLLBACK DATABASE TO SNAPSHOT 'rollback_point' HOT_STANDBY
SSL Trust Commands
The following commands support SSL trust configuration for appliances used to replicate databases:
Parent topic:Database Replication