> For the complete documentation index, see [llms.txt](https://docs.ovaledge.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.ovaledge.com/release8.3/deployment-and-maintenance/migration/pre-and-post-migration-activities.md).

# Pre & Post Migration Activities

This article describes the required validation steps to be performed before and after database migration. These steps ensure data consistency, integrity, and completeness by capturing key database metrics. The captured values serve as a baseline for comparison after migration.

### Prerequisites

Ensure the following conditions are met before proceeding:

* **Database Access:** Access to both source and target database environments
* **Permissions:** Required privileges to query information\_schema
* **SQL Tool:** Availability of a SQL client or query execution tool
* **Database Details:** Database name identified for validation

### Procedure

Execute the following scripts before and after the migration activity to validate consistency.

1. #### Capture Table Row Counts
   * Run the following SQL query to retrieve table row counts and sizes. Save the output for post-migration comparison.

     ```sql
     USE information_schema;
     SELECT 
         TABLE_NAME AS "Table Name", 
         TABLE_ROWS AS "Row Count", 
         ROUND((COALESCE(DATA_LENGTH, 0) + COALESCE(INDEX_LENGTH, 0)) / 1024 / 1024) AS 
     "Size (MB)"
     FROM tables
     WHERE table_schema = 'YOUR_DB_NAME'
     UNION ALL
     SELECT 
         "Total Count", 
         SUM(RowCount), 
         SUM(Size)
     FROM (
         SELECT 
             TABLE_NAME AS "Table Name", 
             TABLE_ROWS AS "RowCount", 
             ROUND((COALESCE(DATA_LENGTH, 0) + COALESCE(INDEX_LENGTH, 0)) / 1024 / 1024) 
     AS "Size"
         FROM tables
         WHERE table_schema = 'YOUR_DB_NAME'
     ) summary;
     Reference: All_Tables_RowCount.sql
     ```

2. #### Capture Database Size
   * Run the following SQL query to retrieve the total database size.

     ```sql
     SELECT 
         table_schema AS "Database Name", 
         ROUND(SUM(data_length + index_length) / 1024 / 1024, 1) AS "DB Size (MB)"
     FROM information_schema.tables 
     GROUP BY table_schema;
     ```

3. #### Verify Table Collation
   * Verify that all tables use the utf8mb4\_0900\_ai\_ci collation. \
     **Check Collation:**

     ```sql
     SELECT 
         TABLE_SCHEMA, 
         TABLE_NAME, 
         TABLE_COLLATION 
     FROM information_schema.tables 
     WHERE TABLE_COLLATION != 'utf8mb4_0900_ai_ci';
     ```

***

Copyright © 2026, OvalEdge LLC, Peachtree Corners, GA, USA.


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://docs.ovaledge.com/release8.3/deployment-and-maintenance/migration/pre-and-post-migration-activities.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
