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

Complete Oracle installation and library building manual

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

Share

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

Oracle12C R2 for Centos 7

Background introduction

Installation and configuration of this thing, there is really nothing to write about, but you said not to write more details, really many students do not understand, so, Xiong thought about how to install, completely write down, hope to let everyone have a comprehensive basic understanding

Preparatory work

Install Xmanager

This software is so powerful that it is mainly used to share the screen of the remote server to the local desktop.

The software is downloaded on the official website or in many places, so the link address will not be given in detail here (maybe in the later stage, Xiong will put all the software he needs on Baidu cloud disk, who knows)

Double-click the Xmanager installer and click next on the Welcome page to continue

You must accept the license agreement and continue next.

Mainly to enter the product key (there are many online, can be found, but also a special registration machine), click next to continue

The installation path can be continued according to your actual situation.

A typical installation is enough. Continue next.

The program folder in the start menu, which is the default. Continue next.

Select the Chinese language and click install

Installation completed

Download the installation package

In front: in fact, for absolute beginners, it is strongly recommended that you download an OEL7.6 installation because it optimizes the Oracle kernel and sets the necessary packages and parameters in advance, so don't worry.

Https://edelivery.oracle.com/osdc/faces/SoftwareDelivery#! Download link here, you need to sign up for an Oracle official website user and log in. Usually choose the seventh package, which is the last one. If you don't use OEL, you can download Centos 7.6 yourself.

Download the Oracle installation package

Just put the database package first, and if you want to practice, put the example package below.

Links are as follows: https://www.oracle.com/technetwork/database/enterprise-edition/downloads/oracle12c-linux-12201-3608234.html

You also need to sign up for an Oracle official website user and log in

Parameter configuration

Create groups and accounts (root account)

Groupadd-g 501 oinstallgroupadd-g 502 dbauseradd-g oinstall-G dba oracle

Create some directories and permissions (root account)

Mkdir-p / orasetup / home/app/oraclechmod-R 775 / orasetup / home/appchown-R oracle:oinstall / orasetup / home/app

The specific path above needs to be determined according to your actual situation. For example, it usually defaults to / u01/app/oracle.

Switch to the Oracle account and edit some necessary environment variables

[oracle@svn ~] $pwd/home/oracle [oracle@svn ~] $vi .bash _ profile

The details are as follows

Alias rm='rm-i'alias cp='cp-i'alias mv='mv-i'alias vi='vim'alias sqlplus='rlwrap sqlplus'alias rman='rlwrap rman'export ORACLE_BASE=/home/app/oracleexport ORACLE_HOME=$ORACLE_BASE/product/12.2.0/db_1export ORACLE_SID=bearexport LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$ORACLE_HOME/lib:/lib/usr/libexport PATH=$ORACLE_HOME/bin:/bin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/X11R6 / bin:$ORACLE_HOME/jdk/binexport NLS_DATE_FORMAT= "YYYY-MM-DD HH24:MI:SS" export NLS_LANG= "Simplified Chinese_China" .AL32UTF8

ORACLE_BASE is the Oracle base directory (including all Oracle products can be installed in this directory)

ORACLE_HOME is the Oracle database software directory

ORACLE_SID is the only indication of the database (especially important in a single instance)

The following LD_LIBRARY_PATH and PATH are the bin operation path and dictionary library path, respectively

NLS_DATA_FORMAT is the date display format (here is the year, month, day, hour and second)

NLS_LANG is the database display character set and the national character set display

(Simplified_Chinese_China.AL32UTF8 in Chinese)

Here you need to install a rlwrap software. Let's take a look at its function and how to install it.

If there is no rlwrap, the default sqlplus does not support up and down keyboard scrolling and fast history query (the list command can query history, but it is very inconvenient)

So let's install this software (there are many download addresses on the Internet, so there are no links here)

[root@svn tmp] # pwd/tmp [root@svn tmp] # ll-h Total usage 248K cd rlwrap-0.37/ [root@svn rlwrap-0.37] # pwd/tmp/rlwrap-0.37 [root@svn rlwrap-0.37] # 1 root root 246K February 14 2011 rlwrap-0.37.tar.gz [root@svn tmp] # tar-zxvf rlwrap-0.37.tar.gz [root@svn tmp] # pwd/tmp/rlwrap-0.37 [root@svn rlwrap-0.37] #. / configure

If an readline error occurs, execute the command yum-y install * readline* to install the missing package

Otherwise, it should appear as shown in the following figure.

[root@svn rlwrap-0.37] # make & & make install

Just perform the installation.

After editing the environment variable file for .bash _ profile, wq exits and executes source .bash _ profile to make it effective.

[root@svn ~] # vi / etc/profile sets system-level environment variables

If [$USER = "oracle"] | | [$USER = "grid"]; then if [$SHELL = "/ bin/ksh"]; then ulimit-p 16384 ulimit-n 65536 else ulimit-u 16384-n 65536 fifi

The above part is added mainly to lift the restrictions.

After adding, wq should also save and exit, and execute source / etc/profile to make it effective.

[root@svn ~] # vi / etc/security/limits.conf edit some parameter settings

Oracle soft stack 10240oracle soft nproc 2047oracle hard nproc 16384oracle soft nofile 1024

Adding the above settings is mainly due to the soft and hard restrictions that are allowed to open. Noproc represents the maximum number of processes per user, and nofile represents the maximum number of files that can be opened at the same time.

All of these, really thoughtful, you can take a look at this link (https://www.cnblogs.com/galengao/p/5764693.html)

Start installation

In the xmanager folder, select passive this. After double-clicking, an x icon appears in the lower right corner.

[oracle@svn ~] $export DISPLAY=192.168.9.179:0.0 [oracle@svn ~] $xhost + access control disabled, clients can connect from any host

Set your local IP display as shown above (note, set DISPLAY according to the actual situation of your local IP)

[oracle@svn orasetup] $pwd/orasetup [oracle@svn orasetup] $ll-h Total amount 0drwxr-xr-x 7 oracle oinstall 117 January 27 2017 databasedrwxr-xr-x 5 oracle oinstall 90 January 27 2017 examples [oracle@svn orasetup] $

After uploading the Oracle installation package to the / orasetup directory and unzipping it, the database folder appears and you can enter it.

[oracle@svn database] $pwd/orasetup/database [oracle@svn database] $. / runInstaller

Perform installation

In the first step, the configuration security update appears. Since there is no Metalink account, check the Oracle support out. Click next to continue.

First, install only the database software, and click next to continue.

Currently, only single instance installation is considered. Click next to continue.

Select Enterprise Edition to install, and click next to continue

As you can see here, above is the base directory of Oracle, and below is the product directory of Oracle. Both directories are configured in the. bash_profile file under the Oracle account. This file is read directly here. Click next to continue.

For the permission groups required for all kinds of operations, just give him the dba group to learn by yourself. Don't worry, click next to continue.

If there is a prerequisite to deal with, there is a script to execute, if there is a lack of packages, use the yum command to install, why use OEL, because only yum-y install oracle is needed, it is very convenient, I do not have any problems here, click install to start the installation

Execute the script shown above with your root account

[root@svn ~] # / home/app/oracle/product/12.2.0/db_1/root.sh

After the script execution is complete, click the OK button in the execution configuration script window.

After the software is installed, click close.

Silent installation

Sometimes we can't install it on the desktop (local or is counted remotely), so remote silent installation is particularly important, so let's take a look at how to do it.

In the response directory of database, there is a db_install.rsp file. Back it up first.

In the above file, there are some actual parameters. Just change them according to your actual situation. I won't explain them one by one here. It's very simple. If there are students who don't understand, just ask me again.

Use the command above to invoke the silent installation. The specific installation will not be demonstrated here. After installation, you also need to execute two scripts with the root account, which will be ok.

Install monitoring

NETCA

Type netca at the command line under Oracle user

Select listener configuration and click next to continue

Add listeners and continue next

Default listening name is listener. Continue next.

Default TCP protocol, continue next

Default port 1521, continue next

There is no need to configure another monitor. Continue next.

Listener configuration is complete. Continue next.

Click the finish button to complete the configuration

Create a database

Type dbca under the oracle account

Choose to create the database and continue next

Select advanced configuration and continue next

Select a single instance database. Default is general purpose (OLTP), and continue next.

Support for CDB and PDB databases (i.e. container databases and pluggable databases) from version 12C

The full name of CDB is Container Database, and its Chinese translation is database container.

The full name of PDB is Pluggable Database, and you can plug in and unplug the database.

Starting from 12C, Oracle instances can form an one-to-many relationship with databases.

Select Storage Properties, select OMF Tablespace Management, and click next to continue

Set the storage mode, path and size of the fast flashback area, and continue in the next step (practice phase, do not start archiving for the time being)

As you can see, the listener we have set has been loaded, and the next step is to continue.

Security options are not set in the practice environment. Continue next.

I set the process to 500. select AL31UTF8 in the character set, and the connection mode is dedicated server mode. The example solution of the practice environment can be ticked. Please set the memory according to the actual situation, and click next to continue.

If our shared memory setting is more than half of the total memory, then we need to set the shm, virtual memory page size on the Linux system

[root@svn ~] # vi / etc/fstab edit this file

Tmpfs / dev/shm tmpfs defaults,size=12288M 0 0

Add the above line, and after wq saves and exits, umount / dev/shm and then mount / dev/shm

In order to add to the OEM CC later, the stand-alone OEM will not be set here, and the next step will be continued.

Here Xiong is lazy to use the unified management password. The next step is to continue.

If you are interested, you can check all the initialization parameters, or generate a database creation script to learn (this script mainly uses RMAN's CLONE technology). Click next to continue.

Here will be a detailed configuration list. After verification, click finish to start building the library.

At this point, when the database is created, click close.

Silently build a database

Edit the dbca.rsp file to build the dbca library silently. How to edit the file is recorded in detail on the official website. There is no specific explanation here.

[oracle@svn response] $dbca-silent-createDatabase-responseFile. / dbca.rsp

Use the above command to silently build the library of dbca. Before that, edit the script and set up sid, dbname and other settings.

Build the library by hand

Write in front: there are many holes in building the library by hand, and to be honest, it doesn't make much sense, so beginners are strongly not recommended to try it.

12C the difference between creating a CDB is that to create a CDB,CREATE DATABASE statement, you must include an ENABLE PLUGGABLE DATABASE clause. When this clause is included, the statement uses the root and seed to create the CDB. If the ENABLE PLUGGABLE DATABASE clause is not specified, the newly created database is non-CDB. This statement does not create roots and seeds, and non-CDB will never contain PDB.

Here is the specific script for building the library

Create database bearuser sys identified by oracleuser system identified by oraclelogfile group 1 ('$ORACLE_BASE/oradata/bear/disk1/redo01.log') size 200m, group 2 ('$ORACLE_BASE/oradata/bear/disk2/redo02.log') size 200m Group 3 ('$ORACLE_BASE/oradata/bear/disk3/redo03.log') size 200mmaxlogfiles 10maxlogmembers 5maxloghistory 5maxdatafiles 1000character set al32utf8national character set al16utf16extent management local datafile'$ORACLE_BASE/oradata/bear/disk1/system01.dbf' size 1g sysaux datafile'$ORACLE_BASE/oradata/bear/disk3/sysaux01.dbf' size 1g default tablespace deftbs datafile'$ORACLE_BASE/oradata/bear/disk2/deftbs01.dbf' size 1g default temporary tablespace temp01 tempfile'$ORACLE_BASE/oradata/bear/disk1/temp01.tmp' size 100m Undo tablespace undotbs datafile'$ORACLE_BASE/oradata/bear/disk2/undotbs01.dbf' size 2genable pluggable database seed file_name_convert = ('$ORACLE_BASE/oradata/bear/' '$ORACLE_BASE/oradata/pdbseed/') system datafiles size 1g autoextend on next 1m maxsize unlimited sysaux datafiles size 1g user_data tablespace usertbs datafile' $ORACLE_BASE/oradata/pdbseed/disk2/usertbs01.dbf' size 1g Select instance_name, status from vastly instanceswitting select open_mode, name from v$database

After the 12C R2 version has built the library, the relevant execution scripts are integrated into the perl script catcdb.pl, which can be simply edited and modified. Please modify it according to the actual situation. I will not demonstrate it here.

In short, building a database by hand is not suitable for beginners, say important things three times!

View database status

In the CDB database, starting the CDB database does not start the pdb directly under it. Let's take a look at it.

SQL > select con_id, dbid, guid, name, open_mode from v$pdbs

As you can see, the PDB database is still in the mount state, that is, it is not started, and it needs to be started.

Currently, the database has been started

Switch to cdb$root user, and you can also see that the pdb library has been started

SQL > alter pluggable database all open; use this statement to start all pdb databases under the cdb library, or we can do a trigger to automatically trigger and start all pdb when cdb is started

SQL > create or replace trigger open_pdbs 2 after startup on database 3 begin 4 execute immediate 'alter pluggable database all open'; 5 end open_pdbs; 6 /

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