The Windows service-related commands enable you to start or stop an instance and to check its operating state.
If you are to use Windows services, you should register instances in Windows services.
See
Refer to "When an instance was created with WebAdmin" in "Configuring Automatic Start and Stop of an Instance" in the Installation Guide for Server for information on registering instances in Windows services.
Note
While it is also possible for you to execute the pg_ctl command to start and stop instances without having to register instances in Windows services, it is recommended that you use Windows services to start and stop instances for the following reason:
If you use the pg_ctl command to start an instance, the instance will be started as a user process. Therefore, when you close the [Command Prompt] window in which you executed the command, Windows forces the postgres process to stop.
You can start an instance by specifying the service name in the net start command or sc start command.
Also, you can use the following procedure to start an instance in the Windows services window:
Display the [Services] window
Windows Server(R) 2012 and Windows Server(R) 2012 R2:
In the [Start] screen, select [Administrative Tools], and then click [Services].
All other operating systems:
In the [Start] menu, select [Administrative Tools], and then click [Services].
Start a service
Select the instance name that you wish to start from the services list, and click [Start Service].
You can stop an instance by specifying the service name in the net stop command or sc stop command.
Also, you can use the following procedure to stop an instance in the Windows services window:
Display the [Services] window
Windows Server(R) 2012 and Windows Server(R) 2012 R2::
In the [Start] screen, select [Administrative Tools], and then click [Services].
All other operating systems:
In the [Start] menu, select [Administrative Tools], and then click [Services].
Stop the service
Select the instance name that you wish to stop from the services list, and click [Stop Service]. If you stop a service while applications and commands are running, Symfoware Server will force those applications and commands to close and will stop normally.
Checking the operating state of an instance
Use the following procedure to check if an instance is operating correctly immediately after performing the operation to start an instance:
Display the [Services] window
In the [Start] menu, select [Administrative Tools], and then click [Services].
Check the state of the service
In the services list, check the state of the services for the applicable Symfoware Server.
To check the operating state of an instance during operation, use the pg_ctl command.
Specify the following in the pg_ctl command:
Specify "status" as the mode.
Specify the data storage destination directory in the -D option. If the -D option is omitted, the value of the PGDATA environment variable is used by default.
Example
When the instance is active:
> pg_ctl status -D D:\database\inst1 pg_ctl: server is running (PID: 1234)
When the instance is inactive:
> pg_ctl status -D D:\database\inst1 pg_ctl: no server running
Information
You can also use the net start command or sc query command to check the operating state of an instance.
See
Refer to "pg_ctl" in "Reference" in the PostgreSQL Documentation for information on the pg_ctl command.