In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-17 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >
Share
Shulou(Shulou.com)06/01 Report--
In the field of computer information security, database system undoubtedly plays an important role. For example, Microsoft's SQL server, IBM's DB2, Oracle's Oracle, MySQL and so on, are all well-known database management software, in which Oracle database has an absolute leading advantage in telecommunications, banking, securities, transportation and other large-scale applications.
Here we will talk about the installation of Oracle 12c.
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. SUSE Linux Distributions. NeoKylin Linux Advanced Server Distributions. Because Red Hat Enterprise and CentOS are simultaneous operating systems, Oracle 12c also supports CentOS7. CentOS6. CentOS5 operating system. Individual software or configuration files may need to be adjusted appropriately when installed on other Linux systems.
Linux system requirements:
Physical memory: must be higher than 1GB, and no less than 2GB is recommended for VMware virtual machines. Swap space: when the physical memory is 1 ~ 2GB, the swap partition is 1.5 ~ 2 times the physical memory; when the physical memory is 2 ~ 16GB, the swap partition is the same as the physical memory size: when the physical memory exceeds 16GB, the swap partition uses 16GB.
I. preparatory work
System configuration requirements
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. In addition to the standard version of 6.1GB, make sure that the free space in the / tmp directory is not less than 1GB. General land
For example, it is recommended to prepare at least 15GB hard disk space for Oracle 12c.
In the experimental environment, if you do not create a partition for Oracle alone, at least make sure that the root partition has free disk space for 15GB. If the current disk space is insufficient, consider adding a hard disk to the simulator and formatting it as a XFS file system. At the same time, create the / U01 directory and mount the newly created partition to the / U01 directory. Also remember to modify the / etc/fstab file so that it is automatically mounted when powered on.
Before installing the Oracle database, plan the hostname and IP. The host name and IP address of the server should also be determined in advance. Once the Oracle database installation is complete, it is recommended that you do not modify the hostname, otherwise the database startup will fail. Viewing the host name can be achieved through the hostname command, and modifying the host name can be achieved through the configuration file / etc/hosts
[root@oracle /] # hostnameoracle [root@oracle /] # cat / etc/hosts127.0.0.1 localhost localhost.localdomain localhost4 localhost4.localdomain4::1 localhost localhost.localdomain localhost6 localhost6.localdomain6192.168.1.10 oracle
Software environment requirements
The installation process of Oracle 12c is usually carried out in a graphical interface, so it is recommended that you use a CentOS server that already has a GNOME Chinese desktop environment installed. Of course, software development tools, such as gcc. Glibc, binutils and other software packages
[root@oracle /] # yum-y install binutils compat-libcap1 compat-libstdc++-33 gcc gcc-c++ glibc glibc-devel ksh libaio libaio-devel libgcc libstdc++ libstdc++-devel libXi libXtst make sysstat unixODBC unixODBC-devel
Kernel requirements
To ensure that the database runs stably, Oracle 12c targets Linux kernel parameters. Process session restrictions make a number of requirements, some of which can be automatically detected and repaired during installation, but they are not necessarily 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 memory scheduling. Port range, number of open files.
For some related settings such as VO requests, 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 # editor. / / omit part fs.aio-max-nr = 1048576fs.file-max = 6815744kernel.shmall = 2097152kernel.shmmax = 4294967295kernel.shmmni = 4096kernel.sem = 25032000100 128net.ipv4.ip_local_port_range = 9000 65500net.core.rmem_default = 262144net.core.rmem_max = 4194304net.core.wmem_default = 262144net.core.wmem_max = 1048576. / / omit some contents [root@oracle /] # sysctl-p # reload the configuration file fs.aio-max-nr = 1048576fs.file-max = 6815744kernel.shmall = 2097152kernel.shmmax = 4294967295kernel.shmmni = 4096kernel.sem = 25032000100 128net.ipv4.ip_local_port_range = 900065500net.core.rmem_default = 262144net.core.rmem_max = 4194304net.core.wmem_default = 262144net.core.wmem_max = 1048576
Oracle user environment requirements
Oracle 12c requires a fixed operating user oracle. Installation group oinsall. Management group dba, these accounts should be set up in advance. Use
Basic directories (such as / u01/app/oracle) to store Oracle programs and database files should also be created in advance
[root@oracle /] # groupadd-g 54321 oinstall # create installation group [root@oracle /] # groupadd-g 54322 dba # create administrative group [root@oracle /] # useradd-u 54321-g oinstall-G dba oracle # create and run user [root@oracle /] # passwd oracle # configure password to change user oracle password. New password: invalid password: password failed dictionary check-oversimplified / systematic re-entry of the new password: passwd: all authentication tokens have been successfully updated. [root@oracle /] # mkdir-p / u01/app/oracle # create a basic directory [root@oracle /] # chown-R oracle:oinstall / u01/app/ [root@oracle /] # chmod-R 775 / u01/app/oracle/
The installation task of Oracle 12c should be performed as the running user oracle, and the environment configuration of the oracle user should be adjusted appropriately to meet the requirements:
[root@oracle /] # vim / home/oracle/.bash_profile.... / / omit part of umask 022ORACLE_BASE=/u01/app/oracle # define basic directory ORACLE_HOME=/u01/app/oracle/product/12.2.0/dbhome_1/ # define installer directory ORACLE_SID=orcl # define database instance name NLS_LANG= "SIMPLIFIED CHINESE_CHINA" .UTF8 # determine which locale to use, PATH=$PATH:$ORACLE_HOME/binLANG=zh_CN.UTF-8export PATH LANG NLS_LANG ORACLE_BASE ORACLE_HOME ORACLE_SIDexport DISPLAY=:0.0
Oracle user resource restriction requirements
The process session limit can be pam. Jimits authentication module to achieve. Enable the authentication by modifying the PAM setting of the login program login, and then modify / etc/security/imits. Conf file, the number of processes that the user oracle can open. Increased number of files used by the process
[root@oracle /] # vim / etc/pam.d/login. / / omit part of the content session required / lib/security/pam_limits.sosession required pam_ rooms.so [root @ oracle /] # vim / etc/security/limits.conf. / / omit some contents oracle soft nproc 2047 # soft limit on the number of processes oracle hard nproc 16384 # hard limit on the number of processes oracle soft nofile 1024 # soft limit on the number of files oracle hard nofile 65536 # hard limit oracle soft stack 10240 # Oracle Soft stack limit [root@oracle /] # vim / etc/profile. / / omit some contents if [$USER = "oracle"]; then if [$SHELL = "/ bin/ksh"]; then ulimit-p 16384 ulimit-n 65536 else ulimit-u 16384-n 65536 fifi
If you do not configure the oracle user resource limit section, it will not affect the successful installation of the Oracle database. However, if there are bad SQL statements that infinitely occupy the resources of the server, resulting in no response to user requests for a long time, it is recommended to limit oralce user resources in advance, restart the operating system after the preparation is completed, and check whether the previous configuration is effective again after restarting. It is recommended not to make temporary configuration.
Second, install Oracle
The official Chinese website of Oracle is https: / / www. Oracle .com / cn. It supports free download of Oracle 12c installation files (you need to register an account). Correctly select the system platform you are using (such as Linux x86-64), and then download the linuxx64 .12201.database .zip ZP package to the / tmp/abc folder (create your own). After unpacking, you can get the database folder and the installation script for Oracle. Product manuals and other documents are located in this folder
You can also download the installation package provided by me:
Start installation
[root@oracle /] # mkdir / tmp/abc # Why create a directory under tmp, because the permissions of tmp are liberalized Later, you need to switch Oracle users to install [root@oracle /] # cd / tmp/abc/ [root@oracle abc] # lsflash-player-npapi-26.0.0.131-release.x86_64.rpm linuxx64_12201_database.zip [root@oracle abc] # unzip linuxx64_12201_database.zip [root@oracle abc] # ls database/install response rpm runInstaller sshsetup stage welcome.html
The installation of Oracle 12c is mainly carried out through runlsaller scripts. Visit the web page welcome .html to consult the product manual, including product instructions, release notes, installation guides and other documents, providing administrators with a wealth of help information.
Once all the prerequisites are ready, you can officially begin the installation. If the current graphical desktop environment is logged in as another user, such as root, you should also add authorization to allow the user oracle to use the graphics terminal. For example, "xhost +"
"oracle@localhost" means to allow user oracle to access from the local machine, execute, xhost+ "means to remove all restrictions.
Log in to CentOS's graphical desktop environment as user oracle and start the runstaller script file in the database/ directory
[root@oracle abc] # xhost + # must be a root user operating access control disabled in a graphical environment. Clients can connect from any host [root@oracle abc] # su-oracle # switch to Oracle user [oracle@oracle ~] $cd / tmp/abc/database/ [oracle@oracle database] $. / runInstaller is starting Oracle Universal Installer... Check temporary space: must be greater than 500 MB. The actual swap space is 28334 MB by checking: it must be greater than 150 MB. Actually check the monitor for 2047 MB: the monitor configuration must display at least 256colors. Actually launch Oracle Universal Installer / tmp/OraInstall2019-12-11 09-32-31PM from the following address by preparing for 16777216. Just a moment, please.
[root@oracle /] # / u01/app/oraInventory/orainstRoot.sh # can change permissions / u01/app/oraInventory by executing directly. Add read and write permissions for the group. Removes global read, write, and execute permissions. Change the group name / u01/app/oraInventory to oinstall. The execution of the script is complete. [root@oracle /] # / u01/app/oracle/product/12.2.0/dbhome_1/root.sh # enter directly after being prompted to execute Performing root user operation.The following environment variables are set as: ORACLE_OWNER= oracle ORACLE_HOME= / u01/app/oracle/product/12.2.0/dbhome_1Enter the full pathname of the local bin directory: [/ usr/local/bin]: # enter
Install flash player
[root@oracle /] # cd / tmp/abc/ [root@oracle abc] # lsdatabase linuxx64_12201_database.zipflash-player-npapi-26.0.0.131-release.x86_ 64.rpm [root @ oracle abc] # rpm-ivh flash-player-npapi-26.0.0.131-release.x86_64.rpm preparation. # # # # [100%] upgrading / installing... 1:flash-plugin-26.0.0.131-release # # [100%]
The following figure shows the enterprise manager of Oracle
The creation of Oracle 12c database
[oracle@oracle /] $sqlplus / as sysdba # login database SQL*Plus: Release 12.2.0.1.0 Production on Wednesday December 11 22:00:15 2019Copyright (c) 1982, 2016, Oracle. All rights reserved. Connect to: Oracle Database 12c Enterprise Edition Release 12.2.0.1.0-64bit ProductionSQL > sys users are the top administrators of Oracle, and as sysdba is usually added when logging in as sys users, while other users do not need it. SQL > help index # ketongguy can use this command to view the list of supported assignments
Create the database:
[oracle@oracle /] $dbca # shuru enter this command to pop up the wizard to create the database
Startup and shutdown of Oracle 12c database
1. Startup of database
Starting (STARTUP) a database requires three steps: ① starts the Oracle instance (non-mount phase); ② is loaded by the instance
Database (load phase); ③ open database (open phase).
In the STARTUP command, you can control the different startup steps of the database through different options.
1) STARTUP NOMOUNT
The NOMOUNT option starts only one Oracle instance, reads the init ora initialization parameter file, starts the background process, and initializes the
Change into SGA. When the instance starts, the system will display a list of SGA memory structure and size, as shown below.
SQL > startup nomountORACLE instance started.Total System G1obal Area 2516582400 bytesFixed Size 8795904 bytesVariable Size 671090944 bytesDatabase Buffers 1828716544 bytesRedo Buffers 7979008 bytes
2) 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 open mode is often used in database maintenance operations, such as renaming the data file, changing the redo log and opening the 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".
3) 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; in addition to seeing all the prompts in the previous STARTUP MOUNT mode, the system will also give a "database has been opened" prompt: the database system is in a normal working state and can receive user requests.
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.
ALTER DATABASE MOUNT;ALTER DATABASE OPEN
If you start the database in STARTUP MOUNT mode, simply run the following command to open the database.
ALTER DATABASE OPEN
two。 Shutdown of the database
For database shutdown (SHUTDOWN), there are four different shutdown options.
1) 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. But it is important to note that. In this way, it may take several days or more to shut down a database.
2) SHUTDOWN IMEDIATE
SHUTDOWN IMEDIATE is a common way to shut down a database. This approach is often used if you want to close the database quickly and also want the database to shut down "cleanly".
After issuing this command, the SaL 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.
3) 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 active transactions are completed, the database closes the database in the same way as SHUTDOWN IMEDIATE.
4) SHUTDOWN ABORT
SHUTDOWN ABORT is the last choice to shut down the database, and it has to be adopted when there is no way to shut down the database. Consider shutting down the database in this way when the following situations occur.
(1) the database is in an abnormal working state and cannot be shut down with SHUTDOWN NORMAL or SHUTDOWN IMEDIATE commands.
(2) the database needs to be closed immediately.
(3) there is a problem when starting the database instance.
After issuing this command, all running SQL statements will be aborted immediately, all uncommitted transactions will not be rolled back, Oracle will not wait for users currently connected to the database to log out of the system, and the next time the database will be started will require instance recovery, so the next startup may take more time 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.
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.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.