<div class="preview-main">
<span style="color:#666666;font-family:'Courier New';font-size:16px;line-height:1.5;">数据库的迁移方式千变万化,各有千秋。今天为大家呈现的是第二种方法,利用RMAN中的Duplicate来完成数据库的迁移工作。<br><br><strong><span style="color:#000000;">1.创建目标数据库的辅助实例</span></strong><br> 为了使用迁移后的数据库,我们首先创建一个辅助实例。<br><br><span style="color:#333333;"><strong>1)创建参数文件</strong></span><span style="color:#333333;"><strong></strong></span><br> 在本文中,我们将原数据库的参数文件和口令文件拷贝过来。<br></span>
<span style="color:#666666;font-family:'Courier New';font-size:16px;"><span style="line-height:1.5;">[oracle@ENMOEDU ~]$ cd /u01/app/oracle/product/11.2.0/dbhome_1/dbs/</span><br><span style="line-height:1.5;"> [oracle@ENMOEDU dbs]$ ls</span><br><span style="line-height:1.5;"> hc_ENMOEDU.dat initENMOEDU.ora init.ora lkENMOEDU orapwENMOED </span><span style="line-height:1.5;">spfileENMOEDU.ora</span><br></span>
<span style="color:#666666;font-family:'Courier New';font-size:16px;line-height:1.5;"> [oracle@ENMOEDU dbs]$ scp orapwENMOEDU spfileENMOEDU.ora oracle@192.168.80.27:/u01/app/oracle/product/11.2.0/dbhome_1/dbs/<br> The authenticity of host '192.168.80.27 (192.168.80.27)' can't be established.<br> RSA key fingerprint is db:39:d8:4c:81:41:aa:a3:e5:be:bc:60:f5:b6:43:56.<br> Are you sure you want to continue connecting (yes/no)? yes<br> Warning: Permanently added '192.168.80.27' (RSA) to the list of known hosts.<br> oracle@192.168.80.27's password: <br> orapwENMOEDU 100% 1536 1.5KB/s 00:00 <br> spfileENMOEDU.ora 100% 2560 2.5KB/s 00:00 <br><br> 在备库中查询传输过来的文件。<br> [oracle@FRANK dbs]$ ls<br> hc_FRANK.dat init.ora lkFRANK orapwENMOEDU orapwFRANK spfileENMOEDU.ora spfileFRANK.or<br><br> 至此,口令文件和参数文件传输成功。<br><br><span style="color:#333333;"><strong>2)修改参数文件</strong></span><br> [oracle@FRANK dbs]$ mv orapwENMOEDU orapwDBFRANK<br> [oracle@FRANK dbs]$ mv spfileENMOEDU.ora spfileDBFRANK.ora<br> [oracle@FRANK dbs]$ ls<br> hc_FRANK.dat init.ora lkFRANK orapwDBFRANK orapwFRANK spfileDBFRANK.ora spfileFRANK.ora<br><br> 创建pfile<br><span style="color:#4C33E5;"><strong></strong></span><span style="color:#4C33E5;"><strong>[oracle@FRANK dbs]$ export ORACLE_SID=DBFRANK</strong></span><br> [oracle@FRANK dbs]$ sqlplus / as sysdba<br><br> SQL*Plus: Release 11.2.0.3.0 Production on Tue Apr 8 00:31:40 2014<br> Copyright (c) 1982, 2011, Oracle. All rights reserved.<br> Connected to an idle instance.<br><br> SQL> create pfile from spfile;<br> File created.<br> [oracle@FRANK dbs]$ vi initDBFRANK.ora<br><br> 将pfile中的ENMOEDU全部替换为DBFRANK,然后重新创建spfile.<br> [oracle@FRANK dbs]$ sqlplus / as sysdba<br><br> SQL*Plus: Release 11.2.0.3.0 Production on Tue Apr 8 00:39:45 2014<br> Copyright (c) 1982, 2011, Oracle. All rights reserved.<br> Connected to an idle instance.<br><br> SQL> create spfile from pfile; <br> File created.<br><br><span style="color:#333333;"><strong>3)创建所需要的目录</strong></span><br> [oracle@FRANK dbs]$ cd /u01/app/oracle/admin/<br> [oracle@FRANK admin]$ mkdir -p DBFRANK/adump<br> [oracle@FRANK DBFRANK]$ cd /u01/app/oracle/fast_recovery_area/<br> [oracle@FRANK fast_recovery_area]$ mkdir DBFRANK<br> [oracle@FRANK fast_recovery_area]$ cd /u01/app/oracle/oradata/<br> [oracle@FRANK oradata]$ mkdir DBFRANK<br><br><span style="color:#333333;"><strong>4)启动辅助实例</strong></span><br> [oracle@FRANK oradata]$ sqlplus / as sysdba<br><br> SQL*Plus: Release 11.2.0.3.0 Production on Tue Apr 8 00:46:21 2014<br> Copyright (c) 1982, 2011, Oracle. All rights reserved.<br> Connected to an idle instance.<br><br> SQL> startup nomount<br> ORACLE instance started.<br><br> Total System Global Area 422670336 bytes<br> Fixed Size 1345380 bytes<br> Variable Size 335546524 bytes<br> Database Buffers 79691776 bytes<br> Redo Buffers 6086656 bytes<br><br> 辅助实例在目标数据库上启动成功。<br><br><span style="color:#333333;"><strong>5)在原数据库上连接目标数据库的辅助实例</strong></span><br> 首先要配置目标数据库上的tnsname.ora文件<br> [oracle@ENMOEDU dbs]$ cd /u01/app/oracle/product/11.2.0/dbhome_1/network/admin/<br> [oracle@ENMOEDU admin]$ vi tnsnames.ora <br> # tnsnames.ora Network Configuration File: /u01/app/oracle/product/11.2.0/dbhome_1/network/admin/tnsnames.ora<br> # Generated by Oracle configuration tools.<br><br> ENMOEDU =<br> (DESCRIPTION =<br> (ADDRESS_LIST =<br> (ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.80.10)(PORT = 1521))<br> )<br> (CONNECT_DATA =<br> (SERVICE_NAME = ENMOEDU)<br> )<br> )<br> DBFRANK =<br> (DESCRIPTION =<br> (ADDRESS_LIST =<br> (ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.80.27)(PORT = 1521))<br> )<br> (CONNECT_DATA =<br> (SERVICE_NAME |
|