9). Set the environment for oracle Account Logon (logon as oracle ):Edit the vi/home/oracle/. bash_profile file and add the following lines:
ORACLE_BASE =/opt/oracle; # installation directory
ORACLE_HOME = $ ORACLE_BASE/11g; # oracle Home Directory
ORACLE_SID = orcl; # Instance name
LD_LIBRARY_PATH=$ORACLE_HOME/lib;
PATH=$PATH:$ORACLE_HOME/bin:$HOME/bin;
exportORACLE_BASEORACLE_HOMEORACLE_SIDLD_LIBRARY_PATHPATH;
After saving and exiting, run the following command to make the preceding settings take effect immediately:
source/home/oracle/.bash_profile
Set the default language for installation to English
echo'exportLANG=en_US.UTF-8'>>~/.bashrc
10). Start installation (Log On As an oracle user ):/Home/oracle/database/runInstaller; # run this program to start Installation
The following figure shows the installation page.
Figure-1 enter an email and click next
Figure-2 I am prompted to set up a proxy because my installation is not connected to the Internet. Select the check box and click "Continue ".
Figure-3 select the first item, create and configure the database after installation, and click next
Figure-4 Select Server Class and click next
Figure-5 install in singleton mode (if RAC is installed, select the next option) and click next
Figure-6 select Advanced install and click next
Figure-7 select Simple Chinese and English.
Figure-8 select "Install Enterprise Edition" and click "next"
Figure-9 install the base directory and Home directory. Because we have set the environment variables ORACLE_BASE and ORACLE_HOME, you do not need to select them here. Click next
Figure-10 install as an oinstall group and click next
Figure-11 install the database for transaction processing (select the next item in the data warehouse) and click next
Figure-12 set the environment variable ORACLE_SID and click next
Figure-13.1 maximum memory available, Oracle recommends automatic memory management, click the Character sets tab to select the Character set
Figure-13.2 select UTF-8 as the database character set and click Sample Schemas to create the case provided by Oracle
Figure-13.3 select the check box and click next
Figure-14 set the parameters based on your needs. click next.
Figure-16 whether to enable automatic backup in the production environment
Figure-17 set a password for the system management account.
Figure-18 select the group to which the DBA account belongs, the group to which the dba account belongs, and click next
Figure-19 because the swap space is too small, the check fails and the swap space is expanded. Add about 1 GB
[Root @ oracle_test ~] # Dd if =/dev/zero of = swapfile bs = 1 M count = 1024
1024 + 0 records in
1024 + 0 records out
1073741824 bytes (1.1 GB) copied, 12.8605 s, 83.5 MB/s
[Root @ oracle_test ~] # Mkswap swapfile
Setting up swapspace version 1, size = 1048572 KiB
No label, UUID = 796f3041-c278-4c72-b1b1-aa5d04fe2ad5
[Root @ oracle_test ~] # Swapon swapfile
Swapon:/root/swapfile: insecure permission0644,060 0 suggested.
[Root @ oracle_test ~] # Free-m
Total used free shared buff/cache available
Mem: 1826 325 68 8 1432 1284
Swap: 3071 0 3071
Re-check
Figure-19 the installer checks the environment. Because the 32bit packages of CentOS are i686, and oracle requires i386, the installation fails. ignore this. Click next
Figure-20 Click Finish to start Installation
Figure-21 is being installed.
Figure-21 install ing
Figure-22 retain, first execute the next step: Log On As root and execute the two sh files
11 ).If Chinese characters are garbled, refer to the following solutions.
(1) modify and display Chinese garbled characters and set the database character set to UTF8
Vim/etc/sysconfig/i18n
Check whether the content is LANG = "zh_CN.UTF-8"
(2) edit/home/oracle/. bash_profile and add the following in the last line:
NLS_LANG = "SIMPLIFIED CHINESE_CHINA.AL32UTF8 ";
Export NLS_LANG;
Run source/home/oracle/. bash_profile
12 ).Start the test and modify some system parameters.
[Oracle @ kdzfu-test ~] $ Sqlplus/as sysdba
SQL * Plus: Release 11.2.0.1.0 Production on Monday April 4 00:23:20 2016
Copyright (c) 1982,200 9, Oracle. All rights reserved.
Connect:
Oracle Database 11g Enterprise Edition Release 11.2.0.1.0-64bit Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options
SQL> shutdown immediate;
The database has been closed.
The database has been detached.
The ORACLE routine has been disabled.
SQL> startup mount;
The ORACLE routine has been started.
Total System Global Area 1603411968 bytes
Fixed Size 2213776 bytes
Variable Size 973080688 bytes
Database Buffers 620756992 bytes
Redo Buffers 7360512 bytes
The database has been loaded.
SQL> ALTER SYSTEM ENABLE RESTRICTED SESSION;
The system has been changed.
SQL> ALTER SYSTEM SET JOB_QUEUE_PROCESSES = 0;
The system has been changed.
SQL> ALTER DATABASE OPEN;
The database has been changed.
SQL> shutdown immediate;
The database has been closed.
The database has been detached.
The ORACLE routine has been disabled.
SQL> startup;
The ORACLE routine has been started.
Total System Global Area 1603411968 bytes
Fixed Size 2213776 bytes
Variable Size 973080688 bytes
Database Buffers 620756992 bytes
Redo Buffers 7360512 bytes
The database has been loaded.
The database has been opened.
SQL>
13 ).Modify the startup script dbstart and disable the script dbshut.
First modify vim/etc/oratab
Change N from the last line to Y
Then modify the content of $ ORACLE_HOME/bin/dbstart.
Modify ORACLE_HOME_LISTNER = $1:
ORACLE_HOME_LISTNER = $ ORACLE_HOME
Su-oracle
Dbstart # Start oracle
This is only the basic service for starting oracle databases and listening.
Services without three web pages are equivalent to the above two operations: sqlplus and lsnrtl start.
Dbshut stops oracle
Use the dbshut script to shut down the database and check whether the listening port is closed.
./Dbshut
[Oracle @ kdzfu-test bin] $./dbshut
Processing Database instance "orcl": log file/opt/oracle/11g/shutdown. log
[Oracle @ kdzfu-test bin] $ ss-tnlp
State Recv-Q Send-Q Local Address: Port Peer Address: Port
LISTEN 0 128: 22 :::*
LISTEN 0 128 *: 22 *:*
LISTEN 0 128 127.0.0.1: 631 *:*
LISTEN 0 128: 1: 631 :::*
LISTEN 0 128: 56535 :::*
LISTEN 0 100: 1: 25 :::*
LISTEN 0 100 127.0.0.1: 25 *:*
LISTEN 0 128 127.0.0.1: 6010 *:*
LISTEN 0 128: 1: 6010 :::*
LISTEN 0 128 127.0.0.1: 6011 *:*
LISTEN 0 128: 1: 6011 :::*
LISTEN 0 128 127.0.0.1: 6012 *:*
LISTEN 0 128: 1: 6012 :::*
LISTEN 0 128 127.0.0.1: 6013 *:*
LISTEN 0 128: 1: 6013 :::*
LISTEN 0 10 *: 3938 *: * users :( ("emagent", 22698,5 ))
LISTEN 0 30: 1158: * users :( ("java", 26990,19 ))
LISTEN 0 128 *: 35016 *:*
LISTEN 0 128: 111 :::*
LISTEN 0 128 *: 111 *:*
LISTEN 0 30: 5520: * users :( ("java", 26990,14 ))
Listener disabled
[Oracle @ kdzfu-test bin] $ lsnrctl status
LSNRCTL for Linux: Version 11.2.0.1.0-Production on-2016 00:49:00
Copyright (c) 1991,200 9, Oracle. All rights reserved.
Connecting to (DESCRIPTION = (ADDRESS = (PROTOCOL = IPC) (KEY = EXTPROC1521 )))
TNS-12541: TNS: no listeners
TNS-12560: TNS: protocol adapter error.
TNS-00511: no listeners
Linux Error: 2: No such file or directory
Connecting to (DESCRIPTION = (ADDRESS = (PROTOCOL = TCP) (HOST = kdzfu-test) (PORT = 1521 )))
TNS-12541: TNS: no listeners
TNS-12560: TNS: protocol adapter error.
TNS-00511: no listeners
Linux Error: 111: Connection refused
Use the dbstart script to open the database and check whether the listening port is enabled.
[Oracle @ kdzfu-test bin] $./dbstart
Processing Database instance "orcl": log file/opt/oracle/11g/startup. log
Listener Enabled
[Oracle @ kdzfu-test bin] $ lsnrctl status
LSNRCTL for Linux: Version 11.2.0.1.0-Production on-2016 00:51:32
Copyright (c) 1991,200 9, Oracle. All rights reserved.
Connecting to (DESCRIPTION = (ADDRESS = (PROTOCOL = IPC) (KEY = EXTPROC1521 )))
LISTENER STATUS
------------------------
Alias LISTENER
Version TNSLSNR for Linux: Version 11.2.0.1.0-Production
Start Date:-2016 00:51:20
Normal operation time 0 days 0 hours 0 minutes 11 seconds
Tracking level off
Security ON: Local OS Authentication
SNMP OFF
Listener parameter file/opt/oracle/11g/network/admin/listener. ora
Listener log file/opt/oracle/diag/tnslsnr/kdzfu-test/listener/alert/log. xml
Listener endpoint overview...
(DESCRIPTION = (ADDRESS = (PROTOCOL = ipc) (KEY = EXTPROC1521 )))
(DESCRIPTION = (ADDRESS = (PROTOCOL = tcp) (HOST = kdzfu-test) (PORT = 1521 )))
Service summary ..
The Service "orcl" contains one instance.
Instance "orcl", status READY, contains 1 handler of this service...
The Service "orclXDB" contains one instance.
Instance "orcl", status READY, contains 1 handler of this service...
Command executed successfully
[Oracle @ kdzfu-test 11g] $ ss-tnlp
State Recv-Q Send-Q Local Address: Port Peer Address: Port
LISTEN 0 128: 1521: * users :( ("tnslsnr", 2937 ))
LISTEN 0 128: 22 :::*
LISTEN 0 128 *: 22 *:*
LISTEN 0 128 127.0.0.1: 631 *:*
LISTEN 0 128: 1: 631 :::*
LISTEN 0 128: 56535 :::*
LISTEN 0 100: 1: 25 :::*
LISTEN 0 100 127.0.0.1: 25 *:*
LISTEN 0 128 127.0.0.1: 6010 *:*
LISTEN 0 128: 1: 6010 :::*
LISTEN 0 128 127.0.0.1: 6011 *:*
LISTEN 0 128: 1: 6011 :::*
LISTEN 0 128 127.0.0.1: 6012 *:*
LISTEN 0 128: 1: 6012 :::*
LISTEN 0 128 127.0.0.1: 6013 *:*
LISTEN 0 128: 1: 6013 :::*
LISTEN 0 10 *: 3938 *: * users :( ("emagent", 22698,5 ))
LISTEN 0 128: 31619: * users :( ("oracle", 29484,17 ))
LISTEN 0 30: 1158: * users :( ("java", 29182,18 ))
LISTEN 0 128 *: 35016 *:*
LISTEN 0 128: 111 :::*
LISTEN 0 128 *: 111 *:*
LISTEN 0 30: 5520: * users :( ("java", 29182,14 ))
14 ).To allow other computers to access the manager, open port 1158 to the firewall.
Note: If the host firewall is to be enabled, port 1521 must be enabled.
Run
Iptables-I INPUT-p tcp -- dport 1158-j ACCEPT
Iptables-I INPUT-p tcp -- dport 1521-j ACCEPT
/Etc/rc. d/init. d/iptables save
/Etc/rc. d/init. d/iptables restart
15 ).Modify/etc/oratab
Su-root
# Vim/etc/oratab
Find
# Replace $ ORACLE_HOME with the value of $ ORACLE_HOME, and $ SID with the value of $ SID.
$ SID: $ ORACLE_HOME: N
Change
$ SID: $ ORACLE_HOME: Y
Change the configuration file to the following:
Orcl:/opt/oracle/11g: Y
16 ).Edit startup close script
# Vim/etc/rc. d/init. d/oracle
#! /Bin/bash
# Chkconfig: 234 61 61
# Description: Oracle 11g AutoRun Service
#/Etc/rc. d/init. d/oracle
Case "$1" in
Start)
# Starts oracle listener and instance
Echo "Starting Oracle Database :"
Su-oracle-lc "lsnrctl start"
Su-oracle-lc dbstart
Su-oracle-lc "emctl start dbconsole"
;;
Stop)
# Shutdown oracle linstener and instance
Echo "Shuting down Oracle Database :"
Su-oracle-lc "lsnrctl stop"
Su-oracle-lc dbshut
Su-oracle-lc "emctl stop dbconsole"
;;
Reload | restart)
$0 stop
$0 start
;;
*)
Echo "Usage: {start | stop | reload | restart }"
Exit 1
Esac
Exit0
17). Grant the execution permission to the script and check whether the script can be correctly executed.
# Cd/etc/rc. d/init. d
Chmod + x oracle
#./Oracle stop
[Root @ kdzfu-test init. d] #./oracle stop
Shuting down Oracle Database:
LSNRCTL for Linux: Version 11.2.0.1.0-Production on-2016 01:37:02
Copyright (c) 1991,200 9, Oracle. All rights reserved.
Connecting to (DESCRIPTION = (ADDRESS = (PROTOCOL = IPC) (KEY = EXTPROC1521 )))
Command executed successfully
Processing Database instance "orcl": log file/opt/oracle/11g/shutdown. log
Oracle Enterprise Manager 11g Database Control Release 11.2.0.1.0
Copyright (c) 1996,200 9 Oracle Corporation. All rights reserved.
Https: // kdzfu-test: 1158/em/console/aboutApplication
Stopping Oracle Enterprise Manager 11g Database Control...
... Stopped.
./Oracle start
[Root @ kdzfu-test init. d] #./oracle start
Starting Oracle Database:
LSNRCTL for Linux: Version 11.2.0.1.0-Production on-2016 01:41:41
Copyright (c) 1991,200 9, Oracle. All rights reserved.
Start/opt/oracle/11g/bin/tnslsnr: Please wait...
TNSLSNR for Linux: Version 11.2.0.1.0-Production
The system parameter file is/opt/oracle/11g/network/admin/listener. ora.
Write/opt/oracle/diag/tnslsnr/kdzfu-test/listener/alert/log. xml log information
Listener: (DESCRIPTION = (ADDRESS = (PROTOCOL = ipc) (KEY = EXTPROC1521 )))
Listener: (DESCRIPTION = (ADDRESS = (PROTOCOL = tcp) (HOST = kdzfu-test) (PORT = 1521 )))
Connecting to (DESCRIPTION = (ADDRESS = (PROTOCOL = IPC) (KEY = EXTPROC1521 )))
LISTENER STATUS
------------------------
Alias LISTENER
Version TNSLSNR for Linux: Version 11.2.0.1.0-Production
Start Date:-2016 01:41:41
Normal operation time 0 days 0 hours 0 minutes 0 seconds
Tracking level off
Security ON: Local OS Authentication
SNMP OFF
Listener parameter file/opt/oracle/11g/network/admin/listener. ora
Listener log file/opt/oracle/diag/tnslsnr/kdzfu-test/listener/alert/log. xml
Listener endpoint overview...
(DESCRIPTION = (ADDRESS = (PROTOCOL = ipc) (KEY = EXTPROC1521 )))
(DESCRIPTION = (ADDRESS = (PROTOCOL = tcp) (HOST = kdzfu-test) (PORT = 1521 )))
The Listener does not support services.
Command executed successfully
Processing Database instance "orcl": log file/opt/oracle/11g/startup. log
Oracle Enterprise Manager 11g Database Control Release 11.2.0.1.0
Copyright (c) 1996,200 9 Oracle Corporation. All rights reserved.
Https: // kdzfu-test: 1158/em/console/aboutApplication
Starting Oracle Enterprise Manager 11g Database Control.
------------------------------------------------------------------
Logs are generated in directory/opt/oracle/11g/kdzfu-test_orcl/sysman/log
18 ).Run the following command: # Add boot and soft link
# Chmod 750/etc/rc. d/init. d/oracle
# Ln-s/etc/rc. d/init. d/oracle/etc/rc2.d/S61oracle
# Ln-s/etc/rc. d/init. d/oracle/etc/rc3.d/S61oracle
# Ln-s/etc/rc. d/init. d/oracle/etc/rc4.d/S61oracle
# Ln-s/etc/rc. d/init. d/oracle/etc/rc5.d/S61oracle
# Ln-s/etc/rc. d/init. d/oracle/etc/rc0.d/K61oracle
# Ln-s/etc/rc. d/init. d/oracle/etc/rc6.d/K61oracle
# Chkconfig -- add oracle
# Chkconfig -- level 234 oracle on
Note: When chkconfig is executed, you must add at least two lines of comments to the script (in step 1). The first line tells chkconfig the running level of the service, the second line adds a brief description of the service.
19) restart the linux operating system and check whether oracle is automatically started.