In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-02-24 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >
Share
Shulou(Shulou.com)06/01 Report--
Install Oracle from the Linux command
Before the use of scripts to install directly, so it is easy to have problems do not know how to arrange errors, so try to install step by step manually under linux, some internal principles are not very clear, to be slowly improved, it is best to install a few more graphical installations, understand the principle.
1. The environment to be installed:
1. Hardware: centos 6.5
Oracle database 11g
/ db partition is greater than 10G
/ free memory is more than 2G
Two packages installed for 2.Oracle:
Linux.x64_11gR2_database_2of2.zip
Linux.x64_11gR2_database_1of2.zip
Download address: wget http://v.yingsun.net/cobra/download/linux.x64_11gR2_database_2of2.zip
-http-user=$usr-http-password=$code
Wget http://v.yingsun.net/cobra/download/linux.x64_11gR2_database_1of2.zip
-http-user=$usr-http-password=$code
Note: a download address is provided here, which is the download address of our company's software, or you can go to the oracle website.
64-bit 11g version.
3. The installation of oracle must depend on the package (must be checked, otherwise an error will be reported after installation):
Check whether all dependent packages are installed
Rpm-Q binutils compat-libstdc++-33 elfutils-libelf elfutils-libelf-devel gcc gcc-c++ glibc glibc-common glibc-devel glibc-headers libaio libaio-devel libgcc ksh libstdc++-devel libstdc++ make numactl-devel sysstat compat-gcc-34 compat-gcc-34-c++ gcc libXp openmotif compat-db glibc.i686
Use rpm to check if "not" is not installed, and use yum-y install to install it. After installation, it is best.
Use rpm to check again.
4. Fill in the hosts file and the host name, because oracle will bind according to hosts. If you do not fill in the file, an error will be reported.
Unable to create parameters and instances, as follows:
5. Close iptables and selinux
Second, enter the installation
1. For users to establish oracle, Oracle needs to have its own user actions:
Groupadd oinstall
Groupadd dba
Useradd-d / home/oracle-g oinstall-G dba-m oracle
two。 Set up the database directory db, if the business uses, need enough space, the best separate partition.
Mkdir-p / db/oracle11g/product/11.2.0/db
Chmod-R 775 / db
Chown-R oracle:oinstall / db
3. Modify kernel parameters to support oracle
1) in the / etc/sysctl.conf file, use vim to edit, save trouble and add it directly to the end
The parameters are as follows:
Kernel.shmall = 2097152
Kernel.shmmax = 2147483648
Kernel.shmmni = 4096
Kernel.sem = 250 32000 100 128
Fs.file-max = 65536
Net.ipv4.ip_local_port_range = 1024 65000
Net.core.rmem_default=262144
Net.core.rmem_max=262144
Net.core.wmem_default=262144
Net.core.wmem_max=262144
As follows:
The changed kernel takes effect:
/ sbin/sysctl-p
2) modify the user's restrictions:
Modify the / etc/security/limits.conf file and add it directly at the end:
Oracle soft nproc 2047
Oracle hard nproc 16384
Oracle soft nofile 1024
Oracle hard nofile 65536
Then modify it in the / etc/pam.d/login file and add it directly at the end:
Session required / lib64/security/pam_limits.so
Session required pam_limits.so
Finally, in the / etc/profile file, add the following to make the above restrictions on users effective (the following initials are small
Write, automatically adjusted to lowercase due to text formatting problems.
If [$USER = "oracle"]; then
If [$SHELL = "/ bin/ksh"]; then
Ulimit-p 16384
Ulimit-n 65536
Else
Ulimit-u 16384-n 65536
Fi
Fi
Make it effective.
Source / etc/profile
4. Set the environment variable of the oracle user. Be careful here. If you don't pay attention, you will have no permission.
Install. As follows:
Vi / home/oracle/.bash_profile
Export ORACLE_BASE=/db/oracle11g # this is the directory where the database is declared
Export ORACLE_HOME=$ORACLE_BASE/product/11.2.0/db # this is the home of the database
Catalogue
Export ORACLE_SID= "benguo" # this refers to the name of the instance where oracle is installed, depending on your business
Write the name or the company, if you need to put the instance at once
On the installation, you can add sid here, otherwise you will
Also write, if you forget to write, you may make mistakes.
Export PATH=$PATH:$HOME/bin:$ORACLE_HOME/bin # this is in the environment, oracle home directory
Otherwise, before installing the database
You can't find sqlplus when you do.
Caused the installation to be unsuccessful.
Export LD_LIBRARY_PATH=$ORACLE_HOME/lib:/usr/lib # this refers to the library of oracle, also
It needs to be specified, otherwise the dependent library cannot be found.
Export NLS_LANG=AMERICAN_AMERICA.ZHS16GBK # character set
Export
Note: after adding the environment variable of oracle, you need to take effect. The command is as follows:
Source / home/oracle/.bash_profile
The experiment is shown in the following figure:
5. Extract the installation package for oracle as follows:
Unzip linux.x64_11gR2_database_1of2.zip
Unzip linux.x64_11gR2_database_2of2.zip
Reminder: here I will explain the installation path of my software package, because this unzipped installation package is at the back.
It also needs to be used, so special attention needs to be paid to the issue of permissions. My environment is as follows:
I created a soft directory under / db, gave oracle users all recursive permissions, put the two installed packages under soft, and pressurized them to get the database directory.
Mkdir-p / db/soft
Chown-R Oracle:oinstall / db/soft
Chmod-R 755 / db/soft
6. Silently install the database software:
1) silently install the files that need the corresponding file template. Under the directory of the database of the unzipped installation package, there is a db_install.rsp under the response response directory. Modify the steps as follows:
Su-oracle
Vim / db/soft/database/response/db_install.rsp modifies the module that responds to the installation of the database as follows:
[root@server161 response] # egrep-v "# | ^ $" db_install.rsp
Oracle.install.responseFileVersion=/oracle/install/rspfmt_dbinstall_response_schema_v11_2_0
Oracle.install.option=INSTALL_DB_SWONLY # Type of installation database
ORACLE_HOSTNAME=localhost.localdomain # Host name (hostname) query
UNIX_GROUP_NAME=oinstall # installation group
INVENTORY_LOCATION=/db/oraInventory # can be the default value, inventory directory
SELECTED_LANGUAGES=en # choose the language to install
ORACLE_HOME=/db/oracle11g/product/11.2.0/db # oracle's home directory, the oracle environment you set up
Write as much as you can.
ORACLE_BASE=/db/oracle11g # Oracle installation directory
Oracle.install.db.InstallEdition=EE
Oracle.install.db.isCustomInstall=false
Oracle.install.db.customComponents=
Oracle.install.db.DBA_GROUP=dba # dba user Group
Oracle.install.db.OPER_GROUP=oinstall # oper user Group
Oracle.install.db.CLUSTER_NODES=
Oracle.install.db.config.starterdb.type=GENERAL_PURPOSE
Oracle.install.db.config.starterdb.globalDBName=
Oracle.install.db.config.starterdb.SID=
Oracle.install.db.config.starterdb.characterSet=
Oracle.install.db.config.starterdb.memoryLimit=
Oracle.install.db.config.starterdb.memoryOption=false
Oracle.install.db.config.starterdb.installExampleSchemas=false
Oracle.install.db.config.starterdb.enableSecuritySettings=true
Oracle.install.db.config.starterdb.password.ALL=
Oracle.install.db.config.starterdb.password.SYS=
Oracle.install.db.config.starterdb.password.SYSTEM=
Oracle.install.db.config.starterdb.password.SYSMAN=
Oracle.install.db.config.starterdb.password.DBSNMP=
Oracle.install.db.config.starterdb.control=DB_CONTROL
Oracle.install.db.config.starterdb.gridcontrol.gridControlServiceURL=
Oracle.install.db.config.starterdb.dbcontrol.enableEmailNotification=false
Oracle.install.db.config.starterdb.dbcontrol.emailAddress=
Oracle.install.db.config.starterdb.dbcontrol.SMTPServer=
Oracle.install.db.config.starterdb.automatedBackup.enable=false
Oracle.install.db.config.starterdb.automatedBackup.osuid=
Oracle.install.db.config.starterdb.automatedBackup.ospwd=
Oracle.install.db.config.starterdb.storageType=
Oracle.install.db.config.starterdb.fileSystemStorage.dataLocation=
Oracle.install.db.config.starterdb.fileSystemStorage.recoveryLocation=
Oracle.install.db.config.asm.diskGroup=
Oracle.install.db.config.asm.ASMSNMPPassword=
MYORACLESUPPORT_USERNAME=
MYORACLESUPPORT_PASSWORD=
SECURITY_UPDATES_VIA_MYORACLESUPPORT=false # wrote false manually
DECLINE_SECURITY_UPDATES=true # set security updates (there seems to be a bug, this must be
Choose true, otherwise there will be an unlimited reminder that there is a problem with the email address
Terminate the installation,)
PROXY_HOST=
PROXY_PORT=
What is not written above can be left empty.
Start silent installation
Cd / db/soft/database
. / runInstaller-ignorePrereq-silent-responseFile / db/soft/database/response/db_install.rsp-force
During the installation, there are some info waring information, do not need to pay attention to the error information, the following information is installed. As follows:
Note: if no installation is terminated, view the solution according to the log of the silent installation.
Note: after installing the database library, you need to test whether you can enter the database. If sqlplus / as sysdba prompts that the sqlplus command cannot be found, you can check $PATH under the oracle user command to see if there is a path. If not, you need to check whether the environment changes ORACLE_HOME variables of the following oracle users have been added to the PATH, as follows:
Export PATH=$PATH:$HOME/bin:$ORACLE_HOME/bin
2) after installing the database, you need to change the following configuration. Here, you only need to use the root user to execute the script that comes with it, such as the following two scripts:
/ db/oraInventory/orainstRoot.sh
The above script automatically configures the system installation configuration file / etc/oralnst.loc and gives permissions. Note that if you configure this file before installing the data, this script and the default script that comes with it will not be generated when you install the database. The specific configuration is as follows:
Vim / etc/oraInst.loc
Nventory_loc=/db/oraInventory # this path refers to the path where the database puts the inventory.
Inst_group=oinstall # this is the installation group
Note that view permission is required here.
Chown oracle:oiinstall / etc/oraInst.loc
Chmod 644 / etc/oraInst.loc
Sh / db/oracle11g/product/11.2.0/db/root.sh (executed using root)
This script is specifically about changing some parameter settings, which you can open and see for yourself.
7. Silently configure network monitoring
$ORACLE_HOME/bin/netca / silent / responseFile / db/soft/database/response/netca.rsp
Note: this template can be used by default, and the listening file for oracle will be configured and added after the instance is installed.
After this installation, some listening files will appear under / db/oracle11g/product/11.2.0/db/network/admin/, as follows:
[root@server161 ~] # ll / db/oracle11g/product/11.2.0/db/network/admin/
Total dosage 16
-rw-r--r--. 1 oracle oinstall 536 April 7 15:46 listener.ora
Drwxr-xr-x. 2 oracle oinstall 4096 April 7 11:03 samples
-rw-r--r--. 1 oracle oinstall 187 May 7 2007 shrept.lst
-rw-r--r--. 1 oracle oinstall 213 April 7 15:37 sqlnet.ora
8. Silently install the database instance (installed by oracle users)
Here, you need to configure the template file for silently installing the database response, and decompress the dbca_rsp file in the response directory under database in the installation package as follows:
[root@spider101 ~] # egrep-v "# | ^ $" / vol/ora11g/dbca_benguo.rsp
[GENERAL]
RESPONSEFILE_VERSION = "11.2.0"
OPERATION_TYPE = "createDatabase"
[CREATEDATABASE]
GDBNAME = "benguo" # name of the global database
SID = "benguo" # Database instance, according to the above you wrote the same SID, feel free to write.
TEMPLATENAME = "benguo.dbc" # this can be the default template, will not write the default, preferably default
It was written by our dba, so we used it.
SYSPASSWORD = "2011@oracle"
SYSTEMPASSWORD = "2011@oracle"
SYSMANPASSWORD = "2011@oracle"
DBSNMPPASSWORD = "2011@oracle" # the first four can be ignored, and the default is fine
CHARACTERSET = "ZHS16GBK" # Encoding
NATIONALCHARACTERSET= "UTF8" # coding
[createTemplateFromDB]
SOURCEDB = "myhost:1521:orcl"
SYSDBAUSERNAME = "system"
TEMPLATENAME = "My Copy TEMPLATE"
[createCloneTemplate]
SOURCEDB = "orcl"
TEMPLATENAME = "My Clone TEMPLATE"
[DELETEDATABASE]
SOURCEDB = "orcl"
[generateScripts]
TEMPLATENAME = "New Database"
GDBNAME = "orcl11.us.oracle.com"
[CONFIGUREDATABASE]
[ADDINSTANCE]
DB_UNIQUE_NAME = "orcl11g.us.oracle.com"
NODELIST=
SYSDBAUSERNAME = "sys"
[DELETEINSTANCE]
DB_UNIQUE_NAME = "orcl11g.us.oracle.com"
INSTANCENAME = "orcl11g"
SYSDBAUSERNAME = "sys"
After configuring the template, silently install the database
$ORACLE_HOME/bin/dbca-silent-responseFile / db/soft/database/response/dbca.rsp
Wait until 100% of the installation is complete.
9. After installing the instance of the database, configure the database instance to start and listen for files.
1) modify the listening file and add the following command:
SID_LIST_LISTENER =
(SID_LIST =
(SID_DESC =
(GLOBAL_DBNAME = benguo)
(ORACLE_HOME = / db/oracle11g/product/11.2.0/db)
(SID_NAME = benguo)
)
)
The experiment is shown in the following figure:
2) modify the instance startup configuration file, as shown in the following figure, just change "N" to "Y". This allows you to start the instance, the listener, through dbstart.
Su-oracle
10 . Even if the installation is successful at this step, you can run netstat to check whether the oracle listener has been started. By default, the instance is started after installation.
Or enter the database to check the status of the database:
Su-oracle
Sqlplus / as sysdba
Select status from v$instance
If the status of open starts normally, as shown in the figure:
Here your database is installed normally and can be run normally.
Third, the use of some functions of the database.
1. Set the database to start automatically, under / etc/rc.d/init.d/oracle
#! / bin/bash
#
# oracle Starts Oracle Database Server
#
#
# chkconfig: 345 80 20
# description: Oracle Database Server
# BEGIN INIT INFO
# Provides: $oracle
# END INIT INFO
Case "$1" in
Start)
Echo-n "Starting Oracle Databases:"
Echo "- -" > > / var/log/oracle
Date + "!% T% a% D: Starting Oracle Databases as part of system up." > > / var/log/oracle
Echo "- -" > > / var/log/oracle
Su-oracle-c dbstart > > / var/log/oracle
Echo "Done."
Echo-n "Starting Oracle Listeners:"
Su-oracle-c "lsnrctl start" > > / var/log/oracle
Echo "Done."
Echo ""
Echo "- -" > > / var/log/oracle
Date + "!% T% a% D: Finished." > > / var/log/oracle
Echo "- -" > > / var/log/oracle
Touch / var/lock/subsys/oracle
Stop)
Echo-n "Shutting Down Oracle Listeners:"
Echo "- -" > > / var/log/oracle
Date + "!% T% a% D: Shutting Down Oracle Databases as part of system down." > > / var/log/oracle
Echo "- -" > > / var/log/oracle
Su-oracle-c "lsnrctl stop" > > / var/log/oracle
Echo "Done."
Rm-f / var/lock/subsys/oracle
Echo-n "Shutting Down Oracle Databases:"
Su-oracle-c dbshut > > / var/log/oracle
Echo "Done."
Echo ""
Echo "- -" > > / var/log/oracle
Date + "!% T% a% D: Finished." > > / var/log/oracle
Echo "- -" > > / var/log/oracle
Restart)
Echo-n "Restarting Oracle Databases:"
Echo "- -" > > / var/log/oracle
Date + "!% T% a% D: Restarting Oracle Databases as part of system up." > > / var/log/oracle
Echo "- -" > > / var/log/oracle
Su-oracle-c dbshut > > / var/log/oracle
Su-oracle-c dbstart > > / var/log/oracle
Echo "Done."
Echo-n "Restarting Oracle Listeners:"
Su-oracle-c "lsnrctl stop" > > / var/log/oracle
Su-oracle-c "lsnrctl start" > > / var/log/oracle
Echo "Done."
Echo ""
Echo "- -" > > / var/log/oracle
Date + "!% T% a% D: Finished." > > / var/log/oracle
Echo "- -" > > / var/log/oracle
Touch / var/lock/subsys/oracle
*)
Echo "Usage: oracle {start | stop | restart}"
Exit 1
Esac
Chmod 755 / etc/rc.d/init.d/oracle
Ln-s / etc/rc.d/init.d/oracle / etc/rc.d/rc2.d/S99oracle
Ln-s / etc/rc.d/init.d/oracle / etc/rc.d/rc3.d/S99oracle
Ln-s / etc/rc.d/init.d/oracle / etc/rc.d/rc5.d/S99oracle
Ln-s / etc/rc.d/init.d/oracle / etc/rc.d/rc0.d/K01oracle
Ln-s / etc/rc.d/init.d/oracle / etc/rc.d/rc6.d/K01oracle
two。 After you install the database, you need to create a tablespace to be able to use it.
Note: before creating a tablespace, first create a directory of data files where the tablespace name is stored, as follows:
Mkdir-p / db/oracle11g/oradata/zebra
And set permissions as follows:
Chown orale:oinstall / db/oracle11g/oradata/zebra
The experiment is shown in the following figure:
Create a tablespace
Create tablespace tyfo datafile'/ db/oracle11g/oradata/tyfo/tyfo01.dbf' size 500m autoextend on next 500m maxsize 31g logging online permanent extent management local
Create a user
Create user zebra identified by zebra default tablespace zebra temporary tablespace temp
Set permissions
Grant dba,connect, create session, resource to zebra
Create backup files and set permissions
CREATE DIRECTORY back AS'/ home/oracle'
GRANT READ,WRITE ON DIRECTORY back to zebra
ALTER PROFILE DEFAULT LIMIT PASSWORD_LIFE_TIME UNLIMITED
Alter system set audit_trail=false scope=spfile
Shutdown abort
Startup
That's all for today. There are new needs to write again.
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.