辅助库上:
TARGETORCL =
(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.0.45)(PORT = 1521))
)
(CONNECT_DATA =
(SERVICE_NAME = orcl)
)
)
ORCL =
(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.0.78)(PORT = 1521))
)
(CONNECT_DATA =
(SERVICE_NAME = orcl)
)
)
6:目标库进行备份,并拷贝到辅助实例服务其上,或同NFS挂载过去;
RMAN> RUN {
2> allocate channel c1 type disk;
3> allocate channel c2 type disk;
4> backup database format '/backup/orcl_%U_%T' skip inaccessible filesperset 5 tag orcl_bak;
5> sql 'alter system archive log current';
6> backup archivelog all delete input format '/backup/arch_%U_%T' skip inaccessible filesperset 5;
7> backup current controlfile format '/backup/ctl_%U_%T' tag='ctl_BAK';
8> backup spfile format '/backup/orcl_spfile_%U_%T' tag='spfile';
9> release channel c2;
10> release channel c1;
11> }
注: 因为这里使用的是nocatalog备份方式,备份信息会写入到控制文件中,所以,控制文件要单独备份
目标库上:
[root@bzdb ~]# cat /etc/exports
/backup 192.168.0.78(rw,async)
[root@bzdb ~]# /etc/init.d/nfs start
Starting NFS services: [ OK ]
Starting NFS mountd: [ OK ]
Stopping RPC idmapd: [ OK ]
Starting RPC idmapd: [ OK ]
Starting NFS daemon: [ OK ]
辅助库上:
# 建立与目标库上相同的目录
mkdir /backup
chown Oracle.oinstall /backup -R
chmod 775 /backup
showmount -e 192.168.0.45
mount -t nfs 192.168.0.45:/backup /bakup
7:使用pfile启动辅助实例到nomount,并退出会话;
SQL> startup nomount pfile='/uoracle/app/dbs/initorcl.ora'
ORACLE instance started.
Total System Global Area 1.0055E+10 bytes
Fixed Size 2237008 bytes
Variable Size 3154120112 bytes
Database Buffers 6878658560 bytes
Redo Buffers 19767296 bytes
SQL> exit
Disconnected from Oracle Database 11g Enterprise Edition Release 11.2.0.3.0 - 64bit Production
With the Partitioning, Oracle Label Security, OLAP, Data Mining,
Oracle Database Vault and Real Application Testing options
8:duplicate命令复制数据库;
目标库上:
[oracle@bzdb ~]$ rman target sys/admin123@orcl auxiliary sys/admin123@auxorcl;
Recovery Manager: Release 10.2.0.1.0 - Production on Sun Jul 18 20:41:19 2010
Copyright (c) 1982, 2005, Oracle. All rights reserved.
connected to target database: ORCL (DBID=1248423599)
connected to auxiliary database: ORCL (not mounted)
RMAN> duplicate target database to ORCL nofilenamecheck
logfile
'/orabase/oradata/orcl/redo01.log' size 100M,
'/orabase/oradata/orcl/redo02.log' size 100M,
'/orabase/oradata/orcl/redo03.log' size 100M;
9:创建spfile,并重新启动
create spfile from pfile;
shutdown immeidate;
startup
验证数据库是否复制成功
更多Oracle相关信息见Oracle 专题页面 http://www.linuxidc.com/topicnews.aspx?tid=12
本文永久更新链接地址:http://www.linuxidc.com/Linux/2014-11/108885.htm
