Oracle 11g Windows 遷移至 Linux

haoge0205發表於2013-11-28

OS:

windows server 2008 R2 enterprise

DB:

11.2.0.1.0

資料庫配置:

ORACLE_BASE=D:\app\Administrator

ORACLE_HOME=D:\app\Administrator\product\11.2.0\dbhome_1

ORACLE_SID=yoon

OS:

Oracle Linux Server release 5.7

DB:

11.2.0.3.0

資料庫配置:

ORACLE_BASE=/u01/oracle;

ORACLE_HOME=$ORACLE_BASE/product/11.2.0/db_1

ORACLE_SID=yoon

1、登入到Windows下的oracle

① 建立pfile

② 建立spfile

③ 關閉資料庫

④ 複製資料檔案、控制檔案、重做日誌組、引數檔案 到 Linux 對應的目錄

2、登入到Linux下的oracle(提前安裝oracle軟體)

① 在oracle使用者下建立對應的目錄

② 在windows下引數檔名有大小寫,在linux將檔名改為小寫

③ 編輯linux下的引數檔案inityoon.ora 將windows路徑改成linux路徑

即:

[oracle@yoon dbs]$ cat inityoon.ora
yoon.__db_cache_size=1543503872
yoon.__java_pool_size=16777216
yoon.__large_pool_size=16777216
yoon.__oracle_base='/u01/oracle'#ORACLE_BASE set from environment
yoon.__pga_aggregate_target=1375731712
yoon.__sga_target=2063597568
yoon.__shared_io_pool_size=0
yoon.__shared_pool_size=452984832
yoon.__streams_pool_size=0
*.audit_file_dest='/u01/oracle/admin/yoon/adump'
*.audit_trail='db'
*.compatible='11.2.0.0.0'
*.control_files='/u01/oracle/oradata/yoon/control01.ctl','/u01/oracle/fast_recovery_area/yoon/control02.ctl'
*.db_block_size=8192
*.db_domain=''
*.db_name='yoon'
*.db_recovery_file_dest='/u01/oracle/fast_recovery_area'
*.db_recovery_file_dest_size=4102029312
*.diagnostic_dest='/u01/oracle'
*.dispatchers='(PROTOCOL=TCP) (SERVICE=yoonXDB)'
*.memory_target=3435134976
*.nls_language='SIMPLIFIED CHINESE'
*.nls_territory='CHINA'
*.open_cursors=300
*.processes=150
*.remote_login_passwordfile='EXCLUSIVE'
*.undo_tablespace='UNDOTBS1'

④ 建立密碼檔案

即:

[oracle@yoon dbs]$ orapwd file=orapwyoon password=oracle

3、登入到linux的oracle下

[oracle@yoon ~]$ sqlplus / as sysdba

SQL*Plus: Release 11.2.0.3.0 Production on Sun Sep 22 17:40:56 2013

Copyright (c) 1982, 2011, Oracle. All rights reserved.


Connected to:
Oracle Database 11g Enterprise Edition Release 11.2.0.3.0 - 64bit Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options

SQL>

SQL> startup mount pfile='/u01/oracle/product/11.2.0/db_1/dbs/inityoon.ora';

SQL> crate spfile from pfile='/u01/oracle/product/11.2.0/db_1/dbs/inityoon.ora';

--下次啟動時,直接以spfile引數檔案啟動

4、生成控制檔案的跟蹤檔案

SQL> alter database backup controlfile to trace;

SQL> shutdown immediate

[oracle@yoon ~]$ cd /u01/oracle/diag/rdbms/yoon/yoon/trace

[oracle@yoon trace]$ ls -ltr --查詢最新的 ‘XXX.trc' 檔案 即:yoon_ora_7891.trc

[oracle@yoon trace]$ vi yoon_ora_7891.trc

[oracle@yoon backup]$ cat yoon_ora_7891.trc
STARTUP NOMOUNT
CREATE CONTROLFILE REUSE DATABASE "YOON" NORESETLOGS NOARCHIVELOG
MAXLOGFILES 16
MAXLOGMEMBERS 3
MAXDATAFILES 100
MAXINSTANCES 8
MAXLOGHISTORY 292
LOGFILE
GROUP 1 '/u01/oracle/oradata/yoon/redo01.log' SIZE 50M BLOCKSIZE 512,
GROUP 2 '/u01/oracle/oradata/yoon/redo02.log' SIZE 50M BLOCKSIZE 512,
GROUP 3 '/u01/oracle/oradata/yoon/redo03.log' SIZE 50M BLOCKSIZE 512
DATAFILE
'/u01/oracle/oradata/yoon/system01.dbf',
'/u01/oracle/oradata/yoon/sysaux01.dbf',
'/u01/oracle/oradata/yoon/undotbs01.dbf',
'/u01/oracle/oradata/yoon/users01.dbf'
CHARACTER SET ZHS16GBK
;
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 '/u01/oracle/oradata/yoon/TEMP01.DBF' REUSE;

--資料檔案改為小寫

SQL> STARTUP NOMOUNT

SQL> CREATE CONTROLFILE REUSE DATABASE "YOON" NORESETLOGS NOARCHIVELOG
MAXLOGFILES 16
MAXLOGMEMBERS 3
MAXDATAFILES 100
MAXINSTANCES 8
MAXLOGHISTORY 292
LOGFILE
GROUP 1 '/u01/oracle/oradata/yoon/redo01.log' SIZE 50M BLOCKSIZE 512,
GROUP 2 '/u01/oracle/oradata/yoon/redo02.log' SIZE 50M BLOCKSIZE 512,
GROUP 3 '/u01/oracle/oradata/yoon/redo03.log' SIZE 50M BLOCKSIZE 512
DATAFILE
'/u01/oracle/oradata/yoon/system01.dbf',
'/u01/oracle/oradata/yoon/sysaux01.dbf',
'/u01/oracle/oradata/yoon/undotbs01.dbf',
'/u01/oracle/oradata/yoon/users01.dbf'
CHARACTER SET ZHS16GBK
;

SQL> RECOVER DATABASE;

5、關閉資料庫,更新資料字典

SQL> SHUTDOWN IMMEDIATE

SQL> startup upgrade;

SQL> @/u01/oracle/product/11.2.0/db_1/rdbms/admin/catupgrd.sql

SQL> @/u01/oracle/product/11.2.0/db_1/rdbms/admin/catalog.sql

6、啟動資料庫

SQL> STARTUP;

*注意windows下的oracle版本低,linux下的oracle版本高哦*

來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/28939273/viewspace-1061487/,如需轉載,請註明出處,否則將追究法律責任。

相關文章