CMCTL> command
cmctl [command] [argument1 . . . argumentN] [-c instance_name]
cmctl @input_file
If an Oracle Connection Manager instance name is not provided, then the default instance name is assumed. The default name is cman_hostname.
Instances are defined in the cman.ora file.
注:交互模式不能使用instance选项,因此在进入交互模式时要先指定instance name
CMCTL> administer [-c] instance_name
(一)启/关/停gateway
To start Oracle Connection Manager.
cmctl STARTUP [-c instance_name]
To shut down specific gateway processes or the entire Oracle Connection Manager instance.
cmctl SHUTDOWN [gateways gateway] [normal | abort] [-c instance_name]
normal: To reject new connections and terminate after existing connections close. This is the default.
abort: To shut down Oracle Connection Manager immediately, and close all open connections.
cmctl RELOAD [-c instance_name]
The SET RELOAD command restores configurations set in cman.ora, and override the SET command.
To specify which gateway processes will no longer accept new client connections.
cmctl SUSPEND GATEWAY [gateway_process_id] [-c instance_name]
To resume gateway processes that have been suspended.
cmctl RESUME GATEWAYS [gateway_process_id] [cman_name]
gateway_process_id: One or more gateway processes to reopen. Separate multiple gateway processes using a space between the process identifiers.
Issuing RESUME GATEWAYS without an argument reopens all gateway processes that have been closed.
- 查看gateway状态
cmctl HELP [command] [-c instance_name]
cmctl SHOW GATEWAYS [gateway] [-c instance_name]
cmctl SHOW SERVICES [-c instance_name]
cmctl SHOW VERSION [-c instance_name]
- 连接控制
查看连接
cmctl SHOW CONNECTIONS [information] [in state] [gt time] [from source]
[to destination] [for service] [using gateway_process_id]
[connect_identifier_list] [-c instance_name]
information: Specify one of the following values to display information about connections. Information categories include connection identifier, source, destination, service, current state, total idle time, and total elapsed time.
count: The total number of connections that meet the criteria specified by the other qualifiers. This is the default.
detail: All information about connections specified by the other qualifiers.
Examples
CMCTL> SHOW CONNECTIONS gt 1:30:00 from 192.0.2.32/24 to host1
关闭连接
$ cmctl CLOSE CONNECTIONS [in state] [gt [hh:mm:]ss ] [from source] [to destination]
[for service] [using gateway_process_id] [connect_identifier_list][-c cman_name]
state: One of the following values to specify the connection state:
idle: Connections that are inactive in the established state.
connecting: Connections that are in the process of connecting.
established: Connections that are connected and are transferring data.
terminating: Connections that are disconnecting.
If no state is specified, then CLOSE CONNECTIONS defaults to all possible states.
source: The source address. Use one of the following formats to specify the source address:
from IP, from hostname, from subnet
destination: The destination address:
from IP, from hostname, from subnet
service: The service name. Use the service_name parameter to specify the service, such as sales.us.example.com.
gateway_process_id:
The gateway process identifier is a number. Use this number to specify connections that are proxied by the gateway process indicated. To determine the gateway process identifier, use the Oracle Connection Manager control utility show gateways command.
connect_identifier_list: The connection identifiers. Use a space between multiple connection identifiers in a list.
Usage Notes:
Because the CLOSE CONNECTIONS command terminates connections, it might generate error messages on both client and server sides.
The IDLE state qualifier always requires a time qualifier.
Issuing CLOSE CONNECTIONS without an argument closes all connections.
Examples
The following example shuts down connections in any state. The elapsed time of the connection must be greater than 1 hour and 30 minutes. The connection source is the specified subnet, and the destination is the specified host name.
CMCTL> CLOSE CONNECTIONS gt 1:30:00 from 192.0.2.32/24 to host1
The following example shuts down those connections proxied by gateway process 0 that have been in the idle state more than 30 minutes:
CMCTL> CLOSE idle CONNECTIONS gt 30:00 using 0
(四)参数设置
cmctl SHOW [-c instance_name]
cmctl SHOW ALL [-c instance_name]
To combine and display output from the SHOW PARAMETERS and SHOW RULES commands.
cmctl SHOW DEFAULTS [-c instance_name]
To display default parameter settings.
cmctl SHOW EVENTS [-c instance_name]
cmctl SHOW PARAMETERS [-c instance_name]
To display current parameter settings for an instance.
Several configuration parameters can be dynamically modified using the SET command. Therefore, the information that SHOW PARAMETERS displays might be different from what appears in the cman.ora file.
cmctl SHOW RULES [-c instance_name]
To display the access control list currently used by the instance.
设置参数
cmctl set --查看可设置参数
cmctl SET ASO_AUTHENTICATION_FILTER {on | off (default)}[-c instance_name]
cmctl SET CONNECTION_STATISTICS {yes | no(默认)}[-c instance_name]
If SET CONNECTION_STATISTICS is set to yes, then you can obtain statistics by issuing the show connections command.
cmctl SET EVENT event_group [-c instance_name]
event_group: Specify one of the following event groups:
init_and_term: Initialization and termination event group.
memory_ops: Memory operations event group.
conn_hdlg: Connection handling event group.
proc_mgmt: Process management event group.
reg_and_load: Registration and load update event group.
wake_up: Events related to Connection Manager Administration (CMADMIN) wakeup queue event group.
timer: Gateway timeouts event group.
cmd_proc: Command processing event group.
relay: Events associated with connection control blocks event group.
The SET EVENT command accepts only one argument. To log multiple events, you must issue the command for each event separately.
时间单位秒,默认为0即disable this feature
cmctl SET IDLE_TIMEOUT [time] [-c instance_name]
- To specify the maximum amount of time the Oracle Connection Manager listener waits for a valid connection request from the client before timing out.
cmctl SET INBOUND_CONNECT_TIMEOUT [time] [-c instance_name]
cmctl SET LOG_DIRECTORY [directory_path] [-c instance_name]
只用于未开启ADR时,默认为ORACLE_HOME/log
cmctl SET LOG_LEVEL [level] [-c instance_name]
level: Specify one of the following log levels:
off: No logging.
user: User log information.
admin: Administrative log information
support: Oracle Support Services log information. This is the default.
Specify off to capture the minimum amount of log information. Specify support to capture the maximum amount.
cmctl SET TRACE_DIRECTORY [directory_path] [-c instance_name]
This command works only if Automatic Diagnostic Repository (ADR) is not enabled. The default is for ADR to be enabled. The default path is ORACLE_HOME/network/trace.
cmctl SET TRACE_LEVEL [level] [-c instance_name]
level: off|user|admin|support
- To specify the maximum amount of time the Oracle Connection Manager instance waits for a valid connection with the server before timing out.
cmctl SET OUTBOUND_CONNECT_TIMEOUT [time] [-c instance_name]
time: The outbound connect timeout in seconds. The default is 0.
cmctl SET SESSION_TIMEOUT [time] [-c instance_name]
time: The session timeout in seconds. The default is 0 (zero), which disables this feature.
(五)密码设置
This command does not save the password to cman.ora. As a result the password is valid only for the current session. To save the password after you have set it, run the save_passwd command.
To save the current password to the cman.ora file
cmctl SAVE_PASSWD [-c instance_name]