讨论数据库的升级(10gR2至11gR2)

今天对数据库升级做了大致了解,还是很多东西值得考虑的。

首先,升级前的准备就很多工作需要做:

1. 测试和准备, 主要是应用的做压力测试。因为版本升级,优化器可能使SQL性能回退(选择性能更差的执行计划),可以结合database replay做压力测试,SPA模拟环境变化的影响,以及SPM对执行计划做固定。

2. 升级的方法, 主要是图形界面DBUA(新目录的路径)来完成,相对简单;手工升级(手工执行脚本、DBUA只不过将这些手工动作代替而已、新目录路径);EXPDP(源库路径)/IMPDP(新库路径)等等。

其中,以下几种方法可以支持滚动升级:

可以看得出,升级的方案多样,根据不同的环境而定。

3. 升级前,务必将新库路径下$ORACLE_HOME/rdbms/admin/utlu112i.sql脚本拷至源库执行,主要是检查当前环境(如表空间大小,隐含参数,警告或建议)是否合适做升级,我们可以根据警告和建议做相应调整。

以下粘出单机数据库的升级实验步骤,供参数,由10.2.0.5升级至11.2.0.3.

时间允许的话,将做RAC的升级并更新文章

======================================================================================================

一、源库--备份

run {

allocate channel ch1 device type disk;

allocate channel ch2 device type disk;

allocate channel ch3 device type disk;

allocate channel ch4 device type disk;

backup AS BACKUPSET full tag ‘db_full‘ format ‘/backup/db_%d_%T_%s_%U.bak‘ database include current controlfile;

sql ‘alter system archive log current‘;

release channel ch4;

release channel ch3;

release channel ch2;

release channel ch1;

}

SQL> archive log list;

Database log mode        Archive Mode

Automatic archival        Enabled

Archive destination        /arch/ora10g

Oldest online log sequence     49

Next log sequence to archive   51

Current log sequence        51

二、源库 -- 运行脚本utlu112i.sql,做升级前检查

[[email protected] backup]$ sqlplus / as sysdba

SQL*Plus: Release 10.2.0.5.0 - Production on Mon Jan 26 20:27:42 2015

Copyright (c) 1982, 2010, Oracle.  All Rights Reserved.

Connected to:

Oracle Database 10g Enterprise Edition Release 10.2.0.5.0 - 64bit Production

With the Partitioning, OLAP, Data Mining and Real Application Testing options

SQL> spool /tmp/upgrade_info.log

@/u01/app/oracle/product/11.2.0/db_1/rdbms/admin/utlu112i.sql

打印内容如下:

================

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

Oracle Database 11.2 Pre-Upgrade Information Tool 01-26-2015 20:34:56

Script Version: 11.2.0.3.0 Build: 001

.

**********************************************************************

Database:

**********************************************************************

--> name:    ORA10G

--> version:    10.2.0.5.0

--> compatible:    10.2.0.5.0

--> blocksize:    8192

--> platform:    Linux x86 64-bit

--> timezone file: V4

.

**********************************************************************

Tablespaces: [make adjustments in the current environment]

**********************************************************************

--> SYSTEM tablespace is adequate for the upgrade.

.... minimum required size: 643 MB

--> UNDOTBS1 tablespace is adequate for the upgrade.

.... minimum required size: 400 MB

--> SYSAUX tablespace is adequate for the upgrade.

.... minimum required size: 433 MB

--> TEMP tablespace is adequate for the upgrade.

.... minimum required size: 60 MB

.

**********************************************************************

Flashback: OFF

**********************************************************************

**********************************************************************

Update Parameters: [Update Oracle Database 11.2 init.ora or spfile]

Note: Pre-upgrade tool was run on a lower version 64-bit database.

**********************************************************************

--> If Target Oracle is 32-Bit, refer here for Update Parameters:

-- No update parameter changes are required.

.

--> If Target Oracle is 64-Bit, refer here for Update Parameters:

-- No update parameter changes are required.

.

**********************************************************************

Renamed Parameters: [Update Oracle Database 11.2 init.ora or spfile]

**********************************************************************

-- No renamed parameters found. No changes are required.

.

**********************************************************************

Obsolete/Deprecated Parameters: [Update Oracle Database 11.2 init.ora or spfile]

**********************************************************************

--> sql_trace    10.2     DEPRECATED

--> background_dump_dest  11.1     DEPRECATED  replaced by  "diagnostic_dest"

--> user_dump_dest   11.1     DEPRECATED  replaced by  "diagnostic_dest"

.

**********************************************************************

Components: [The following database components will be upgraded or installed]

**********************************************************************

--> Oracle Catalog Views  [upgrade]  VALID

--> Oracle Packages and Types  [upgrade]  VALID

--> JServer JAVA Virtual Machine [upgrade]  VALID

--> Oracle XDK for Java   [upgrade]  VALID

--> Oracle Workspace Manager  [upgrade]  VALID

--> EM Repository   [upgrade]  VALID

--> Oracle XML Database   [upgrade]  VALID

--> Oracle Java Packages  [upgrade]  VALID

--> Oracle interMedia   [upgrade]  VALID

--> Expression Filter   [upgrade]  VALID

--> Rule Manager   [upgrade]  VALID

.

**********************************************************************

Miscellaneous Warnings

**********************************************************************

WARNING: --> Database is using a timezone file older than version 14.

.... After the release migration, it is recommended that DBMS_DST package

.... be used to upgrade the 10.2.0.5.0 database timezone version

.... to the latest version which comes with the new release.

WARNING: --> Database contains INVALID objects prior to upgrade.

.... The list of invalid SYS/SYSTEM objects was written to

.... registry$sys_inv_objs.

.... The list of non-SYS/SYSTEM objects was written to

.... registry$nonsys_inv_objs.

.... Use utluiobj.sql after the upgrade to identify any new invalid

.... objects due to the upgrade.

.... USER PUBLIC has 234 INVALID objects.

.... USER TEST has 3 INVALID objects.

.... USER SYSTEM has 2 INVALID objects.

.... USER SYSMAN has 210 INVALID objects.

.... USER SYS has 198 INVALID objects.

.... USER WMSYS has 6 INVALID objects.

WARNING: --> EM Database Control Repository exists in the database.

.... Direct downgrade of EM Database Control is not supported. Refer to the

.... Upgrade Guide for instructions to save the EM data prior to upgrade.

WARNING: --> Your recycle bin is turned on and currently contains no objects.

.... Because it is REQUIRED that the recycle bin be empty prior to upgrading

.... and your recycle bin is turned on, you may need to execute the command:

PURGE DBA_RECYCLEBIN

.... prior to executing your upgrade to confirm the recycle bin is empty.

.

**********************************************************************

Recommendations

**********************************************************************

Oracle recommends gathering dictionary statistics prior to

upgrading the database.

To gather dictionary statistics execute the following command

while connected as SYSDBA:

EXECUTE dbms_stats.gather_dictionary_stats;

**********************************************************************

Oracle recommends removing all hidden parameters prior to upgrading.

To view existing hidden parameters execute the following command

while connected AS SYSDBA:

SELECT name,description from SYS.V$PARAMETER WHERE name

LIKE ‘\_%‘ ESCAPE ‘\‘

Changes will need to be made in the init.ora or spfile.

**********************************************************************

Oracle recommends reviewing any defined events prior to upgrading.

To view existing non-default events execute the following commands

while connected AS SYSDBA:

Events:

SELECT (translate(value,chr(13)||chr(10),‘ ‘)) FROM sys.v$parameter2

WHERE  UPPER(name) =‘EVENT‘ AND  isdefault=‘FALSE‘

Trace Events:

SELECT (translate(value,chr(13)||chr(10),‘ ‘)) from sys.v$parameter2

WHERE UPPER(name) = ‘_TRACE_EVENTS‘ AND isdefault=‘FALSE‘

Changes will need to be made in the init.ora or spfile.

**********************************************************************

Oracle recommends examining audit tables AUD$ and FGA_LOG$ before

upgrading the database.

This database has 0 rows in AUD$ and 23 rows in FGA_LOG$ that

will be updated during the database upgrade from 10.2.0.5.0.

During this upgrade, null DBIDs in AUD$ and FGA_LOG$ will be updated

with non-null values.

The upgrade downtime could be affected if there are many rows to update.

If downtime is a concern, the audit update could be done manually prior

to upgrading the database.

Please refer to My Oracle Support Note 1329590.1 titled "How to

Pre-Process SYS.AUD$ Records Pre-Upgrade From 10.1 or Later to 11.2".

**********************************************************************

<<<<<<<<<根据输出结果,做相对就的调整...此处省略

三、upgrading

[[email protected] ~]$ env | grep ORA

ORACLE_SID=ora10g

ORACLE_BASE=/u01/app/oracle

ORACLE_TERM=xterm

ORACLE_HOME=/u01/app/oracle/product/11.2.0/db_1

[[email protected] ~]$ lsnrctl start

LSNRCTL for Linux: Version 11.2.0.3.0 - Production on 26-JAN-2015 20:41:52

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

Starting /u01/app/oracle/product/11.2.0/db_1/bin/tnslsnr: please wait...

TNSLSNR for Linux: Version 11.2.0.3.0 - Production

System parameter file is /u01/app/oracle/product/11.2.0/db_1/network/admin/listener.ora

Log messages written to /u01/app/oracle/diag/tnslsnr/tivoli02/listener/alert/log.xml

Listening on: (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=tivoli02)(PORT=1521)))

Listening on: (DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=EXTPROC1521)))

Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=tivoli02)(PORT=1521)))

STATUS of the LISTENER

------------------------

Alias                     LISTENER

Version                   TNSLSNR for Linux: Version 11.2.0.3.0 - Production

Start Date                26-JAN-2015 20:41:52

Uptime                    0 days 0 hr. 0 min. 0 sec

Trace Level               off

Security                  ON: Local OS Authentication

SNMP                      OFF

Listener Parameter File   /u01/app/oracle/product/11.2.0/db_1/network/admin/listener.ora

Listener Log File         /u01/app/oracle/diag/tnslsnr/tivoli02/listener/alert/log.xml

Listening Endpoints Summary...

(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=tivoli02)(PORT=1521)))

(DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=EXTPROC1521)))

The listener supports no services

The command completed successfully

[[email protected] ~]$ which lsnrctl

/u01/app/oracle/product/11.2.0/db_1/bin/lsnrctl

sqlpus / as sysdba

startup upgrade

SQL> SPOOL upgrade.log

SQL> @?/rdbms/admin/catupgrd.sql  ---about 30 minutes

SQL> STARTUP

SQL> @?/rdbms/admin/utlu112s.sql

SQL> @?/rdbms/admin/catuppst.sql

SQL> @?/rdbms/admin/utlrp.sql

SQL> SELECT count(*) FROM dba_invalid_objects;

SQL> SELECT distinct object_name FROM dba_invalid_objects;

<<<<<<如果有失效对象,需要手工重编译

时间: 2024-10-09 20:05:05

讨论数据库的升级(10gR2至11gR2)的相关文章

android数据库的升级的写法

在基类的table中加入upgrade操作: public abstract class DbBaseTable { private static final String TAG = "DbBaseTable"; /** * @return the DB table name */ abstract String getName(); /** * Creates the DB table according to the DB scheme * * @param db */ abst

Android数据库无缝升级方案

软件迭代过程中,业务不断更新,也要求软件持续更新.相应地,数据库更新升级也是不可避免的一个环节.Android作为客户端应用,数据库升级相对于服务端来说会麻烦一些.常见的升级方式有: 1.删除旧表和数据,创建新表.优点是简单方便,缺点是丢失了旧数据.适用于应用数据依赖度低的情况. 2.在代码中兼容处理各版本数据库,创建新表,迁移旧数据到新表.优点是保留了旧数据,缺点是需要处理兼容个版本数据库差异,比较麻烦.如果通过代码来记录维护版本差异,会导致代码臃肿且极易出错. 本文介绍一种简单无缝的数据库升

Android版本升级同时Sqlite数据库的升级及之前数据的保留

http://www.cnblogs.com/wang340/archive/2013/05/06/3063135.html http://www.eoeandroid.com/forum.php?mod=viewthread&tid=166052 做Android应用,不可避免的会与SQLite打交道.随着应用的不断升级,原有的数据库结构可能已经不再适应新的功能,这时候,就需要对SQLite数据库的结构进行升级了. SQLite提供了ALTER TABLE命令,允许用户重命名或添加新的字段到已

【转】Android版本升级同时Sqlite数据库的升级及之前数据的保留

做Android应用,不可避免的会与SQLite打交道.随着应用的不断升级,原有的数据库结构可能已经不再适应新的功能,这时候,就需要对SQLite数据库的结构进行升级了. SQLite提供了ALTER TABLE命令,允许用户重命名或添加新的字段到已有表中,但是不能从表中删除字段.并且只能在表的末尾添加字段,比如,为 Subscription添加两个字段:1 ALTER TABLE Subscription ADD COLUMN Activation BLOB;2 ALTER TABLE Sub

静默方式安装10g数据库软件+升级patch+手工建库

通常我们安装Oracle数据库软件,都是用OUI图形界面来完成的,但有些Unix/Linux系统中并未安装图形系统,也就无法使用图形界面来安装Oracle的产品了,对于这种场景,就只能采用静默方式来安装了,Oracle提供了这种silent方式,主要是通过配置响应文件rsp来完成的. 一.静默安装10.2.0.1数据库软件 --解压安装包 [[email protected] u01]$ unzip 10201_database_linux32.zip [[email protected] u0

oracle数据库psu升级(本实验是将10.2.0.3.12升级到10.2.0.3.15)

psu升级(本实验是将10.2.0.3.12升级到10.2.0.3.15) 一.解压安装包自定义存放路径为/home/oracle/yjb/psu/10.2.0.3.15cd /home/oracle/yjb/psu/10.2.0.3.15unzip p6880880_112000_04-SEP-2015_Linux-x86-64.zipunzip p20760997_112030_15_Linux-x86-64.zip -d 1120315 二.检查psu补丁是否有冲突/home/oracle

ios 数据库更新升级方案

我们常使用fmdb或者其他方式创建sqlite数据库,但是由于版本迭代问题,常常有需求要更新数据库,比如加字段.删除.修改字段等等,怎么样才能升级数据库且保持原来存的数据有效呢,上代码: const static NSInteger FAMILY_LIST_DB_MANAGER_VER = 1; @implementation KSFamilyListDBManager {     DBManager *_dbMgr; } + (instancetype)sharedManager {     

ubuntu环境下zabbix2.0数据库迁移升级到zabbix2.2

zabbix版本更新升级较快,功能也在逐步强化,旧版本的有些功能存在不足甚至是bug.并且在运维工作工设计到zabbix平台的迁移也是比较常见的问题.先前在做数据迁移时也犯过一些大大小小的问题.在网上也查找了一些资料,基于Ubuntu的还是比较少,尽管与centos等大同小异,还是决定整理记录一下. 旧版本:zabbix 2.0.6-Ubuntu 12.10 新版本:  zabbix 2.2.9-Ubuntu14.10 1.旧版本的数据导出 mysqldump -uroot -p -hlocal

SQL数据库的升级过程—解决WMI服务无法链接过程

之前用的SQL SERVER数据库的试用期到了,然后就出现了数据库无法打开,提示没有权限的错误. 这个错误的相信很多人都遇到过,处理方法也有很多,前期的工作可以从网上找. 下面说说我的处理方法:首先明白WMI是什么,以下摘自百度百科:WMI,是Windows 2K/XP管理系统的核心:对于其他的Win32操作系统,WMI是一个有用的插件.WMI以CIMOM为基础,CIMOM即公共信息模型对象管理器(Common Information Model Object Manager),是一个描述操作系