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版本高哦*