Restore n Recover Production DB to Point In Time on new machine
2010-10-27 16:19
627 查看
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;
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;
相关文章推荐
- Hwo to Open Navigation Item in New Window on SharePoint Portal
- To restore the database on a new host-将数据库恢复至一个新的主机上
- date(): It is not safe to rely on the system's timezone settings in CodeIgniter
- How to create a GoldenGate uni-directional target database in a production database zero downtime
- How To Create SharePoint 2010 Site Collection In Its Own DB
- 130 In your production database, users report that they are unable to generate reports on an importa
- Azure SQL Database 时间点还原(Point in Time Restore)功能
- How to read out WhatsApp messages with Tasker and react on their content in real time
- 创建团队项目时,遭遇:Insufficient permissions on the Windows SharePoint Services at 123.12.15.25 to create a new site.错误!
- [TroubleShooting] The remote copy of database xx has not been rolled forward to a point in time
- CI框架 Fatal error: Call to undefined method CI_DB::CI_DB() in D:\xinqing\web\CodeIgniter\database\drivers\odbc\odbc_driver.php on line 53
- How to create a GoldenGate uni-directional target database in a production database zero downtime
- How to enable time stamps for logs in 'dmesg' on Gaia and SecurePlatform
- how-to-install-hyper-v-on-a-virtual-machine-in-hyper-v.aspx
- Register ASP.NET 4.0 An error has occurred: 0x8007b799 You must have administrative rights on this machine in order to ru
- 安装 Fatal error: Maximum execution time of 30 seconds exceeded in …/magento/lib/Varien/Db/Adapter/Pdo/Mysql.php on line 230
- How to get current date time in SharePoint Site Time Zone
- how-to-install-hyper-v-on-a-virtual-machine-in-hyper-v.aspx
- 每日英语:New Reason To Get The Kids To Bed On Time
- On Creating New Project in VS2013: Failed to Initialize the Powershell Host