刚开始出现了些问题搞得我既郁闷又着急都不知道我在记什么了大家将就着看吧! 一个G数据库的真实迁移过程(也可以说是一个数据库系统崩溃下的恢复过程)要求停机的时间最短 前提:拥有完整的数据库备份和归档日志迁移的主机所有的目录结构和原主机一样 Oracle版本: 操作系统: linux 备份程序:rman没用恢复目录 把所有rman的备份(包括控制文件的自动备份)拷贝到新的服务器上路径要和原来的一模一样 迁移过程如下: 把参数文件tns等文件拷贝到新服务器上原数据库停机开始把数据库迁移到新的服务器上 $set oracle_sid=service SQL> conn / as sysdba Connected SQL>startup nomount; 恢复控制文件 SQL> declare devtype varchar(); done boolean; begin devtype :=dbms_backup_restoredeviceallocate(NULL); dbms_backup_restorerestoresetdatafile; dbms_backup_restorerestorecontrolfileto(/opt/data/SERVICE/controlctl); dbms_backup_restorerestorebackuppiece(/opt/backup/control_cDONE => done); end; / PL/SQL procedure successfully completed 这个过程我到现在还解应该是只要控制文件自动备份通过restore controlfile from autobackup就能恢复过来但我在现场怎么实现不了没办法只要用dbms_backup_restore包了 把控制文件复制成三个文件 $ cp controlctl controlctl $ cp controlctl controlctl SQL>alter database mount 数据库启动到mount状态准备进行数据文件的恢复 启动rman Recovery Manager: Release Production Copyright (c) Oracle All rights reserved RMAN> connect target / connected to target database: SERVICE (DBID=) RMAN> restore database ; Starting restore at AUG using target database controlfile instead of recovery catalog allocated channel: ORA_DISK_ channel ORA_DISK_: sid= devtype=DISK channel ORA_DISK_: starting datafile backupset restore channel ORA_DISK_: specifying datafile(s) to restore from backup set restoring datafile to /opt/data/SERVICE/systemdbf restoring datafile to /opt/data/SERVICE/undotbsdbf restoring datafile to /opt/data/SERVICE/sysauxdbf restoring datafile to /opt/data/SERVICE/usersdbf restoring datafile to /opt/data/SERVICE/businessdbf restoring datafile to /opt/data/SERVICE/advertisedbf restoring datafile to /opt/data/SERVICE/backupdbf channel ORA_DISK_: restored backup piece piece handle=/opt/backup/service_mpgrf___ tag=TAGT channel ORA_DISK_: restore complete Finished restore at AUG 查看归档日志 RMAN> list backup archivelog all; 进行数据库的恢复 RMAN> recover database; Starting recover at AUG using channel ORA_DISK_ starting media recovery channel ORA_DISK_: starting archive log restore to default destination channel ORA_DISK_: restoring archive log archive log thread= sequence= channel ORA_DISK_: restored backup piece piece handle=/opt/backup/service_mqgrjj___ tag=TAGT channel ORA_DISK_: restore complete archive log filename=/opt/archive/SERVICE__dbf thread= sequence= channel ORA_DISK_: starting archive log restore to default destination channel ORA_DISK_: restoring archive log archive log thread= sequence= channel ORA_DISK_: restoring archive log archive log thread= sequence= channel ORA_DISK_: restored backup piece piece handle=/opt/backup/service_msgrom___ tag=TAGT channel ORA_DISK_: restore complete archive log filename=/opt/archive/SERVICE__dbf thread= sequence= archive log filename=/opt/archive/SERVICE__dbf thread= sequence= channel ORA_DISK_: starting archive log restore to default destination channel ORA_DISK_: restoring archive log archive log thread= sequence= channel ORA_DISK_: restoring archive log archive log thread= sequence= channel ORA_DISK_: restoring archive log archive log thread= sequence= channel ORA_DISK_: restoring archive log archive log thread= sequence= channel ORA_DISK_: restoring archive log archive log thread= sequence= channel ORA_DISK_: restoring archive log archive log thread= sequence= channel ORA_DISK_: restoring archive log archive log thread= sequence= channel ORA_DISK_: restoring archive log archive log thread= sequence= channel ORA_DISK_: restoring archive log archive log thread= sequence= channel ORA_DISK_: restoring archive log archive log thread= sequence= channel ORA_DISK_: restoring archive log archive log thread= sequence= channel ORA_DISK_: restoring archive log archive log thread= sequence= channel ORA_DISK_: restored backup piece piece handle=/opt/backup/service_mvgrafg___ tag=TAGT channel ORA_DISK_: restore complete archive log filename=/opt/archive/SERVICE__dbf thread= sequence= archive log filename=/opt/archive/SERVICE__dbf thread= sequence= archive log filename=/opt/archive/SERVICE__dbf thread= sequence= archive log filename=/opt/archive/SERVICE__dbf thread= sequence= archive log filename=/opt/archive/SERVICE__dbf thread= sequence= archive log filename=/opt/archive/SERVICE__dbf thread= sequence= archive log filename=/opt/archive/SERVICE__dbf thread= sequence= archive log filename=/opt/archive/SERVICE__dbf thread= sequence= archive log filename=/opt/archive/SERVICE__dbf thread= sequence= archive log filename=/opt/archive/SERVICE__dbf thread= sequence= archive log filename=/opt/archive/SERVICE__dbf thread= sequence= archive log filename=/opt/archive/SERVICE__dbf thread= sequence= channel ORA_DISK_: starting archive log restore to default destination channel ORA_DISK_: restoring archive log archive log thread= sequence= channel ORA_DISK_: restoring archive log archive log thread= sequence= channel ORA_DISK_: restoring archive log archive log thread= sequence= channel ORA_DISK_: restoring archive log archive log |