oracle linux6操作系统oracle11.2.0.4数据库从一台主机A(ora11g)到另一台主机B(ora02)的迁移过程


oracle linux6操作系统oracle11.2.0.4数据库从一台主机Aora11g)到另一台主机Bora02)的迁移过程


A生成pfile文件并关闭数据库

[oracle@ora11g ~]$ sqlplus /nolog


SQL*Plus: Release 11.2.0.4.0 Production on Fri Jan 1 17:25:12 2016


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


SQL> conn / as sysdba

Connected.

SQL> create pfile from spfile;


File created.


SQL> shutdown immediate

Database closed.

Database dismounted.

ORACLE instance shut down.

SQL> quit

Disconnected from Oracle Database 11g Enterprise Edition Release 11.2.0.4.0 - 64bit Production

With the Partitioning, OLAP, Data Mining and Real Application Testing options

[oracle@ora11g ~]$


A将密码文件,参数文件复制到B

[oracle@ora11g dbs]$ pwd

/u01/app/oracle/product/11.2.0/dbhome_1/dbs

[oracle@ora11g dbs]$ scp orapwORCL 192.168.56.18:/u01/app/oracle/product/11.2.0/dbhome_1/dbs

The authenticity of host '192.168.56.18 (192.168.56.18)' can't be established.

RSA key fingerprint is 1f:9f:b4:3c:7e:4c:97:0c:70:ac:06:bd:d3:d8:28:7c.

Are you sure you want to continue connecting (yes/no)? yes

Warning: Permanently added '192.168.56.18' (RSA) to the list of known hosts.

[email protected]'s password:

orapwORCL                                    100% 1536     1.5KB/s   00:00    

[oracle@ora11g dbs]$ scp initORCL.ora 192.168.56.18:/u01/app/oracle/product/11.2.0/dbhome_1/dbs

[email protected]'s password:

initORCL.ora                                 100%  902     0.9KB/s   00:00    


B根据参数文件创建相应目录

[oracle@ora02 Desktop]$ mkdir -p /u01/app/oracle/admin/ORCL/adump

[oracle@ora02 Desktop]$ mkdir -p /u01/app/oracle/oradata/ORCL/

[oracle@ora02 Desktop]$ mkdir -p /u01/app/oracle/fast_recovery_area/ORCL/


A将控制文件,日志文件,数据文件复制到B

[oracle@ora11g ORCL]$ scp control01.ctl 192.168.56.18:/u01/app/oracle/fast_recovery_area/ORCL/control02.ctl

[email protected]'s password:

control01.ctl                                100% 9520KB   9.3MB/s   00:00    

[oracle@ora11g ORCL]$ scp * 192.168.56.18:/u01/app/oracle/oradata/ORCL

[email protected]'s password:

control01.ctl                                100% 9520KB   9.3MB/s   00:00    

redo01.log                                   100%   50MB  50.0MB/s   00:01    

redo02.log                                   100%   50MB  50.0MB/s   00:01    

redo03.log                                   100%   50MB  50.0MB/s   00:01    

sysaux01.dbf                                 100%  490MB  70.0MB/s   00:07    

system01.dbf                                 100%  740MB  67.3MB/s   00:11    

temp01.dbf                                   100%   29MB  29.0MB/s   00:00    

undotbs01.dbf                                100%   70MB  70.0MB/s   00:01    

users01.dbf                                  100% 5128KB   5.0MB/s   00:00    


B新建目录并将数据文件复制过去

[root@ora02 ~]# mkdir -p /u02/app/oracle/oradata/ORCL

[root@ora02 ~]# chown -R oracle:oinstall /u02/


[oracle@ora02 Desktop]$ cd /u01/app/oracle/oradata/ORCL/

[oracle@ora02 ORCL]$ ls

control01.ctl redo02.log  sysaux01.dbf  temp01.dbf     users01.dbf

redo01.log    redo03.log  system01.dbf  undotbs01.dbf

[oracle@ora02 ORCL]$ mv *.dbf /u02/app/oracle/oradata/ORCL/


B将数据库启动到mount状态

[oracle@ora02 Desktop]$ sqlplus /nolog


SQL*Plus: Release 11.2.0.4.0 Production on Fri Jan 1 17:43:24 2016


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


SQL> conn / as sysdba

Connected to an idle instance.

SQL> startup mount

ORACLE instance started.


Total System Global Area  835104768 bytes

Fixed Size    2257840 bytes

Variable Size  536874064 bytes

Database Buffers  289406976 bytes

Redo Buffers    6565888 bytes

Database mounted.

SQL>


B启动rman,使用rman修改数据文件在控制文件中的位置


[oracle@ora02 ORCL]$ rman target /


Recovery Manager: Release 11.2.0.4.0 - Production on Fri Jan 1 17:44:52 2016


Copyright (c) 1982, 2011, Oracle and/or its affiliates.  All rights reserved.


connected to target database: ORCL (DBID=1427785672, not open)


RMAN> catalog start with '/u02/app/oracle/oradata/ORCL';


using target database control file instead of recovery catalog

searching for all files that match the pattern /u02/app/oracle/oradata/ORCL


List of Files Unknown to the Database

=====================================

File Name: /u02/app/oracle/oradata/ORCL/temp01.dbf

File Name: /u02/app/oracle/oradata/ORCL/system01.dbf

File Name: /u02/app/oracle/oradata/ORCL/users01.dbf

File Name: /u02/app/oracle/oradata/ORCL/sysaux01.dbf

File Name: /u02/app/oracle/oradata/ORCL/undotbs01.dbf


Do you really want to catalog the above files (enter YES or NO)? yes

cataloging files...

cataloging done


List of Cataloged Files

=======================

File Name: /u02/app/oracle/oradata/ORCL/temp01.dbf

File Name: /u02/app/oracle/oradata/ORCL/system01.dbf

File Name: /u02/app/oracle/oradata/ORCL/users01.dbf

File Name: /u02/app/oracle/oradata/ORCL/sysaux01.dbf

File Name: /u02/app/oracle/oradata/ORCL/undotbs01.dbf


RMAN> report schema;          


Report of database schema for database with db_unique_name ORCL


List of Permanent Datafiles

===========================

File Size(MB) Tablespace           RB segs Datafile Name

---- -------- -------------------- ------- ------------------------

1   0        SYSTEM               ***     /u01/app/oracle/oradata/ORCL/system01.dbf

2   0        SYSAUX               ***     /u01/app/oracle/oradata/ORCL/sysaux01.dbf

3   0        UNDOTBS1             ***     /u01/app/oracle/oradata/ORCL/undotbs01.dbf

4   0        USERS                ***     /u01/app/oracle/oradata/ORCL/users01.dbf


List of Temporary Files

=======================

File Size(MB) Tablespace           Maxsize(MB) Tempfile Name

---- -------- -------------------- ----------- --------------------

1   20       TEMP                 32767       /u01/app/oracle/oradata/ORCL/temp01.dbf


RMAN> switch database to copy;


datafile 1 switched to datafile copy "/u02/app/oracle/oradata/ORCL/system01.dbf"

datafile 2 switched to datafile copy "/u02/app/oracle/oradata/ORCL/sysaux01.dbf"

datafile 3 switched to datafile copy "/u02/app/oracle/oradata/ORCL/undotbs01.dbf"

datafile 4 switched to datafile copy "/u02/app/oracle/oradata/ORCL/users01.dbf"


RMAN> report schema;


Report of database schema for database with db_unique_name ORCL


List of Permanent Datafiles

===========================

File Size(MB) Tablespace           RB segs Datafile Name

---- -------- -------------------- ------- ------------------------

1   740      SYSTEM               ***     /u02/app/oracle/oradata/ORCL/system01.dbf

2   490      SYSAUX               ***     /u02/app/oracle/oradata/ORCL/sysaux01.dbf

3   70       UNDOTBS1             ***     /u02/app/oracle/oradata/ORCL/undotbs01.dbf

4   5        USERS                ***     /u02/app/oracle/oradata/ORCL/users01.dbf


List of Temporary Files

=======================

File Size(MB) Tablespace           Maxsize(MB) Tempfile Name

---- -------- -------------------- ----------- --------------------

1   20       TEMP                 32767       /u01/app/oracle/oradata/ORCL/temp01.dbf


RMAN>


B启动数据库,完成迁移

SQL> alter database open;


Database altered.




你可能感兴趣的:(oracle,操作系统,迁移)