In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-16 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >
Share
Shulou(Shulou.com)06/01 Report--
Install oracle 11g silently on Centos7.0 without desktop environment
1 configure the basic environment 1.1 create users and groups
Groupadd oinstall # create oinstall
Groupadd dba # create a dba group
Useradd-g oinstall-G dba oracle # create oracle user
Passwd oracle # modify the login password of an oracle user
[root@test-1 oracle] # id oracle # View oracle user information
Uid=1000 (oracle) gid=1000 (oinstall) groups=1000 (oinstall), 1001 (dba)
1.2 create a directory
Mkdir-p / mnt/app/oracle
Chown-R oracle:oinstall / mnt/app/oracle
Chmod-R 775 / mnt/app/oracle
1.3 install dependency packages
Dependency packages are necessary to install oracle, and if some required dependency packages are not installed, a variety of errors will occur during installation. Therefore, the installation of the dependency package is complete and the installation process is generally smooth.
Execute the following command directly to install the dependency package.
Yum-y install binutils compat-libcap1compat-libstdc++-33 compat-libstdc++-33*i686 compat-libstdc++-33*.develcompat-libstdc++-33 compat-libstdc++-33*.devel gcc gcc-c++ glibc glibc*.i686glibc-devel glibc-devel*.i686 ksh libaio libaio*.i686 libaio-devellibaio-devel*.devel libgcc libgcc*.i686 libstdc++ libstdc++*.i686libstdc++-devel libstdc++-devel*.devel libXi libXi*.i686 libXtst libXtst*.i686make sysstat unixODBC unixODBC*.i686 unixODBC-devel unixODBC-devel*.i686
Refer to the official: http://docs.oracle.com/cd/E11882_01/install.112/e24326/toc.htm#BHCCADGD
The following or later version of packagesfor Oracle Linux 7, and Red Hat Enterprise Linux 7 must be installed:
Binutils-2.23.52.0.1-12.el7.x86_64
Compat-libcap1-1.10-3.el7.x86_64
Compat-libstdc++-33-3.2.3-71.el7.i686
Compat-libstdc++-33-3.2.3-71.el7.x86_64
Gcc-4.8.2-3.el7.x86_64
Gcc-c++-4.8.2-3.el7.x86_64
Glibc-2.17-36.el7.i686
Glibc-2.17-36.el7.x86_64
Glibc-devel-2.17-36.el7.i686
Glibc-devel-2.17-36.el7.x86_64
Ksh
Libaio-0.3.109-9.el7.i686
Libaio-0.3.109-9.el7.x86_64
Libaio-devel-0.3.109-9.el7.i686
Libaio-devel-0.3.109-9.el7.x86_64
Libgcc-4.8.2-3.el7.i686
Libgcc-4.8.2-3.el7.x86_64
Libstdc++-4.8.2-3.el7.i686
Libstdc++-4.8.2-3.el7.x86_64
Libstdc++-devel-4.8.2-3.el7.i686
Libstdc++-devel-4.8.2-3.el7.x86_64
LibXi-1.7.2-1.el7.i686
LibXi-1.7.2-1.el7.x86_64
LibXtst-1.2.2-1.el7.i686
LibXtst-1.2.2-1.el7.x86_64
Make-3.82-19.el7.x86_64
Sysstat-10.1.5-1.el7.x86_64
UnixODBC-2.3.1-6.el7.x86_64 or later
UnixODBC-2.3.1-6.el7.i686 or later
UnixODBC-devel-2.3.1-6.el7.x86_64 or later
UnixODBC-devel-2.3.1-6.el7.i686 or later
1.4 change the hosts file
In the hosts file, add the hostname to the configuration file and add it to 127.0.0.1. If it is not added, there will be errors during installation.
Check the hostname first: use the hostname command
[root@test-1 oracle] # hostname
Test-1
If the hostname is test-1, add test-1 to the / etc/hosts file:
[root@test-1 oracle] # vi / etc/hosts
127.0.0.1 localhost localhost.localdomain localhost4 localhost4.localdomain4test-1
:: 1 localhost localhost.localdomain localhost6 localhost6.localdomain6
Add your hostname to the file and save exit.
1.5 configure kernel parameters / etc/sysctl.conf
Edit the sysctl.conf file
`[ root@test-1 oracle] # vi / etc/sysctl.conf
Add the following configuration
Fs.aio-max-nr = 1048576
Fs.file-max = 6815744
Kernel.shmall = 2097152
Kernel.shmmax = 536870912
Kernel.shmmni = 4096
Kernel.sem = 250 32000 100 128
Net.ipv4.ip_local_port_range = 9000 65500
Net.core.rmem_default = 262144
Net.core.rmem_max = 4194304
Net.core.wmem_default = 262144
Net.core.wmem_max = 1048576
Vm.hugetlb_shm_group = 1001 # this is the same as in dba in id oracle
To make the kernel parameters take effect, execute: / sbin/sysctl-p
1.6 modify user restrictions
Vi / etc/security/limits.conf
# add at the end
Oracle soft nproc 2047
Oracle hard nproc 16384
Oracle soft nofile 1024
Oracle hard nofile 65536
Oracle soft stack 10240
Save exit.
1.7 modify / etc/pam.d/login
Vi / etc/pam.d/login
Open and edit this file and add the following configuration at the end:
Session required / lib64/security/pam_limits.so
Session required pam_limits.so
Note: here, to use lib64, if you use lib, you may not be able to log in to the system. Lib is used in the case of 32-bit. If it is a 64-bit system, lib64 should be used.
Save exit.
1.8 modify the system configuration file / etc/profile
Vi / etc/profile
Add the following configuration:
If [[$USER = "oracle"]]; then
If [[$SHELL = "/ bin/ksh"]; then
Ulimit-p16384
Ulimit-n65536
Else
Ulimit-u16384-n 65536
Fi
Fi
Pay attention to the spaces
Save exit
Make it effective source / etc/profile
1.9 modify oracle user environment variables
Vi / home/oracle/.bash_profile
Add the following configuration file:
# oracle
Export TMP=/tmp
Export TMPDIR=$TMP
Export ORACLE_BASE=/mnt/app/oracle
ExportORACLE_HOME=$ORACLE_BASE/product/12.1.0/db_1
Export ORACLE_SID=orcl
Export ORACLE_TERM=xterm
Export PATH=/usr/sbin:$PATH
Export PATH=$ORACLE_HOME/bin:$PATH
Export LD_LIBRARY_PATH=$ORACLE_HOME/lib:/lib:/usr/lib
ExportCLASSPATH=$ORACLE_HOME/JRE:$ORACLE_HOME/jlib:$ORACLE_HOME/rdbms/jlib
Save exit.
Make it work: source / home/oracle/.bash_profile
2 start installing oracle2.1, upload and decompress oracle installation files
Use sftp to upload the installation file to the server.
Extract the folder
[root@test-1 oracle] # unziplinuxamd64_12102_database_1of2.zip
[root@test-1 oracle] # unziplinuxamd64_12102_database_2of2.zip
After pressurization, get a folder of database and move it to the / mnt/app/oracle directory
Mv database / mnt/app/oracle
Authorize files
Chown-R oracle:oinstall/mnt/app/oracle/database
2.2 Editing and installing the database response file db_install.rsp
The final installation is mainly related to the configuration of three response files: dbca.rsp,netca.rsp,db_install.rsp, which corresponds to creating the database, creating the monitor, and installing the database. The paths to the three files are under the database/response folder.
To prevent errors, we copy the three response files to the oracle user path, and after the error, you can delete and copy the changes.
Under the oracle user directory, create an etc folder
[oracle@test-1 /] $mkdir / home/oracle/etc
Copy response file
[oracle@test-1 /] $cp / mnt/app/oracle/database/response/*/home/oracle/etc
[oracle@test-1 /] $ls / home/oracle/etc/
Dbca.rsp db_install.rsp netca.rsp
Authorization
[oracle@test-1 /] $su-root
[root@test-1 ~] # chmod 777 / home/oracle/etc/*.rsp
Edit the installation response file
[root@test-1 ~] # vi / home/oracle/etc/db_install.rsp
Find the following configuration and change the configuration as follows:
`oracle.install.option=INSTALL_DB_SWONLY / / installation type
ORACLE_HOSTNAME=test-1 / / Host name (hostname query)
UNIX_GROUP_NAME=oinstall / / installation group
INVENTORY_LOCATION=/mnt/app/oracle/oraInventory//INVENTORY directory (left empty is the default)
SELECTED_LANGUAGES=en / / Select language
ORACLE_HOME=/mnt/app/oracle/product/12.1.0/db_1//oracle_home
ORACLE_BASE=/mnt/app/oracle / / oracle_base
Oracle.install.db.InstallEdition=EE / / oracle version
Oracle.install.db.isCustomInstall=false / / Custom installation, No, use default components
Oracle.install.db.DBA_GROUP=dba / / dba user group
Oracle.install.db.OPER_GROUP=dba / / oper user group
Oracle.install.db.config.starterdb.type=GENERAL_PURPOSE// database type
Oracle.install.db.config.starterdb.globalDBName=orcl//globalDBName
Oracle.install.db.config.starterdb.SID=orcl//SID
Oracle.install.db.config.starterdb.password.ALLroomAdmings 123 database users / set all database users to use the same password
SECURITY_UPDATES_VIA_MYORACLESUPPORT=false// (false written manually)
DECLINE_SECURITY_UPDATES=true / / set security update (there seems to be bug, this must be selected true, otherwise it will infinitely remind you that there is a problem with the email address and terminate the installation. PS: no matter whether the address is correct or not) `
After the configuration. Save exit.
2.3 start installing the database. Switch to oracle user
[root@test-1 ~] # su-oracle
[oracle@test-1 database] $/ mnt/app/oracle/database/runInstaller-silent-responseFile / home/oracle/etc/db_install.rsp
The installation process is as follows, and the following results show that the installation is successful
Starting Oracle Universal Installer...
Checking Temp space: must be greater than500 MB. Actual 17997 MB Passed
Checking swap space: must be greater than150 MB. Actual 2999 MB Passed
Preparing to launch Oracle UniversalInstaller from / tmp/OraInstall2017-06-04. 07-51-31PM. Please wait. [Oracle @ test-1 database] $[WARNING] [INS-32055] The Central Inventory is locatedin the Oracle base.
ACTION: Oracle recommends placing thisCentral Inventory in a location outside the Oracle base directory.
[WARNING] [INS-13014] Target environmentdoes not meet some optional requirements.
CAUSE: Some of the optional prerequisitesare not met. See logs for details./tmp/OraInstall2017-06-04-07-51-31PM/installActions2017-06-04-07-51-31PM.log
ACTION: Identify the list of failedprerequisite checks from the log:/tmp/OraInstall2017-06-04-07-51-31PM/installActions2017-06-04-07-51-31PM.log.Then either from the log file or from installation manual find the appropriateconfiguration to meet the prerequisites and fix it manually.
You can find the log of this installsession at:
/ mnt/app/oracle/oraInventory/logs/installActions2017-06-04 / 07-51-31PM.log
The installation of Oracle Database 12c wassuccessful.
Please check'/mnt/app/oracle/oraInventory/logs/silentInstall2017-06-04. 07-51-31 PM. Log 'formore details.
As a root user, execute the followingscript (s):
1. / mnt/app/oracle/oraInventory/orainstRoot.sh
2. / mnt/app/oracle/product/12.1.0/db_1/root.sh
Successfully Setup Software
2.4 Log in using the root user and execute the
/ mnt/app/oracle/oraInventory/orainstRoot.sh
/ mnt/app/oracle/product/12.1.0/db_1/root.sh
At this point, the database has been successfully installed.
2.5 configure, start snooping
The listener configuration response file is: / home/oracle/etc/netca.rsp, which can be used by default.
Perform configuration snooping
[oracle@test-1 database] $netca / silent/responsefile / home/oracle/etc/netca.rsp
The following message appears, indicating that the monitoring configuration was successful.
[oracle@test-1 oracle] $netca / silent/responsefile / home/oracle/etc/netca.rsp
Parsing command line arguments:
Parameter "silent" = true
Parameter "responsefile" = / home/oracle/etc/netca.rsp
Complete the syntax analysis of the command line parameters.
Oracle Net Services configuration:
Complete the profile configuration.
The Oracle Net listener starts:
Running listener controls:
/ mnt/app/oracle/product/12.1.0/db_1/bin/lsnrctl start LISTENER
Listener control complete.
The listener started successfully.
The listener configuration is complete.
Oracle Net Services configuration completed successfully. The exit code is 0
After running successfully, generate listener.ora and sqlnet.ora in / mnt/app/oracle/product/12.1.0/db_1/network/admin/
You can see that port 1521 is listening through the netstat command.
Yum installs netstat software, and the package is in net-tools
[root@test-1 ~] # yum install net-tools
[root@test-1 ~] # netstat-lntup | grep 1521
Tcp6 0 0: 1521: * LISTEN 14496/tnslsnr
2.5.1 initiate monitoring
[oracle@test-1 database] $lsnrctl start
View monitoring status
[oracle@test-1 database] $lsnrctl status
LSNRCTL for Linux: Version 12.1.0.2.0-Production on 04-JUN-2017 20:15:07
Copyright (c) 1991, 2014, Oracle. Allrights reserved.
Connecting to (DESCRIPTION= (ADDRESS= (PROTOCOL=TCP) (HOST=localhost) (PORT=1521)
STATUS of the LISTENER
Alias LISTENER
Version TNSLSNR for Linux: Version12.1.0.2.0-Production
Start Date 04-JUN-2017 20:08:08
Uptime 0 days 0 hr. 7 min. 0 sec
Trace Level off
Security ON: Local OS Authentication
SNMP OFF
Listener Parameter File/mnt/app/oracle/product/12.1.0/db_1/network/admin/listener.ora
Listener Log File/mnt/app/oracle/diag/tnslsnr/test-1/listener/alert/log.xml
Listening Endpoints Summary...
(DESCRIPTION= (ADDRESS= (PROTOCOL=tcp) (HOST=localhost) (PORT=1521))
(DESCRIPTION= (ADDRESS= (PROTOCOL=ipc) (KEY=EXTPROC1521)
The listener supports no services
The command completed successfully
2.5.2 restart snooping
[oracle@test-1 database] $lsnrctl reload
2.6 silently create a database instance 2.6.1 Edit the answer file
[oracle@test-1 /] $su-root
[root@test-1 ~] # vim/home/oracle/etc/dbca.rsp
Set the following parameters:
GDBNAME = "orcl"
SID = "orcl"
SYSPASSWORD = "oracle"
SYSTEMPASSWORD = "oracle"
SYSMANPASSWORD = "oracle"
DBSNMPPASSWORD = "oracle"
DATAFILEDESTINATION=/mnt/app/oracle/oradata
RECOVERYAREADESTINATION=/mnt/app/oracle/fast_recovery_area
CHARACTERSET = "ZHS16GBK"
TOTALMEMORY = "1638"
Where TOTALMEMORY = "1638" is 1638MB and physical memory is 2Gbps. Perform installation of database instance
Switch to oracle user
[root@test-1 ~] # su-oracle
[oracle@test-1 ~] $dbca-silent-responseFile / home/oracle/etc/dbca.rsp
The log shows that the database instance has been created successfully.
2.6.2 check the instance process after the database is built:
[oracle@test-1 ~] $ps-ef | grep ora_ | grep-v grep
2.6.3 check the monitoring status:
[oracle@test-1~] $lsnrctl status
2.6.4 Log in to view instance status:
[oracle@test-1 ~] $sqlplus / as sysdba
SQL > select status from v$instance
2.7 start and stop of the database
Go to the bin directory of the oracle installation directory and execute dbstop to stop the database.
2.8Open port (using root users)
As the database installation generally requires external network access, it is necessary to open the database connection port.
[root@test-1 /] # firewall-cmd-zone=public--add-port=1521/tcp-permanent
Success
[root@test-1 /] # firewall-cmd-zone=public--add-port=5500/tcp-permanent
Success
[root@test-1 /] # firewall-cmd-- reload
Success
Meaning of the command:
-- zone # scope
-- add-port=80/tcp # add port in the format: Port / communication protocol
-- permanent # is in effect forever. Without this parameter, it will expire after restart.
Restart the firewall
Firewall-cmd-reload
2.9. set the oracle database to start automatically with the system boot.
1. Modify / mnt/app/oracle/product/12.1.0/db_1/bin/dbstart
[oracle@test-1 ~] $vim/mnt/app/oracle/product/12.1.0/db_1/bin/dbstart
Change ORACLE_HOME_LISTNER=$1 to ORACLE_HOME_LISTNER=$ORACLE_HOME
2. Modify / mnt/app/oracle/product/12.1.0/db_1/bin/dbshut
[oracle@test-1 ~] $vim / mnt/app/oracle/product/12.1.0/db_1/bin/dbshut
Change ORACLE_HOME_LISTNER=$1 to ORACLE_HOME_LISTNER=$ORACLE_HOME
3. Modify / etc/oratab file
[oracle@test-1~] $vim / etc/oratab
Change the last N in orcl:/mnt/app/oracle/product/11.2.0:N to Y to become orcl:/mnt/app/oracle/product/11.2.0:Y
2.9.1 enter commands dbshut and dbstart test
[oracle@test-1~] $dbshut
Oracle snooping stops and the process disappears.
Oracle snooping starts and the process starts.
2.9.2. Edit / etc/rc.d/rc.local2.9.2.1 scheme 1: self-start
Vi / etc/rc.d/rc.local
Add the following configuration:
Su oracle-lc "/ mnt/app/oracle/product/12.1.0/db_1/bin/lsnrctlstart"
Su oracle-lc / mnt/app/oracle/product/12.1.0/db_1/bin/dbstart
Save exit
Restart the system, connect to the database again, and connect normally.
2.9.2.2 option 2: switch to the root account to establish a self-startup script
[oracle@test-1~] $su-
[root@test-1~] # vim / etc/rc.d/init.d/oracle
Add the following (some values such as ORACLE_HOME and ORACLE_USER can be modified according to the actual situation):
[root@test-1 ~] # cat/etc/rc.d/init.d/oracle
#! / bin/bash
# oracle: Start/Stop Oracle Database 11g R2
# chkconfig: 345 90 10
# description: The Oracle Database is anObject-Relational Database Management System.
#
. / etc/rc.d/init.d/functions
LOCKFILE=/mnt/app/oracle/var/lock/subsys/oracle
ORACLE_HOME=/mnt/app/oracle/product/12.1.0/db_1/
ORACLE_USER=oracle
Case "$1" in
'start')
If [!-f $LOCKFILE]
Then
Touch "$LOCKFILE"
Else
Exit 1
Fi
Su- $ORACLE_USER-c "$ORACLE_HOME/bin/lsnrctl start"
Su- $ORACLE_USER-c "$ORACLE_HOME/bin/dbstart"
Su- $ORACLE_USER-c "$ORACLE_HOME/bin/emctl start dbconsole"
Echo-n $"Starting Oracle Database:"
'stop')
If [!-f $LOCKFILE]; then
Echo $0 already stopping.
Exit 1
Fi
Echo-n $"Stopping Oracle Database:"
Su- $ORACLE_USER-c "$ORACLE_HOME/bin/lsnrctl stop"
Su- $ORACLE_USER-c "$ORACLE_HOME/bin/dbshut"
Su- $ORACLE_USER-c "$ORACLE_HOME/bin/emctl stop dbconsole"
Rm-f "$LOCKFILE"
'restart')
$0stop
$0start
'status')
If [- e $LOCKFILE]
Then
Echo $0 started.
Else
Echo $0 stopped.
Fi
*)
Echo "Usage: $0 [start | stop | status]"
Exit 1
Esac
Exit 0
2.9.2.3 modify / etc/init.d/oracle service file permissions
[root@test-1 ~] # chmod 755 / etc/init.d/oracle
[root@test-1 ~] # ll / etc/init.d/oracle
-rwxr-xr-x 1 root root 1203 June 29 10:59 / etc/init.d/oracle
2.9.2.4 set boot up
[root@test-1 ~] # chkconfig oracle on
2.9.2.5 for serviceoracle start/stop/restart testing
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.