RMAN同位元組序跨平臺跨版本遷移資料庫(二)
在目標平臺執行資料檔案轉換
將32位windows平臺上的資料庫jingyong(10.2.0.1)遷移到32位的Linux平臺上(10.2.0.5)在目標平臺上執行RMAN的convert database操作的步驟如下:
1.將源資料庫以只讀模式開啟
C:\Users\Administrator>sqlplus / as sysdba SQL*Plus: Release 10.2.0.1.0 - Production on 星期二 3月 31 20:30:23 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檢查
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來識別外部物件
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命令並指定on target platform引數。
C:\Users\Administrator>rman target/ 恢復管理器: Release 10.2.0.1.0 - Production on 星期二 3月 31 21:05:58 2015 Copyright (c) 1982, 2005, Oracle. All rights reserved. 連線到目標資料庫: JINGYONG (DBID=3213417256) RMAN> convert database on target platform 2> convert script 'E:\oradata\convert\convertscript.rman' 3> transport script 'E:\oradata\convert\transportscript.sql' 4> new database 'cs' 5> format 'E:\oradata\convert\%U'; 啟動 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 通道 ORA_DISK_1: 資料檔案檢查完畢, 用時: 00:00:00 通道 ORA_DISK_1: 開始檢查資料檔案 輸入資料檔案 fno=00003 name=E:\ORADATA\JINGYONG\DATAFILE\O1_MF_SYSAUX_BKLLOTFL_. DBF 通道 ORA_DISK_1: 資料檔案檢查完畢, 用時: 00:00:01 通道 ORA_DISK_1: 開始檢查資料檔案 輸入資料檔案 fno=00005 name=E:\ORADATA\JINGYONG\DATAFILE\O1_MF_EXAMPLE_BKLLRKG2_ .DBF 通道 ORA_DISK_1: 資料檔案檢查完畢, 用時: 00:00:00 通道 ORA_DISK_1: 開始檢查資料檔案 輸入資料檔案 fno=00006 name=E:\ORADATA\JINGYONG\TSPITR01.DBF 通道 ORA_DISK_1: 資料檔案檢查完畢, 用時: 00:00:00 通道 ORA_DISK_1: 開始檢查資料檔案 輸入資料檔案 fno=00007 name=E:\ORADATA\JINGYONG\TEST01.DBF 通道 ORA_DISK_1: 資料檔案檢查完畢, 用時: 00:00:00 通道 ORA_DISK_1: 開始檢查資料檔案 輸入資料檔案 fno=00002 name=E:\ORADATA\JINGYONG\DATAFILE\O1_MF_UNDOTBS1_BKLLOTM0 _.DBF 通道 ORA_DISK_1: 資料檔案檢查完畢, 用時: 00:00:00 通道 ORA_DISK_1: 開始檢查資料檔案 輸入資料檔案 fno=00004 name=E:\ORADATA\JINGYONG\DATAFILE\O1_MF_USERS_BKLLOTM6_.D BF 通道 ORA_DISK_1: 資料檔案檢查完畢, 用時: 00:00:01 在目標平臺上執行 SQL 指令碼 E:\ORADATA\CONVERT\TRANSPORTSCRIPT.SQL 以建立資料庫 編輯 init.ora 檔案 E:\ORADATA\CONVERT\INIT_00Q3836C_1_0.ORA。此 PFILE 將用於在目 標平臺上建立資料庫據 在目標平臺上執行 RMAN 指令碼 E:\ORADATA\CONVERT\CONVERTSCRIPT.RMAN 以轉換資料檔案 要重新編譯所有 PL/SQL 模組, 請在目標平臺上執行 utlirp.sql 和 utlrp.sql 要更改內部資料庫識別符號, 請使用 DBNEWID 實用程式 完成 backup 於 31-3月 -15
與在源平臺執行convert database命令一樣,convert database on target platform會生成可以在目標平臺上建立新資料庫的傳輸指令碼和包含與源資料庫有相同引數設定的PFILE引數檔案。convert database on target platform也會生成一個包含對源資料庫每個資料檔案執行convert datafile命令的轉換指令碼。源資料庫的資料檔案必須在不被轉換的情況下傳輸到目標主機相應的目錄中,並對轉換指令碼做相應的修改,轉換指令碼內容如下:
RUN { CONVERT DATAFILE 'E:\ORADATA\JINGYONG\DATAFILE\O1_MF_SYSTEM_BKLLOT8Z_.DBF' FROM PLATFORM 'Microsoft Windows IA (32-bit)' FORMAT 'E:\ORADATA\CONVERT\DATA_D-JINGYONG_I-3213417256_TS-SYSTEM_FNO-1_08Q3836D'; CONVERT DATAFILE 'E:\ORADATA\JINGYONG\DATAFILE\O1_MF_SYSAUX_BKLLOTFL_.DBF' FROM PLATFORM 'Microsoft Windows IA (32-bit)' FORMAT 'E:\ORADATA\CONVERT\DATA_D-JINGYONG_I-3213417256_TS-SYSAUX_FNO-3_09Q3836D'; CONVERT DATAFILE 'E:\ORADATA\JINGYONG\DATAFILE\O1_MF_EXAMPLE_BKLLRKG2_.DBF' FROM PLATFORM 'Microsoft Windows IA (32-bit)' FORMAT 'E:\ORADATA\CONVERT\DATA_D-JINGYONG_I-3213417256_TS-EXAMPLE_FNO-5_0AQ3836E'; CONVERT DATAFILE 'E:\ORADATA\JINGYONG\TSPITR01.DBF' FROM PLATFORM 'Microsoft Windows IA (32-bit)' FORMAT 'E:\ORADATA\CONVERT\DATA_D-JINGYONG_I-3213417256_TS-TSPITR_FNO-6_0BQ3836E'; CONVERT DATAFILE 'E:\ORADATA\JINGYONG\TEST01.DBF' FROM PLATFORM 'Microsoft Windows IA (32-bit)' FORMAT 'E:\ORADATA\CONVERT\DATA_D-JINGYONG_I-3213417256_TS-TEST_FNO-7_0CQ3836E'; CONVERT DATAFILE 'E:\ORADATA\JINGYONG\DATAFILE\O1_MF_UNDOTBS1_BKLLOTM0_.DBF' FROM PLATFORM 'Microsoft Windows IA (32-bit)' FORMAT 'E:\ORADATA\CONVERT\DATA_D-JINGYONG_I-3213417256_TS-UNDOTBS1_FNO-2_0DQ3836E'; CONVERT DATAFILE 'E:\ORADATA\JINGYONG\DATAFILE\O1_MF_USERS_BKLLOTM6_.DBF' FROM PLATFORM 'Microsoft Windows IA (32-bit)' FORMAT 'E:\ORADATA\CONVERT\DATA_D-JINGYONG_I-3213417256_TS-USERS_FNO-4_0EQ3836F'; }
5.在源資料庫為只讀狀態時將資料檔案與傳輸指令碼,轉換指令碼與PFILE引數檔案複製到目標主機對應的目錄中。
ftp> put CONVERTSCRIPT.RMAN 200 PORT command successful. Consider using PASV. 150 Ok to send data. 226 File receive OK. ftp: 傳送 1462 位元組,用時 0.00秒 1462000.00千位元組/秒。 ftp> put INIT_00Q3836C_1_0.ORA 200 PORT command successful. Consider using PASV. 150 Ok to send data. 226 File receive OK. ftp: 傳送 1309 位元組,用時 0.00秒 1309.00千位元組/秒。 ftp> TRANSPORTSCRIPT.SQL 無效命令。 ftp> put TRANSPORTSCRIPT.SQL 200 PORT command successful. Consider using PASV. 150 Ok to send data. 226 File receive OK. ftp: 傳送 2739 位元組,用時 0.00秒 2739.00千位元組/秒。 ftp> lcd E:\oradata\JINGYONG 目前的本地目錄 E:\oradata\JINGYONG。 ftp> bin 200 Switching to Binary mode. ftp> put TEST01.dbf 200 PORT command successful. Consider using PASV. 150 Ok to send data. 226 File receive OK. ftp: 傳送 52436992 位元組,用時 2.55秒 20555.47千位元組/秒。 ftp> put TSPITR01.dbf 200 PORT command successful. Consider using PASV. 150 Ok to send data. 226 File receive OK. ftp: 傳送 52436992 位元組,用時 6.71秒 7819.41千位元組/秒。 ftp> lcd E:\oradata\JINGYONG\DATAFILE 目前的本地目錄 E:\oradata\JINGYONG\DATAFILE。 ftp> bin 200 Switching to Binary mode. ftp> put O1_MF_SYSTEM_BKLLOT8Z_. O1_MF_SYSTEM_BKLLOT8Z_.: ftp> DBF 無效命令。 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 位元組,用時 12.16秒 8620.29千位元組/秒。 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 位元組,用時 25.59秒 9835.71千位元組/秒。 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 位元組,用時 60.46秒 8325.06千位元組/秒。 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 位元組,用時 6.67秒 4718.17千位元組/秒。 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.42秒 12355.46千位元組/秒。 [oracle@oracle11g cs]$ ls -lrt total 978980 -rwxrwxrwx 1 oracle oinstall 1462 Mar 31 21:22 CONVERTSCRIPT.RMAN -rwxrwxrwx 1 oracle oinstall 1309 Mar 31 21:22 INIT_00Q3836C_1_0.ORA -rwxrwxrwx 1 oracle oinstall 2739 Mar 31 21:22 TRANSPORTSCRIPT.SQL -rwxrwxrwx 1 oracle oinstall 52436992 Mar 31 21:23 TEST01.DBF -rwxrwxrwx 1 oracle oinstall 52436992 Mar 31 21:23 TSPITR01.DBF -rwxrwxrwx 1 oracle oinstall 104865792 Mar 31 21:24 O1_MF_EXAMPLE_BKLLRKG2_.DBF -rwxrwxrwx 1 oracle oinstall 251666432 Mar 31 21:25 O1_MF_SYSAUX_BKLLOTFL_.DBF -rwxrwxrwx 1 oracle oinstall 503324672 Mar 31 21:26 O1_MF_SYSTEM_BKLLOT8Z_.DBF -rwxrwxrwx 1 oracle oinstall 31465472 Mar 31 21:27 O1_MF_UNDOTBS1_BKLLOTM0_.DBF -rwxrwxrwx 1 oracle oinstall 5251072 Mar 31 21:27 O1_MF_USERS_BKLLOTM6_.DBF
6.建立新資料庫cs相關目錄,並修改PFILE引數檔案,傳輸指令碼與轉換指令碼中的相關路徑資訊,因為convert database on target platform命令並不會生成轉換後的資料檔案副本。當目標主機資料檔案儲存路徑與源資料庫資料檔案儲存路徑完全相同時,可以直接執行轉換指令碼,但這裡由於目標主機儲存資料檔案的路徑與源資料庫儲存資料檔案的路徑不相同,需要對轉換指令碼做相應修改,也需要對用來建立新資料庫的傳輸指令碼做修改。
建立相關目錄
[oracle@oracle11g dbs]$ mkdir -p /u01/app/oracle/admin/cs/adump [oracle@oracle11g dbs]$ mkdir -p /u01/app/oracle/admin/cs/bdump [oracle@oracle11g dbs]$ mkdir -p /u01/app/oracle/admin/cs/cdump [oracle@oracle11g dbs]$ mkdir -p /u01/app/oracle/admin/cs/udump [oracle@oracle11g dbs]$ chmod -R 777 /u01/app/oracle/admin/cs*
修改PFILE引數檔案
[oracle@oracle11g cs]$ mv INIT_00Q3836C_1_0.ORA initcs.ora [oracle@oracle11g cs]$ vi initcs.ora __shared_pool_size = 113246208 __large_pool_size = 4194304 __java_pool_size = 4194304 __streams_pool_size = 4194304 __db_cache_size = 285212672 remote_login_passwordfile= "EXCLUSIVE" db_domain = "" db_create_file_dest = "E:\ORADATA\CONVERT\oradata" # Please change the values of the following parameters: audit_file_dest = '/u01/app/oracle/admin/cs/adump' background_dump_dest = '/u01/app/oracle/admin/cs/bdump' user_dump_dest = '/u01/app/oracle/admin/cs/udump' core_dump_dest = '/u01/app/oracle/admin/cs/cdump' db_name = "CS" control_files='/u02/cs/control01.ctl' # Please review the values of the following parameters: dispatchers = "(PROTOCOL=TCP) (SERVICE=csXDB)" # 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 "initcs.ora" 48L, 990C written [oracle@oracle11g cs]$ cp initcs.ora $ORACLE_HOME/dbs
修改轉換指令碼
[oracle@oracle11g cs]$ vi CONVERTSCRIPT.RMAN RUN { CONVERT DATAFILE '/u02/cs/O1_MF_SYSTEM_BKLLOT8Z_.DBF' FROM PLATFORM 'Microsoft Windows IA (32-bit)' FORMAT '/u02/cs/datafiles/system01.dbf'; CONVERT DATAFILE '/u02/cs/O1_MF_SYSAUX_BKLLOTFL_.DBF' FROM PLATFORM 'Microsoft Windows IA (32-bit)' FORMAT '/u02/cs/datafiles/sysaux01.dbf'; CONVERT DATAFILE '/u02/cs/O1_MF_EXAMPLE_BKLLRKG2_.DBF' FROM PLATFORM 'Microsoft Windows IA (32-bit)' FORMAT '/u02/cs/datafiles/example01.dbf'; CONVERT DATAFILE '/u02/cs/TSPITR01.DBF' FROM PLATFORM 'Microsoft Windows IA (32-bit)' FORMAT '/u02/cs/datafiles/tspitr01.dbf'; CONVERT DATAFILE '/u02/cs/TEST01.DBF' FROM PLATFORM 'Microsoft Windows IA (32-bit)' FORMAT '/u02/cs/datafiles/test01.dbf'; CONVERT DATAFILE '/u02/cs/O1_MF_UNDOTBS1_BKLLOTM0_.DBF' FROM PLATFORM 'Microsoft Windows IA (32-bit)' FORMAT '/u02/cs/datafiles/undotsb1.dbf'; CONVERT DATAFILE '/u02/cs/O1_MF_USERS_BKLLOTM6_.DBF' FROM PLATFORM 'Microsoft Windows IA (32-bit)' FORMAT '/u02/cs/datafiles/users01.dbf'; }
修改用來建立新資料庫的傳輸指令碼
[oracle@oracle11g cs]$ vi TRANSPORTSCRIPT.SQL -- 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 PERFORMANCE STARTUP NOMOUNT PFILE='/u01/app/oracle/10.2.0/db/dbs/initcs.ora' -- Create SPFILE CREATE SPFILE FROM PFILE = '/u01/app/oracle/10.2.0/db/dbs/initcs.ora'; STARTUP FORCE NOMOUNT CREATE CONTROLFILE REUSE SET DATABASE "CS" RESETLOGS NOARCHIVELOG MAXLOGFILES 16 MAXLOGMEMBERS 3 MAXDATAFILES 100 MAXINSTANCES 8 MAXLOGHISTORY 292 LOGFILE GROUP 1 '/u02/cs/datafiles/redo01.log' SIZE 50M, GROUP 2 '/u02/cs/datafiles/redo02.log' SIZE 50M, GROUP 3 '/u02/cs/datafiles/redo03.log' SIZE 50M DATAFILE '/u02/cs/datafiles/system01.dbf', '/u02/cs/datafiles/sysaux01.dbf', '/u02/cs/datafiles/example01.dbf', '/u02/cs/datafiles/tspitr01.dbf', '/u02/cs/datafiles/test01.dbf', '/u02/cs/datafiles/undotsb1.dbf', '/u02/cs/datafiles/users01.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/cs/datafiles/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.在目標主機上執行轉換指令碼
[oracle@oracle11g admin]$ rman target/ Recovery Manager: Release 10.2.0.5.0 - Production on Tue Mar 31 21:55:50 2015 Copyright (c) 1982, 2007, Oracle. All rights reserved. connected to target database: JINGYONG (DBID=3213417256) RMAN> run 2> { 3> CONVERT DATAFILE '/u02/cs/O1_MF_SYSTEM_BKLLOT8Z_.DBF' 4> FROM PLATFORM 'Microsoft Windows IA (32-bit)' 5> FORMAT '/u02/cs/datafiles/system01.dbf'; 6> 7> CONVERT DATAFILE '/u02/cs/O1_MF_SYSAUX_BKLLOTFL_.DBF' 8> FROM PLATFORM 'Microsoft Windows IA (32-bit)' 9> FORMAT '/u02/cs/datafiles/sysaux01.dbf'; 10> 11> CONVERT DATAFILE '/u02/cs/O1_MF_EXAMPLE_BKLLRKG2_.DBF' 12> FROM PLATFORM 'Microsoft Windows IA (32-bit)' 13> FORMAT '/u02/cs/datafiles/example01.dbf'; 14> 15> CONVERT DATAFILE '/u02/cs/TSPITR01.DBF' 16> FROM PLATFORM 'Microsoft Windows IA (32-bit)' 17> FORMAT '/u02/cs/datafiles/tspitr01.dbf'; 18> 19> CONVERT DATAFILE '/u02/cs/TEST01.DBF' 20> FROM PLATFORM 'Microsoft Windows IA (32-bit)' 21> FORMAT '/u02/cs/datafiles/test01.dbf'; 22> 23> CONVERT DATAFILE '/u02/cs/O1_MF_UNDOTBS1_BKLLOTM0_.DBF' 24> FROM PLATFORM 'Microsoft Windows IA (32-bit)' 25> FORMAT '/u02/cs/datafiles/undotsb1.dbf'; 26> 27> CONVERT DATAFILE '/u02/cs/O1_MF_USERS_BKLLOTM6_.DBF' 28> FROM PLATFORM 'Microsoft Windows IA (32-bit)' 29> FORMAT '/u02/cs/datafiles/users01.dbf'; 30> } Starting backup at 31-MAR-15 using target database control file instead of recovery catalog allocated channel: ORA_DISK_1 channel ORA_DISK_1: sid=160 devtype=DISK channel ORA_DISK_1: starting datafile conversion input filename=/u02/cs/O1_MF_SYSTEM_BKLLOT8Z_.DBF converted datafile=/u02/cs/datafiles/system01.dbf channel ORA_DISK_1: datafile conversion complete, elapsed time: 00:00:55 Finished backup at 31-MAR-15 Starting backup at 31-MAR-15 using channel ORA_DISK_1 channel ORA_DISK_1: starting datafile conversion input filename=/u02/cs/O1_MF_SYSAUX_BKLLOTFL_.DBF converted datafile=/u02/cs/datafiles/sysaux01.dbf channel ORA_DISK_1: datafile conversion complete, elapsed time: 00:00:25 Finished backup at 31-MAR-15 Starting backup at 31-MAR-15 using channel ORA_DISK_1 channel ORA_DISK_1: starting datafile conversion input filename=/u02/cs/O1_MF_EXAMPLE_BKLLRKG2_.DBF converted datafile=/u02/cs/datafiles/example01.dbf channel ORA_DISK_1: datafile conversion complete, elapsed time: 00:00:15 Finished backup at 31-MAR-15 Starting backup at 31-MAR-15 using channel ORA_DISK_1 channel ORA_DISK_1: starting datafile conversion input filename=/u02/cs/TSPITR01.DBF converted datafile=/u02/cs/datafiles/tspitr01.dbf channel ORA_DISK_1: datafile conversion complete, elapsed time: 00:00:07 Finished backup at 31-MAR-15 Starting backup at 31-MAR-15 using channel ORA_DISK_1 channel ORA_DISK_1: starting datafile conversion input filename=/u02/cs/TEST01.DBF converted datafile=/u02/cs/datafiles/test01.dbf channel ORA_DISK_1: datafile conversion complete, elapsed time: 00:00:07 Finished backup at 31-MAR-15 Starting backup at 31-MAR-15 using channel ORA_DISK_1 channel ORA_DISK_1: starting datafile conversion input filename=/u02/cs/O1_MF_UNDOTBS1_BKLLOTM0_.DBF converted datafile=/u02/cs/datafiles/undotsb1.dbf channel ORA_DISK_1: datafile conversion complete, elapsed time: 00:00:03 Finished backup at 31-MAR-15 Starting backup at 31-MAR-15 using channel ORA_DISK_1 channel ORA_DISK_1: starting datafile conversion input filename=/u02/cs/O1_MF_USERS_BKLLOTM6_.DBF converted datafile=/u02/cs/datafiles/users01.dbf channel ORA_DISK_1: datafile conversion complete, elapsed time: 00:00:01 Finished backup at 31-MAR-15
8.執行傳輸指令碼中的內容來建立新資料庫(也可以直接執行傳輸指令碼)
[oracle@oracle11g admin]$ export ORACLE_SID=cs [oracle@oracle11g admin]$ sqlplus / as sysdba SQL*Plus: Release 10.2.0.5.0 - Production on Tue Mar 31 22:01:12 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/initcs.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 "CS" RESETLOGS NOARCHIVELOG 2 MAXLOGFILES 16 3 MAXLOGMEMBERS 3 4 MAXDATAFILES 100 5 MAXINSTANCES 8 6 MAXLOGHISTORY 292 7 LOGFILE 8 GROUP 1 '/u02/cs/datafiles/redo01.log' SIZE 50M, 9 GROUP 2 '/u02/cs/datafiles/redo02.log' SIZE 50M, 10 GROUP 3 '/u02/cs/datafiles/redo03.log' SIZE 50M 11 DATAFILE 12 '/u02/cs/datafiles/system01.dbf', 13 '/u02/cs/datafiles/sysaux01.dbf', 14 '/u02/cs/datafiles/example01.dbf', 15 '/u02/cs/datafiles/tspitr01.dbf', 16 '/u02/cs/datafiles/test01.dbf', 17 '/u02/cs/datafiles/undotsb1.dbf', 18 '/u02/cs/datafiles/users01.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
在執行恢復後正常開啟資料庫例項被終止,在alert.log中的錯誤資訊如下:
Errors in file /u01/app/oracle/admin/cs/udump/cs_ora_6458.trc: ORA-00704: bootstrap process failure ORA-39700: database must be opened with UPGRADE option Tue Mar 31 22:04:28 CST 2015 Error 704 happened during db open, shutting down database USER: terminating instance due to error 704 Instance terminated by USER, pid = 6458 ORA-1092 signalled during: ALTER DATABASE OPEN RESETLOGS...
錯誤資訊指示需要以升級模式來啟動資料庫,因為遷移過來的源資料庫的版本是10.2.0.1,而目標主機上的資料庫版本是10.2.0.5。
以升級模式啟動資料庫
[oracle@oracle11g admin]$ sqlplus / as sysdba SQL*Plus: Release 10.2.0.5.0 - Production on Tue Mar 31 22:06:55 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/cs/datafiles/system01.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/cs/datafiles/temp01.dbf' 2 SIZE 50M AUTOEXTEND OFF; Tablespace altered.
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 省略... TIMESTAMP -------------------------------------------------------------------------------- COMP_TIMESTAMP UPGRD_END 2015-03-31 23:04:46 . Oracle Database 10.2 Upgrade Status Utility 03-31-2015 23:04:46 . Component Status Version HH:MM:SS Oracle Database Server VALID 10.2.0.5.0 00:18:17 JServer JAVA Virtual Machine VALID 10.2.0.5.0 00:04:52 Oracle XDK VALID 10.2.0.5.0 00:00:49 Oracle Database Java Packages VALID 10.2.0.5.0 00:00:32 Oracle Text VALID 10.2.0.5.0 00:00:56 Oracle XML Database VALID 10.2.0.5.0 00:02:33 Oracle Workspace Manager VALID 10.2.0.5.0 00:01:05 Oracle Data Mining INVALID 10.2.0.5.0 00:00:30 OLAP Analytic Workspace VALID 10.2.0.5.0 00:01:07 OLAP Catalog VALID 10.2.0.5.0 00:01:32 Oracle OLAP API VALID 10.2.0.5.0 00:01:08 Oracle interMedia VALID 10.2.0.5.0 00:05:11 Spatial VALID 10.2.0.5.0 00:06:40 Oracle Expression Filter INVALID 10.2.0.5.0 00:00:25 Oracle Enterprise Manager VALID 10.2.0.5.0 00:02:50 Oracle Rule Manager INVALID 10.2.0.5.0 00:00:20 . Total Upgrade Time: 00:51:07 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>####################################################################### DOC>
再次執行utlrp.sql指令碼來進行編譯無效物件
SQL> @$ORACLE_HOME/rdbms/admin/utlrp.sql TIMESTAMP -------------------------------------------------------------------------------- COMP_TIMESTAMP UTLRP_BGN 2015-03-31 23:05:21 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 23:07:54 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 ------------------- 5 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 SQL> column comp_name format a35 SQL> SELECT comp_name, status, substr(version,1,10) as version from dba_server_registry order by modified; COMP_NAME STATUS VERSION ----------------------------------- ---------------------- -------------------- Oracle Enterprise Manager VALID 10.2.0.5.0 Oracle Database Packages and Types VALID 10.2.0.5.0 Oracle Workspace Manager VALID 10.2.0.5.0 JServer JAVA Virtual Machine VALID 10.2.0.5.0 Oracle Database Java Packages VALID 10.2.0.5.0 Oracle Database Catalog Views VALID 10.2.0.5.0 Oracle XDK VALID 10.2.0.5.0 Oracle Expression Filter VALID 10.2.0.5.0 Oracle Data Mining VALID 10.2.0.5.0 Oracle Text VALID 10.2.0.5.0 Oracle Rule Manager VALID 10.2.0.5.0 Oracle interMedia VALID 10.2.0.5.0 Oracle XML Database VALID 10.2.0.5.0 OLAP Analytic Workspace VALID 10.2.0.5.0 Oracle OLAP API VALID 10.2.0.5.0 OLAP Catalog VALID 10.2.0.5.0 Spatial VALID 10.2.0.5.0
來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/28211342/viewspace-2129028/,如需轉載,請註明出處,否則將追究法律責任。
相關文章
- RMAN備份恢復典型案例——跨平臺遷移pdb
- 【MOS】如何利用RMAN可傳輸表空間遷移資料庫到不同位元組序的平臺(文件 ID 1983639.1)資料庫
- 【資料遷移】XTTS跨平臺傳輸表空間v3(2.RMAN增量)TTS
- 用傳輸表空間跨平臺遷移資料
- Rman_異地、跨平臺、跨版本的恢復總結及案例
- 用rman遷移資料庫資料庫
- 【資料遷移】XTTS跨平臺傳輸表空間v4TTS
- elasticsearch跨叢集資料遷移Elasticsearch
- 使用 Velero 跨雲平臺遷移叢集資源到 TKE
- 跨平臺資料庫 Realm 整合實踐資料庫
- 【資料遷移】XTTS跨平臺傳輸表空間(1.傳統方式)TTS
- 12c跨平臺完成PDB的備份遷移
- iOS CoreData (二) 版本升級和資料庫遷移iOS資料庫
- 【資料遷移】XTTS跨平臺傳輸表空間v3(3.DFT方式)TTS
- GBASE助力山東移動大資料平臺PB級資料主倉業務跨機房無感知遷移大資料
- 同版本的庚頓實時資料庫的資料遷移操作步驟資料庫
- 移動跨平臺開發深度解析
- OBIEE10g跨平臺遷移過程及問題總結
- OGG資料庫遷移方案(二)資料庫
- JPA使用pg資料庫時,bool欄位不能跨庫遷移的解決方案資料庫
- 使用 `postMessage` 跨域名遷移 `localStorage`跨域
- long資料型別跨平臺問題資料型別
- rust跨平臺Rust
- 移動跨平臺技術方案總結
- JetBrains DataGrip 2024.2 (macOS, Linux, Windows) - 資料庫和 SQL 跨平臺 IDEAIMacLinuxWindows資料庫SQLIDE
- Azure data studio 跨平臺資料庫管理工具試用資料庫
- Go 跨平臺 UI 庫來了 fyneGoUI
- Apache Wayang :跨平臺資料處理系統Apache
- 寬位元組XSS跨站攻擊
- 5個免費、跨平臺的SQLite資料庫視覺化工具SQLite資料庫視覺化
- 移動端跨平臺開發的深度解析
- .NET Core 跨平臺
- 跨平臺編譯編譯
- Java跨平臺原理Java
- JVM跨平臺原理JVM
- WPF跨平臺方案?
- 資料庫遷移資料庫
- .NET跨平臺繪圖基礎庫--SkiaSharp繪圖
- 高速遷移MySQL資料到分散式時序資料庫DolphinDBMySql分散式資料庫