1. Download Oracle12C
Download address: http://download.oracle.com/otn/linux/oracle12c/122010/linuxx64_12201_database.zip
(I also saved it on Baidu Cloud ^-^)
Two, configure hosts
Add hosts 127.0.0.1 test01 10.177.11.222 test01
3. Configure the prerequisites for oracle installation
1. Modify kernel parameters
Edit the sysctl.conf file
# vi /etc/sysctl.conf Write the following: fs.file-max = 6815744 kernel.sem = 250 32000 100 128 kernel.shmmni = 4096 kernel.shmall = 1073741824 kernel.shmmax = 4398046511104 kernel.panic_on_oops = 1 net.core.rmem_default=262144 net.core.rmem_max = 4194304 net.core.wmem_default=262144 net.core.wmem_max = 1048576 net.ipv4.conf.all.rp_filter = 2 net.ipv4.conf.default.rp_filter = 2 fs.aio-max-nr = 1048576 net.ipv4.ip_local_port_range = 9000 65500 Make the configuration take effect # sysctl -p
2. Limit oracle user resource usage
edit /etc/security/limits.conf
Write the following at the end:
oracle soft nofile 1024 oracle hard nofile 65536 oracle soft nproc 16384 oracle hard nproc 16384 oracle soft stack 10240 oracle hard stack 32768 oracle hard memlock 30000000 oracle soft memlock 30000000
3. Install dependent packages
yum install -y binutils compat-libcap1 compat-libstdc + + -33 compat-libstdc + + -33.i686 glibc glibc.i686 glibc-devel glibc-devel.i686 ksh libaio libaio.i686 libaio-devel libaio-devel .i686 libX11 libX11.i686 libXau libXau.i686 libXi libXi.i686 libXtst libXtst.i686 libgcc libgcc.i686 libstdc + + libstdc + + .i686 libstdc + + -devel libstdc + + -devel.i686 nilb-i686 libxcf 6xcake net-tools smartmontools sysstat unixODBC unixODBC-devel
4. Create groups and users
Create and install oracle group: # groupadd -g 54321 oinstall
Create a management database group: # groupadd -g 54322 dba
Create oper group: # groupadd -g 54323 oper
Add the oracle user to the group: # useradd -u 54321 -g oinstall -G dba,oper oracle
5. Set a password for the oracle user
[root@test01 ~]# passwd oracle Changing password for user oracle. New password: BAD PASSWORD: The password is shorter than 8 characters Retype new password: passwd: all authentication tokens updated successfully.
6. Close selinux and firewall
Close selinux # setenforce 0# sed -i 's/SELINUX=enforcing/SELINUX=disabled/g' /etc/selinux/config turn off firewall # systemctl stop firewalld# systemctl disable firewalld
7. Create the oracle installation directory
# mkdir -p /u01/app # chown -R oracle:oinstall /u01 # chmod -R 775 /u01
8. Configure Oracle environment variables and verify
Switch to oracle user
su - oracle
Edit .bash_profile to configure environment variables
vim.bash_profile ORACLE_BASE=/u01/app ORACLE_HOME=$ORACLE_BASE/oracle12c ORACLE_SID=TEST01 export ORACLE_BASE ORACLE_HOME ORACLE_SID PATH=$ORACLE_HOME/bin:$PATH
Make the configuration take effect immediately
$ source .bash_profile
Verify that it is in effect
[oracle@test01 ~]$ echo $ORACLE_HOME/u01/app/oracle12c
Fourth, the installation of Oracle
1. Upload the database installation package and decompress it
-
The following can be executed using the oracle user
[root@test01 u01]# pwd /u01/app [root@test01 app]# ll total 3372752 drwxrwxr-x 2 oracle oinstall 6 Feb 28 22:58 app -rw-r--r--. 1 oracle oinstall 3453696911 Feb 22 23:07 linuxx64_12201_database.zip
linuxx64_12201_database.zip will be decompressed to /u01/app
$ unzip linuxx64_12201_database.zip
2. Modify the installation response file configuration
See https://oracle-base.com/articles/misc/oui-silent-installations for settings
vim /u01/app/database/response/db_install.rsp
Modify the following content that needs to be changed:
oracle.install.option=INSTALL_DB_SWONLY UNIX_GROUP_NAME=oinstall INVENTORY_LOCATION=/u01/app/oraInventory ORACLE_HOME=/u01/app/oracle12c ORACLE_BASE=/u01/app oracle.install.db.InstallEdition=EE oracle.install.db.OSDBA_GROUP=dba oracle.install.db.OSOPER_GROUP=dba oracle.install.db.OSBACKUPDBA_GROUP=dba oracle.install.db.OSDGDBA_GROUP=dba oracle.install.db.OSKMDBA_GROUP=dba oracle.install.db.OSRACDBA_GROUP=dba
Example:
3. Corresponding file installation
(There is also a silent installation, much the same)
Switch directory to /u01/app/database
cd /u01/app/database
start installation
./runInstaller -ignoreSysPrereqs -ignorePrereq -waitforcompletion -showProgress -silent -responseFile /u01/app/database/response/db_install.rsp
The execution results are as follows:
[oracle@test01 database]$ ./runInstaller -ignoreSysPrereqs -ignorePrereq -waitforcompletion -showProgress -silent -responseFile /u01/app/database/response/db_install.rsp Starting Oracle Universal Installer... Checking Temp space: must be greater than 500 MB. Actual 190805 MB Passed Checking swap space: must be greater than 150 MB. Actual 4095 MB Passed Preparing to launch Oracle Universal Installer from /tmp/OraInstall2022-03-02_10-25-42PM. Please wait ...[WARNING] [INS-32055] The Central Inventory is located in the Oracle base. ACTION: Oracle recommends placing this Central Inventory in a location outside the Oracle base directory. You can find the log of this install session at: /u01/app/oraInventory/logs/installActions2022-03-02_10-25-42PM.log Prepare in progress. ................................................... 8% Done. Prepare successful. Copy files in progress. ................................................... 17% Done. ................................................... 22% Done. ................................................... 27% Done. ................................................... 32% Done. ................................................... 40% Done. ................................................... 45% Done. ................................................... 50% Done. ................................................... 55% Done. ................................................... 60% Done. ................................................... 65% Done. ................................................... 70% Done. ................................................... 75% Done. ................................................... 80% Done. ................................... Copy files successfully. Link binaries in progress. ......... Link binaries successful. Setup files in progress. ................................... Setup files successful. Setup Inventory in progress. Setup Inventory successful. Finish Setup successful. The installation of Oracle Database 12c was successful. Please check '/u01/app/oraInventory/logs/silentInstall2022-03-02_10-25-42PM.log' for more details. Setup Oracle Base in progress. Setup Oracle Base successful. ................................................... 95% Done. As a root user, execute the following script(s): 1. /u01/app/oraInventory/orainstRoot.sh 2. /u01/app/oracle12c/root.sh ................................................... 100% Done. Successfully Setup Software.
After the installation is complete, switch to the root user to execute the following script
As a root user, execute the following script(s):
1. /u01/app/oraInventory/orainstRoot.sh
2. /u01/app/oracle12c/root.sh
su - root [root@test01 ~]# /u01/app/oraInventory/orainstRoot.sh Changing permissions of /u01/app/oraInventory. Adding read, write permissions for group. Removing read, write, execute permissions for the world. Changing groupname of /u01/app/oraInventory to oinstall. The execution of the script is complete. [root@test01 ~]# /u01/app/oracle12c/root.sh Check /u01/app/oracle12c/install/root_fce-slt-warranty_2022-03-02_22-36-48-507025673.log for the output of root script
Check whether the installation is successful, switch to the oracle user and run sqlplus / as sysdba
[oracle@test01 ~]$ sqlplus / as sysdba SQL*Plus: Release 12.2.0.1.0 Production on Wed Mar 2 22:38:38 2022 Copyright (c) 1982, 2016, Oracle. All rights reserved. Connected to an idle instance. SQL>
At this point, the database software is installed successfully.
5. Database creation
See https://oracle-base.com/articles/misc/database-configuration-assistant-dbca-silent-mode, use the database configuration assistant DBCA to create a database in silent mode, see https://docs.oracle.com for specific settings /database/121/ADMIN/create.htm#ADMIN14032
Execute the command to create the database:
(dbname SID character set password must be customized)
(The path must be written correctly)
dbca -silent -createDatabase \ -templateName /u01/app/oracle12c/assistants/dbca/templates/General_Purpose.dbc\ -gdbname TEST -sid TEST01 \ -responseFile /u01/app/database/response/dbca.rsp \ -characterSet AL32UTF8 \ -sysPassword Test@123 \ -systemPassword Test@123 \ -createAsContainerDatabase false
Note: The password setting requires a password length of at least 8 characters, including at least 1 uppercase character, 1 lowercase character and 1 number [0-9]. Otherwise there will be a warning as follows.
[WARNING] [DBT-06208] The 'SYS' password entered does not conform to the Oracle recommended standards. CAUSE: a. Oracle recommends that the password entered should be at least 8 characters in length, contain at least 1 uppercase character, 1 lower case character and 1 digit [0-9]. b. The password entered is a keyword that Oracle does not recommend to be used as password ACTION: Specify a strong password. If required refer Oracle documentation for guidelines. [WARNING] [DBT-06208] The 'SYSTEM' password entered does not conform to the Oracle recommended standards. CAUSE: a. Oracle recommends that the password entered should be at least 8 characters in length, contain at least 1 uppercase character, 1 lower case character and 1 digit [0-9]. b. The password entered is a keyword that Oracle does not recommend to be used as password ACTION: Specify a strong password. If required refer Oracle documentation for guidelines. Copying database files
Create library execution result:
Copying database files 1% complete 2% complete 18% complete 33% complete Creating and starting Oracle instance 35% complete 40% complete 44% complete 49% complete 50% complete 53% complete 55% complete Completing Database Creation 56% complete 57% complete 58% complete 62% complete 65% complete 66% complete Executing Post Configuration Actions 100% complete Look at the log file "/u01/app/cfgtoollogs/dbca/WARRANTY/WARRANTY.log" for further details.
Confirm that the database is created:
Enter the database:
$ sqlplus / as sysdba
Check if the database status is OPEN
SQL> select status from v$instance; STATUS ------------ OPEN
The above state database is created.
Six, database configuration monitoring
The results of executing lsnrctl status before the monitoring is configured are as follows:
[oracle@fce-slt-warranty ~]$ lsnrctl status LSNRCTL for Linux: Version 12.2.0.1.0 - Production on 02-MAR-2022 23:10:07 Copyright (c) 1991, 2016, Oracle. All rights reserved. Connecting to (ADDRESS=(PROTOCOL=tcp)(HOST=)(PORT=1521)) TNS-12541: TNS: no listener TNS-12560: TNS: protocol adapter error TNS-00511: No listener Linux Error: 111: Connection refused
Use the default netca.rsp file to execute the command netca -silent -responseFile /u01/app/database/response/netca.rsp
[oracle@test01 ~]$ netca -silent -responseFile /u01/app/database/response/netca.rsp Parsing command line arguments: Parameter "silent" = true Parameter "responsefile" = /u01/app/database/response/netca.rsp Done parsing command line arguments. Oracle Net Services Configuration: Profile configuration complete. Oracle Net Listener Startup: Running Listener Control: /u01/app/oracle12c/bin/lsnrctl start LISTENER Listener Control complete. Listener started successfully. Listener configuration complete. Oracle Net Services configuration successful. The exit code is 0
Check the monitoring again with lsnrctl status and you can see that the monitoring has been successfully started
[oracle@test01 ~]$ lsnrctl status LSNRCTL for Linux: Version 12.2.0.1.0 - Production on 02-MAR-2022 23:10:54 Copyright (c) 1991, 2016, Oracle. All rights reserved. Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=localhost)(PORT=1521))) STATUS of the LISTENER ------------------------ Alias LISTENER Version TNSLSNR for Linux: Version 12.2.0.1.0 - Production Start Date 02-MAR-2022 23:10:53 Uptime 0 days 0 hr. 0 min. 1 sec Trace Level off Security ON: Local OS Authentication SNMP OFF Listener Parameter File /u01/app/oracle12c/network/admin/listener.ora Listener Log File /u01/app/diag/tnslsnr/fce-slt-warranty/listener/alert/log.xml Listening Endpoints Summary... (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=fce-slt-warranty)(PORT=1521))) (DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=EXTPROC1521))) The listener supports no services The command completed successfully
View port also has 1521 port listening
[oracle@test01 ~]$ ss -ntlp State Recv-Q Send-Q Local Address: Port Peer Address: Port LISTEN 0 128 *:111 *:* LISTEN 0 128 *:22 *:* LISTEN 0 100 127.0.0.1:25 *:* LISTEN 0 100 :::8009 :::* LISTEN 0 128 :::111 :::* LISTEN 0 100 :::8080 :::* LISTEN 0 128 :::1521 :::* users:(("tnslsnr",pid=31448,fd=8)) LISTEN 0 128 :::22 :::* LISTEN 0 100 ::1:25 :::* LISTEN 0 128 :::12571 :::* users:(("ora_d000_warrnt",pid=8719,fd=8)) LISTEN 0 1 ::ffff:127.0.0.1:8005 :::*
Seven, configure the oracle database to start automatically
1. Switch to the root user and perform the following operations:
vim /etc/oratab N to Y WARRANTY:/u01/app/oracle12c:N changed to WARRANTY:/u01/app/oracle12c:Y
2. Switch to the oracle user
switch directory
$ cd $ORACLE_HOME/binx
Modify the file vim dbstart
around line 80
ORACLE_HOME_LISTNER=$1 changed to ORACLE_HOME_LISTNER=$ORACLE_HOME
Modify vim dbshut
around line 50
ORACLE_HOME_LISTNER=$1 changed to ORACLE_HOME_LISTNER=$ORACLE_HOME
3. Test run dbshut, dbstart to see if the oracle service and listener service can be started
Test stops:
[oracle@test01 bin]$ ./dbshut Processing Database instance "TEST01": log file /u01/app/oracle12c/shutdown.log [oracle@fce-slt-warranty bin]$ ss -ntlp State Recv-Q Send-Q Local Address: Port Peer Address: Port LISTEN 0 128 *:111 *:* LISTEN 0 128 *:22 *:* LISTEN 0 100 127.0.0.1:25 *:* LISTEN 0 100 :::8009 :::* LISTEN 0 128 :::111 :::* LISTEN 0 100 :::8080 :::* LISTEN 0 128 :::22 :::* LISTEN 0 100 ::1:25 :::* LISTEN 0 1 ::ffff:127.0.0.1:8005 :::*
Test start:
[oracle@test01 bin]$ ./dbstart Processing Database instance "TEST01": log file /u01/app/oracle12c/startup.log [oracle@fce-slt-warranty bin]$ ss -ntlp State Recv-Q Send-Q Local Address: Port Peer Address: Port LISTEN 0 128 *:111 *:* LISTEN 0 128 *:22 *:* LISTEN 0 100 127.0.0.1:25 *:* LISTEN 0 100 :::8009 :::* LISTEN 0 128 :::111 :::* LISTEN 0 100 :::8080 :::* LISTEN 0 128 :::1521 :::* users:(("tnslsnr",pid=15933,fd=8)) LISTEN 0 128 :::22 :::* LISTEN 0 100 ::1:25 :::* LISTEN 0 128 :::14621 :::* users:(("ora_d000_warran",pid=16140,fd=8)) LISTEN 0 1 ::ffff:127.0.0.1:8005 ::
The database and monitoring can be started, and the test can be connected.
4. Configure system startup items
switch to root user
Add executable permissions for self-starting files
# chmod +x /etc/rc.d/rc.local
Edit the end of the file to write the following:
su - oracle -lc dbstart
Test whether it can start automatically
*Remark:
Command execution: start: su - oracle -lc dbstart Stop: su - oracle -lc dbshut
8. Create table space and business user authorization
Create a tablespace file of unlimited size:
create bigfile tablespace "tablespace name such as: ALESDEV" datafile '/data/app/oradata/ALESDEV/datafile/ALESDEV.dbf' size 128m AUTOEXTEND ON NEXT 256M MAXSIZE UNLIMITED;
‘/data/app/oradata/ALESDEV/datafile/ALESDEV.dbf’ This is the path where the tablespace is stored.
bigfile stands for big file type tablespace.
Create a database business user:
CREATE USER "username" IDENTIFIED BY "password" DEFAULT TABLESPACE "The name of the tablespace created above" TEMPORARY TABLESPACE TEMP PROFILE DEFAULT ACCOUNT UNLOCK;
For example:
CREATE USER ALESDEV IDENTIFIED BY TEST@01 DEFAULT TABLESPACE ALESDEV TEMPORARY TABLESPACE TEMP PROFILE DEFAULT ACCOUNT UNLOCK;
Authorize the created user to the database:
GRANT CONNECT TO ALESDEV; GRANT DBA TO ALESDEV; GRANT RESOURCE TO ALESDEV;
The above authorization statement is to authorize the ALESDEV user as a DBA authority user.
Send the user and password to business development, and then you can connect to the database.