云架构


MongoDB迁移到OracleDB的演示

MongoDB迁移到OracleDB的演示

将数据从MongoDB迁移到OracleDB涉及mangoexport 和mongoimport工具

Step1. 从MongoDB中导出数据
export MONGO_URI=mongodb://localhost:27018/admin
mkdir ~/mongo-api-lab
cd ~/mongo-api-lab
mongoexport -u admin -p password --collection station --uri=$MONGO_URI -o station.json
mongoexport -u admin -p password --collection status --uri=$MONGO_URI -o status.json

image-20221110184510594

Step2. 把数据导入MongoDB
mongoimport --tlsInsecure --uri='mongodb://roger:password@localhost:27017/roger?authMechanism=PLAIN&authSource=$external&ssl=true&retryWrites=false&loadBalanced=true' --collection station --file=station.json
mongoimport --tlsInsecure --uri='mongodb://roger:password@localhost:27017/roger?authMechanism=PLAIN&authSource=$external&ssl=true&retryWrites=false&loadBalanced=true' --collection status --file=status.json

image-20221112231607468

看结果

mongosh --tlsAllowInvalidCertificates 'mongodb://roger:password@localhost:27017/roger?authMechanism=PLAIN&authSource=$external&ssl=true&retryWrites=false&loadBalanced=true'
db.station.find({_id:'120'})

image-20221112231658235

ad