6.Oracle小版本升级

来源:互联网 发布:新疆4g网络停用真相 编辑:程序博客网 时间:2024/06/04 11:45
案例:将数据库从10.2.0.1升级到10.2.0.4


10gR2   R=release  
9iR2=9.2.0.1~9.2.0.8
10gR1=10.1.0.1~10.1.0.8
10gR2=10.2.0.1~10.2.0.8


1、将oracle相关的服务全部停止
[oracle@oracle253 bin]$ isqlplusctl stop   --停止isqlplus
iSQL*Plus 10.2.0.1.0
Copyright (c) 2003, 2005, Oracle.  All rights reserved.
getnameinfo failed
getnameinfo failed
Stopping iSQL*Plus ...
iSQL*Plus stopped.
[oracle@oracle253 bin]$ emctl stop dbconsole   --停止OEM
TZ set to PRC
Oracle Enterprise Manager 10g Database Control Release 10.2.0.1.0
Copyright (c) 1996, 2005 Oracle Corporation.  All rights reserved.
http://oracle253:1158/em/console/aboutApplication
Stopping Oracle Enterprise Manager 10g Database Control ...
 ...  Stopped.
[oracle@oracle253 bin]$ sqlplus /nolog   --停止oracle服务
SQL*Plus: Release 10.2.0.1.0 - Production on Thu Jul 11 14:16:21 2013
Copyright (c) 1982, 2005, Oracle.  All rights reserved.
SQL> conn /as sysdba
Connected.
SQL> shutdown immediate
Database closed.
Database dismounted.
ORACLE instance shut down.
SQL> exit
Disconnected from Oracle Database 10g Enterprise Edition Release 10.2.0.1.0 - Production
With the Partitioning, OLAP and Data Mining options
[oracle@oracle253 bin]$ lsnrctl stop   --停止监听


LSNRCTL for Linux: Version 10.2.0.1.0 - Production on 11-JUL-2013 14:16:46


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


Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=IPC)(KEY=EXTPROC1)))
The command completed successfully


2、解压缩升级包,解完出现Disk1的文件
p6810189_10204_Linux-x86.zip   ——   Disk1


3、设置调用图形界面的环境安装
[root@oracle253 rc0.d]# xhost +
access control disabled, clients can connect from any host
[root@oracle253 rc0.d]# su - oracle
[oracle@oracle253 ~]$ export DISPLAY=":0.0"
[oracle@oracle253 ~]$ export LANG=en_US
[oracle@oracle253 ~]$ cd /u01/10g/Disk1/
[oracle@oracle253 Disk1]$ ll
total 1784
-rw-r--r--  1 root root 1620786 Feb 22  2008 10204_buglist.htm
drwxr-xr-x  4 root root    4096 Feb 17  2008 install
-rw-r--r--  1 root root  178465 Feb 23  2008 patch_note.htm
drwxr-xr-x  2 root root    4096 Feb 17  2008 response
-rwxr-xr-x  1 root root    1756 Feb 17  2008 runInstaller
drwxr-xr-x 10 root root    4096 Feb 22  2008 stage
[oracle@oracle253 Disk1]$ ./runInstaller   --安装


4、执行脚本(root下)
[root@oracle253 ~]# cd /u01/oracle/product/10.2.0/db_1/
[root@oracle253 db_1]# ./root.sh
Running Oracle10 root.sh script...


The following environment variables are set as:
    ORACLE_OWNER= oracle
    ORACLE_HOME=  /u01/oracle/product/10.2.0/db_1


Enter the full pathname of the local bin directory: [/usr/local/bin]:
The file "dbhome" already exists in /usr/local/bin.  Overwrite it? (y/n)
[n]:
The file "oraenv" already exists in /usr/local/bin.  Overwrite it? (y/n)
[n]:
The file "coraenv" already exists in /usr/local/bin.  Overwrite it? (y/n)
[n]:


Entries will be added to the /etc/oratab file as needed by
Database Configuration Assistant when a database is created
Finished running generic part of root.sh script.
Now product-specific root actions will be performed.


----以上升级的是oracle软件,下面升级的是ORCL实例


5、将oracle启动到升级状态
SQL> conn /as sysdba
Connected to an idle instance.


SQL> startup upgrade
ORACLE instance started.


Total System Global Area 1241513984 bytes
Fixed Size                  1267212 bytes
Variable Size             318769652 bytes
Database Buffers          905969664 bytes
Redo Buffers               15507456 bytes
Database mounted.
Database opened.


6、升级组件
SQL> @/u01/oracle/product/10.2.0/db_1/rdbms/admin/catupgrd.sql(运行时间较长)


7、关闭数据库后正常启动


SQL> shutdown immediate
Database closed.
Database dismounted.
ORACLE instance shut down.


SQL> startup
ORACLE instance started.


Total System Global Area 1241513984 bytes
Fixed Size                  1267212 bytes
Variable Size             352324084 bytes
Database Buffers          872415232 bytes
Redo Buffers               15507456 bytes
Database mounted.
Database opened.


8、编译无效的对象
SQL> @/u01/oracle/product/10.2.0/db_1/rdbms/admin/utlrp.sql 


9、创建组件目录
SQL> @/u01/oracle/product/10.2.0/db_1/rdbms/admin/catalog.sql


10、创建存储过程和组件包
SQL> @/u01/oracle/product/10.2.0/db_1/rdbms/admin/catproc.sql


出现
SQL> SET SERVEROUTPUT OFF  升级结束
确认:
SQL> col comp_name format a40
SQL> col version format a30
SQL> set linesize 1000
SQL> select comp_name,version,status from dba_registry;


COMP_NAME                                VERSION                        STATUS
---------------------------------------- ------------------------------------
Oracle Enterprise Manager                10.2.0.4.0                     VALID
Spatial                                  10.2.0.4.0                     VALID
Oracle interMedia                        10.2.0.4.0                     VALID
OLAP Catalog                             10.2.0.4.0                     VALID
Oracle XML Database                      10.2.0.4.0                     VALID
Oracle Text                              10.2.0.4.0                     VALID
Oracle Expression Filter                 10.2.0.4.0                     VALID
Oracle Rule Manager                      10.2.0.4.0                     VALID
Oracle Workspace Manager                 10.2.0.4.3                     VALID
Oracle Data Mining                       10.2.0.4.0                     VALID
Oracle Database Catalog Views            10.2.0.4.0                     VALID
Oracle Database Packages and Types       10.2.0.4.0                     VALID
JServer JAVA Virtual Machine             10.2.0.4.0                     VALID
Oracle XDK                               10.2.0.4.0                     VALID
Oracle Database Java Packages            10.2.0.4.0                     VALID
OLAP Analytic Workspace                  10.2.0.4.0                     VALID
Oracle OLAP API                          10.2.0.4.0                     VALID


17 rows selected.


练习:创建另外一个实例LAW
[oracle@redhat]$dbca
字符集UTF8


LSNRCTL> status
Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=IPC)(KEY=EXTPROC1)))
STATUS of the LISTENER
------------------------
Alias                     LISTENER
Version                   TNSLSNR for Linux: Version 10.2.0.4.0 - Production
Start Date                11-JUL-2013 15:31:19
Uptime                    0 days 0 hr. 6 min. 30 sec
Trace Level               off
Security                  ON: Local OS Authentication
SNMP                      OFF
Listener Parameter File   /u01/oracle/product/10.2.0/db_1/network/admin/listener.ora
Listener Log File         /u01/oracle/product/10.2.0/db_1/network/log/listener.log
Listening Endpoints Summary...
  (DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=EXTPROC1)))
  (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=oracle253)(PORT=1521)))
Services Summary...
Service "LAW" has 1 instance(s).  --监听LAW
  Instance "LAW", status READY, has 1 handler(s) for this service...
Service "LAWXDB" has 1 instance(s).
  Instance "LAW", status READY, has 1 handler(s) for this service...
Service "LAW_XPT" has 1 instance(s).
  Instance "LAW", status READY, has 1 handler(s) for this service...
Service "ORCL" has 1 instance(s).  --监听ORCL
  Instance "ORCL", status READY, has 1 handler(s) for this service...
Service "ORCLXDB" has 1 instance(s).
  Instance "ORCL", status READY, has 1 handler(s) for this service...
Service "ORCL_XPT" has 1 instance(s).
  Instance "ORCL", status READY, has 1 handler(s) for this service...
Service "PLSExtProc" has 1 instance(s).
  Instance "PLSExtProc", status UNKNOWN, has 1 handler(s) for this service...
The command completed successfully


[oracle@oracle253 Disk1]$ sqlplus /nolog


SQL*Plus: Release 10.2.0.4.0 - Production on Thu Jul 11 15:38:40 2013


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


SQL> conn /as sysdba
Connected.
SQL> select instance_name from v$instance;  (查看连接的实例名)


INSTANCE_NAME
----------------
ORCL    --默认连接ORCL,这个实例名在.bash_profile文件中,
            切换到oracle用户的时候就已经加载了


SQL> exit
Disconnected from Oracle Database 10g Enterprise Edition Release 10.2.0.4.0 - Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options
[oracle@oracle253 Disk1]$ export ORACLE_SID=LAW --连LAW,必须修改环境变量的值,ORACLE_SID
[oracle@oracle253 Disk1]$ sqlplus /nolog


SQL*Plus: Release 10.2.0.4.0 - Production on Thu Jul 11 15:39:35 2013


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


SQL> conn /as sysdba
Connected.
SQL> select instance_name from v$instance;


INSTANCE_NAME
--------------------------------
LAW


养成一个好的习惯:
1、当一个主机上多个实例的时候,经常select instance_name from v$instance;
2、当你同时操作多个主机的时候,ssh工具连接了多个主机维护,经常hostname,确认操作的主机。


软件层次结构:
B/S模式和C/S模式
C/S模式(两层)——客户端+数据库服务器(client+server),要求客户端安装软件,软件的业务层是安装在客户端的。sqlplus、developer
B/S模式(三层)——浏览器+应用服务器+数据库服务器——客户端不需要安装任何东西,只要有浏览器即可。
OEM、isqlplus


emctl start dbconsole命令实际是在启动应用服务器,此时数据库服务器是已经启动的。



原创粉丝点击