灵魂腐蚀 发表于 2015-1-16 22:38:38

MYSQL网页编程之Oracle 9i Installation on Red Hat Li...

甚至一个有经验的Windows管理者也可以轻松部署并开始学习它,而你不需投入一分钱来了解这个数据库。oracle


1,Uncompressandunpackdownloadedfiles



Onestepprocedure(useslessdiskspaceandisfaster):
zcatlnx_920_disk1.cpio.gz|cpio-idmv
zcatlnx_920_disk2.cpio.gz|cpio-idmv
zcatlnx_920_disk3.cpio.gz|cpio-idmv

Twostepprocedure:
#Uncompress
gunziplnx_920_disk1.cpio.gzlnx_920_disk2.cpio.gzlnx_920_disk3.cpio.gzLinux9i_Disk3.cpio.gz
#Unpackthedownloadedfiles:
cpio-idmv<lnx_920_disk1.cpio
cpio-idmv<lnx_920_disk2.cpio
cpio-idmv<lnx_920_disk3.cpio



Nowyoushouldhave3directoriescontaininginstallationfiles:
Disk1
Disk2
Disk3



2,Swapspace

InordertoperformatypicalOracle9iinstallationandtocreateasimpleprototypedatabase,Oraclesaysthatyouneedaminimumof512MBofRAMfortheOracle9i(9.0.1)Server,andtheamountofdiskspace(swapspace)shouldbeequaltotwicetheamountofRAMoratleast400MB,whicheverisgreater.

Checkyourmemorybyexecuting:
grepMemTotal/proc/meminfo

Checkswapspacebyexecuting:
cat/proc/swapsorswaponCs

Youcanalsoaddtemporaryswapspacebycreatingatemporaryswapfileinsteadofusingarawdevice.Hereistheprocedure:

Asroot:
ddif=/dev/zeroof=tmpswapbs=1kcount=900000
chmod600tmpswap
mkswaptmpswap
swapontmpswap

Todisablethetemporaryswapspaceexecutethefollowingcommands:

Asroot:
swapofftmpswap
rmtmpswap

3,SharedMemory

Iincreasedtheshmmaxsettingforthekernelbyexecutingthefollowingcommand:

Asroot:
#cat/proc/sys/kernel/shmmax
33554432
#echo`expr1024*1024*1024`>/proc/sys/kernel/shmmax



ItisrecommendedtoincreasetheshmmaxsettingpermanentlyforOracle.Soifyouwanttoincreasethemaximumsharedmemorysizepermanently,addthefollowinglinetothe/etc/sysctl.conffile:
kernel.shmmax=1073741824

4,/tmpSpace

TheOracleUniversalInstallerrequiresupto400MBoffreespaceinthe/tmpdirectory.Ifyoudonothaveenoughspaceinthe/tmpdirectory,youcantemporarilycreateatmpdirectoryinanotherfilesystem.Hereishowyoucandothis:

Asroot:
mkdir/<AnotherFilesystem>/tmp
chownroot.root/<AnotherFilesystem>/tmp
chmod1777/<AnotherFilesystem>/tmp
exportTEMP=/<AnotherFilesystem>/tmp#usedbyOracle
exportTMPDIR=/<AnotherFilesystem>/tmp#usedbyLinuxprogramslikethelinker"ld"

WhenyouaredonewithyourOracleinstallation,shutdownOracleandremovethetemporarydirectory:
rmdir/<AnotherFilesystem>/tmp
unsetTEMP
unsetTMPDIR

5,OracleDiskSpace

Youwillneedabout2.5GBforthedatabasesoftware.Ifyouperformatypicaldatabaseinstallationandnotacustomizeddatabaseinstallation,thenyouwillneedabout3.5GBofdiskspace.

6,"binutils"Issue(ifyoufondfollowingerror)

Q:"Errorinvokingtargetinstallofmakefile/opt/oracle/product/9.0.1/plsql/lib/ins_plsql.mk"

A:Thisobviatestheneedtochangebinutils

downloadthefollowingbinutilRPMversionanddowngradebinutilontheOracleserver:
ftp://ftp.redhat.com/pub/redhat/linux/7.0/en/os/i386/RedHat/RPMS/binutils-2.10.0.18-1.i386.rpm
Asroot:
rpm-Uvh--force--nodepsbinutils-2.10.0.18-1.i386.rpm
WhenyouaredonewiththeOracleinstallation,youupgradeyourbinutilRPMbacktotheversionyouhadbeforeyoudowngraded:
E.g.onaRedHat7.2server:
rpm-Uvh--force--nodepsbinutils-2.11.90.0.8-9.i386.rpm

7,DevelopmentPackages(RPMs)

YouwillneedthefollowingRPMdevelopmentpackagesfortheOracleinstallertocompiletheOraclemodulesetc.:
gcc
cpp
glibc-devel
compat-libstdc++
kernel-headers(onRH7.1,7.2,2.1AS)
glibc-kernheaders(onRH7.3,8.0)
binutils

Otherwiseyoullgetanerrormessagelike:
Errorininvokingtargetntcontab.oofmakefile/opt/oracle/product/9.2.0/network/lib/ins_net_client.mk

Tofindoutifyouhavethesedevelopmentpackagesinstalled,executethefollowingcommand:
#rpm-qgcccppglibc-develkernel-headersbinutils

8,JDK

IsuccessfullyinstalledOracle9iR2withoutinstallingJDKonthesystem.OraclecomesnowwithitsownJava.ThismeansthatyoudonthavetofollowthesestepswhichwererequiredforolderOracleversions:

DownloadJDK1.3.1orBlackdown1.1.8_v3:(IusuallyusedBlackdown)
http://www.blackdown.org
http://java.sun.com

AccordingtoJDKdocumentation,installJDKunder/usr/local.
ThencreateasymboliclinktotheJDKunder/usr/local/java:

Asroot:
bzip2-dcjdk118_v3-glibc-2.1.3.tar.bz2|tarxf--C/usr/local
ln-s/usr/local/jdk118_v3/usr/local/java

9,CreateOracleUserAccounts

Asroot:

groupadddba
groupaddoinstall
useradd-goinstall-Gdbaoracle
passwdoracle

Oinstallisnotneededwhenthesamepeoplewillbemaintainingthesoftwareandthedatabase.Inthissituation,itwillcreatemoreworkandaddanextralayerofcomplexitytothemaintenanceoftheinstallation.

Recommendation:ifyoudontneedtheoinstallgroupforaddedsecurity,
justinstallusingthedbagroup.

10,CreateOracleDirectories

Inthisexample,makesurethatthe/optfilesystemislargeenough.If/optisnotonaseparatefilesystem,thenmakesuretherootfilesystem"/"hasenoughspace.

Asroot:

mkdir/opt/oracle
mkdir/opt/oracle/product
mkdir/opt/oracle/product/9.2.0
chown-Roracle.oinstall/opt/oracle

mkdir/var/opt/oracle
chownoracle.dba/var/opt/oracle
chmod755/var/opt/oracle

11,SetOracleEnvironments

SetthefollowingOracleenvironmentvariablesbeforeyoustartrunInstaller.

Astheoracleuserexecutethefollowingcommands:

#OracleEnvironment
exportORACLE_BASE=/opt/oracle
exportORACLE_HOME=/opt/oracle/product/9.2.0
exportORACLE_SID=test
exportORACLE_TERM=xterm
#exportTNS_ADMIN=Setifsqlnet.ora,tnsnames.ora,etc.arenotin$ORACLE_HOME/network/admin
exportNLS_LANG=AMERICAN#exportNLS_LANG=AMERICAN_AMERICA.ZHS16GBK;(ifyouuseChinese)
exportORA_NLS33=$ORACLE_HOME/ocommon/nls/admin/data
LD_LIBRARY_PATH=$ORACLE_HOME/lib:/lib:/usr/lib
LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/local/lib
exportLD_LIBRARY_PATH

#Setshellsearchpaths
exportPATH=$PATH:$ORACLE_HOME/bin

#IsuccessfullyinstalledOracle9iR2WITHOUTsettingthefollowingCLASSPATHenvironmentvariable:
CLASSPATH=$ORACLE_HOME/JRE:$ORACLE_HOME/jlib:$ORACLE_HOME/rdbms/jlib
CLASSPATH=$CLASSPATH:$ORACLE_HOME/network/jlib
exportCLASSPATH

exportTMPDIR=/tmp

Youcanputtheseenvironmentsettingsattheendofthe~oracle/.bash_profilefileifyouusebash.

12,StartrunInstaller

Oraclenolongersupportsacharactermodeinstaller.Therefore,inordertoexecuterunInstallerdirectlyfromaconsoleofamachineyouareloggedinto(inthisexamplethenodenamewhereOracleisrunningiscalled"oracleserver"),youneedtosettheDISPLAYenvironmentvariable.

FromtheconsoleofyourOracleserver"oracleserver"youareloggedinto,executethefollowingcommandasuser"oracle":
oracleserver:oracle$exportDISPLAY=yourlocalIP:0.0

13,RunningOracleInstallation

ThisishowIansweredthequestionsintherunInstaller:

Whatwouldyoulikeasthebasedirectory(InventoryLocation):
/opt/oracle/oraInventory

UNIXGroupName(permissionforupdatingOraclesoftware):
oinstall
Youcouldalsouse"dba"whichIdonotrecommendforsecurityreasons.(refertostep9)

FullpathnameforOracleHome:
/opt/oracle/product/9.2.0

OracleHomeName:
OUIHome

14,YoumightgetthefollowinginstallationproblemswhenyouinstallOracle9i(9.2.0):

lFirstcheckalwaystheerrorlogsin/tmp/OraInstallfor9.2.0,e.g/tmp/OraInstall2002-07-04_09-50-19PM,andin/tmp/OraInstallfor9.0.1.Whenyougetmakeproblemscheckalso$ORACLE_HOME/install/make.log.



lQ:"Errorininvokingtargetinstallofmakefile/opt/oracle/product/9.2.0/ctx/lib/ins_ctx.mk"

A:Edit$ORACLE_HOME/ctx/lib/env_ctx.mkandgoto"INSO_LINK=",adda"$(LDLIBFLAG)dl"tothelineandsaveit.

Hereisthefulllinewiththeadded"$(LDLIBFLAG)dl"flag:
INSO_LINK=-L$(CTXLIB)$(LDLIBFLAG)m$(LDLIBFLAG)dl$(LDLIBFLAG)sc_ca$(LDLIBFLAG)sc_fa$(LDLIBFLAG)sc_ex$(LDLIBFLAG)sc_da$(LDLIBFLAG)sc_ut$(LDLIBFLAG)sc_ch$(LDLIBFLAG)sc_fi$(LLIBCTXHX)$(LDLIBFLAG)c-Wl,-rpath,$(CTXHOME)lib$(CORELIBS)$(COMPEOBJS)

lQ:"Errorinvokingtargetinstallofmakefile/opt/oracle/product/9.0.1/plsql/lib/ins_plsql.mk"
"Errorinvokingtargetinstallofmakefile/opt/oracle/product/9.0.1/precomp/lib/ins-precomp.mk"
"Errorinvokingtargetinstallofmakefile/opt/oracle/product/9.0.1/precomp/lib/ins-net-client"
"Errorinvokingtargetinstallofmakefile/opt/oracle/product/9.0.1/precomp/lib/ins-oemagent"

A:Editthefile$ORACLE_HOME/bin/genclntshandchangethefollowingline(peoplehavesentmeemailspointingoutthatthisalsoworksforMandrake8.1andMandrake8.2):
LD_SELF_CONTAINED="-zdefs"
toread:
LD_SELF_CONTAINED=""

Thenrunthescript$ORACLE_HOME/bin/genclntshastheuser"oracle"andnotastheuser"root".AlsomakesureyouhavealltheOracleenvironmentsset!

$su-oracle
$$ORACLE_HOME/bin/genclntsh
Created/opt/oracle/product/9.0.1/lib/libclntst9.a
$

lQ:CantfindinitfileforDatabase"SID".

A:IsawthiserroronlyinconnectionwithOracle9iR2(9.2.0)whenIttriedtostartthedatabasewithdbstart.

IcopiedtheinitfileformySID"test"from/opt/oracle/admin/test/pfileto$ORACLE_HOME/dbstogetdbstartanddbshutworking:
cp/opt/oracle/admin/test/pfile/inittest.ora.642002224936$ORACLE_HOME/dbs/inittest.ora

lQ:"Errorinsettingpermissionsoffile/directory/opt/oracle/jre/1.1.8/bin/i686/native_threads/.extract_args"

A:Whiletheerrordialogisopen,manuallyfindandcopythe.extract_argsfilefromyourinstalledjretowhererunInstallercomplainsitismissing.

lQ:"jrewasnotfoundin/tmp/OraInstall/jre/bin/i586/green_threads/jre"

A:YouareprobablyrunningrunInstallerona586machine,oryourAMDCPUgetsrecognizedas586(e.g.AMDK6-III-400).Youcancheckyourmachine(hardware)typebyexecutinguname-m.
Torectifythisproblem,createalinkforlibandbinfromi586toi686andmakethei686directoriesreadonly:
E.g.
ln-s/tmp/OraInstall/jre/bin/i686/tmp/OraInstall/jre/bin/i586
ln-s/tmp/OraInstall/jre/lib/i686/tmp/OraInstall/jre/lib/i586
chmodu-w/tmp/OraInstall/jre/bin/i686/tmp/OraInstall/jre/lib/i686
NowrestartrunInstaller.

Ifyouarenotrunningona586orAMDmachine,trytolinkjretojavaandseeifthissolvesyourproblem.

lDonotcdto/mnt/cdromtorun./runInstaller!
Ifyoudoso,theinstallationwillfailbecauseyouwontbeabletochangetheCDs.

lIfyouforgottosettheDISPLAYenvironmentvariable(e.g.exportDISPLAY=oracleserver:0.0),orifyouforgottogivetheremoteconsole-yourOracleServer-authoritytodisplayXinformationonyourdesktopPC(e.g.xhost+oracleserver),youwillgetthefollowingerror:
Xlib:connectionto":0.0"refusedbyserver
Xlib:ClientisnotauthorizedtoconnecttoServer
Inthiscase,IalwayshadtokillrunInstallerwhichwasstillrunninginthebackground!Ifyoudontdothis,runInstallerwillnotcompletelycomeupanymoreandyouwillnotseeanyerrormessagesthatrunInstallerishavingproblems.
Youmightalsowanttocleanup/tmp/OraInstall(9.0.1):
rm-rf/tmp/OraInstall

lWhenrunInstallerstartstoconfigurethetools("ConfigurationTools"),the"OracleNetConfigurationAssistant"willsometimeshang.SimplystoptheAssistantandrestartit,orcontinuetheinstallation.Whentherestoftheinstallationisfinished,doa"Retry"for"OracleNetConfigurationAssistant".Thisalwaysworkedforme.

lWhenthesystemstopstorespondduringtheOracleinstallation,inparticularduringthedatabasecreation,thenitisprobablybecauseyoudonthaveenoughRAMorenoughswapspace.Inoticedthatthewholesystemwillnotrespond(or"hang")forseveralminuteswhenIdidnothaveenoughswapspace.Ifthishappens,simplywaituntilthesystemstartstorespondagain.

lTheOracleinstallationalsorunsmakeetc.Inaproductionenvironmentyoumightnothavecompilersandotherdevelopmentpackagesinstalled.Thereforemakesureyouhavetemporarilythefollowingpackagesinstalled:gcc,cpp,egcs,egcs-c++,glibc-devel,kernel-headers.(ImnotsurethoughifallofthesepackageshavetobeonthesystemduringtheOracleinstallation.)

lIfforanyreasontheOracleinstallationdidntfinishsuccessfully,youmightwanttocleanupthefollowingfilesanddirectoriesbeforeyourestartoveragain:
rm-rf/etc/oraInst.loc/etc/oratab/tmp/OraInstall
/tmp/<OtherOracleOwnedFiles>
$ORACLE_BASE/*

15,StartupandShutdownofOracle9iDatabase

sqlplus:

svrmgrlisnotsupportedanymore.Youcannowdoeverythingwithsqlplus.

E.g.,tostartupthedatabase,executethefollowingcommands:
dba$sqlplus/nolog
SQL>connect/assysdba
SQL>startup

TheslashconnectsyoutotheschemaownedbySYS.SointhisexamplewearesayingthatwewanttoconnecttotheschemaownedbySYSwiththeprivilegeSYSDBA.SYSDBAgivesyouthefollowingprivileges:
sysoperprivilegesWITHADMINOPTION
createdatabase
recoverdatabaseuntil

$ORACLE_HOME/bin/dbstartand$ORACLE_HOME/bin/dbshut:

Youcanalsouse$ORACLE_HOME/bin/dbstarttostartupthedatabase,and$ORACLE_HOME/bin/dbshuttoshutdownthedatabase.Youcanplace$ORACLE_HOME/bin/dbstartintothe/etc/rc.d/rc.localbootscripttoautomaticallybringupthedatabaseatsystemboottime.Toget$ORACLE_HOME/bin/dbstartand$ORACLE_HOME/bin/dbshutworking,youneedtochangethethirdfieldforyourOracleSIDin/etc/oratabfrom"N"to"Y".

E.g.fortheOracleSID"test"Ichangedthelinein/etc/oratabfrom
test:/opt/oracle/product/9.2.0:N
toread
test:/opt/oracle/product/9.2.0:Y

For9.2.0,IalsohadtocopytheinitfileformySID"test"from/opt/oracle/admin/test/pfileto$ORACLE_HOME/dbstogetdbstartanddbshutworking:
cp/opt/oracle/admin/test/pfile/inittest.ora.642002224936$ORACLE_HOME/dbs/inittest.ora
Butfirstcheckifyourinitfilealreadyexistsin$ORACLE_HOME/dbs.


对于IT经理来说,令他们喜欢的MySQL的简单性还有另一方面。MySQL可以运行的更快速。某些人或许会说MySQL缺少了一些人们想要的功能。

乐观 发表于 2015-1-17 19:27:14

而写到本地,我又考虑到效率问题.大家来讨论讨论吧,分数不打紧,就给10分,十全十美,没啥对错,各抒己见,但是要有说服力的哦~

蒙在股里 发表于 2015-1-21 07:14:26

是否碎片会引发效率问题?这都是需要进一步探讨的东西。varbinary(max)代替image也让SQLServer的字段类型更加简洁统一。

第二个灵魂 发表于 2015-2-6 10:14:43

还不是性能有问题!否则面向对象的数据库早就实现了!建议使用CLR的地方一般是和应用的复杂程度或操作系统环境有很高的耦合度的场景。如你想构建复杂的算法,并且用到了大量的指针和高级数据模型。

变相怪杰 发表于 2015-2-15 23:17:19

你可以简单地认为适合的就是好,不适合就是不好。

柔情似水 发表于 2015-3-4 18:15:16

比如,MicrosoftSQLServer2008的某一个版本可以满足现在的这个业务的需要,而且价格还比Oracle11g要便宜,那么这一产品就是适合的。

山那边是海 发表于 2015-3-11 20:36:44

having子句的作用是筛选满足条件的组,即在分组之后过滤数据,条件中经常包含聚组函数,使用having条件显示特定的组,也可以使用多个分组标准进行分组。

小女巫 发表于 2015-3-19 11:59:52

对于数据库来说,查询是数据库的灵魂,那么SQL查询效率究竟效率如何呢?下文将带对SQL查询的相关问题进行讨论,供您参考。

因胸联盟 发表于 2015-3-28 01:30:06

现在是在考虑:如果写到服务器端,我一下搞他个10个存储过程导过去,那久之服务器不就成垃圾箱了吗?即便优化了我的中间层.
页: [1]
查看完整版本: MYSQL网页编程之Oracle 9i Installation on Red Hat Li...