The SET_SYSTEM_STATS procedure sets system statistics.
Syntax
DBMS_STATS.SET_SYSTEM_STATS (
pname VARCHAR2,
pvalue NUMBER);
Parameters
| Parameter | Description |
|---|---|
| pname | The name of the parameter. Valid values: cpu_speed, disk_seq_read_speed, disk_rnd_read_speed, and network_speed. |
| pvalue | The value of the preference. |
Exceptions
| Error code | Description |
|---|---|
| HY000 | The entered name of the system statistical item is incorrect. |
Considerations
- To call this procedure, you must connect to the database as the specified user, or have the
SYSDBAprivilege.
Examples
Call the DBMS_STATS.SET_SYSTEM_STATS stored procedure to set system statistics. In this example, the parameter name is set to cpu_speed and pvalue is set to 5000. This value indicates the number of CPU cycles that can be executed per second in the current hardware environment and must be estimated or obtained based on actual measurements.
BEGIN
-- Set the CPU speed to 5000, which is a CPU speed in a specific measurement unit.
DBMS_STATS.SET_SYSTEM_STATS('cpu_speed', 5000);
END;
/
If you want to set the sequential read speed of the disk (disk_seq_read_speed), call the procedure as follows:
BEGIN
-- Set the sequential read speed of the disk to 200, which is a disk read speed in a specific measurement unit.
DBMS_STATS.SET_SYSTEM_STATS('disk_seq_read_speed', 200);
END;
/