View, Trigger or Stored Routine Definitions Lost?
Recover Metadata for Other Objects
Scenario Description
Table data has been found, but normal export of views, triggers, procedures or functions is unavailable. Physical sources such as FRM, TRG/TRN, mysql.proc or mysql.ibd survive. Extract definitions and context by object type rather than recovering only business tables.
Possible Causes
- The instance cannot start and logical object export is unavailable.
- System catalogs or non-table object metadata are partially damaged.
- Objects, accounts and dependencies are incomplete in the recovery copy.
Challenges
Conventional recovery often requires complete files, a running instance or a usable backup. In these situations, choose a method based on the evidence that survives.
Common Errors and Symptoms
- - Business tables can be extracted, but view or routine definitions are missing.
- - Trigger names, mappings or session context need confirmation.
- - An 8.0 DD source may establish only some object attributes.
Why Traditional Methods Fail
- - Recovering data rows does not reconstruct views or program objects.
- - Summaries, complete CREATE scripts and executable objects are different results.
- - Definers, collations and dependency order require separate confirmation.
PDU Solution
PDU reads non-table objects according to the exact version of the original files. Matching 5.7.44 files can produce creation scripts for views, triggers and routines. Recovery from 8.0 DD extracts the supported object attributes and records damage and object ownership information.
Recovery Principle
- Preserve Object Evidence
- Extract by Object Type
- Retain Definitions and Context
- Confirm Target Dependencies
PDU Core Capabilities
- Read view FRM and trigger TRG/TRN files.
- Inspect routine and event physical sources separately.
- Generate supported 5.7.44 view and trigger CREATE evidence.
- Bind FUNCTION/PROCEDURE by name and type.
- Retain SQL mode, character sets and original context.
- Retain source, domain, generation and PARTIAL status for 8.0 object attributes.
Recovery Steps
- 1
Prepare Original Evidence
Preserve the exact version and matching TRG/TRN, MYD/MYI, FRM, original DDL or mysql.ibd. Record object definitions, account privileges, session context and dependencies separately.
- 2
Read Object Information from Files
Paths and versions are syntax examples; replace them for actual objects. summary shows a summary only and does not mean a complete creation script has been generated.
- 3
Generate Trigger Creation Evidence
Retain the native CREATE and session context. Confirm target collation, accounts, privileges, dependencies and execution separately. PDU does not automatically create business objects.
- 4
Generate View Creation Evidence
Explicit database and view names must match the original database directory and FRM filename. Retain algorithm, security type, CHECK OPTION, definer, normalized query and character-set context. The original VIEW SQL mode is not stored, so complete recovery of the original session context cannot be claimed.
- 5
Generate Routine Creation Evidence
Use matching MYD/MYI, original DDL and FRM, with explicit database, routine-name and FUNCTION/PROCEDURE bindings. Retain parameters, return types, body, definer, SQL mode and character-set context. Creation evidence includes short client delimiters and session save/restore statements.
Important: Object Creation Scope
The complete CREATE commands above are limited to corresponding MySQL 5.7.44 sources and contexts. Complete EVENT and 8.0 DD CREATE are outside this scope. Confirm accounts, privileges, dependency order and target execution separately. PDU does not execute GRANT or create business objects automatically.
- 6
Extract Sparse DD Object Attributes
Sparse DD is currently limited to declared 8.0.28/8.0.46 source profiles. With proven domain and generation, SOURCE_ID is 0. When both domain and generation are unknown and 0, specify a concrete nonzero source ID. Do not reuse example identities for other sources.
This path extracts object attributes without guaranteeing complete CREATE, transaction states, dependencies or database completeness. Known damage retains surviving objects and PARTIAL. Stop when attribution or SDI evidence is missing.
Quick Command Examples
Preserve frozen sources and launch PDU outside them. Write configuration snippets to pdu.ini and execute PDU commands after startup. Replace example paths, versions, times and task identities with actual evidence.
# Read Object Information from Files
meta view /recovery-input/view.frm 50744;
meta trigger /recovery-input/table.TRG 50744 summary;
meta trigger-map /recovery-input/table.TRG /recovery-input/trigger.TRN 50744 summary;
meta routine /recovery-input/proc.MYD /recovery-input/proc.MYI /recovery-input/proc.sql /recovery-input/proc.frm 50744 summary;# Generate Trigger Creation Evidence
meta trigger-create /recovery-input/table.TRG /recovery-input/trigger.TRN 50744;# Generate View Creation Evidence
meta view-create /recovery-input/appdb/orders_view.frm 50744 appdb orders_view;# Generate Routine Creation Evidence
meta routine-create /recovery-input/proc.MYD /recovery-input/proc.MYI /recovery-input/proc.sql /recovery-input/proc.frm 50744 appdb calculate_total FUNCTION;
meta routine-create /recovery-input/proc.MYD /recovery-input/proc.MYI /recovery-input/proc.sql /recovery-input/proc.frm 50744 appdb rebuild_summary PROCEDURE;# Extract Sparse DD Object Attributes
meta objects /recovery-input/mysql.ibd appdb 80046 summary;
ds objects <DS_TASK> 1 1 0 appdb 80046 summary;Export Results
Object Definitions
CREATE evidence or object attributes from supported sources, with scope declared separately.
Context and Dependencies
Definers, character sets, session context and unresolved dependencies.
Native Status
Complete, PARTIAL or rejected status with source identity.
After export, record PDU’s native success and failure counts and original errors, retaining checkpoints. Resume uses native records and file metadata without rereading exported data or automatic trial import.
Prerequisites
- Prepare a matching program, license and sufficient space. Keep original evidence read-only and place the PDU launch directory outside the sources.
Important Notes
- Complete EVENT and 8.0 DD CREATE are outside the creation scope above.
- This does not establish automatic 8.0 DD salvage with missing headers, roots or pages.
- Confirm accounts, privileges, dependencies and target execution separately; no automatic GRANT or object creation occurs.