Restore Oracle database to another server

1. Copy or remotely mount the backupset folder from the source server to the target server

2. On the target server, export ORACLE_SID as same as the source database and run "rman target /"

3. Restore spfile from backup:

RMAN> startup nomount;

startup failed: ORA-01078: failure in processing system parameters
LRM-00109: could not open parameter file ‘/u01/app/oracle/product/11.2.0/dbhome_1/dbs/initorcl01.ora‘

starting Oracle instance without parameter file for retrieval of spfile
Oracle instance started

Total System Global Area 158662656 bytes

Fixed Size 2211448 bytes
Variable Size 88080776 bytes
Database Buffers 62914560 bytes
Redo Buffers 5455872 bytes

RMAN> restore spfile from ‘/u01/app/remote/flash_recovery_area/ORCL01/backupset/2014_10_01/o1_mf_ncsn1_TAG20141001T011809_b2q3ojl8_.bkp‘;

Starting restore at 27-OCT-14
using target database control file instead of recovery catalog
allocated channel: ORA_DISK_1
channel ORA_DISK_1: SID=18 device type=DISK

channel ORA_DISK_1: restoring spfile from AUTOBACKUP /u01/app/remote/flash_recovery_area/ORCL01/backupset/2014_10_01/o1_mf_ncsn1_TAG20141001T011809_b2q3ojl8_.bkp
channel ORA_DISK_1: SPFILE restore from AUTOBACKUP complete
Finished restore at 27-OCT-14

4. Open another ssh session, export ORACLE_SID and run "sqlplus / as sysdba" and create pfile from spfile:

[[email protected] dbs]$ sqlplus / as sysdba

SQL*Plus: Release 11.2.0.1.0 Production on Mon Oct 27 10:34:57 2014

Copyright (c) 1982, 2009, Oracle. All rights reserved.

Connected to:
Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - 64bit Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options

SQL> create pfile from spfile;

File created.

SQL> exit

5. Review the pfile just created and mkdir all the file dests:

[[email protected] dbs]$ cat initorcl01.ora
orcl01.__db_cache_size=188743680
orcl01.__java_pool_size=4194304
orcl01.__large_pool_size=4194304
orcl01.__oracle_base=‘/u01/app/oracle‘#ORACLE_BASE set from environment
orcl01.__pga_aggregate_target=272629760
orcl01.__sga_target=515899392
orcl01.__shared_io_pool_size=0
orcl01.__shared_pool_size=306184192
orcl01.__streams_pool_size=4194304
*.audit_file_dest=‘/u01/app/oracle/admin/orcl01/adump‘
*.audit_trail=‘db‘
*.compatible=‘11.2.0.0.0‘
*.control_files=‘/u01/app/oracle/oradata/orcl01/control01.ctl‘,‘/u01/app/oracle/flash_recovery_area/orcl01/control02.ctl‘
*.db_block_size=8192
*.db_domain=‘‘
*.db_name=‘orcl01‘
*.db_recovery_file_dest=‘/u01/app/oracle/flash_recovery_area‘
*.db_recovery_file_dest_size=4070572032
*.diagnostic_dest=‘/u01/app/oracle‘
*.dispatchers=‘(PROTOCOL=TCP) (SERVICE=orcl01XDB)‘
*.memory_target=787480576
*.open_cursors=300
*.processes=150
*.remote_login_passwordfile=‘EXCLUSIVE‘
*.undo_tablespace=‘UNDOTBS1‘
[[email protected] dbs]$ mkdir -p /u01/app/oracle/admin/orcl01/adump

[[email protected] dbs]$ mkdir -p /u01/app/oracle/oradata/orcl01

[[email protected] dbs]$ mkdir -p /u01/app/oracle/flash_recovery_area/orcl01

6. In the RMAN session, restore the control files:

RMAN> restore controlfile from ‘/u01/app/remote/flash_recovery_area/ORCL01/backupset/2014_10_01/o1_mf_ncsn1_TAG20141001T011809_b2q3ojl8_.bkp‘;

7. Restart database in mount mode. You cannot directly alter database mount because the spfile has been restored:

RMAN> alter database mount;

RMAN-00571: ===========================================================
RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ===============
RMAN-00571: ===========================================================
RMAN-03002: failure of alter db command at 10/27/2014 10:35:35
ORA-01103: database name ‘ORCL01‘ in control file is not ‘DUMMY‘

RMAN> shutdown immediate;

Oracle instance shut down

RMAN> startup mount;

8. Catalog the backupsets:

RMAN> catalog start with ‘/u01/app/remote/flash_recovery_area/ORCL01/backupset/2014_10_01‘;

9. In the sqlplus session, check v$datafile and v$logfile and mkdir the directories.

SQL> select file#,name from v$datafile;

FILE#
----------
NAME
--------------------------------------------------------------------------------
1
/u01/app/oracle/oradata/orcl01/system01.dbf

2
/u01/app/oracle/oradata/orcl01/sysaux01.dbf

3
/u01/app/oracle/oradata/orcl01/undotbs01.dbf

FILE#
----------
NAME
--------------------------------------------------------------------------------
4
/u01/app/oracle/oradata/orcl01/user01.dbf

5
/u01/app/oracle/oradata/orcl01/example01.dbf

6
/u01/app/oracle/oradata/orcl01/index01

6 rows selected.

SQL> select member from v$logfile;

MEMBER
----------------------------------------------------------------------------------------------------
/u01/app/oracle/oradata/orcl01/redo03.log
/u01/app/oracle/oradata/orcl01/redo02.log
/u01/app/oracle/oradata/orcl01/redo01.log

In this case, /u01/app/oracle/oradata/orcl01 has been created at step 5.

10. In RMAN session, restore database, recover database and open database with resetlogs option

RMAN> restore database;

...

RMAN> recover database;

...

RMAN> alter database open resetlogs;

...

P.S.: if you want to restore datafiles to a different path, in step 10:

RMAN> run{
2> set newname for datafile 1 to ‘/u01/app/oracle/oradata/newpath/system01.dbf‘;

3> restore database;
4> switch datafile all;
5> recover database;
6> }

时间: 2024-12-27 00:08:59

Restore Oracle database to another server的相关文章

Create Oracle Enterprise Manager repository data after restore a database from another server

1. Set password for SYS in password file: orapwd file=$ORACLE_HOME/dbs/orapw<ORACLE_SID> 2. Drop repos data copied from the original database ( you may need to unlock sysman user first ): emca -deconfig dbcontrol db -repos drop 3. If emca cannot dro

How to backup and restore database in SQL Server

/*By Dylan SUN*/ If you want to backup and restore one database in SQL Server. Firstly, create a shared folder, and add everyone with read/write right. Secondly, backup your database. You can use the following script : backup database DatabaseName to

Oracle Database Memory Structures

Oracle Database creates and uses memory structures for various purposes. For example, memory stores program code being run, data that is shared among users, and private data areas for each connected user. Two basic memory structures are associated wi

使用 Oracle GoldenGate 在 Microsoft SQL Server 和 Oracle Database 之间复制事务

使用 Oracle GoldenGate 在 Microsoft SQL Server 和 Oracle Database 之间复制事务 作者:Nikolay Manchev 分步构建一个跨这些平台的简单事务复制示例. 2011 年 8 月发布 大多数关注数据复制的 Oracle 技术专家都熟悉 Oracle Streams.在 2009 年之前,Streams 一直是推荐使用的最流行的 Oracle 数据分发技术. 2009 年 7 月,Oracle 收购了 GoldenGate 这一数据库复

11.2.0.3.0 PATCH SET FOR ORACLE DATABASE SERVER for windows (32bit)

Patch 10404530 [使用迅雷直接下载]   11.2.0.3.0 PATCH SET FOR ORACLE DATABASE SERVER for linux x86-64 https://updates.oracle.com/Orion/Services/download/p10404530_112030_Linux-x86-64_1of7.zip?aru=14125322&patch_file=p10404530_112030_Linux-x86-64_1of7.zip http

P6 EPPM Manual Installation Guide (Oracle Database)

Contents Oracle Database Manual Configuration Overview ,,★★5 Oracle Database Installation ,,★★6 Creating the Database Structure for Oracle and Loading Application Data ,,★★7 Creating the P6 EPPM Database Structure for Oracle ,,★★7 Copying the Script

To restore the database on a new host-将数据库恢复至一个新的主机上

To restore the database on a new host:1. Ensure that the backups of the target database are accessible on the new host.2. Configure the ORACLE_SID on hostb.3. Start RMAN on hostb and connect to the target database without connecting to the recovery c

Quick and Easy Installation of Oracle Database 12c on Oracle Linux in Oracle VM VirtualBox

发贴人 Sergio-Oracle 于2018-4-18 23:10:15在Oracle Linux Introduction How Does This Work? Requirements Before You Get Started Steps Clone the vagrant-boxes repository from GitHub Download Oracle Database Installation Files Place the downloaded Database ins

Windows 7 64bit上安装Oracle Database 12c [INS-30131] 错误的解决方法

Windows 7 64bit上安装Oracle Database 12c,出现以下错误: 解决方法: 第一步:控制面板>所有控制面板项>管理工具>服务>SERVER  启动 第二步:控制面板>所有控制面板项>管理工具>计算机管理>系统工具>共享文件夹>共享   右键单击“共享”>新建共享> 点击“下一步”>   单击“浏览”> 选择"本地磁盘(C:)">确定   单击“下一步”:     单击“