完成後我們修改壹下hosts文件,將裏面的ip地址給修改壹下
1 # vi /etc/hosts接著我們刪除上次安裝過的ORACLE文件
123 # cd $ORACLE_BASE # ls # rm -rf *進入root:rm -rf /etc/ora*
還是在安裝前進行配置。
接下來進行靜默安裝。首先我們先要創建壹個相應文件,這個文件裏記錄了我們oracle安裝的所有過程
123 [oracle@oracle ~]$ cd /u01/database/response$ cp enterprise.rsp /u01$ vi /u01/enterprise.rsp修改壹下內容:
1234567 35 UNIX_GROUP_NAME=\"oinstall\" 62 ORACLE_HOME=\"/u01/app/oracle/10.2.0/db_1\" 70 ORACLE_HOME_NAME=\"OraDbHome1\" 351 COMPONENT_LANGUAGES={\"en,zh_CN\"} 384 s_nameForDBAGrp=\"dba\" 392 s_nameForOPERGrp=\"oper\" 422 n_configurationOption=3開始安裝:
12 [oracle@oracle ~]$ cd /u01/database $ ./runInstaller -silent -responseFile /u01/enterprise.rsp安裝完成後執行以下腳本
12 $ORACLE_BASE/oraInventory/orainstRoot.sh $ORACLE_HOME/root.sh執行完腳本以後使用:sqlplus / as sysdba即可知道oracle的版本為:10.2.0.1.0
靜默升級數據庫
12345678 $ cp /u01/Disk1/response/patchset.rsp /u01 vi /u01/patchset.rsp編輯如下行: 45 UNIX_GROUP_NAME=\"oinstall\" 87 ORACLE_HOME=\"/u01/app/oracle/10.2.0/db_1\" 99 ORACLE_HOME_NAME=\"OraDbHome1\" 533 MYORACLESUPPORT_USERNAME=\"zhaoming@sina.com\" 542 MYORACLESUPPORT_PASSWORD=\"b\" 603 DECLINE_SECURITY_UPDATES=true進行安裝升級的補丁
1 $ ./runInstaller -silent -responseFile /u01/patchset.rsp升級成功
1234 $ sqlplus / as sysdba; Connected to: Oracle Database 10g Enterprise Edition Release 10.2.0.5.0 - Production With the Partitioning, OLAP, Data Mining and Real Application Testing options接下來進行手工建庫
12345678910111213141516 $ vi $ORACLE_HOME/dbs/initorcl.ora 寫入以下內容: compatible=10.2.0.5 instance_name=orcl db_name=orcl sga_target=500M sga_max_size=500M job_queue_processes=10 undo_management=auto undo_tablespace=undotbs audit_file_dest=$ORACLE_BASE/admin/orcl/adump background_dump_dest=$ORACLE_BASE/admin/orcl/bdump core_dump_dest=$ORACLE_BASE/admin/orcl/cdump user_dump_dest=$ORACLE_BASE/admin/orcl/udump control_files=\'/u01/app/oracle/oradata/orcl/control01.ctl\',\'/u01/app/oracle/oradata/orcl/control02.ctl\' 保存退出創建跟蹤目錄:
1 mkdir -p $ORACLE_BASE/admin/orcl/{a,b,c,u}dump創建控制文件的位置
1 mkdir -p /u01/app/oracle/oradata/orcl/啟動到實例:
123 sqlplus / as sysdba create spfile from pfile; startup nomount接下來進行創建數據庫
vi createdb.sql寫入如下內容:
123456789101112131415161718192021222324 CREATE DATABASE orcl USER SYS IDENTIFIED BY a ---這裏需要修改妳的密碼 USER SYSTEM IDENTIFIED BY a LOGFILE GROUP 1 (\'/u01/app/oracle/oradata/orcl/redo01.log\') SIZE 50M, GROUP 2 (\'/u01/app/oracle/oradata/orcl/redo02.log\') SIZE 50M, GROUP 3 (\'/u01/app/oracle/oradata/orcl/redo03.log\') SIZE 50M MAXLOGFILES 5 MAXLOGMEMBERS 5 MAXLOGHISTORY 1 MAXDATAFILES 100 MAXINSTANCES 1 CHARACTER SET utf8 NATIONAL CHARACTER SET utf8 DATAFILE \'/u01/app/oracle/oradata/orcl/system01.dbf\' SIZE 325M REUSE EXTENT MANAGEMENT LOCAL SYSAUX DATAFILE \'/u01/app/oracle/oradata/orcl/sysaux01.dbf\' SIZE 325M REUSE DEFAULT TABLESPACE users datafile \'/u01/app/oracle/oradata/orcl/users01.dbf\' size 200M DEFAULT TEMPORARY TABLESPACE temp TEMPFILE \'/u01/app/oracle/oradata/orcl/temp01.dbf\' SIZE 20M REUSE UNDO TABLESPACE undotbs DATAFILE \'/u01/app/oracle/oradata/orcl/undotbs01.dbf\' SIZE 200M REUSE AUTOEXTEND ON MAXSIZE UNLIMITED /然後在sql中引用到這些腳本
123 sql> get /u01/create.sql ---解釋壹下get的作用:就是引用操作系統目錄下的任意壹個文件引入到sql中來。 sql> ......... sql>/-----執行完這些腳本語句之後就會在相應的位置產生控制文件、數據文件、日誌文件等----
接著執行
123 sql>desc dba_tables ERROR: ORA-04043: object dba_tables does not exist----解釋壹下:這裏查詢的是數據字典,我們這裏只不過建好了數據庫,並沒有將數據庫相關的視圖、表、索引、數據字典等建好。----
所以我們呢要來建這些視圖、表、索引了。
123456 $ cd /u01vi jb.sql寫入如下內容: @?/rdbms/admin/catalog.sql ----catalog.sql:創建數據字典 @?/rdbms/admin/catproc.sql ----catproc.sql:安裝ORACLE自定義的包 conn system/a@?/sqlplus/admin/pupbld.sql ----pupbld.sql:屏蔽sqlplus錯誤接著在數據庫中執行這段腳本:
1 sql>@/u01/jb.sql---這裏解釋壹下:@:可以執行操作系統下的某個腳本中sql語句
緊接著就是漫長的等待,估計20多分鐘吧。
執行完成後,妳會看到很多什麽表啊視圖什麽的,does not exist。不用管他,這是創建數據字典時候先去查詢這些表存不存在。當然不存在啊,因為都還沒創建,所以自然會報錯。
1 sql>desc dba_tables完了後這個時候就有內容了。
1 sql> select count(*) from dba_tables接下來我們進行OEM的安裝,安裝之前我們先將補丁給補上。補丁我們也是采用禁默安裝。補丁:
1 p8350262_10205_Generic.zip將補丁上傳到目錄:$ORACLE_HOME/OPatch/ 解壓縮:
$ unzip p8350262_10205_Generic.zip
得到壹個目錄為:8350262
打補丁:
123 $ emctl stop dbconsole $ cd $ORACLE_HOME/OPatch $ ./opatch apply 8350262補丁安裝上去之後
1 $ lsnrctl status 顯示: No Listener然後我們做:
123 $ cd /u01/database/response/ $ cp netca.rsp /u01 $ netca /silent /responseFile /u01/netca.rsp安裝完監聽器後我們進入sqlplus去將數據庫註冊到這個監聽器上。
12 $ sqlplus / as sysdba; sqlplus>alter system register監聽器安裝完成後我們進行安裝資料庫
12 SQL> select username from dba_users where username=\'SYSMAN\'; no rows selected執行安裝資料庫命令:
12345678910111213141516171819 $ emca -repos create STARTED EMCA at Mar 30, 2013 9:57:23 AM 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 Listener port number: 1521 Password for SYS user: Password for SYSMAN user: Password for SYSMAN user: Do you wish to continue? [yes(Y)/no(N)]: Y Mar 30, 2013 9:58:28 AM oracle.sysman.emcp.EMConfig perform INFO: This operation is being logged at /u01/app/oracle/10.2.0/db_1/cfgtoollogs/emca/orcl/emca_2013-03-30_09-57-2-AM.log. Mar 30, 2013 9:58:28 AM oracle.sysman.emcp.EMReposConfig createRepository INFO: Creating the EM repository (this may take a while) ... Mar 30, 2013 10:00:42 AM oracle.sysman.emcp.EMReposConfig invoke INFO: Repository successfully created Enterprise Manager configuration completed successfully FINISHED EMCA at Mar 30, 2013 10:00:42 AM資料庫安裝完成後我們進行安裝控制臺:
12345678910111213141516171819202122232425262728293031323334 $ emca -config dbcontrol db STARTED EMCA at Mar 30, 2013 10:01:47 AM 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 Listener port number: 1521 Password for SYS user: Password for DBSNMP user: Password for SYSMAN user: Invalid username/password. 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/10.2.0/db_1 Database hostname ................ hndx 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 Mar 30, 2013 10:02:42 AM oracle.sysman.emcp.EMConfig perform INFO: This operation is being logged at /u01/app/oracle/10.2.0/db_1/cfgtoollogs/emca/orcl/emca_2013-03-30_10-01-4-AM.log. Mar 30, 2013 10:02:48 AM oracle.sysman.emcp.util.DBControlUtil startOMS INFO: Starting Database Control (this may take a while) ... Mar 30, 2013 10:04:24 AM oracle.sysman.emcp.EMDBPostConfig performConfiguration INFO: Database Control started successfully Mar 30, 2013 10:04:24 AM oracle.sysman.emcp.EMDBPostConfig performConfiguration INFO: >>>>>>>>>>> The Database Control URL is pleted successfully FINISHED EMCA at Mar 30, 2013 10:04:24 AM馬上就大功告成了
$ firefox http://hndx:1158/em --如果報錯:用戶名密碼錯誤,請先創建口令文件:
創建口令文件:
1 orapwd file=$ORACLE_HOME/dbs/orapworcl password=xxxxx---用戶名自己定義是不是看到火狐瀏覽器的界面很親切呢。這裏估計還會有錯誤,就是要添加證書,進入後添加點擊下面的添加就好了。