oracle 11g自動安裝與配置

來源:互聯網
上載者:User

標籤:oracle   localhost   資料庫安裝   

自動刪除日誌指令檔:

連結:http://pan.baidu.com/s/1mg0EnQo    密碼:4uit


資料庫安裝前的準備工作

[[email protected] ~]# vim /etc/sysconfig/network-scripts/ifcfg-eth0  #配置IP地址DEVICE=eth0HWADDR=00:0C:29:59:6E:BFTYPE=EthernetONBOOT=yesBOOTPROTO=noIPADDR=172.16.2.20NETMASK=255.255.0.0GATEWAY=172.16.1.1DNS1=202.106.0.20[[email protected] ~]# vim /etc/sysconfig/networkNETWORKING=yesHOSTNAME=db[[email protected] ~]# vim /etc/hosts   #添加網域名稱解析127.0.0.1    localhost localhost.localdomain localhost4 localhost4.localdomain4::1        localhost localhost.localdomain localhost6 localhost6.localdomain6172.16.2.20   db[[email protected] ~]#reboot            #重啟系統


第一步:解壓並安裝資料庫

[[email protected] ~]#tar -jxpvf /home/ora11.2.0.3.8_cluster.tgj -C /      #解壓oracle資料庫到根目錄,大C指定檔案解壓目錄


第二步:設定資料庫參數

[[email protected] ~]# su - oracle                          #切換到oracle使用者[[email protected] ~]$ sqlplus /  as sysdba                  #進入oracle資料庫SQL*Plus: Release 11.2.0.3.0 Production on Wed Nov 18 15:40:15 2015Copyright (c) 1982, 2011, Oracle.  All rights reserved.Connected to an idle instance.SQL> create pfile from spfile;   #建立pfile檔案(pfile檔案的作用是方便電腦可讀,也就是0和1),第一次進入資料庫時均需要建立此檔案File created.SQL> startup              #啟動資料庫,若出現以下提示(需要給作業系統預留記憶體空間,不能讓資料庫獨佔記憶體)請修改initgnnt.ora檔案,方法如下            ORA-00845: MEMORY_TARGET not supported on this systemSQL> !                    #返回到oracle使用者[[email protected] ~]$ vim /opt/ora11/product/11.2/dbs/initgnnt.ora                 #修改initgnnt.ora設定檔(大小視實體記憶體而定,一定不能等於實體記憶體)..................................................................*.memory_max_target=8g*.memory_target=8g..................................................................*.sga_max_size=8g..................................................................[[email protected] ~]$sqlplus / as sysdba           #再次進入oracle資料庫     SQL> create spfile from pfile;                                        #建立spfile檔案(spfile檔案的作用是讀取pfile檔案的內容並更新修改的內容,也就是更新initgnnt.ora設定檔的內容讓電腦可讀)SQL> startup                         #資料庫開啟成功ORACLE instance started.Total System Global Area 8551575552 bytesFixed Size    2245480 bytesVariable Size 5066722456 bytesDatabase Buffers 3472883712 bytesRedo Buffers    9723904 bytesDatabase mounted.Database opened.SQL>select status  from v$instance;         #查看資料庫狀態,顯示‘open’代表正常STATUS------------OPEN


第三步:監聽資料庫

SQL>!lsnrctl status 或[[email protected] ~]$ lsnrctl status                #監聽資料庫,若提示以下內容,請修改listener.ora和tnsnames.ora檔案LSNRCTL for Linux: Version 11.2.0.3.0 - Production on 18-NOV-2015 17:46:36Copyright (c) 1991, 2011, Oracle.  All rights reserved.Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=IPC)(KEY=EXTPROC1521)))TNS-12541: TNS:no listener TNS-12560: TNS:protocol adapter error  TNS-00511: No listener   Linux Error: 111: Connection refusedConnecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=dbi)(PORT=1521)))TNS-12545: Connect failed because target host or object does not exist TNS-12560: TNS:protocol adapter error  TNS-00515: Connect failed because target host or object does not exist   Linux Error: 111: Connection refusedSQL>!    #返回到oracle使用者    [[email protected] admin]$ vim listener.ora # listener.ora Network Configuration File: /opt/ora11/product/11.2/network/admin/listener.ora# Generated by Oracle configuration tools..........................................................................................LISTENER =  (DESCRIPTION_LIST =    (DESCRIPTION =      (ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC1521))      (ADDRESS = (PROTOCOL = TCP)(HOST = db)(PORT = 1521))     #將HOST改為db    )  )[[email protected] admin]$ vim tnsnames.ora # tnsnames.ora Network Configuration File: /opt/ora11/product/11.2/network/admin/tnsnames.ora# Generated by Oracle configuration tools.GNNT =  (DESCRIPTION =    (ADDRESS = (PROTOCOL = TCP)(HOST = db)(PORT = 1521))       #將HOST改為db    (CONNECT_DATA =      (SERVER = DEDICATED)      (SERVICE_NAME = gnnt)    )  )SQL>!lsnrctl status   #最後一行顯示The command completed successfully,代表監聽成功LSNRCTL for Linux: Version 11.2.0.3.0 - Production on 18-NOV-2015 17:28:52Copyright (c) 1991, 2011, Oracle.  All rights reserved.Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=IPC)(KEY=EXTPROC1521)))STATUS of the LISTENER------------------------Alias                     LISTENERVersion                   TNSLSNR for Linux: Version 11.2.0.3.0 - ProductionStart Date                18-NOV-2015 12:41:04Uptime                    0 days 4 hr. 47 min. 47 secTrace Level               offSecurity                  ON: Local OS AuthenticationSNMP                      OFFListener Parameter File   /opt/ora11/product/11.2/network/admin/listener.oraListener Log File         /opt/ora11/diag/tnslsnr/db/listener/alert/log.xmlListening Endpoints Summary...  (DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=EXTPROC1521)))  (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=db)(PORT=1521)))Services Summary...Service "PLSExtProc" has 1 instance(s).  Instance "PLSExtProc", status UNKNOWN, has 1 handler(s) for this service...Service "gnnt" has 2 instance(s).  Instance "gnnt", status UNKNOWN, has 1 handler(s) for this service...  Instance "gnnt", status READY, has 1 handler(s) for this service...Service "gnntXDB" has 1 instance(s).  Instance "gnnt", status READY, has 1 handler(s) for this service...The command completed successfully


第四步:添加自動刪除記錄檔指令碼

[[email protected] ~]#su - oracle[[email protected]]$cp /media/linux/deletearchivelogs.sh /media/linux/rman_cmd /home/oracle     #/media/linux/代表隨身碟中的目錄,粘貼的位置為/home/oracle[[email protected]]$chmod  +x  /home/oracle/deletearchivelogs.sh #給deletearchivelogs.sh檔案添加可執行許可權[[email protected]]$ ll /home/oracle總用量 8-rwxr-xr-x 1 root root 439 11月 18 16:44 deletearchivelogs.sh-rwxr-xr-x 1 root root 118 11月 18 16:44 rman_cmd[[email protected]]$vim /home/oracle/deletearchivelogs.sh   #修改IP地址為本地IP地址/sbin/ip add show dev bond0 | grep -iq ‘172.16.2.20‘ [[email protected] ~]#crontab -e        #添加自動刪除日誌指令碼,如果出現計劃任務無法儲存時,則說明時間不同步,只需同步時間即可0 5 * * * /home/oracle/deletearchivelogs.sh  > /dev/null  2>&1[[email protected] home]# crontab -l      #查看計劃執行任務0 5 * * *  /home/oracle/deletearchivelogs.sh > /dev/null 2>&1


第五步:關閉資料庫

[[email protected] ~]# su - oracle                       #切換到oracle使用者[[email protected] ~]$ sqlplus /  as sysdba               #進入oracle資料庫SQL > shutdown  immediate;                    #關閉資料庫Database closed.Database dismounted.ORACLE instance shut down.


補充:

1、使用history查看之前所使用過的命令。

2、如果探索資料庫每隔一段時間就會重啟,這時候只需要關掉bmc-watchdog伺服器

[[email protected] ~]#chkconfig  bmc-watcgdog off

本文出自 “紫禁之巔” 部落格,請務必保留此出處http://1343138116.blog.51cto.com/6124664/1714417

oracle 11g自動安裝與配置

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.