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

CentOS 7 deploys Oracle 12c Enterprise Edition Database

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

Share

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

Matters needing attention in installing Oracle 12c1 and CentOS 7 operating system

Since the Oracle 12c software installation is implemented on the CentOS 7 system, install the CentOS 7 operating system first. The installation requirements are as follows:

The configuration option for the firewall is set to disabled

SELinux is set to disabled

The default installation setting is software development

Kernel version 3.10.0-862.el7.x86_64 and above; 2. Preparation of preconditions

Oracle database is a relatively large application software, which has corresponding requirements for server system type, memory and swap partition, hard disk empty Arkin, kernel parameters, software environment, user environment and so on. As long as these necessary conditions are met, Oracle 12c can be installed successfully and run stably.

1) system and configuration requirements

The Linux operating systems explicitly supported by Oracle 12c include Oracle Linux 7, Oracle Linux 6, Oracle Linux 5, Red Hat Enterprise Linux 7, Red Hat Enterprise Linux 6, Red Hat Enterprise Linux 5, and so on. Because Red Hat Enterprise and CentOS are synchronous parallel operating systems, Oracle 12c also supports CentOS 7, CentOS 6, CentOS 5 operating systems. Individual software or configuration files may need to be adjusted appropriately when installed on other Linux systems. View the system version with the following command:

[root@Oracle ~] # cat / etc/centos-releaseCentOS Linux release 7.4.1708 (Core)

The Linux operating system requires:

Physical memory: must be higher than 1GB, not less than 2GB is recommended for VMware virtual machines

Swap space: when the physical memory is 1~2GB, the swap partition is 1.5 to 2 times the physical memory; when the physical memory is 2~16GB, the swap partition is the same size as the physical memory; when the physical memory exceeds 16GB, the swap partition can use 16GB.

If there is not enough space in the swap partition, you can extend the swap partition in the following ways

The commands to view physical memory and swap memory are as follows:

[root@Oracle ~] # grep MemTotal / proc/meminfo MemTotal: 4030172 kB [root@Oracle ~] # grep SwapTotal / proc/meminfo SwapTotal: 8388604 kB

For Oracle 12c database, if the program files and data files are installed in the same partition, the minimum requirement for hard disk space in this partition is 6.4GB for the enterprise class and 6.1GB for the standard edition. In addition, make sure that the free space in the / tmp directory is not less than 1G. In general, it is recommended that you prepare at least 15GB hard disk space for Oracle 12c. Use the following command to view disk space usage:

[root@Oracle ~] # df-hT File system Type capacity available available mount point / dev/mapper/centos-root xfs 72G 21G 51G 30% / devtmpfs devtmpfs 2.0G 02.0G 0% / devtmpfs tmpfs 2.0G 960M 1008m 49% / dev/shmtmpfs Tmpfs 2.0G 9.0M 2.0G 1% / runtmpfs tmpfs 2.0G 0 2.0G 0% / sys/fs/cgroup/dev/sda1 xfs 197M 139M 59M 71% / boottmpfs tmpfs 394M 12K 394M 1% / run/user/42tmpfs tmpfs 394M 0394M 0% / run/user/0/dev/sr0 iso9660 4.3G 4.3G 0% / mnt

Before installing the Oracle database, plan the hostname and IP. The host name and IP address of the server should be confirmed in advance. Once the installation of the Oracle database is completed, it is recommended not to modify the host name, otherwise it will cause the database to fail to start. You can view the hostname through the hostname command, and modify the hostname through the configuration file / etc/hosts, as follows:

[root@centos01 ~] # hostnamectl set-hostname Oracle [root@centos01 ~] # bash [root@oracle ~] # hostname oracle [root@Oracle ~] # vim / etc/hosts 192.168.100.10 oracle2) Software environment requirements

The installation process of Oracle 12c is usually carried out in a graphical interface, so it is recommended to use a CentOS server with GNOME Chinese desktop environment installed. Of course, software development tools are essential, such as gcc, glibc, binutils and other software packages. It is recommended to use yum tools to install the following necessary software environment. The specific operations are as follows:

[root@Oracle ~] # yum-y install binutils elfutils-libelf elfutils-libelf-devel gcc gcc-c++ glibc glibc-common glibc-devel glibc-headers kernel-headers ksh libaio libaio-devel libgcc libgomp libstdc++ libstdc++-devel make numactl-devel unixODBC unixODBC-devel

The yum repository can choose to use a local CD. Oracle 12c itself integrates the Java running environment, but the Chinese language support for the installation interface is not perfect, so if you want to use the Chinese Oracle installation interface, it is recommended to install the Java software package in advance.

3) Kernel requirements

In order to ensure the stability of the database, Oracle 12c puts forward some requirements for Linux kernel parameters and process session restrictions, some of which can be automatically detected and repaired during installation, but they must be complete, so it is best to configure them in advance according to the installation documentation.

Kernel parameter adjustment is reflected in the / etc/sysctl.conf file, which mainly includes some settings related to memory scheduling, port range, number of open files, Icano request and so on. The relevant values should not be lower than the installation requirements. After the modification, make the new configuration effective immediately by executing the following "sysctl-p" command.

[root@Oracle] # vim / etc/sysctl.conf. Fs.file-max = 6815744kernel.sem = 32000 100100 128kernel.shmmni = 4096kernel.shmall = 1073741824kernel.shmmax = 4398046511104kernel.panic_on_oops = 1net.core.rmem_default = 262144net.core.rmem_max = 4194304net.core.wmem_default = 262144net.core.wmem_max = 1048576net.ipv4.conf.all.rp_filter = 2net.ipv4.conf.default.rp_filter = 2fs.aio-max-nr = 1048576net.ipv4.ip_local_port_range = 900065500 [root@Oracle ~] # sysctl-p 4) Oracle user environment requirements

Oracle 12c requires a fixed running user oracle, installation group oinstall, and management group dba. These accounts should be created in advance. The basic directory used to store Oracle programs and database files (such as / u01/app/oracle) should also be created in advance. The specific commands created are as follows:

[root@Oracle ~] # groupadd-g 54321 oinstall [root@Oracle ~] # groupadd-g 54322 dba [root@Oracle ~] # useradd-u 54321-g oinstall-G dba oracle [root@Oracle ~] # passwd oracle [root@Oracle ~] # mkdir-p / u01/app/oracle [root@Oracle ~] # chown-R oracle:oinstall / u01/app/ [root@Oracle ~] # chmod-R 755 / u01/app/

The installation task of Oracle 12c should be performed as the running user oracle, and the environment configuration of the oracle user needs to be adjusted to meet the requirements. The specific operations are as follows:

[root@Oracle ~] # vim / home/oracle/.bash_profile. Umask 022 ORACLE_BASE=/u01/app/oracle ORACLE_HOME=/u01/app/oracle/product/12.2.0/dbhome_1/ ORACLE_SID=orcl LANG=zh_CN.UTF-8 NLS_LANG= "AMERICAN_AMERICA" .ZHS16GBK PATH=$PATH:$ORACLE_HOME/binexport ORACLE_BASE ORACLE_HOME ORACLE_SID LANG NLS_LANG PATH [root@Oracle ~] # source / home / oracle/.bash_profile 5) oracle user resource limit requirements

The process session restriction can be realized by pam_limits authentication module. By modifying the PAM setting of the login program login to enable the authentication, and then modifying the / etc/security/limits.conf file, the number of processes that the user oracle can open and the number of files used by the process can be increased. The specific operations are as follows:

[root@Oracle ~] # vim / etc/pam.d/login session required / lib64/security/pam_limits.sosession required pam_ rooms.so.[ root @ Oracle ~] # vim / etc/security/limits.conf .oracle soft nofile 1024 oracle hard nofile 65536 oracle soft nproc 16384 oracle hard nproc 16384 oracle soft stack 10240 [root@Oracle ~] # vim / etc/profile. If [$USER = "oracle"]; then if [$SHELLO = "/ bin/ksh"]; then ulimit-p 16384 ulimit n 65536else ulimit-u 16384-n 65536fifi

If you do not configure the oracle user resource limit section, it will not affect the successful installation of the oracle database. However, if the server resources are infinitely occupied by bad SQL statements, resulting in no response to user requests for a long time, it is recommended to limit oracle user resources in advance.

Restart the system after the preparatory work is completed, and after the restart, check again whether the previous configuration is in effect.

3. Oracle 12c installation process

The official Chinese website of Oracle is https://www.oracle.com/index.html, which can be downloaded or extracted through the network disk: [https://pan.baidu.com/s/1VWFYZH0itXjXN-xt7hlD0A

Extract code: 9n84] for installation. The specific operations are as follows:

[root@Oracle oracle] # ls linuxx64_12201_database.zip [root@Oracle oracle] # unzip linuxx64_12201_database.zip [root@Oracle ~] # export DISPLAY=192.168.100.254:0.0 [root@Oracle ~] # xhost +

[root@Oracle ~] # su oracle [oracle@Oracle root] $cd [oracle@Oracle ~] $export DISPLAY=192.168.100.254:0.0 [oracle@Oracle ~] $xhost +

[oracle@Oracle ~] $/ u01/app/oracle/database/runInstaller is starting Oracle Universal Installer...

A moment after the execution is complete, the graphical interface pops up and do the following:

1) configure security updates and choose the next step without anything.

2) Select the installation option to create and configure the database, and click next.

3) Select the server class for the system class, and click next

4) Database installation option Select single instance database installation, and click next

5) Select a typical installation type, and click next

6) set the database password, and click next

7) keep the list by default, click next

8) default to next step

9) execute script

[root@Oracle ~] # / u01/app/oraInventory/orainstRoot.sh [root@Oracle ~] # / u01/app/oracle/product/12.2.0/dbhome_1/root.sh

10) installation is complete and accessed through the browser

11) browser visits https://Oracle:5500/em to install flash player

12) verify the installation result, and the browser accesses https://Oracle:5500/em

* next, use the SQLPlus command to access the Oracle 12c database in the command line interface: * *

[root@Oracle ~] # su oracle [oracle@Oracle root] $cd [oracle@Oracle ~] $source .bash _ profile [oracle@Oracle ~] $sqlplus / as sysdba SQL > help index SQL > show user; USER is "SYS"

In SQL > mode, it is not case-sensitive, but it is case-sensitive at the Linux prompt.

II. The creation of Oracle 12c database

If you do not create a database when you install an oracle product, you must first create a database to use the oracle system. If you choose to build a database when you install oracle, you can also create a second database.

There are two ways to create a database: through a graphical interface, or by using the "CREATE DATABASE" command. Here's how to create a database with a graphical interface.

In the Linux environment, it is realized by running database configuration assistant (database configuration assistant, DBCA). After Oracle 12c is installed, the Oracle system executable is generated in the $ORACLE_HOME/bin directory, and the DBCA used to create the Oracle database is also in this directory.

[oracle@Oracle ~] $export DISPLAY=192.168.100.254:0.0 [oracle@Oracle ~] $xhost +

[oracle@Oracle ~] $dbca

The graphical interface that pops up is as follows:

The database has been created. In order to enable the Oracle system to make full use of system resources, it is recommended that only one database be created on a server.

III. Startup and shutdown of Oracle 12c database

The startup and shutdown of oracle database is one of the daily tasks. For most oracle DBA, the most common way to start and shut down the oracle database is to execute it on the command line.

1. Start and shut down the Oracle database

To start and shut down the database, you must be logged in by a user with Oracle administrator privileges, usually as a user with SYSDBA privileges.

1) Startup of the database

Starting (STARTUP) a database requires three steps: ① starts the oracle instance (non-mount phase); ② loads the database by the instance (mount phase); and ③ opens the database (open phase).

In the STARTUP command, you can use different options to control the different startup steps of the database.

① STARTUP NOMOUNT

The NOMOUNT option starts only one oracle instance, reads the init.ora initialization parameter file, starts the background process, and initializes the SGA. When the instance is started, the system will display a list of SGA memory structure and size, as shown below:

SQL > startup nomount; ORACLE instance started.Total System Global Area 1660944384 bytesFixed Size 8793448 bytesVariable Size 1056965272 bytesDatabase Buffers 587202560 bytesRedo Buffers 7983104 bytesSQL > alter database mount; Database altered.SQL > alter database open; Database altered. ② STARTUP MOUNT

The STARTUP MOUNT command starts the instance and loads the database, but does not open the database. The Oracle system reads the contents of the data file and redo log file in the control file, but does not open the file. This opening method is often used in database maintenance operations, such as renaming data files, changing redo logs, opening archive mode, and so on. In this open mode, in addition to seeing the list of SGA systems, the system will also give a prompt that "the database is loaded". The specific operations are as follows:

SQL > startup mount; ORACLE instance started.Total System Global Area 1660944384 bytesFixed Size 8793448 bytesVariable Size 1056965272 bytesDatabase Buffers 587202560 bytesRedo Buffers 7983104 bytesDatabase mounted.SQL > alter database open; Database altered. ③ STARTUP

The STARTUP command completes the three steps of starting the instance, loading the database and opening the database. At this point, the database makes the data files and redo log files online, and usually requests one or more rollback segments; the system will not only see all the prompts in the previous STARTUP MOUNT mode, but also give a prompt that "the database is open"; the database system is in a normal working state and can receive requests from users.

SQL > startup; ORACLE instance started.Total System Global Area 1660944384 bytesFixed Size 8793448 bytesVariable Size 1056965272 bytesDatabase Buffers 587202560 bytesRedo Buffers 7983104 bytesDatabase mounted.Database opened.

If you use STARTUP NOMOUNT or STARTUP MOUNT to open the database, you must use the alter database command to load or open the database. For example, if you open the database in STARTUP NOMOUNT, that is, the instance has been started, but the database is not loaded and opened. At this point, you must run the following two commands for the database to start correctly. The command is as follows:

SQL > alter database mount; SQL > alter database open

If you start the database in STARTUP MOUNT, you only need to run the following command to open the database:

SQL > alter database open; 2) Database shutdown

For database shutdown, there are four different shutdown options.

① SHUTDOWN NORMAL

SHUTDOWN NORMAL is the default option for the SHUTDOWN command. That is, if the user issues the SHUTDOWN command, the SHUTDOWN NORMAL command is executed.

After issuing this command, any new connections will no longer be allowed to connect to the database. Before shutting down the database, Oracle will wait for all currently connected users to exit from the database before starting to shut down the database. Shutting down the database in this way does not require any instance recovery at the next startup. It is important to note, however, that in this way, it may take several days or more to shut down a database.

SQL > shutdown;Database closed.Database dismounted.ORACLE instance shut down.SQL > shutdown normal;Database closed.Database dismounted.ORACLE instance shut down. ② SHUTDOWN IMMEDIATE

SHUTDOWN IMMEDIATE is a common way to shut down a database. If you want to close the database quickly, but also want the database to be "clean" closed, this method is often used.

After issuing this command, the SQL statement currently being processed by Oracle is interrupted immediately, and any uncommitted transactions in the system are rolled back. If there is a long uncommitted transaction in the system, it will also take some time to shut down the database in this way (the transaction rollback time). Instead of waiting for all users connected to the database to exit the system, the system forcibly rolls back all currently active transactions and then disconnects all connected users.

SQL > shutdown immediate;Database closed.Database dismounted.ORACLE instance shut down. ③ SHUTDOWN TRANSACTIONAL

The SHUTDOWN TRANSACTIONAL command, which is often used to plan a database shutdown, waits for active transactions that are currently connected to the system to complete, and after running the command, any new connections and transactions are not allowed. After all its active transactions are completed, the database shuts down the database in the same way as SHUTDOWN IMMEDIATE.

SQL > shutdown transactional;Database closed.Database dismounted.ORACLE instance shut down. ④ SHUTDOWN ABORT

SHUTDOWN ABORT is the last choice to shut down the database. It has to be adopted when there is no way to close the database. Generally, it should not be used. Consider shutting down the database in this way when the following situations occur.

SQL > shutdown abort;ORACLE instance shut down.

The database is in an abnormal working state and cannot be shut down with SHUTDOWN NORMAL or SHUTDOWN IMMEDIATE commands

The database needs to be shut down immediately

A problem was encountered while starting the database instance.

After issuing this command, all running SQL statements will be aborted immediately, all uncommitted transactions will not be rolled back, and oracle will not wait for the user currently connected to the database to log out of the system; the next time the database is started, the instance needs to be restored, so the next startup may take longer than usual.

It is best to use the SHUTDOWN IMMEDIATE method when shutting down the database because it is safe and relatively fast. Do not use the SHUTDOWN ABORT method as a last resort, as it can result in data loss and take a long time to recover the database.

2. Start and close the Oracle listening process

When the oracle database instance is started, in order for client users to connect to the oracle instance, DBA also needs to start the listening process using the lsnrctl command on the server where oracle resides. If the database instance is shut down, the listening process is generally turned off as well.

1) start monitoring

Start snooping is a command executed by Oracle users under the operating system. You can add parameters directly after lsnrctl, or you can operate from the command prompt as follows:

[oracle@oracle] $lsnrctl LSNRCTL for Linux: Version 12.2.0.1.0-Production on 06-JAN-2020 19:28:52Copyright (c) 1991, 2016, Oracle. All rights reserved.Welcome to LSNRCTL Type "help" for information.LSNRCTL > start Starting / u01/app/oracle/product/12.2.0/dbhome_1//bin/tnslsnr: please wait...TNSLSNR for Linux: Version 12.2.0.1.0-ProductionSystem parameter file is / u01/app/oracle/product/12.2.0/dbhome_1/network/admin/listener.oraLog messages written to / u01/app/oracle/diag/tnslsnr/oracle/listener/alert/log.xmlListening on: (DESCRIPTION= PROTOCOL=tcp) (HOST=oracle) (PORT=1521)) Listening on: (DESCRIPTION= (ADDRESS= (PROTOCOL=ipc) (KEY=EXTPROC1521) Connecting to (DESCRIPTION= (ADDRESS= (PROTOCOL=TCP) (HOST=oracle) (PORT=1521) STATUS of the LISTENER----Alias LISTENERVersion TNSLSNR for Linux: Version 12.2.0.1.0-ProductionStart Date 06 MurJan- 2020 19:28:54Uptime 0 days 0 hr. 0 min. 0 secTrace Level offSecurity ON: Local OS AuthenticationSNMP OFFListener Parameter File / u01/app/oracle/product/12.2.0/dbhome_1/network/admin/listener.oraListener Log File / u01/app/oracle/diag/tnslsnr/oracle/listener/alert/log.xmlListening Endpoints Summary... (DESCRIPTION= (ADDRESS= (PROTOCOL=tcp) (HOST=oracle) (PORT=1521) (DESCRIPTION= (ADDRESS= (PROTOCOL=ipc) (KEY=EXTPROC1521) The listener supports no servicesThe command completed successfully

You can also directly use the following command "to start monitoring:

[oracle@Oracle ~] $lsnrctl start2) close listening [oracle@oracle ~] $lsnrctl stopLSNRCTL for Linux: Version 12.2.0.1.0-Production on 06-JAN-2020 19:33:04Copyright (c) 1991, 2016, Oracle. All rights reserved.Connecting to (DESCRIPTION= (ADDRESS= (PROTOCOL=TCP) (HOST=oracle) (PORT=1521)) The command completed successfully

-this is the end of this article. Thank you for reading-

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