|
| 1 | +# MongoDB to Oracle Database 23ai Migration |
| 2 | + |
| 3 | +**Summary:** Contained herein is a bash script for demonstrating and managing MongoDB to Oracle Database migration in a containerized environment. The `orclMongoMigration.sh` script provides a full-featured environment for demonstrating how to migrate data from MongoDB to Oracle Database. It handles container management, database setup, MongoDB configuration, and the complete migration process in an interactive, user-friendly way. |
| 4 | + |
| 5 | +## Key Features |
| 6 | + |
| 7 | +**Container Management:** |
| 8 | +* Start/stop Oracle Database containers |
| 9 | +* Automatic configuration and environment setup |
| 10 | +* Interactive menu system with color-coded output |
| 11 | +* Comprehensive command-line interface for automation |
| 12 | +* File transfer between host and container |
| 13 | +* Volume and resource management |
| 14 | + |
| 15 | +**Database Setup and Access:** |
| 16 | +* Automatic Oracle Database configuration |
| 17 | +* Multiple SQL*Plus access modes (nolog, user, SYSDBA) |
| 18 | +* ORDS (Oracle REST Data Services) setup and management |
| 19 | +* MongoDB initialization and configuration |
| 20 | +* MongoDB API compatibility for Oracle |
| 21 | + |
| 22 | +**MongoDB and Migration:** |
| 23 | +* MongoDB instance setup and configuration |
| 24 | +* MongoDB shell access via mongosh |
| 25 | +* Oracle Database MongoDB API connectivity |
| 26 | +* Complete data migration workflow from MongoDB to Oracle |
| 27 | +* Sample data generation and import |
| 28 | +* Interactive migration process with step-by-step guidance |
| 29 | +Demo Application |
| 30 | +* Registration demo app deployment |
| 31 | +* Sample data generation with geographic features |
| 32 | +* Data visualization and testing |
| 33 | + |
| 34 | +## Prerequisites |
| 35 | +* Podman installed (script can install it if not present) |
| 36 | +* macOS or Linux operating system |
| 37 | +* Internet connection |
| 38 | +* 8GB+ RAM recommended for running the Oracle Database container |
| 39 | + |
| 40 | +## Installation |
| 41 | + |
| 42 | +1. Download the script |
| 43 | + |
| 44 | + ```bash |
| 45 | + wget https://github.com/oracle-devrel/devo.tutorials/blob/mongo-2-oracle-migration/mongo-2-oracle/src/orclMongoMigration.sh |
| 46 | + ``` |
| 47 | + |
| 48 | +2. Change permissions to make the script executable |
| 49 | + |
| 50 | + ```bash |
| 51 | + chmod +x orclMongoMigration.sh |
| 52 | + ``` |
| 53 | + |
| 54 | +3. Set the global variables within the script file. |
| 55 | + |
| 56 | + >NOTE: See [the step by step guide](step-by-step-guide.md) for details on setting global variables. |
| 57 | + |
| 58 | +4. Run the script without arguments to display a user-friendly menu with the following sections: |
| 59 | + |
| 60 | + ```bash |
| 61 | + ./orclMongoMigration.sh |
| 62 | + ``` |
| 63 | + |
| 64 | + * **Container Management:** - Start/stop Oracle container - Bash and root access - Install utilities and manage volumes - Copy files in and out |
| 65 | + * **Database Access & Utilities:** - SQL*Plus connections (nolog, user, SYSDBA) - ORDS setup and management - MongoDB API connectivity |
| 66 | + * **MongoDB Operations:** - Start MongoDB instance - mongosh to ORDS or MongoDB |
| 67 | + * **Application & Migration:** - Run registration demo app - Add demo data - Migrate data from MongoDB to Oracle |
| 68 | + |
| 69 | +5. For a comprehensive walkthru, please visit the [step-by-step guide](step-by-step-guide.md). |
| 70 | + |
| 71 | +## Available Commandline Arguments |
| 72 | + |
| 73 | +* Container Management: |
| 74 | + |
| 75 | + ```bash |
| 76 | + start - Start Oracle container |
| 77 | + stop - Stop Oracle container |
| 78 | + restart - Restart Oracle container |
| 79 | + bash - Bash access to container |
| 80 | + root - Root access to container |
| 81 | + remove - Remove Oracle container |
| 82 | + utils - Install utilities |
| 83 | + copyin - Copy file into container |
| 84 | + copyout - Copy file out of container |
| 85 | + clean - Clean unused volumes |
| 86 | + ``` |
| 87 | + |
| 88 | +* Database Access: |
| 89 | + |
| 90 | + ```bash |
| 91 | + sqlnolog - SQL*Plus nolog connection |
| 92 | + sqluser - SQL*Plus user connection |
| 93 | + sqlsys - SQL*Plus SYSDBA connection |
| 94 | + setupords - Setup ORDS |
| 95 | + ords - Start ORDS service |
| 96 | + mongoapi - Check MongoDB API connection |
| 97 | + ``` |
| 98 | + |
| 99 | +* MongoDB Commands: |
| 100 | + |
| 101 | + ```bash |
| 102 | + mongodb - Start MongoDB instance |
| 103 | + mongoords - Connect to MongoDB via ORDS |
| 104 | + mongo - Connect to MongoDB directly |
| 105 | + ``` |
| 106 | + |
| 107 | +* Application Commands: |
| 108 | + |
| 109 | + ```bash |
| 110 | + demoapp - Run Registration Demo App |
| 111 | + demodata - Add demo data |
| 112 | + migrate - Migrate data |
| 113 | + help - Show help message |
| 114 | + ``` |
| 115 | + |
| 116 | +## Migration Workflow Example |
| 117 | +Here’s a typical workflow for demonstrating MongoDB to Oracle migration: |
| 118 | +1. Start the container: |
| 119 | + |
| 120 | + ```bash |
| 121 | + ./orclMongoMigration.sh start |
| 122 | + ``` |
| 123 | +2. Start MongoDB instance: |
| 124 | + ```bash |
| 125 | + ./orclMongoMigration.sh mongodb |
| 126 | + ``` |
| 127 | +3. Generate demo data: |
| 128 | + ```bash |
| 129 | + ./orclMongoMigration.sh demodata |
| 130 | + ``` |
| 131 | +4. Perform the migration: |
| 132 | + ```bash |
| 133 | + ./orclMongoMigration.sh migrate |
| 134 | + ``` |
| 135 | +5. Verify the migrated data in Oracle: (The script will offer to connect you to SQL*Plus after migration) |
| 136 | + |
| 137 | +## Container Details |
| 138 | +* **Image:** Oracle Database Free (container-registry.oracle.com/database/free) |
| 139 | +* **Default Credentials:** |
| 140 | +* SYS/SYSTEM password: Oradoc_db1 |
| 141 | +* Created user: matt with password matt |
| 142 | +* **Exposed Ports:** |
| 143 | +* 1521: Oracle Database listener |
| 144 | +* 3000: Node.js demonstration app |
| 145 | +* 5500: Enterprise Manager Express |
| 146 | +* 8080/8443: ORDS (Oracle REST Data Services) |
| 147 | +* 27017: MongoDB API compatibility |
| 148 | +* 23456: MongoDB native port |
| 149 | + |
| 150 | +## Troubleshooting |
| 151 | +* If the Oracle container fails to start, try running ./orclMongoMigration.sh clean to remove unused volumes |
| 152 | +* For migration issues, check that both MongoDB and ORDS are running |
| 153 | +* If demo data generation fails, ensure Python libraries are installed correctly |
| 154 | +* Check container logs for Oracle Database startup issues |
| 155 | + |
| 156 | + |
| 157 | +## Acknowledgments |
| 158 | +* Created by Matt DeMarco ( [email protected]) |
| 159 | +* Oracle Database Free images provided by Oracle |
| 160 | + |
| 161 | + |
0 commit comments