Restore n Recover Production DB to Point In Time on new machine

本文详细介绍了一种Oracle数据库从源主机到目标主机的迁移流程,包括软件安装、补丁升级、文件备份与恢复、控制文件及数据文件恢复等关键步骤。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

1.Install Oracle RDBMS Server Software on destination host.

2.Patch it to same release which is installed on source host.

3.Copy Datafile Backups , Archivelog Backups , Controlfile backup and spfile backup on to destination host ( test2 ) to same location as source host ( test1 )

4.Restore spfile from autobackup using following command.

$export ORACLE_SID=DEV
$export ORACLE_HOME=/apps1/oracle01/u11/app/oracle/product/10.2.0/db_1
$rman target / nocatalog
RMAN>set DBID=00000000 ( You can get DB ID for source db by querying v$database view )
RMAN>startup nomount;
RMAN>restore spfile from '/var/backups1/DEV/autobackup/2009_10_04/o1_mf_s_699336061_5dj3zg47_.bkp';

Spfile will be restored in $ORACLE_HOME/dbs folder.

RMAN>shutdown immediate;
$sqlplus / as sysdba
SQL>create pfile from spfile;

pfile will be restored in $ORACLE_HOME/dbs folder.

Open pfile ( initDEV.ora ) and modify adump,bdump,cdump,udump and db_recovery_file_dest parameter.Also modify control_files parameter according to new path.

$sqlplus / as sysdba
SQL>startup nomount pfile='$ORACLE_HOME/dbs/initDEV.ora'
SQL>create spfile from pfile;
SQL>startup nomount force;

5.Restore controlfile from autobackup using following command.

$rman target / nocatalog
RMAN>set DBID=00000000
RMAN>restore controlfile from '/var/backups1/DEV/autobackup/2009_10_04/o1_mf_s_699336061_5dj3zg47_.bkp';
RMAN>alter database mount;

6.Restore datafiles.
If the directory structure is different than you need to use "set newname" command to change file name location else its not required.

Create RMAN script for restoring DB.

RUN
{
SET NEWNAME FOR DATAFILE 1 TO '/apps1/DEV/system01.dbf';
SET NEWNAME FOR DATAFILE 2 TO '/apps1/DEV/undotbs01.dbf';
SET NEWNAME FOR DATAFILE 3 TO '/apps1/DEV/sysaux01.dbf';
SET NEWNAME FOR DATAFILE 4 TO '/apps1/DEV/users01.dbf';
SET NEWNAME FOR DATAFILE 5 TO '/apps1/DEV/cs_dev_owner_01.dbf';
SET NEWNAME FOR DATAFILE 6 TO '/apps1/DEV/admin_01.dbf';
SET UNTIL TIMEA = "to_date('2019-11-03:41:54:00','YYYY-MM-DD:HH24:MI:SS')";
RESTORE DATABASE;
SWITCH DATAFILE ALL;
}
EXIT

7.Recover database to point in time.

$rman target / nocatalog
RMAN>recover database until time "to_date(''2019-11-03:41:54:00'','YYYY-MM-DD:HH24:MI:SS')";

8.Rename redo logfile name before opening DB with resetlogs option.

$sqlplus / as sysdba
SQL>alter database rename file '/apps1/u14/oradata/DEV/redo01a.log' to '/apps1/DEV/redo01a.log';

Do same for all the redo files.( run select member from v$logfile to get list of redo logs )

9.Open DB with resetlogs option.

$sqlplus / as sysdba
SQL>alter database open resetlogs;

10.Create TEMP tablespace.

$sqlplus / as sysdba
SQL>create temporary tablespace temp1 tempfile '/apps1/DEV/temp.dbf' size 10M;
SQL>alter database default temporary tablespace temp1;

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值