由于本次的實(shí)驗(yàn)我是將上次的虛擬機(jī)直接拷貝過(guò)來(lái),然后將里面圖形化界面安裝好了的oracle給刪除,再次重新安裝,所以這里要修改一些配置。
首先修改的是我們的IP地址
完成后我們修改一下hosts文件,將里面的ip地址給修改一下
接著我們刪除上次安裝過(guò)的ORACLE文件
# cd $ORACLE_BASE
# ls
# rm -rf *
進(jìn)入root:rm -rf /etc/ora*
還是在安裝前進(jìn)行配置。
接下來(lái)進(jìn)行靜默安裝。首先我們先要?jiǎng)?chuàng)建一個(gè)相應(yīng)文件,這個(gè)文件里記錄了我們oracle安裝的所有過(guò)程
[oracle@oracle ~]$ cd /u01/database/response
$ cp enterprise.rsp /u01
$ vi /u01/enterprise.rsp
修改一下內(nèi)容:
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
開(kāi)始安裝:
[oracle@oracle ~]$ cd /u01/database
$ ./runInstaller -silent -responseFile /u01/enterprise.rsp
安裝完成后執(zhí)行以下腳本
$ORACLE_BASE/oraInventory/orainstRoot.sh
$ORACLE_HOME/root.sh
執(zhí)行完腳本以后使用:sqlplus / as sysdba即可知道oracle的版本為:10.2.0.1.0
靜默升級(jí)數(shù)據(jù)庫(kù)
$ 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
進(jìn)行安裝升級(jí)的補(bǔ)丁
$ ./runInstaller -silent -responseFile /u01/patchset.rsp
升級(jí)成功
$ 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
接下來(lái)進(jìn)行手工建庫(kù)
$ vi $ORACLE_HOME/dbs/initorcl.ora
寫(xiě)入以下內(nèi)容:
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'
保存退出
創(chuàng)建跟蹤目錄:
mkdir -p $ORACLE_BASE/admin/orcl/{a,b,c,u}dump
創(chuàng)建控制文件的位置
mkdir -p /u01/app/oracle/oradata/orcl/
啟動(dòng)到實(shí)例:
sqlplus / as sysdba
create spfile from pfile;
startup nomount
接下來(lái)進(jìn)行創(chuàng)建數(shù)據(jù)庫(kù)
vi createdb.sql寫(xiě)入如下內(nèi)容:
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中引用到這些腳本
sql> get /u01/create.sql ---解釋一下get的作用:就是引用操作系統(tǒng)目錄下的任意一個(gè)文件引入到sql中來(lái)。
sql> .........
sql>/
-----執(zhí)行完這些腳本語(yǔ)句之后就會(huì)在相應(yīng)的位置產(chǎn)生控制文件、數(shù)據(jù)文件、日志文件等----
接著執(zhí)行
sql>desc dba_tables
ERROR:
ORA-04043: object dba_tables does not exist
----解釋一下:這里查詢的是數(shù)據(jù)字典,我們這里只不過(guò)建好了數(shù)據(jù)庫(kù),并沒(méi)有將數(shù)據(jù)庫(kù)相關(guān)的視圖、表、索引、數(shù)據(jù)字典等建好。----
所以我們呢要來(lái)建這些視圖、表、索引了。
$ cd /u01
vi jb.sql寫(xiě)入如下內(nèi)容:
@?/rdbms/admin/catalog.sql ----catalog.sql:創(chuàng)建數(shù)據(jù)字典
@?/rdbms/admin/catproc.sql ----catproc.sql:安裝ORACLE自定義的包
conn system/a
@?/sqlplus/admin/pupbld.sql ----pupbld.sql:屏蔽sqlplus錯(cuò)誤
接著在數(shù)據(jù)庫(kù)中執(zhí)行這段腳本:
---這里解釋一下:@:可以執(zhí)行操作系統(tǒng)下的某個(gè)腳本中sql語(yǔ)句
緊接著就是漫長(zhǎng)的等待,估計(jì)20多分鐘吧。
執(zhí)行完成后,你會(huì)看到很多什么表啊視圖什么的,does not exist。不用管他,這是創(chuàng)建數(shù)據(jù)字典時(shí)候先去查詢這些表存不存在。當(dāng)然不存在啊,因?yàn)槎歼€沒(méi)創(chuàng)建,所以自然會(huì)報(bào)錯(cuò)。
完了后這個(gè)時(shí)候就有內(nèi)容了。
sql> select count(*) from dba_tables
接下來(lái)我們進(jìn)行OEM的安裝,安裝之前我們先將補(bǔ)丁給補(bǔ)上。補(bǔ)丁我們也是采用禁默安裝。補(bǔ)丁:
p8350262_10205_Generic.zip
將補(bǔ)丁上傳到目錄:$ORACLE_HOME/OPatch/ 解壓縮:
$ unzip p8350262_10205_Generic.zip
得到一個(gè)目錄為:8350262
打補(bǔ)?。?br />
$ emctl stop dbconsole
$ cd $ORACLE_HOME/OPatch
$ ./opatch apply 8350262
補(bǔ)丁安裝上去之后
$ lsnrctl status 顯示: No Listener
然后我們做:
$ cd /u01/database/response/
$ cp netca.rsp /u01
$ netca /silent /responseFile /u01/netca.rsp
安裝完監(jiān)聽(tīng)器后我們進(jìn)入sqlplus去將數(shù)據(jù)庫(kù)注冊(cè)到這個(gè)監(jiān)聽(tīng)器上。
$ sqlplus / as sysdba;
sqlplus>alter system register
監(jiān)聽(tīng)器安裝完成后我們進(jìn)行安裝資料庫(kù)
SQL> select username from dba_users where username=\'SYSMAN';
no rows selected
執(zhí)行安裝資料庫(kù)命令:
$ 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
資料庫(kù)安裝完成后我們進(jìn)行安裝控制臺(tái):
$ 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 http://hndx:1158/em
Enterprise Manager configuration completed successfully
FINISHED EMCA at Mar 30, 2013 10:04:24 AM
馬上就大功告成了
$ firefox http://hndx:1158/em --如果報(bào)錯(cuò):用戶名密碼錯(cuò)誤,請(qǐng)先創(chuàng)建口令文件:
創(chuàng)建口令文件:
orapwd file=$ORACLE_HOME/dbs/orapworcl password=xxxxx---用戶名自己定義
是不是看到火狐瀏覽器的界面很親切呢。這里估計(jì)還會(huì)有錯(cuò)誤,就是要添加證書(shū),進(jìn)入后添加點(diǎn)擊下面的添加就好了。
您可能感興趣的文章:- 常用軟件的靜默安裝方法介紹
- Android 靜默方式實(shí)現(xiàn)批量安裝卸載應(yīng)用程序的深入分析
- vbs腳本實(shí)現(xiàn)下載jre包并靜默安裝的代碼實(shí)例
- java實(shí)現(xiàn)靜默安裝apk