windows環境下10.2.0.1到11gr2 遷移升級

來源:互聯網
上載者:User

標籤:upgrade   windows   遷移   

windows 環境下 10g 資料庫到11g 資料庫遷移一。10g 環境做好遷移準備

在資料庫中建立test表,並插入一條資料以便確認遷移是否成功

SQL> create table test(id number,name varchar(20));

SQL> insert into test(id,name) values(1,‘test‘


由於10.2.0.1版本不能直接升級到11gr2,所以需要先將來源資料庫升級為10.2.0.2

 

登陸rman

C:\Documentsand Settings\Administrator>rman target /

 

復原管理員: Release10.2.0.1.0 - Production on 星期二 4月 14 16:47:24 2015

 

Copyright(c) 1982, 2005, Oracle.  All rightsreserved.

 

串連到目標資料庫: TEST(DBID=2175164748)


修改rman參數

RMAN>configure controlfile autobackup on;

RMAN>configure datafile backup copies for device type disk to ‘d:\backup\%F‘;

RAMN>CONFIGURERETENTION POLICY TO REDUNDANCY 2;


備份資料庫以及歸檔記錄檔

$ORACLE_HOME/rdbms/admin下的utlu112i.sql指令碼copy到10g的$ORACLE_HOME/rdbms/admin 下,並在10g上執行


備份資料庫以及歸檔記錄檔

RMAN> backupdatabase format ‘ /data/backup/2014-04-17-allbackup、full_%d_%T_%s_P.bak‘;

RMAN> backuparchivelog all format /data/backup/2014-04-17-allbackup/arch_%d_%T_%s_%p.bak‘;


將產生備份組全部拷貝到新環境中(要拷貝一份口令檔案)

===========================新===========================================

設定oracle-sid ,登入rman
oradim -new -sid test ---建立test執行個體

C:\Users\Administrator>rmantarget / nocatalogg

exportORACLE_SID=test


恢複spfile到指定目錄下

startup nomount;
RMAN>restore spfile to

‘C:\app\Administrator\product\11.2.0\dbhome_1\dbs\spfiletest.ora‘from

‘C:\backup\C-2175164748-20150416-00‘;


建立pfile並修改其中參數,並建立相關檔案夾(所有路徑需要與當前安裝路徑匹配)

SQL> create pfilefrom spfile=‘C:\app\Administrator\product\11.2.0\dbhome_1\dbs\

spfiletest.ora‘;

test.__db_cache_size=167772160

test.__java_pool_size=4194304

test.__large_pool_size=4194304

test.__shared_pool_size=109051904

test.__streams_pool_size=0

*.audit_file_dest=‘C:\oracle\product\10.2.0/admin/test/adump‘

*.background_dump_dest=‘C:\oracle\product\10.2.0/admin/test/bdump‘--delete

*.compatible=‘10.2.0.1.0‘  --修改為當前資料庫版本

*.control_files=‘C:\oracle\product\10.2.0/oradata/test/\control01.ctl‘,‘C:\oracle\product\10.2.0/oradata/test/\control02.ctl‘,‘C:\oracle\product\10.2.0/oradata/test/\control03.ctl‘

*.core_dump_dest=‘C:\oracle\product\10.2.0/admin/test/cdump‘  --delete

*.db_block_size=8192

*.db_domain=‘‘

*.db_file_multiblock_read_count=16 --delete

*.db_name=‘test‘

*.db_recovery_file_dest=‘C:\oracle\product\10.2.0/flash_recovery_area‘

*.db_recovery_file_dest_size=2147483648

*.dispatchers=‘(PROTOCOL=TCP) (SERVICE=testXDB)‘

*.job_queue_processes=10

*.log_archive_format=‘ARC%S_%R.%T‘

*.nls_language=‘SIMPLIFIED CHINESE‘

*.nls_territory=‘CHINA‘

*.open_cursors=300

*.pga_aggregate_target=96468992

*.processes=150

*.remote_login_passwordfile=‘EXCLUSIVE‘

*.sga_target=290455552

*.undo_management=‘AUTO‘

*.undo_tablespace=‘UNDOTBS1‘

    *.user_dump_dest=‘C:\oracle\product\10.2.0/admin/test/udump‘  --delete


恢複控制檔案

RMAN>restorecontrolfile from ‘C:\backup\C-2175164748-20150416-00‘;

需要把副檔名從.ora 改成.ctl

啟動到mount狀態,恢複資料檔案

alter database mount;

重設資料檔案路徑,並恢複資料庫

run{

set newname for datafile 1 to‘C:\app\Administrator\oradata\test\SYSTEM01.DBF‘;

set newname for datafile 2 to‘C:\app\Administrator\oradata\test\UNDOTBS01.DBF‘;

set newname for datafile 3 to‘C:\app\Administrator\oradata\test\SYSAUX01.DBF‘;

set newname for datafile 4 to‘C:\app\Administrator\oradata\test\USERS01.DBF‘;

restore database;

SWITCH DATAFILE ALL;

SWITCH TEMPFILE ALL;

}

修複資料庫

recover database;

重新命名重做日誌,並以resetlogs方式開啟資料庫

alter database rename file‘C:\ORACLE\PRODUCT\10.2.0\ORADATA\TEST\REDO03.LOG‘ to

‘C:\app\Administrator\oradata\test\redo03.log‘;

alter database renamefile ‘C:\ORACLE\PRODUCT\10.2.0\ORADATA\TEST\REDO02.LOG‘ to‘C:\app\Administrator\oradata\test\redo02.log‘;

alter database renamefile ‘C:\ORACLE\PRODUCT\10.2.0\ORADATA\TEST\REDO01.LOG‘ to‘C:\app\Administrator\oradata\test\redo01.log‘;

  1. 以upgrade方式開啟資料庫

sqlplus / as sysdba

startup upgrade

  1. 執行升級指令碼

SQL>@?/RDBMS/ADMIN/utlu112i.sql

SQL>@?/rdbms/admin/catupgrd.sql

SQL> @?/rdbms/admin/catuppst.sql

 


本文出自 “Sunny” 部落格,請務必保留此出處http://dbasunny.blog.51cto.com/9192126/1654844

windows環境下10.2.0.1到11gr2 遷移升級

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.