Database Consistency

Zerto replicates continuously, maintaining the write-order fidelity of all the block level changes between all virtual machines in a VPG and all disks within each virtual machine. This means that replication is always crash-consistent.

See the following sections:

Database Consistency in a Windows Environment
Database Consistency in a Linux Environment

Database Consistency in a Windows Environment

To maintain database consistency in Oracle virtual machines running Windows, Zerto recommends installing the Zerto PowerShell cmdlets. A PowerShell script can then be scheduled, to create database consistent points-in-time, checkpoints. Use the following process:

1. Windows Task Scheduler starts the PowerShell script.
2. The PowerShell script loads user configured variables.
3. The PowerShell script does the following:
a. Connects to the database using SQLPLUS.
b. Places the database into backup mode.
c. Inserts a checkpoint into the journal for the Oracle VPG using the Set-Checkpoint cmdlet to mark the database consistent point-in-time.
d. Ends the backup mode to resume normal database operations.
Note: For a blog entry describing how to use the Windows Task Scheduler to Run a Windows PowerShell Script, refer to http://blogs.technet.com/b/heyscriptingguy/archive/2012/08/11/weekend-scripter-use-the-windows-task-scheduler-to-run-a-windows-powershell-script.aspx.

The following is a sample PowerShell script for creating database consistent points-in-time in Windows:

# Start of script - Configure the variables below

$OracleUser = "system"

$OraclePassword = "password"

$OracleServer = "OracleServer"

$ZVMServerIP = "123.123.123.123"

$ZVMPort = "9080"

$ZVMUser = "administrator"

$ZVMPassword = "password"

$VPGName = "Oracle"

$CheckpointTag = "HotBackup"

# Nothing to configure below here, load Zerto PowerShell commands

add-pssnapin "Zerto.PS.Commands"

# Connect to Oracle and place the database in hot backup mode

$OracleConnectionString = $OracleUser + "/" + $OraclePassword + "@" + $OracleServer

sqlplus $OracleConnectionString

ALTER DATABASE BEGIN BACKUP;

EXIT

# Insert a checkpoint in the Zerto journal for the defined VPG

Set-Checkpoint -VirtualProtectionGroup $VPGName -Tag $CheckpointTag -ZVMIP $ZVMServerIP -ZVMPort $ZVMPort -Username $ZVMUser -Password

$ZVMPassword

# Connect to Oracle and resume normal database operations

sqlplus $OracleConnectionString

ALTER DATABASE END BACKUP;

EXIT

# End of script

The frequency with which database consistent points-in-time can be inserted is dependent on the performance of the Oracle databases and services, not Zerto. In theory, Zerto could support inserting database consistent checkpoints every few seconds, since Zerto just inserts a point-in-time marker while database consistency is handled by Oracle hot backup mode.

Zerto best practice: Start with daily database consistent points-in-time and build up to reach the maximum level that the databases and services can handle.

Upon recovering a Windows Oracle database virtual machine from a database consistent checkpoint it is required to release the database from backup mode to continue normal operation as it will not start automatically on boot. The following sample command shows how this can be done:

sqlplus / as sysdba

startup mount;

alter database end backup;

alter database open;

Database Consistency in a Linux Environment

To insert database consistent points-in-time in Linux virtual machines, Zerto recommends installing the Zerto PowerShell cmdlets on a Zerto Virtual Manager Windows server virtual machine, with a PowerShell SSH server to allow remote execution from Linux virtual machines. To write a database consistent point-in-time, use the following process:

1. An Oracle Linux virtual machine runs a bash script that places the database into backup mode.
2. Via SSH, the bash script connects to the Zerto Virtual Manager PowerShell server and executes a PowerShell script.
3. The PowerShell script on the Zerto Virtual Manager inserts a checkpoint into the journal for the Oracle VPG using the Set-Checkpoint cmdlet to mark the database consistent point-in-time.
4. The bash script disconnects the SSH session.
5. The bash script ends the backup mode to resume normal database operations.

The following is a sample Linux script for creating database consistent points-in-time in Linux:

#!/bin/bash

# Place database in backup mode

sqlplus "/as sysdba" <<EOF

alter database begin backup;

exit;

EOF

# Run the remote PowerShell script on the PowerShell server via SSH

ssh administrator@123.123.123.123 '.\oraclevpg.ps1' exit

ENDSSH

# Resume normal database operations

sqlplus "/as sysdba" <<EOF

alter database end backup;

exit;

EOF

# End of script

Zerto best practice: To enable remote SSH access to PowerShell cmdlets on the Zerto Virtual Manager, Zerto recommends using the PowerShell Server that can be downloaded from http://www.powershellserver.com/download/.

The following is a sample PowerShell script that can be run on the Zerto Virtual Manager, initiated from the Linux virtual machine via SSH:

#

# Start of script - Configure the variables below

#

$ZVMServerIP = "123.123.123.123"

$ZVMPort = "9080"

$ZVMUser = "administrator"

$ZVMPassword = "password"

$VPGName = "Oracle"

$CheckpointTag = "HotBackup"

#

# Insert the checkpoint into the journal

#

Set-Checkpoint -VirtualProtectionGroup $VPGName -Tag $CheckpointTag -ZVMIP $ZVMServerIP -ZVMPort $ZVMPort -Username $ZVMUser -Password $ZVMPassword

#

# End of script

#

Upon recovering a Linux Oracle database virtual machine from a database consistent checkpoint it is required to release the database from backup mode to continue normal operation as it will not start automatically on boot. The following sample command shows how this can be done:

sqlplus / as sysdba

startup mount;

alter database end backup;

alter database open;