Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

Linux silently installs oracle

2025-01-16 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >

Share

Shulou(Shulou.com)06/01 Report--

1. Prepare to install the package

Linux.x64_11gR2_database_1of2.zip

Linux.x64_11gR2_database_2of2.zip

Rlwrap-0.30.tar.gz

two。 Installation dependency

Establish a local yum source first (briefly)

1) check whether the dependency package is complete

/ / View the packages that have been installed

Rpm-qa binutils compat-libstdc++-33 elfutils-libelf elfutils-libelf-devel expat gcc gcc-c++ glibc glibc-common glibc-devel glibc-headers libaio libaio-devel libgcc libstdc++ libstdc++-devel make pdksh sysstat unixODBC unixODBC-devel

/ / View installed and uninstalled packages

Rpm-Q binutils compat-libstdc++-33 elfutils-libelf elfutils-libelf-devel expat gcc gcc-c++ glibc glibc-common glibc-devel glibc-headers libaio libaio-devel libgcc libstdc++ libstdc++-devel make pdksh sysstat unixODBC unixODBC-devel

2) install all

/ / install all

Yum-y install binutils compat-libstdc++-33 elfutils-libelf elfutils-libelf-devel expat gcc gcc-c++ glibc glibc-common glibc-devel glibc-headers libaio libaio-devel libgcc libstdc++ libstdc++-devel make pdksh sysstat unixODBC unixODBC-devel

(there may be packages that are not available in yum, which can be copied locally for installation, such as the pdksh package)

Create users and groups

Groupadd oinstall

Groupadd dba

Groupadd asmadmin

Groupadd asmdba

Useradd-g oinstall-G dba,asmdba oracle-d / home/oracle

View oracle users

Id oracle

Initialize oracle user password

Passwd oracle

View oracle users

Id oracle

Initialize oracle user password

Passwd oracle

4 configure hostname

Vim / etc/hosts

192.168.1.18 centos-oracle

This is your own ip. If you want to change your name, you should change it as well.

Test hostname

Ping-c 3 centos-oracle

4.1 optimize os kernel parameters

Check the system memory size and swap area

[root@dbserver /] # grep MemTotal / proc/meminfo

[root@dbserver /] # grep SwapTotal / proc/meminfo

Vim / etc/sysctl.conf

Fs.aio-max-nr=1048576

Fs.file-max=6815744

Kernel.shmall=2097152

Kernel.shmmni=4096

Kernel.shmmax = 1073741824 (preferably half of the system memory)

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=1048586

Make the parameter effective

Sysctl-p

5 restrict the shell permissions of oracle users

Vim / etc/security/limits.conf

Oracle soft nproc 2047

Oracle hard nproc 16384

Oracle soft nofile 1024

Oracle hard nofile 65536

Vim / etc/pam.d/login

Session required / lib64/security/pam_limits.so

Session required pam_limits.so

Vim / etc/profile

If [$USER = "oracle"]; then

If [$SHELL = "/ bin/ksh"]; then

Ulimit-p 16384

Ulimit-n 65536

Else

Ulimit-u 16384-n 65536

Fi

Fi

6 create an oracle installation directory

1. Plan one.

Mkdir-p / opt/app/oracle/product/11.2.0

Mkdir / opt / app/oracle/oradata

Mkdir / opt / app/oracle/inventory

Mkdir / opt / app/oracle/fast_recovery_area

Chown-R oracle:oinstall / opt / app/oracle

Chmod-R 775 / opt / app/oracle

two。 Plan two.

Mkdir-p / db/app/oracle/product/11.2.0

Mkdir / db/app/oracle/oradata

Mkdir / db/app/oracle/inventory

Mkdir / db/app/oracle/fast_recovery_area

Chown-R oracle:oinstall / db/app/oracle

Chmod-R 775 / db/app/oracle

7 configure oracle user environment variables

Su-oracle

Vim .bash _ profile

Umask 022

Export ORACLE_HOSTNAME=centos-oracle

Export ORACLE_BASE=/opt/app/oracle

Export ORACLE_HOME=$ORACLE_BASE/product/11.2.0/

Export ORACLE_SID=ORCL

Export PATH=.:$ORACLE_HOME/bin:$ORACLE_HOME/OPatch:$ORACLE_HOME/jdk/bin:$PATH

Export LC_ALL= "en_US"

Export LANG= "en_US"

Export NLS_LANG= "AMERICAN_AMERICA.ZHS16GBK"

Export NLS_DATE_FORMAT= "YYYY-MM-DD HH24:MI:SS"

Umask 022

Export ORACLE_HOSTNAME=centos-oracle

Export ORACLE_BASE=/db/app/oracle

Export ORACLE_HOME=$ORACLE_BASE/product/11.2.0/

Export ORACLE_SID=ORCL

Export PATH=.:$ORACLE_HOME/bin:$ORACLE_HOME/OPatch:$ORACLE_HOME/jdk/bin:$PATH

Export LC_ALL= "en_US"

Export LANG= "en_US"

Export NLS_LANG= "AMERICAN_AMERICA.ZHS16GBK"

Export NLS_DATE_FORMAT= "YYYY-MM-DD HH24:MI:SS"

After the above configuration is completed, it is recommended to restart the system.

Source .bash _ profile

Reboot

8. Upload and extract oracle compressed files to / db

Cd / opt/

Unzip linux.x64_11gR2_database_1of2.zip-d / db

Unzip linux.x64_11gR2_database_2of2.zip-d / db

After decompression is completed

Mkdir / opt/etc/

Cp / opt/database/response/* / opt/etc/

Vim / opt/etc/db_install.rsp

Mkdir / db/etc/

Cp / db/database/response/* / db/etc/

Vim / db/etc/db_install.rsp

Set relevant parameters

Oracle.install.option=INSTALL_DB_SWONLY

UNIX_GROUP_NAME=oinstall

INVENTORY_LOCATION=/opt/app/oracle/inventory

SELECTED_LANGUAGES=en,zh_CN

ORACLE_HOSTNAME=centos-oracle

ORACLE_HOME=/opt/app/oracle/product/11.2.0

ORACLE_BASE=/opt/app/oracle

Oracle.install.db.InstallEdition=EE

Oracle.install.db.isCustomInstall=true

Oracle.install.db.DBA_GROUP=dba

Oracle.install.db.OPER_GROUP=dba

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 (* * Note here is consistent with the configuration SID in the environment variable)

Oracle.install.db.config.starterdb.memoryLimit=81920 # automatically manages memory of memory (M)

SECURITY_UPDATES_VIA_MYORACLESUPPORT=false # (false is manually written)

Oracle.install.db.config.starterdb.password.SYS=123456

Oracle.install.db.config.starterdb.password.SYSTEM=123456

DECLINE_SECURITY_UPDATES=true / / must be set to true

Optional item

/ / oracle.install.db.config.starterdb.password.ALL=oracle # set all database users to use the same password

Start installation

Su-oracle

Cd / opt/database

. / runInstaller-silent-ignorePrereq-responseFile / opt/etc/db_install.rsp

. / runInstaller-silent-ignorePrereq-responseFile / db/etc/db_install.rsp

(note: the problem of page jump may occur during operation

The following actions are required:

Su root

# xhost +

Su oracle

Continue with the installation. )

During installation, you can open another window and use the tail command to monitor the installation log of oracle

Tail-f / opt/app/oracle/inventory/logs/installActions2017-07-12, 03-48-29PM.log

Note: the date followed by this log file is different from your own. According to the prompt, copy your correct log path.

The installation will prompt Successfully Setup Software in the original window.

At this time, do not move the original window, operate under the new window

Su root

Sh / opt/app/oracle/inventory/orainstRoot.sh

Sh / opt/app/oracle/product/11.2.0/root.sh

Sh / db/app/oracle/inventory/orainstRoot.sh

Sh / db/app/oracle/product/11.2.0/root.sh

After the execution is complete, you can type enter in the original window to resume the operation.

10 configure silent monitoring

Su-oracle

Netca / silent / responsefile / opt/etc/netca.rsp

Netca / silent / responsefile / db/etc/netca.rsp

Note that this step may lead to situations where the netca command cannot be used, and part 7 needs to be checked and re-source.

View listening port

Netstat-tnulp | grep 1521

If the netstat command yum install net-tools.x86_64 cannot be found

11. Silently create a database

Vi / opt/etc/dbca.rsp

GDBNAME = "orcl"

SID = "orcl"

SYSPASSWORD = "oracle"

SYSTEMPASSWORD = "oracle"

SYSMANPASSWORD = "oracle"

DBSNMPPASSWORD = "oracle"

DATAFILEDESTINATION = / opt/app/oracle/oradata

RECOVERYAREADESTINATION=/opt/app/oracle/fast_recovery_area

CHARACTERSET = "AL32UTF8"

TOTALMEMORY = "1638"

SOURCEDB = "orcl"

INSTANCENAME = "orcl"

Vi / db/etc/dbca.rsp

GDBNAME = "orcl"

SID = "orcl"

SYSPASSWORD = "oracle"

SYSTEMPASSWORD = "oracle"

SYSMANPASSWORD = "oracle"

DBSNMPPASSWORD = "oracle"

DATAFILEDESTINATION = / db/app/oracle/oradata

RECOVERYAREADESTINATION=/db/app/oracle/fast_recovery_area

CHARACTERSET = "AL32UTF8"

TOTALMEMORY = "1638"

SOURCEDB = "orcl"

INSTANCENAME = "orcl"

Perform silent database construction

Dbca-silent-responseFile / opt/etc/dbca.rsp

Dbca-silent-responseFile / db/etc/dbca.rsp

.

View the oracle instance process after completion

Ps-ef | grep ora_ | grep-v grep

View monitoring status

Lsnrctl status

Install rlwrap

Install rlwrap to support Oracle sqlplus can not use direction keys, use direction keys garbled and other problems

After downloading, remove the .zip extension and upload it to the Linux server

When installing rlwrap, prompt that you need to install readline

Just use yum-y install readline*.

Install rlwrap

[root@oracle11g ~] # tar-zxvf rlwrap-0.30.tar.gz

[root@oracle11g ~] # cd rlwrap-0.30

[root@oracle11g rlwrap-0.30] #. / configure

[root@oracle11g rlwrap-0.30] # make

[root@oracle11g rlwrap-0.30] # make install

[root@oracle11g rlwrap-0.30] # rlwrap

Usage: rlwrap [options] command...

Options:

-a [password:]-- always-readline [= password:]

-A-- ansi-colour-aware

-b-- break-chars=

-c-- complete-filenames

-C-- command-name=

-D-- history-no-dupes=

-f-- file=

-F-- history-format=

-h-- help

-H-- history-filename=

-I-- case-insensitive

-l-- logfile=

-n-- no-warnings

-p [ANSI colour spec]-- prompt-colour [= ANSI colour spec]

-P-- pre-given=

-Q-- quote-characters=

-m [newline substitute]-- multi-line [= newline substitute]

-r-- remember

-v-- version

-s-- histsize= (negative: readonly)

-t-- set-term-name=

[root@oracle11g rlwrap-0.30] # vi / home/oracle/.bash_profile

Add

Alias sqlplus='rlwrap sqlplus'

Alias rman='rlwrap rman'

Installation of possible errors

Rlwrap: error while loadingshared libraries: libreadline.so.5: cannot open shared object file: No suchfile or directory

Solution:

Add / usr/local/bin path to $PATH path in .bash _ profile under oracle

PATH=/usr/local/bin:$PATH;export PATH

Modify initialization location

Find .bash _ profile in the oracle user root directory

Su-oracle

[oracle@centos-oracle] $ls-a

[oracle@centos-oracle ~] $vim .bash _ profile

Make a copy of everything you just added to the installation process.

[oracle@centos-oracle ~] $vim .bashrc paste into this file

[oracle@centos-oracle ~] $source .bashrc

14. Start the database

After the oracle database is installed, only sys users can enter it. You need to start the database before other users can use it.

[oracle@centos-oracle ~] $sqlplus / as sysdba

SQL*Plus: Release 11.2.0.1.0 Production on Wed Oct 18 15:37:44 2017

Copyright (c) 1982, 2009, Oracle. All rights reserved.

Connected to an idle instance.

SQL >

If the following error occurs

SQL > startup

ORA-01078: failure in processing system parameters

LRM-00109: could not open parameter file'/ db/app/oracle/product/11.2.0/dbs/initORCL.ora'

SQL >

Solution:

[oracle@dbserver dbs] $cd / db/app/oracle/admin/orcl/pfile/

[oracle@dbserver pfile] $ls

Init.ora.6242012174552

[oracle@dbserver pfile] $cp init.ora.6242012174552 / db/app/oracle/product/11.2.0/dbs/

Change the name format to: initORACLE_SID.ora

[oracle@dbserver dbs] $mv init.ora.6242012174552 initORCL.ora

Restart the database

[oracle@centos-oracle ~] $sqlplus / as sysdba

SQL*Plus: Release 11.2.0.1.0 Production on Wed Oct 18 15:37:44 2017

Copyright (c) 1982, 2009, Oracle. All rights reserved.

Connected to an idle instance.

SQL >

SQL > startup

ORACLE instance started.

Total System Global Area 1720328192 bytes

Fixed Size 2214056 bytes

Variable Size 1006634840 bytes

Database Buffers 704643072 bytes

Redo Buffers 6836224 bytes

Database mounted.

Database opened.

SQL >

Start successfully.

Tips: ora-01102 appears:

Reason for occurrence: there is a "sgadef.dbf" file or lk* file in DBS /. These two files are used to lock memory. B, the pmon,smon,lgwr and dbwr processes of oraclel have not been shut down normally. C, after the database is closed, the shared memory or semaphore is still occupied. The Lk data database is already in MOUNT state, so you don't have to MOUNT it again. When DATABASE is UNmount, it will be deleted automatically. If DATABASE does not have MOUNT, the problem still exists and can only be deleted manually.

Solution:

Cd / $ORACLE_HOME/dbs

$ORACLE_HOME/dbs > ll lk*

/ / View processes and users using lkORCL files

/ sbin/fuser-u lkORCL

/ / use fuser-k lkORCL to release the access process

/ sbin/fuser-k lkORCL

And then restart it.

15. View the database

View instance status

Select status from v$instance

View database coding

Select userenv ('language') from dual

Activate scott user

Alter user scott account unlock

Alter user scott identified by tiger

View users

Select * from all_users

16.oracle snooping start, stop, view commands

Su oracle

Then start the listener.

Lsnrctl start

You will see the interface that starts successfully.

Lsnrctl stop

Stop listener command.

Lsnrctl status

Check the listener commands.

View listening port

Netstat-tnulp | grep 1521

Power-on self-start monitoring

Su root

[root@centos-oracle ~] # vim .bashrc

Add lsnrctl start at the bottom of the file

Save exit

17.firewall firewall

Start and shut down

Systemctl start firewalld # start, systemctl enable firewalld # boot systemctl restart firewalld # restart systemctl stop firewalld # shut down systemctl disable firewalld # cancel boot

Specific rule management using firewall-cmd

Description:

-zone scope

-add-port=8080/tcp add port, format: Port / communication protocol

-permanent # is in effect forever. Without this parameter, it will expire after restart.

View running status

[root@localhost /] # firewall-cmd-- state

Running

[root@localhost /] #

View all open ports in the specified area

[root@localhost /] # firewall-cmd-zone=public-list-port

5055-5060/tcp

Open designated port

[root@centos-oracle] # firewall-cmd-zone=public-add-port=1521/tcp-permanent

Success

[root@centos-oracle ~] #

Port forwarding

Firewall-cmd-add-forward-port=port=80:proto=tcp:toport=8080-permanent

18. Modify the listening file

Cd / db/app/oracle/product/11.2.0/network/admin

Find the listener.ora file

The modifications are as follows:

The modifications are as follows:

SID_LIST_LISTENER =

(SID_LIST =

(SID_DESC =

(SID_NAME = PLSExtProc)

(ORACLE_HOME = / opt/app/oracle/product/11.2.0/)

(PROGRAM = extproc)

)

(SID_DESC =

(GLOBAL_DBNAME = ORCL)

(ORACLE_HOME = / opt/app/oracle/product/11.2.0/)

(SID_NAME = ORCL)

)

)

LISTENER =

(DESCRIPTION_LIST =

(DESCRIPTION =

(ADDRESS = (PROTOCOL = IPC) (KEY = EXTPROC1521))

(ADDRESS = (PROTOCOL = TCP) (HOST = centos-oracle) (PORT = 1521))

)

)

ADR_BASE_LISTENER = / opt/app/oracle

SID_LIST_LISTENER =

(SID_LIST =

(SID_DESC =

(SID_NAME = PLSExtProc)

(ORACLE_HOME = / db/app/oracle/product/11.2.0/)

(PROGRAM = extproc)

)

(SID_DESC =

(GLOBAL_DBNAME = ORCL)

(ORACLE_HOME = / db/app/oracle/product/11.2.0/)

(SID_NAME = ORCL)

)

)

LISTENER =

(DESCRIPTION_LIST =

(DESCRIPTION =

(ADDRESS = (PROTOCOL = IPC) (KEY = EXTPROC1521))

(ADDRESS = (PROTOCOL = TCP) (HOST = centos-oracle) (PORT = 1521))

)

)

ADR_BASE_LISTENER = / db/app/oracle

19. Set boot self-boot

Cd / etc

Vim oratab

If not, create a new one.

Join orcl:/opt/app/oracle/product/11.2.0:Y

Give oratab execution permission

Chmod 777 / etc/oratab

Vim / etc/rc.d/rc.local

Modify

Su-oracle-lc "/ opt/app/oracle/product/11.2.0/bin/lsnrctl start"

Su-oracle-lc "/ opt/app/oracle/product/11.2.0/bin/dbstart"

Su-oracle-lc "/ db/app/oracle/product/11.2.0/bin/lsnrctl start"

Su-oracle-lc "/ db/app/oracle/product/11.2.0/bin/dbstart"

Chmod 777 / etc/rc.d/rc.local

Cd / opt/app/oracle/product/11.2.0/bin

Cd / db/app/oracle/product/11.2.0/bin

Vim dbstart

Change $1 to $ORACLE_HOME, as follows:

# ORACLE_HOME_LISTNER=$1

ORACLE_HOME_LISTNER=$ORACLE_HOME

Restart the linux system and check whether the oracle starts automatically

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.

Share To

Database

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report