將oracle資料庫從32位平台遷移到64位,oracle32位

來源:互聯網
上載者:User

將oracle資料庫從32位平台遷移到64位,oracle32位

客戶的32位oracle資料庫系統磁碟出現損壞,慶幸的是oracle資料庫完好無損。客戶要求將資料庫遷移到新購的裝置上,新裝置記憶體為64G,系統REDHAT 6.2 64位,直接拷貝資料檔案肯定是不行的,因為oracle 的預存程序在32位和64位平台下的wordsize不同,雖然使用者的預存程序可以在使用時自行完成重新編譯,但oracle的系統預存程序確需要我們來手工轉換。

總結,遷移過程如下:

1:備份oracle資料庫

2:備份控制檔案到trace(以備需要建立控制檔案)

SQL> alter database backup controlfile to trace;Database altered.SQL> oradebug setmypidStatement processed.SQL> oradebug tracefile_name/u01/app/admin/easy/udump/easy_ora_18830.trcSQL> host cat /u01/app/admin/easy/udump/easy_ora_18830.trc......----     Set #1. NORESETLOGS case---- The following commands will create a new control file and use it-- to open the database.-- Data used by Recovery Manager will be lost.-- Additional logs may be required for media recovery of offline-- Use this only if the current versions of all online logs are-- available.-- After mounting the created controlfile, the following SQL-- statement will place the database in the appropriate-- protection mode:--  ALTER DATABASE SET STANDBY DATABASE TO MAXIMIZE PERFORMANCESTARTUP NOMOUNTCREATE CONTROLFILE REUSE DATABASE "EASY" NORESETLOGS  NOARCHIVELOG    MAXLOGFILES 16    MAXLOGMEMBERS 3    MAXDATAFILES 100    MAXINSTANCES 8    MAXLOGHISTORY 292LOGFILE  GROUP 1 '/oradata/easy/redo01.log'  SIZE 11200K,  GROUP 2 '/oradata/easy/redo02.log'  SIZE 11200K-- STANDBY LOGFILEDATAFILE  '/oradata/easy/system01.dbf',  '/oradata/easy/undotbs01.dbf',  '/oradata/easy/sysaux01.dbf',  '/oradata/easy/users01.dbf'CHARACTER SET ZHS16GBK;-- Commands to re-create incarnation table-- Below log names MUST be changed to existing filenames on-- disk. Any one log file from each branch can be used to-- re-create incarnation records.-- ALTER DATABASE REGISTER LOGFILE '/u01/app/flash_recovery_area/EASY/archivelog/2014_11_05/o1_mf_1_1_%u_.arc';-- ALTER DATABASE REGISTER LOGFILE '/u01/app/flash_recovery_area/EASY/archivelog/2014_11_05/o1_mf_1_1_%u_.arc';-- Recovery is required if any of the datafiles are restored backups,-- or if the last shutdown was not normal or immediate.RECOVER DATABASE-- Database can now be opened normally.ALTER DATABASE OPEN;-- Commands to add tempfiles to temporary tablespaces.-- Online tempfiles have complete space information.-- Other tempfiles may require adjustment.ALTER TABLESPACE TEMP ADD TEMPFILE '/oradata/easy/temp01.dbf'     SIZE 20971520  REUSE AUTOEXTEND ON NEXT 655360  MAXSIZE 32767M;-- End of tempfile additions.----     Set #2. RESETLOGS case---- The following commands will create a new control file and use it-- to open the database.-- Data used by Recovery Manager will be lost.-- The contents of online logs will be lost and all backups will-- be invalidated. Use this only if online logs are damaged.-- After mounting the created controlfile, the following SQL-- statement will place the database in the appropriate-- protection mode:--  ALTER DATABASE SET STANDBY DATABASE TO MAXIMIZE PERFORMANCESTARTUP NOMOUNTCREATE CONTROLFILE REUSE DATABASE "EASY" RESETLOGS  NOARCHIVELOG    MAXLOGFILES 16    MAXLOGMEMBERS 3    MAXDATAFILES 100    MAXINSTANCES 8    MAXLOGHISTORY 292LOGFILE  GROUP 1 '/oradata/easy/redo01.log'  SIZE 11200K,  GROUP 2 '/oradata/easy/redo02.log'  SIZE 11200K-- STANDBY LOGFILEDATAFILE  '/oradata/easy/system01.dbf',  '/oradata/easy/undotbs01.dbf',  '/oradata/easy/sysaux01.dbf',  '/oradata/easy/users01.dbf'CHARACTER SET ZHS16GBK;-- Commands to re-create incarnation table-- Below log names MUST be changed to existing filenames on-- disk. Any one log file from each branch can be used to-- re-create incarnation records.-- ALTER DATABASE REGISTER LOGFILE '/u01/app/flash_recovery_area/EASY/archivelog/2014_11_05/o1_mf_1_1_%u_.arc';-- ALTER DATABASE REGISTER LOGFILE '/u01/app/flash_recovery_area/EASY/archivelog/2014_11_05/o1_mf_1_1_%u_.arc';-- Recovery is required if any of the datafiles are restored backups,-- or if the last shutdown was not normal or immediate.RECOVER DATABASE USING BACKUP CONTROLFILE-- Database can now be opened zeroing the online logs.ALTER DATABASE OPEN RESETLOGS;-- Commands to add tempfiles to temporary tablespaces.-- Online tempfiles have complete space information.-- Other tempfiles may require adjustment.ALTER TABLESPACE TEMP ADD TEMPFILE '/oradata/easy/temp01.dbf'     SIZE 20971520  REUSE AUTOEXTEND ON NEXT 655360  MAXSIZE 32767M;-- End of tempfile additions.--

3: 查看當前的資料庫狀態

SQL> select count(*) from dba_objects where status ='INVALID';  COUNT(*)---------- 0SQL> select comp_name,status from dba_registry;COMP_NAME STATUS---------------------------------------- ----------------------Oracle Database Catalog Views VALIDOracle Database Packages and Types VALIDOracle Workspace Manager VALIDJServer JAVA Virtual Machine VALIDOracle XDK VALIDOracle Database Java Packages VALIDOracle Expression Filter VALIDOracle Data Mining VALIDOracle Text VALIDOracle XML Database VALIDOracle Rules Manager VALIDCOMP_NAME STATUS---------------------------------------- ----------------------Oracle interMedia VALIDOLAP Analytic Workspace  VALIDOracle OLAP API  VALIDOLAP Catalog VALIDSpatial  VALIDOracle Enterprise Manager VALID17 rows selected.

        4:拷貝參數檔案,控制檔案,資料檔案,記錄檔到64位元據庫

        5:在64位系統上建立相應目錄,如udmp  adump等,要和32位系統一致

        6:如果資料庫的資料檔案目錄發生變化,則需要建立控制檔案,(最好保持源庫和目標庫的一致,減少工作量和錯誤發生率)

        7:將資料庫中的預存程序等置為失效,UTLIRP指令碼會將預存程序等置為失效

<span style="white-space:pre"></span>--如果遷移的是oracle9i的資料庫,執行如下命令:SQL> STARTUP MIGRATE  --如果是Oracle10g或11g,執行如下命令:SQL> STARTUP UPGRADE SQL> SPOOL EASY.log;SQL> @$ORACLE_HOME/rdbms/admin/utlirp.sql SQL> SPOOL OFF;   

8: 重新啟動資料庫,

9: 如果資料庫有OLAP組件,則刪除OLAP,以sys使用者執行如下指令碼

SQL> conn / as sysdba----> Remove OLAP CatalogSQL> @?/olap/admin/catnoamd.sql----> Remove OLAP APISQL> @?/olap/admin/olapidrp.plbSQL> @?/olap/admin/catnoxoq.sql----> Deinstall APS - OLAP AW componentSQL> @?/olap/admin/catnoaps.sqlSQL> @?/olap/admin/cwm2drop.sql   ---只需要在11g中執行。在10g中,catnoamd.sql 指令碼中已經包含了該指令碼,所以不用執行You could getsome invalid objects under SYS and PUBLIC owner, and they are the old duplicate OLAPSYS objects copied under these schemas when Olap has been installedpreviously.Generally, theOlap objects are named with context like %OLAP%, %AWM%, or other Olap word keys intheir "object_name" field, however, if it needs a help to recognizethem, then please contact Oracle  Support and create a Service Request toget assistance for this question. Note that catnoadm.sql could fail from 10.1.0.5 to 11.1.0.7release.  Due to the factthat it refers to three scripts which don't get shipped until 11.2 this scriptwill fail.Besides that itwill error on 7 non-existing synonyms to drop.Prior 11.2, execute these three dropsynonym statements:SQL> drop public synonym OlapFactView;SQL> drop public synonym OlapDimView;SQL> drop public synonym DBMS_ODM;

10:編譯失效對象

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

此時會有錯誤,這是因為olap沒有安裝,下面安裝olap,然後重新編譯

11:添加OLAP

SQL> @?/olap/admin/olap.sql SYSAUX TEMP;
<pre name="code" class="sql">SQL> @?/rdbms/admin/utlrp.sql    --這次會非常快


12.  驗證無效對象和組件狀態

SQL> l  1* select count(*) from dba_objects where status<>'VALID'SQL> col comp_name for a40SQL> select comp_name,status from dba_registry;COMP_NAME STATUS---------------------------------------- ----------------------Oracle Database Catalog Views VALIDOracle Database Packages and Types VALIDOracle Workspace Manager VALIDJServer JAVA Virtual Machine VALIDOracle XDK VALIDOracle Database Java Packages VALIDOracle Expression Filter VALIDOracle Data Mining VALIDOracle Text VALIDOracle XML Database VALIDOracle Rules Manager VALIDCOMP_NAME STATUS---------------------------------------- ----------------------Oracle interMedia VALIDOLAP Analytic Workspace  VALIDOracle OLAP API  VALIDOLAP Catalog VALIDSpatial  VALIDOracle Enterprise Manager VALID

11:重新編譯java對象

<pre name="code" class="sql">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             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/

It may be necessary to recompilethe Java objects with ncomp:i.e.   % ncomp-user scott/tiger Hello.class


遷移過程中,最好不要有ddl操作,以免造成死結



64位oracle資料庫遷移到32位oracle上,不知道行不行,方法?

想將64位的Oracle轉到32位的Oracle,只有使用EXP在伺服器上匯出資料,然後在32位系統上執行IMP匯入,才能實現遷移。其他方法無法實現。
遷移過程注意版本需要一致,且留意新系統的儲存和記憶體的配置,避免在大資料匯入處理程序中的異常,詳細可參考匯出匯入的相關文檔。
 
ORACLE系統是64位的,怎匯出資料庫是32位的

用EXP/IMP是可以做到的。

在export/import Untilty中是不分BIT的
 

相關文章

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.