启云数据库平台有一个老库 test01,现在下发一个新库 test02,将test01的数据备份到test02中
先在启云平台备份test01数据库:
得到备份集 full_20240710142233642
进入集群内部操作步骤如下:
kubectl get po -n dmcp-instance
2.将备份集复制到宿主机上
kubectl cp -n dmcp-instance dm1810220892998692864-0:/opt/dmdbms/data/backup/full_20240710142233642 /tmp/
mkdir -p full_20240710142233642
mv full_20240710142233642*.* full_20240710142233642
kubectl cp -n dmcp-instance full_20240710142233642 dm1810920584631906304-0:/opt/dmdbms/data/backup/
kubectl exec -it dm1810920584631906304-0 -n dmcp-instance -c database bash
pause
cd /opt/dmdbms/bin
./dmrman CTLSTMT="RESTORE DATABASE '/opt/dmdbms/data/DAMENG/dm.ini' FROM BACKUPSET '/opt/dmdbms/data/backup/full_20240710 142233642'"
./dmrman CTLSTMT="RECOVER database '/opt/dmdbms/data/DAMENG/dm.ini' from backupset '/opt/dmdbms/data/backup/full_20240710 142233642'";
./dmrman CTLSTMT="RECOVER DATABASE '/opt/dmdbms/data/DAMENG/dm.ini' UPDATE DB_MAGIC"
reload
获取test02库SYSDBA密码
登录test02数据库,sysdba密码为test01库的sysdba密码
将test02库的sysdba密码修改为当前密码
alter user "SYSDBA" identified by "***";
7.检查数据库状态
此刻数据迁移完成,数据库可以正常使用
文章
阅读量
获赞