教你如何静默安装ORACLE
由于本次的实验我是将上次的虚拟机直接拷贝过来,然后将里面图形化界面安装好了的oracle给删除,再次重新安装,所以这里要修改一些配置。
首先修改的是我们的ip地址
# system-config-network
完成后我们修改一下hosts文件,将里面的ip地址给修改一下
# vi /etc/hosts
接着我们删除上次安装过的oracle文件
# cd $oracle_base # ls # rm -rf *
进入root:rm -rf /etc/ora*
还是在安装前进行配置。
接下来进行静默安装。首先我们先要创建一个相应文件,这个文件里记录了我们oracle安装的所有过程
[oracle@oracle ~]$ cd /u01/database/response $ cp enterprise.rsp /u01 $ vi /u01/enterprise.rsp
修改一下内容:
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
开始安装:
[oracle@oracle ~]$ cd /u01/database $ ./runinstaller -silent -responsefile /u01/enterprise.rsp
安装完成后执行以下脚本
$oracle_base/orainventory/orainstroot.sh $oracle_home/root.sh
执行完脚本以后使用:sqlplus / as sysdba即可知道oracle的版本为:10.2.0.1.0
静默升级数据库
$ 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
进行安装升级的补丁
$ ./runinstaller -silent -responsefile /u01/patchset.rsp
升级成功
$ 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
接下来进行手工建库
$ 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\' 保存退出
创建跟踪目录:
mkdir -p $oracle_base/admin/orcl/{a,b,c,u}dump
创建控制文件的位置
mkdir -p /u01/app/oracle/oradata/orcl/
启动到实例:
sqlplus / as sysdba create spfile from pfile; startup nomount
接下来进行创建数据库
vi createdb.sql写入如下内容:
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的作用:就是引用操作系统目录下的任意一个文件引入到sql中来。 sql> ......... sql>/
-----执行完这些脚本语句之后就会在相应的位置产生控制文件、数据文件、日志文件等----
接着执行
sql>desc dba_tables error: ora-04043: object dba_tables does not exist
----解释一下:这里查询的是数据字典,我们这里只不过建好了数据库,并没有将数据库相关的视图、表、索引、数据字典等建好。----
所以我们呢要来建这些视图、表、索引了。
$ cd /u01 vi 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错误
接着在数据库中执行这段脚本:
sql>@/u01/jb.sql
---这里解释一下:@:可以执行操作系统下的某个脚本中sql语句
紧接着就是漫长的等待,估计20多分钟吧。
执行完成后,你会看到很多什么表啊视图什么的,does not exist。不用管他,这是创建数据字典时候先去查询这些表存不存在。当然不存在啊,因为都还没创建,所以自然会报错。
sql>desc dba_tables
完了后这个时候就有内容了。
sql> select count(*) from dba_tables
接下来我们进行oem的安装,安装之前我们先将补丁给补上。补丁我们也是采用禁默安装。补丁:
p8350262_10205_generic.zip
将补丁上传到目录:$oracle_home/opatch/ 解压缩:
$ unzip p8350262_10205_generic.zip
得到一个目录为:8350262
打补丁:
$ emctl stop dbconsole $ cd $oracle_home/opatch $ ./opatch apply 8350262
补丁安装上去之后
$ lsnrctl status 显示: no listener
然后我们做:
$ cd /u01/database/response/ $ cp netca.rsp /u01 $ netca /silent /responsefile /u01/netca.rsp
安装完监听器后我们进入sqlplus去将数据库注册到这个监听器上。
$ sqlplus / as sysdba; sqlplus>alter system register
监听器安装完成后我们进行安装资料库
sql> select username from dba_users where username=\'sysman\'; no rows selected
执行安装资料库命令:
$ 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
资料库安装完成后我们进行安装控制台:
$ 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 --如果报错:用户名密码错误,请先创建口令文件:
创建口令文件:
orapwd file=$oracle_home/dbs/orapworcl password=xxxxx---用户名自己定义
是不是看到火狐浏览器的界面很亲切呢。这里估计还会有错误,就是要添加证书,进入后添加点击下面的添加就好了。