Microsoft SQL Server resources protect a SQL Server instance by managing the SQL Server service during failover and failback operations. When the primary server fails, LifeKeeper brings the SQL Server service in-service on a standby server.

Resource Type: database/sqlapp
Aliases: sqlapp

Preconditions

  • Microsoft SQL Server must be installed on the primary server.
  • The SQL Server instance must exist and be reachable with the provided credentials.
  • For a named instance, the instance must be configured and accessible by the specified instance name.
  • If --ip-resource is specified, the referenced LifeKeeper IP resource must already exist on the server.
  • If --relocation-volume is specified, the referenced shared/replicated volume must already exist on the server and be protected by a LifeKeeper resource.
  • The Microsoft SQL Server user provided for monitoring (via the --sql-username flag) must have the “sysadmin” fixed server role (SA privileges).

Subcommands

Microsoft SQL Server resources are managed by commands of the form:

lkcli resource database/sqlapp <subcommand> [flags]

Subcommand Description Required Role
create Create a new SQL Server resource admin
extend Extend to a standby server admin
get-property Read a resource property guest
set-property Update an editable resource property admin

create

lkcli resource database/sqlapp create \
  --instance=<string> --sql-username=<string> --sql-password=<string> [flags]

Flag Short Type Required Default Constraints Description
--instance string Yes SQL Server instance name. Use MSSQLSERVER for the default instance.
--sql-username string Yes SQL Server administrative username
--sql-password string Yes SQL Server administrative password
--protected-service-list array No Comma-separated list of additional Windows service display names to bring in/out of service with SQL Server (e.g., “SQL Browser,SQL Server Agent (INSTANCE1)“)
--ip-resource string No Tag of a LifeKeeper IP resource to bring in/out of service with this resource
--relocation-volume string No Drive letter of a shared or replicated volume to relocate database files to
--tag string No Auto-generated Resource tag name
--switchback enum No INTELLIGENT INTELLIGENT, AUTOMATIC Switchback type
--local-recovery enum No enabled enabled, disabled Enable local recovery (Windows only)
--quickcheck-interval int No 180 min: 0, max: 604800 Quickcheck interval in seconds (Windows only)
--deepcheck-interval int No 300 min: 0, max: 604800 Deepcheck interval in seconds (Windows only)

Note one --protected-service-list: At creation time, supply service display names as shown in the Windows Services MMC snap-in (e.g., “SQL Server Agent (INSTANCE1)“). When reading the property back via get-property or updating via set-property, use short service names instead.

extend

lkcli resource database/sqlapp extend \
  --primary-sys=<string> --primary-tag=<string> [flags]

Flag Short Type Required Default Constraints Description
--primary-sys string Yes Hostname of the server the existing resource is extended from
--primary-tag string Yes Tag of the existing resource to extend
--standby-sys string No Value of --host (defaults to localhost) Hostname of the standby server
--switchback enum No INTELLIGENT INTELLIGENT, AUTOMATIC Switchback type
--primary-priority int No Defaults to the current priority of the --primary-sys server, or 1 if the resource has not yet been extended min: 1, max: 999 Failover priority for the primary server
--standby-priority int No Defaults to an unused value which is computed dynamically based on the priority values currently in-use min: 1, max: 999 Failover priority for the standby server

get-property / set-property

lkcli resource database/sqlapp get-property --tag=<string> --property=<string>
lkcli resource database/sqlapp set-property --tag=<string> --property=<string> --value=<string>

Flag Short Type Required Description
--tag -t string Yes Resource tag name
--property -p string Yes Property name (see Properties table below)
--value -v string Yes (set-property only) New property value

Additional set-property flag:

Flag Type Default Constraints Description
--update-cluster enum yes yes, no Whether to apply the property change across all cluster nodes

Properties

Property Type Constraints Editable Description
instance string No SQL Server instance name
sql-version string No Installed SQL Server version
db-auth object Yes SQL Server authentication credentials object
protected-service-list array Yes List of additional Windows services to protect (note: set-property uses short service names; get-property also returns short names)
protected-db-list array Yes List of databases to protect
kit-name string No Recovery kit name
switchback enum INTELLIGENT, AUTOMATIC Yes Switchback type
quickcheck-interval int min: 0, max: 604800 Yes Quickcheck interval in seconds (Windows only; default: 180)
deepcheck-interval int min: 0, max: 604800 Yes Deepcheck interval in seconds (Windows only; default: 300)
local-recovery enum enabled, disabled Yes Enable local recovery (Windows only)

Example Usage

# Create a SQL Server resource for the default instance
lkcli resource database/sqlapp create \
  --host=server1 \
  --instance=MSSQLSERVER \
  --sql-username=sa \
  --sql-password=MyPassword! \
  --tag=sqlapp.MSSQLSERVER

# Create with additional protected services
lkcli resource sqlapp create \
  --host=server1 \
  --instance=INSTANCE1 \
  --sql-username=sa \
  --sql-password=MyPassword! \
  --protected-service-list="SQL Browser,SQL Server Agent (INSTANCE1)" \
  --tag=sqlapp.INSTANCE1

# Extend the resource to server2
lkcli resource database/sqlapp extend \
  --primary-sys=server1 \
  --primary-tag=sqlapp.MSSQLSERVER \
  --standby-sys=server2

# Get the current switchback setting
lkcli resource database/sqlapp get-property \
  --host=server1 \
  --tag=sqlapp.MSSQLSERVER \
  --property=switchback

# Change switchback type
lkcli resource sqlapp set-property \
  --host=server1 \
  --tag=sqlapp.MSSQLSERVER \
  --property=switchback \
  --value=AUTOMATIC

Feedback

Was this helpful?

Yes No
You indicated this topic was not helpful to you ...
Could you please leave a comment telling us why? Thank you!
Thanks for your feedback.

Post your comment on this topic.

Post Comment