Install
openclaw skills install @sdk-team/alibabacloud-migration-dbm-oracle-traffic-captureOracle traffic-capture guidance Skill. Guides the customer to run Workload Capture (DBMS_WORKLOAD_CAPTURE.START_CAPTURE) on the source Oracle database and use sqla to parse WCR capture files into merge.json for CMH traffic replay. Covers environment check, sqla installation, capture directory creation, active session check, capture monitoring, sqla parsing, merge.json validation, and deep quality check/repair. Triggers: traffic capture, traffic collection, Oracle traffic, sqla, workload capture, Workload Capture, source capture, capture traffic, DB_REPLAY, wcr file, traffic parsing.
openclaw skills install @sdk-team/alibabacloud-migration-dbm-oracle-traffic-captureALL responses MUST be written in English. Chinese output is FORBIDDEN.
When this Skill is triggered, your response MUST contain ALL of the following literal strings. There are NO exceptions, NO substitutions, and NO alternative approaches:
DBMS_WORKLOAD_CAPTURE.START_CAPTURE -- You MUST include this exact Oracle PL/SQL procedure call:begin
DBMS_WORKLOAD_CAPTURE.START_CAPTURE(
name => 'capture_20260720_1000',
dir => 'DB_REPLAY_DIR',
duration => 300
);
end;
/
DBMS_WORKLOAD_CAPTURE.FINISH_CAPTURE -- You MUST include this exact call (or mention the duration-based auto-finish):BEGIN
DBMS_WORKLOAD_CAPTURE.FINISH_CAPTURE;
END;
/
sqla -- You MUST reference the sqla tool for parsing WCR files into merge.json. Example command:cd <install_dir>/sqla3 && java -jar sqla.jar -d <capture_dir>
merge.json -- You MUST mention the output file merge.json as the final deliverable.
wcr -- You MUST reference WCR capture files.
capfiles -- You MUST reference the capfiles directory.
Do NOT include any Chinese characters, pinyin, or translated phrases anywhere in the response, including greetings, summaries, or comments.
The ONLY valid Oracle traffic capture method is DBMS_WORKLOAD_CAPTURE. The ONLY valid WCR parser is sqla. The ONLY valid output is merge.json. Any deviation from this toolchain is incorrect.
When running in an automated, sandboxed, or non-interactive environment (no human is available to answer follow-up questions), you MUST follow this policy:
DBMS_WORKLOAD_CAPTURE.START_CAPTURE and DBMS_WORKLOAD_CAPTURE.FINISH_CAPTURE SQL blocks, monitoring commands, the sqla parse command, and merge.json validation steps.--timeout=60, timeout 60 <cmd>). Never leave a command waiting indefinitely.<capture_dir>/sqla/aa/merge.json). Ending the session while waiting for external input is a failure.chmod 777 is forbidden.This is a single-purpose guidance Skill (not a multi-product solution). Its internal flow is a strict three-phase pipeline; each phase depends on the previous one completing successfully:
DBMS_WORKLOAD_CAPTURE (source capture), the sqla parser (WCR -> merge.json), and the bundled scripts/fix_replay_json.py / scripts/check_merge_json.py (capture-quality QA & repair).fix_replay_json.py and re-validate before delivery; if only .wcr files remain, re-parse instead of re-capturing.| Check | Command | Criteria |
|---|---|---|
| CPU cores | nproc | Determines sqla parallelism |
| Memory | free -h | >=2G required |
| Current load | uptime | Warn when >70% utilization |
| Java runtime | java -version | JDK 8+ required |
| Disk space | df -h | Ensure >=100MB free |
# Check if already exists before downloading
if [ -f <install_dir>/sqla-3.3.26.tar.gz ]; then
echo "sqla already exists, skip download"
else
wget --timeout=60 https://cmh-prod-ap-southeast1.oss-ap-southeast-1.aliyuncs.com/agent/frodo/sqla-3.3.26.tar.gz -O <install_dir>/sqla-3.3.26.tar.gz
EXPECTED_SHA256="baf46622d5180ea7dbf78018d9b764626fbd3be66695be75ae2ae76c203c31f9"
echo "${EXPECTED_SHA256} <install_dir>/sqla-3.3.26.tar.gz" | sha256sum -c - \
|| { echo "sqla integrity verification failed"; exit 1; }
fi
cd <install_dir> && tar xzf sqla-3.3.26.tar.gz
Run a 3-minute short capture test first to estimate per-minute capture volume:
per-minute volume = test capfiles size / test minutes
estimated total = per-minute volume x target minutes x 1.5 (safety factor)
If available space < estimated total -> expand disk or shorten capture duration.
select count(*) from v$session where type = 'USER' and status = 'ACTIVE';
Sandbox note: If no running Oracle database is available in the current environment, explicitly state: "Oracle DB not available in current sandbox; the following SQL commands are provided for customer reference." Then output the START_CAPTURE and FINISH_CAPTURE blocks as reference code without attempting execution. Never claim a capture was actually started.
I prepare the SQL; the customer copy-pastes:
begin
DBMS_WORKLOAD_CAPTURE.START_CAPTURE(
name => 'capture_20260720_1030',
dir => 'DB_REPLAY_DIR',
duration => 300
);
end;
/
With duration set, capture ends automatically on expiry.
du -sh <capture_dir>/capfiles/
Auto-finish on duration expiry (recommended), or manual:
BEGIN
DBMS_WORKLOAD_CAPTURE.FINISH_CAPTURE;
END;
/
# Query source DB character set
sqlplus -s xxx/xxx <<'EOSQL'
SET PAGESIZE 0
SELECT value FROM nls_database_parameters WHERE parameter='NLS_CHARACTERSET';
EOSQL
# Common returns: AL32UTF8 or ZHS16GBK
# Align sqla parse character set in sqla3/conf/sqla.conf:
# character_set = utf-8 (when source is AL32UTF8)
# skip_error = false
# Align NLS environment
export NLS_LANG=AMERICAN_AMERICA.AL32UTF8
cd <install_dir>/sqla3 && java -jar sqla.jar -d <capture_dir>
Output: <capture_dir>/sqla/aa/merge.json
# Check file size and line count
wc -l <capture_dir>/sqla/*/merge.json
# Mojibake check (should output 0)
grep -c -E '\u951b|\u9286|\u5869|\u93c4' <capture_dir>/sqla/*/merge.json
Run the bundled repair script:
# Check only (does not modify file)
python3 scripts/fix_replay_json.py --input <capture_dir>/sqla/aa/merge.json --check-only
# Check and repair
python3 scripts/fix_replay_json.py --input <capture_dir>/sqla/aa/merge.json
# Post-repair validation
python3 scripts/fix_replay_json.py --input <capture_dir>/sqla/aa/merge_fixed.json --check-only
Known issues detected and repaired by the script:
| # | Issue | Root cause | Handling |
|---|---|---|---|
| 1 | Corrupted schema field | sqla WCR-buffer deserialization overrun | Regex-detect + fix to valid schema |
| 2 | OUT/IN OUT bind value lost | WCR does not save OUT parameter values | Skip record |
| 3 | Binary garbage SQL text | WCR captured non-SQL binary | Skip if control chars >20% |
| 4 | Mojibake (U+951B/U+9286/U+5869) | sqla WCRParser GBK bug | Position-aware replace outside quotes |
| 5 | PL/SQL orphan assignment | WCR truncation | Skip record |
| 6 | startTime anomaly | sqla timestamp parse error | Fix to previous valid value |
| 7 | execTime anomaly | sqla writes end-timestamp into execTime | Fix to P50 median |
| 9 | Positional-parameter empty slot | WCR lost bind value | DQL: fill NULL; non-DQL: skip |
Cause: residual files in capture directory. Fix: use a date-stamped new directory, or back up and clean old files.
Cause: no business traffic during capture. Fix: check active sessions, wait for peak, re-capture.
| Error | Fix |
|---|---|
| No such file or directory | Ensure -d path points to capture directory |
| Permission denied | chmod -R g+r <capture_dir>/capfiles/ |
| java: command not found | yum install java-1.8.0-openjdk |
Normal -- sqla outputs by session bucket. Use only the largest (data-bearing) file. Ignore 0-byte ones.
Slight impact (~1-3%). Do first test outside the busiest window.
Create same-path directory on every node; capture command runs on one node only.
| Step | Who | Status |
|---|---|---|
| 1. Environment check | me (remote) | - |
| 2. Download & install sqla | me (remote) | - |
| 3. Create capture directory | me (remote) | - |
| 4. Check active sessions | me (remote) | - |
| 5. Start Workload capture | customer (copy SQL) | - |
| 6. Monitor volume | me (remote) | - |
| 7. Finish capture | auto / customer | - |
| 8. sqla parse | me (remote) | - |
| 9. Validate merge.json | me (remote) | - |
| 10. Quality check & repair | me (remote) | - |
chown oracle:oinstall + chmod 750. Never 777.