oracle手動(dòng)升級(jí)有兩種方式,一種在安裝oracle軟件之后,安裝升級(jí)包,然后創(chuàng)建數(shù)據(jù)庫(kù);另一種在oracle數(shù)據(jù)庫(kù)創(chuàng)建以后,進(jìn)行升級(jí)。

成都創(chuàng)新互聯(lián)成立與2013年,先為江陵等服務(wù)建站,江陵等地企業(yè),進(jìn)行企業(yè)商務(wù)咨詢服務(wù)。為江陵企業(yè)網(wǎng)站制作PC+手機(jī)+微官網(wǎng)三網(wǎng)同步一站式服務(wù)解決您的所有建站問(wèn)題。
下面主要介紹oracle數(shù)據(jù)庫(kù)創(chuàng)建后進(jìn)行的數(shù)據(jù)庫(kù)升級(jí)(10.2.0.1-10.2.0.4),代碼如下:
SQL --查看當(dāng)前數(shù)據(jù)庫(kù)版本
SQL select * from v$version;
SQL --給用戶scott解鎖
SQL alter user scott account unlock;
SQL --查看表空間
SQL select * from dba_tablespaces;
SQL --查看數(shù)據(jù)文件存放位置
SQL select * from dba_data_files;
SQL --創(chuàng)建測(cè)試表空間
SQL create tablespace ts_upgrade datafile '/u02/oradata/data/orcl/ts_upgrade01.dbf' size 5m autoextend on maxsize 30g;
SQL --創(chuàng)建用戶
SQL create user u_upgrade identified by "123456" default tablespace ts_upgrade temporary tablespace temp;
SQL --為用戶賦權(quán)
SQL grant connect,resource to u_upgrade;
SQL --創(chuàng)建測(cè)試表
SQL create table u_upgrade.dept as select * from scott.dept;
SQL select * from u_upgrade.dept;
[oracle@feegle ~]$ #停止em
[oracle@feegle ~]$ emctl stop dbconsole
[oracle@feegle ~]$ #停止sql*plus
[oracle@feegle ~]$ isqlplusctl stop
[oracle@feegle ~]$ #停止監(jiān)聽
[oracle@feegle ~]$ lsnrctl stop
[oracle@feegle ~]$ #安裝升級(jí)包(p6810189_10204_Linux-x86-64.zip)
[oracle@feegle ~]$ #手動(dòng)升級(jí)數(shù)據(jù)庫(kù)
[oracle@feegle ~]$ sqlplus /nolog
SQL conn /as sysdba
SQL --以升級(jí)模式啟動(dòng)數(shù)據(jù)庫(kù)
SQL startup upgrade;
SQL --重建數(shù)據(jù)字典(建議關(guān)閉數(shù)據(jù)庫(kù)歸檔)
SQL spool upgrade.log
SQL @$ORACLE_HOME/rdbms/admin/catupgrd.sql
#####重建數(shù)據(jù)字典部分截圖#####
Oracle Database 10.2 Upgrade Status Utility 06-15-2012 18:27:56
.
Component Status Version HH:MM:SS
Oracle Database Server VALID 10.2.0.4.0 00:12:04
JServer JAVA Virtual Machine VALID 10.2.0.4.0 00:04:58
Oracle XDK VALID 10.2.0.4.0 00:00:32
Oracle Database Java Packages VALID 10.2.0.4.0 00:00:28
Oracle Text VALID 10.2.0.4.0 00:00:25
Oracle XML Database VALID 10.2.0.4.0 00:02:25
Oracle Workspace Manager VALID 10.2.0.4.3 00:00:43
Oracle Data Mining VALID 10.2.0.4.0 00:00:21
OLAP Analytic Workspace VALID 10.2.0.4.0 00:00:23
OLAP Catalog VALID 10.2.0.4.0 00:01:02
Oracle OLAP API VALID 10.2.0.4.0 00:00:53
Oracle interMedia VALID 10.2.0.4.0 00:03:52
Spatial VALID 10.2.0.4.0 00:01:37
Oracle Expression Filter VALID 10.2.0.4.0 00:00:12
Oracle Enterprise Manager VALID 10.2.0.4.0 00:01:18
Oracle Rule Manager VALID 10.2.0.4.0 00:00:10
.
Total Upgrade Time: 00:31:30
DOC#######################################################################
DOC#######################################################################
DOC
DOC The above PL/SQL lists the SERVER components in the upgraded
DOC database, along with their current version and status.
DOC
DOC Please review the status and version columns and look for
DOC any errors in the spool log file. If there are errors in the spool
DOC file, or any components are not VALID or not the current version,
DOC consult the Oracle Database Upgrade Guide for troubleshooting
DOC recommendations.
DOC
DOC Next shutdown immediate, restart for normal operation, and then
DOC run utlrp.sql to recompile any invalid application objects.
DOC
DOC#######################################################################
DOC#######################################################################
DOC#
SQL
#####重建數(shù)據(jù)字典部分截圖#####
SQL spool off
SQL --關(guān)閉數(shù)據(jù)庫(kù)
SQL shutdown immediate;
SQL --啟動(dòng)數(shù)據(jù)庫(kù)
SQL startup;
SQL --編譯無(wú)效對(duì)象
SQL @$ORACLE_HOME/rdbms/admin/utlrp.sql
#####編譯無(wú)效對(duì)象部分截圖#####
DOC 1. Query showing jobs created by UTL_RECOMP
DOC SELECT job_name FROM dba_scheduler_jobs
DOC WHERE job_name like 'UTL_RECOMP_SLAVE_%';
DOC
DOC 2. Query showing UTL_RECOMP jobs that are running
DOC SELECT job_name FROM dba_scheduler_running_jobs
DOC WHERE job_name like 'UTL_RECOMP_SLAVE_%';
DOC#
TIMESTAMP
--------------------------------------------------------------------------------
COMP_TIMESTAMP UTLRP_END 2012-06-15 18:45:01
DOC The following query reports the number of objects that have compiled
DOC with errors (objects that compile with errors have status set to 3 in
DOC obj$). If the number is higher than expected, please examine the error
DOC messages reported with each object (using SHOW ERRORS) to see if they
DOC point to system misconfiguration or resource constraints that must be
DOC fixed before attempting to recompile these objects.
DOC#
OBJECTS WITH ERRORS
-------------------
DOC The following query reports the number of errors caught during
DOC recompilation. If this number is non-zero, please query the error
DOC messages in the table UTL_RECOMP_ERRORS to see if any of these errors
DOC are due to misconfiguration or resource constraints that must be
DOC fixed before objects can compile successfully.
DOC#
ERRORS DURING RECOMPILATION
---------------------------
SQL
#####編譯無(wú)效對(duì)象部分截圖#####
SQL 驗(yàn)證升級(jí)
SQL --查看組件狀態(tài)
SQL --status=VALID
SQL select comp_name, version, status from sys.dba_registry;
SQL --查看表空間狀態(tài)
SQL select tablespace_name,status from dba_tablespaces;
SQL --查看用戶
SQL select username from dba_users;
SQL --查看用戶對(duì)象
SQL select object_name from dba_objects where owner='SCOTT';
SQL select object_name from dba_objects where owner='U_UPGRADE';
SQL select * from v$version;
BANNER
----------------------------------------------------------------
Oracle Database 10g Enterprise Edition Release 10.2.0.4.0 - 64bi
PL/SQL Release 10.2.0.4.0 - Production
CORE 10.2.0.4.0 Production
TNS for Linux: Version 10.2.0.4.0 - Production
NLSRTL Version 10.2.0.4.0 - Production
[oracle@feegle ~]$ #啟動(dòng)監(jiān)聽
[oracle@feegle ~]$ lsnrctl start
[oracle@feegle ~]$ #啟動(dòng)EM
[oracle@feegle ~]$ emctl start dbconsole
[oracle@feegle ~]$ #啟動(dòng)SQL*PLUS
[oracle@feegle ~]$ isqlplusctl start
首先 準(zhǔn)備安裝需要的軟件包和補(bǔ)丁包: 用rpm qa│grep pat 查看系統(tǒng)中是否安有以下幾個(gè)軟件包 pat libstdc++ pat gcc c++ pat libstdc++ devel pat db pat gcc nss_db pat i rpm rpm qa │ grep openmotif查看下列軟件包 openmotif rpm qa │ grep setarch查看: setarch 以上文件如果沒(méi)有的話 在RHEL 的CD 和CD 上有相關(guān)的RPM包 使用: # rpm i pat i rpm 命令來(lái)安裝相應(yīng)的包 從網(wǎng)上下載升級(jí)補(bǔ)丁包 用于將Oracle 升級(jí)到 : p _ _LINUX zip 所有的補(bǔ)丁說(shuō)明如下 p _ _LINUX zip 的升級(jí)補(bǔ)丁包 p _ _LINUX zip 在運(yùn)行 runInstaller 之前打 p _ _LINUX zip 在升級(jí)到 之后打 p _ _GENERIC zip 打 補(bǔ)丁所需要的補(bǔ)丁 第二 準(zhǔn)備安裝過(guò)程中需要的用戶和用戶組 在安裝的過(guò)程中我們使用兩個(gè)用戶同時(shí)進(jìn)行 其中一個(gè)是root用戶 另外一個(gè)是你新建立的oracle用戶 打開一個(gè)終端 以root用戶登錄或者是 su # groupadd oinstall # groupadd dba # useradd g oinstall G dba oracle # passwd oracle第三 安裝準(zhǔn)備步驟 準(zhǔn)備文件目錄 # mkdir p /opt/ora /product/ # mkdir /var/opt/oracle # chown oracle dba /var/opt/oracle # chown R oracle dba /opt/ora 設(shè)置內(nèi)核參數(shù) 調(diào)節(jié)信號(hào)燈及共享內(nèi)存 # echo /proc/sys/kernel/sem # echo /proc/sys/kernel/shmmax # echo /proc/sys/kernel/shmmni # echo /proc/sys/kernel/shmall # echo /proc/sys/fs/file max # echo /proc/sys/net/ipv /ip_local_port_range當(dāng)然為了一開機(jī)系統(tǒng)就能自動(dòng)幫你設(shè)好這些參數(shù) 也可改動(dòng) /etc/nf 這個(gè)文件 加入以下的語(yǔ)句 kernel shmmax = kernel shmmni = kernel shmall = kernel sem = fs file max = net ipv ip_local_port_range = 設(shè)置oracle對(duì)文件的要求 編輯文件 /etc/security/nf 加入以下語(yǔ)句 oracle soft nofile oracle hard nofile oracle soft nproc oracle hard nproc 設(shè)置系統(tǒng)環(huán)境 首先設(shè)置root用戶這個(gè)終端的 export ORACLE_BASE=/opt/ora export ORACLE_HOME=/opt/ora /product/ (Oracle被安裝在這些位置) 這個(gè)步驟用來(lái)最后打補(bǔ)丁時(shí)使用 注意這個(gè)終端要保持不要關(guān)掉它 設(shè)置oracle用戶的環(huán)境 新開一個(gè)終端 su oracle 注意一定要新開一個(gè)打開 bash profile文件 將如下內(nèi)容加入 #oracle i export ORACLE_BASE=/opt/ora export ORACLE_HOME=/opt/ora /product/ export PATH=$ORACLE_HOME/bin:$ORACLE_HOME/Apache/Apache/bin:$PATH export ORACLE_OWNER=oracle export ORACLE_SID=ora i export ORACLE_TERM=vt export LD_ASSUME_KERNEL= export THREADS_FLAG=native export LD_LIBRARY_PATH=/opt/ora /product/ /lib:$LD_LIBRARY_PATH export PATH=/opt/ora /product/ /bin:$PATH # # change this NLS settings to suit your country: # example: # german_germany we iso p american_america we iso p etc # export LANG=en_US 保存后退出 然后 退出登錄 再次進(jìn)入 這時(shí)候oracle的環(huán)境就已經(jīng)生效了 解壓文件 安裝前打補(bǔ)丁 切換到root用戶的控制臺(tái) 第四 開始正式安裝 cd /home mkdir ora i cd ora i 這些目錄你可以自己定義 用來(lái)存放安裝文件 然后將從網(wǎng)上下載的三個(gè)Oracle 的安裝文件拷到這里 解gz文件 gunzip gunzip lnx_ _disk cpio gz gunzip lnx_ _disk cpio gz gunzip lnx_ _disk cpio gz 釋放cpio文件 cpio idmv lnx_ _disk cpio cpio idmv lnx_ _disk cpio cpio idmv lnx_ _disk cpio //這個(gè)步驟將生成三個(gè)文件夾 DISK DISK DISK 打安裝前的補(bǔ)丁 以root身份運(yùn)行 這也是在/home/ora i/里進(jìn)行的 # unzip p _ _LINUX zip Archive: p _ _LINUX zip creating: / inflating: /rhel _pre_install sh inflating: /README txt# cd # sh rhel _pre_install sh 完成Oracle的安裝 新開一個(gè)控制終端(用root用戶開) #xhost + 這個(gè)命令用來(lái)保證oracle用戶調(diào)用X 否則無(wú)法安裝 我看過(guò)的所有的文檔里都沒(méi)有提到 結(jié)果害得我在這個(gè)地方憋了兩個(gè)小時(shí)才搞定#su oracle 在登錄終端中切換到oracle用戶 在oracle主目錄里運(yùn)行:/home/ora i/Disk /runInstaller注意的是以下幾點(diǎn): 第一 在RedHat Advance Server 下安裝Oracle i不用將gcc降級(jí) 有些文檔里說(shuō)需要將gcc降為 其實(shí)是不需要的 第二 在部分文檔里 要求oracle用戶的bash profile文件中降LD_ASSUME_KERNEL設(shè)置為 千萬(wàn)不要這樣設(shè)置 否則會(huì)在Rlink時(shí)會(huì)有一大堆報(bào)錯(cuò) 第三 安裝Oracle不需要額外安裝JDK Oracle自己帶 第四 再安裝過(guò)程中 系統(tǒng)會(huì)提醒你用root身份去執(zhí)行兩個(gè)sh文件 再root的登錄終端中按提示操作就可以了 第五 Relink階段 會(huì)出兩個(gè)錯(cuò)誤:ins_oemagent mk 和 ins_ctx mk 點(diǎn) Ignore 忽略 第六 注意在安裝過(guò)程中不要?jiǎng)?chuàng)建數(shù)據(jù)庫(kù) 如果創(chuàng)建了也沒(méi)有關(guān)系在升級(jí)之前將它給刪除掉(不過(guò)裝了再刪是不是有點(diǎn)麻煩?干脆不創(chuàng)建數(shù)據(jù)庫(kù)了)上面這幾點(diǎn)害得我郁悶死了!!!!!!!!一定要注意啊!!!!第五 開始升級(jí)Oracle 安裝結(jié)束后 HTTPD會(huì)自動(dòng)運(yùn)行 在升級(jí)之前 需要將它停下來(lái) $ cd $ORACLE_HOME/Apache/Apache/bin $ /apachectl stop /apachectl stop: d stoppedLISTENER也需要停下來(lái) $ lsnrctl stop LSNRCTL for Linux: Version Production on NOV : : Copyright (c) Oracle Corporation All rights reserved Connecting to (ADDRESS=(PROTOCOL=tcp)(PORT= )) The mand pleted successfully注意: 如果不停的話 oracle會(huì)提示不能覆蓋文件 這個(gè)時(shí)候再去將服務(wù)停下來(lái)也可以 點(diǎn)Retry就可以了 開始打補(bǔ)丁升級(jí) 注意打補(bǔ)丁時(shí)使用root用戶 切換到root用戶控制臺(tái) 解包: $ unzip p _ _LINUX zip Archive: p _ _LINUX zip inflating: _lnx _release cpio inflating: l inflating: patchnote css$ cat _lnx _release cpio │ cpio i make directories做完這個(gè)后 再切換到oracle用戶控制臺(tái) 再次運(yùn)行/home/ora i/Disk /runInstaller升級(jí) 注意必須先選擇最下面的安裝選項(xiàng) 安裝OUI 要不然沒(méi)有辦法打那個(gè)最上面的升級(jí)補(bǔ)丁 升級(jí)完OUI后 要退出 再次運(yùn)行/home/ora i/Disk /runInstaller 選擇第一個(gè)選項(xiàng) 將Oracle升級(jí)到 這時(shí)候還是會(huì)有一個(gè)錯(cuò)誤出現(xiàn) 再次選擇忽略它 打其它的補(bǔ)丁 切換到root的終端 注意這個(gè)最好是原來(lái)那個(gè)保持了ORACLE_HOME ORACLE_BASE的環(huán)境變量那個(gè)終端 修復(fù)ins_oemagent mk錯(cuò)誤 首先安裝 opatch $ unzip p _ _GENERIC zip Archive: p _ _GENERIC zip creating: OPatch/ creating: OPatch/docs/ inflating: Opatch/docs/FAQ inflating: README txt $ ls $ pwd /home/or i lishixinzhi/Article/program/Oracle/201311/17747
1、分別解壓“winx64_12c_database_1of2.zip“和“winx64_12c_database_2of2.zip”,將其放在同一個(gè)文件夾上
2、點(diǎn)擊“setup.exe”進(jìn)行正式安裝
3、這里需要注意一下,需要取消“我希望通過(guò)My Oracle Support接受安全更新”的勾選(不取消的話以后會(huì)莫名其妙進(jìn)行重新安裝的)
4、軟件更新,直接跳過(guò)即可
5、默認(rèn)狀態(tài)即可,點(diǎn)擊“下一步”
6、根據(jù)介紹選擇”桌面類”還是”服務(wù)器類”,選擇”服務(wù)器類”可以進(jìn)行高級(jí)的配置,這里直接默認(rèn)狀態(tài)即可
7、”創(chuàng)建新windows用戶“,輸入用戶名和口令,單擊”下一步“
當(dāng)前題目:oracle怎么升級(jí)補(bǔ)丁 oracle版本升級(jí)方法
本文鏈接:http://www.jbt999.com/article20/hgceco.html
成都網(wǎng)站建設(shè)公司_創(chuàng)新互聯(lián),為您提供虛擬主機(jī)、企業(yè)網(wǎng)站制作、企業(yè)建站、做網(wǎng)站、動(dòng)態(tài)網(wǎng)站、關(guān)鍵詞優(yōu)化
聲明:本網(wǎng)站發(fā)布的內(nèi)容(圖片、視頻和文字)以用戶投稿、用戶轉(zhuǎn)載內(nèi)容為主,如果涉及侵權(quán)請(qǐng)盡快告知,我們將會(huì)在第一時(shí)間刪除。文章觀點(diǎn)不代表本網(wǎng)站立場(chǎng),如需處理請(qǐng)聯(lián)系客服。電話:028-86922220;郵箱:[email protected]。內(nèi)容未經(jīng)允許不得轉(zhuǎn)載,或轉(zhuǎn)載時(shí)需注明來(lái)源: 創(chuàng)新互聯(lián)