ORACLE 從32位到64位的一次遷移

1 環境說明
A 機:192.168.1.184
操作系統:LINUX 32位
數據庫:ORACLE 10G 32位

B機:192.168.1.183
操作系統:LINUX 64位
數據庫:ORACLE 10G 64位
2 A機備份
備份腳本:
Run{
Allocate channel a1 type disk;
Allocate channel a2 type disk;
Sql’alter system switch logfile’
Backup full format=’/home/oracle/rman/FULL_%d_%T_%s’ database plus archivelog format=’/home/oracle/rman/arch_%d_%T_%s’;
Backup format=’/home/oracle/rman/ctl_%U’ current controlfile;
Release channel a2;
Release channel a1;
}
3 A機生成參數文件
Create pfile=’/home/oracle/rman/initdevdb.ora’ from spfile;
4 將備從文件和參數文件傳至B機
Cd /home/oracle/rman
Scp * [email protected]:/home/oracle/rman
5 在B機對參數文件做相應的修改後啓動到NOMOUNT狀態
Export ORACLE_SID=devdb
Sqlplus / as sysdba
Startup nomount pfile=’/home/oracle/rman/initdevdb.ora’;
6 介質恢復
6.1 恢復控制文件
Rman target /
restore controlfile from ‘/home/oracle/rman/ctl_0hn2cdp1_1_1′;
6.2 啓動到MOUNT 狀態
Alter database mount;
6.3 介質恢復
Restore database;
Recover database;
在RECOVER DATABASE 時會報一個日誌序列的錯誤:
RMAN-00571: ===========================================================
RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ===============
RMAN-00571: ===========================================================
RMAN-03002: failure of recover command at 03/08/2012 01:47:31
RMAN-06054: media recovery requesting unknown log: thread 1 seq 5 lowscn 504551
解決辦法:
run{
set until sequence 5;
recover database;
}
6.4 以resetlogs 方式打開
alter database open resetlogs;

database opened
RMAN-06900: WARNING: unable to generate V$RMAN_STATUS or V$RMAN_OUTPUT row
RMAN-06901: WARNING: disabling update of the V$RMAN_STATUS and V$RMAN_OUTPUT rows
ORACLE error from target database:
ORA-06553: PLS-801: internal error [56319]
因爲數據庫從32位到64位,會有很多無效對像出現,所以會出現以上錯誤。
解決辦法:
在Target 端重新編譯64位的PL/SQL模塊
6.4.1 先重新啓動到更新模式。
startup upgrade pfile=’/home/oracle/rman/initdevdb.ora’;
6.4.2 執行腳本:@$ORACLE_HOME/rdbms/admin/utlirp.sql
6.4.3 查詢無效對象:
select count(*) from all_objects where status=’INVALID’;

COUNT(*)
———-
6548
由以上可以看出無效對象。
6.4.4 創建SPFILE 並重新啓動:
create spfile from pfile=’/home/oracle/rman/initdevdb.ora’;

File created.

SQL> shutdown immediate;
Database closed.
Database dismounted.
ORACLE instance shut down.
SQL> startup;
ORACLE instance started.

Total System Global Area 264241152 bytes
Fixed Size 2020024 bytes
Variable Size 100666696 bytes
Database Buffers 155189248 bytes
Redo Buffers 6365184 bytes
Database mounted.
Database opened.
6.4.5 執行編譯腳本
@?/rdbms/admin/utlrp.sql;
在執行以下時會報03113錯誤。
DECLARE
2 threads pls_integer := &&1;
3 BEGIN
4 utl_recomp.recomp_parallel(threads);
5 END;
6 /
ERROR at line 1:
ORA-03113: end-of-file on communication channel
6.4.6 再次查詢無效對象
select count(*) from all_objects where status=’INVALID’;

COUNT(*)
———-
261
從以上數字可以看到比頭一次查的要少很多了。
先放着,處理完Java在編譯一次
重建 javashared data objects (SRO)
執行以下腳本:
begin
update obj$ set status=5 where obj#=(select obj# from obj$,javasnm$ where owner#=0 and type#=29 and short(+)=name and nvl(longdbcs,name)=’oracle/aurora/rdbms/Compiler’);
commit;
declare
cursor C1 is select ‘DROP JAVA DATA “‘ || u.name||’”.”‘ || o.name || ‘”‘ from obj$ o,user$ u where o.type#=56 and u.user#=o.owner#;
ddl_statement varchar2(200);
iterations number;
previous_iterations number;
loop_count number;
my_err number;
begin
previous_iterations := 10000000;
loop
select count(*) into iterations from obj$ where type#=56;
exit when iterations=0 or iterations >=previous_iterations;
previous_iterations := iterations;
loop_count := 0;
open C1;
loop
begin
fetch C1 into ddl_statement;
exit when C1%NOTFOUND or loop_count > iterations;
exception when others then
my_err := sqlcode;
if my_err = -1555 then –snapshot too old, re-execute fetch query
exit;
else
raise;
end if;
end;
initjvmaux.exec(ddl_statement);
loop_count := loop_count + 1;
end loop;
close C1;
end loop;
end;
commit;
initjvmaux.drp(‘delete from java$policy$shared$table’);
update obj$ set status=1 where obj#=(select obj# from obj$,javasnm$
where owner#=0 and type#=29 and short(+)=name and nvl(longdbcs,name)=’oracle/aurora/rdbms/Compiler’);
commit;
end;
/
重建命令:create or replace java system
/
6.4.7 再次重新編譯無效對象
@?/rdbms/admin/utlrp.sql;
在執行腳本的過程中,session異常中斷,在alert log和 trace裏都有:ORA-7445的錯誤:
ORA-07445: exception encountered: core dump[__intel_new_memcpy()+2164] [SIGSEGV] [ADDR:0x7F2F0CBBD2BF] [PC:0x47ED7D4][Address not mapped to object] []

—– Current SQL Statement for thissession (sql_id=2y0pxmcj6k00t) —–
ALTER VIEW”OLAPSYS”.”ALL$OLAP2_AW_CATALOGS” COMPILE

導致這個問題,是因爲我們啓動了OLAP,在32位轉到64位時就會遇到這種錯誤。
7 處理OLAP問題
7.1 刪除組件
@?/olap/admin/catnoamd.sql
@?/olap/admin/olapidrp.plb
@?/olap/admin/catnoxoq.sql
@?/olap/admin/catnoaps.sql
@?/olap/admin/cwm2drop.sql —此腳本在11G的版本中用,在10G是不需要的。
@?/rdbms/admin/utlrp.sql
drop public synonym OlapFactView;
drop public synonym OlapDimView;
drop public synonym DBMS_ODM;
關閉數據庫
7.2 添加OLAP組件
利用DBCA工具。
因爲恢復的實例在DBCA中是看不到的,所以要做一些修改,修改如下:
devdb:/home/oracle/oracle/product/10.2.0/db_1:N

然後在圖形化下啓動DBCA, 選擇 configure database option——–next——–next———-選擇OLAP(SYSAUX) —-next ——finish

待重建完畢後,可再次查看無效對象:
select count(*) from all_objects where status=’INVALID’;

COUNT(*)
———-
1
此處的一個無效對像並不影響數據庫的完整功能。 遷移完畢。


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