Files
mars/MARS_Packages/REL02_POST/MARS-956/install_mars956.sql
Grzegorz Michalski 3b7ce7de97 Implement rollback functionality for MARS-956:
- Added script to delete exported CSV files from DATA bucket.
- Enhanced rollback file registrations script with improved error handling and success messages.
- Updated process logs cleanup script to include error handling and success messages.
- Modified rollback verification script for clearer success and warning messages.
- Removed outdated README.md file and updated installation script to reflect schema changes.
- Adjusted rollback master script to streamline execution steps and improve clarity.
2026-02-13 07:50:54 +01:00

95 lines
3.7 KiB
SQL

-- ===================================================================
-- MARS-956 INSTALL SCRIPT: C2D MPEC Data Export to External Tables
-- ===================================================================
-- Purpose: One-time bulk export of 3 C2D MPEC tables from OU_LEGACY_C2D schema
-- to OCI buckets (ODS bucket CSV format)
-- Uses DATA_EXPORTER v2.7.5 with pRegisterExport for file registration
-- Author: System Generated
-- Date: 2026-02-12
-- Version: 1.0.0
-- Dynamic spool file generation (using SYS_CONTEXT - no DBA privileges required)
-- Log files are automatically created in log/ subdirectory
-- IMPORTANT: Ensure log/ directory exists before SPOOL (use host mkdir)
host mkdir log 2>nul
var filename VARCHAR2(100)
BEGIN
:filename := 'log/INSTALL_MARS_956_' || SYS_CONTEXT('USERENV', 'CON_NAME') || '_' || TO_CHAR(SYSDATE,'YYYYMMDD_HH24MISS') || '.log';
END;
/
column filename new_value _filename
select :filename filename from dual;
spool &_filename
SET ECHO OFF
SET TIMING ON
SET SERVEROUTPUT ON SIZE UNLIMITED
SET PAUSE OFF
-- Set current schema context (optional - use when modifying packages in specific schema)
-- ALTER SESSION SET CURRENT_SCHEMA = CT_MRDS;
PROMPT =========================================================================
PROMPT MARS-956: C2D MPEC Data Export to External Tables (One-Time Migration)
PROMPT =========================================================================
PROMPT
PROMPT This script will export 3 C2D MPEC tables to OCI buckets:
PROMPT
PROMPT TARGET: ODS Bucket (CSV format):
PROMPT - MPEC_ADMIN
PROMPT - MPEC_CONTENT
PROMPT - MPEC_CONTENT_CRITERION
PROMPT
PROMPT Key Features:
PROMPT - Files registered in A_SOURCE_FILE_RECEIVED for tracking
PROMPT - Template table column order matching (CT_ET_TEMPLATES.C2D_MPEC_*)
PROMPT - ODS/C2D bucket path structure
PROMPT =========================================================================
-- Confirm installation with user
ACCEPT continue CHAR PROMPT 'Type YES to continue with installation, or Ctrl+C to abort: '
WHENEVER SQLERROR EXIT SQL.SQLCODE
BEGIN
IF '&continue' IS NULL OR TRIM('&continue') IS NULL OR UPPER(TRIM('&continue')) != 'YES' THEN
RAISE_APPLICATION_ERROR(-20001, 'Installation aborted by user');
END IF;
END;
/
WHENEVER SQLERROR CONTINUE
PROMPT
PROMPT =========================================================================
PROMPT Pre-Check: Verify prerequisites and table readiness
PROMPT =========================================================================
@@00_MARS_956_pre_check_prerequisites.sql
PROMPT
PROMPT =========================================================================
PROMPT Step 1: Export C2D MPEC Data to ODS Bucket
PROMPT =========================================================================
@@01_MARS_956_export_c2d_mpec_data.sql
PROMPT
PROMPT =========================================================================
PROMPT Step 2: Verify Exports (File Registration Check)
PROMPT =========================================================================
@@02_MARS_956_verify_exports.sql
PROMPT
PROMPT =========================================================================
PROMPT Step 3: Verify Data Integrity (Source vs Exported)
PROMPT =========================================================================
@@03_MARS_956_verify_data_integrity.sql
PROMPT
PROMPT =========================================================================
PROMPT MARS-956 Installation - COMPLETED
PROMPT =========================================================================
PROMPT Check the log file for complete installation details.
PROMPT For rollback, use: rollback_mars956.sql
PROMPT =========================================================================
spool off
quit;