- 一、检查服务器硬件和内存配置:
1.使用以下命令确定服务器上的物理RAM大小:
grep MemTotal /proc/meminfo
2.确定配置的交换空间的大小:
grep SwapTotal /proc/meminfo
3.确定/tmp目录中可用的空间量:
df -h /tmp
4.确定系统上的可用RAM和磁盘交换空间量:
free
5.确定系统体系结构是否可以运行该软件:
uname -m
验证处理器体系结构是否与要安装的Oracle软件版本匹配。例如,对于x86-64位系统,您应该看到以下内容:
x86_64
如果您没有看到预期的输出,则无法在此系统上安装该软件。
6.验证共享内存(/dev/shm)是否已正确安装且大小足够:
df -h /dev/shm
二、依赖包安装:
yum install -y binutils compat-libstdc++-33 elfutils-libelf elfutils-libelf-devel gcc gcc-c++ glibc glibc-common glibc-devel libaio libaio-devel libgcc libstdc++ libstdc++-devel make sysstat ld-linux.so.2
- 三、创建组和用户
groupadd oinstall
useradd oracle -g oinstall
passwd oracle
- 四、创建目录
mkdir -p /u01/app/oracle
chown -R oracle:oinstall /u01/app/oracle
chmod -R 775 /u01/app/
mkdir /opt/oracle(客户端安装介质解压目录)
mkdir /u01/app/oracle/11.2/client(客户端的安装目录)
- 五、安装
配置文件所在位置:/opt/oracle/client/response/client_install.rsp
##################################################################
#-----------------------------------------------------------------------------
#Do not change the following system generated value.
#-----------------------------------------------------------------------------
oracle.install.responseFileVersion=/oracle/install/rspfmt_clientinstall_response_schema_v12.2.0
#-----------------------------------------------------------------------------
#Unix group to be set for the inventory directory.
#-----------------------------------------------------------------------------
UNIX_GROUP_NAME=oinstall
#-----------------------------------------------------------------------------
#Inventory location.
#-----------------------------------------------------------------------------
INVENTORY_LOCATION=/u01/app/oralnventory
#-----------------------------------------------------------------------------
#Complete path of the Oracle Home
#-----------------------------------------------------------------------------
ORACLE_HOME=/u01/app/oracle/client
#-----------------------------------------------------------------------------
#Complete path of the Oracle Base.
#-----------------------------------------------------------------------------
ORACLE_BASE=/u01/app/oracle
#-----------------------------------------------------------------------------
#Name : INSTALL_TYPE
#Datatype : String
#Description: Installation type of the component.
#
#The following choices are available. The value should contain
#only one of these choices.
#- InstantClient
#- Administrator
#- Runtime
#- Custom
#
#Example : INSTALL_TYPE = Administrator
#-----------------------------------------------------------------------------
oracle.install.client.installType=Administrator
#-----------------------------------------------------------------------------
#Name : oracle.install.client.customComponents
#Datatype : StringList
#
#This property is considered only if INSTALL_TYPE is set to "Custom"
#
#Description: List of Client Components you would like to install
#
#The following choices are available. You may specify any
#combination of these choices. The components you choose should
#be specified in the form "internal-component-name:version"
#Below is a list of components you may specify to install.
#
#oracle.sqlj:12.2.0.1.0 -- "Oracle SQLJ"
#oracle.rdbms.util:12.2.0.1.0 -- "Oracle Database Utilities"
#oracle.javavm.client:12.2.0.1.0 -- "Oracle Java Client"
#oracle.sqlplus:12.2.0.1.0 -- "SQL*Plus"
#oracle.dbjava.jdbc:12.2.0.1.0 -- "Oracle JDBC/THIN Interfaces"
#oracle.ldap.client:12.2.0.1.0 -- "Oracle Internet Directory Client"
#oracle.rdbms.oci:12.2.0.1.0 -- "Oracle Call Interface (OCI)"
#oracle.precomp:12.2.0.1.0 -- "Oracle Programmer"
#oracle.xdk:12.2.0.1.0 -- "Oracle XML Development Kit"
#oracle.network.aso:12.2.0.1.0 -- "Oracle Advanced Security"
#oracle.oraolap.mgmt:12.2.0.1.0 -- "OLAP Analytic Workspace Manager and Worksheet"
#oracle.network.client:12.2.0.1.0 -- "Oracle Net"
#oracle.network.cman:12.2.0.1.0 -- "Oracle Connection Manager"
#oracle.network.listener:12.2.0.1.0 -- "Oracle Net Listener"
#oracle.ordim.client:12.2.0.1.0 -- "Oracle Multimedia Client Option"
#oracle.odbc:12.2.0.1.0 -- "Oracle ODBC Driver"
#oracle.has.client:12.2.0.1.0 -- "Oracle Clusterware High Availability API"
#oracle.dbdev:12.2.0.1.0 -- "Oracle SQL Developer"
#oracle.rdbms.scheduler:12.2.0.1.0 -- "Oracle Scheduler Agent"
#
#Example: oracle.install.client.customComponents="oracle.precomp:12.2.0.1.0","oracle.oraolap.mgmt:12.2.0.1.0","oracle.rdbms.scheduler:12.2.0.1.0"
#-----------------------------------------------------------------------------
oracle.install.client.customComponents=
#-----------------------------------------------------------------------------
#Host name to be used for by the Oracle Scheduler Agent.
#This needs to be entered in case oracle.rdbms.scheduler is selected in the
#list of custom components during custom install
#
#Example : oracle.install.client.schedulerAgentHostName = acme.domain.com
#-----------------------------------------------------------------------------
oracle.install.client.schedulerAgentHostName=
#-----------------------------------------------------------------------------
#Port number to be used for by the Oracle Scheduler Agent.
#This needs to be entered in case oracle.rdbms.scheduler is selected in the
#list of custom components during custom install
#
#Example: oracle.install.client.schedulerAgentPortNumber = 1500
#-----------------------------------------------------------------------------
oracle.install.client.schedulerAgentPortNumber=
静默安装客户端
./runInstaller -silent -responseFile /opt/oracle/client/response/client_install.rsp -ignoreSysPrereqs
• -silent 以静默方式运行安装程序。
• -noconfig 禁止在安装期间运行配置助手,而是执行纯软件安装。
注意:
必须要用oracle用户启动
不要指定响应文件的相对路径。如果指定相对路径,则安装程序将失败。
- 六、root用户执行脚本
/u01/app/oracle/11.2/client/root.sh
- 七、配置环境变量
vim .bash_profile
export ORACLE_HOME =/u01/app/oracle/11.2/client
export NLS_LANG(根据情况)
export NLS_DATE_FORMAT ="YYYY-MM-DD HH24:Mi:SS"
export LD_LIBRARY_PATH= $ORACLE_HOME/lib
export PATH=$ORACLE_HOME/bin:$PATH
生效环境变量
source .bash_profile
- 八、登陆sqlplus
sqlplus / nolog
- 九、客户端连接数据库
- 十、常见问题
问题:
尝试使用system/sys用户登录服务器的数据库,始终显示无效的用户名/密码。
ERROR:
ORA-01017: invalid username/password; logon denied
解决方法:
1.执行命令sqlplus / as sysdba登录
2.执行select username from dba_users查看所有用户
3.解锁账户并设置密码
解锁用户命令格式为:ALTER USER 用户名 UNLOCK
SQL> alter user system account unlock;
设置新密码命令格式为:ALTER USER 用户名 IDENTIFIED BY 新密码
SQL> alter user system identified by 123456;