Writing in the front

I wrote an article about installing Oracle on CentOS 7/8 before. The installation was successful according to my article, but there was a problem when uninstalling Oracle. Today, I will put together an article on manual installation and uninstallation of Oracle. The full text is actual combat type content, whole dry goods.

If the article is helpful to you, please do not spare your likes, views, comments and forwarding, your support is the biggest motivation for me to continue to create!

Environment to prepare

1.CentOS7 / CentOS8 64-bit minimal installation of the virtual machine environment (here I will directly omit the installation steps, you install your own virtual machine environment)

2.Oracle 11gR2 64-bit Linux installation package (follow the wechat official account of “Glacier Technology” and reply “Oracle” to obtain the download link of Oracle database installation package).

linux.x64_11gR2_database_1of2.zip

linux.x64_11gR2_database_2of2.zip

The installation process

1. Disable the firewall

User: root

systemctl stop firewalld.service
systemctl disable firewalld.service
Copy the code

2. Install dependency packages

The user name is root.

Run the following command to install the dependency packages.

yum install -y automake autotools-dev binutils bzip2 elfutils expat \
gawk gcc gcc-multilib g++-multilib lib32ncurses5 lib32z1 \
ksh less lib32z1 libaio1 libaio-dev libc6-dev libc6-dev-i386 \
libc6-i386 libelf-dev libltdl-dev libodbcinstq4-1 libodbcinstq4-1:i386 \
libpth-dev libpthread-stubs0-dev libstdc++5 make openssh-server rlwrap \
rpm sysstat unixodbc unixodbc-dev unzip x11-utils zlibc unzip cifs-utils \
libXext.x86_64  glibc.i686
Copy the code

3. Create an Oracle user

The user name is root

groupadd -g 502 oinstall groupadd -g 503 dba groupadd -g 504 oper groupadd -g 505 asmadmin useradd -u 502 -g oinstall -G  oinstall,dba,asmadmin,oper -s /bin/bash -m oracle passwd oracleCopy the code

After the preceding commands are executed, set the password for the oracle user. For example, THE password I set here is oracle

4. Decompress the Oracle database installation package

Operation user: oracle Operation directory: /home/oracle

Upload the Oracle 11gR2 installation file (you can use SFTP to upload the file) to this directory, and then decompress the installation files to this directory.

unzip linux.x64_11gR2_database_1of2.zip
unzip linux.x64_11gR2_database_2of2.zip
Copy the code

5. Modify the operating system configuration

Operate user: root operation file: / etc/security/limits. Conf

vim /etc/security/limits.conf
Copy the code

Add the following configuration items at the end of the file.

oracle          soft      nproc   2047
oracle          hard      nproc   16384
oracle          soft      nofile  1024
oracle          hard      nofile  65536
oracle          soft      stack   10240
Copy the code

6. Create an Oracle installation directory

User: Oracle

mkdir ~/tools/oracle11g
Copy the code

7. Modify environment variables

Operation user: oracle Operation directory: /home/oracle

vim ~/.bash_profile
Copy the code

Add the following configuration items at the end of the file

export ORACLE_BASE=/home/oracle/tools/oracle11g
export ORACLE_HOME=$ORACLE_BASE/ product / 11.2.0 / dbhome_1export ORACLE_SID=orcl
export ORACLE_UNQNAME=orcl
export NLS_LANG=.AL32UTF8
export PATH=${PATH}:${ORACLE_HOME}/bin/:$ORACLE_HOME/lib64
Copy the code

Put environment variables into effect.

source ~/.bash_profile
Copy the code

8. Modify the Oracle configuration file

Operation user: oracle Operation directory: /home/oracle

Copying a File Template

cp /home/oracle/database/response/db_install.rsp .
Copy the code

Note: the last copy command. Can’t omit, said it would db_install. RSP files from/home/oracle/copy the database/response to the current directory.

Edit the db_install.rsp file.

vim db_install.rsp
Copy the code

The configuration items that need to be modified are listed as follows.

oracle.install.option=INSTALL_DB_AND_CONFIG
ORACLE_HOSTNAME=localhost You can actually change it to your own host name or domain name (IP)UNIX_GROUP_NAME=oinstall INVENTORY_LOCATION=/home/oracle/tools/oraInventory SELECTED_LANGUAGES=en,zh_CN ORACLE_HOME = / home/oracle/tools/oracle11g/product / 11.2.0 dbhome_1 ORACLE_BASE = / home/oracle/tools/oracle11g oracle.install.db.InstallEdition=EE oracle.install.db.DBA_GROUP=dba oracle.install.db.OPER_GROUP=oper 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.password.ALL=Oracle# 123456
oracle.install.db.config.starterdb.control=DB_CONTROL
oracle.install.db.config.starterdb.dbcontrol.enableEmailNotification=false
oracle.install.db.config.starterdb.dbcontrol.emailAddress=test@qq.com You can fill in your own email address
oracle.install.db.config.starterdb.automatedBackup.enable=false
oracle.install.db.config.starterdb.storageType=FILE_SYSTEM_STORAGE
oracle.install.db.config.starterdb.fileSystemStorage.dataLocation=/home/oracle/tools/oracle11g/oradata
oracle.install.db.config.starterdb.fileSystemStorage.recoveryLocation=/home/oracle/tools/oracle11g/fast_recovery_area
oracle.install.db.config.starterdb.automatedBackup.enable=false
DECLINE_SECURITY_UPDATES=true
Copy the code

9. Silently install Oracle 11gR2

Operation user: oracle Operation directory: /home/oracle/database

./runInstaller -silent -ignoreSysPrereqs -responseFile /home/oracle/db_install.rsp
Copy the code

After a period of time, if the following information is displayed, the Oracle database is successfully installed.

The following configuration scripts need to be executed as the "root" user.
#! /bin/sh
#Root scripts to run/ home/oracle/tools/oraInventory/orainstRoot. Sh/home/oracle/tools/oracle11g/product / 11.2.0 / dbhome_1 / root. Sh To execute the configuration scripts: 1. Open a terminal window 2. Login as "root"
         3. Run the scripts
         4. Return to this window and hit "Enter" key to continue

Successfully Setup Software.
Copy the code

10. The installation is complete

User: root

Execute the following two commands based on your installation location:

/ home/oracle/tools/oraInventory/orainstRoot. Sh/home/oracle/tools/oracle11g/product / 11.2.0 / dbhome_1 / root. ShCopy the code

11. Create a connection user

User: Oracle

sqlplus /nolog
conn /as sysdba
startup
Copy the code

Next, run the following command.

alter user system identified by system;
alter user sys identified by sys;
Copy the code

Create a connection user.

create user SYNC identified by SYNC;
grant connect,resource,dba to SYNC;
Copy the code

Verifying the Installation

1. Start the database

Start the installed database ORCL.

User Oracle

sqlplus /nolog
Copy the code

Connect to Oracle WITH dba privileges

connect / as sysdba
Copy the code

Start the database

startup
Copy the code

Confirm startup result:

ORACLE instance started. Total System Global Area 534462464 bytes Fixed Size 2215064 bytes Variable Size 373293928 bytes  Database Buffers 150994944 bytes Redo Buffers 7958528 bytes Database mounted. Database opened.Copy the code

2. Verify the database

Here, we use Navicat to connect to the Oracle database, as shown below.

In this case, the user name and password are SYNC.

Next, click “Connect Test” as shown below.

The Oracle database is successfully connected.

Manually Uninstalling Oracle

1. Stop listening

[oracle@binghe101 ~]$ lsnrctl stop
[oracle@binghe101 ~]$ lsnrctl status
Copy the code

2. Stop the database

[oracle@binghe101 ~]$ sqlplus / as sysdba
SQL> shutdown immediate
Copy the code

3. Delete the Oracle Inventory directory

[root@binghe101 app]# rm -rf /home/oracle/tools/oraInventory/
Copy the code

4. Delete all directories in the Oracle base directory

[root@binghe101 oracle]# rm -rf /home/oracle/tools/oracle11g/*
Copy the code

5. Delete the temporary directory/TMP

[root@binghe101 tmp]# rm -rf /tmp/*
Copy the code

6. Delete the Oracle configuration file

[root@binghe101 tmp]# rm -f /etc/ora*
Copy the code

7. Delete the Oracle generate command

[root@binghe101 tmp]# rm -f /usr/local/bin/*
Copy the code

8. Other documents

[root@binghe101 .oracle]# rm -rf /usr/tmp/.oracle/
Copy the code

9. Delete users and groups

[root@binghe101 tmp]# userdel -r oracle
[root@binghe101 tmp]# groupdel oper
[root@binghe101 tmp]# groupdel dba    
[root@binghe101 tmp]# groupdel oinstall
[root@binghe101 tmp]# groupdel asmadmin
Copy the code

10. Undo the oracle resource limit file

[root@binghe101 tmp]# vi /etc/security/limits.conf
Copy the code

Kernel parameters

[root@binghe101 tmp]# vi /etc/sysctl.conf 
[root@binghe101 tmp]# sysctl -p
Copy the code

12. Delete Oracle Base

[root@binghe101 ~]# rm -rf /home/oracle/tools/oracle11g
Copy the code

Big welfare

Follow the wechat official account of “Glacier Technology” and reply the keyword “Design Mode” in the background to get the PDF document of “23 Design Modes in Simple Java”. Return keyword “Java8” to obtain the Java8 new features tutorial PDF. “Distributed traffic limiting solutions under 100 million levels of traffic” PDF document, the three PDFS are created by the glacial and collated super core tutorial, interview essential!!

Ok, that’s enough for today! Don’t forget to click a like, to see and forward, let more people see, learn together, progress together!!

Write in the last

If you think glacier wrote good, please search and pay attention to “glacier Technology” wechat public number, learn with glacier high concurrency, distributed, micro services, big data, Internet and cloud native technology, “glacier technology” wechat public number updated a large number of technical topics, each technical article is full of dry goods! Many readers have read the articles on the wechat public account of “Glacier Technology” and succeeded in job-hopping to big factories. There are also many readers to achieve a technological leap, become the company’s technical backbone! If you also want to like them to improve their ability to achieve a leap in technical ability, into the big factory, promotion and salary, then pay attention to the “Glacier Technology” wechat public account, update the super core technology every day dry goods, so that you no longer confused about how to improve technical ability!