CentOS7.4 silently install Oracle11g

1. Prepare the oracle installation packages linux.x64_11gR2_database_1of2.zip and linux.x64_11gR2_database_2of2.zip

2. Check the native dependencies, check the command as follows:
rpm -q binutils compat-libstdc++-33 elfutils-libelf elfutils-libelf-devel gcc gcc-c++ glibc glibc-common glibc-devel glibc-headers ksh libaio libaio-devel libgcc libstdc++ libstdc++-devel make sysstat unixODBC unixODBC-devel
Note: If any dependent packages are not installed, please use yum to install, if you cannot connect to the external network, you can configure iso The way to mirror the yum source, or directly find the corresponding RPM package installation from the Packages package of the CentOS mirror.

3. Create the required operating system group and user
groupadd oinstall
groupadd dba
useradd -g oinstall -G dba oracle
Description:
-g: Specify the starting group to which the user belongs.
-G: Specifies the additional group to which the user belongs.
Set the oracle user password
passwd oracle
password: oracle

4. Modify the kernel parameter
vi /etc/sysctl.conf and append the following configuration
#Oracle
kernel.sem = 250 32000 100 128
kernel.shmmax = 2147483648 (half of the physical memory is configured here, in bytes. For example, if the physical memory is 16G, this value is 8Gx1024x1024x1024=1073741824)
kernel.shmmni = 4096
kernel.shmall = 2097152( Here is a quarter of the physical memory configured in k. For example, if the physical memory is 16G, this value is 4G*1024*1024=4194304)
fs.file-max = 6815744
net.ipv4.ip_local_port_range = 9000 65500
net.core. rmem_default =
4194304 net.core.rmem_max = 8388608
net.core.wmem_default = 4194304 net.core.wmem_max =
4194304
fs.aio-max-nr = 1048576
After saving, execute the /sbin/sysctl -p command to make the modification take effect.

My configuration:
#Oracle
kernel.sem=250 32000 100 128
kernel.shmmax=4294967296
kernel.shmmni=4096
kernel.shmall=2097152
fs.file-max=6815744
net.ipv4.ip_local_port_range=9000 65500
net.core.rmem_default=
4194304 net.core.rmem_max=8388608
net.core.wmem_default= 4194304 net.core.wmem_max=
4194304
fs.aio-max-nr=

1048576
vi /etc/security/limits.conf Append the following configuration
oracle soft nproc 2047
oracle hard nproc 16384
oracle soft nofile 1024
oracle hard nofile 65536
oracle soft stack 10240
vi /etc/pam.d/login Append the following configuration
session required /lib/security/pam_limits.so
session required pam_limits.so
vi /etc/profile Append the following configuration at the end of the configuration file (before unset i and unset -f pathmunge)
if [ $USER = "oracle" ]; then
   if [ $ SHELL = "/bin/ksh" ]; then
ulimit -p 16384
ulimit -n 65536
   else
ulimit -u 16384 -n 65536
   fi
fi
After saving, execute the source /etc/profile command to make the modification take effect.

6. Create an installation directory and modify the directory owner
mkdir -p /highgo/data/oracle
chown -R oracle:oinstall /highgo/data/oracle
chmod -R 775 /highgo/data/oracle

7. Create /etc/oraInst. loc file
vi /etc/oraInst.loc Write the following configuration in it
inventory_loc=/highgo/data/oracle/oraInventory
inst_group=oinstall
Modify the file permissions after saving
chown oracle:oinstall /etc/oraInst.loc
chmod 664 /etc/oraInst. loc

8. Set the oracle environment variable
Log in with the oracle user
su - oracle
vi ~/.bash_profile and append the following configuration
export ORACLE_BASE=/highgo/data/oracle
export ORACLE_SID=orcl (here is the database name defined by the user, which cannot be changed later).
After saving, execute the source /home/oracle/.bash_profile command to make the modification take effect.
Execute the env command to check the environment variables.

9. Move the database installation file prepared earlier to /home/oracle/

10. Unzip the oracle installation file
unzip linux.x64_11gR2_database_1of2.zip
unzip linux.x64_11gR2_database_2of2.zip
The unzipped installation file is in the /home/oracle/database directory

11. Copy the response file template
Create the etc directory under the /home/oracle/ directory
mkdir etc
Copy the response file
cp /home/oracle/database/response/* /home/oracle/etc/
Set the permission of the response file
su - root
chmod 700 /home/ oracle/etc/*.rsp

12. Install Oracle software silently
12.1 Log in to oracle user
su - oracle 
12.2 vi /home/oracle/etc/db_install.rsp Modify the response file for installing Oracle software. This link is actually the various options and "next step" in the graphical installation, but the silent installation should be configured in advance in the configuration file. The specific configuration is as follows:
oracle.install.option=INSTALL_DB_SWONLY // Installation type
ORACLE_HOSTNAME=oracle // Host name (hostname query, it should be noted here that the host name should be configured with the ip correspondence in the /etc/hosts file, otherwise the installation will report an error )
UNIX_GROUP_NAME=oinstall // Installation group
INVENTORY_LOCATION=/highgo/data/oracle/oraInventory //INVENTORY directory (default value if not filled in)
SELECTED_LANGUAGES=en,zh_CN,zh_TW //Select language
ORACLE_HOME=/highgo/data/oracle/product /11.2.0/db_1 // oracle_home
ORACLE_BASE=/highgo/data/oracle // oracle_base
oracle.install.db.InstallEdition=EE // oracle version
oracle.install.db.isCustomInstall=false //custom installation, no, Use the default component
oracle.install.db.DBA_GROUP=dba // dba user group
oracle.install.db.OPER_GROUP=oinstall // oper user group
oracle.install.db.config.starterdb.type=GENERAL_PURPOSE //database type
oracle.install.db.config.starterdb.globalDBName=orcl //globalDBName (here Consistent with the sid configured in step 8)
oracle.install.db.config.starterdb.SID=orcl //SID (this should be the same as the sid configured in step 8)
oracle.install.db.config.starterdb.memoryLimit=81920 //Automatically manage memory memory (M)
oracle.install.db.config.starterdb.password.ALL=123456//Set all database users to use the same password
SECURITY_UPDATES_VIA_MYORACLESUPPORT=false (manually write false)
DECLINE_SECURITY_UPDATES=true // Set up security update (it seems that there is a bug, this must be true, otherwise it will infinitely remind the email address that there is a problem, and terminate the installation. PS: no matter whether the address is correct or not) The
system/system
12.3 /home/oracle/database/ directory starts to install silently.
./runInstaller -silent -ignorePrereq -responseFile /home/oracle/etc/db_install.rsp (I used to report errors during installation, SEVERE: [FATAL] [INS-13013] The target environment does not meet some required requirements. Later in the request parameters After adding -ignorePrereq, the installation is successful./runInstaller -silent -ignorePrereq -responseFile /home/oracle/etc/db_install.rsp)
Note: When the installation starts, if the command is correct for inventory_loc=/highgo/data/oracle in step 7 The directory of /oraInventory does not have access rights, so an error will be reported. At this time, you need to be empowered to modify the location of the directory.
12.4 When the following message appears in the oraInstall2016-07-14_10-49-36AM.out file, it means the installation is complete
/highgo/data/oracle/product/11.2.0/db_1/root.sh
To execute the configuration script, please do the following :
1. Open a terminal window
2. Log in as "root"
3. Run the script
4. Return to this window and press "Enter" to continue
Successfully Setup Software.
12.5 Execute the su - root command to log in to
/highgo/data as root /oracle/product/11.2.0/db_1/root.sh
12.6 Execute the su - oracle command and log in with the oracle user
vi ~/.bash_profile 在后面追加下面配置
export ORACLE_HOME=$ORACLE_BASE/product/11.2.0/db_1
export TNS_ADMIN=$ORACLE_HOME/network/admin
export PATH=.:${PATH}:$HOME/bin:$ORACLE_HOME/bin
export PATH=${PATH}:/usr/bin:/bin:/usr/bin/X11:/usr/local/bin
export LD_LIBRARY_PATH=${LD_LIBRARY_PATH}:$ORACLE_HOME/lib
export LD_LIBRARY_PATH=${LD_LIBRARY_PATH}:$ORACLE_HOME/oracm/lib
export LD_LIBRARY_PATH=${LD_LIBRARY_PATH}:/lib:/usr/lib:/usr/local/lib
export CLASSPATH=${CLASSPATH}:$ORACLE_HOME/JRE
export CLASSPATH=${CLASSPATH}:$ORACLE_HOME/JRE/lib
export CLASSPATH=${CLASSPATH}:$ORACLE_HOME/jlib
export CLASSPATH=${CLASSPATH}:$ORACLE_HOME/rdbms/jlib
export CLASSPATH=${CLASSPATH}:$ORACLE_HOME/network/jlib
export LIBPATH=${CLASSPATH}:$ORACLE_HOME/lib:$ORACLE_HOME/ctx/lib
export ORACLE_OWNER=oracle
export SPFILE_PATH=$ORACLE_HOME/dbs
export ORA_NLS10=$ORACLE_HOME/nls/data
save and execute source /home/oracle/.bash_profile command to make the changes take effect.
Execute the env command to check the environment variables.

13. At this point, even if the database instance of Oracle 11g is installed, then configure the basic parameter file of the database instance
cd $ORACLE_HOME/dbs (actually this directory is /highgo/data/oracle/product/11.2.0/db_1/ dbs)
At this time, there is an init.ora file in the directory. Execute the following command to create a new basic parameter configuration file
cat init.ora | grep -V ^# | grep -V ^$ | > init$ORACLE_SID.ora

Newly created The file name is init(sid).ora. For example, if I configured orcl in step 8, then the file name is initorcl.ora
. This newly created file is an empty file, and the content in init.ora needs to be copied manually. , Change all <ORACLE_BASE> in the content
to absolute address /highgo/data/oracle
db_name='[sid]' (the sid here should be the same as the sid configured in step 8) 
audit_file_dest='/highgo/data/oracle/admin/[sid]/adump' (the sid here should be the same as the sid configured in step 8) 
and manually create 
/highgo/data/oracle/admin/[sid]/ with the oracle user adump (the sid here should be the same as the sid configured in step 8) 
/highgo/data/oracle/flash_recovery_area
/highgo/data/oracle/oradata

14. Execute the command vi /home/oracle/script.sql to edit the sql script file, the content As follows:
CREATE DATABASE orcl (this should be the same as the sid configured in step 8)
USER SYS IDENTIFIED BY sys 
USER SYSTEM IDENTIFIED BY system 
LOGFILE 
GROUP 1 ('/highgo/data/oracle/oradata/redo01.log') SIZE 1024M, 
GROUP 2 ('/highgo/data/oracle/oradata/redo02.log') size 1024m, 
GROUP 3 ('/highgo/data/oracle/oradata/redo03.log') size 1024m, 
GROUP 4 ('/highgo/data/ oracle/oradata/redo04.log') size 1024m, 
GROUP 5 ('/highgo/data/oracle/oradata/redo05.log') size 1024m
MAXLOGFILES 5 
MAXLOGMEMBERS 5 
MAXLOGHISTORY 200 
MAXDATAFILES 10000
MAXINSTANCES 1 
CHARACTER SET ZHS16GBK 
NATIONAL CHARACTER SET AL16UTF16 
datafile '/usr/oracle/oradata/system01.dbf' size 2048M  REUSE
EXTENT MANAGEMENT LOCAL
sysaux datafile '/usr/oracle/oradata/sysaux01.dbf' size 2048M REUSE
default temporary tablespace temp 
tempfile '/usr/oracle/oradata/temp01.dbf' size 2048M REUSE
undo tablespace UNDOTBS1 
datafile '/usr/oracle/oradata/undotbs01.dbf' size 4096M  REUSE
AUTOEXTEND off
default tablespace DATA
datafile '/usr/oracle/oradata/data01.dbf' size 8192M REUSE
EXTENT MANAGEMENT LOCAL
SEGMENT SPACE MANAGEMENT AUTO;

15. Execute the command sqlplus / as sysdba to log in to the oracle database
and execute startup nomount after successful login; number, otherwise oracle will not execute.

16. @/home/oracle/script.sql; Execute the script configured in step 14
If an error is reported here:
ERROR at line 1:
ORA-01501: CREATE DATABASE failed
ORA-00200: control file could not be created
ORA-00202: control file: '/usr/oracle/product/11.2.0/db_1/dbs/ora_control1'
ORA-27038: created file already exists
Additional information: 1
means this script has been executed before, but failed. Delete ora_control1 and ora_control2 in the /usr/oracle/product/11.2.0/db_1/dbs/ directory and execute the script again.
This script executes for a long time without any prompts, and it succeeds when it shows Database created.

17. Create data dictionary and pl/sql package
@/highgo/data/oracle/product/11.2.0/db_1/rdbms/admin/catalog.sql;
@/highgo/data/oracle/product/11.2.0/db_1/ rdbms/admin/catproc.sql;
@/highgo/data/oracle/product/11.2.0/db_1/rdbms/admin/utlrp.sql;
conn system/system;
@/highgo/data/oracle/product/11.2.0 /db_1/sqlplus/admin/pupbld.sql;
The first two scripts take a long time to execute.
After the creation is completed, execute the exit command to exit, and then execute sqlplus / as sysdba to log in to the database;
then execute the shutdown immediate; command to close the database;
and then execute the startup; to start the oracle database. Log out first and then log in because after conn system/system, the current user becomes system, and system does not have permission to close the database.

18. Configure the listening file
18.1. Execute the vim /highgo/data/oracle/product/11.2.0/db_1/network/admin/listener.ora command and insert the following content:
# listener.ora Network Configuration File: /app/oracle/product/11.2.0/dbhome_1/network/admin/listener.ora
# Generated by Oracle configuration tools.
LISTENER =
 (DESCRIPTION_LIST =
   (DESCRIPTION =
     (ADDRESS = (PROTOCOL = TCP )(HOST = [computer name])(PORT = 1521)) (the HOST here should be filled with the computer name of the machine)
   )
 )
18.2. Execute vi /highgo/data/oracle/product/11.2.0/db_1/network/ admin/tnsnames.ora command, insert as follows:
# tnsnames.ora Network Configuration File: /app/oracle/product/11.2.0/dbhome_1/network/admin/tnsnames.ora
# Generated by Oracle configuration tools.
QXT =
 (DESCRIPTION =
   (ADDRESS = (PROTOCOL = TCP)(HOST = [computer name])(PORT = 1521)) (The HOST here should be filled with the computer name of the machine)
   (CONNECT_DATA =
     (SERVER = DEDICATED)
     (SERVICE_NAME = orcl) (fill in the sid defined in step 8 here)
   )
 )
# listener.ora Network Configuration File: /app/oracle/product/11.2.0/dbhome_1/network/admin/listener. ora
# Generated by Oracle configuration tools.
LISTENER =
 (DESCRIPTION_LIST =
   (DESCRIPTION =
     (ADDRESS = (PROTOCOL = TCP)(HOST = [computer name])(PORT = 1521)) (The HOST here should be filled with the computer name of the machine)
   )
 )
ADR_BASE_LISTENER = /app/oracle

19. Start listening
 to switch accounts
# su - Oracle
executes the command lsnrctl start to start listening ,
prompting The command completed successfully
Remarks: The manual silent installation of the listening configuration here has been unsuccessful, and finally the graphical interface is used Just reinstalled once.

20. Create a user and
execute the command sqlplus / as sysdba to log in to the oracle database
Execute the following statement to create a user
create user zs_user identified by 123456; 
grant connect, resource to zs_user;
grant create session to zs_user;
Execute the following statement to create a
tablespace create tablespace zs_user_DATA datafile '/highgo/data/oracle/oradata/zs_user001.dbf ' size 16G;
Execute the following statement to specify the tablespace
alter user zs_user default tablespace zs_user_DATA temporary tablespace TEMP;

 

At this point, the silent installation is all complete. You can use the client to connect to the database on the server on your own laptop.

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=324897392&siteId=291194637