Deployment of Oracle 12c database

Bowen structure
Oracle manual installation process
to start, shut down the Oracle database

A .Oracle Database Overview

Oracle Database, also known as Oracle RDBMS, or simply Oracle. Oracle is a relational database management systems. It is has been a leader in the field of database products. Oracle database system can be said is the world's popular relational database management system, a good system portability, ease of use, powerful, applicable to all types of large, medium, small, computer environment. It is a high efficiency, good reliability, high throughput adaptation program database.

  • A complete data management capabilities
1)数据的大量性
2)数据的保存的持久性
3)数据的共享性
4)数据的可靠性
2、完备关系的产品:
1)信息准则---关系型DBMS的所有信息都应在逻辑上用一种方法,即表中的值显式地表示;
2)保证访问的准则
3)视图更新准则---只要形成视图的表中的数据变化了,相应的视图中的数据同时变化
4)数据物理性和逻辑性独立准则
3、分布式处理功能:
ORACLE数据库自第5版起就提供了分布式处理能力,到第7版就有比较完善的分布式数据库功能了,一个ORACLE分布式数据库由oraclerdbms、sql*Net、SQL*CONNECT和其他非ORACLE的关系型产品构成。
4、用ORACLE能轻松的实现数据仓库的操作。

Advantage
■ strong availability
■ scalability
■ data security strong
■ strong stability

II. Installation procedure

Requirements Before installing
Oracle 12c explicitly supported Linux operating systems, including 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 belong synchronous parallel operating systems also support so Oracle 12 c CentOS 7, CentOS 6, CentOS 5 operating system. When installed in other Linux systems, individual software or configuration files may need to make the appropriate adjustments.

Linux operating system requirements:

Physical Memory: must be higher than 1GB, VMware virtual machine for less than 2GB is recommended;
swap space: the physical memory is 1 ~ 2GB, swap 1.5 to 2 times the physical memory; physical memory is 2 ~ 16GB, swap in the same physical memory size; more than 16GB, 16GB physical memory swap using it;

  • 1. Software Environment Requirements
[root@localhost /]# vim /etc/hosts
192.168.1.10    Oracle

[root@localhost ~]# 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
  • 2. Core Requirements
[root@localhost ~]# vim /etc/sysctl.conf    \\添加下面这段
fs.aio-max-nr = 1048576
fs.file-max = 6815744
kernel.shmall = 2097152
kernel.shmmax = 4294967295
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  = 262144
net.core.wmem_max = 1048576
[root@localhost ~]# sysctl -p                    \\重新加载配置
  • 3.Oracle user environment requirements
    [root@localhost ~]# groupadd -g 54321 oinstall  \\创建安装组
[root@localhost ~]# groupadd -g 54322 dba       \\创建管理组
[root@localhost ~]# useradd -u 54321 -g oinstall -G dba oracle
\\创建运行用户
[root@localhost ~]# passwd oracle 
更改用户 oracle 的密码 。
新的 密码:
重新输入新的 密码:
passwd:所有的身份验证令牌已经成功更新。
[root@localhost ~]# mkdir -p /u01/app/oracle    \\建立基本组
[root@localhost ~]# chown -R oracle:oinstall /u01/app/
[root@localhost ~]# chmod -R 775 /u01/app/oracle/

Oracle 12c installation tasks should be performed in order to run as user oracle, the need to adjust the oracle user's environment configuration to full
meet the requirements. Specific operation is as follows:

[root@localhost /]# 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
NLS_LANG="SIMPLIFIED CHINESE_CHINA".UTF8
PATH=$PATH:$ORACLE_HOME/bin
LANG=zh_CN.UTF-8
export PATH LANG NLS_LANG ORACLE_BASE ORACLE_HOME ORACLE_SID
export  DISPLAY=:0.0
  • 4.oracle user resource limits
    , respectively, into the configuration file to the field

    [root@localhost /]# vim /etc/pam.d/login 
    session   required  /lib/security/pam_limits.so
    session   required  pam_limits.so
    [root@localhost /]# vim /etc/security/limits.conf 
    oracle   soft    nproc   2047
    oracle   hard    nproc   16384
    oracle   soft   nofile   1024
    oracle   hard   nofile    65536
    oracle   soft  stack    10240
    [root@localhost /]# 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

Restart the system after the completion of the preparatory work. After the restart, before checking again whether the configuration take effect. Restart

  • 5.
    the Oracle of Chinese official site at https:. // www oracle com / cn
    It supports Oracle 12c installation files free downloads
[root@localhost media]# mkdir /tmp/abc
[root@localhost media]# cd /media/
[root@localhost media]# ls
linuxx64_12201_database.zip
[root@localhost media]# cp linuxx64_12201_database.zip /tmp/abc/
[root@localhost abc]# cd /tmp/abc/
[root@localhost abc]# unzip linuxx64_12201_database.zip 
[root@localhost abc]# ls
database  linuxx64_12201_database.zip
[root@localhost abc]# ls database/
install  response  rpm  runInstaller  sshsetup  stage  welcome.html
[root@localhost abc]# xhost +    
//一定要以root用户在图形环境中操作
access control disabled, clients can connect from any host
[root@localhost abc]# cd /
[root@localhost /]# su oracle
[oracle@localhost /]$ cd /tmp/abc/database/
[oracle@localhost database]$ export DISPLAY=:0.0  
//设置DISPLAY环境变量
[oracle@localhost database]$ ./runInstaller 

Enter the above command will appear as shown:

Deployment of Oracle 12c database

Deployment of Oracle 12c database

Deployment of Oracle 12c database

Deployment of Oracle 12c database

Deployment of Oracle 12c database

Deployment of Oracle 12c database

Deployment of Oracle 12c database

Deployment of Oracle 12c database

Deployment of Oracle 12c database

Deployment of Oracle 12c database

Deployment of Oracle 12c database

Deployment of Oracle 12c database

Deployment of Oracle 12c database

Installation process will pop up as shown below, need to open the terminal performs bit

Deployment of Oracle 12c database

[root@localhost ~]# /u01/app/oraInventory/orainstRoot.sh 
\\默认回车就行
更改权限/u01/app/oraInventory.
添加组的读取和写入权限。
删除全局的读取, 写入和执行权限。

更改组名/u01/app/oraInventory 到 oinstall.
脚本的执行已完成。
[root@localhost~]#/u01/app/oracle/product/12.2.0/dbhome_1/root.sh 
Performing root user operation.

The following environment variables are set as:
    ORACLE_OWNER= oracle
    ORACLE_HOME=  /u01/app/oracle/product/12.2.0/dbhome_1

Enter the full pathname of the local bin directory: [/usr/local/bin]: 
   Copying dbhome to /usr/local/bin ...
   Copying oraenv to /usr/local/bin ...
   Copying coraenv to /usr/local/bin ...
     略.....

Deployment of Oracle 12c database

Deployment of Oracle 12c database

You first need to solve the problem sqlplus command-line arrow keys can not be used, as follows:

[root@oracle ~]#  yum -y install ncurses* readline*                 //安装软件包所需依赖
[root@oracle ~]# tar zxf rlwrap-0.30.tar.gz.zip -C /usr/src
[root@oracle ~]# cd /usr/src/rlwrap-0.30/
[root@oracle rlwrap-0.30]# ./configure && make && make install
//使用root身份进行编译安装,安装完成后即可使用!
[oracle@oracle ~]$  rlwrap sqlplus "/ as sysdba"

SQL*Plus: Release 12.2.0.1.0 Production on 星期二 11月 26 10:51:44 2019

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

连接到: 
Oracle Database 12c Enterprise Edition Release 12.2.0.1.0 - 64bit Production

SQL> 

III. Creating a database

To create a database follows
.
(1) as the oracle user to run a command DBCA.

[oracle@localhost /]$ dbca

Deployment of Oracle 12c database

Deployment of Oracle 12c database

Deployment of Oracle 12c database

Deployment of Oracle 12c database

Deployment of Oracle 12c database

  • Start, shut down the Oracle database

User login To start and close the database, Oracle must have administrator privileges, usually log on as a user with SYSDBA privileges.

Start database
starts a database requires three: ① From Start oracle instance (non-loading phase); ② a database instance loading (loading stage); ③ Open Database (opening phase).
In the startup command, you can use different options to control the different steps to start the database.

1) startup nomount (the command is not used)

nomount option to start only one instance of oracle, read init.ora initialization parameter file to start the background process initialization SGA. After the instance is started, the system displays a list of a structure and size of the SGA memory, as follows:

[oracle@oracle ~]$ sqlplus / as sysdba                    //以oracle用户登录数据库

SQL*Plus: Release 12.2.0.1.0 Production on 星期二 11月 26 11:18:36 2019

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

连接到: 
Oracle Database 12c Enterprise Edition Release 12.2.0.1.0 - 64bit Production

SQL> startup nomount       

2)startup mount(某些时候会用到该命令)
startup mount 命令启动实例并且装载数据库,但是没有打开数据库。oracle系统读取控制文件中关于数据文件和重做日志文件的内容,但并不打开该文件。这种打开方式常在数据库维护操作中使用,如对数据文件的更名、改变重做日志及打开归档模式等。在这种打开方式下,除了可以看到SGA系统列表以外,系统还会给出“数据库装载完毕”的提示。

SQL> alter database mount; 
//由于上面已经执行了startup nomount命令,所以再更改它的状态,就需要使用该命令

3)startup(正常时使用的命令)
startup命令完成启动实例,装载数据库和打开数据库三个步骤。此时,数据库使数据文件和重做日志文件在线,通常还会请求一个或者多个回滚段;系统除了可以看到前面startup mount 方式下的所有提示外,还会给出一个“数据库已经打开”的提示;数据库系统处于正常的工作状态,可以接收用户的请求。

如果采用startup nomount或者startup mount的数据库打开方式,必须采用alter database命令来执行装载或打开数据库的操作。

前面两条命令都执行过了(startup nomount和alter database mount),所以这里再执行下面命令,数据库就可以说是正确启动完成了。如下:

SQL> alter database open;             
正常来说,可以直接使用下面一条命令来正常启动数据库,如下:

SQL> startup           //在数据库关闭状态下执行该命令,数据库会依次启动、装载、打开。
ORACLE 例程已经启动。

Total System Global Area 1593835520 bytes
Fixed Size          8793256 bytes
Variable Size        1023411032 bytes
Database Buffers      553648128 bytes
Redo Buffers            7983104 bytes
数据库装载完毕。
数据库已经打开。
  • 数据库的关闭

对于数据库的关闭,有四种不同的关闭选项。

  • 1)shutdown normal
    shutdown normal是shutdown命令的默认选项。也就是说,如果用户发出shutdown命令,即执行shutdown normal命令。
    发出该命令后,任何新的连接都将不再允许连接到数据库。在数据库关闭之前,oracle将等待目前连接的所有用户都从数据库中退出后才开始关闭数据库。采用这种方式关闭数据库,在下一次启动时不需要进行任何的实例恢复。但需要注意的是,采用这种方式时,也许关闭一个数据库需要几天或更长的时间。

  • 2)shutdown immediate
    shutdown immediate是常用的一种关闭数据库的方式。若即想很快地关闭数据库,又想让数据库“干净”的关闭,则常采用这种方式。

发出该命令后,当前正在被oracle处理的SQL语句立即中断,系统中任何没有提交的事务全部回滚。如果系统中存在一个很长的未提交的事务,那么采用这种方式关闭数据库也需要一段时间(该事务回滚时间)。系统不会等待连接到数据库的所有用户退出系统,而会强行回滚当前所有的活动事务,然后断开所有的连接用户。

  • 3)shutdown transactional
    shutdown transactional 命令常用来计划关闭数据库,它会等待当前连接到系统且正在活动的事务执行完毕,运行该命令后,任何新的连接和事务都是不允许的。它所有活动的事务执行完成后,数据库将以和shutdown immediate同样的方式关闭数据库。

  • 4)shutdown abort
    shutdown abort是关闭数据库方式的最后选择,是在没有任何办法关闭数据库的情况下不得不采用的方式,一般不要采用。在下列情况出现时可以考虑采用这种方式关闭数据库。

数据库处于一种非正常工作状态,不能用shutdown normal或shutdown immediate命令关闭数据库;
需要立即关闭数据库;
在启动数据库实例时遇到问题。

发出该命令后,所有正在运行的SQL语句将立即中止,所有未提交的事务将不回滚,oracle也不等待目前连接到数据库的用户退出系统;下一次启动数据库时需要实例恢复,因此,下一次启动可能比平时需要更多的时间。

When closing the database shutdown immediate mode is preferably used, because this way safe and relatively fast. Not a last resort do not use shutdown abort way, because in this way will result in loss of data and also take a long time to recover the database.

  • Startup, shutdown oracle listener process

When the Oracle database instance startup is complete, in order to enable client users can connect to the Oracle instance, the database administrator should
start the monitoring process using Inrctl command on the server where Oracle. If the database instance is shut down - as also closed the listener
process.

[oracle@oracle ~]$ lsnrctl              //执行该命令

LSNRCTL for Linux: Version 12.2.0.1.0 - Production on 25-9月 -2019 21:59:04

Copyright (c) 1991, 2016, Oracle.  All rights reserved.

欢迎来到LSNRCTL, 请键入"help"以获得信息。

LSNRCTL> start          //启动监听
启动/u01/app/oracle/product/12.2.0/dbhome_1//bin/tnslsnr: 请稍候...

TNSLSNR for Linux: Version 12.2.0.1.0 - Production
系统参数文件为/u01/app/oracle/product/12.2.0/dbhome_1/network/admin/listener.ora
写入/u01/app/oracle/diag/tnslsnr/oracle/listener/alert/log.xml的日志信息
监听: (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=oracle)(PORT=1521)))
监听: (DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=EXTPROC1521)))

正在连接到 (DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=oracle)(PORT=1521)))
LISTENER 的 STATUS
------------------------
别名                      LISTENER
版本                      TNSLSNR for Linux: Version 12.2.0.1.0 - Production
启动日期                  25-9月 -2019 21:59:12
正常运行时间              0 天 0 小时 0 分 0 秒
跟踪级别                  off
安全性                    ON: Local OS Authentication
SNMP                      OFF
监听程序参数文件          /u01/app/oracle/product/12.2.0/dbhome_1/network/admin/listener.ora
监听程序日志文件          /u01/app/oracle/diag/tnslsnr/oracle/listener/alert/log.xml
监听端点概要...
  (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=oracle)(PORT=1521)))
  (DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=EXTPROC1521)))
监听程序不支持服务
命令执行成功

Direct command to turn

[Oracle @ oracle ~] $ lsnrctl start // start listening

  • Close listening
[oracle@oracle ~]$ lsnrctl stop         //关闭监听

LSNRCTL for Linux: Version 12.2.0.1.0 - Production on 25-9月 -2019 22:00:31

Copyright (c) 1991, 2016, Oracle.  All rights reserved.

正在连接到 (DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=oracle)(PORT=1521)))
命令执行成功

Guess you like

Origin blog.51cto.com/14400213/2457746