# Oracle Tuning Ptbr

> Performance tuning Oracle 19c — explain plan, AWR em tempo real, ASH, indexes, hints, bind variables, cursor sharing, DBMS_STATS, V$SQL, V$SQLAREA, V$SESSION_WAIT. ATIVE em query lenta, full scan indesejado, hard parse alto, index strategy, plano de execução ruim, estatísticas desatualizadas, cardinality errada, AWR snapshot, ASH amostragem. Frases — "query está lenta", "qual index criar", "melho…

- **Type:** Skill
- **Install:** `agentstack add skill-maxwbh-oracle-skills-ptbr-oracle-tuning-ptbr`
- **Verified:** Yes — security-reviewed for prompt injection and unsafe behavior
- **Seller:** [Maxwbh](https://agentstack.voostack.com/s/maxwbh)
- **Installs:** 0
- **Category:** [Databases](https://agentstack.voostack.com/c/databases)
- **Latest version:** 0.1.0
- **License:** MIT
- **Upstream author:** [Maxwbh](https://github.com/Maxwbh)
- **Source:** https://github.com/Maxwbh/oracle-skills-ptbr/tree/main/skills/oracle-tuning-ptbr
- **Website:** https://maxwbh.github.io/oracle-skills-ptbr/

## Install

```sh
agentstack add skill-maxwbh-oracle-skills-ptbr-oracle-tuning-ptbr
```

Requires the [AgentStack CLI](https://agentstack.voostack.com/docs/cli). Works with Claude Code, Cursor, and any MCP-compatible agent.

## About

# oracle-tuning-ptbr — v2.0.0

Performance tuning Oracle 19c — análise de planos de execução, índices, AWR e ASH em tempo real.

**Desenvolvido por:** Maxwell da Silva Oliveira — [M&S do Brasil LTDA](https://msbrasil.inf.br)

## Áreas cobertas

| Área | Reference | Assets |
|---|---|---|
| **Performance** | `references/performance-tuning.md` | `explain_plan_workflow.sql`, `index_strategy_examples.sql` |

## Quando ativar

- Query lenta — análise de explain plan, `AUTOTRACE`, `DBMS_XPLAN.DISPLAY_CURSOR`
- Índices: `B-Tree`, `Bitmap`, `Function-Based`, `Composite`, `Invisible`
- `V$SQL`, `V$SQLAREA` — top SQL por `ELAPSED_TIME`, `CPU_TIME`, `BUFFER_GETS`
- `V$SESSION_WAIT`, `V$SYSTEM_EVENT` — wait event analysis
- Hard parse alto: bind variables ausentes, cursor sharing
- Cardinality errada: `DBMS_STATS`, `METHOD_OPT`, `HISTOGRAM`
- AWR em tempo real: `DBA_HIST_SQLSTAT`, `DBA_HIST_SYSTEM_EVENT` (requer Diagnostics Pack)
- ASH: `V$ACTIVE_SESSION_HISTORY`, `DBA_HIST_ACTIVE_SESS_HISTORY`
- Hints: `/*+ APPEND */`, `/*+ INDEX */`, `/*+ PARALLEL */`, `/*+ FIRST_ROWS */`
- `MERGE` vs loop, `BULK COLLECT` para I/O pesado
- Estatísticas: `GATHER_SCHEMA_STATS`, `GATHER_TABLE_STATS`, lock stats

**Não usar** para: DBA ops (sessão/lock/kill), código PL/SQL novo, APEX, ORDS.

## Princípios canônicos

- **Medir antes de otimizar.** Baseline com `SET TIMING ON` + `AUTOTRACE`. Sem medição, otimização é placebo.
- **Bind variables primeiro.** Hard parse elevado em `V$SQLAREA` resolve antes de qualquer tuning de index.
- **Index ≠ sempre melhor.** Full scan em tabela pequena ou query retornando > 10% das linhas geralmente vence B-Tree.
- **AWR requer licença.** `DBA_HIST_*` → Diagnostics Pack obrigatório. Checar `control_management_pack_access`.
- **Histogram nas colunas com skew.** Sem histogram, optimizer usa densidade plana → plano errado em distribuição assimétrica.
- **CREATE INDEX ONLINE** em produção — sem `ONLINE`, bloqueia DML.

## Referências cruzadas

| Precisa de | Skill |
|---|---|
| PL/SQL com BULK COLLECT, loop otimizado | **oracle-plsql-ptbr** |
| AWR histórico, sessões, DBA operacional | **oracle-dba-ptbr** |
| Query lenta em report APEX | **oracle-apex-ptbr** |
| Naming Trivadis em scripts de tuning | **oracle-trivadis-ptbr** |

## Source & license

This open-source skill is cataloged on AgentStack and links to its original source — we do not rehost the code.

- **Author:** [Maxwbh](https://github.com/Maxwbh)
- **Source:** [Maxwbh/oracle-skills-ptbr](https://github.com/Maxwbh/oracle-skills-ptbr)
- **License:** MIT
- **Homepage:** https://maxwbh.github.io/oracle-skills-ptbr/

Install and usage instructions live in the source repository linked above.

## Pricing

- **Free** — Free

## Security capabilities

Automated source analysis of v0.1.0 — what this tool can access:

- **Network access:** no
- **Filesystem access:** no
- **Shell / process execution:** no
- **Environment & secrets:** no
- **Dynamic code execution:** no

*"Yes" means the capability is present in the source — more access means more to trust, not that it is unsafe.*


## Versions

- **0.1.0** — security scan: passed — Imported from the upstream source.

## Links

- Listing page: https://agentstack.voostack.com/l/skill-maxwbh-oracle-skills-ptbr-oracle-tuning-ptbr
- Seller: https://agentstack.voostack.com/s/maxwbh
- Browse the marketplace: https://agentstack.voostack.com/browse

---
Listed on AgentStack — the marketplace for AI agent skills and MCP servers. Every listing is security-reviewed. Creators keep 70%.
