admin管理员组

文章数量:1531375


图形化安装数据库软件,创建数据库,配置监听大家都很熟悉了,本篇博客分为几部分来演示应答方式(response)安装数据库软件、创建数据库等操作。
这种方式的好处是可以深入了解没有安装配置的细节。
首先来看一张OFA的脉络图,虽然生产环境总会自定义这些路径,但是总的框架还是不会变的。


OFA标准中的几个重要目录:
oracle清单目录 oraInventory
/u01/app/oraInventory
oracle基础目录  ORACLE_BASE
/u01/app/oracle
oracle主目录  ORACLE_HOME
/u01/app/oracle/product/12.1.0/db_1
如果环境中有测试、开发可以在这里用db_1, db_2来区分; 如果只有一个生产环境可以去掉db_1
/u01/app/oracle/product/12.1.0      生产 /u01/app/oracle/product/12.1.0/db_1 开发 /u01/app/oracle/product/12.1.0/db_2 测试
oracle网络目录 TNS_ADMIN
/u01/app/oracle/product/12.1.0/db_1/network/admin
自动诊断库目录
ADR_HOME
/u01/app/oracle/diag/rdbms/db_unique_name/instance_name
select value from v$diag_info where name='ADR Home'

/u01为操作系统挂载点,通常会出现/u01,/u02,/u03等等。 如果命名为/ora01会一目了然该挂载点为oracle数据库所用。
下面开始准备工作
一,OS准备工作 主机名 [root@snow ~]# hostname snow.oracle
hosts配置 [root@snow ~]# vi /etc/hosts 127.0.0.1 localhost localhost.localdomain localhost4 localhost4.localdomain4 ::1 localhost localhost.localdomain localhost6 localhost6.localdomain6 172.16.228.12 snow.oracle
操作系统版本 [root@snow ~]# cat /etc/redhat-release Red Hat Enterprise Linux Server release 6.6 (Santiago)
磁盘空间 [root@snow ~]# df -h Filesystem Size Used Avail Use% Mounted on /dev/sda2 36G 3.2G 31G 10% / tmpfs 1.8G 72K 1.8G 1% /dev/shm
内存大小 [root@snow ~]# grep MemTotal /proc/meminfo MemTotal: 3772548 kB
swap使用情况 [oracle@snow ~]$ free -t total used free shared buffers cached Mem: 3772548 3237804 534744 2372 44880 2819740 -/+ buffers/cache: 373184 3399364 Swap: 4194300 0 4194300 Total: 7966848 3237804 4729044
挂载OS安装光盘 [root@snow ~]# mount /dev/cdrom /mnt mount: block device /dev/sr0 is write-protected, mounting read-only
创建repos文件 root@snow ~]# cd /etc/yum.repos.d/ [root@snow yum.repos.d]# mv public-yum-ol6.repo public-yum-ol6.repo.bak
[root@snow yum.repos.d]# vi snow12c.repo [Oracle] name=OEL-$releasever - Media baseurl=file:///mnt gpgcheck=0 enabled=1
创建组、用户、安装rpm包 [root@snow yum.repos.d]# yum install oracle-rdbms-server-12cR1-preinstall
检测组、用户创建效果 [oracle@snow ~]$ id oracle uid=54321(oracle) gid=54321(oinstall) groups=54321(oinstall),54322(dba)
修改oracle密码 root@snow yum.repos.d]# passwd oracle Changing password for user oracle
cat /etc/group cat /etc/passwd
如果不符合要求可以修改或删除 groupmod/groupdel usremode/userdel
修改限制文件 [root@snow yum.repos.d]# vi /etc/security/limits.conf
oracle soft nofile 1024 oracle hard nofile 65536 oracle soft nproc 2047 oracle hard nproc 16384 oracle soft stack 10240 oracle hard stack 32768
禁用防火墙 # service iptables stop iptables: Setting chains to policy ACCEPT: filter [ OK ] iptables: Flushing firewall rules: [ OK ] iptables: Unloading modules: [ OK ]
禁用SELINUX,注意黄色字体 [root@snow yum.repos.d]# vi /etc/selinux/config # This file controls the state of SELinux on the system. # SELINUX= can take one of these three values: # enforcing - SELinux security policy is enforced. # permissive - SELinux prints warnings instead of enforcing. # disabled - No SELinux policy is loaded. SELINUX= disabled # SELINUXTYPE= can take one of these two values: # targeted - Targeted processes are protected, # mls - Multi Level Security protection. SELINUXTYPE=targeted
创建oracle安装目录 [root@snow yum.repos.d]# mkdir -p /u01/app/oracle [root@snow yum.repos.d]# chown -R oracle:oinstall /u01 [root@snow yum.repos.d]# chmod -R 775 /u01
二,数据库软件准备工作 创建安装介质目录 su - oracle [oracle@snow ~]$ mkdir -p orainst/12.1.0.1
ftp上传介质到指定目录 ftp linux_12c_database_1of2.zip /home/oracle/orainst/12.1.0.1 ftp linux_12c_database_2of2.zip /home/oracle/orainst/12.1.0.1
解压缩安装包 cd /home/oracle/orainst/12.1.0.1 unzip linux_12c_database_1of2.zip unzip linux_12c_database_2of2.zip
创建oraInst.loc $ cat /etc/oraInst.loc inventory_loc=/u01/app/oraInventory inst_group=oinstall
chown oracle:oinstall oraInst.loc chmod 664 oraInst.loc
配置bash_profile cd /home/oracle [oracle@snow ~]$ vi .bash_profile export ORACLE_BASE=/u01/app/oracle export ORACLE_HOME=$ORACLE_BASE/product/12.1.0.1/db_1 export ORACLE_SID=cdb export PATH=$ORACLE_HOME/bin:$ORACLE_HOME/OPatch:$PATH export LD_LIBRARY_PATH=$ORACLE_HOME/lib:$LD_LIBRARY_PATH stty erase ^h
[oracle@snow ~]$ . .bash_profile
检查环境变量是否生效 [oracle@snow ~]$ env|grep ORA ORACLE_SID=cdb ORACLE_BASE=/u01/app/oracle ORACLE_HOME=/u01/app/oracle/product/12.1.0/db_1
三,配置应答文件 复制一个应答文件作为模板来修改
通常应答文件在数据库软件解压缩路径下的response cd /home/oracle/orainst/12.1.0.1/database/response -rwxrwxr-x. 1 oracle oinstall 58021 Aug 29 2012 dbca.rsp -rw-rw-r--. 1 oracle oinstall 26690 May 24 2013 db_install.rsp -rwxrwxr-x. 1 oracle oinstall 6038 Jun 18 2012 netca.rsp
cp -rp db_install.rsp inst.rsp
修改后的inst.rsp如下 oracle.install.responseFileVersion=/oracle/install/rspfmt_dbinstall_response_schema_v12.1.0 oracle.install.option= INSTALL_DB_SWONLY ORACLE_HOSTNAME= snow.oracle UNIX_GROUP_NAME= oinstall INVENTORY_LOCATION= /u01/app/oraInventory SELECTED_LANGUAGES=en ORACLE_HOME= /u01/app/oracle/product/12.1.0.1 ORACLE_BASE= /u01/app/oracle oracle.install.db.InstallEdition= EE oracle.install.db.DBA_GROUP= dba oracle.install.db.OPER_GROUP= oper oracle.install.db.BACKUPDBA_GROUP= dba oracle.install.db.DGDBA_GROUP= dba oracle.install.db.KMDBA_GROUP= dba DECLINE_SECURITY_UPDATES= true SECURITY_UPDATES_VIA_MYORACLESUPPORT= false oracle.installer.autoupdates.option= SKIP_UPDATES
执行应答方式安装数据库 [oracle@snow database]$ ./runInstaller -ignoreSysPrereqs -force -silent -responseFile /home/oracle/orainst/12.1.0.1/database/response/inst.rsp Starting Oracle Universal Installer...
Checking Temp space: must be greater than 500 MB. Actual 25953 MB Passed Checking swap space: must be greater than 150 MB. Actual 4095 MB Passed Preparing to launch Oracle Universal Installer from /tmp/OraInstall2015-02-28_07-20-40AM. Please wait ...[oracle@snow database]$ [WARNING] [INS-35342] The specified group for Database Operator (OSOPER) group (Optional): may not be defined in the system. CAUSE: The OS group you specified as Database Operator (OSOPER) group (Optional): may not be configured on the server, or in the Network Information Service (NIS). ACTION: Check the group name you selected, and specify a different group, or create the group on the server or in the Network Information Service. You can find the log of this install session at: /u01/app/oraInventory/logs/installActions2015-02-28_07-20-40AM.log The installation of Oracle Database 12c was successful. Please check '/u01/app/oraInventory/logs/silentInstall2015-02-28_07-20-40AM.log' for more details.
As a root user, execute the following script(s): 1. /u01/app/oracle/product/12.1.0.1/db_1/root.sh

Successfully Setup Software.
按照提示使用root用户执行脚本 [root@snow ~]# /u01/app/oracle/product/12.1.0.1/db_1/root.sh Check /u01/app/oracle/product/12.1.0.1/db_1/install/root_snow.oracle_2015-02-28_07-23-11.log for the output of root script
测试软件安装效果 [oracle@snow ~]$ sqlplus /nolog
SQL*Plus: Release 12.1.0.1.0 Production on Sat Feb 28 08:30:43 2015
Copyright (c) 1982, 2013, Oracle. All rights reserved.
SQL>
由于篇幅较长,应答方式创建数据库、配置等再后续的博客中发出。

附录 完整版应答文件内容很多 除去注释内容的方法: [oracle@snow database]$ sed -n '/^[^#]/p' response/db_install.rsp oracle.install.responseFileVersion=/oracle/install/rspfmt_dbinstall_response_schema_v12.1.0 oracle.install.option= ORACLE_HOSTNAME= UNIX_GROUP_NAME= INVENTORY_LOCATION= SELECTED_LANGUAGES=en ORACLE_HOME= ORACLE_BASE= oracle.install.db.InstallEdition= oracle.install.db.DBA_GROUP= oracle.install.db.OPER_GROUP= oracle.install.db.BACKUPDBA_GROUP= oracle.install.db.DGDBA_GROUP= oracle.install.db.KMDBA_GROUP= oracle.install.db.rac.configurationType= oracle.install.db.CLUSTER_NODES= oracle.install.db.isRACOneInstall= oracle.install.db.racOneServiceName= oracle.install.db.rac.serverpoolName= oracle.install.db.rac.serverpoolCardinality= oracle.install.db.config.starterdb.type= oracle.install.db.config.starterdb.globalDBName= oracle.install.db.config.starterdb.SID= oracle.install.db.ConfigureAsContainerDB= oracle.install.db.config.PDBName= oracle.install.db.config.starterdb.characterSet= oracle.install.db.config.starterdb.memoryOption= oracle.install.db.config.starterdb.memoryLimit= oracle.install.db.config.starterdb.installExampleSchemas= 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.DBSNMP= oracle.install.db.config.starterdb.password.PDBADMIN= oracle.install.db.config.starterdb.managementOption= oracle.install.db.config.starterdb.omsHost= oracle.install.db.config.starterdb.omsPort= oracle.install.db.config.starterdb.emAdminUser= oracle.install.db.config.starterdb.emAdminPassword= oracle.install.db.config.starterdb.enableRecovery= 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= 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=

来自 “ ITPUB博客 ” ,链接:http://blog.itpub/29047826/viewspace-1443856/,如需转载,请注明出处,否则将追究法律责任。

转载于:http://blog.itpub/29047826/viewspace-1443856/

本文标签: 方式数据库软件