跨平臺傳輸數據庫
RMAN的convert database命令被用來將整個數據庫從一個平臺移動到另外一個平臺。當源平臺與目標平臺字節序相同時,RMAN會在目標平臺自動完成建立新數據庫的大部分操做。當跨平臺傳輸數據庫時convertdatabase命令的處理過程將會很長。與傳輸表空間同樣,RMAN的convert database命令能夠在源平臺或目標平臺執行。node
當跨平臺傳輸數據庫時文件會自動被傳輸到目標平臺,這些文件包括:
1.屬於永久表空間的數據文件,注意,無論源平臺與目標平吧的字節序是否相同,傳輸數據庫的數據文件必需要進行轉換不能簡單的從一個平臺複製到另外一個平臺。與跨平臺傳輸表空間不同,傳輸整個數據庫要求特定類型的數據塊,好比undo段,要被從新格式化確保與目標平臺兼容sql
2.若是使用PFILE,PFILE文件會被傳輸。若是使用SPFILE,會基於SPFILE生成PFILE並將其傳輸,並在目標平基於PFILE來生成新的SPFILE。注意,在大多數狀況下,PFILE文件中的有些參數對於新數據庫須要手動修改。例如db_name,control_files數據庫
跨平臺傳輸數據庫的限制
跨平臺傳輸數據庫的主要限制是源平臺與目標平臺必須有相同的字節序。例如,當將數據庫從Windows平臺傳輸到Linux平臺(都是小字節序)或者從HP-UX到AIX(都是大字節序),不能將整個數據庫從HP-UX傳輸到Linux平臺上。然而,能夠在目標平臺上建立一個新數據庫,並使用表空間傳輸功能將須要的表空間從源數據庫中使用跨平臺與跨字節序傳輸到目標數據庫中。bootstrap
在源平臺執行轉換
將32位windows平臺上的數據庫jingyong(10.2.0.1)遷移到32位的Linux平臺上(10.2.0.5)。在源平臺上執行RMAN的convert database操做的步驟以下:
1.將源數據庫以只讀模式打開windows
C:\Users\Administrator>sqlplus / as sysdba SQL*Plus: Release 10.2.0.1.0 - Production on 星期二 3月 31 15:08:36 2015 Copyright (c) 1982, 2005, Oracle. All rights reserved. 鏈接到: Oracle Database 10g Enterprise Edition Release 10.2.0.1.0 - Production With the Partitioning, OLAP and Data Mining options SQL> shutdown immediate 數據庫已經關閉。 已經卸載數據庫。 ORACLE 例程已經關閉。 SQL> startup mount ORACLE 例程已經啓動。 Total System Global Area 419430400 bytes Fixed Size 1249320 bytes Variable Size 125833176 bytes Database Buffers 285212672 bytes Redo Buffers 7135232 bytes 數據庫裝載完畢。 SQL> alter database open read only; 數據庫已更改。
2.對源數據庫執行dbms_tdb.check_db檢查oracle
SQL> set serveroutput on SQL> declare 2 db_ready boolean; 3 begin 4 db_ready :=dbms_tdb.check_db('Linux IA (32-bit)',dbms_tdb.skip_readonly); 5 end; 6 / PL/SQL procedure successfully completed
3.對源數據庫執行dbms_tdb.check_external來識別外部對象app
SQL> set serveroutput on; SQL> declare 2 external boolean; 3 begin 4 external:=dbms_tdb.check_external; 5 end; 6 / The following external tables exist in the database: SH.SALES_TRANSACTIONS_EXT The following directories exist in the database: SYS.TEST_DUMP, SYS.SUBDIR, SYS.XMLDIR, SYS.MEDIA_DIR, SYS.LOG_FILE_DIR, SYS.DATA_FILE_DIR, SYS.WORK_DIR, SYS.ADMIN_DIR, SYS.DATA_PUMP_DIR The following BFILEs exist in the database: PM.PRINT_MEDIA PL/SQL procedure successfully completed
4.執行convert database命令,指定目標平臺和輸出文件名稱。RMAN會生成須要移動到目標平臺上的文件,包含如下文件:
--數據庫完整的數據文件副本
--在目標平臺使用的新的PFILE參數文件,包含來自源數據庫PFILE或SPFILE中的設置。在目標平臺使用以前須要進行相應修改
--傳輸腳本,包含在目標平臺建立新數據庫的SQL語句ide
RMAN> convert database new database 'jingyong' 2> transport script 'E:\oradata\transport\transport_db_script.sql' 3> to platform 'Linux IA (32-bit)' 4> db_file_name_convert('E:\oradata\JINGYONG\DATAFILE', 'E:\oradata\transport',' E:\oradata\JINGYONG', 'E:\oradata\transport'); 啓動 convert 於 31-3月 -15 使用目標數據庫控制文件替代恢復目錄 分配的通道: ORA_DISK_1 通道 ORA_DISK_1: sid=152 devtype=DISK 在數據庫中找到外部表 SH.SALES_TRANSACTIONS_EXT 在數據庫中找到目錄 SYS.TEST_DUMP 在數據庫中找到目錄 SYS.SUBDIR 在數據庫中找到目錄 SYS.XMLDIR 在數據庫中找到目錄 SYS.MEDIA_DIR 在數據庫中找到目錄 SYS.LOG_FILE_DIR 在數據庫中找到目錄 SYS.DATA_FILE_DIR 在數據庫中找到目錄 SYS.WORK_DIR 在數據庫中找到目錄 SYS.ADMIN_DIR 在數據庫中找到目錄 SYS.DATA_PUMP_DIR 在數據庫中找到 BFILE PM.PRINT_MEDIA 在口令文件中找到用戶 SYS (具備 SYSDBA and SYSOPER 權限) 通道 ORA_DISK_1: 啓動數據文件轉換 輸入數據文件 fno=00001 name=E:\ORADATA\JINGYONG\DATAFILE\O1_MF_SYSTEM_BKLLOT8Z_. DBF 已轉換的數據文件 = E:\ORADATA\TRANSPORT\O1_MF_SYSTEM_BKLLOT8Z_.DBF 通道 ORA_DISK_1: 數據文件轉換完畢, 通過時間: 00:00:25 通道 ORA_DISK_1: 啓動數據文件轉換 輸入數據文件 fno=00003 name=E:\ORADATA\JINGYONG\DATAFILE\O1_MF_SYSAUX_BKLLOTFL_. DBF 已轉換的數據文件 = E:\ORADATA\TRANSPORT\O1_MF_SYSAUX_BKLLOTFL_.DBF 通道 ORA_DISK_1: 數據文件轉換完畢, 通過時間: 00:00:16 通道 ORA_DISK_1: 啓動數據文件轉換 輸入數據文件 fno=00005 name=E:\ORADATA\JINGYONG\DATAFILE\O1_MF_EXAMPLE_BKLLRKG2_ .DBF 已轉換的數據文件 = E:\ORADATA\TRANSPORT\O1_MF_EXAMPLE_BKLLRKG2_.DBF 通道 ORA_DISK_1: 數據文件轉換完畢, 通過時間: 00:00:07 通道 ORA_DISK_1: 啓動數據文件轉換 輸入數據文件 fno=00006 name=E:\ORADATA\JINGYONG\TSPITR01.DBF 已轉換的數據文件 = E:\ORADATA\TRANSPORT\TSPITR01.DBF 通道 ORA_DISK_1: 數據文件轉換完畢, 通過時間: 00:00:03 通道 ORA_DISK_1: 啓動數據文件轉換 輸入數據文件 fno=00007 name=E:\ORADATA\JINGYONG\TEST01.DBF 已轉換的數據文件 = E:\ORADATA\TRANSPORT\TEST01.DBF 通道 ORA_DISK_1: 數據文件轉換完畢, 通過時間: 00:00:03 通道 ORA_DISK_1: 啓動數據文件轉換 輸入數據文件 fno=00002 name=E:\ORADATA\JINGYONG\DATAFILE\O1_MF_UNDOTBS1_BKLLOTM0 _.DBF 已轉換的數據文件 = E:\ORADATA\TRANSPORT\O1_MF_UNDOTBS1_BKLLOTM0_.DBF 通道 ORA_DISK_1: 數據文件轉換完畢, 通過時間: 00:00:03 通道 ORA_DISK_1: 啓動數據文件轉換 輸入數據文件 fno=00004 name=E:\ORADATA\JINGYONG\DATAFILE\O1_MF_USERS_BKLLOTM6_.D BF 已轉換的數據文件 = E:\ORADATA\TRANSPORT\O1_MF_USERS_BKLLOTM6_.DBF 通道 ORA_DISK_1: 數據文件轉換完畢, 通過時間: 00:00:01 在目標平臺上運行 SQL 腳本 E:\ORADATA\TRANSPORT\TRANSPORT_DB_SCRIPT.SQL 以建立數 據庫 編輯 init.ora 文件 D:\ORACLE\PRODUCT\10.2.0\DB_1\DATABASE\INIT_00Q37GUS_1_0.ORA 。此 PFILE 將用於在目標平臺上建立數據庫據 要從新編譯全部 PL/SQL 模塊, 請在目標平臺上運行 utlirp.sql 和 utlrp.sql 要更改內部數據庫標識符, 請使用 DBNEWID 實用程序 完成 backup 於 31-3月 -15
5.將轉換操做生成的全部文件傳輸到目標主機上存儲數據庫文件的目錄中當convert database執行完成後,源數據庫能夠以讀寫模式打開,生成的全部文件都要被傳輸到目標主機上。ui
ftp> put INIT_00Q37GUS_1_0.ORA 200 PORT command successful. Consider using PASV. 150 Ok to send data. 226 File receive OK. ftp: 發送 1415 字節,用時 0.00秒 1415.00千字節/秒。 ftp> put O1_MF_EXAMPLE_BKLLRKG2_.DBF 200 PORT command successful. Consider using PASV. 150 Ok to send data. 226 File receive OK. ftp: 發送 104865792 字節,用時 8.57秒 12233.53千字節/秒。 ftp> put O1_MF_SYSTEM_BKLLOT8Z_.DBF 200 PORT command successful. Consider using PASV. 150 Ok to send data. 226 File receive OK. ftp: 發送 503324672 字節,用時 49.54秒 10160.38千字節/秒。 ftp> put TSPITR01.DBF 200 PORT command successful. Consider using PASV. 150 Ok to send data. 226 File receive OK. ftp: 發送 52436992 字節,用時 4.46秒 11762.45千字節/秒。 ftp> put TEST01.DBF 200 PORT command successful. Consider using PASV. 150 Ok to send data. 226 File receive OK. ftp: 發送 52436992 字節,用時 3.48秒 15050.80千字節/秒。 ftp> put O1_MF_UNDOTBS1_BKLLOTM0_.DBF 200 PORT command successful. Consider using PASV. 150 Ok to send data. 226 File receive OK. ftp: 發送 31465472 字節,用時 2.05秒 15341.53千字節/秒。 ftp> put O1_MF_USERS_BKLLOTM6_.DBF 200 PORT command successful. Consider using PASV. 150 Ok to send data. 226 File receive OK. ftp: 發送 5251072 字節,用時 0.20秒 26520.57千字節/秒。 ftp> put TRANSPORT_DB_SCRIPT.SQL 200 PORT command successful. Consider using PASV. 150 Ok to send data. 226 File receive OK. ftp: 發送 2582 字節,用時 0.00秒 2582000.00千字節/秒。 ftp> put O1_MF_SYSAUX_BKLLOTFL_.DBF 200 PORT command successful. Consider using PASV. 150 Ok to send data. 226 File receive OK. ftp: 發送 251666432 字節,用時 19.63秒 12817.89千字節/秒。 [oracle@oracle11g jingyong]$ ls -lrt total 978976 -rwxrwxrwx 1 oracle oinstall 1415 Mar 31 16:18 INIT_00Q37GUS_1_0.ORA -rwxrwxrwx 1 oracle oinstall 104865792 Mar 31 16:18 O1_MF_EXAMPLE_BKLLRKG2_.DBF -rwxrwxrwx 1 oracle oinstall 503324672 Mar 31 16:20 O1_MF_SYSTEM_BKLLOT8Z_.DBF -rwxrwxrwx 1 oracle oinstall 52436992 Mar 31 16:21 TSPITR01.DBF -rwxrwxrwx 1 oracle oinstall 52436992 Mar 31 16:21 TEST01.DBF -rwxrwxrwx 1 oracle oinstall 31465472 Mar 31 16:22 O1_MF_UNDOTBS1_BKLLOTM0_.DBF -rwxrwxrwx 1 oracle oinstall 5251072 Mar 31 16:22 O1_MF_USERS_BKLLOTM6_.DBF -rwxrwxrwx 1 oracle oinstall 2582 Mar 31 16:23 TRANSPORT_DB_SCRIPT.SQL -rwxrwxrwx 1 oracle oinstall 251666432 Mar 31 16:24 O1_MF_SYSAUX_BKLLOTFL_.DBF
6.在目標主機上建立數據庫須要的目錄,並修改PFILE參數文件中的相關參數,並修改傳輸腳本中指示數據文件的位置。this
建立相關目錄
[oracle@oracle11g dbs]$ mkdir -p /u01/app/oracle/admin/jingyong/adump [oracle@oracle11g dbs]$ mkdir -p /u01/app/oracle/admin/jingyong/bdump [oracle@oracle11g dbs]$ mkdir -p /u01/app/oracle/admin/jingyong/cdump [oracle@oracle11g dbs]$ mkdir -p /u01/app/oracle/admin/jingyong/udump [oracle@oracle11g dbs]$ chmod -R 777 /u01/app/oracle/admin/jingyong*
修改PFILE參數文件
[oracle@oracle11g jingyong]$ vi initjingyong.ora # Please change the values of the following parameters: audit_file_dest = '/u01/app/oracle/admin/jingyong/adump' background_dump_dest = '/u01/app/oracle/admin/jingyong/bdump' user_dump_dest = '/u01/app/oracle/admin/jingyong/udump' core_dump_dest = '/u01/app/oracle/admin/jingyong/udump' db_name = "JINGYONG" control_files='/u01/app/oracle/oradata/test/control01.ctl' # Please review the values of the following parameters: dispatchers = "(PROTOCOL=TCP) (SERVICE=jingyongXDB)" # The values of the following parameters are from source database: processes = 150 nls_language = "SIMPLIFIED CHINESE" nls_territory = "CHINA" sga_target = 130M db_block_size = 8192 compatible = "10.2.0.1.0" db_file_multiblock_read_count= 16 undo_management = "AUTO" undo_tablespace = "UNDOTBS1" job_queue_processes = 10 open_cursors = 300 pga_aggregate_target = 32M
修改convert database命令生成的傳輸腳本
[oracle@oracle11g jingyong]$ vi TRANSPORT_DB_SCRIPT.SQL -- 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 PERFORMANCE STARTUP NOMOUNT PFILE='/u01/app/oracle/10.2.0/db/dbs/initjingyong.ora' -- Create SPFILE CREATE SPFILE FROM PFILE = '/u01/app/oracle/10.2.0/db/dbs/initjingyong.ora'; STARTUP FORCE NOMOUNT CREATE CONTROLFILE REUSE SET DATABASE "JINGYONG" RESETLOGS NOARCHIVELOG MAXLOGFILES 16 MAXLOGMEMBERS 3 MAXDATAFILES 100 MAXINSTANCES 8 MAXLOGHISTORY 292 LOGFILE GROUP 1 '/u02/jingyong/redo01.log' SIZE 50M, GROUP 2 '/u02/jingyong/redo02.log' SIZE 50M, GROUP 3 '/u02/jingyong/redo03.log' SIZE 50M DATAFILE '/u02/jingyong/O1_MF_SYSTEM_BKLLOT8Z_.DBF', '/u02/jingyong/O1_MF_UNDOTBS1_BKLLOTM0_.DBF', '/u02/jingyong/O1_MF_SYSAUX_BKLLOTFL_.DBF', '/u02/jingyong/O1_MF_USERS_BKLLOTM6_.DBF', '/u02/jingyong/O1_MF_EXAMPLE_BKLLRKG2_.DBF', '/u02/jingyong/TSPITR01.DBF', '/u02/jingyong/TEST01.DBF' CHARACTER SET ZHS16GBK ; -- 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 '/u02/jingyong/temp01.dbf' SIZE 50M AUTOEXTEND OFF; -- End of tempfile additions. -- set echo off prompt ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ prompt * Your database has been created successfully! prompt * There are many things to think about for the new database. Here prompt * is a checklist to help you stay on track: prompt * 1. You may want to redefine the location of the directory objects. prompt * 2. You may want to change the internal database identifier (DBID) prompt * or the global database name for this database. Use the prompt * NEWDBID Utility (nid). prompt ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ SHUTDOWN IMMEDIATE STARTUP UPGRADE @@ ?/rdbms/admin/utlirp.sql SHUTDOWN IMMEDIATE STARTUP -- The following step will recompile all PL/SQL modules. -- It may take serveral hours to complete. @@ ?/rdbms/admin/utlrp.sql
7.使用SQL*Plus來執行傳輸腳本中的內容在目標主機上建立新的數據庫
[oracle@oracle11g jingyong]$ sqlplus / as sysdba SQL*Plus: Release 10.2.0.5.0 - Production on Tue Mar 31 18:11:36 2015 Copyright (c) 1982, 2010, Oracle. All Rights Reserved. Connected to an idle instance. SQL> STARTUP NOMOUNT PFILE='/u01/app/oracle/10.2.0/db/dbs/initjingyong.ora' ORACLE instance started. Total System Global Area 138412032 bytes Fixed Size 1272432 bytes Variable Size 62915984 bytes Database Buffers 71303168 bytes Redo Buffers 2920448 bytes SQL> CREATE CONTROLFILE REUSE SET DATABASE "JINGYONG" RESETLOGS NOARCHIVELOG 2 MAXLOGFILES 16 3 MAXLOGMEMBERS 3 4 MAXDATAFILES 100 5 MAXINSTANCES 8 6 MAXLOGHISTORY 292 7 LOGFILE 8 GROUP 1 '/u02/jingyong/redo01.log' SIZE 50M, 9 GROUP 2 '/u02/jingyong/redo02.log' SIZE 50M, 10 GROUP 3 '/u02/jingyong/redo03.log' SIZE 50M 11 DATAFILE 12 '/u02/jingyong/O1_MF_SYSTEM_BKLLOT8Z_.DBF', 13 '/u02/jingyong/O1_MF_UNDOTBS1_BKLLOTM0_.DBF', 14 '/u02/jingyong/O1_MF_SYSAUX_BKLLOTFL_.DBF', 15 '/u02/jingyong/O1_MF_USERS_BKLLOTM6_.DBF', 16 '/u02/jingyong/O1_MF_EXAMPLE_BKLLRKG2_.DBF', 17 '/u02/jingyong/TSPITR01.DBF', 18 '/u02/jingyong/TEST01.DBF' 19 CHARACTER SET ZHS16GBK 20 ; Control file created. SQL> ALTER DATABASE OPEN RESETLOGS; ALTER DATABASE OPEN RESETLOGS * ERROR at line 1: ORA-01092: ORACLE instance terminated. Disconnection forced
在以open resetlogs方式打開數據庫是出錯了,alert.log中的錯誤信息以下所示:
Errors in file /u01/app/oracle/admin/jingyong/udump/jingyong_ora_5406.trc: ORA-00704: bootstrap process failure ORA-39700: database must be opened with UPGRADE option Error 704 happened during db open, shutting down database USER: terminating instance due to error 704 Instance terminated by USER, pid = 5406 ORA-1092 signalled during: alter database open...
錯誤信息指示須要以升級模式來啓動數據庫,由於遷移過來的源數據庫的版本是10.2.0.1,而目標主機上的數據庫版本是10.2.0.5。
以升級模式啓動數據庫
[oracle@oracle11g jingyong]$ sqlplus / as sysdba SQL*Plus: Release 10.2.0.5.0 - Production on Tue Mar 31 18:11:36 2015 Copyright (c) 1982, 2010, Oracle. All Rights Reserved. Connected to an idle instance. SQL> startup upgrade; ORACLE instance started. Total System Global Area 138412032 bytes Fixed Size 1272432 bytes Variable Size 62915984 bytes Database Buffers 71303168 bytes Redo Buffers 2920448 bytes Database mounted. ORA-01113: file 1 needs media recovery if it was restored from backup, or END BACKUP if it was not ORA-01110: data file 1: '/u02/jingyong/O1_MF_SYSTEM_BKLLOT8Z_.DBF'
執行恢復並關閉數據庫
SQL> recover database; Media recovery complete. SQL> shutdown immediate; ORA-01109: database not open Database dismounted. ORACLE instance shut down.
再次以升級模式啓動數據庫
SQL> startup upgrade; ORACLE instance started. Total System Global Area 138412032 bytes Fixed Size 1272432 bytes Variable Size 62915984 bytes Database Buffers 71303168 bytes Redo Buffers 2920448 bytes Database mounted. Database opened.
建立臨時表空間
SQL> ALTER TABLESPACE TEMP ADD TEMPFILE '/u02/jingyong/temp01.dbf' 2 SIZE 50M AUTOEXTEND OFF;
SQL>@$ORACLE_HOME//rdbms/admin/utlirp.sql 省略... SQL> SQL> Rem Continue even if there are SQL errors SQL> WHENEVER SQLERROR CONTINUE; SQL> SQL> Rem =========================================================================== SQL> Rem END utlip.sql SQL> Rem =========================================================================== SQL> SQL> DOC DOC>####################################################################### DOC>####################################################################### DOC> utlirp.sql completed successfully. All PL/SQL objects in the DOC> database have been invalidated. DOC> DOC> Shut down and restart the database in normal mode and run utlrp.sql to DOC> recompile invalid objects. DOC>####################################################################### DOC>####################################################################### DOC>#
上面的輸出信息說在以正常模式重啓數據庫後執行utlrp.sql腳原本編譯無效對象。因爲這裏源數據庫是10.2.0.1,而目標主機數據庫的版本是10.2.0.5,在重啓數據庫仍然須要以升級模式來啓動並執行utlrp.sql腳本
SQL> shutdown immediate Database closed. Database dismounted. ORACLE instance shut down. SQL> startup upgrade ORACLE instance started. Total System Global Area 138412032 bytes Fixed Size 1272432 bytes Variable Size 62915984 bytes Database Buffers 71303168 bytes Redo Buffers 2920448 bytes Database mounted. Database opened. SQL> @$ORACLE_HOME/rdbms/admin/utlrp.sql SQL> Rem =========================================================================== SQL> Rem BEGIN utlrp.sql SQL> Rem =========================================================================== 省略... PL/SQL procedure successfully completed. SQL> SET serveroutput off SQL> SQL> SQL> Rem =========================================================================== SQL> Rem END utlrp.sql SQL> Rem ===========================================================================
執行和數據庫升級相關的腳本catupgrade.sql
SQL> @$ORACLE_HOME/rdbms/admin/catupgrd.sql 省略... COMP_TIMESTAMP UPGRD_END 2015-03-31 20:42:53 . Oracle Database 10.2 Upgrade Status Utility 03-31-2015 20:42:54 . Component Status Version HH:MM:SS Oracle Database Server VALID 10.2.0.5.0 00:18:20 JServer JAVA Virtual Machine VALID 10.2.0.5.0 00:05:21 Oracle XDK VALID 10.2.0.5.0 00:00:49 Oracle Database Java Packages VALID 10.2.0.5.0 00:00:37 Oracle Text VALID 10.2.0.5.0 00:01:02 Oracle XML Database VALID 10.2.0.5.0 00:02:47 Oracle Workspace Manager VALID 10.2.0.5.0 00:01:39 Oracle Data Mining VALID 10.2.0.5.0 00:00:39 OLAP Analytic Workspace VALID 10.2.0.5.0 00:00:52 OLAP Catalog VALID 10.2.0.5.0 00:01:24 Oracle OLAP API VALID 10.2.0.5.0 00:01:08 Oracle interMedia VALID 10.2.0.5.0 00:05:22 Spatial VALID 10.2.0.5.0 00:07:20 Oracle Expression Filter VALID 10.2.0.5.0 00:00:26 Oracle Enterprise Manager VALID 10.2.0.5.0 00:02:56 Oracle Rule Manager VALID 10.2.0.5.0 00:00:27 . Total Upgrade Time: 00:53:45 DOC>####################################################################### DOC>####################################################################### DOC> DOC> The above PL/SQL lists the SERVER components in the upgraded DOC> database, along with their current version and status. DOC> DOC> Please review the status and version columns and look for DOC> any errors in the spool log file. If there are errors in the spool DOC> file, or any components are not VALID or not the current version, DOC> consult the Oracle Database Upgrade Guide for troubleshooting DOC> recommendations. DOC> DOC> Next shutdown immediate, restart for normal operation, and then DOC> run utlrp.sql to recompile any invalid application objects. DOC> DOC>####################################################################### DOC>#######################################################################
再次運行utlrp.sql腳原本進行編譯無效對象
SQL> @$ORACLE_HOME/rdbms/admin/utlrp.sql TIMESTAMP -------------------------------------------------------------------------------- COMP_TIMESTAMP UTLRP_BGN 2015-03-31 20:50:46 DOC> The following PL/SQL block invokes UTL_RECOMP to recompile invalid DOC> objects in the database. Recompilation time is proportional to the DOC> number of invalid objects in the database, so this command may take DOC> a long time to execute on a database with a large number of invalid DOC> objects. DOC> DOC> Use the following queries to track recompilation progress: DOC> DOC> 1. Query returning the number of invalid objects remaining. This DOC> number should decrease with time. DOC> SELECT COUNT(*) FROM obj$ WHERE status IN (4, 5, 6); DOC> DOC> 2. Query returning the number of objects compiled so far. This number DOC> should increase with time. DOC> SELECT COUNT(*) FROM UTL_RECOMP_COMPILED; DOC> DOC> This script automatically chooses serial or parallel recompilation DOC> based on the number of CPUs available (parameter cpu_count) multiplied DOC> by the number of threads per CPU (parameter parallel_threads_per_cpu). DOC> On RAC, this number is added across all RAC nodes. DOC> DOC> UTL_RECOMP uses DBMS_SCHEDULER to create jobs for parallel DOC> recompilation. Jobs are created without instance affinity so that they DOC> can migrate across RAC nodes. Use the following queries to verify DOC> whether UTL_RECOMP jobs are being created and run correctly: DOC> DOC> 1. Query showing jobs created by UTL_RECOMP DOC> SELECT job_name FROM dba_scheduler_jobs DOC> WHERE job_name like 'UTL_RECOMP_SLAVE_%'; DOC> DOC> 2. Query showing UTL_RECOMP jobs that are running DOC> SELECT job_name FROM dba_scheduler_running_jobs DOC> WHERE job_name like 'UTL_RECOMP_SLAVE_%'; DOC># TIMESTAMP -------------------------------------------------------------------------------- COMP_TIMESTAMP UTLRP_END 2015-03-31 20:53:25 DOC> The following query reports the number of objects that have compiled DOC> with errors (objects that compile with errors have status set to 3 in DOC> obj$). If the number is higher than expected, please examine the error DOC> messages reported with each object (using SHOW ERRORS) to see if they DOC> point to system misconfiguration or resource constraints that must be DOC> fixed before attempting to recompile these objects. DOC># OBJECTS WITH ERRORS ------------------- 53 DOC> The following query reports the number of errors caught during DOC> recompilation. If this number is non-zero, please query the error DOC> messages in the table UTL_RECOMP_ERRORS to see if any of these errors DOC> are due to misconfiguration or resource constraints that must be DOC> fixed before objects can compile successfully. DOC># ERRORS DURING RECOMPILATION --------------------------- 0