48 lines
1.9 KiB
Markdown
48 lines
1.9 KiB
Markdown
# MARS-1096: Extend A_PROCESS_LOG and Enable Daily Interval Partitioning
|
|
|
|
## Scope
|
|
- Extend `CT_MRDS.A_PROCESS_LOG.LOG_MESSAGE` to `VARCHAR2(20000)`
|
|
- Convert table to interval partitioning by day on `LOG_TIMESTAMP`
|
|
- **CRITICAL**: Preserves all existing data during conversion
|
|
|
|
## Strategy
|
|
- Creates new partitioned table `A_PROCESS_LOG_NEW`
|
|
- Copies ALL existing records (preserving data integrity)
|
|
- Renames old table to `A_PROCESS_LOG_OLD` (backup)
|
|
- Renames new table to `A_PROCESS_LOG`
|
|
- Manual cleanup of backup table after verification
|
|
|
|
## Files
|
|
- Baseline update: `mrds_elt-dev-database/database/CT_MRDS/SCHEMA/tables/A_PROCESS_LOG.sql`
|
|
- Migration: `MARS_Packages/migrations/004_extend_log_message_and_partition.sql`
|
|
- Rollback: `MARS_Packages/migrations/rollback/004_rollback_log_message_and_partition.sql`
|
|
- Install: `MARS_Packages/REL02/MARS-1096/install_mars1096.sql` (includes cleanup)
|
|
- Verify: `MARS_Packages/REL02/MARS-1096/04_MARS_1096_verify_partitioning.sql`
|
|
- Cleanup: `MARS_Packages/REL02/MARS-1096/05_MARS_1096_cleanup_backup.sql` (auto-executed)
|
|
|
|
## Install
|
|
```powershell
|
|
# Run with SQLcl - includes verification and automatic backup cleanup
|
|
sql "CT_MRDS/Cloudpass#34@ggmichalski_high" "@MARS_Packages/REL01/MARS-1096/install_mars1096.sql"
|
|
```
|
|
|
|
## Rollback
|
|
```powershell
|
|
# Execute rollback with full logging and verification
|
|
sql "CT_MRDS/Cloudpass#34@ggmichalski_high" "@MARS_Packages/REL01/MARS-1096/rollback_mars1096.sql"
|
|
|
|
# Log file created: ROLLBACK_MARS_1096_<PDB>_<timestamp>.log
|
|
```
|
|
|
|
**Rollback Process:**
|
|
1. User confirmation required (type "YES")
|
|
2. Restore table to non-partitioned structure
|
|
3. Revert log_message to VARCHAR2(4000)
|
|
4. Preserve all existing data
|
|
5. Verify changes with automatic checks
|
|
|
|
## Performance Notes
|
|
- Daily partitions optimal for ~200k records/day
|
|
- Partition pruning improves query performance with date filters
|
|
- Local indexes can be added per partition if needed
|