Oracle 11g Linux centros7 installation
Oracle 11g graphical installation requires the installation of xmmanager or vnc, which is troublesome and error prone in the intermediate process. The following describes the silent installation.
preparation
1.1 modify the host name and configure the host file
vim /etc/hosts 127.0.0.1 orcl-db
1.2 SELinux & iptables needs to be closed:
vim /etc/selinux/config Modification: SELINUX=disabled service iptables stop chkconfig iptables off
yum install dependencies
yum install gcc make binutils gcc-c++ compat-libstdc++-33elfutils-libelf-devel elfutils-libelf-devel-static ksh libaio libaio-develnumactl-devel sysstat unixODBC unixODBC-devel pcre-devel –y
Kernel parameter setting
fs.file-max = 6815744 kernel.sem = 250 32000 100 128 kernel.shmmni = 4096 kernel.shmall = 1073741824 kernel.shmmax = 4398046511104 kernel.panic_on_oops = 1 net.core.rmem_default = 262144 net.core.rmem_max = 4194304 net.core.wmem_default = 262144 net.core.wmem_max = 1048576 net.ipv4.conf.all.rp_filter = 2 net.ipv4.conf.default.rp_filter = 2 fs.aio-max-nr = 1048576 net.ipv4.ip_local_port_range = 9000 65500
Parameter details:
kernel.shmall:
This parameter controls the total number of pages of shared memory that can be used. The size of Linux shared memory page is 4KB, and the size of shared memory segment is an integer multiple of the size of shared memory page. The maximum size of a shared memory segment is 16G, so the number of pages of shared memory required is 16GB/4KB=16777216KB /4KB=4194304 (pages), that is, 16GB physical memory under the 64Bit system. Set kernel.shmall = 4194304 to meet the requirements
kernel.shmmax:
Is one of the most important parameters in the core parameters. It is used to define the maximum value of a single shared memory segment. The setting should be large enough. Setting too low may lead to the need to create multiple shared memory segments, which may lead to the decline of system performance. The main reason for system degradation is that multiple small shared memory segments may lead to slight system performance degradation during instance startup and ServerProcess creation (multiple virtual address segments need to be created during startup, and the process needs to "identify" multiple segments during process creation, which will have some impact), But it won't affect other times.
Official recommended value:
32-bit linux system: the maximum value is 4GB (4294967296bytes) - 1byte, i.e. 4294967295. The recommended value is more than half of the memory, so if 32 is the system, the general value can be 4294967295.
64 bit linux system: the maximum desirable value is - 1byte of physical memory, and the recommended value is more than half of physical memory. For example, if it is 12GB of physical memory, 1210241024 * 1024-1 = 12884901887 can be used.
kernel.shmmni:
This parameter is the maximum number of shared memory segments. The default value of shmmni is 4096. Generally, it must be enough.
kernel.sem:
Take kernel.sem = 250 32000 100 128 as an example:
250 is the value of the parameter semmsl, indicating the maximum number of semaphores that can be included in a semaphore set.
32000 is the value of parameter semmns, indicating the maximum number of semaphores allowed in the system.
100 is the value of the parameter semopm, indicating the number of operations that a single semopm() call can perform on a semaphore set.
128 is the value of the parameter semmni, which represents the total number of system semaphore sets.
net.ipv4.ip_local_port_range:
Indicates the range of IPv4 ports available to the application.
net.core.rmem_default:
Represents the default value for the socket receive buffer size.
net.core.rmem_max:
Represents the maximum socket receive buffer size.
net.core.wmem_default:
Represents the default value for the socket send buffer size.
net.core.wmem_max:
Represents the maximum size of the socket send buffer.
fs.aio-max-nr:
This parameter limits concurrent outstanding requests and should be set to avoid I/O subsystem failure.
fs.file-max:
This parameter determines the maximum number of file handles allowed in the system. The file handle setting represents the number of files that can be opened in the linux system.
Execute sysctl -p / / to make the parameter effective
#implement[root@bgs etc]# dd if=/dev/zero of=/swapfile bs=1024 count=512k ------------------------------------------------- 524288+0 records in 524288+0 records out 536870912 bytes (537 MB) copied, 3.09343 s, 174 MB/s [root@bgs-5p19-zhaochangyin etc]# mkswap /swapfile Setting up swapspace version 1, size = 524284 KiB no label, UUID=a525b1ce-804d-44c5-b670-c96c6ce11859 [root@bgs-5p19-zhaochangyin etc]# swapon /swapfile swapon: /swapfile: insecure permissions 0644, 0600 suggested
Restrict oracle user policy
vim /etc/security/limits.conf oracle soft nproc 2047 oracle hard nproc 16384 oracle soft nofile 1024 oracle hard nofile 65536 oracle soft stack 10240 oracle hard stack 10240
Add the following contents to the / etc/pam.d/login file
vim /etc/pam.d/login session required /lib64/security/pam_limits.so session required pam_limits.so
###Install oracle
Create oracle user groups and users
[root@bgs-5p19- ~]# groupadd oinstall [root@bgs-5p19- ~]# groupadd dba [root@bgs-5p19- ~]# useradd -g oinstall -G dba oracle [root@bgs-5p19- ~]# echo oracle | passwd --stdin oracle [root@bgs-5p19- ~]# id oracle uid=1003(oracle) gid=1003(oinstall) groups=1003(oinstall),1004(dba)
Create directory
mkdir -p /u01/app/ chown -R oracle:oinstall /u01/app/ chmod -R 775 /u01/app/
Edit environment variables in oracle users
vim /home/oracle/.bash_profile if [ $USER = "oracle" ]; then if [ $SHELL = "/bin/ksh" ]; then ulimit -p 16384 ulimit -n 65536 else ulimit -u 16384 -n 65536 fi fi ORACLE_HOSTNAME=orcl-db export ORACLE_BASE=/u01/app/oracle export ORACLE_HOME=$ORACLE_BASE/product/11.2.0/db_1 export ORACLE_SID=orcl export ORACLE_TERM=xterm export PATH=$ORACLE_HOME/bin:/usr/sbin:$PATH export LD_LIBRARY_PATH=$ORACLE_HOME/lib:/lib:/usr/lib export NLS_LANG=AMERICAN_AMERICA.UTF8
Refresh the configuration
source /home/oracle/.bash_profile
decompression
[root@bgs-5p19 app]# cd /u01/app #Extract the installation package, and a database directory will be generated after decompression [root@bgs-5p19 app]# unzip linux.x64_11gR2_database_1of2.zip [root@bgs-5p19 app]# unzip linux.x64_11gR2_database_2of2.zip # Copy the response directory to the current location [root@bgs-5p19 app]# cp -r database/response /u01/app [root@bgs-5p19 app]# chmod -R 775 response #Remember to modify the attribute group and user group of the extracted file [root@bgs-5p19 app]# chown -R oracle:oinstall /u01/app/
Configure DB_ The install.rsp response template file starts silent installation
[root@bgs-5p19 app]# su - oracle [oracle@bgs-5p19 app]# sed -n '/^[^#]/p' response/db_install.rsp #Here are some parameters that need to be modified oracle.install.responseFileVersion=/oracle/install/rspfmt_dbinstall_response_schema_v11_2_0 oracle.install.option=INSTALL_DB_SWONLY ORACLE_HOSTNAME=orcl-db 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.isCustomInstall=false oracle.install.db.customComponents=oracle.server:11.2.0.1.0,oracle.sysman.ccr:10.2.7.0.0,oracle.xdk:11.2.0.1.0,oracle.rdbms.oci:11.2.0.1.0,oracle.network:11.2.0.1.0,oracle.network.listener:11.2.0.1.0,oracle.rdbms:11.2.0.1.0,oracle.options:11.2.0.1.0,oracle.rdbms.partitioning:11.2.0.1.0,oracle.oraolap:11.2.0.1.0,oracle.rdbms.dm:11.2.0.1.0,oracle.rdbms.dv:11.2.0.1.0,orcle.rdbms.lbac:11.2.0.1.0,oracle.rdbms.rat:11.2.0.1.0 oracle.install.db.DBA_GROUP=dba oracle.install.db.OPER_GROUP=oinstall oracle.install.db.CLUSTER_NODES= oracle.install.db.config.starterdb.type=GENERAL_PURPOSE oracle.install.db.config.starterdb.globalDBName=orcl oracle.install.db.config.starterdb.SID=orcl oracle.install.db.config.starterdb.characterSet=AL32UTF8 oracle.install.db.config.starterdb.memoryOption=true oracle.install.db.config.starterdb.memoryLimit=1024 oracle.install.db.config.starterdb.installExampleSchemas=false oracle.install.db.config.starterdb.enableSecuritySettings=true oracle.install.db.config.starterdb.password.ALL=123123 oracle.install.db.config.starterdb.password.SYS=123123 oracle.install.db.config.starterdb.password.SYSTEM=123123 oracle.install.db.config.starterdb.password.SYSMAN=123123 oracle.install.db.config.starterdb.password.DBSNMP=123123 oracle.install.db.config.starterdb.control=DB_CONTROL oracle.install.db.config.starterdb.gridcontrol.gridControlServiceURL= oracle.install.db.config.starterdb.dbcontrol.enableEmailNotification=false oracle.install.db.config.starterdb.dbcontrol.emailAddress= oracle.install.db.config.starterdb.dbcontrol.SMTPServer= 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=false DECLINE_SECURITY_UPDATES=true PROXY_HOST= PROXY_PORT= PROXY_USER= PROXY_PWD=
Start silent installation
[root@bgs-5p19-zhaochangyin database]# pwd /u01/app/database [oracle@bgs-5p19-zhaochangyin database]$ ./runInstaller -silent -responseFile /u01/app/response/db_install.rsp
There may be an error in execution - the reason is that the files in the previous installation have not been cleaned up
Some files are generated under / etc. these files need to be deleted and regenerated
cd /etc
rm -rf ora
rm -rf oraInst.loc
Error 2
[oracle@bgs-5p19-zhaochangyin database]$ ./runInstaller -silent -responseFile /u01/app/response/db_install.rsp
Starting Oracle Universal Installer... Checking Temp space: must be greater than 120 MB. Actual 30042 MB Passed Checking swap space: 0 MB available, 150 MB required. Failed <<<< Some requirement checks failed. You must fulfill these requirements before continuing with the installation, Exiting Oracle Universal Installer, log for this session can be found at /tmp/OraInstall2019-03-11_12-06-04PM/installActions2019-03-11_12-06-04PM.log
Solution:
The partition needs to be reset. An error occurred due to the previous installation. Please refer to 1.5 operation steps to reset the partition
Error 3 ignoring parameters
The - ignorePrereq parameter needs to be added
./runInstaller -ignorePrereq -silent -responseFile /u01/app/response/db_install.rsp
Effect after execution
Reopen the root operation window and execute the script to be run above
Configure listener
[root@bgs-5p19 database]# sed -n '/^[^#]/p' response/netca.rsp [GENERAL] RESPONSEFILE_VERSION="11.2" CREATE_TYPE="CUSTOM" [oracle.net.ca] INSTALLED_COMPONENTS={"server","net8","javavm"} INSTALL_TYPE=""typical"" LISTENER_NUMBER=1 LISTENER_NAMES={"LISTENER"} LISTENER_PROTOCOLS={"TCP;1521"} LISTENER_START=""LISTENER"" NAMING_METHODS={"TNSNAMES","ONAMES","HOSTNAME"} NSN_NUMBER=1 NSN_NAMES={"EXTPROC_CONNECTION_DATA"} NSN_SERVICE={"PLSExtProc"} NSN_PROTOCOLS={"TCP;HOSTNAME;1521"}
lsnrctl start
[oracle@bgs-5p19-zhaochangyin response]$ netca /silent /responsefile /u01/app/response/netca.rsp Parsing command line arguments: Parameter "silent" = true Parameter "responsefile" = /u01/app/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
Create a dbca database and edit the response file. This configuration file seems to be the default
[root@bgs-5p19-zhaochangyin database]# sed -n '/^[^#]/p' response/dbca.rsp [GENERAL] RESPONSEFILE_VERSION = "11.2.0" OPERATION_TYPE = "createDatabase" [CREATEDATABASE] GDBNAME = "orcl11g.us.oracle.com" SID = "orcl11g" TEMPLATENAME = "General_Purpose.dbc" [createTemplateFromDB] SOURCEDB = "myhost:1521:orcl" SYSDBAUSERNAME = "system" TEMPLATENAME = "My Copy TEMPLATE" [createCloneTemplate] SOURCEDB = "orcl" TEMPLATENAME = "My Clone TEMPLATE" [DELETEDATABASE] SOURCEDB = "orcl" [generateScripts] TEMPLATENAME = "New Database" GDBNAME = "orcl11.us.oracle.com" [CONFIGUREDATABASE] [ADDINSTANCE] DB_UNIQUE_NAME = "orcl11g.us.oracle.com" NODELIST= SYSDBAUSERNAME = "sys" [DELETEINSTANCE] DB_UNIQUE_NAME = "orcl11g.us.oracle.com" INSTANCENAME = "orcl11g" SYSDBAUSERNAME = "sys"
Execute the command to initialize a child
[oracle@bgs-5p19-zhaochangyin ~]$ dbca -silent -responseFile /u01/app/response/dbca.rsp Copying database files 1% complete 3% complete 11% complete 18% complete 26% complete 37% complete Creating and starting Oracle instance 40% complete 45% complete 50% complete 55% complete 56% complete 60% complete 62% complete Completing Database Creation 66% complete 70% complete 73% complete 85% complete 96% complete 100% complete Look at the log file "/u01/app/oracle/cfgtoollogs/dbca/orcl/orcl.log" for further details.
Don't care about the content of the log after it is finished. There are write tips related to it
Create user connection error
[oracle@bgsbtsp0010-dqf:database]$ sqlplus / as sysdba SQL*Plus: Release 11.2.0.1.0 Production on Wed May 15 13:46:45 2019 Copyright (c) 1982, 2009, Oracle. All rights reserved. Connected to an idle instance. SQL> startup; ORA-01078: failure in processing system parameters LRM-00109: could not open parameter file '/u01/app/oracle/product/11.2.0/db_1/dbs/initorcl.ora' SQL>
Error reason
In 11g recent versions, the database uses spfile to start the database by default. If spfile does not exist, the above error will occur.
Solution:
take
O
R
A
C
L
E
B
A
S
E
/
a
d
m
i
n
/
l
j
l
/
p
f
i
l
e
(
/
u
01
/
a
p
p
/
o
r
a
c
l
e
/
a
d
m
i
n
/
o
r
c
l
11
g
/
p
f
i
l
e
)
order
record
lower
of
i
n
i
t
.
o
r
a
.
4152019134530
shape
type
of
writing
piece
c
o
p
y
reach
ORACLE_ copy the file in the form of init.ora.4152019134530 in the directory of base / admin / LJL / pfile (/ u01 / APP / Oracle / admin / orcl11g / pfile)
copy the file in the form of init.ora.4152019134530 Under Oracle ASE/admin/ljl/pfile(/u01/app/oracle/admin/orcl11g/pfile) directory to Oracle_ Just name initorcl.ora in the home / DBS directory.
# Query the pfile file location with the command "find /u01 -name pfile" [oracle@bgsbtsp0010-dqf:dbs]# find /u01 -name pfile /u01/app/oracle/admin/orcl11g/pfile [oracle@bgsbtsp0010-dqf:dbs]# cd /u01/app/oracle/admin/orcl11g/pfile [oracle@bgsbtsp0010-dqf:pfile]# ls init.ora.4152019134530 [oracle@bgsbtsp0010-dqf:pfile]# cp init.ora.4152019134530 /u01/app/oracle/product/11.2.0/db_1/dbs/initorcl.ora
Note that you can't copy directly
Restart error
[oracle@bgsbtsp -dqf:database] sqlplus / as sysdba SQL> startup; ORACLE instance started. Total System Global Area 1603411968 bytes Fixed Size 2213776 bytes Variable Size 402655344 bytes Database Buffers 1191182336 bytes Redo Buffers 7360512 bytes ORA-01102: cannot mount database in EXCLUSIVE mode
database not mounted error
[oracle@bgsbtsp0010-dqf:dbs]# fuser -u lkORCL11G /u01/app/oracle/product/11.2.0/db_1/dbs/lkORCL11G: 29365(oracle) 29371(oracle) 29375(oracle) 29377(oracle) 29381(oracle) 29383(oracle) 29385(oracle) 29387(oracle) 29389(oracle) 29391(oracle) 29393(oracle) 29395(oracle) 29397(oracle) 29399(oracle) 29455(oracle) 29490(oracle) 29576(oracle) 29578(oracle) 33195(oracle) 33218(oracle) # Sure enough, the file is not released. kill it with the fuser command: [oracle@bgsbtsp0010-dqf:dbs]# fuser -k lkORCL11G /u01/app/oracle/product/11.2.0/db_1/dbs/lkORCL11G: 29365 29371 29375 29377 29381 29383 29385 29387 29389 29391 29393 29395 29397 29399 29455 29490 29576 29578 33195 33218
3.2. If memory is encountered_ Target not supported error
SQL> startup;
xxx
ORA-00845: MEMORY_TARGET not supported on this system
Error found. Reason is memory_ MAX_ The target setting cannot exceed the size of / dev/shm. Let's take a look at the solution steps:
[oracle@ocp dbs]$ df -h Filesystem Size Used Avail Use% Mounted on /dev/sda3 95G 21G 70G 23% / tmpfs 932M 265M 667M 29% /dev/shm /dev/sda1 194M 34M 151M 19% /boot /dev/sr0 3.6G 3.6G 0 100% /media/RHEL_6.5 x86_64 Disc 1 [oracle@ocp dbs]$ cat /etc/fstab | grep tmpfs tmpfs /dev/shm tmpfs defaults 0 0 -------— It can be seen that/dev/shm The partition is really a little small. We can increase it. Now we can make this configuration take effect by restarting, or we can modify its size by re mounting: Execute command mount -o remount,size=16G /dev/shm/ Then re startup that will do;
last
SQL> shutdown ORA-01507: database not mounted ORACLE instance shut down. SQL> startup ORACLE instance started. Total System Global Area 1603411968 bytes Fixed Size 2213776 bytes Variable Size 402655344 bytes Database Buffers 1191182336 bytes Redo Buffers 7360512 bytes Database mounted. Database opened. SQL> create user test identified by baifendian; User created. SQL> grant connect, resource to test; Grant succeeded.