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
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
看结果
mongosh --tlsAllowInvalidCertificates 'mongodb://roger:password@localhost:27017/roger?authMechanism=PLAIN&authSource=$external&ssl=true&retryWrites=false&loadBalanced=true'
db.station.find({_id:'120'})