rman將linux平臺資料庫遷移到window平臺資料庫

tolilong發表於2013-01-05
今天測試了一下將linux平臺的oracle資料庫遷移到windows平臺下[@more@]
1.準備pfile,將linux上的pfile copy到window下,修改相應的目錄
orcl.__db_cache_size=134217728
orcl.__java_pool_size=4194304
orcl.__large_pool_size=4194304
orcl.__oracle_base='D:app'#ORACLE_BASE set from environment
orcl.__pga_aggregate_target=218103808
orcl.__sga_target=411041792
orcl.__shared_io_pool_size=0
orcl.__shared_pool_size=247463936
orcl.__streams_pool_size=8388608
*._kghdsidx_count=4
*.audit_file_dest='D:appadminorcladump'
*.audit_trail='db'
*.compatible='11.2.0.0.0'
*.control_files='D:apporadataorclcontrol01.ctl','D:apporadataorclcontrol02.ctl'
*.db_block_size=8192
*.db_domain=''
*.db_name='orcl'
*.diagnostic_dest='D:app'
*.memory_max_target=629145600
*.memory_target=629145600
*.processes=150
*.remote_login_passwordfile='EXCLUSIVE'
*.undo_tablespace='UNDOTBS1'
2.啟動到nomount 階
oradim –new –sid prod –startmode manual –pfile d:oracle…….pfileinitprod.ora
C:>sqlplus / as sysdba

SQL*Plus: Release 11.2.0.1.0 Production on 星期六 1月 5 11:11:21 2013
Copyright (c) 1982, 2010, Oracle. All rights reserved.
Connected to an idle instance.
SQL> startup nomount
ORACLE instance started.
Total System Global Area 626327552 bytes
Fixed Size 2178336 bytes
Variable Size 482345696 bytes
Database Buffers 134217728 bytes
Redo Buffers 7585792 bytes
SQL> create spfile from pfile;
File created.
SQL> shutdown immediate
ORA-01507: ??????

ORACLE instance shut down.
SQL> startup nomount
ORACLE instance started.
Total System Global Area 626327552 bytes
Fixed Size 2178336 bytes
Variable Size 482345696 bytes
Database Buffers 134217728 bytes
Redo Buffers 7585792 bytes
3.啟動到mount階段
C:>rman target /
Recovery Manager: Release 11.2.0.1.0 - Production on 星期六 1月 5 11:14:13 2013
Copyright (c) 1982, 2009, Oracle and/or its affiliates. All rights reserved.
connected to target database: ORCL (not mounted)
RMAN> restore controlfile from 'd:c-1326955037-20130103-00';
Starting restore at 05-1月 -13
using target database control file instead of recovery catalog
allocated channel: ORA_DISK_1
channel ORA_DISK_1: SID=5 device type=DISK
channel ORA_DISK_1: restoring control file
channel ORA_DISK_1: restore complete, elapsed time: 00:00:03
output file name=D:APPORADATAORCLCONTROL01.CTL
output file name=D:APPORADATAORCLCONTROL02.CTL
Finished restore at 05-1月 -13
RMAN> alter database mount;
database mounted
released channel: ORA_DISK_1
4.將從linux上copy到window下的備份 加入到controlfile中.
RMAN> catalog backuppiece 'd:201212302unu6mab_1_1';
cataloged backup piece
backup piece handle=D:201212302UNU6MAB_1_1 RECID=102 STAMP=803906255
RMAN> catalog backuppiece 'd:2012123130nu9amd_1_1';
cataloged backup piece
backup piece handle=D:2012123130NU9AMD_1_1 RECID=103 STAMP=803906256
RMAN> catalog backuppiece 'd:2013010132nubv2c_1_1';
cataloged backup piece
backup piece handle=D:2013010132NUBV2C_1_1 RECID=104 STAMP=803906256
RMAN> catalog backuppiece 'd:2013010234nuejed_1_1';
cataloged backup piece
backup piece handle=D:2013010234NUEJED_1_1 RECID=105 STAMP=803906257
RMAN> catalog backuppiece 'd:2013010336nuh7qd_1_1';
cataloged backup piece
backup piece handle=D:2013010336NUH7QD_1_1 RECID=106 STAMP=803906261
5.restore database
RMAN> run{
2> allocate channel c1 type disk;
3> allocate channel c2 type disk;
4> set newname for datafile 1 to 'D:apporadataorclsystem01.dbf';
5> set newname for datafile 2 to 'D:apporadataorclsysaux01.dbf';
6> set newname for datafile 3 to 'D:apporadataorclundotbs01.dbf';
7> set newname for datafile 4 to 'D:apporadataorclusers01.dbf';
8> set newname for datafile 5 to 'D:apporadataorclhissaas_data01.dbf';
9> set newname for datafile 6 to 'D:apporadataorclhissaas_data02.dbf';
10> set newname for datafile 7 to 'D:apporadataorclsaas_data01.dbf';
11> restore database;
12> switch datafile all;
13> release channel c1;
14> release channel c2;
15> }
allocated channel: c1
channel c1: SID=192 device type=DISK
allocated channel: c2
channel c2: SID=5 device type=DISK
executing command: SET NEWNAME
executing command: SET NEWNAME
executing command: SET NEWNAME
executing command: SET NEWNAME
executing command: SET NEWNAME
executing command: SET NEWNAME
executing command: SET NEWNAME
Starting restore at 05-1月 -13
channel c1: starting datafile backup set restore
channel c1: specifying datafile(s) to restore from backup set
channel c1: restoring datafile 00001 to D:apporadataorclsystem01.dbf
channel c1: restoring datafile 00002 to D:apporadataorclsysaux01.dbf
channel c1: restoring datafile 00003 to D:apporadataorclundotbs01.dbf
channel c1: restoring datafile 00004 to D:apporadataorclusers01.dbf
channel c1: restoring datafile 00005 to D:apporadataorclhissaas_data01.dbf
channel c1: restoring datafile 00006 to D:apporadataorclhissaas_data02.dbf
channel c1: restoring datafile 00007 to D:apporadataorclsaas_data01.dbf
channel c1: reading from backup piece /rmanbackup/201212302unu6mab_1_1
channel c1: errors found reading piece handle=/rmanbackup/201212302unu6mab_1_1
channel c1: failover to piece handle=D:201212302UNU6MAB_1_1 tag=TAG20121230T223803
channel c1: restored backup piece 1
channel c1: restore complete, elapsed time: 00:09:56
Finished restore at 05-1月 -13
datafile 1 switched to datafile copy
input datafile copy RECID=8 STAMP=803908655 file name=D:APPORADATAORCLSYSTEM01.DBF
datafile 2 switched to datafile copy
input datafile copy RECID=9 STAMP=803908656 file name=D:APPORADATAORCLSYSAUX01.DBF
datafile 3 switched to datafile copy
input datafile copy RECID=10 STAMP=803908656 file name=D:APPORADATAORCLUNDOTBS01.DBF
datafile 4 switched to datafile copy
input datafile copy RECID=11 STAMP=803908656 file name=D:APPORADATAORCLUSERS01.DBF
datafile 5 switched to datafile copy
input datafile copy RECID=12 STAMP=803908657 file name=D:APPORADATAORCLHISSAAS_DATA01.DBF
datafile 6 switched to datafile copy
input datafile copy RECID=13 STAMP=803908657 file name=D:APPORADATAORCLHISSAAS_DATA02.DBF
datafile 7 switched to datafile copy
input datafile copy RECID=14 STAMP=803908658 file name=D:APPORADATAORCLSAAS_DATA01.DBF
released channel: c1
released channel: c2
5.recover database
有個奇怪的問題,把recover database放在上面的restore指令碼中,會有ora-01110,ora-01157的錯誤,奇怪了
RMAN> run{
2> recover database;
3> }
6.接下來就是開啟資料庫
SQL> alter database backup controlfile to trace as 'd:bakcontrol.sql';
Database altered.
SQL> STARTUP NOMOUNT
ORACLE instance started.
Total System Global Area 626327552 bytes
Fixed Size 2178336 bytes
Variable Size 482345696 bytes
Database Buffers 134217728 bytes
Redo Buffers 7585792 bytes
SQL> CREATE CONTROLFILE REUSE DATABASE "ORCL" RESETLOGS NOARCHIVELOG
2 MAXLOGFILES 16
3 MAXLOGMEMBERS 3
4 MAXDATAFILES 100
5 MAXINSTANCES 8
6 MAXLOGHISTORY 292
7 LOGFILE
8 GROUP 1 'D:APPORADATAORCLredo01.log' SIZE 50M BLOCKSIZE 512,
9 GROUP 2 'D:APPORADATAORCLredo02.log' SIZE 50M BLOCKSIZE 512,
10 GROUP 3 'D:APPORADATAORCLredo03.log' SIZE 50M BLOCKSIZE 512,
11 GROUP 4 'D:APPORADATAORCLredo04.log' SIZE 50M BLOCKSIZE 512
12 DATAFILE
13 'D:APPORADATAORCLSYSTEM01.DBF',
14 'D:APPORADATAORCLSYSAUX01.DBF',
15 'D:APPORADATAORCLUNDOTBS01.DBF',
16 'D:APPORADATAORCLUSERS01.DBF',
17 'D:APPORADATAORCLHISSAAS_DATA01.DBF',
18 'D:APPORADATAORCLHISSAAS_DATA02.DBF',
19 'D:APPORADATAORCLSAAS_DATA01.DBF'
20 CHARACTER SET AL32UTF8
21 ;
Control file created.
SQL> alter database open resetlogs;
Database altered.
SQL> ALTER TABLESPACE TEMP ADD TEMPFILE 'D:APPORADATAORCLtemp01.dbf' size 10m;

Tablespace altered.

來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/24237320/viewspace-1060004/,如需轉載,請註明出處,否則將追究法律責任。

相關文章