1 静默安装DB软件
1.1 创建/etc/oraInst.loc文件并添加如下内容: 这里异一定是两行不能写一行,在此处吃过亏,否则安装数据软件的时候报错
inventory_loc=/u01/app/oraInventory inst_group=oinstall 更改文件的权限 chown oracle:oinstall /etc/oraInst.loc chmod 664 /etc/oraInst.loc1.2 创建response文件
修改response文件db_install.rsp,在文件在安装目录的response目录下,根据需求修改这个配置文件。
[root@localhost instanllOracle11g]# cd /database/ [root@localhost database]# ls install readme.html response rpm runInstaller sshsetup stage welcome.html [root@localhost database]# cd response/ [root@localhost response]# pwd /database/response [root@localhost response]# ls dbca.rsp db_install.rsp netca.rsp 文件过滤找到需要修改的地方: cat db_install.rsp |grep -v "#"|grep -v "^$" [root@localhost response]# cat db_install.rsp |grep -v "#"|grep -v "^$" oracle.install.option=INSTALL_DB_SWONLY ORACLE_HOSTNAME= UNIX_GROUP_NAME=oinstall INVENTORY_LOCATION=/u01/app/oraInventory SELECTED_LANGUAGES=en,zh_CN ORACLE_HOME=/u01/app/oracle/product/11.2.0/db_1 ORACLE_BASE=/u01/app/oracle oracle.install.db.InstallEdition=EE oracle.install.db.EEOptionsSelection=false oracle.install.db.optionalComponents=oracle.rdbms.partitioning:11.2.0.4.0,oracle.oraolap:11.2.0.4.0,oracle.rdbms.dm:11.2.0.4.0,oracle.rdbms.dv:11.2.0.4.0,oracle.rdbms.lbac:11.2.0.4.0,oracle.rdbms.rat:11.2.0.4.0 oracle.install.db.DBA_GROUP=dba oracle.install.db.OPER_GROUP=dba oracle.install.db.CLUSTER_NODES= oracle.install.db.isRACOneInstall= oracle.install.db.racOneServiceName= oracle.install.db.config.starterdb.type= oracle.install.db.config.starterdb.globalDBName= oracle.install.db.config.starterdb.SID= oracle.install.db.config.starterdb.characterSet=AL32UTF8 oracle.install.db.config.starterdb.memoryOption=true oracle.install.db.config.starterdb.memoryLimit= oracle.install.db.config.starterdb.installExampleSchemas=false oracle.install.db.config.starterdb.enableSecuritySettings=true oracle.install.db.config.starterdb.password.ALL= oracle.install.db.config.starterdb.password.SYS= oracle.install.db.config.starterdb.password.SYSTEM= oracle.install.db.config.starterdb.password.SYSMAN= oracle.install.db.config.starterdb.password.DBSNMP= oracle.install.db.config.starterdb.control=DB_CONTROL oracle.install.db.config.starterdb.gridcontrol.gridControlServiceURL= oracle.install.db.config.starterdb.automatedBackup.enable=false oracle.install.db.config.starterdb.automatedBackup.osuid= oracle.install.db.config.starterdb.automatedBackup.ospwd= oracle.install.db.config.starterdb.storageType= oracle.install.db.config.starterdb.fileSystemStorage.dataLocation= oracle.install.db.config.starterdb.fileSystemStorage.recoveryLocation= oracle.install.db.config.asm.diskGroup= oracle.install.db.config.asm.ASMSNMPPassword= MYORACLESUPPORT_USERNAME= MYORACLESUPPORT_PASSWORD= SECURITY_UPDATES_VIA_MYORACLESUPPORT= DECLINE_SECURITY_UPDATES=true PROXY_HOST= PROXY_PORT= PROXY_USER= PROXY_PWD= PROXY_REALM= COLLECTOR_SUPPORTHUB_URL= oracle.installer.autoupdates.option= oracle.installer.autoupdates.downloadUpdatesLoc= AUTOUPDATES_MYORACLESUPPORT_USERNAME= AUTOUPDATES_MYORACLESUPPORT_PASSWORD= 可以根据我们的需要手工进行修改,实际上最简单的就是在GUI安装的时候,生成response文件,这样照葫芦画瓢就可以了。 最终我们修改了db_install.rsp中的如下内容: oracle.install.responseFileVersion=/oracle/install/rspfmt_dbinstall_response_schema_v11_2_0 oracle.install.option=INSTALL_DB_SWONLY DECLINE_SECURITY_UPDATES=true UNIX_GROUP_NAME=oinstall INVENTORY_LOCATION=/u01/app/oraInventory SELECTED_LANGUAGES=en,zh_CN ORACLE_HOME=/u01/app/oracle/product/11.2.0/db_1 ORACLE_BASE=/u01/app/oracle oracle.install.db.InstallEdition=EE oracle.install.db.DBA_GROUP=dba oracle.install.db.OPER_GROUP=dba DECLINE_SECURITY_UPDATES=true 其中DECLINE_SECURITY_UPDATES一定要设置成true,否则在安装的时候会出现以下的告警: [WARNING] - My Oracle Support Username/Email Address Not Specified [SEVERE] - Provide the My Oracle Support password. 无法继续安装
1.3 使用response 文件静默安装db软件
[oracle@localhost database]$ ./runInstaller -silent -force -ignorePrereq -ignoreSysPrereqs -responseFile /database/response/db_install.rsp Starting Oracle Universal Installer... Checking Temp space: must be greater than 120 MB. Actual 3690 MB Passed Checking swap space: must be greater than 150 MB. Actual 4095 MB Passed Preparing to launch Oracle Universal Installer from /tmp/OraInstall2017-05-22_11-54-15AM. Please wait ...[oracle@localhost database]$ You can find the loll session at: /u01/app/oraInventory/logs/installActions2017-05-22_11-54-15AM.log [oracle@localhost database]$ ./runInstaller -silent -force -ignorePrereq -ignoreSysPrereqs -responseFile /database/response/db_install.rsp Starting Oracle Universal Installer... Checking Temp space: must be greater than 120 MB. Actual 3464 MB Passed Checking swap space: must be greater than 150 MB. Actual 4095 MB Passed Preparing to launch Oracle Universal Installer from /tmp/OraInstall2017-05-22_11-55-07AM. Please wait ...[oracle@localhost database]$ [WARNING] [INS-32016] The selected Oracle home contains directories or files. CAUSE: The selected Oracle home contained directories or files. ACTION: To start with an empty Oracle home, either remove its contents or choose another location. The installation of Oracle Database 11g was successful. Please check '/u01/app/oraInventory/logs/silentInstall2017-05-22_11-54-15AM.log' for more details. As a root user, execute the following script(s): 1. /u01/app/oracle/product/11.2.0/db_1/root.sh Successfully Setup Software. /u01/app/oracle/product/11.2.0/db_1/root.sh
2 netca静默创建监听 netca.rsp不需要修改,直接建立监听,并且一定要注意环境变量要正确,否则netca 报错 -bash: netca: command not found,出现这个问题 基本是环境变量的问题
[oracle@localhost app]$ netca -silent -responsefile /database/response/netca.rsp Parsing command line arguments: Parameter "silent" = true Parameter "responsefile" = /database/response/netca.rsp Done parsing command line arguments. Oracle Net Services Configuration: Profile configuration complete. Oracle Net Listener Startup: Running Listener Control: /u01/app/oracle/product/11.2.0/db_1/bin/lsnrctl start LISTENER Listener Control complete. Listener started successfully. Listener configuration complete. Oracle Net Services configuration successful. The exit code is 0
3 手工建库
3.1 创建初始化文件
[oracle@localhost dbs]$ pwd /u01/app/oracle/product/11.2.0/db_1/dbs [oracle@localhost dbs]$ ls hc_cndba.dat initcndba.ora init.ora lkCNDBA 从其他环境copy 过来也可以 touch 这个文件 然后添加以下内容: 注意这里是oracle 用户创建,如果使用root 用户创建的话记得赋权限 chown -R oracle:oinstall /u01/app/oracle/product/11.2.0/db_1/dbs/initorcl.ora [oracle@localhost dbs]$ cat initorcl.ora orcl.__db_cache_size=146800640 orcl.__java_pool_size=4194304 orcl.__large_pool_size=587202560 orcl.__oracle_base='/u01/app/oracle'#ORACLE_BASE set from environment orcl.__pga_aggregate_target=25165824 orcl.__sga_target=1023410176 orcl.__shared_io_pool_size=0 orcl.__shared_pool_size=272629760 orcl.__streams_pool_size=0 *.audit_file_dest='/u01/app/oracle/admin/orcl/adump' *.audit_trail='db' *.compatible='11.2.0.4.0' *.control_files='/u01/app/oracle/oradata/orcl/control01.ctl','/u01/app/oracle/fast_recovery_area/orcl/control02.ctl' *.db_block_size=8192 *.db_domain='' *.db_name='orcl' *.db_recovery_file_dest='/u01/app/oracle/fast_recovery_area' *.db_recovery_file_dest_size=4385144832 *.diagnostic_dest='/u01/app/oracle' *.dispatchers='(PROTOCOL=TCP) (SERVICE=orclXDB)' *.memory_target=1048576000 *.open_cursors=300 *.processes=1500 *.remote_login_passwordfile='EXCLUSIVE' *.sessions=1655 *.undo_management='AUTO' *.undo_tablespace='UNDOTBS1'
3.2 创建相关目录 根据当前的环境来创建,一般在$ORACLE_BASE/oradata下,如果使用root 用户创建的话记得赋权限 chown -R oracle:oinstall
[oracle@localhost oracle]$ mkdir oradata [oracle@localhost oracle]$ cd oradata [oracle@localhost oradata]$ mkdir orcl [oracle@localhost oradata]$ cd orcl [oracle@localhost orcl]$ pwd /u01/app/oracle/oradata/orcl [oracle@localhost orcl]$ mkdir -p /u01/app/oracle/fast_recovery_area/orcl/ [oracle@localhost orcl]$ mkdir -p /u01/app/oracle/admin/orcl/adump
3.3 使用pfile 将DB启动到nomount
[oracle@localhost orcl]$ export ORACLE_SID=orcl [oracle@localhost orcl]$ sqlplus / as sysdba SQL*Plus: Release 11.2.0.4.0 Production on Mon May 22 12:45:40 2017 Copyright (c) 1982, 2013, Oracle. All rights reserved. Connected to an idle instance. SQL> startup nomount ORACLE instance started. Total System Global Area 1043886080 bytes Fixed Size 2259840 bytes Variable Size 889193600 bytes Database Buffers 146800640 bytes Redo Buffers 5632000 bytes
3.4 执行创建数据库脚本
CREATE DATABASE orcl USER SYS IDENTIFIED BY oracle USER SYSTEM IDENTIFIED BY oracle LOGFILE GROUP 1 ('/u01/app/oracle/oradata/orcl/redo1.log') SIZE 50M BLOCKSIZE 512, GROUP 2 ('/u01/app/oracle/oradata/orcl/redo2.log') SIZE 50M BLOCKSIZE 512, GROUP 3 ('/u01/app/oracle/oradata/orcl/redo3.log') SIZE 50M BLOCKSIZE 512 MAXLOGFILES 5 MAXLOGMEMBERS 5 MAXLOGHISTORY 1 MAXDATAFILES 100 CHARACTER SET AL32UTF8 NATIONAL CHARACTER SET AL16UTF16 EXTENT MANAGEMENT LOCAL DATAFILE '/u01/app/oracle/oradata/orcl/system01.dbf' SIZE 325M REUSE SYSAUX DATAFILE '/u01/app/oracle/oradata/orcl/sysaux01.dbf' SIZE 325M REUSE DEFAULT TABLESPACE users DATAFILE '/u01/app/oracle/oradata/orcl/users01.dbf'SIZE 500M REUSE AUTOEXTEND ON MAXSIZE UNLIMITED DEFAULT TEMPORARY TABLESPACE tempts1 TEMPFILE '/u01/app/oracle/oradata/orcl/temp01.dbf' SIZE 20M REUSE UNDO TABLESPACE undotbs1 DATAFILE '/u01/app/oracle/oradata/orcl/undotbs01.dbf' SIZE 200M REUSE AUTOEXTEND ON MAXSIZE UNLIMITED;
3.5 执行善后脚本
SQL>@?/rdbms/admin/catalog.sql --约2分钟,作用:创建数据字典 SQL>@?/rdbms/admin/catproc.sql --约5分钟,作用:创建存储过程和包,跑完这两个脚本后库已经建完了。
3.6 验证
SQL>conn system/oracle SQL>@?/sqlplus/admin/pupbld.sql --约1分钟,以conn system/manager 运行此脚本 作用:设置sqlplus的一些包,让其它用户可以登录sqlplus SQL> conn /as sysdba Connected. SQL> select instance_name,status from v$instance; INSTANCE_NAME STATUS -------------------------------- ------------------------ orcl OPEN 1 row selected. SQL> col comp_name for a40 SQL> col version for a15 SQL> col status for a20 SQL> select comp_name,version,status from sys.dba_registry; COMP_NAME VERSION STATUS ---------------------------------------- --------------- -------------------- Oracle Database Catalog Views 11.2.0.4.0 VALID Oracle Database Packages and Types 11.2.0.4.0 VALID 2 rows selected. 这里的2个组件,就是我们之前运行脚本创建的。 我们查看一组用DBCA 创建的实例的组件: SQL> select comp_name,version,status from sys.dba_registry; COMP_NAME VERSION STATUS ---------------------------------------- --------------- -------------------- OWB 11.2.0.4.0 VALID Oracle Application Express 3.2.1.00.12 VALID Oracle Enterprise Manager 11.2.0.4.0 VALID OLAP Catalog 11.2.0.4.0 VALID Spatial 11.2.0.4.0 VALID Oracle Multimedia 11.2.0.4.0 VALID Oracle XML Database 11.2.0.4.0 VALID Oracle Text 11.2.0.4.0 VALID Oracle Expression Filter 11.2.0.4.0 VALID Oracle Rules Manager 11.2.0.4.0 VALID Oracle Workspace Manager 11.2.0.4.0 VALID COMP_NAME VERSION STATUS ---------------------------------------- --------------- -------------------- Oracle Database Catalog Views 11.2.0.4.0 VALID Oracle Database Packages and Types 11.2.0.4.0 VALID JServer JAVA Virtual Machine 11.2.0.4.0 VALID Oracle XDK 11.2.0.4.0 VALID Oracle Database Java Packages 11.2.0.4.0 VALID OLAP Analytic Workspace 11.2.0.4.0 VALID Oracle OLAP API 11.2.0.4.0 VALID 18 rows selected. 缺少的组件也继续可以运行脚本创建,我们这里添加OLAP 和Spatial组件: @?/olap/admin/olap.sql SYSAUX TEMP; @?/md/admin/mdinst.sql SQL> select comp_name,version,status from sys.dba_registry; COMP_NAME VERSION STATUS ---------------------------------------- --------------- -------------------- Oracle Database Catalog Views 11.2.0.4.0 VALID Oracle Database Packages and Types 11.2.0.4.0 VALID OLAP Analytic Workspace 11.2.0.4.0 VALID Oracle OLAP API 11.2.0.4.0 LOADED 2017-05-23 17:4124300原创Oracle 11g编辑删除 本文链接:https://www.cndba.cn/leo1990/article/1929 [2017-05-23 17:4124300 Yuánchuàng Oracle 11g biānjí shānchú běnwén liànjiē:Https://Www.Cndba.Cn/leo1990/article/1929] 2017-05-23 17:4124300 original Oracle 11g edit delete This article links: https://www.cndba.cn/leo1990/article/1929