Oracle12c在CentOS7操作系統(tǒng)下環(huán)境搭建手冊(cè)_第1頁
Oracle12c在CentOS7操作系統(tǒng)下環(huán)境搭建手冊(cè)_第2頁
Oracle12c在CentOS7操作系統(tǒng)下環(huán)境搭建手冊(cè)_第3頁
Oracle12c在CentOS7操作系統(tǒng)下環(huán)境搭建手冊(cè)_第4頁
Oracle12c在CentOS7操作系統(tǒng)下環(huán)境搭建手冊(cè)_第5頁
已閱讀5頁,還剩63頁未讀 繼續(xù)免費(fèi)閱讀

下載本文檔

版權(quán)說明:本文檔由用戶提供并上傳,收益歸屬內(nèi)容提供方,若內(nèi)容存在侵權(quán),請(qǐng)進(jìn)行舉報(bào)或認(rèn)領(lǐng)

文檔簡(jiǎn)介

1、前言oracle DBA環(huán)境的搭建是非常重要的,我用了兩臺(tái)電腦(分別使用windows server 2003和CentOS7的操作系統(tǒng)),配置較高的電腦,筆記本和臺(tái)式機(jī)都可以,內(nèi)存至少4G,CPU不能太差,要有至少100G的硬盤空間存放虛擬機(jī),還有要求能夠有較好的網(wǎng)速下載相關(guān)的軟件,Linux操作系統(tǒng)是CentOS7-64位。下面就來介紹怎么從無到有的搭建oracle環(huán)境! 第一章 軟件下載需要下載的軟件如下CentOS下載操作系統(tǒng)用的是CentOS,載地址為最好用64位的,生產(chǎn)庫都是64位的,不過OCM考試的環(huán)境都是32位的軟件。寫文檔的時(shí)候是7.0

2、版本,區(qū)別應(yīng)該不會(huì)很大,本人選了DVD版本的,因?yàn)榈綍r(shí)候系統(tǒng)裝到一半的時(shí)候不需要反復(fù)更換盤數(shù)據(jù)庫軟件下載下載地址xmanager Enterprise3下載這個(gè)軟件一定要下載企業(yè)版的,我們主要用它的ftp功能把oracle軟件傳輸?shù)絣inxu里,還有用它的遠(yuǎn)程圖形顯示功能隨便選個(gè)下載SecureCRT下載這個(gè)軟件不用介紹了吧隨便選個(gè)下載rlwrap下載這個(gè)軟件是linux的軟件,就是命令行上下翻頁功能下載地址:http:/utopia.knoware.nl/%7Ehlub/uck/rlwrap/小節(jié)本次下載的CentOS和oracle軟件都是64位的軟件,也可以都下載32位的,但安裝的時(shí)候Ce

3、ntOS和oracle軟件要么都是32位的,要么都是64位的。由于軟件都比較大,所以用迅雷下載。如果軟件地址沒有了,請(qǐng)想其他辦法獲得軟件。下面是下載的軟件一覽第二章 安裝CentOS操作系統(tǒng)安裝操作系統(tǒng)CentOS7選英語,防止亂碼點(diǎn)Review and modify partitioning layout,就是手動(dòng)分區(qū)先刪除默認(rèn)的分區(qū)方式,默認(rèn)配置刪除干凈因?yàn)槭呛?jiǎn)單的學(xué)習(xí)環(huán)境,所以分兩個(gè)區(qū)就行了swap和/先創(chuàng)建swap分區(qū),大小為內(nèi)存的兩倍是2G剩余的容量全部分配給/配置好分區(qū)后,就可以下一步了這里要配置主機(jī)名字、IP地址、掩碼和網(wǎng)關(guān)配置eth0的ip地址開始安裝了,安裝快慢取決于電腦的配

4、置安裝完畢,重啟虛擬機(jī)因?yàn)槭菍W(xué)習(xí)機(jī),所以防火墻無需打開,SE也關(guān)閉掉,不需要KdumpCentos就安裝完成了!設(shè)置SecureCRT直接解壓SecureCRT的軟件包,雙擊SecureCRT.exe設(shè)置配置文件的路徑,最好把Config目錄配置在解壓出的文件里輸入Linux主機(jī)IP地址,創(chuàng)建連接如果提示如下窗口按下面步驟操作,若未提示直接跳過該段文字,這個(gè)是因?yàn)橹形能浖g的問題進(jìn)入Config目錄的sessions目錄這個(gè)就是SecureCRT會(huì)話的配置信息,打開它找到如下內(nèi)容把“無”改成None保存退出,再用SecureCRT連接會(huì)話的時(shí)候,不會(huì)報(bào)下面的錯(cuò)界面不是很好看,可以設(shè)置一下,點(diǎn)

5、會(huì)話選項(xiàng)這樣確實(shí)好看多了點(diǎn)擊全局選項(xiàng)不要使用右鍵粘貼功能,避免復(fù)制操作出錯(cuò)如果啟動(dòng)太慢,發(fā)現(xiàn) sendmail 會(huì)導(dǎo)致啟動(dòng)很慢,所以這里關(guān)掉此服務(wù)執(zhí)行service sendmail stop然后依次執(zhí)行chkconfig sendmail offchkconfig -list sendmail好,關(guān)閉了sendmail服務(wù)如果基本上都是用SecureCRT等遠(yuǎn)程工具來操作的話,而且不需要Linux的圖形界面,可以設(shè)置成字符界面圖形界面比較浪費(fèi)系統(tǒng)資源,改成全字符的,如果要臨時(shí)用圖形界面可以用startx命令vi /etc/inittab把id改成3,就是全字符界面保存退出即可,下次啟動(dòng)的時(shí)候

6、就生效了1、安裝依賴包 rootoracledb # yum -y install  gcc gcc-c+ make binutils compat-libstdc+-33 elfutils-libelf elfutils-libelf-devel glibc glibc-common glibc-devellibaio libaio-devel libgcc libstdc+ libstdc+-devel unixODBC unixODBC-devel此處需要配置yum源,建議使用國(guó)內(nèi)163的源。可先備份centos7的CentOS-Base.repo原始文件。然后添加如

7、下的163的centos7的源。注意,163的centos7的源里包含了centos7 dvd里全部的os的rpm包。#CentOS-Base.repo# The mirror system uses the connecting IP address of the client and the# update status of each mirror to pick mirrors that are updated to and# geographically close to the client. You should use this for CentOS updates# unle

8、ss you are manually picking other mirrors.# If the mirrorlist= does not work for you, as a fall back you can try the # remarked out baseurl= line instead.#osname=CentOS-$releasever - os - #mirrorlist=/?release=$releasever&arch=$basearch&repo=osbaseurl=gpgcheck=1gpg

9、key=file:/etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-7#released updatesupdatesname=CentOS-$releasever - Updates - #mirrorlist=/?release=$releasever&arch=$basearch&repo=updatesbaseurl=gpgcheck=1gpgkey=file:/etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-7#additional packages that may b

10、e usefulextrasname=CentOS-$releasever - Extras - #mirrorlist=/?release=$releasever&arch=$basearch&repo=extrasbaseurl=gpgcheck=1gpgkey=file:/etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-7#additional packages that may be useful#additional packages that extend functionality of

11、existing packagescentosplusname=CentOS-$releasever - Plus - #mirrorlist=/?release=$releasever&arch=$basearch&repo=centosplusbaseurl=gpgcheck=1enabled=0gpgkey=file:/etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-7#contrib - packages by Centos Userscontribname=CentOS-$releasever

12、 - Contrib - #mirrorlist=/?release=$releasever&arch=$basearch&repo=contribbaseurl=gpgcheck=1enabled=0gpgkey=file:/etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-7 安裝xmanager和rlwrap輸入序列號(hào)081129-116771-999614打開xmanager的ftp把rlwrap軟件壓縮包傳輸?shù)?root目錄下解壓軟件包tar -zxvf rlwrap-0.41.tar.gzll

13、進(jìn)入壓縮出來的文件夾rlwrap-0.41cd rlwrap-0.41./configuremakemake installrlwrap軟件安裝好之后就可以在sqlplus或者rman等命令行模式下使用上下箭頭翻頁查找執(zhí)行過的語句了之后我們會(huì)在oracle用戶下的.bash_profile后面加alias sqlplus='rlwrap sqlplus'、alias rman='rlwrap rman'等等,后面會(huì)提到的如果這里軟件安裝不上,很可能是由于缺rpm包的關(guān)系,如果是根據(jù)前面一步步來的是不會(huì)安裝不上的,我裝的時(shí)候少了readline-devel的rpm

14、包(安裝哦前還得裝一個(gè)devel包,會(huì)提示的),因此未執(zhí)行成功。設(shè)置內(nèi)核參數(shù)和其他參數(shù)vi /etc/sysctl.conf把下面的參數(shù)復(fù)制到最下面kernel.core_uses_pid = 1kernel.shmall = 2097152kernel.shmmax = 2147483648kernel.shmmni = 4096kernel.sem = 250 32000 100 128fs.file-max = 65536net.ipv4.ip_local_port_range = 1024 65000net.core.rmem_default = 1048576net.core.rme

15、m_max = 1048576net.core.wmem_default = 262144net.core.wmem_max = 262144也可以參照下圖(Oracle官方提供)的內(nèi)核參數(shù)設(shè)置:使用sysctl -p命令使內(nèi)核參數(shù)立即生效sysctl -p設(shè)置其他參數(shù)vi /etc/security/limits.conforacle soft nproc 2047oracle hard nproc 16384oracle soft nofile 1024oracle hard nofile 65536也可以參照下圖(Oracle官方提供)的其他參數(shù)設(shè)置:vi /etc/pam.d/logi

16、nsession required /lib64/security/pam_limits.sosession required pam_limits.so注意:因?yàn)槭?4位的系統(tǒng),所以一定要寫/lib64/security/pam_limits.so如果寫成/lib/security/pam_limits.so(這是32位系統(tǒng)的設(shè)置),就會(huì)在Linux本地的字符界面模式下無法登錄vi /etc/profile在profile里添加oracle環(huán)境變量if $USER = "oracle" ; then if $SHELL = "/bin/ksh" ; t

17、hen ulimit -p 16384 ulimit -n 65536 else ulimit -u 16384 -n 65536 fifi執(zhí)行source /etc/profile命令使配置生效source /etc/profile查看tmpfs大小df -lhtmpfs太小了,要設(shè)置大點(diǎn)vi /etc/fstab保存退出grep MemTotal /proc/meminfogrep SwapTotal /proc/meminfo確認(rèn)一下物理內(nèi)存和交換內(nèi)存信息設(shè)置hosts的IP地址在hosts里設(shè)置本地地址,最好用三段式vi /etc/hosts localhost lo

18、calhost.localdomain localhost4 localhost4.localdomain4:1 localhost localhost.localdomain localhost6 localhost6.localdomain606 CentOS7.localdomain CentOS7保存退出,測(cè)試一下ping CentOS7.localdomain -c 4ping CentOS7 -c 4創(chuàng)建oracle用戶組和用戶groupadd dbagroupadd oinstall創(chuàng)建兩個(gè)用戶組,一個(gè)用作oracle用戶的主組dba,另一個(gè)用作oracl

19、e用戶的輔助組oinstalluseradd -c oracle -g oinstall -G dba oraclepasswd oracle創(chuàng)建oracle用戶并設(shè)置密碼()mkdir -p /u01/oraclemkdir p /opt/oracle/app/ 將oracle安裝在/opt目錄下。此處在opt下新建oracle安裝目錄。Mkdir p /opt/oracle/oradata/ 新建oracle數(shù)據(jù)文件的存放目錄Chmod 755 /opt/oracle/ 對(duì)oracle及其子目錄設(shè)置755權(quán)限。 Chmod 775 /opt/oracle/app/ /oracle/app目

20、錄設(shè)置775權(quán)限chown -R oracle:oinstall /u01chown R oracle.oinstall /opt/oracle/ 設(shè)定oinstall組成員oracle對(duì)/opt/oracle/及子目錄有擁有權(quán)。也可以參照下圖(Oracle官方提供)的創(chuàng)建Oracle用戶:創(chuàng)建u01目錄專門放oracle文件的su - oracleoracle用戶創(chuàng)建完畢第三章 創(chuàng)建oracle數(shù)據(jù)庫安裝oracle數(shù)據(jù)庫軟件把oracle軟件傳到/u01目錄下修改軟件屬于者為oraclecd /u01#初定oracle安裝目錄為/opt/oracle/ls -lrtchown -R ora

21、cle:oinstall *chown R oracle:oinstall /opt/oracle/chmod R 755 /opt/oracle/chmod R 775 /opt/oracle/appls -lrt設(shè)置oracle環(huán)境變量su - oraclevi .bash_profileexport PATHexport TMP=/tmpexport TMPDIR=$TMP#export ORACLE_HOSTNAME=dbcloud.localdomain#export ORACLE_UNQNAME=dbcloudexport ORACLE_BASE=/u01 # export ORA

22、CLE_BASE=/opt/oracle/appexport ORACLE_SID=redpos (數(shù)據(jù)庫實(shí)例名為redpos)export ORACLE_HOME=/u01/oracle/db_1#export ORACLE_HOME=$ORACLE_BASE/dbhome_1export ORACLE_TERM=xtermexport PATH=$PATH:$ORACLE_HOME/bin:$HOME/binexport LD_LIBRARY_PATH=$ORACLE_HOME/lib:/bin:/usr/bin:/usr/local/bin:/usr/X11R6/bin/export C

23、LASSPATH=$ORACLE_HOME/JRE:$ORACLE_HOME/jlib:$ORACLE_HOME/rdbms/jlibexport DISPLAY=:0.0stty erase h保存后退出執(zhí)行注意:display后面的IP一定是自己的WINDOWS環(huán)境的客戶機(jī)的IP,需要自己改正。ORACLE_SID的值以安裝實(shí)例時(shí)輸入的實(shí)際實(shí)例名為準(zhǔn)。也可以參照下圖(Oracle官方提供)設(shè)置oracle環(huán)境變量:. .bash_profile讓參數(shù)生效解壓縮oracle軟件后綴為.gz的用如下命令:gzip -dc 10201_database_linux_x86

24、_64.cpio.gz|cpio icvdBum注意:這條命令不要去拷貝粘貼,要自己親自敲一遍。后綴為.zip的,直接解壓zip,就用unzip *.zipls -lrtcd database在windows端打開xmanager的passive來接收遠(yuǎn)程圖形雙擊它就可以了看到右下角有圖標(biāo)且是:0.0端口就行./runInstaller因?yàn)槲矣玫氖荂entOS7,因此它對(duì)最新的Oracle12c不是很支持,請(qǐng)參照如下網(wǎng)址操作:http:/oracle-Only follow these notes if you are attempting the install using

25、, there are a number of things that will need to be fixed along the way. These are not necessary for a installation, as it completes cleanly.The following steps need to be considered during the installation.· When clicking "Next" on the "Download Software Updates" s

26、creen you will get the following message. Click the "Yes" button.· "INS-13001 Environment does not meet minimum requirements.Are you sure you want to continue?· During the linking phase, you will see the following error.· Error in invoking target 'links proc gen_pcs

27、cfg procob' of makefile· '/u01/app/oracle/product//db_1/precomp/lib/ins_precomp.mk'.· See· '/u01/app/oraInventory/logs/installActions2014-04-26_08-07-04PM.log'for details.To fix it, do the following:rm -rf $ORACLE_HOME/lib/stubs/*cp $ORACLE_HOME/rdbms/lib/e

28、nv_rdbms.mk $ORACLE_HOME/rdbms/lib/env_rdbms.mk.origPerform the following modifications to the "$ORACLE_HOME/rdbms/lib/env_rdbms.mk" file.# Line 176# FROM:LINKTTLIBS=$(LLIBCLNTSH) $(ORACLETTLIBS) $(LINKLDLIBS)# TO :LINKTTLIBS=$(LLIBCLNTSH) $(ORACLETTLIBS) $(LINKLDLIBS) -lons# Line 279-280#

29、 FROM:LINK=$(FORT_CMD) $(PURECMDS) $(ORALD) $(LDFLAGS) $(COMPSOBJS)LINK32=$(FORT_CMD) $(PURECMDS) $(ORALD) $(LDFLAGS32) $(COMPSOBJS)# TO :LINK=$(FORT_CMD) $(PURECMDS) $(ORALD) $(LDFLAGS) $(COMPSOBJS) -Wl,-no-as-neededLINK32=$(FORT_CMD) $(PURECMDS) $(ORALD) $(LDFLAGS32) $(COMPSOBJS) -Wl,-no-as-needed

30、# Line 3041-3042# FROM:TG4PWD_LINKLINE= $(LINK) $(OPT) $(TG4PWDMAI) $(LLIBTHREAD) $(LLIBCLNTSH) $(LINKLDLIBS)# TO :TG4PWD_LINKLINE= $(LINK) $(OPT) $(TG4PWDMAI) $(LLIBTHREAD) $(LLIBCLNTSH) $(LINKLDLIBS) -lnnz12Click the "Retry" button.· Later, you might see the following error.· E

31、rror in invoking target 'install' of makefile · '/u01/app/oracle/product//db_1/ctx/lib/ins_ctx.mk'.· See· '/u01/app/oraInventory/logs/installActions2014-04-26_08-07-04PM.log'for details.To fix it, do the following:rm -rf $ORACLE_HOME/lib/stubs/*cp $ORAC

32、LE_HOME/ctx/lib/env_ctx.mk $ORACLE_HOME/ctx/lib/env_ctx.mk.origPerform the following modifications to the "$ORACLE_HOME/ctx/lib/env_ctx.mk" file.# Line 154# FROM:LINK=$(LDCCOM)# TO :LINK=$(LDCCOM) -Wl,-no-as-neededClick the "Retry" button.Oracle 12c的圖形化安裝過程及設(shè)置步驟如下;SYS /s1Cv0yopen

33、lab SYSTEM/s1CvoyOpen DBSNMP/s1Cv0yvirtualPDBADMIN/ s1Cv0ycom 此處設(shè)置密碼需要注意小寫字母、數(shù)字和大寫字母混合,不要用等特殊字符。當(dāng)數(shù)據(jù)庫服務(wù)器網(wǎng)絡(luò)配置為dhcp時(shí),會(huì)報(bào)告oracle net configuration assistant failed手動(dòng)配置靜態(tài)IP后,安裝檢測(cè)順利通過,另外在網(wǎng)絡(luò)配置無誤的情況下報(bào)告oracle net configuration assistant failed, 執(zhí)行/etc/init.d/network restart 即可讓檢查通過 另開一個(gè)窗口用root用戶執(zhí)行上面腳本由于“The E

34、M Express port “” is not valid. Specify a valid unused port” 錯(cuò)誤訊息的出現(xiàn),導(dǎo)致出現(xiàn)“INS-20802 Oracle Database Configuration Assistant failed.”這樣的錯(cuò)誤,最終導(dǎo)致數(shù)據(jù)庫安裝中斷。此處千萬不能忽略或跳過,否則數(shù)據(jù)庫安裝不成功。網(wǎng)絡(luò)上搜索關(guān)于此錯(cuò)誤的解決方案無果,但也查到點(diǎn)線索。仔細(xì)檢查安裝oracle數(shù)據(jù)庫的主機(jī)設(shè)置,主機(jī)用戶名(/etc/hostname文件和/etc/hosts文件)發(fā)現(xiàn)兩個(gè)文件中的主機(jī)名稱不一致。更改hostname的名稱和hosts文件中的一致,都為d

35、bcloud。使用rm R 命令刪除oracle安裝的全部文件,因?yàn)槲沂前惭b在/opt目錄下。直接刪除即可。再次重新安裝即順利完成oracle 12C的安裝。總結(jié)oracle的環(huán)境搭建完成了,接下來大家就可以開始o(jì)racle的學(xué)習(xí)了!第一次成功安裝oracle 12c后,無法執(zhí)行sqlplus以及其它任何命令。su oracle不加載環(huán)境變量,這個(gè)要注意,不然設(shè)置的環(huán)境變量不生效。使用echo $ORACLE_HOME查看為空。rootlocalhost oracle# su - oracleoraclelocalhost oracle$ sqlplus "as/sysdba&quo

36、t;-bash: sqlplus: command not foundoraclelocalhost oracle$在$ORACLE_HOME/bin下執(zhí)行sqlplus命令報(bào)告如下錯(cuò)誤:oracledbcloud $ /opt/oracle/app/dbhome_1/bin/sqlplusError 6 initializing SQL*PlusSP2-0667: Message file sp1<lang>.msb not foundSP2-0750: You may need to set ORACLE_HOME to your Oracle software directo

37、ry這個(gè)錯(cuò)誤主要在.bash_profile文件里設(shè)置oracle用戶環(huán)境變量時(shí),設(shè)置ORACLE_HOME,忘記了export下;反省一下。 Linux下安裝好Oracle 12c后運(yùn)行sqlplus出現(xiàn)故障如下:oraclelocalhost oracle$ ./sqlplusError 6 initializing SQL*PlusMessage file sp1<lang>.msb not foundSP2-0750: You may need to set ORACLE_HOME to your Oracle software directory解決方法:第一,

38、用oracle用戶名登錄linux系統(tǒng)。而不是root登錄后su oracle。第二,用oracle用戶名登錄linux系統(tǒng)后,vi .bash_profile,其中,文件.bash_profile在homeoracle目錄下,它是隱藏文件,可以ls -a 顯示所有文件(包含隱藏文件)。第三,編輯.bash_profile文件,內(nèi)容如下:# .bash_profile# Get the aliases and functionsif -f /.bashrc ; then. /.bashrcfi# User specific environment and startup programsexp

39、ort ORACLE_SID=orclexport ORACLE_BASE=/opt/oracle/appexport ORACLE_HOME=$ORACLE_BASE/dbhome_1export PATH=$PATH:$ORACLE_HOME/bin#export DISPLAY=:0.0 (需要注釋掉,否則oracle系統(tǒng)用戶無法登陸)在Linux下如何啟動(dòng)Oracle數(shù)據(jù)庫? 分為兩步:第一步:?jiǎn)?dòng)監(jiān)聽(listener); oracledbcloud $ lsnrctl startLSNRCTL for Linux: Version .0 - Pro

40、duction on 21-MAY-2015 13:39:02Copyright (c) 1991, 2014, Oracle. All rights reserved.Starting /opt/oracle/app/dbhome_1/bin/tnslsnr: please wait.TNSLSNR for Linux: Version .0 - ProductionSystem parameter file is /opt/oracle/app/dbhome_1/network/admin/listener.oraLog messages written to /opt/o

41、racle/app/diag/tnslsnr/dbcloud/listener/alert/log.xmlListening on: (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=dbcloud.localdomain)(PORT=1521)Listening on: (DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=EXTPROC1521)Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=dbcloud.localdomain)(PORT=1521)STATUS

42、 of the LISTENER注意,如遇到當(dāng)前Oracle系統(tǒng)用戶環(huán)境變量無效或設(shè)置不當(dāng)?shù)那闆r,導(dǎo)致在oracle用戶下無法執(zhí)行l(wèi)snrctl 以及sqlplus等命令,可手動(dòng)切換到實(shí)際的oracle_home/bin目錄下。然后調(diào)用sqlplus.重新啟動(dòng)系統(tǒng)并登陸到centos,切換到oracle用戶權(quán)限。# su oracleoraclelocalhost $ cd $ORACLE_HOMEoraclelocalhost db_1$ pwd/opt/oracle/app/dbhome_1oraclelocalhost db_1$ cd binoraclelocalhost bin$ p

43、wd/opt/oracle/app/dbhome_1/binoraclelocalhost bin$然后oraclelocalhost bin$ ./sqlplus "/ as sysdba"SQL*Plus: Release .0 - Production on Mon Aug 17 10:43:41 2009Copyright (c) 1982, 2005, Oracle.  All rights reserved.Connected to an idle instance.原本的畫面會(huì)變?yōu)镾QL>問題解決!我們發(fā)現(xiàn)Connec

44、ted to an idle instance.接著請(qǐng)輸入SQL> startup就可以正常的啟動(dòng)數(shù)據(jù)庫了。另外停止數(shù)據(jù)庫的指令如下:SQL> shutdown immediate第二步,啟動(dòng)數(shù)據(jù)庫實(shí)例。1、首先進(jìn)入sqlplus、連接到sysdbaSQL> conn /as sysdbaConnected to an idle instance.SQL>3、啟動(dòng)數(shù)據(jù)庫實(shí)例如果關(guān)閉數(shù)據(jù)庫實(shí)例,則使用如下程序。)、關(guān)閉數(shù)據(jù)庫實(shí)例SQL> shutdown immediate        

45、;                                  Database closed.Database dismounted.ORACLE instance shut down.)、退出sqlplusOracl SQL> exitDisc

46、onnected from Oracle Database 12c Enterprise Edition Release .0 - 64bit ProductionWith the Partitioning, OLAP, Advanced Analytics and Real Application Testing options3)、停止監(jiān)聽器oracledbcloud $ lsnrctl stopLSNRCTL for Linux: Version .0 - Production on 21-MAY-2015 14:00:50Copyright (c) 19

47、91, 2014, Oracle. All rights reserved.Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=dbcloud.localdomain)(PORT=1521)The command completed successfully如何用dbstart 啟動(dòng)和停止oracle 數(shù)據(jù)庫實(shí)例呢?、 首先采用lsnrctl start啟動(dòng)監(jiān)聽器、 運(yùn)行dbstart命令會(huì)提示:oracledbcloud $ dbstartORACLE_HOME_LISTNER is not SET, unable to auto-

48、start Oracle Net ListenerUsage: /opt/oracle/app/dbhome_1/bin/dbstart ORACLE_HOME但此處報(bào)錯(cuò),是因?yàn)閐bstart和dbshut腳本文件中ORACLE_HOME_LISTNER的設(shè)置有問題。dbstart腳本,該腳本放在$ORACLE_HOME/bin下面。搜索dbstart里面的tnslsnr:oracledbcloud bin$ grep tnslsnr dbstart if -x $ORACLE_HOME_LISTNER/bin/tnslsnr ; thenecho "Failed to auto-s

49、tart Oracle Net Listener using $ORACLE_HOME_LISTNER/bin/tnslsnr"返回結(jié)果中發(fā)現(xiàn)有$ORACLE_HOME_LISTNER變量,有可能是該變量的路徑不對(duì),我們繼續(xù)搜索ORACLE_HOME_LISTNER grep ORACLE_HOME_LISTNER dbstart oracledbcloud bin$ grep ORACLE_HOME_LISTNER dbstart# The Listener log is located at $ORACLE_HOME_LISTNER/listener.logORACLE

50、_HOME_LISTNER=$1if ! $ORACLE_HOME_LISTNER ; then echo "ORACLE_HOME_LISTNER is not SET, unable to auto-start Oracle Net Listener" LOG=$ORACLE_HOME_LISTNER/listener.log ORACLE_HOME=$ORACLE_HOME_LISTNER ; export ORACLE_HOME if -x $ORACLE_HOME_LISTNER/bin/tnslsnr ; then $ORACLE_HOME_LISTNER/bi

51、n/lsnrctl start >> $LOG 2>&1 & VER10LIST=$ORACLE_HOME_LISTNER/bin/lsnrctl version | grep "LSNRCTL for " | cut -d' ' -f5 | cut -d'.' -f1 echo "Failed to auto-start Oracle Net Listener using $ORACLE_HOME_LISTNER/bin/tnslsnr" $LOGMSG "Restart Or

52、acle Net Listener using an alternate ORACLE_HOME_LISTNER:"設(shè)置ORACLE_HOME_LISTNER在$ORACLE_HOME/bin下。用vi分別編輯dbstart和dbshut腳本。將dbstart 和dbshut腳本中的ORACLE_HOME_LISTNER=$1修改為ORACLE_HOME_LISTNER=$ORACLE_HOME命令如下:oracledbcloud $ vi $ORACLE_HOME/bin/dbstartoracledbcloud $ vi $ORACLE_HOME/bin/dbshut修改后保存退

53、出,問題解決然后保存退出,此時(shí)再運(yùn)行dbstart,已經(jīng)不報(bào)錯(cuò)了,但是沒有任何反應(yīng),ps一下進(jìn)程,沒有oracle的進(jìn)程,說明oracle實(shí)例沒有正常啟動(dòng)。此時(shí)的原因是在/etc/oratab的設(shè)置問題,我們cat一下,發(fā)現(xiàn)# Multiple entries with the same $ORACLE_SID are not allowed.#orcl:/opt/oracle/app/dbhome_1:N最后設(shè)置的是"N"(我的環(huán)境中只有一個(gè)實(shí)例,因此只有一行配置語句),我們需要把“N”修改為“Y”。以上的工作做好之后,dbstart就可以正常使用了.oracledbcl

54、oud /$ dbstartProcessing Database instance "orcl": log file /opt/oracle/app/dbhome_1/startup.logoracledbcloud /$ dbshutProcessing Database instance "orcl": log file /opt/oracle/app/dbhome_1/shutdown.log oracledbcloud /$ lsnrctl stopLSNRCTL for Linux: Version .0 - Producti

55、on on 21-MAY-2015 15:06:54Copyright (c) 1991, 2014, Oracle. All rights reserved.Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=dbcloud.localdomain)(PORT=1521)The command completed successfullyoracledbcloud bin$Oracle在linux下不會(huì)自動(dòng)啟動(dòng),若要實(shí)現(xiàn)自動(dòng)啟動(dòng),還需要做一些腳本配置。 在 /etc/init.d/ 下創(chuàng)建文件oracle,內(nèi)容如下:#!/bin/sh# c

溫馨提示

  • 1. 本站所有資源如無特殊說明,都需要本地電腦安裝OFFICE2007和PDF閱讀器。圖紙軟件為CAD,CAXA,PROE,UG,SolidWorks等.壓縮文件請(qǐng)下載最新的WinRAR軟件解壓。
  • 2. 本站的文檔不包含任何第三方提供的附件圖紙等,如果需要附件,請(qǐng)聯(lián)系上傳者。文件的所有權(quán)益歸上傳用戶所有。
  • 3. 本站RAR壓縮包中若帶圖紙,網(wǎng)頁內(nèi)容里面會(huì)有圖紙預(yù)覽,若沒有圖紙預(yù)覽就沒有圖紙。
  • 4. 未經(jīng)權(quán)益所有人同意不得將文件中的內(nèi)容挪作商業(yè)或盈利用途。
  • 5. 人人文庫網(wǎng)僅提供信息存儲(chǔ)空間,僅對(duì)用戶上傳內(nèi)容的表現(xiàn)方式做保護(hù)處理,對(duì)用戶上傳分享的文檔內(nèi)容本身不做任何修改或編輯,并不能對(duì)任何下載內(nèi)容負(fù)責(zé)。
  • 6. 下載文件中如有侵權(quán)或不適當(dāng)內(nèi)容,請(qǐng)與我們聯(lián)系,我們立即糾正。
  • 7. 本站不保證下載資源的準(zhǔn)確性、安全性和完整性, 同時(shí)也不承擔(dān)用戶因使用這些下載資源對(duì)自己和他人造成任何形式的傷害或損失。

最新文檔

評(píng)論

0/150

提交評(píng)論