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

下載本文檔

版權(quán)說(shuō)明:本文檔由用戶(hù)提供并上傳,收益歸屬內(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的硬盤(pán)空間存放虛擬機(jī),還有要求能夠有較好的網(wǎng)速下載相關(guān)的軟件,Linux操作系統(tǒng)是CentOS7-64位。下面就來(lái)介紹怎么從無(wú)到有的搭建oracle環(huán)境! 第一章 軟件下載需要下載的軟件如下CentOS下載操作系統(tǒng)用的是CentOS,載地址為最好用64位的,生產(chǎn)庫(kù)都是64位的,不過(guò)OCM考試的環(huán)境都是32位的軟件。寫(xiě)文檔的時(shí)候是7.0版本,區(qū)別應(yīng)該不會(huì)很大,本人選了DVD版

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

3、的,要么都是64位的。由于軟件都比較大,所以用迅雷下載。如果軟件地址沒(méi)有了,請(qǐng)想其他辦法獲得軟件。下面是下載的軟件一覽第二章 安裝CentOS操作系統(tǒng)安裝操作系統(tǒng)CentOS7選英語(yǔ),防止亂碼點(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地址開(kāi)始安裝了,安裝快慢取決于電腦的配置安裝完畢,重啟虛擬機(jī)因?yàn)槭菍W(xué)習(xí)機(jī),所以

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

5、使用右鍵粘貼功能,避免復(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)程工具來(lái)操作的話(huà),而且不需要Linux的圖形界面,可以設(shè)置成字符界面圖形界面比較浪費(fèi)系統(tǒng)資源,改成全字符的,如果要臨時(shí)用圖形界面可以用startx命令vi /etc/inittab把id改成3,就是全字符界面保存退出即可,下次啟動(dòng)的時(shí)候就生效了1、安裝依賴(lài)包rootoracl

6、edb # 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的源??上葌浞輈entos7的CentOS-Base.repo原始文件。然后添加如下的163的centos7的源。注意,163的centos7的源

7、里包含了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# unless you are manually picking othe

8、r 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=/centos/7.1.1503/os/x86_64/gpgcheck=1gpgkey=file:/etc/pki/rpm-gpg/RPM-GPG-KEY-Ce

9、ntOS-7#released updatesupdatesname=CentOS-$releasever - Updates - #mirrorlist=/?release=$releasever&arch=$basearch&repo=updatesbaseurl=/centos/7.1.1503/updates/x86_64/gpgcheck=1gpgkey=file:/etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-7#additional packages that may be usefulextrasname=CentOS-$releasever - Ext

10、ras - #mirrorlist=/?release=$releasever&arch=$basearch&repo=extrasbaseurl=/centos/7.1.1503/extras/x86_64/gpgcheck=1gpgkey=file:/etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-7#additional packages that may be useful#additional packages that extend functionality of existing packagescentosplusname=CentOS-$release

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

12、rch=$basearch&repo=contribbaseurl=/centos/7.1.1503/updates/x86_64/gpgcheck=1enabled=0gpgkey=file:/etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-7 安裝xmanager和rlwrap輸入序列號(hào)081129-116771-999614打開(kāi)xmanager的ftp把rlwrap軟件壓縮包傳輸?shù)?root目錄下解壓軟件包tar -zxvf rlwrap-0.41.tar.gzll進(jìn)入壓縮出來(lái)的文件夾rlwrap-0.41cd rlwrap-0.41./configuremakem

13、ake installrlwrap軟件安裝好之后就可以在sqlplus或者rman等命令行模式下使用上下箭頭翻頁(yè)查找執(zhí)行過(guò)的語(yǔ)句了之后我們會(huì)在oracle用戶(hù)下的.bash_profile后面加alias sqlplus=rlwrap sqlplus、alias rman=rlwrap rman等等,后面會(huì)提到的如果這里軟件安裝不上,很可能是由于缺rpm包的關(guān)系,如果是根據(jù)前面一步步來(lái)的是不會(huì)安裝不上的,我裝的時(shí)候少了readline-devel的rpm包(安裝哦前還得裝一個(gè)devel包,會(huì)提示的),因此未執(zhí)行成功。設(shè)置內(nèi)核參數(shù)和其他參數(shù)vi /etc/sysctl.conf把下面的參數(shù)復(fù)制到

14、最下面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.rmem_max = 1048576net.core.wmem_default = 262144net.core.wmem_max = 262144

15、也可以參照下圖(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/loginsession required /lib64/security/pam_limits.sosession required pam_lim

16、its.so注意:因?yàn)槭?4位的系統(tǒng),所以一定要寫(xiě)/lib64/security/pam_limits.so如果寫(xiě)成/lib/security/pam_limits.so(這是32位系統(tǒng)的設(shè)置),就會(huì)在Linux本地的字符界面模式下無(wú)法登錄vi /etc/profile在profile里添加oracle環(huán)境變量if $USER = oracle ; then if $SHELL = /bin/ksh ; then ulimit -p 16384 ulimit -n 65536 else ulimit -u 16384 -n 65536 fifi執(zhí)行source /etc/profile命令使配

17、置生效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 localhost.localdomain localhost4 localhost4.localdomain4:1 localhost localhost.localdomain localhost6 loca

18、lhost6.localdomain606 CentOS7.localdomain CentOS7保存退出,測(cè)試一下ping CentOS7.localdomain -c 4ping CentOS7 -c 4創(chuàng)建oracle用戶(hù)組和用戶(hù)groupadd dbagroupadd oinstall創(chuàng)建兩個(gè)用戶(hù)組,一個(gè)用作oracle用戶(hù)的主組dba,另一個(gè)用作oracle用戶(hù)的輔助組oinstalluseradd -c oracle -g oinstall -G dba oraclepasswd oracle創(chuàng)建oracle用戶(hù)并設(shè)置密碼()mkdir -p /u01/oraclemkdir p

19、/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目錄設(shè)置775權(quán)限chown -R oracle:oinstall /u01chown R oracle.oinstall /opt/oracle/ 設(shè)定oinstall組成員oracle對(duì)/opt/oracle/及子目錄有擁有權(quán)。也

20、可以參照下圖(Oracle官方提供)的創(chuàng)建Oracle用戶(hù):創(chuàng)建u01目錄專(zhuān)門(mén)放oracle文件的su - oracleoracle用戶(hù)創(chuàng)建完畢第三章 創(chuàng)建oracle數(shù)據(jù)庫(kù)安裝oracle數(shù)據(jù)庫(kù)軟件把oracle軟件傳到/u01目錄下修改軟件屬于者為oraclecd /u01#初定oracle安裝目錄為/opt/oracle/ls -lrtchown -R oracle:oinstall *chown R oracle:oinstall /opt/oracle/chmod R 755 /opt/oracle/chmod R 775 /opt/oracle/appls -lrt設(shè)置oracle

21、環(huán)境變量su - oraclevi .bash_profileexport PATHexport TMP=/tmpexport TMPDIR=$TMP#export ORACLE_HOSTNAME=dbcloud.localdomain#export ORACLE_UNQNAME=dbcloudexport ORACLE_BASE=/u01 # export ORACLE_BASE=/opt/oracle/appexport ORACLE_SID=redpos (數(shù)據(jù)庫(kù)實(shí)例名為redpos)export ORACLE_HOME=/u01/oracle/db_1#export ORACLE_HO

22、ME=$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 CLASSPATH=$ORACLE_HOME/JRE:$ORACLE_HOME/jlib:$ORACLE_HOME/rdbms/jlibexport DISPLAY=:0.0stty erase h保存后退出執(zhí)行注意:display后

23、面的IP一定是自己的WINDOWS環(huán)境的客戶(hù)機(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_64.cpio.gz|cpio icvdBum注意:這條命令不要去拷貝粘貼,要自己親自敲一遍。后綴為.zip的,直接解壓zip,就用unzip *.zipls -lrtcd database在windows端打開(kāi)xmanager的passive來(lái)接收遠(yuǎn)程

24、圖形雙擊它就可以了看到右下角有圖標(biāo)且是:0.0端口就行./runInstaller因?yàn)槲矣玫氖荂entOS7,因此它對(duì)最新的Oracle12c不是很支持,請(qǐng)參照如下網(wǎng)址操作: HYPERLINK /articles/12c/oracle-db-12cr1-installation-on-oracle-linux-7.php /articles/12c/oracle-db-12cr1-installation-on-oracle-linux-7.phpOnly follow these notes if you are attempting the install using , there a

25、re 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 screen you will get the following message. Click t

26、he 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_pcscfg procob of makefile/u01/app/oracle/product/db_1/precomp/lib/ins_precomp.mk.See/u01/app/ora

27、Inventory/logs/installActions2014-04-26_08-07-04PM.logfor details.To fix it, do the following:rm -rf $ORACLE_HOME/lib/stubs/*cp $ORACLE_HOME/rdbms/lib/env_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#

28、FROM:LINKTTLIBS=$(LLIBCLNTSH) $(ORACLETTLIBS) $(LINKLDLIBS)# TO :LINKTTLIBS=$(LLIBCLNTSH) $(ORACLETTLIBS) $(LINKLDLIBS) -lons# Line 279-280# FROM:LINK=$(FORT_CMD) $(PURECMDS) $(ORALD) $(LDFLAGS) $(COMPSOBJS)LINK32=$(FORT_CMD) $(PURECMDS) $(ORALD) $(LDFLAGS32) $(COMPSOBJS)# TO :LINK=$(FORT_CMD) $(PUR

29、ECMDS) $(ORALD) $(LDFLAGS) $(COMPSOBJS) -Wl,-no-as-neededLINK32=$(FORT_CMD) $(PURECMDS) $(ORALD) $(LDFLAGS32) $(COMPSOBJS) -Wl,-no-as-needed# Line 3041-3042# FROM:TG4PWD_LINKLINE= $(LINK) $(OPT) $(TG4PWDMAI) $(LLIBTHREAD) $(LLIBCLNTSH) $(LINKLDLIBS)# TO :TG4PWD_LINKLINE= $(LINK) $(OPT) $(TG4PWDMAI)

30、$(LLIBTHREAD) $(LLIBCLNTSH) $(LINKLDLIBS) -lnnz12Click the Retry button.Later, you might see the following error.Error 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.logfor details.To fix it, do

31、 the following:rm -rf $ORACLE_HOME/lib/stubs/*cp $ORACLE_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的

32、圖形化安裝過(guò)程及設(shè)置步驟如下;SYS /s1Cv0yopenlab SYSTEM/s1CvoyOpen DBSNMP/s1Cv0yvirtualPDBADMIN/ s1Cv0ycom 此處設(shè)置密碼需要注意小寫(xiě)字母、數(shù)字和大寫(xiě)字母混合,不要用等特殊字符。當(dāng)數(shù)據(jù)庫(kù)服務(wù)器網(wǎng)絡(luò)配置為dhcp時(shí),會(huì)報(bào)告oracle net configuration assistant failed手動(dòng)配置靜態(tài)IP后,安裝檢測(cè)順利通過(guò),另外在網(wǎng)絡(luò)配置無(wú)誤的情況下報(bào)告oracle net configuration assistant failed, 執(zhí)行/etc/init.d/network restart 即可讓檢查

33、通過(guò) 另開(kāi)一個(gè)窗口用root用戶(hù)執(zhí)行上面腳本由于“The EM 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ù)庫(kù)安裝中斷。此處千萬(wàn)不能忽略或跳過(guò),否則數(shù)據(jù)庫(kù)安裝不成功。網(wǎng)絡(luò)上搜索關(guān)于此錯(cuò)誤的解決方案無(wú)果,但也查到點(diǎn)線(xiàn)索。仔細(xì)檢查安裝oracle數(shù)據(jù)庫(kù)的主機(jī)設(shè)置,主機(jī)用戶(hù)名(/etc/hostname文件和/etc/hosts文件)發(fā)現(xiàn)兩個(gè)文件中的主機(jī)名稱(chēng)不一致

34、。更改hostname的名稱(chēng)和hosts文件中的一致,都為dbcloud。使用rm R 命令刪除oracle安裝的全部文件,因?yàn)槲沂前惭b在/opt目錄下。直接刪除即可。再次重新安裝即順利完成oracle 12C的安裝??偨Y(jié)oracle的環(huán)境搭建完成了,接下來(lái)大家就可以開(kāi)始o(jì)racle的學(xué)習(xí)了!第一次成功安裝oracle 12c后,無(wú)法執(zhí)行sqlplus以及其它任何命令。su oracle不加載環(huán)境變量,這個(gè)要注意,不然設(shè)置的環(huán)境變量不生效。使用echo $ORACLE_HOME查看為空。rootlocalhost oracle# su - oracleoraclelocalhost oracl

35、e$ sqlplus as/sysdba-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.msb not foundSP2-0750: You may need to set ORACLE_HOME to your Oracle software d

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

37、linux系統(tǒng)。而不是root登錄后su oracle。第二,用oracle用戶(hù)名登錄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 programsexport ORACLE_S

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

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/oracle/app/diag/tnslsnr/dbcloud/listen

40、er/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 of the LISTENER注意,如遇到當(dāng)前Oracle系統(tǒng)用戶(hù)環(huán)境變

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

42、ocalhost bin$然后oraclelocalhost bin$ ./sqlplus / as sysdbaSQL*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à)面會(huì)變?yōu)镾QL問(wèn)題解決!我們發(fā)現(xiàn)Connected to an idle instance.接著請(qǐng)輸入SQL startup就可以正常的啟動(dòng)數(shù)據(jù)庫(kù)了。另外停止數(shù)據(jù)庫(kù)的指令如下:SQL shu

43、tdown immediate第二步,啟動(dòng)數(shù)據(jù)庫(kù)實(shí)例。1、首先進(jìn)入sqlplus、連接到sysdbaSQL conn /as sysdbaConnected to an idle instance.SQL3、啟動(dòng)數(shù)據(jù)庫(kù)實(shí)例如果關(guān)閉數(shù)據(jù)庫(kù)實(shí)例,則使用如下程序。)、關(guān)閉數(shù)據(jù)庫(kù)實(shí)例SQL shutdown immediateDatabase closed.Database dismounted.ORACLE instance shut down.)、退出sqlplusOracl SQL exitDisconnected from Oracle Database 12c Enterprise Edit

44、ion Release .0 - 64bit ProductionWith the Partitioning, OLAP, Advanced Analytics and Real Application Testing options3)、停止監(jiān)聽(tīng)器oracledbcloud $ lsnrctl stopLSNRCTL for Linux: Version .0 - Production on 21-MAY-2015 14:00:50Copyright (c) 1991, 2014, Oracle. All rights reserved.Connecting to (DESCRIPTION=

45、(ADDRESS=(PROTOCOL=TCP)(HOST=dbcloud.localdomain)(PORT=1521)The command completed successfully如何用dbstart 啟動(dòng)和停止oracle 數(shù)據(jù)庫(kù)實(shí)例呢?首先采用lsnrctl start啟動(dòng)監(jiān)聽(tīng)器運(yùn)行dbstart命令會(huì)提示:oracledbcloud $ dbstartORACLE_HOME_LISTNER is not SET, unable to auto-start Oracle Net ListenerUsage: /opt/oracle/app/dbhome_1/bin/dbstart

46、ORACLE_HOME但此處報(bào)錯(cuò),是因?yàn)閐bstart和dbshut腳本文件中ORACLE_HOME_LISTNER的設(shè)置有問(wèn)題。dbstart腳本,該腳本放在$ORACLE_HOME/bin下面。搜索dbstart里面的tnslsnr:oracledbcloud bin$ grep tnslsnr dbstart if -x $ORACLE_HOME_LISTNER/bin/tnslsnr ; thenecho Failed to auto-start Oracle Net Listener using $ORACLE_HOME_LISTNER/bin/tnslsnr返回結(jié)果中發(fā)現(xiàn)有$ORA

47、CLE_HOME_LISTNER變量,有可能是該變量的路徑不對(duì),我們繼續(xù)搜索ORACLE_HOME_LISTNERgrep ORACLE_HOME_LISTNER dbstart oracledbcloud bin$ grep ORACLE_HOME_LISTNER dbstart# The Listener log is located at $ORACLE_HOME_LISTNER/listener.logORACLE_HOME_LISTNER=$1if ! $ORACLE_HOME_LISTNER ; then echo ORACLE_HOME_LISTNER is not SET, u

48、nable 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/bin/lsnrctl start $LOG 2&1 & VER10LIST=$ORACLE_HOME_LISTNER/bin/lsnrctl version | grep LSNRCTL for |

49、cut -d -f5 | cut -d. -f1 echo Failed to auto-start Oracle Net Listener using $ORACLE_HOME_LISTNER/bin/tnslsnr $LOGMSG Restart Oracle 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

50、_HOME_LISTNER=$ORACLE_HOME命令如下:oracledbcloud $ vi $ORACLE_HOME/bin/dbstartoracledbcloud $ vi $ORACLE_HOME/bin/dbshut修改后保存退出,問(wèn)題解決然后保存退出,此時(shí)再運(yùn)行dbstart,已經(jīng)不報(bào)錯(cuò)了,但是沒(méi)有任何反應(yīng),ps一下進(jìn)程,沒(méi)有oracle的進(jìn)程,說(shuō)明oracle實(shí)例沒(méi)有正常啟動(dòng)。此時(shí)的原因是在/etc/oratab的設(shè)置問(wèn)題,我們cat一下,發(fā)現(xiàn)# Multiple entries with the same $ORACLE_SID are not allowed.#orcl

51、:/opt/oracle/app/dbhome_1:N最后設(shè)置的是N(我的環(huán)境中只有一個(gè)實(shí)例,因此只有一行配置語(yǔ)句),我們需要把“N”修改為“Y”。以上的工作做好之后,dbstart就可以正常使用了.oracledbcloud /$ dbstartProcessing Database instance orcl: log file /opt/oracle/app/dbhome_1/startup.logoracledbcloud /$ dbshutProcessing Database instance orcl: log file /opt/oracle/app/dbhome_1/shut

52、down.log oracledbcloud /$ lsnrctl stopLSNRCTL for Linux: Version .0 - Production 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$Ora

53、cle在linux下不會(huì)自動(dòng)啟動(dòng),若要實(shí)現(xiàn)自動(dòng)啟動(dòng),還需要做一些腳本配置。 在 /etc/init.d/ 下創(chuàng)建文件oracle,內(nèi)容如下:#!/bin/sh# chkconfig: 35 80 10# description: Oracle auto start-stop script.# Set ORA_HOME to be equivalent to the $ORACLE_HOME# from which you wish to execute dbstart and dbshut;# Set ORA_OWNER to the user id of the owner of the#

54、Oracle database in ORA_HOME.ORA_HOME=/opt/oracle/app/dbhome_1ORA_OWNER=oracleLOGFILE=/var/log/oracle.logif ! -f $ORA_HOME/bin/dbstart then echo Oracle startup: cannot start exitficase $1 instart)# Start the Oracle databases:echo Starting Oracle Databases . echo - /var/log/oracledate + %T %a %D : Sta

55、rting Oracle Databases as part of system up. /var/log/oracleecho - /var/log/oraclesu - $ORA_OWNER -c $ORA_HOME/bin/dbstart /var/log/oracleecho Done# Start the Listener:echo Starting Oracle Listeners . echo - /var/log/oracledate + %T %a %D : Starting Oracle Listeners as part of system up. /var/log/or

56、acleecho - /var/log/oraclesu - $ORA_OWNER -c $ORA_HOME/bin/lsnrctl start /var/log/oracleecho Done.echo - /var/log/oracledate + %T %a %D : Finished. /var/log/oracleecho - /var/log/oracletouch /var/lock/subsys/oracle;stop)# Stop the Oracle Listener:echo Stoping Oracle Listeners . echo - /var/log/oracl

57、edate + %T %a %D : Stoping Oracle Listener as part of system down. /var/log/oracleecho - /var/log/oraclesu - $ORA_OWNER -c $ORA_HOME/bin/lsnrctl stop /var/log/oracleecho Done.rm -f /var/lock/subsys/oracle# Stop the Oracle Database:echo Stoping Oracle Databases . echo - /var/log/oracledate + %T %a %D

58、 : Stoping Oracle Databases as part of system down. /var/log/oracleecho - /var/log/oraclesu - $ORA_OWNER -c $ORA_HOME/bin/dbshut /var/log/oracleecho Done.echo echo - /var/log/oracledate + %T %a %D : Finished. /var/log/oracleecho - /var/log/oracle;restart)$0 stop$0 start;esac3. 改變文件權(quán)限# chmod 755 /etc

59、/init.d/oracle4. 添加服務(wù)# chkconfig -level 35 oracle on5. 需要在關(guān)機(jī)或重啟機(jī)器之前停止數(shù)據(jù)庫(kù),做一下操作# ln -s /etc/init.d/oracle /etc/rc0.d/K01oracle /關(guān)機(jī)# ln -s /etc/init.d/oracle /etc/rc6.d/K01oracle /重啟 6. 使用方法# service oracle start /啟動(dòng)oracle# service oracle stop /關(guān)閉oracle# service oracle restart /重啟oracle附錄資料:不需要的可以自行刪除

60、 Oracle10g在AIX上的安裝準(zhǔn)備工作Oracle For Aix安裝1:安裝Oracle10.2的最基本要求硬件: 64位 內(nèi)存與交換區(qū) 硬盤(pán)空間:除數(shù)據(jù)外,Oracle軟件本身至少需要3G 軟件: 操作系統(tǒng): AIX 5L version 5.2, Maintenance Level 04 or later , or AIX 5L version 5.3, Maintenance Level 02 or later. AIX的軟件包:o bos.adt.baseo bos.adt.libo bos.adt.libmo bos.perf.libperfstato bos.perf.pe

溫馨提示

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

評(píng)論

0/150

提交評(píng)論