--==========================================
-- 使用 OEM,SQL*Plus,iSQL*Plus 管理 Oracle 實(shí)例
--==========================================
/*
一、管理組件
??? Oracle 10g 數(shù)據(jù)庫(kù)管理包含三個(gè)組件 , 本文主要介紹 Database Control,SQL*Plus 及 iSQL*Plus
??? ?? Database instance( 數(shù)據(jù)庫(kù)實(shí)例 ) ? --> 系統(tǒng)使用的后臺(tái)進(jìn)程
??? ?? Listener ( 監(jiān)聽(tīng)器 ) ???? ????????? --> 監(jiān)聽(tīng)客戶端連接到數(shù)據(jù)庫(kù)
??? ?? Management interfance
??? ?????? Database Control ?????????? -->OEM
?????? ?? Management agent (when using Grid Control) ? -- 網(wǎng)格管理
二、使用 OEM 管理 Oracle ????? ??
??? 1. 關(guān)于 OEM : Oracle 從 i 開(kāi)始就隨軟件提供企業(yè)管理器( OEM )
??? ??? 在 g 中, oracle 在 dbca 建庫(kù)過(guò)程中會(huì)出現(xiàn)四個(gè)用戶: sys,system,dbsnap,sysman
?????? (--dbsnap 用戶用于 OEM 智能代理管理工作, sysman 用戶則是 OEM 的管理員帳號(hào))
?????? 如果在 dbca 建庫(kù)過(guò)程中沒(méi)有選擇安裝 OEM, 則沒(méi)有 dbsnap 和 sysman 用戶,如果在 dbca 建庫(kù)時(shí)選擇啟用 database control 管理數(shù)據(jù)庫(kù),
?????? 則需要在數(shù)據(jù)庫(kù)中建立一個(gè) sysman 的 schema ,用于保存 OEM 的一些數(shù)據(jù),這個(gè)就是 OEM 的資料檔案庫(kù)( repository) ,在 G 版本中,
?????? 這個(gè)庫(kù)存儲(chǔ)在 sysaux 表空間中
??????
??? 2.OEM 的啟動(dòng)和關(guān)閉
??? 啟動(dòng): emctl start dbconsole ?? 啟動(dòng)后用瀏覽器 http://IP:1158/em ?? 來(lái)登陸 OEM ,進(jìn)行圖形化操作數(shù)據(jù)庫(kù)
?????? 關(guān)閉: emctl stop dbconsole
?????? 狀態(tài): emctl status dbconsole ???????????????????? */
?????? -- 下面演示 EM 啟動(dòng)到停止的過(guò)程
?????? [oracle@robinson scripts]$ emctl start dbconsole ? -- 啟動(dòng)
??????? 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://robinson.com:1158/em/console/aboutApplication
??????? Starting Oracle Enterprise Manager 10g Database Control ...................... started.
??????? ------------------------------------------------------------------
??????? Logs are generated in directory /u01/app/oracle/10g/robinson.com_orcl/sysman/log
??????? [oracle@robinson scripts]$ emctl status dbconsole ??? -- 查看狀態(tài)
??????? 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://robinson.com:1158/em/console/aboutApplication
??????? Oracle Enterprise Manager 10g is running.
??????? ------------------------------------------------------------------
??????? Logs are generated in directory /u01/app/oracle/10g/robinson.com_orcl/sysman/log
??????? [oracle@robinson scripts]$ emctl stop dbconsole ????? -- 停止
??????? 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://robinson.com:1158/em/console/aboutApplication
??????? Stopping Oracle Enterprise Manager 10g Database Control ...
??????? ... ? Stopped.
??????? /*
???????
??? 3. 重建 OEM
由于 EM 需要 J2EE 環(huán)境支持,正常創(chuàng)建后,在 $ORACLE_HOME 目錄下將會(huì)建立一個(gè)
類似 $ORACLE_HOME/oc4j/j2ee/OC4J_DBConsole_<hostname>_<sid> 的目錄,如果此目錄不存在,則 EM 將無(wú)法啟動(dòng)。
另外,如果服務(wù)器修改過(guò)主機(jī)名等信息,導(dǎo)致 OEM 可能無(wú)法啟動(dòng),此時(shí)需要重新配置 EM 。 ???
??????? 使用 emca 命令來(lái)重建 EM 檔案庫(kù),關(guān)于 emca 的用戶,使用 emca -h 來(lái)查看詳細(xì)說(shuō)明 */
??????
?????? [oracle@robinson scripts]$ emca - config dbcontrol db - repos recreate
?
?????? STARTED EMCA at Apr 21, 2010 3:09:04 PM
?????? EM Configuration Assistant, Version 10.2.0.1.0 Production
?????? Copyright (c) 2003, 2005, Oracle. ? All rights reserved.
?
?????? Enter the following information:
?????? Database SID: orcl
?????? Database Control is already configured for the database orcl
?????? You have chosen to configure Database Control for managing the database orcl
?????? This will remove the existing configuration and the default settings and perform a fresh configuration
?????? Do you wish to continue? [yes(Y)/no(N)]: y
?????? Listener port number: 1521
?????? Password for SYS user: ?
?????? Password for DBSNMP user: ?
?????? Password for SYSMAN user: ?
?????? Email address for notifications (optional):
?????? Outgoing Mail (SMTP) server for notifications (optional):
?????? -----------------------------------------------------------------
?
?????? You have specified the following settings
?
?????? Database ORACLE_HOME ................ /u01/app/oracle/10g
?
?????? Database hostname ................ robinson.com
?????? Listener port number ................ 1521
?????? Database SID ................ orcl
?????? Email address for notifications ...............
?????? Outgoing Mail (SMTP) server for notifications ...............
?
?????? -----------------------------------------------------------------
?????? Do you wish to continue? [yes(Y)/no(N)]: y
?????? Apr 21, 2010 3:09:24 PM oracle.sysman.emcp.EMConfig perform
?????? INFO: This operation is being logged at /u01/app/oracle/10g/cfgtoollogs/emca/orcl/emca_2010-04-21_03-09-04-PM.log.
?????? Apr 21, 2010 3:09:25 PM oracle.sysman.emcp.util.DBControlUtil stopOMS
?????? INFO: Stopping Database Control (this may take a while) ...
?????? Apr 21, 2010 3:09:32 PM oracle.sysman.emcp.EMReposConfig dropRepository
?????? INFO: Dropping the EM repository (this may take a while) ...
?????? Apr 21, 2010 3:11:41 PM oracle.sysman.emcp.EMReposConfig invoke
?????? INFO: Repository successfully dropped
?????? Apr 21, 2010 3:11:41 PM oracle.sysman.emcp.EMReposConfig createRepository
?????? INFO: Creating the EM repository (this may take a while) ...
?????? Apr 21, 2010 3:16:01 PM oracle.sysman.emcp.EMReposConfig invoke
?????? INFO: Repository successfully created
?????? Apr 21, 2010 3:16:08 PM oracle.sysman.emcp.util.DBControlUtil startOMS
?????? INFO: Starting Database Control (this may take a while) ...
?????? Apr 21, 2010 3:17:55 PM oracle.sysman.emcp.EMDBPostConfig performConfiguration
?????? INFO: Database Control started successfully
?????? Apr 21, 2010 3:17:55 PM oracle.sysman.emcp.EMDBPostConfig performConfiguration
?????? INFO: >>>>>>>>>>> The Database Control URL is http://robinson.com:1158/em <<<<<<<<<<<
?????? Enterprise Manager configuration completed successfully
?????? FINISHED EMCA at Apr 21, 2010 3:17:55 PM
?????? [oracle@robinson scripts]$ emctl status dbconsole
?????? 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://robinson.com:1158/em/console/aboutApplication
?????? Oracle Enterprise Manager 10g is running.
?????? ------------------------------------------------------------------
?????? Logs are generated in directory /u01/app/oracle/10g/robinson.com_orcl/sysman/log
?????? /*
?????? 注意:如果啟動(dòng) EM 有問(wèn)題,確保監(jiān)聽(tīng)器已經(jīng)啟動(dòng)
?????? 打開(kāi)瀏覽器,使用 sysman 用戶登陸,也可以使用 sys 用戶登陸,當(dāng)使用 sys 用戶登陸時(shí),注意幾點(diǎn):
?????? a. 口令文件存在并配置正常
?????? b. 監(jiān)聽(tīng)啟動(dòng)
?????? c.remote_login_passwordfile 設(shè)置不能為 NONE
?????? 重建 EM 成功后, ORACLE 主要?jiǎng)?chuàng)建的相關(guān)目錄有個(gè),分別是 :
??????? a.$ORACLE_HOME/oc4j/j2ee/OC4J_DBConsole_<hostname>_<sid>
??????? b.$ORACLE_HOME/<hostname>_<sid>
??????
??? 4. 查看默認(rèn)的端口號(hào) ?? ?? */
??? ?? [oracle@robinson scripts]$ cat $ORACLE_HOME/install/portlist.ini
??????? iSQL*Plus HTTP port number =5560
??????? Enterprise Manager Console HTTP Port (orcl) = 1158
??????? Enterprise Manager Agent Port (orcl) = 3938
??? ? /* ???
??????
??? 5. 建議
??? ??? OEM 管理和維護(hù)直觀簡(jiǎn)單,但并不建議使用 OEM 來(lái)進(jìn)行管理,因?yàn)? JAVA 的界面通常消耗的資源較多,
?????? 加上網(wǎng)絡(luò)連接的因素, OEM 界面很容易失去響應(yīng),從而可能導(dǎo)致很多意外,通過(guò)命令行操作可以讓
?????? 我們更加熟悉 ORACLE 的本質(zhì),又可以減少低級(jí)的意外錯(cuò)誤。
?
三、使用 SQL*Plus 及 iSQL*Plus 管理 Oracle
??? SQL*Plus 及 iSQL*Plus 同樣可以完成 Oracle 的管理工作,能夠通過(guò)命令的方式來(lái)執(zhí)行查詢,更新,刪除等操作
??????
??? 1.SQL*Plus 使用相關(guān)賬戶登陸到到實(shí)例,啟動(dòng)數(shù)據(jù)庫(kù),完成相關(guān)的管理任務(wù) ? */
? ?? ? [oracle@robinson scripts]$ sqlplus / as sysdba
?
????? SQL*Plus: Release 10.2.0.1.0 - Production on Wed Apr 21 15:38:54 2010
?
????? Copyright (c) 1982, 2005, Oracle. ? All rights reserved.
?
???? Connected to:
???? Oracle Database 10g Enterprise Edition Release 10.2.0.1.0 - Production
???? With the Partitioning, OLAP and Data Mining options
?
???? SQL> ?
??? ? /*
??? ?
??? 2.iSQL*Plus( 從 i 開(kāi)始出現(xiàn)的基于 web 的 sqlplus 工具 )
????? 10g 下 iSQL*Plus 的啟動(dòng)與關(guān)閉
????? 啟動(dòng): isqlplusctl start
??? ? 關(guān)閉: isqlplusctl stop ??????????????????? */
??? ? [oracle@robinson scripts]$ isqlplusctl start
????? perl: warning: Setting locale failed.
????? perl: warning: Please check that your locale settings:
????????? LANGUAGE = (unset),
????????? LC_ALL = (unset),
????????? LANG = "en"
????? are supported and installed on your system.
????? perl: warning: Falling back to the standard locale ("C").
????? iSQL*Plus 10.2.0.1.0
????? Copyright (c) 2003, 2005, Oracle. ? All rights reserved.
????? Starting iSQL*Plus ...
????? iSQL*Plus started.
?
??? ? [oracle@robinson scripts]$ isqlplusctl stop
????? perl: warning: Setting locale failed.
????? perl: warning: Please check that your locale settings:
????????? LANGUAGE = (unset),
????????? LC_ALL = (unset),
????????? LANG = "en"
????? are supported and installed on your system.
???? perl: warning: Falling back to the standard locale ("C").
???? iSQL*Plus 10.2.0.1.0
???? Copyright (c) 2003, 2005, Oracle. ? All rights reserved.
???? Stopping iSQL*Plus ...
???? iSQL*Plus stopped.
?
????? /*
??? ? 修改 iSQL*Plus 默認(rèn)端口號(hào)
??? ? [oracle@robinson scripts]$ cat $ORACLE_HOME/oc4j/j2ee/isqlplus/config/http-web-site.xml |grep 5560
????? <web-site port="5560" display-name="OC4J Java HTTP Web Site"> ? -- 將改為其他端口號(hào)即可
??? ?
??? ? 啟動(dòng) isqlplus, 然后通過(guò)瀏覽器登陸 http://IP:5560/isqlplus
??? ? 注意:默認(rèn)情況下, sysdba 用戶無(wú)法通過(guò) isqlplus 登陸 ?
??? ?
四、更多 ??????? */
?
???
??? Oralce 10g 使用 DBCA 創(chuàng)建數(shù)據(jù)庫(kù)
???
??? 使用 Uniread 實(shí)現(xiàn) SQLplus 翻頁(yè)功能
???
??? Linux (RHEL 5.4) 下安裝 Oracle 10g R2
???
??? VmWare6.5.2 下安裝 RHEL 5.4 (配置 Oracle 安裝環(huán)境)
???
??? Oracle 相關(guān)
?
??? Oracle 實(shí)例和 Oracle 數(shù)據(jù)庫(kù) (Oracle 體系結(jié)構(gòu) )
??? ??
?
?
更多文章、技術(shù)交流、商務(wù)合作、聯(lián)系博主
微信掃碼或搜索:z360901061

微信掃一掃加我為好友
QQ號(hào)聯(lián)系: 360901061
您的支持是博主寫(xiě)作最大的動(dòng)力,如果您喜歡我的文章,感覺(jué)我的文章對(duì)您有幫助,請(qǐng)用微信掃描下面二維碼支持博主2元、5元、10元、20元等您想捐的金額吧,狠狠點(diǎn)擊下面給點(diǎn)支持吧,站長(zhǎng)非常感激您!手機(jī)微信長(zhǎng)按不能支付解決辦法:請(qǐng)將微信支付二維碼保存到相冊(cè),切換到微信,然后點(diǎn)擊微信右上角掃一掃功能,選擇支付二維碼完成支付。
【本文對(duì)您有幫助就好】元
