当前位置:  数据库>oracle

教你如何静默安装ORACLE

    来源: 互联网  发布时间:2014-10-04

    本文导语:  由于本次的实验我是将上次的虚拟机直接拷贝过来,然后将里面图形化界面安装好了的oracle给删除,再次重新安装,所以这里要修改一些配置。 首先修改的是我们的IP地址 # system-config-network 完成后我们修改一下hosts文件,...

由于本次的实验我是将上次的虚拟机直接拷贝过来,然后将里面图形化界面安装好了的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 

    
 
 
 
本站(WWW.169IT.COM)旨在分享和传播互联网科技相关的资讯和技术,将尽最大努力为读者提供更好的信息聚合和浏览方式。
本站(WWW.169IT.COM)站内文章除注明原创外,均为转载、整理或搜集自网络。欢迎任何形式的转载,转载请注明出处。












  • 相关文章推荐




  • 特别声明:169IT网站部分信息来自互联网,如果侵犯您的权利,请及时告知,本站将立即删除!

    ©2012-2017,169IT.COM,E-mail:www_169it_com#163.com(请将#改为@)

    浙ICP备11055608号