2026-10-04 08:36:14
This commit is contained in:
1 parent
4f6a34cfcc
commit
fc997210bf
2 files changed
+226
-4
No files matched your search
@@ -1,13 +1,20 @@
|
||||
# Oracle E-commerce and Accounting Workload
|
||||
|
||||
This project contains three SQL*Plus/SQLcl scripts for creating and exercising
|
||||
an Oracle e-commerce and accounting schema.
|
||||
This project contains SQL*Plus/SQLcl scripts for creating and exercising an
|
||||
Oracle e-commerce and accounting schema, including background workload jobs.
|
||||
|
||||
## Requirements
|
||||
|
||||
- Oracle Database 12c or later. The schema uses identity columns and daily
|
||||
interval partitioning.
|
||||
- Run the scripts while connected as the schema owner.
|
||||
- The Scheduler management procedures require the schema owner to have the
|
||||
`CREATE JOB` system privilege. A DBA can grant it directly:
|
||||
|
||||
```sql
|
||||
GRANT CREATE JOB TO your_schema;
|
||||
```
|
||||
|
||||
- The activity procedure uses `DBMS_LOCK.SLEEP`. The schema owner may need a
|
||||
direct grant from a DBA:
|
||||
|
||||
@@ -25,11 +32,13 @@ Run these scripts in order from SQL*Plus or SQLcl:
|
||||
@oracle_ecommerce_schema.sql
|
||||
@oracle_ecommerce_seed_2gb.sql
|
||||
@oracle_ecommerce_activity.sql
|
||||
@oracle_ecommerce_job_management.sql
|
||||
```
|
||||
|
||||
The schema script creates objects only. The seed script expects the schema to
|
||||
be empty and should be run once. The activity script creates or replaces the
|
||||
workload procedure and can be rerun to install procedure changes.
|
||||
be empty and should be run once. The activity and job-management scripts
|
||||
create or replace their procedures and can be rerun to install procedure
|
||||
changes.
|
||||
|
||||
## `oracle_ecommerce_schema.sql`
|
||||
|
||||
@@ -110,3 +119,46 @@ EXEC simulate_commerce_activity(100, 2, 5.5);
|
||||
The procedure prints a one-line summary for each iteration and a final total
|
||||
and realized average. `DBMS_OUTPUT` is buffered, so SQL*Plus/SQLcl may display
|
||||
the output after the procedure completes.
|
||||
|
||||
## `oracle_ecommerce_job_management.sql`
|
||||
|
||||
Creates four procedures for managing one-time Oracle Scheduler jobs that run
|
||||
`SIMULATE_COMMERCE_ACTIVITY` asynchronously. A created job is enabled
|
||||
immediately, starts as soon as Scheduler can run it, executes the specified
|
||||
number of iterations, and remains in the schema's Scheduler job list after
|
||||
completion (`AUTO_DROP` is disabled).
|
||||
|
||||
```sql
|
||||
SET SERVEROUTPUT ON
|
||||
|
||||
-- Create a background job: name, iterations, seconds between iterations,
|
||||
-- average DML rows per iteration.
|
||||
EXEC create_commerce_activity_job('COMMERCE_LOAD_01', 10000, 3, 5.5);
|
||||
|
||||
-- List Scheduler jobs for SIMULATE_COMMERCE_ACTIVITY.
|
||||
EXEC list_commerce_activity_jobs;
|
||||
|
||||
-- Stop and disable a pending or running job; it remains listed.
|
||||
EXEC stop_commerce_activity_job('COMMERCE_LOAD_01');
|
||||
|
||||
-- Remove the job. FORCE also stops it if it is still running.
|
||||
EXEC remove_commerce_activity_job('COMMERCE_LOAD_01');
|
||||
```
|
||||
|
||||
The list procedure reports the job state, enabled status, run/failure counts,
|
||||
and last start time. `STOP` disables the job and force-stops it if running;
|
||||
it does not resume automatically. `REMOVE` drops the job and force-stops it
|
||||
if necessary. These operations apply to jobs owned by the connected schema.
|
||||
|
||||
For run history and Scheduler error messages, query the job run details view:
|
||||
|
||||
```sql
|
||||
SELECT log_date, status, error#, additional_info
|
||||
FROM user_scheduler_job_run_details
|
||||
WHERE job_name = 'COMMERCE_LOAD_01'
|
||||
ORDER BY log_date DESC;
|
||||
```
|
||||
|
||||
The activity procedure's `DBMS_OUTPUT` is generated in the Scheduler worker
|
||||
session and is not normally returned to the session that submitted the job.
|
||||
Use Scheduler run details to inspect completion status and errors.
|
||||
Reference in new issue
Block a user