Escolar Documentos
Profissional Documentos
Cultura Documentos
Contents
Introduction to DR Agent ......................................................1
Disaster Recovery Environment Architecture .................2
Adaptive Server High Availability Disaster Recovery
System .......................................................................2
Before You Begin ...................................................................5
SAP Prerequisites ...........................................................5
Standby System Administration ......................................5
Technical Prerequisites and Limitations ..........................6
Sybase Replication Software Versions and
Downloads ..................................................................7
Sybase Replication Software Installation ............................9
Preinstallation Tasks ......................................................9
Changing the DR Agent Port ..........................................9
Validating Adaptive Server Configuration .....................10
Add Additional Adaptive Server Users ..........................11
Maintenance User ................................................11
Creating the Maintenance User ...........................12
DR Agent Administration User .............................13
Creating DR Agent Administration Login .............13
Installing Replication Server .........................................14
Installing Replication Server on Windows ............15
Running the DR Agent ........................................................17
Starting and Stopping DR Agent in UNIX .....................17
Starting and Stopping DR Agent in Windows ...............20
Verifying the DR Agent .................................................21
Viewing the Log Files ....................................................22
Connecting to DR Agent ...............................................22
Setting Up the Disaster Recovery Solution .......................23
DR Agent Security ........................................................23
DR Agent Error Handling ..............................................24
Defining a Logical Host .................................................24
iii
Contents
iv
Contents
Contents
vi
Introduction to DR Agent
Introduction to DR Agent
Disaster Recovery (DR) Agent supports automated setup and configuration, monitoring, and
administration for an SAP Business Suite for Adaptive Server disaster recovery solution.
Note: The commands described in this guide are for reference only. SAP recommends that
you use the SAP tools for administering and configuring the high availability disaster recovery
(HADR) sytem. SAP tools are wrappers around DR Administration tools, which are wrappers
around the sp_hadr_admin system procedure.
Traditionally, setting up and configuring replication with a goal of disaster recovery requires
multiple steps that must be performed in the correct order across multiple servers. Failed
processes lead to a system that does not function, which results to tearing down the
environment, and hours of lost work. The DR Agent consolidates many complex steps into a
few abstracted actions that reduce the manual effort or set of commands required to establish a
basic replication setup for disaster recovery.
Note: DR Agent supports only SAP Business Suite environments.
Replication in a Disaster Recovery Environment
In a typical replication scenario, the SAP application connects to and updates data on the
primary site. The replication software captures transactions from the primary site and
replicates them to the standby site. When integrated with SAP tooling in a planned or
unplanned failover scenario, SAP application connections are switched to the standby site.
The direction of replication is switched, and Replication Servers save the transactions
generated at the standby site until the primary database comes back online. When the primary
site returns to service, the saved transactions at the standby site are released and applied to the
primary, allowing the two sites to resynchronize.
If you are using DR Agent as a standalone tool (not integrated or combined with SAP tooling),
you must provide your own processes for switching the connectivity of the SAP applications
and other database clients to the active database instance. The disaster recovery configuration
created by the DR Agent supports only one active server at a time. Database activity may occur
at either the primary database, or the standby, but not both at the same time.
For initial setup and configuration, connect to the DR Agent on the primary site, and issue the
appropriate commands to define the environment and set up replication. Once you have set up
the environment, connect to the DR Agent on either site to monitor and administer the
replication environment. The DR Agent provides its own copies of the Sybase JDBC driver
and other libraries required for its execution. To avoid coexistence or migration issues, the DR
Agent does not share libraries with Adaptive Server or Replication Server installations. The
DR Agent uses JDBC connectivity for all outbound TCP/IP connections. Target servers
include Adaptive Server, Replication Server, and other DR Agent instances.
Introduction to DR Agent
The DR Agent is a Sybase Control Center (SCC) plug-in that runs inside the SCC server
framework. Client applications connect to the DR Agent through its TDS interface (ODBC,
JDBC, or Open Client). The DR Agent uses JDBC to communicate with the servers on either
host, and to the other DR Agent.
Introduction to DR Agent
An Adaptive Server HADR is integrated into the DR Agent setup, materialization, failover,
and teardown processes. Only privileged users can access the standby Adaptive Server,
application users are either rejected or automatically rerouted to the primary Adaptive Server.
In an HADR system, data is replicated from the primary server to the standby server. If the
primary server fails, a standby server is promoted to the role of primary server.
The user identifies the primary and standby Adaptive Server during the setup process. As the
last step in Enterprise Resource Planning (ERP) database materialization, DR Agent
configures the Adaptive Servers as a primary and a standby server. During failover, the DR
Agent deactivates the primary Adaptive Server, reverses the flow of replication, then promotes
the standby Adaptive Server to become the active primary server. Users can no longer connect
to the old primary Adaptive Server and are re-routed to the new primary Adaptive Server.
See the SAP Adaptive Server High Availability Disaster Recovery Users Guide for more
information.
Introduction to DR Agent
SAP Prerequisites
Before you can set up a disaster recovery solution, you must meet the SAP Business Suite
environment hardware and software requirements.
Two host systems each system can comprise virtual machines, physical machines, or a
mix. Both hosts must be for the same operating system and hardware architecture,
although the exact version of the operating systems may vary, as well as the size of the
machines.
DR Agent refers to a site as a "logical host". One logical host is referred to as the "primary";
the other is the "standby". A site can host the Adaptive Server and the Replication Server
on the same machine, or on separate machines. It does not support using the same host for
both primary and standby hosts.
The SAP Business Suite for Adaptive Server must be installed with the Adaptive Server
database hosted by the primary site. The SAP Application Server (NetWeaver) is not
required; however, you may want to install on the same primary host or a separate host.
The SAP Business Suite for Adaptive Server must have a copy of the Adaptive Server
database on the standby site. The standby site must be a copy of the database instance of the
primary SAP system.
Execute the SAP installer creating only the database without the NetWeaver application
server. For example, you can use the SAPinst options for Global Host Preparation and
Database Instance installation on the standby site.
The master and saptools databases are always replicated. You cannot exclude them from
replication.
The Adaptive Server name is based on the SAP_SID values and must be the same on both
the primary and standby sites.
The sapsa and sapsso logins and passwords must be identical on both hosts.
Note: Logins, users, and roles at the standby site must be a subset of those at the primary
site. When the login data from the primary Adaptive Server master database is
materialized to the standby, any unique logins at the standby site are lost.
The sa and sso role must have same permissions on the primary and standby Adaptive
Server for materializing the master database.
Note: The permissions for sa and sso users and roles are not copied from the primary to the
standby database during master database materialization. These users and roles are
excluded from materialization in order to ensure that any failure of the materialization
process does not result in an inaccessible standby database. The sa and sso users are not
corrupted at the standby. As the standby database may only have the "default" permissions
assigned to sa and sso users and roles, any customizations or additional permissions
granted to these users and roles at the primary database must be duplicated at the standby
database before materialization.
The SAP database name must be the same on both primary and standby sites.
The same hardware platform and operating system must be used for both sites. Machine
sizes and speeds may vary, as long as the standby site has sufficient resources to host the
SAP application activity and database sizes. The operating system version may vary, as
long as the version supports the SAP application.
A unique additional Adaptive Server maintenance user must be defined for the master,
SAP_SID, and saptools databases at both the primary and standby sites.
As a result of enabling replication, additional information is written to the Adaptive Server
transaction log for each database. This increase may be 40 50 percent greater than before.
Therefore, to ensure that sufficient log space is available to the SAP application, either
increase the transaction log space allocation, or schedule transaction log dumps more
frequently.
In an SAP environment with replication enabled, these ports are allocated based on the
Adaptive Server port specified when setting up replication:
Note: You can change these default port assignments, before the replication environment
is created. However, you cannot change the total number of required ports.
See also
Changing the DR Agent Port on page 9
Version
Version
Replication Server
DR Agent
Preinstallation Tasks
The preinstallation tasks to be performed before installing the Sybase replication software.
1. Verify that the prerequisites have been completed.
2. Verify that the Adaptive Server database has been properly configured.
3. Add additional Adaptive Server users required to support replication.
Note: The SAP SID is D01 in the examples. This is the name of the Adaptive Server and the
ERP database. If your SID differs, replace D01 with your SID.
This command creates a new logical host named host2 with the Adaptive Server at
host computer2 with port 4901. The Replication Server is on host computer3 with port
8000. The DR Agent for the logical host host2 is on computer3 (the Replication
Server host) and port 7777 is the port DR Agent started with on computer1.
4. To override the default port for communicating with the remote DR Agent port on host2',
the sap_set command is used.
For example:
a) Connect to DR Agent on computer1 using isql or equivalent client.
b) Execute:
sap_set newHost, dr_plugin_port, 8000
This command indicates to the DR Agent on computer1 that to reach the DR Agent for
the logical host host2, to use the port 8000.
10
You must restart Adaptive Server for this change to take effect. Use the SAP commands
stopdb and startdb to start and stop the Adaptive Server.
3. An SAP installation also requires all Adaptive Server connections to send encrypted
passwords. If necessary, execute this command at both the primary and standby Adaptive
Server:
isql -Usapsso PSybase123 -SD01
sp_configure 'net password encryption reqd', 1
go
Adaptive Server refuses all connection requests that do not encrypt passwords after setting
net password encryption reqd. The isql option that can connect to an Adaptive Server,
which requires password encryptions is -X. For example:
isql -Usapsa -PSybase -SD01 X
Maintenance User
Replication requires a unique Adaptive Server login name that is used explicitly and
exclusively when applying activity to the standby database. This unique user is referred to as
the maintenance user, for its role in maintaining a replication system.
Create the maintenance user logins in the Adaptive Server on both the primary and standby
sites. You cannot use an existing Adaptive Server or SAP user. Replication applies operations
to the standby database using this unique maintenance user login. To prevent those operations
from being replicated back to the primary, replication ignores all activity performed by this
maintenance user. Thus, using this user for any activity other than replication, the activity by
the user is ignored by replication may create a loss or inaccuracy between the primary and
standby databases.
11
Example 2: Grant sa_role to D01_maint, so it can send DML in database D01 on all tables.You
must log in as an sa user to grant sa_role.
isql -Usapsa -PSybase123 -SD01
sp_role "grant", sa_role, D01_maint
go
Authorization updated.
(return status = 0)
Example 3: Create a new role named sap_maint_user_role and grant it set session
authorization permissions. Grant the sap_maint_user_role to the maintenance user.
isql -Usapsso -PSybase123 -SD01
create role sap_maint_user_role
go
grant set session authorization to sap_maint_user_role
go
sp_role "grant", sap_maint_user_role, D01_maint
go
12
Example 4: Alias the D01_maint to DBO in the master, SAP_SID, and saptools databases.
isql -Usapsa -PSybase123 -S D01
use master
go
sp_addalias D01_maint, dbo
go
Alias user added.
(return status = 0)
use D01
go
sp_addalias D01_maint, dbo
go
Alias user added.
(return status = 0)
use saptools
go
sp_addalias D01_maint, dbo
go
Alias user added.
(return status = 0)
Execute all of these commands at both the primary and standby sites.
13
2. Log in as an sa user, and grant sa_role to DR_admin so it can assist with materialization
tasks. For example:
isql -Usapsa -PSybase123 -SD01
sp_role "grant", sa_role, DR_admin
go
Authorization updated.
(return status = 0)
14
15
16
Use the scc.sh script to start the DR Agent manually. You can either:
Run scc.sh in the foreground to get access to the DR Agent console, which you can use
to shut down and to display information about services, ports, system properties, and
environment variables.
Run scc.sh in the background to suppress the console.
You can use scc.sh to run the DR Agent at a nondefault logging level for troubleshooting.
When you start manually with scc.sh, you cannot take advantage of the automatic start
and restart features available to the services.
Use the sccd script to configure a service that starts DR Agent automatically.
Here are the steps for each starting and stopping option:
17
C shell
nohup ./scc.sh >& scc-console.out &
$SYBASE/SCC-3_2/bin/scc.sh stop
Configure DR Agent to run as a service.
A UNIX service is a daemon process that starts automatically after the machine is started
and runs in the background. UNIX installations of DR Agent include a shell script, sccd,
which you can use to configure the DR Agent service. (Some UNIX platforms supply tools
that make service configuration easier; Linux chkconfig is an example.)
Note: Sybase recommends that, if you are unfamiliar with setting up services in UNIX,
you delegate this task to a system administrator or consult the system administration
documentation for your UNIX platform.
a) Copy $SYBASE/SCC-3_2/bin/sccd into this directory:
18
AIX: /etc/rc.d/init.d
HP-UX: /sbin/init.d
All other platforms: /etc/init.d
AIX:
/etc/rc.d/init.d/sccd: S90sccd and
/etc/rc.d/init.d/sccd: K10sccd
HP-UX:
/sbin/init.d/sccd: S90sccd and
/sbin/init.d/sccd: K10sccd
Solaris:
/etc/init.d/sccd: S90sccd and
/etc/init.d/sccd: K10sccd
The S90sccd link starts the service and the K10sccd link stops the service. The
two-digit numbers in the links indicate the start and stop priorities of the service.
e) Use the S90sccd and K10sccd links to test starting and stopping the service. The
links are called automatically when the machine is started or shut down.
See also
Starting and Stopping DR Agent in Windows on page 20
19
e) Configure the service to use the Windows user when starting DR Agent:
C:> sc config SybaseDRAgent_<SID> obj= <WindowsUser> password=
<Password>
20
Start or stop from the Windows Control Panel; configure automatic start and restart:
a) Open the Windows Control Panel.
b) Select Administrative Tools > Services.
c) Locate SybaseDRAgent_<SID> in the Services list. If the service is running, the
Status column displays Started.
d) To start or stop the service, right-click the entry in the Services list and choose Start or
Stop.
e) To configure automatic starting, double-click the service.
f) To set the service to automatically start when the machine starts, change the Startup
type to Automatic.
g) To restart the service in case of failure, choose the Recovery tab and change the First,
Second, and Subsequent failures to Restart Service.
h) Click Apply to save the modifications and close the dialog.
The SCC console is disabled when SCC is executed in the background. If SCC is already
running in the background, you must stop SCC and restart it in the foreground. Once the
DR Agent is started, the operating system session is presented with a prompt for additional
command execution.
2. Check the status of the DR Agent by running the status command at the SCC console:
scc-console> status
21
Valid values include ERROR, WARN, INFO, DEBUG, or TRACE. The default log level for
the DR Agent is TRACE, which includes INFO, WARN (warning), ERROR, and DEBUG
messages. You must restart DR Agent for a change in log level to take effect. .
Connecting to DR Agent
Connect to the DR Agent plug-in using the isql utility.
Although each host includes a DR Agent, you need to enter commands at only one of them.
The DR Agents connect to each other to share configuration information or run any activity
that requires local access to the host.
To set up and monitor replication, log in to the DR Agent on the primary host. Use the DR
Agent host and port and the DR Agent administrators security credentials to establish a
connection to the DR Agent. The default port for the DR Agent is port 8899. For example:
isql UDR_admin PSybase123 Shost1:8899
22
Replication servers are installed and configured on both the primary and standby sites.
The master, SAP SID, and saptools databases at both sites are configured to support
replication.
The primary and standby Adaptive Servers are configured to support high availability
disaster recovery (HADR).
The primary databases start sending data to the Replication Server on the same host;
however, these initial updates are discarded by the local Replication Server until
materialization takes place.
The data for each database must be materialized (copied) from the primary site to the standby
site to create an initial synchronization point between the two copies of a database.
Subsequently, replication of the database updates ensures that the databases remain
synchronized.
DR Agent Security
The DR Agent does not store its own security credentials, but enforces authentication by passthrough authentication to the primary or standby Adaptive Server, or primary or standby
Replication Server.
Users must log in to the DR Agent using the host Adaptive Server credentials. The DR_admin
user is designed to be the Adaptive Server user whose credentials are validated by Adaptive
Server when logging in to the DR Agent. To enforce authentication, the DR Agent imposes
these limitations:
1. At least one Adaptive Server host (primary or standby) must be configured in the DR
Agent before pass-through authentication can be performed. Any command that is
executed before an initial sap_set_host command takes place is rejected.
2. Once you run sap_set_host, any DR Agent command execution is first authenticated
against the logical host that has been set. Any attempt to connect to the DR Agent without
authenticated credentials is rejected.
3. Once authentication has occurred, the DR Agent allows only that single administrative
user to issue commands against the DR Agent. You cannot log in to the DR Agent with any
other user name.
23
24
Instance directory
Routes
Connections
Subscriptions
This can be used when defining either the primary or the standby site.
This can be used when defining either the primary or the standby site.
25
Dropping a Host
Drop a host that was previously defined using the sap_set_host command.
sap_drop_host logical_host_name
go
where:
database_name is the name of the database to replicate.
additional_database_name is a comma-separated list of additional databases to
replicate.
26
See also
Materializing the SAP Database on page 39
See also
Adding Replication Server Device Space on page 47
27
The buffer range of 2 10 represents a low disk usage (versus higher risk), to high disk usage
(versus lower risk), decision. The risk is a failure to allocate enough space to hold all delayed
data. Once replication queues are full, the primary database cannot truncate its transaction log
as frequently, which may cause the database system to run out of transaction log space, and
stop the primary system. An allocation that is too high reduces the risk, but allocates disk
resources that may go unused.
In all cases, any choice is an approximation. Monitor the allocation over time and add
additional space allocation if the usage percentage is consistently above 80%.
28
primary, device_buffer identifies the directory location for the primary server.
primary, device_buffer_size identifies the size (in megabytes) of the disk allocation.
standby, device_buffer identifies the directory location for the standby server .
standby, device_buffer_size identifies the size (in megabytes) of the disk allocation.
For example, to change the allocation size to 5GB on the primary host, enter:
sap_set primary, device_buffer_size, 5000
go
Note: Each Replication Server is created with exactly one partition of the size specific by
See also
Adding Replication Server Device Space on page 47
29
The file contains database connection property settings that are applied when a new
Replication Server is created using sap_setup_replication. The files are read during
sap_setup_replication execution. alter connection is the specific Replication Server
command that is run for each of these properties.
Note: Any changes to RS_DB.properties files are applied when sap_setup_replication
is run and the Replication Server is created. The values in this file are read only by
sap_setup_replication. Once you have set up replication, changing the contents of
RS_DB.properties files does not affect your existing environment. Additional changes
can be made by logging into to the Replication Server and configuring it directly. See
Replication Server Reference Manual for more information on configuring Replication
Server connections.
where:
env_type is the type of environment the pre-setup check process validates. DR Agent
supports the disaster recovery "dr" option, which configures the environment using the
Adaptive Server HADR.
primary_logical_host_name is the name of the logical host that identifies the primary
site.
standby_logical_host_name is the name of the logical host that identifies the standby
site.
Before executing the replication setup command, correct any errors returned by
sap_pre_setup_check. sap_setup_replication executes the same set of tests as part of the
setup process.
30
You must execute this command separately for each database you want to mark for replication,
at both the primary and standby sites.
If you do not separately mark the databases for replication, as described here,
sap_setup_replication automatically executes the same marking command for all databases.
sap_setup_replication is available solely as a timing convenience for updating the SAP
database.
Running Setup
Create the disaster recovery replication environment.
Prerequisites
Verify that all required properties have been set.
Task
Execute:
sap_setup_replication, env_type, primary_logical_host_name,
standby_logical_host_name
go
where:
env_type is the type of environment the pre-setup check process validates. DR Agent
supports the disaster recovery "dr" option, which configures the environment using the
Adaptive Server HADR.
primary_logical_host_name is the name of the logical host that identifies the primary
site.
standby_logical_host_name is the name of the logical host that identifies the standby
site.
This command is executed asynchronously (in the background) and may take 30 or more
minutes to complete, depending whether you have already executed
sap_mark_for_replication, which significantly reduces the time for sap_setup_replication
execution. The order of the logical host names dictates the direction of replication (from
primary to standby). The setup command returns immediately, indicating the setup task has
been successfully started and is running asynchronously.
31
If the return from the sap_status command is "running", the background task is still
executing. The remaining results show the current state of the task and all child tasks. You can
reexecute the sap_status command periodically to monitor the task as you wait for its
completion.
A return status of "complete" indicates that, the background task has finished:
One Replication Server instance for each logical host is installedone server on each
host. A route is created between the two servers.
The Replication Server administrative user is the same one used to connect to the DR
Agent.
All three databasesSAP_SID, master, and saptoolsare defined to the Replication
Server.
All three databases are sending data from the primary database to the primary Replication
Server. Replication Server discards these updates; no data is applied to the standby
databases.
Both Replication Servers have connections defined for all three "local" databases.
Both Replication Servers are each using their own embedded RSSD.
Routes exist (both directions).
Database-level replication definitions exist for all databases (both directions).
Replication Agents at the primary site are up and running. Replication Agents at the
standby site are disabled, as is the secondary truncation point. Log transfer is disabled at
the standby Replication Server connection, so that no standby Replication Agent can
connect.
Subscriptions from standby to primary do not yet existthey are created as part of
materialization. Subscriptions do exist from primary to standby, in preparation for future
failover.
The Replication Server administrative user is the same one used to connect to the DR
Agent.
RSSD primary user is configured using the same password as the DR_admin.
Note: Because of a limitation in SQL Anywhere, the RSSD primary users password will
be truncated to 29 characters.
If the sap_status command returns an error, the background task fails. Review the remaining
task information to obtain an error description. Correct the error condition and rerun
32
33
34
Database Materialization
Database Materialization
The materialization step of the setup process performs the initial copy of data from one site to
the other.
Once completed, the replication software maintains the accuracy of the target site by
continuously applying changes that occur after materialization. The procedure for
materialization depends on the type and size of database being materialized.
Before materializing the master database, verify that the sa and sso role have the same
permissions on the primary and standby Adaptive Server.
Note: The permissions for sa and sso users and roles are not copied from the primary to the
standby database during master database materialization. These users and roles are excluded
from materialization in order to ensure that any failure of the materialization process does not
result in an inaccessible standby database. The sa and sso users are not corrupted at the
standby. As the standby database may only have the "default" permissions assigned to sa and
sso users and roles, any customizations or additional permissions granted to these users and
roles at the primary database must be duplicated at the standby database before
materialization.
Dump Configurations
When materializing databases that are configured to use a dump configuration, you must use
sap_materialize start and sap_materialize finish commands.
Note: Dump configurations are not supported with DR Agent automatic materialization.
Dump configurations define options to create a database dump. Backup Server then uses the
configuration to perform a database dump. For more information on dump configurations, see
Adaptive Server Enterprise 15.7 ESD #2 > Reference Manual: Procedures > System
Procedures>sp_config_dump command.
Prior to Materialization
Before running any materialization task, verify that the database to be materialized is properly
set up for replication. Execute sap_status path to check the state of all the databases. The
current status for each database must be "defined". An "active" status indicates that the
database is already being replicated and must not be materialized.
If the status is "error", you must identify and resolve the error before attempting any additional
system changes. Review the Replication Server error logs to determine the reason for the error.
A status of "suspended" typically indicates an error, or that a materialization task is already in
progress. This is the expected state when materialization "start" has been issued, but not the
corresponding "finish" request.
35
Database Materialization
After Materialization
After running any materialization task, verify the database you just materialized has reached
an "active" status. You can run the sap_status path command to check the state of all the
databases. The current status for the database after materialization must be "active". If the
status is "defined", this database has not been materialized.
If the status is "error", the error must be resolved before attempting any additional changes to
the system. Review the Replication Server error logs to determine the reason for the error. If
the status is "suspended", this typically indicates an error, or that the materialization task is
still running. This is the expected state when materialization "start" has been issued, but not
the corresponding "finish" request.
Materialization Verification
The materialization process performs an additional verification step by inserting a row in the
rs_ticket_history table at the primary database, then verifying that the materialization
process copied that row to the standby database.
Note: This verification process is part of all the materialization methods and is not a separate
task to be performed, unless you are using an external materialization.
This step ensures that the manual user steps such as dump and load or snapshot
materialization are performed between the sap_materialize start and sap_materialize finish
commands. It does not attempt to verify that the data in the primary and standby databases are
in sync.
If you are using the external materialization method, perform materialization verification
using the imprint command.
See also
Verifying Materialization for External Method on page 42
Monitoring the Replication Environment on page 45
36
Database Materialization
The order of logical host names in the command dictates the direction in which
materialization is occurring (from source system to target system). The auto option is the
only option available for the master database materialization to manage consistently
which tables are copied. Optionally specify user name and password. This command is
executed asynchronously.
2. Execute sap_status to verify the materialization step is completed.
Once complete, login-related data is synchronized between the two sites. Any subsequent
login changes are replicated, and normal security activity may continue.
During materialization of the master database:
37
Database Materialization
BCP is called for each necessary master database table, one at a time. (This is why no
security updates should occur to the master database during this process).
The DR Agent administrator must have sa and sso roles to configure the standby master
database to allow the updates to the related system tables.
A subscription is created at the standby Replication Server from primary to standby for the
master database.
After materializing a database, you can use the monitoring command sap_status path to
check the status of replication for that database.
See also
Monitoring the Replication Environment on page 45
The order of logical host names in the command dictates the direction in which materialization
is occurring (from source system to target system). Optionally, specify user name and
password.
During materialization of saptools:
A subscription is created at the standby Replication Server from primary to standby for the
saptools database. The with dump marker option is used.
An Adaptive Server dump command is issued at the primary Adaptive Server. The dump
file location is the same as for the Replication Server stable storage.
When the dump completes at the primary, the load command is issued at the standby
Adaptive Server, using the remote backup server syntax. The dump file is transferred to the
standby by the backup servers. The standby dump file location is again the same as the
Replication Server stable storage.
When the load completes, the DSI thread in the standby Replication Server is resumed.
After materializing a database, use the monitoring command sap_status path to check the
status of replication for that database.
38
Database Materialization
See also
Monitoring the Replication Environment on page 45
This instructs the replication components to anticipate the dump and load processing. The
order of logical host names in the command dictates in which direction the materialization
is occurring (from source system to target system).
The start keyword configures replication to anticipate the dump marker, generated by the
Adaptive Server dump command.
Note: A subscription is created at the standby Replication Server from primary to standby
for the SAP database. The with dump marker option is used.
2. Manually dump the entire SAP ERP D01 database by issuing the Adaptive Server
command dump database in the source Adaptive Server system.
39
Database Materialization
3. Manually copy the dump file to the target site. Use shared storage, or a process such as FTP
to make a copy of the dump file available at the target site.
4. Manually load the dumped SAP ERP D01 database by issuing the Adaptive Server
command load database in the target Adaptive Server system.
5. Bring the database online by issuing the Adaptive Server command online database in the
target Adaptive Server system.
6. In the DR Agent, execute:
sap_materialize finish, primary_logical_host_name,
standby_logical_host_name, D01, [,user_name,password]
go
This instructs the replication components to recognize the completion of load processing,
and that new activity can now be applied to the target database. Optionally, specify user
name and password. It completes the materialization process.
Note: The Replication Server DSI threads are now resumed, and application of data to the
standby database can begin.
40
Database Materialization
This instructs the replication components to anticipate the last dump and load process. The
order of logical host names in the command dictates in which direction the materialization
is occurring (from source system to target system).
5.
6.
7.
8.
The start keyword configures replication to anticipate the dump marker from the last
transaction log to be dumped. This must be executed only before the last dump to be loaded
into the standby database. If the start request is issued too soon (not just prior to the last
dump taken) the marker from the wrong dump can be used by replication. If the start
request is too late (after the last dump is taken), replication waits indefinitely for a marker
to appear that it has already read and ignored.
Manually dump the transaction log of SAP ERP D01 database. Use the Adaptive Server
command dump transaction in the source Adaptive Server system.
Manually load the last SAP ERP D01 transaction log dump.
Use the Adaptive Server command online database in the target Adaptive Server system
to bring the database online.
In the DR Agent, execute:
sap_materialize finish, primary_logical_host_name,
standby_logical_host_name, D01
go
This instructs the replication components to recognize that load processing has completed
(the last transaction log dump has been applied and the database is not online). All new
activities that have occurred since the last transaction log dump are now applied to the
target database. It completes the materialization process.
41
Database Materialization
5. Bring the database online.
6. Execute:
sap_materialize finish, primary_logical_host_name,
standby_logical_host_name, database_name
go
Note: You cannot use the external materialization process on the master database. You can use
the external keyword to skip the materialization process. The DR Agent sets up an active
replication path between the primary and the standby databases when you execute the
sap_materialize external, followed by sap_materialize finish. However, the databases are not
synchronized, and any transactions that update or delete rows may fail.
See also
Verifying Materialization for External Method on page 42
Cancelling Materialization
Execute sap_cancel to cancel the materialization process if it is taking too long or must be
rescheduled. It stops at its next logical point. The cancel operation does not perform cleanup.
You can restart the process at any time.
Note: This extra verification step is not performed for the master database materialization
and must only be performed if the external materialization method is used.
2. Perform the initial part of the materialization process.
This would take the database offline.
42
Database Materialization
3. Execute:
sap_materialize external, primary_logical_host_name,
standby_logical_host_name, database_name
The sap_materialize finish command verifies that the verification row exists in the
standby database. If for some reason the row does not exist, the DR Agent generates an
error and does not complete the finish command. The force parameter bypasses the
verification test and finishes the materialization process.
43
Database Materialization
the saptools or ERP database using the auto materialization process or if the start or finish
process fails either when executing the sap_materialize command, or during the dump or load
commands, perform these steps:
1. Disable replication for the database.
sap_disable_replication primary_logical_host_name, database_name
44
Description
Defined
Suspended
The state expected during materialization, when data flow is suspended while
waiting for load activities to complete.
Error
Active
Description
Last Commit Time The local timestamp of a command applied to the target database.
Latency
The approximate length of time it takes for an update on the source system to
reach the target, based on the last trace command sent.
Latency Time
The timestamp of the most recent trace command that was applied to the
target database and used for the latency calculation.
Tracing Latency
Send a trace to initiate latency monitoring. You can initiate a trace from either the primary or
standby logical host. If you are replicating from the primary to standby, initiate the trace at the
45
This command inserts an rs_ticket into the source database or databases. Latency is calculated
from the most recent entry in the target databases rs_ticket_history table.
The DR Agent sap_status path command calculates latency based on the most recent trace
received at the standby database. But if there is a backlog of data, the trace element reflected by
sap_status path results may not be the most recent trace element requested. Verify that the
"Time latency last calculated" is the current time, and not reflective of trace element that was
executed earlier.
2. If device usage percentages returned from the command are high, consider adding device
space to the replication paths to allow for greater buffering and less risk to the primary
Adaptive server transaction log free space.
46
If the replication throughput cannot meet the current primary system demand, the
Adaptive Server transaction log may become full while waiting for replication. Adding
buffering space to the Replication Servers allows the Adaptive Server logs to truncate
more frequently, pushing the data out of the Adaptive Server transaction log and into
replication queue storage to remove the risk of a full log in the primary Adaptive Server.
Primary Adaptive Server transaction log space may fill if the standby site is unavailable
(due to either planned or unplanned downtime). The Adaptive Server transaction log may
47
48
Replication Commands
Replication Commands
Use DR Agent replication commands to manipulate the replication environment when
working on disaster recovery.
Delay Replication
Delays replication to the ERP database. Delaying replication from the primary ERP database
provides time to recover from an undesirable event, such as a table or records dropped by
mistake.
To delay replication:
Disable Replication
Stops replication for all SAP databases or a specified database.
sap_disable_replication primary_logical_host_name [, database_name]
go
Enable Replication
Restarts replication for all SAP databases or a specified database.
sap_enable_replication primary_logical_host_name [, database_name]
go
49
Replication Commands
sap_resume_replication standby_logical_host_name, all
go
Suspend Replication
Suspends replication to a specified database or all SAP databases (master, saptools, and ERP).
To suspend replication to a specified database, enter:
sap_suspend_replication standby_logical_host_name [, database_name]
go
See also
Running Setup on page 31
50
'all' the command refers to the connection-level properties of all the database
connections.
51
Examples
Example 1: List all Replication Server properties on the logical host HostA.
sap_configure_rs HostA, RS
sap_get_log
Retrieves log entries from the Replication Server log after a given timestamp.
52
The logical name must have been defined using sap_set_host. The timestamp is in the
format of YYYY-MM-DD HH:MM:SS. An example timestamp is: '2013-08-13 14:55:00'
sap_help
Displays a list of available commands, or detailed information for the specified command.
sap_help [command]
go
sap_set_password
Both the primary Adaptive Server and Replication Server, and the standby Adaptive Server
and Replication Server contain the system administrator login DR_admin. The DR Agent
authenticates its login by attempting to log in to one of these servers. This requires the
DR_admin password to be the same on all servers. The sap_set_password command changes
the password on all four servers. After execution, the user must log out and then back in to the
DR Agent.
sap_set_password current_password, new_password, new_password
go
Additionally, this command resets the password for these users logins:
sap_set_replication_service
Allows you to update the Replication Server Windows Service credentials. It also allows you
to restart the Replication Server using the Windows Service. The Windows Service does not
exist until the rs_init utility is executed to create the Replication Server.
Windows Service details:
Name SYBREP_<SID>_REP
Display Name SYBREP <SID> Replication Server
Start Type manual
53
Hidden:
sap_set_replication_service LOCAL, domain_name\\user_name, password
Prerequisites:
The SAP SID must be set using the sap_set command, otherwise the hidden LOCAL option
does not work.
This hidden option is only expected to be used by the SAP installer. Its syntax is not
displayed with the sap_help output of the sap_set_replication_service command.
This option can only create a Windows Service on the same machine the DR Agent is
running on
The logical_host_name must have been defined prior to all other options and the options that
accept a logical host can be executed from any DR Agent does not need to be local.
Examples:
Example 1: Defines a Windows Service on the local machine with the credentials provided:
sap_set_replication_service local, sapuser, sappassword
Example 2: Defines a Windows Service on 'myhost' logical host for the Replication Server
belonging to that logical host:
sap_set_replication_service myhost, create
By default, credentials default to the local system account login. You can change the login
credentials using subsequent call to change the credentials.
Example 3: Restarts Replication Server on 'myhost' logical host using the Windows Service
for the Replication Server belonging to that logical host:
sap_set_replication_service myhost, restart
Example 4: Sets or changes the login credentials for the Windows Service on 'myhost'
logical host to use SAP username and SAP password:
sap_set_replication_service myhost, sapuser, sappassword
sap_version
Displays the version of the DR Agent plug-in. With the option all keyword, displays a list of all
the servers known by the DR Agent in this replication environment and their versions.
sap_version [all]
go
54
Failover
Failover
Failover is switching activity to the standby site in the event of a failure on the primary site.
A planned failure occurs on a schedule. Typically as part of a test or other exercise, a planned
failure allows for an orderly sequence of steps to be performed to move processing to the
standby site. The failover includes changes in direction for replication, redirecting NetWeaver
and other applications to connect to the standby site, as well as redirecting other tools and
client applications that may run outside of SAP.
An unplanned failure is unscheduled, occurring unintentionally and without warning. Yet a
similar sequence of events must take place and the same entities are impacted as in a planned
failover. The DR Agent provides assistance for the replication part of failover. It does not assist
with redirecting SAP, NetWeaver or other client activities or connectivity. The DR Agent
changes the direction of replication from the current primary system to the current standby
system.
After the replication part of failover is executed, the direction of replication is reversed.
Activity captured from clients and applications that are redirected to the standby databases is
held to be applied to the primary site when it becomes available. The original primary site
becomes the disaster recovery location for the standby site, which is now performing primary
database support.
sap_failover:
Monitors replication to verify all paths from the primary database to the standby are
complete. No remaining in-flight data to be replicated exists for all three SAP databases,
master, SAP_SID, and saptools.
Suspends the Replication Server at the standby site from applying any additional data from
the primary.
Configures and starts Replication Agent threads for each database in the standby server.
Reconfigures the Replication Server to accept activity from the standby database.
The replication-related activities for failover are divided into two parts. The first part,
supported by sap_failover command processing, ensures clients and applications can
reconnect as soon as possible.
The second part reconfigures the primary database as the new backup for the activity
occurring at the standby site. This second part is fulfilled by using DR Agent command
sap_host_available. The sap_host_available, which:
Disables the Replication Agents on the requested site for the master, SAP_SID, and
saptools databases in an SAP environment so that no data is replicated out from this site.
Reconfigures the Replication Server to not accept activity from the requested site.
Purges the Replication Server queues of any possible in-flight data.
55
Failover
Resets the Replication Server at the current standby site to allow application of future
activity, in the event a subsequent failover back to the primary site is needed.
where:
timeout is the number of seconds the process will wait while draining the transaction
log and Replication Server queues. If the timeout is reached, the process terminates.
force (Optional) causes the failover process to continue if the timeout value is
reached.
The Replication Server is reconfigured to accept activity from the standby database.
sap_failover executes asynchronously in the background. Use sap_status to check for
successful completion of the sap_failover request.
4. Redirect clients and applications to the standby site.
Once sap_failover executes successfully, the standby databases contain the same content
as the primary.
5. Log in to the DR Agent and issue:
sap_host_available primary_logical_host_name
go
Unplanned Failover
Unplanned failover steps are exactly the same as planned failover. The only difference is
timing and planning for the possibility of data loss. The database administrator (DBA) has to
56
Failover
make a conscious decision about failing over and how to deal with any lost transactions and
what happens to these transactions when an old primary site is online again.
The Replication Agent Thread (RAT) does not apply these transactions to Replication Server,
hence, there may be a need for rematerialization, before an old primary site can be designated
as the standby site. For sap_failover execution, there may be in-flight data that is still being
processed if there was a heavy load on the system at the time of failure. The time required to
ensure all in-flight data has been replicated can take longer than a planned failover that has had
all activity quiesced.
During an unplanned outage or disaster, the primary site may be down for hours or days.
Regardless of the duration, you cannot execute sap_host_available until the primary site is
available.
sap_failover primary_logical_host_name, standby_logical_host_name,
timeout [, force]
go
sap_host_available primary_logical_host_name
go
Failback
Failback is switching activity back to the original primary site after failing over to the standby
site.
The sequence of steps and commands is the same for failback as for failover, but switching the
order of the sites. The DR Agent commands are the same, except only the order of the sites is
reversed, to reflect the current direction of replication:
sap_failover standby_logical_host_name, primary_logical_host_name,
timeout [, force]
go
sap_host_available standby_logical_host_name
go
57
Failover
58
Upgrading DR Agent
Upgrading DR Agent
Run the upgrade command to move from an earlier version of DR Agent. The command
checks if an upgrade needs to be performed by verifying that the new DR Agent version is
greater than the previously persisted version. If yes, the upgrade is performed, otherwise no
action is taken.
Prerequisites
Verify both the primary and standby DR Agent versions:
sap_version all
go
Task
Note: Moving from a latest DR Agent version to an earlier version is not permitted.
Upgrade both DR Agents. Issue the upgrade command either on the primary or standby DR
Agent:
sap_upgrade
go
The upgrade command performs the following tasks necessary to move from an earlier
version to the latest version of DR Agent:
a. Connect to the primary and standby Replication Servers.
b. Check for existence of primary and standby replication connections to database saptools.
If no connections exist, remove saptools from the internal database list.
c. For all databases, alter their database replication definitions to allow DDL and stored
procedures to be replicated from the primary to the standby Replication Server.
d. Update and save the new version to the model.
59
Upgrading DR Agent
60
Task
1. Perform the Replication Server upgrade.
2. Start the standby DR Agent.
3. Restore replication to the standby Adaptive Server.
61
The Replication Agent for the master, SAP_SID, and saptools databases must show a
status of "sleeping", and a sleep_status of "end of log". If the Replication Agent is not yet at
the end of the log, wait, then rerun these commands until all three databases reach the end
of log state.
3. Check that all data within the replication path has reached the standby database. Log in to
the DR Agent and execute:
sap_send_trace
go
4. (Optional) Issue the DR Agent sap_status path command to verify that the latency
calculation is low (less than one second) and that the value of "Time latency last
calculated" is equal to the current time in the environment for the master, SAP_SID, and
saptools databases.
If these values are not as expected, it indicates that the latest trace requested has not yet
reached the standby database due to a backlog of data to be replicated. Continue to run
sap_status path until the Time latency last calculated reaches the expected time of the
trace element you are waiting for.
sap_status path calculates latency based on the most recent trace received at the standby
database. But if there is a backlog of data, the trace element may not be the most recent one
sent. Validate that the Time latency last calculated is the current time, and not reflective
of some trace element executed earlier.
62
This completes the Replication upgrade procedures, including upgrading routes if necessary.
63
64
Restoring replication completes the upgrade of the standby Adaptive Server database.
65
66
2. Issue:
sap_teardown
go
The teardown command does not modify any data that has been replicated to the standby
databases. Additionally, the databases on both the primary and standby hosts are not
unmarked for replication. It does not remove any software, but it does remove the
Replication Servers and configurations that support replication. When the teardown
process completes, you can immediately reexecute sap_setup_replication, to rebuild the
environment that was just removed. You must rematerialize the databases.
Directories deleted by Teardown:
Both the primary and standby Replication Server instance directories and their contents
are deleted.
Primary /sybase/<SID>_REP/
<SID>_REP_primary/,SID>_REP_primary.
Secondary /sybase/<SID>_REP/<SID>_REP_standby/
<SID>_REP_standby.
Directories not deleted by Teardown:
The primary and standby dump directories are not deleted during teardown. The dump
directories are defined using sap_set and setting property, db_dump_dir. These
directories can get very large depending on the amount of data materialized. It is the
reponsibility of the user to maintain these directories. Dump file name examples:
saptools.dmp, syslogin.out, sysuser.out
The primary and standby device directories are not deleted during teardown. The dump
directories are defined using sap_set and setting property, device_buffer_dir. Any
device files created by the Replication server will get deleted by teardown. Device file
name example: partition1.dat.
sap_teardown:
67
Shuts down and deletes Replication Server instances, including their stable queue files.
Does nothing to the data in the standby database (the data remains current as of when
replication was last active).
The DR Agent supports the Replication Server hidden maintenance user password feature.
The Replication Server periodically changes the maintenance user password. After executing
sap_teardown, you may have to reset the Adaptive Server maintenance user password in both
Adaptive Servers before resetting up a new replication environment. Log in to each Adaptive
Server and execute the sp_password command, for example:
sp_password Sybase123, Sybase123, D01_maint
68
Replication-Related Servers
Replication-Related Servers
Replication Server and DR Agent are the replication-related servers in your disaster recovery
environment.
Starting DR Agent
The DR Agent must be running on both the primary and standby sites.
1. Log in to the host using the same operating system user that was used to install the DR
Agent and Replication Server.
2. Start the DR Agent:
./sybase/<SID>_REP/SYBASE.sh
nohup /sybase/<SID>_REP/SCC-3_2/bin/scc.sh &
69
Replication-Related Servers
70
71
72
Index
Index
A
Adaptive Server
HADR 2
high availability disaster recovery 2
restoring replicatation to standby 63
suspending replication to standby 64
suspending replication to standby database 61
upgrading 61
upgrading primary 65
upgrading standby 63
upgrading standby database 64
validating configuration 10
administration user
DR Agent 13
administration user 13
commands 49, 51
connecting 22
creating administrator 13
modifying port 9
other commands 49, 51
running 63
shuttong down standby 63
starting 63, 69
starting in UNIX 17
starting in UNIX as a service 17
starting in Windows 20
starting in Windows as a service 20
stopping in UNIX 17
stopping in Windows 20
verifying that it is running 21
viewing log files 22
dropping a host 26
C
cancelling
disaster recovery setup process 33
connecting to DR Agent 22
D
database
marking for replication 30
materialization 35
database dump directory
identifying 36
database name
setting 26
define the Replication Server on a separate computer
25
defining a logical host 24
defining the primary host 25
disaster recovery environment
architecture 2
disaster recovery setup
running 31
DR Agent
about 1
E
external materialize method 41, 42
F
failback 57
failover 55
planned 56
unplanned 56
foreground, running DR Agent in 17
I
installing
Replication Server 14
L
latency
tracing 45
log files
DR Agent 22
SCC 22
73
Index
M
materialization 35
cancelling progress 42
external method 41, 42
materializing with a different user 37
monitoring
replication environment 45
resource usage 46
P
planned failover 56
preinstallation tasks 9
prerequisites 6
SAP 5
primary Adaptive Server
upgrading 65
R
recovering
failed materilization 43
rematerializing
ERP 43
saptools 43
removing
privilege for user sapsso 64
replication disk buffer
adjusting the default size 29
calculating disk requirements 27
size 28
replication environment
monitoring 45
tearing down 67
Replication Server
installing 14
shutting down standby 62
starting 69
upgrading 61, 65
upgrading standby 61, 63
resource usage
monitoring 46
restarts
configuring in UNIX 17
configuring in Windows 20
running
disaster recovery setup 31
S
SAP
74
prerequisites 5
SAP_SID
defining 26
sapsso
removing privilege 64
scc.bat 20
scc.sh 17
sccd shell script 17
services, UNIX
running DR Agent as 17
services, Windows
running DR Agent as 20
set up
Adaptive Server 43
HADR 43
setup process
cancelling 33
shutting down
standby DR Agent 63
shutting down standby Replication Server 62
sofware versions
for Sybase replication 7
specifying the database dump location 27
Specifying the Replication Server device location
27
standby Adaptive Server
suspending replication 64
upgrading 63
standby Adaptive Server database
restoring replication 63, 64
resuming replication 63
suspending replication to 61
standby DR Agent
shutting down 63
standby logical host
defining 25
standby system administration 5
start up
automatic, configuring in UNIX 17
automatic, configuring in Windows 20
starting
DR Agent 69
Replication Server 69
starting DR Agent 63
starting the Replication Server
Windows service 33
suspending
replication to standby Adaptive Server 64
suspending replication
standby Adaptive Server 61
Index
Sybase Control Center
viewing log files 22
T
tracing latency 45
U
UNIX
running DR Agent in the background 17
running DR Agent in the foreground 17
starting, stopping DR Agent 17
upgrading
Adaptive Server 61
DR Agent 59
primary Adaptive Server 65
Replication Server 61, 65
standby Adaptive Server 63
standby Adaptive Server database 64
V
validating the environment 30
verifying
replication 61
sapsso privileges 64
viewing log files
DR Agent 22
SCC 22
W
Windows
starting, stopping DR Agent 20
75
Index
76