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.




發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章