Linux oracle11g installation steps


Note: The memory of the virtual machine should be at least 6 G
to set the network
nmcli conn mod ens33 ipv4.addresses "192.168.1.149/24" 
ipv4.gateway "192.168.1.1" ipv4.dns "202.96.209.133" 

Network card set a boot from the start
connection.autoconnect yes ipv4.method manual

centos7.6安装
1.centos7.6
2.yum -y install bash-completion net-tools zip unzip
3.nmcli conn add type ethernet con-name eth0 ifname ens123 ipv4.addresses "10.10.1.6/24" connection.autoconnect yes ipv4.method manual

oracle安装
1.安装依赖包
[root@localhost /]# yum -y install gcc gcc-c++ make binutils compat-libstdc++-33 elfutils-libelf elfutils-libelf-devel elfutils-libelf-devel-static glibc glibc-common glibc-devel ksh libaio libaio-devel libgcc libstdc++ libstdc++-devel numactl-devel sysstat unixODBC unixODBC-devel kernelheaders pdksh pcre-devel readline rlwrap 

mistake:

It appears that /var/run/yum.pid is locked and another program with PID 11154 is running. ,
the following code can be used to unlock
rm -f /var/run/yum.pid

Setting environment variables (JDK)

Solution 1: First upload the JDK compressed package in the /web/service/ directory and decompress it. (You can also upload the WEB package in the root directory, note that there is no jdk in the web.tar.gz package, you need to install it yourself) Note: This web package is configured in the previous project, and it is directly compressed and deleted.

Solution 2: Create a new JDK file in the root directory and upload the corresponding JDK. This step needs to change this (export JAVA_HOME=/web/service/jdk1.8.xxx) path.

First upload the JDK compressed package in the /web/service/ directory and decompress it.

[root@localhost /]# vim /etc/profile                            If VIM cannot be used, then yum -y install
###Add the following content
export JAVA_HOME=/web/service/jdk1.8.0_161 (JDK version and installation path)
export JRE_HOME= ${JAVA_HOME}/jre
export CLASSPATH=.:${JAVA_HOME}/lib:${JRE_HOME}/lib
export PATH=${JAVA_HOME}/bin:$PATH

Let the modified environment variable take effect
[root@localhost /] source /etc/profile
to verify whether jdk is valid
[root@localhost /] java -version


2. Create users and groups
[root@localhost /]# groupadd oinstall && groupadd dba && useradd -g oinstall -G dba oracle
[root@localhost /]# echo " password entered " | passwd --stdin oracle && id oracle

3. Upload the installation package to the /data/u01/software directory
[root@localhost /]# mkdir -p /data/u01/software
[root@localhost /]# cd /data/u01/software
[root@localhost software ]# ll
linux.x64_11gR2_database_1of2.zip
linux.x64_11gR2_database_2of2.zip

Note: linux.x64_11gR2_database installation package address:

Link: https://pan.baidu.com/s/10JvEHXf8TDeO7bh36EyGBQ 
Extraction code: 2yb1

4. Unzip the installation package
unzip linux.x64_11gR2_database_1of2.zip
unzip linux.x64_11gR2_database_2of2.zip
[root@localhost software]# unzip linux.x64_11gR2_database_1of2.zip
[root@localhost software]# unzip linux.x64_11 gR2_database_2of2.zip

5. Create a directory and empower
[root@localhost /]# mkdir -p /data/u01/app/oracle/product/11.2.0/dbhome_1
[root@localhost /]# mkdir /data/u01/app/oracle/ {oradata,inventory,fast_recovery_area}
[root@localhost /]# chown -R oracle:oinstall /data/u01/app/oracle
[root@localhost /]# chmod -R 775 /data/u01/app/oracle

6. Modify kernel parameters
[root@localhost /]# vi /etc/sysctl.conf
##Add the following content
fs.aio-max-nr = 1048576
fs.file-max = 6815744
kernel.shmall = 4194304
kernel.shmmax = 8589934592
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 = 262 144
net.core.wmem_max = 41944304
# Make the new kernel configuration take effect
[root@localhost /]# sysctl -p

7. Modify user limits
[root@localhost /]# vim /etc/security/limits.conf
##Add the following
oracle soft nproc 2047
oracle hard nproc 16384
oracle soft nofile 1024
oracle hard nofile 65536
oracle soft stack 10240
oracle hard stack 10240

8. Modify the /etc/pam.d/login file
[root@localhost /]# vim /etc/pam.d/login
##Add the following content
session required /lib64/security/pam_limits.so
session required pam_limits.so

9. Modify the /etc/profile file
[root@localhost /]# vim /etc/profile
##Add the following
if [ $USER = "oracle" ]; then
if [ $SHELL = "/bin/ksh" ]; then
ulimit -p 16384
ulimit -n 65536
else
ulimit -u 16384 -n 65536
fi
fi

[root@localhost /] source /etc/profile

10.设置oracle环境变量
[root@localhost /]# su - oracle
[oraclet@localhost ~]# vim .bash_profile
##添加以下内容
export ORACLE_BASE=/data/u01/app/oracle
export ORACLE_HOME=/data/u01/app/oracle/product/11.2.0/dbhome_1
export ORACLE_SID=orcl
export ORACLE_UNQNAME=$ORACLE_SID
export PATH=$ORACLE_HOME/bin:$PATH
export NLS_LANG=american_america.AL32UTF8
export LD_LIBRARY_PATH=$ORACLE_HOME/lib
alias sqlplus='rlwrap sqlplus'
alias rman='rlwrap rman'
#生效
[oraclet@localhost ~]# source .bash_profile

11.#Edit silent installation response file
[oraclet@localhost ~]# cp -R /data/u01/software/database/response/ . && cd response/
[oraclet@localhost ~]# vim db_install.rsp
#Set the following
oracle .install.option=INSTALL_DB_SWONLY in line 29
ORACLE_HOSTNAME=own host name //default is localhost.localdomain line 37
UNIX_GROUP_NAME=oinstall line 42
INVENTORY_LOCATION=/data/u01/app/oracle/inventory line 47 
SELECTED_LANGUAGES=en,zh_CN line 78
ORACLE_HOME=/data/u01/app/oracle/product/11.2.0/dbhome_1 83 lines
ORACLE_BASE=/data/u01/app/oracle 88 lines
oracle.install.db.InstallEdition=EE                                           99行
oracle.install.db.DBA_GROUP=dba                                              142行
oracle.install.db.OPER_GROUP=dba                                             147行
DECLINE_SECURITY_UPDATES=true                                                385行

12. Install
[oraclet@localhost ~]# cd /data/u01/software/database/
[oraclet@localhost database]# ./runInstaller -silent -responseFile /home/oracle/response/db_install.rsp -ignorePrereq
Wait for a few minutes

13.#Open the terminal, log in as root, and execute the script:
[oraclet@localhost ~]# su - root
[root@localhost ~]# sh /data/u01/app/oracle/inventory/orainstRoot.sh
[root@localhost ~]# sh /data/u01/app/oracle/product/11.2.0/dbhome_1/root.sh
[root@localhost ~]# vim /etc/hosts
127.0.0.1 followed by the host name //The default is localhost. localdomain

14.#Start with Oracle user
[root@localhost ~]# su - oracle
[oracle@localhost ~]# lsnrctl start
[oracle@localhost ~]# netstat -tunlp|grep 1521

*********Configure and copy the following information to txt (it may be used for PLSQL connection later)********
Listening Endpoints Summary...
  (DESCRIPTION=(ADDRESS=(PROTOCOL= tcp)(HOST=localhost.localdomain (change to 192.168.XX.XXX))(PORT=1521)))
The listener supports no services
The command completed successfully

****************************************************************************************************


15.# Configure to create a new library in silent mode, and the response file of the instance
[oracle@localhost ~]# vim /home/oracle/response/dbca.rsp
#Set the following parameters
GDBNAME = "orcl" In line 78    
SID = "orcl " Line 142
SYSPASSWORD = "SYS user password" Line 190
SYSTEMPASSWORD = "SYSTEM user password" Line 200
SYSMANPASSWORD = "sysman" Line 231  
DBSNMPPASSWORD = "dbsnmp" Line 241 
DATAFILEDESTINATION =/data/u01/app/oracle/oradata Line 357
RECOVERYAREADE STINATION =/data/u01/app/oracle/fast_recovery_area 367 lines
CHARACTERSET = "AL32UTF8" 415 lines
TOTALMEMORY = "6144" 540 lines


#View configuration results
[oracle@localhost ~]# egrep -v "(^#|^$)" /home/oracle/response/dbca.rsp

16. # Enable configuration, silently build new libraries, and instances! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! !
[oracle@localhost ~]# dbca -silent -responseFile /home/oracle/response/dbca.rsp
copy database file
1% completed
3% completed
11% completed
....
100% completed
//wait a few minutes

17.#Check instance background process
[oracle@localhost ~]# ps -ef | grep ora_ | grep -v grep
 
#Check the ORACLE_UNQNAME environment variable! ! ! ! ! ! !
[oracle@localhost ~]# env|grep ORACLE_UNQNAME

18. Install dependent packages (for recording operations (up and down keys to view operation records))
switch to root user
[oracle@localhost ~]# su - root
[root@localhost ~]# yum -y install readline* nmap perl rlwrap
in ~Upload rlwrap-0.43.tar.gz and decompress it! ! ! ! ! !
[root@localhost ~]# tar -zxvf rlwrap-0.43.tar.gz 
[root@localhost ~]# cd rlwrap-0.43
[root@localhost rlwrap-0.43]# ./configure && make && make install


19.#Log in as sysdba
[root@localhost ~]# su - oracle
[oracle@localhost ~]# sqlplus / as sysdba

20.#Start the oralce database
SQL>     
SQL> select 1 from dual;
SQL> exit

21. Close the firewall
[oracle@localhost ~]$ su - root
[root@localhost ~]$ systemctl stop firewalld temporarily close the firewall
[root@localhost ~]$ systemctl disable firewalld permanently close the firewall

3. Set the database to start automatically

1. After installing the Oracle database: execute dbstart and dbshut
[oracle@localhost ~]$ dbstart
ORACLE_HOME_LISTNER is not SET, unable to auto-start Oracle Net Listener
Usage: /usr/oracle/product/11.2.0/db_1/bin/ dbstart ORACLE_HOME
error reason: There is a problem with the setting of ORACLE_HOME_LISTNER in the dbstart and dbshut script files

[oracle@localhost ~]$ vim $ORACLE_HOME/bin/dbstart
[oracle@localhost ~]$ vim $ORACLE_HOME/bin/dbshut
respectively open two files for modification (about 80 and 50 lines)

ORACLE_HOME_LISTNER=$1
is modified to:
ORACLE_HOME_LISTNER=$ORACLE_HOME
save and exit after modification, the problem is solved

[oracle@localhost ~]$ dbstart

2. Automatically start Oracle monitor and instance when Linux starts

Step 1: Modify the /etc/oratab file
[oracle@localhost ~]$ vim /etc/oratab
to find: orcl:/usr/oracle/product/11.2.0/db_1:N   
and modify it to: orcl:/usr/oracle/ product/11.2.0/db_1:Y
(this path is related to the installation path, $ORACLE_SID:$ORACLE_HOME:<N|Y>)


Step 2: Add lsnrctl start and dbstart to the rc.local file:

Execute with root privileges

[root@localhost ~]# vim /etc/rc.d/rc.local
#Add:
su - oracle -lc "/data/u01/app/oracle/product/11.2.0/dbhome_1/bin/lsnrctl start"
su - oracle -lc "/data/u01/app/oracle/product/11.2.0/dbhome_1/bin/dbstart"
##Description:
##The first line starts the database monitoring service at startup, and the second line starts the database at startup. (The path is related to the installation path).
## Note: /etc/rc.d/rc.local in CentOs7 will not be executed at startup, and execution permission needs to be added.

Check the permissions of /etc/rc.d/rc.local

[root@localhost ~]# ll /etc/rc.d/rc.local
add execution permission
[root@localhost ~]# chmod +x /etc/rc.d/rc.local

3. After restarting the computer, check whether the self-starting is successful.
Check whether the monitoring is self-starting successfully.

oracle user

[root@localhost ~]# su - oracle

[oracle@localhost ~]$ lsnrctl status LISTENER
View Oracle service status

[oracle@localhost ~]$ ps –ef | grep oracle

4. Oracle startup or shutdown management
[root@localhost oracle]# dbstart #start
[root@localhost oracle]# dbshut #stop


4. Create XIBU_WMS and XIBU_INF users

[oracle@localhost /]$ sqlplus / as sysdba
--创建XIBU用户
CREATE TABLESPACE TS_XIBU_WMS_DATA DATAFILE 
'/data/u01/app/oracle/oradata/orcl/TS_XIBU_WMS_DATA_01.DBF'  SIZE 2G AUTOEXTEND ON NEXT 100M MAXSIZE UNLIMITED,
'/data/u01/app/oracle/oradata/orcl/TS_XIBU_WMS_DATA_02.DBF'  SIZE 2G AUTOEXTEND ON NEXT 100M MAXSIZE UNLIMITED;

--Create ZHCXIBU user index table space
CREATE TABLESPACE TS_XIBU_WMS_IDX DATAFILE 
'/data/u01/app/oracle/oradata/orcl/TS_XIBU_WMS_IDX_01.DBF' SIZE 1G AUTOEXTEND ON NEXT 100M MAXSIZE UNLIMITED,
'/data/u01/app/oracle /oradata /orcl/TS_XIBU_WMS_IDX_02.DBF' SIZE 1G AUTOEXTEND ON NEXT 100M MAXSIZE UNLIMITED;


***************
Here you will be prompted that IDX already exists, don’t worry, continue to the next step:
ERROR at line 1:
ORA-01537: cannot add file
'/data/u01/app/oracle/ oradata/orcl/TS_XIBU_WMS_IDX_01.DBF' - file already part
of database
*******************


--Create
USER XIBU_WMS IDENTIFIED BY XIBU_WMS DEFAULT TABLESPACE TS_XIBU_WMS_DATA TEMPORARY TABLESPACE TEMP ;
GRANT CONNECT ,RESOURCE TO XIBU_WMS;
GRANT CREATE SEQUENCE TO XIBU_WMS;
GRANT CREATE S YNONYM TO XIBU_WMS;
GRANT CREATE VIEW TO XIBU_WMS;

alter user xiabu_wms default tablespace TS_XIBU_WMS_DATA;


--创建XIBU_INF用户
CREATE TABLESPACE TS_XIBU_INF_DATA DATAFILE 
'/data/u01/app/oracle/oradata/orcl/TS_XIBU_INF_DATA_01.DBF'  SIZE 2G AUTOEXTEND ON NEXT 100M MAXSIZE UNLIMITED,
'/data/u01/app/oracle/oradata/orcl/TS_XIBU_INF_DATA_02.DBF'  SIZE 2G AUTOEXTEND ON NEXT 100M MAXSIZE UNLIMITED;

--Create ZHCXIBU user index table space
CREATE TABLESPACE TS_XIBU_INF_IDX DATAFILE 
'/data/u01/app/oracle/oradata/orcl/TS_XIBU_INF_IDX_01.DBF' SIZE 1G AUTOEXTEND ON NEXT 100M MAXSIZE UNLIMITED,
'/data/u01/app/oracle /oradata /orcl/TS_XIBU_INF_IDX_02.DBF' SIZE 1G AUTOEXTEND ON NEXT 100M MAXSIZE UNLIMITED;

***************
Here you will be prompted that IDX already exists, do not use gaunt, continue to the next step:
ERROR at line 1:
ORA-01537: cannot add file
'/data/u01/app/oracle/ oradata/orcl/TS_XIBU_INF_IDX_01.DBF' - file already part
of database
*******************

--Create USER
XIBU_INF IDENTIFIED BY XIBU_INF DEFAULT TABLESPACE TS_XIBU_INF_DATA TEMPORARY TABLESPACE TEMP ;
GRANT CONNECT ,RESOURCE TO XIBU_INF;
GRANT CREATE SEQUENCE TO XIBU_INF;
GRANT CREATE S YNONYM TO XIBU_INF;
GRANT CREATE VIEW TO XIBU_INF;

alter user xiabu_inf default tablespace TS_XIBU_INF_DATA;


After the deployment is complete, import data in the following step five , import and export data    

**************************************************************************************

Upload the corresponding WEB package, and open the corresponding redis port when starting:
/web/service/redis/bin/redis-server ../conf/port number.conf
close the redis port
/web/service/redis/bin/redis -cli -p redis port number shutdown

Change the authorization file directory
and give the path to this /web/license/

vim /web/src/wms/WEB-INF/classes/license-config.properties


*************************************************************************************
*************************************************************************************
*************************************************************************************


#Restart the database:
[oracle@localhost ~]$ sqlplus / as sysdba
SQL> shutdown immediate close the database
SQL> startup database start
SQL> exit
[oracle@localhost ~]$ lsnrctl stop stop lsnrctl
[oracle@localhost ~]$ lsnrctl start enable listening

When the tablespace and index cannot be deleted, or it is prompted that there is a situation that cannot be created, go to the /data/u01/app/oracle/oradata/orcl directory and delete the
corresponding file.

drop tablespace

Delete the tablespace without any data object:
first use the PL/SQL interface tool, or use the SQL PLUS tool that comes with oracle, to connect to the oracle database of the tablespace to be deleted.
Confirm whether the current user has the permission to delete the tablespace. If there is no drop tablespace, please use a more advanced user (such as sys) to grant authorization or directly use a more advanced user.
Use drop tablespace xxx to delete the table space that needs to be deleted.

Delete the table space with any data objects
Use drop tablespace xxx including contents and datafiles; to delete the table space.

Note: If the drop tablespace statement contains datafiles, then there must be the contents keyword before the datafiles, otherwise the
ora-01911 error will be prompted .
It will make your own database unusable.

  redis启动:  
[root@localhost bin]# ./redis-server ../conf/6379.conf 
[root@localhost bin]# ./redis-server ../conf/6380.conf 
[root@localhost bin]# ./redis-server ../conf/6381.conf 

78 should give permission
chmod -R 775 /web/*
[root@localhost webserver]# apache-tomcat-8.5.78-YYY-9082/bin/startup.sh
[root@localhost webserver]# apache-tomcat-8.5. 78-MMM-9081/bin/startup.sh 
[root@localhost webserver]# apache-tomcat-8.5.78-WMS-9080/bin/startup.sh 

  
5. Export and import data (the interface is the same)

Backup and export the ORACLE database
su - oracle
expdp XIBU_WMS/XIBU_WMS directory=dp_dir dumpfile=XIBU20220622.dmp logfile=XIBU20220622.log schemas=XIBU_WMS;

Backup and import the ORACLE database
su - oracle
impdp XIBU_WMS/XIBU_WMS@orcl directory=dp_dir dumpfile=XIBU20220622.dmp logfile=XIBU20220622.log schemas=XIBU_WMS table_exists_action=replace ignore=y;
  

************************************* Notes************** *************************
backup export ORACLE database
su - oracle
expdp XIBU_WMS (username)/XIBU_WMS (password) directory=dp_dir dumpfile=XIBU20220622( username_time).dmp logfile=XIBU20220622(username_time).log schemas=XIBU_WMS(username);

Back to import the Oracle database
SU -Oracle
IMPDP XIBU_WMS (username)/xibu_wms (user name) @orCl Directory = DP_DIR DUMPFILE = XIBU20220622 (Backup file name). 0622 (Backup file name). Log Schemas = xibu_WMS Table_exists_ACTION = Replace ignore=y;
************************************************* ********************************* 
  
  
  
  
  

Guess you like

Origin blog.csdn.net/Xin_shou__/article/details/118961739