標籤:關閉 packages home and group files bit lis targe
1. 講補丁包上傳到 Oracle server ,解壓、安裝
[[email protected] tmp]$ unzip linuxx64_12201_database.zip
2. 檢查目前的版本
SQL> select * from v$version;
BANNER
--------------------------------------------------------------------------------
Oracle Database 11g Enterprise Edition Release 11.2.0.4.0 - 64bit Production
PL/SQL Release 11.2.0.4.0 - Production
CORE11.2.0.4.0Production
TNS for Linux: Version 11.2.0.4.0 - Production
NLSRTL Version 11.2.0.4.0 - Production
SQL> set linesize 150;
set pagesize 9999;
col comp_name format a40;
SELECT COMP_NAME, VERSION, STATUS FROM SYS.DBA_REGISTRY;SQL> SQL> SQL>
COMP_NAME VERSIONSTATUS
---------------------------------------- ------------------------------ ----------------------
OWB 11.2.0.1.0VALID
Oracle Application Express 3.2.1.00.10VALID
Oracle Enterprise Manager 11.2.0.4.0VALID
OLAP Catalog 11.2.0.4.0VALID
Spatial 11.2.0.4.0VALID
Oracle Multimedia 11.2.0.4.0VALID
Oracle XML Database 11.2.0.4.0VALID
Oracle Text 11.2.0.4.0VALID
Oracle Expression Filter 11.2.0.4.0VALID
Oracle Rules Manager 11.2.0.4.0VALID
Oracle Workspace Manager 11.2.0.4.0VALID
Oracle Database Catalog Views 11.2.0.4.0VALID
Oracle Database Packages and Types 11.2.0.4.0VALID
JServer JAVA Virtual Machine 11.2.0.4.0VALID
Oracle XDK 11.2.0.4.0VALID
Oracle Database Java Packages 11.2.0.4.0VALID
OLAP Analytic Workspace 11.2.0.4.0VALID
Oracle OLAP API 11.2.0.4.0VALID
18 rows selected.
3. 檢查磁碟空間
select a.tablespace_name, round(a.total_size) "total_size(mb)",
round(a.total_size) - round(b.free_size,3) "unsed_size(mb)",
round(b.free_size,3) "free_size(mb)",
round(b.free_size/total_size *100,2) ||‘%‘ free_rate
from
(select tablespace_name,sum(bytes) /1024/1024 total_size
from dba_data_files
group by tablespace_name) a,
(select tablespace_name,sum(bytes)/1024/1024 free_size
from dba_free_space
group by tablespace_name) b
where a.tablespace_name=b.tablespace_name(+);
4.為資料庫做冷備份
RMAN>run {
shutdown immediate;
startup mount;
allocate channel c1 type disk;
allocate channel c2 type disk;
backup full tag=‘db_full_bak‘ database format ‘/home/oracle/rmanbak/full_cold_%d_%s.bak‘;
alter database open;
}
RMAN> list backup;
資料庫正常關閉後,還需要備份Oracle主目錄,目的還是為了升級失敗時,能夠還原出資料庫軟體到升級前的版本。
重點是如下目錄:
ORACLE_HOME/dbs
ORACLE_HOME/network/admin
ORACLE_HOME/hostname_dbname
ORACLE_HOME/oc4j/j2ee/OC4J_DBConsole_hostname_dbname
[[email protected] ~]$ env|grep ORA
ORACLE_SID=orcl
ORACLE_BASE=/home/oracle/app
ORACLE_HOME=/home/oracle/app/oracle/product/11.2.0/dbhome_1
[[email protected] ~]$ tar cvf oracle.ora /home/oracle
5. 關閉資料庫執行個體及相關進程 (靜態監聽、動態監聽、EOM、相關服務)
--停止資料庫外部進程
[[email protected] ~]#ps -ef|grep -v grep |grep LOCAL=NO|awk ‘{print $2}‘|xargs kill -9
SQL> shutdown immediate;
[[email protected] rmanbak]$ cat /home/oracle/app/oracle/product/11.2.0/dbhome_1/network/admin/listener.ora
[[email protected] rmanbak]$ lsnrctl stop
[[email protected] rmanbak]$ lsnrctl status
[[email protected] rmanbak]$ ps -ef |grep ora_|grep -v grep
[[email protected] rmanbak]$ netstat -an |grep 1521
[[email protected] rmanbak]$ netstat -an |grep 1158
6. 開始升級操作
[[email protected] ~]$ cd /tmp/database
[[email protected] database]$ ./runInstaller
6.1 不勾選 , 點擊 next
注意這裡的安裝位置,我之前的安裝目錄是11.2.0.4,我新目錄是12.2.0.1.0 即將oracle 安裝到其他位置,這樣可以減少宕機時間,也是oracle 推薦的方法。
有pdksh或者ksh其中一個就行
[[email protected] ~]# rpm -qa|grep ksh
pdksh-5.2.14-1.i386
執行到78%的時候彈出如下視窗: 用 root 使用者跑這個指令碼
進度到了83%的時候,自動彈出dbua視窗
圖形化升級單機oracle 11.2.0.4 到 12.2.0.1