read-only-mode

Follow

Manage Microsoft SQL Server READ ONLY mode

Subcommands

start Switch database into READ ONLY mode
exit Switch database into RESTORING mode
enable-schedule-function Turn on scheduled READ ONLY mode
disable-schedule-function Turn off scheduled READ ONLY mode
list-schedules List READ ONLY mode schedules
create-schedule Create READ ONLY mode schedule
enable-schedule Enable/disable READ ONLY mode schedule
disable-schedule Enable/disable READ ONLY mode schedule
edit-schedule Edit READ ONLY mode schedule
remove-schedule Remove READ ONLY mode schedule

start

dbvcli read-only-mode start {-d|--name} CONFIGURATION_NAME [--OPTIONS]

Switch database into READ ONLY mode

Option

Type

Description

--standby-file-directory

string

directory in which to create standby file

Example
C:\Program Files\Dbvisit\standbymp\bin>dbvcli.exe -d mine read-only-mode start
Connecting to the Control Center at localhost:4433 ✓

Checking available actions for this configuration ✓

Checking available actions for this configuration ✓

Standby File Directory
Enter the directory in which to create the standby file. This file is used by
SQL Server when the database is switched into READ ONLY mode.

Standby File Directory:

> c:\backup\

2024-11-13 08:25:13
2024-11-13 08:25:13  Switching standby database to standby mode
2024-11-13 08:25:13
Task succeeded

exit

dbvcli read-only-mode exit {-d|--name} CONFIGURATION_NAME

Switch database into RESTORING mode

Example
C:\Program Files\Dbvisit\standbymp\bin>dbvcli.exe -d mine read-only-mode exit
Connecting to the Control Center at localhost:4433 ✓

Checking available actions for this configuration ✓

2024-11-13 08:26:01
2024-11-13 08:26:01  Switching standby database to restoring mode
2024-11-13 08:26:01  Restoring log backup on standby database
2024-11-13 08:26:01  Restoring log backup from file(s): C:\Program Files\Dbvisit\standbymp\backup\3-mine-l-0-48-0000000040000000142500001-0000000040000000142900001.bak.
2024-11-13 08:26:03  done
2024-11-13 08:26:03  Deleting outdated backup file: C:\Program Files\Dbvisit\standbymp\backup\3-mine-l-0-48-0000000040000000142500001-0000000040000000142900001.bak
2024-11-13 08:26:03  Applying logs received while in Standby Mode because Automated Standby Update is enabled
2024-11-13 08:26:03
Task succeeded

enable-schedule-function

dbvcli read-only-mode enable-schedule-function {-d|--name} CONFIGURATION_NAME

Turn on scheduled READ ONLY mode

Example
C:\Program Files\Dbvisit\standbymp\bin>dbvcli.exe -d mine read-only-mode enable-schedule-function
Connecting to the Control Center at localhost:4433 ✓

Configuration mine Is Updated

disable-schedule-function

dbvcli read-only-mode disable-schedule-function {-d|--name} CONFIGURATION_NAME

Turn off scheduled READ ONLY mode

list-schedules

dbvcli read-only-mode list-schedules {-d|--name} CONFIGURATION_NAME

List READ ONLY mode schedules

Example
C:\Program Files\Dbvisit\standbymp\bin>dbvcli.exe -d mine read-only-mode list-schedules
Connecting to the Control Center at localhost:4433 ✓

Switch To Read-only Mode Schedules

Standby Database State:          RESTORING
Scheduled switching:             ON
Returning To Read-Only State At: 9:10 am (Wed) 13 Nov 2024

--   ---------------   ----------   ------   -------------------
ID   Cron Expression   Duration     State    Name
--   ---------------   ----------   ------   -------------------
1    10 * * * *        20 minutes   active   new-20mins-schedule

create-schedule

dbvcli read-only-mode create-schedule {-d|--name} CONFIGURATION_NAME [--OPTIONS]

Create READ ONLY mode schedule

Option

Type

Description

--standby-file-directory

string

directory in which to create standby file

--cron-expression

string

cron expression specifying when to activate READ ONLY mode

--duration

number

duration of READ ONLY mode, in minutes

--schedule-name

string

name of schedule (optional)

Example
C:\Program Files\Dbvisit\standbymp\bin>dbvcli.exe -d mine read-only-mode create-schedule
Connecting to the Control Center at localhost:4433 ✓

Checking available actions for this configuration ✓

Standby file directory:

c:\backup\

Standby File Directory Prompt Skipped (Using Standby File Directory: c:\backup\)

The cron expression is made of five fields.

minute            hour              day(month)        month             day(week)

10                *                 *                 *                 *

At minute 10
----------------------------------------------
*                 any value
,                 value list
-                 range of values
/                 step values
tab: focus next • shift+tab: focus prev • enter: confirm


Duration
Enter the number of minutes that the standby database should be kept in READ
ONLY mode before returning it to RESTORING.

Duration (minutes):

> 20

Name
Enter a name for the schedule, or leave blank for no name.

Name:

> new-20mins-schedule

Configuration mine Is Updated

enable-schedule

dbvcli read-only-mode enable-schedule {-d|--name} CONFIGURATION_NAME [--OPTIONS]

Enable/disable READ ONLY mode schedule

Option

Type

Description

--schedule-id

string, required

READ ONLY mode schedule ID to enable/disable

disable-schedule

dbvcli read-only-mode disable-schedule {-d|--name} CONFIGURATION_NAME [--OPTIONS]

Enable/disable READ ONLY mode schedule

Option

Type

Description

--schedule-id

string, required

READ ONLY mode schedule ID to enable/disable

edit-schedule

dbvcli read-only-mode edit-schedule {-d|--name} CONFIGURATION_NAME [--OPTIONS]

Edit READ ONLY mode schedule

Option

Type

Description

--schedule-id

string, required

READ ONLY mode schedule ID to edit

--cron-expression

string

cron expression specifying when to activate READ ONLY mode

--duration

number

duration of READ ONLY mode, in minutes

--schedule-name

string

name of schedule (optional)

remove-schedule

dbvcli read-only-mode remove-schedule {-d|--name} CONFIGURATION_NAME [--OPTIONS]

Remove READ ONLY mode schedule

Option

Type

Description

--schedule-id

string, required

READ ONLY mode schedule ID to remove

Have more questions? Submit a request

Comments