返回小栈
upgrade 10.2.0.5 to 11.2.0.4 on linux
orastar2020-03-03 10:41:39
1、在source库上执行utlu112i.sql脚本


将11g $ORACLE_HOME/rdbms/admin下的utlu112i.sql脚本复制到10g的/home/oracle/执行
spool upgrade_info.log
@?/rdbms/admin/utlu112i.sql


原库数据文件保留足够的空余空间
ALTER TABLESPACE system ADD DATAFILE '+DATA01'  SIZE  1G AUTOEXTEND OFF;
ALTER TABLESPACE SYSAUX ADD DATAFILE '+DATA01'  SIZE  1G AUTOEXTEND OFF;
ALTER TABLESPACE USERS ADD DATAFILE '+DATA01'  SIZE  1G AUTOEXTEND OFF;
ALTER TABLESPACE UNDOTBS1 ADD DATAFILE '+DATA01'  SIZE  1G AUTOEXTEND OFF;
ALTER TABLESPACE TEMP ADD tempfile '+DATA01'  SIZE  1G AUTOEXTEND OFF;


检查source库数据文件及日志文件
set line 130
col file_name for a60
col MEMBER for a60
select member from v$logfile;
select file_name,STATUS from dba_temp_files;
select file_id,file_name,STATUS,ONLINE_STATUS from dba_data_files;

2、原备全备


rman target /
backup database format '/home/oracle/full_%U.bak' plus archivelog;
复制备份集到target库。


3、target恢复


3.1 start instance
startup nomount pfile='/home/oracle/pfile.ora';  --注:sga_target>2G以上,根据主机配置设置足够sga
set DBID=2071660054;  --设置source库DBID
restore controlfile from '/home/oracle/full_02spdlip_1_1.bak';
alter database mount;


3.2 restore database
run{
set newname for datafile 1 to '+DATA01/';
set newname for datafile 2 to '+DATA01/';
set newname for datafile 3 to '+DATA01/';
set newname for datafile 4 to '+DATA01/';
restore database;
switch datafile all;
}


3.3 recover database
select CHECKPOINT_CHANGE# from v$database;
select CHECKPOINT_CHANGE# from v$datafile;
select CHECKPOINT_CHANGE# from v$datafile_header;


recover database until scn 397878;


alter database rename file '/oradata/onlinelog/o1_mf_3_f6fy0tvm_.log' to '+DATA01';
alter database rename file '/oradata/onlinelog/o1_mf_2_f6fy0sqf_.log' to '+DATA01';
alter database rename file '/oradata/onlinelog/o1_mf_1_f6fy0rho_.log' to '+DATA01';
alter database rename file '/oradata/datafile/o1_mf_temp_f6fy0xqt_.tmp' to '+DATA01';


3.4 update database
alter database open resetlogs upgrade;


set line 200
col name for a60
select * from v$sgainfo; --检查shared_pool_size,测试时100M升级报错,建议500M以上。


@?/rdbms/admin/catupgrd.sql
@?/rdbms/admin/utlu112s.sql
@?/rdbms/admin/catuppst.sql


3.5 检查无效对象及升级组件
编译无效对象
set lines 1200 pages 1200
col owner for a15
col object_name for a40
col status for a15
col OBJECT_TYPE for a20
select owner,object_name,OBJECT_TYPE,status from dba_objects where status !='VALID'; 
@?/rdbms/admin/utlrp.sql


检查升级组件
set lines 1200
col comp_name for a30
col status for a12
col version for a20
select comp_name,status,version from dba_server_registry;
3
0