RMAN异机duplicate复制数据库(二)
art
6.2.2 在辅助库上挂载源库的目录,注意,mount命令必须以root用户执行
[root@rhel5 orabackup]# mount -t nfs -o rw,bg,hard,nointr,rsize=32768,wsize=32768,tcp,vers=3,timeo=600,actimeo=0 192.168.99.91:/orabackup /orabackup
-- 注意: 在挂载NFS的时候,一定要加上-t -o 参数,不然在RMAN 复制的时候会报错:
--ORA-27054: NFS file system where the file is created or resides is not mounted with correct options
七. 启动辅助库至nomount 状态,注意使用pfile参数启动
SQL> startup nomount pfile= /dbs/initorcl2.ora
SQL> exit -- 启动后就退出session,因为在duplicata的时候不能有session连接
八. RMAN 连接到目标实例和辅助实例,运行duplicate 命令复制数据库
[oracle@rhel5 admin]$ rman target / auxiliary sys/oracle@orcl2_au
RMAN> run {
allocate channel t1 type disk;
allocate channel t2 type disk;
allocate channel t3 type disk;
allocate auxiliary channel a2 type disk;
allocate auxiliary channel a3 type disk;
allocate auxiliary channel a4 type disk;
duplicate target database to orcl2 nofilenamecheck
logfile
'/oradata/orcl2/redo01.dbf' size 50m,
'/oradata/orcl2/redo02.dbf' size 50m,
'/oradata/orcl2/redo03.dbf' size 50m;
}
注: 这个地方有2个地方需要说明:
(1) Nofilenamecheck 参数:
如果在复制时,位置不同时,我们会用参数db_file_name_convert 对文件位置进行转换。 但是在这个复制示例中我们用的是相同的位置。 所以这里必须加上nofilenamecheck参数。 该参数通知复制操作不必在执行还原操作前确认文件名是不同的。如果没有指定nofilenamecheck参数,rman会给出如下错误:
RMAN-05001: auxiliary filename /u01/app/oracle/oradata/orcl/example01.dbf conflicts with a file used by the target database
RMAN-05001: auxiliary filename /u01/app/oracle/oradata/orcl/users01.dbf conflicts with a file used by the target database
(2) logfile 参数:
在完成复制进程并执行最有一条open resetlogs命令时,RMAN 必须为辅助
数据库构建全新的日志文件。 如上面命令所示,我们可以在duplicate 命令中指定logfile参数,并指定使用的日志文件的大小,数目和位置。
还可以在pfile里指定log_file_name_convert 参数来进行转换。 这种方法相对而言要简单一点。
using target database control file instead of recovery catalog
allocated channel: t1
channel t1: SID=46 device type=DISK
allocated channel: t2
channel t2: SID=43 device type=DISK
allocated channel: t3
channel t3: SID=36 device type=DISK
allocated channel: a2
channel a2: SID=18 device type=DISK
allocated channel: a3
channel a3: SID=21 device type=DISK
allocated channel: a4
channel a4: SID=22 device type=DISK
Starting Duplicate Db at 22-OCT-13
contents of Memory Script:
{
sql clone "alter system set db_name =
''ORCL2'' comment=
''Modified by RMAN duplicate'' scope=spfile";
sql clone "alter system set db_unique_name =
''ORCL2'' comment=
''Modified by RMAN duplicate'' scope=spfile";
shutdown clone immediate;
startup clone force nomount
restore clone primary controlfile;
alter clone database mount;
}
executing Memory Script
sql statement: alter system set db_name = ''ORCL2'' comment= ''Modified by RMAN duplicate'' scope=spfile
sql statement: alter system set db_unique_name = ''ORCL2'' comment= ''Modified by RMAN duplicate'' scope=spfile
Oracle instance shut down
Oracle instance started
Total System Global Area 849530880 bytes
Fixed Size 1339824 bytes
Variable Size 629149264 bytes
Database Buffers 213909504 bytes
Redo Buffers 5132288 bytes
allocated channel: a2
channel a2: SID=19 device type=DISK
allocated channel: a3
channel a3: SID=20 dev