设为首页 收藏本站
查看: 618|回复: 0

[经验分享] 静默安装oracle-ohgenlong16300blog.com-51CTO博客

[复制链接]

尚未签到

发表于 2018-9-14 10:40:16 | 显示全部楼层 |阅读模式
  如果Server段没有安装X界面,如何来安装Oracle呢?我们可以使用Oracle提供的静默安装来实现提示符下的Oracle安装。安装前的系统环境变量及内核参数的设置这里就不重复了,可以查看安装光盘中的安装文档。
  假设Oracle安装文件已经解压至/u02 。
  su - oracle
  mkdir -p /u01/app/oracle/
  1. 建立静默安装的配置文件
  cd /u02/database/response
  vi enterprise01.rsp
  RESPONSEFILE_VERSION=2.2.1.0.0
  FROM_LOCATION="../stage/products.xml"
  ORACLE_HOME="/u01/app/oracle/product/10.2.0/db_1/"
  ORACLE_HOME_NAME="OraDb10g_home1"
  TOPLEVEL_COMPONENT={"oracle.server","10.2.0.1.0"}
  DEINSTALL_LIST={"oracle.server","10.2.0.1.0"}
  SHOW_SPLASH_SCREEN=false
  SHOW_WELCOME_PAGE=false
  SHOW_COMPONENT_LOCATIONS_PAGE=false
  SHOW_CUSTOM_TREE_PAGE=false
  SHOW_SUMMARY_PAGE=false
  SHOW_INSTALL_PROGRESS_PAGE=false
  SHOW_REQUIRED_CONFIG_TOOL_PAGE=false
  SHOW_CONFIG_TOOL_PAGE=false
  SHOW_RELEASE_NOTES=false
  SHOW_ROOTSH_CONFIRMATION=false
  SHOW_END_SESSION_PAGE=false
  SHOW_EXIT_CONFIRMATION=false
  NEXT_SESSION=false
  NEXT_SESSION_ON_FAIL=false
  SHOW_DEINSTALL_CONFIRMATION=false
  SHOW_DEINSTALL_PROGRESS=false
  ACCEPT_LICENSE_AGREEMENT=true
  COMPONENT_LANGUAGES={"en"}
  CLUSTER_NODES=
  INSTALL_TYPE="EE"
  s_nameForDBAGrp=dba
  s_nameForOPERGrp=dba
  b_oneClick=false
  SHOW_DATABASE_CONFIGURATION_PAGE=false
  b_createStarterDB=false
  相关属性的值的意义,请参考Oracle提供的enterprise.rsp文档中的说明 。
  2. 开始安装
  cd /u02/database/
  ./runInstaller -silent -responseFile /u02/database/response/enterprise01.rsp
  #注意-responseFile参数后的文件路径一定是绝对路径 ,并且enterprise01.rsp oracle用户可读。
  执行过程如下:
  Installation in progress (Mon May 12 20:27:18 CST 2008)
  ...............................................................  11% Done.
  ...............................................................  23% Done.
  ...............................................................  35% Done.
  ...............................................................  47% Done.
  ...........................................                      55% Done.
  Install successful
  Linking in progress (Mon May 12 20:30:01 CST 2008)
  .                                                                55% Done.
  Link successful
  Setup in progress (Mon May 12 20:31:21 CST 2008)
  ....................                                            100% Done.
  Setup successful
  End of install phases.(Mon May 12 20:31:29 CST 2008)
  Starting to execute configuration assistants
  Configuration assistant "Oracle Net Configuration Assistant" succeeded
  Configuration assistant "Oracle Database Configuration Assistant" failed
  SEVEREOUI-10104:Some of the configuration assistants failed. It is strongly recommended that you retry the configuration assistants at this time. Not successfully running any "Recommended" assistants means your system will not be correctly configured. Select the failed assistants and click the 'Retry' button to retry them.
  --------------------------------------
  The "/u01/app/oracle/product/10.2.0/db_1/cfgtoollogs/configToolFailedCommands" . contains all commands that failed, were skipped or were cancelled. This file may be used to run these configuration assistants outside of OUI. Note that you may have to update this . with passwords (if any) before executing the same.
  The "/u01/app/oracle/product/10.2.0/db_1/cfgtoollogs/configToolAllCommands" . contains all commands to be executed by the configuration assistants. This file may be used to run the configuration assistants outside of OUI. Note that you may have to update this . with passwords (if any) before executing the same.
  --------------------------------------
  The installation of Oracle Database 10g was successful, but some optional configuration assistants failed, were cancelled or skipped.
  Please check '/u01/app/oracle/oraInventory/logs/silentInstall2008-05-12_08-26-55PM.log' for more details.
  3. 运行安装所需脚本
  vi /u01/app/oracle/oraInventory/logs/silentInstall2008-05-12_08-26-55PM.log
  查看日志,提示我们用root用户运行如下两个脚本
  /u01/app/oracle/oraInventory/orainstRoot.sh
  /u01/app/oracle/product/10.2.0/db_1/root.sh
  至此Oracle的产品已经安装完成,可是目前为止我们还没有建立数据库。
  由于没有X界面无法启动dbca ,所以不能用dbca来帮我们建立数据库。这时候你可能会想到用create database 语句来建立数据库,可是语法实在是繁琐,并且还要运行许多的
  oracle脚本 。
  下面我们来利用oracle提供的种子数据库还原一个数据库出来。
  假设我们要建立的数据库的名称为orcl 。
  4.建立我们所需的目录。
  mkdir -p /u01/app/oracle/admin/orcl/{a,b,u}dump
  mkdir -p /u01/app/oracle/oradata/orcl
  找到oracle为种子数据库提供的控制文件并copy至/u01/app/oracle/oradata/orcl 。
  cd /u01/app/oracle/product/10.2.0/db_1/assistants/dbca/templates/
  cp Seed_Database.ctl /u01/app/oracle/oradata/orcl
  5.建立pfile文件
  cd /u01/app/oracle/product/10.2.0/db_1/dbs
  vi initorcl.ora
  *.db_name=SEEDDATA #注:因为Seed_Database.ctl控制文件中记录的db_name为SEEDDATA。
  control_files='/u01/app/oracle/oradata/orcl/Seed_Database.ctl'
  compatible=10.2.0.1.0
  6.启动数据库到mount状态
  sqlplus / as sysdba

  SQL*Plus:>  Copyright (c) 1982, 2005, Oracle.  All rights reserved.

  Connected to an>  SQL> startup mount
  ORACLE instance started.
  Total System Global Area  117440512 bytes

  Fixed>
  Variable>  Database Buffers           50331648 bytes
  Redo Buffers                7168000 bytes
  Database mounted.
  使用默认的参数建立spfile
  SQL> create spfile from pfile;
  重新启动数据库
  SQL> shutdown immediate
  SQL> startup mount
  更改sga_max_size,sga_target参数的值 。

  SQL>>
  SQL>>  然后再次重新启动数据库
  SQL> shutdown immediate
  SQL> startup mount
  7.用rman连接数据库
  rman target /

  Recovery Manager:>  Copyright (c) 1982, 2005, Oracle.  All rights reserved.
  connected to target database: SEEDDATA (DBID=3891038516, not open)
  RMAN> list backup;
  using target database control file instead of recovery catalog
  List of Backup Sets
  ===================

  BS Key  Type LV>  ------- ---- -- ---------- ----------- ------------ ---------------
  1       Full    89.23M     DISK        00:00:36     30-JUN-05
  BP Key: 1   Status: AVAILABLE  Compressed: YES  Tag:
  Piece Name: /ade/aime_10.2_lnx_push/oracle/oradata/Seed_Database.dfb
  List of Datafiles in backup set 1
  File LV Type Ckp SCN    Ckp Time  Name
  ---- -- ---- ---------- --------- ----
  1       Full 446074     30-JUN-05 /ade/aime_10.2_lnx_push/oracle/oradata/seeddata/system01.dbf
  2       Full 446074     30-JUN-05 /ade/aime_10.2_lnx_push/oracle/oradata/seeddata/undotbs01.dbf
  3       Full 446074     30-JUN-05 /ade/aime_10.2_lnx_push/oracle/oradata/seeddata/sysaux01.dbf
  4       Full 446074     30-JUN-05 /ade/aime_10.2_lnx_push/oracle/oradata/seeddata/users01.dbf
  可以看到,我们可以利用/ade/aime_10.2_lnx_push/oracle/oradata/Seed_Database.dfb这个备份集来还原数据库。
  但是很明显我们系统中并没有这样一个文件/ade/aime_10.2_lnx_push/oracle/oradata/Seed_Database.dfb ,但是查找发现路径/u01/app/oracle/product/10.2.0/db_1/assistants/dbca/templates下有Seed_Database.dfb文件 。
  有两种方法,一个是建立一个软链接/ade/aime_10.2_lnx_push/oracle/oradata/Seed_Database.dfb 指向/u01/app/oracle/product/10.2.0/db_1/assistants/dbca/templates/Seed_Database.dfb 。另一个是创建目录/ade/aime_10.2_lnx_push/oracle/oradata/
  并将Seed_Database.dfb copy至其下 。
  8.还原数据库
  run {
  set newname for datafile '/ade/aime_10.2_lnx_push/oracle/oradata/seeddata/system01.dbf' to '/u01/app/oracle/oradata/orcl/system01.dbf';
  set newname for datafile '/ade/aime_10.2_lnx_push/oracle/oradata/seeddata/sysaux01.dbf' to '/u01/app/oracle/oradata/orcl/sysaux01.dbf';
  set newname for datafile '/ade/aime_10.2_lnx_push/oracle/oradata/seeddata/undotbs01.dbf' to '/u01/app/oracle/oradata/orcl/undotbs01.dbf';
  set newname for datafile '/ade/aime_10.2_lnx_push/oracle/oradata/seeddata/users01.dbf' to '/u01/app/oracle/oradata/orcl/users01.dbf';
  restore database;
  switch datafile all;
  }
  cd /u01/app/oracle/oradata/orcl
  [oracle@man /u01/app/oracle/oradata/orcl]$ ls
  Seed_Database.ctl  sysaux01.dbf  system01.dbf  undotbs01.dbf  users01.dbf
  可以看到我们所需要的数据文件都还原回来了,但是现在还缺少log file 。
  我们现在打开数据库。
  因为控制文件中记录的log file路径为 /ade/aime_10.2_lnx_push/oracle/oradata/seeddata 所以要先创建相应的目录。

  SQL>>  此时,在目录/ade/aime_10.2_lnx_push/oracle/oradata/seeddata 下创建了redo01.log,redo02.log,redo03.log,temp01.dbf文件。
  我们要更改这几个文件的路径,所以先将数据库关闭,然后cp /ade/aime_10.2_lnx_push/oracle/oradata/seeddata/× /u01/app/oracle/oradata/orcl/
  启动数据库到mount状态,并更改日志和临时文件的路径

  SQL>>
  Database>
  SQL>>
  Database>
  SQL>>
  Database>
  SQL>>
  Database>
  SQL>>  到此数据库已经建立,并且数据文件也放到了我们期待的地方。但是还有一个问题,就是数据库名称不是我们事先期待的。
  SQL> show parameter name
  NAME                                 TYPE        VALUE
  ------------------------------------ ----------- ------------------------------
  db_file_name_convert                 string
  db_name                              string      SEEDDATA
  db_unique_name                       string      SEEDDATA
  global_names                         boolean     FALSE
  instance_name                        string      orcl
  lock_name_space                      string
  log_file_name_convert                string
  service_names                        string      SEEDDATA
  下面我们将数据库名称SEEDDATA改成我们需要的orcl 。注意此时仅仅更改参数文件的值是不行的,因为控制文件中同样也记录着数据库的名称。
  9.更改数据库名称
  备份控制文件脚本

  SQL>>  SQL> create pfile from spfile;
  将spfile删除,编辑pfile将db_name="SEEDDATA" 改成 db_name="orcl" 。
  vi /tmp/ctl.txt 将其中如下一段
  CREATE CONTROLFILE REUSE DATABASE "SEEDDATA" NORESETLOGS  NOARCHIVELOG
  MAXLOGFILES 16
  MAXLOGMEMBERS 3
  MAXDATAFILES 100
  MAXINSTANCES 8
  MAXLOGHISTORY 292
  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
  -- STANDBY LOGFILE
  DATAFILE
  '/u01/app/oracle/oradata/orcl/system01.dbf',
  '/u01/app/oracle/oradata/orcl/undotbs01.dbf',
  '/u01/app/oracle/oradata/orcl/sysaux01.dbf',
  '/u01/app/oracle/oradata/orcl/users01.dbf',
  '/u01/app/oracle/oradata/orcl/tt.dbf'
  CHARACTER SET US7ASCII
  ;
  修改为
  CREATE CONTROLFILE REUSE DATABASE "SEEDDATA" set database "ORCL"  RESETLOGS  NOARCHIVELOG
  MAXLOGFILES 16
  MAXLOGMEMBERS 3
  MAXDATAFILES 100
  MAXINSTANCES 8
  MAXLOGHISTORY 292
  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
  DATAFILE
  '/u01/app/oracle/oradata/orcl/system01.dbf',
  '/u01/app/oracle/oradata/orcl/undotbs01.dbf',
  '/u01/app/oracle/oradata/orcl/sysaux01.dbf',
  '/u01/app/oracle/oradata/orcl/users01.dbf',
  '/u01/app/oracle/oradata/orcl/tt.dbf'
  CHARACTER SET US7ASCII
  ;
  重新启动数据库到nomount状态 。
  运行上面的建立控制文件的脚本,然后打开数据库 。

  SQL>>  10.控制文件更名并实现冗余。
  修改参数文件initorcl.ora
  *.control_files='/u01/app/oracle/oradata/orcl/control01.ctl','/u01/app/oracle/oradata/orcl/control02.ctl'
  ,'/u01/app/oracle/oradata/orcl/control03.ctl'
  cd /u01/app/oracle/oradata/orcl
  mv Seed_Database.ctl control01.ctl
  cp control01.ctl control02.ctl
  cp control01.ctl control03.ctl
  重新启动数据库,大功告成!


运维网声明 1、欢迎大家加入本站运维交流群:群②:261659950 群⑤:202807635 群⑦870801961 群⑧679858003
2、本站所有主题由该帖子作者发表,该帖子作者与运维网享有帖子相关版权
3、所有作品的著作权均归原作者享有,请您和我们一样尊重他人的著作权等合法权益。如果您对作品感到满意,请购买正版
4、禁止制作、复制、发布和传播具有反动、淫秽、色情、暴力、凶杀等内容的信息,一经发现立即删除。若您因此触犯法律,一切后果自负,我们对此不承担任何责任
5、所有资源均系网友上传或者通过网络收集,我们仅提供一个展示、介绍、观摩学习的平台,我们不对其内容的准确性、可靠性、正当性、安全性、合法性等负责,亦不承担任何法律责任
6、所有作品仅供您个人学习、研究或欣赏,不得用于商业或者其他用途,否则,一切后果均由您自己承担,我们对此不承担任何法律责任
7、如涉及侵犯版权等问题,请您及时通知我们,我们将立即采取措施予以解决
8、联系人Email:admin@iyunv.com 网址:www.yunweiku.com

所有资源均系网友上传或者通过网络收集,我们仅提供一个展示、介绍、观摩学习的平台,我们不对其承担任何法律责任,如涉及侵犯版权等问题,请您及时通知我们,我们将立即处理,联系人Email:kefu@iyunv.com,QQ:1061981298 本贴地址:https://www.iyunv.com/thread-582293-1-1.html 上篇帖子: oracle事物小结 下篇帖子: SYFFOLDER oracle forms开发总结
您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

扫码加入运维网微信交流群X

扫码加入运维网微信交流群

扫描二维码加入运维网微信交流群,最新一手资源尽在官方微信交流群!快快加入我们吧...

扫描微信二维码查看详情

客服E-mail:kefu@iyunv.com 客服QQ:1061981298


QQ群⑦:运维网交流群⑦ QQ群⑧:运维网交流群⑧ k8s群:运维网kubernetes交流群


提醒:禁止发布任何违反国家法律、法规的言论与图片等内容;本站内容均来自个人观点与网络等信息,非本站认同之观点.


本站大部分资源是网友从网上搜集分享而来,其版权均归原作者及其网站所有,我们尊重他人的合法权益,如有内容侵犯您的合法权益,请及时与我们联系进行核实删除!



合作伙伴: 青云cloud

快速回复 返回顶部 返回列表