步骤:
1、上传oracle安装包
linux.x64_11gR2_database_1of2.zip
linux.x64_11gR2_database_2of2.zip
2、检查依赖库
rpm -q binutils | grep "not installed" rpm -q compat-libstdc++-33 | grep "not installed" rpm -q elfutils-libelf | grep "not installed" rpm -q elfutils-libelf-devel | grep "not installed" rpm -q expat | grep "not installed" rpm -q gcc | grep "not installed" rpm -q gcc-c++ | grep "not installed" rpm -q binutils | grep "not installed" rpm -q glibc | grep "not installed" rpm -q glibc-common | grep "not installed" rpm -q glibc-devel | grep "not installed" rpm -q glibc-headers | grep "not installed" rpm -q libaio | grep "not installed" rpm -q libaio-devel | grep "not installed" rpm -q libgcc | grep "not installed" rpm -q libstdc++ | grep "not installed" rpm -q libstdc++-devel | grep "not installed" rpm -q make | grep "not installed" rpm -q pdksh | grep "not installed" rpm -q sysstat | grep "not installed" rpm -q binutils | grep "not installed" rpm -q unixODBC | grep "not installed" rpm -q unixODBC-devel | grep "not installed"
若出现哪些依赖库没有安装,使用”yum install [依赖库]“进行安装
一般缺少依赖包:
compat-libstdc++-33
elfutils-libelf-devel
libaio-devel
pdksh
unixODBC
unixODBC-devel
pdksh可能安装不了,需另外单独下载,传到服务器上,加上执行权限,进行安装
chmod 777 pdksh-5.2.14-37.el5_8.1.x86_64.rpm
rpm -ivh pdksh-5.2.14-37.el5_8.1.x86_64.rpm下载pdksh,地址:http://vdisk.weibo.com/s/uqs9yi2YuoqLL?from=page_100505_profile&wvr=6
3、创建用户和用户组
groupadd oinstall groupadd dba groupadd asmadmin groupadd asmdba useradd -g oinstall -G dba,asmdba oracle -d /home/oracle passwd oracle
4、为oracle设置内核参数
$vi /etc/sysctl.conf
# 在底部追加以下内容
net.ipv4.icmp_echo_ignore_broadcasts = 1
net.ipv4.conf.all.rp_filter = 1
fs.file-max = 6815744
fs.aio-max-nr = 1048576
kernel.shmall = 2097152
kernel.shmmax = 2147483648
kernel.shmmni = 4096
kernel.sem = 250 32000 100 128
net.ipv4.ip_local_port_range = 9000 65500
net.core.rmem_default = 262144
net.core.rmem_max = 4194304
net.core.wmem_default = 262144
net.core.wmem_max = 1048576
# 使配置立即生效 $sysctl -p
$vi /etc/security/limits.conf
# 在底部追加以下内容
oracle soft nproc 2047
oracle hard nproc 16384
oracle soft nofile 1024
oracle hard nofile 65536
5、新建oracle目录
$mkdir -p /u01/app/oracle/ chown -R oracle:oinstall /home/oracle chown -R oracle:oinstall /u01
6、设置oracle环境变量
$su - oracle $vi .bash_profile #在底部追加以下内容 export PATHTH=$PATH:HOME/bin export ORACLE_BASE=/u01 export ORACLE_HOME=$ORACLE_BASE/oracle export ORACLE_SID=LED export PATH=$PATH:$ORACLE_HOME/bin:$ORACLE_HOME/Apache/Apache/bin # export TNS_ADMIN=$ORACLE_HOME/network/admin # export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:ORACLE_HOME/lib export NLS_LANG=AMERICAN_AMERICA.AL32UTF8 # export ORA_NLS10=$ORACLE_HOME/nls/data unset USERNAME umask 022
7、解压缩oracle安装文件
su - root mv linux.x64_11gR2_database_1of2.zip /home/oracle/linux.x64_11gR2_database_1of2.zip mv linux.x64_11gR2_database_2of2.zip /home/oracle/linux.x64_11gR2_database_2of2.zip cd /home/oracle chmod 777 *.zip su - oracle unzip linux.x64_11gR2_database_1of2.zip -d /u01 unzip linux.x64_11gR2_database_2of2.zip -d /u01 cd /u01/database export DISTRIB=`pwd`
8、修改数据库安装响应文件
cd /u01/database/response vi db_install.rsp # 需要更改的参数,其他尽量不要更改,若非要更改请了解参数含义 UNIX_GROUP_NAME=oinstall INVENTORY_LOCATION=/home/oracle/u01/app/oracle/oraInventory SELECTED_LANGUAGES=en,zh_CN,zh_TW ORACLE_HOME=/home/oracle/u01/oracle ORACLE_BASE=/home/oracle/u01 oracle.install.db.InstallEdition=EE oracle.install.db.isCustomInstall=true oracle.install.db.DBA_GROUP=dba oracle.install.db.OPER_GROUP=oinstall
9、调整swap空间大小
su - root # 查看swap大小 free -m # 增加交换分区文件及大小,如果要增加2G大小的交换分区,则命令写法如下,其中的 count 等于想要的块大小。 dd if=/dev/zero of=/home/swap bs=1024 count=2048000 # 设置交换文件 mkswap /home/swap # 立即启用交换分区文件 swapon /home/swap # 如果要在引导时自动启用,则编辑 /etc/fstab 文件,添加行 /home/swap swap swap defaults 0 0
10、开始静默安装
su - oracle cd /u01/database ./runInstaller -silent -force -responseFile /u01/database/response/db_install.rsp # 安装成功会出现 [oracle@iZ94dzd0zvxZ database]$ The following configuration scripts need to be executed as the "root" user. #!/bin/sh #Root scripts to run /u01/oraInventory/orainstRoot.sh /u01/oracle/root.sh To execute the configuration scripts: 1. Open a terminal window 2. Log in as "root" 3. Run the scripts 4. Return to this window and hit "Enter" key to continue Successfully Setup Software.
这一步操作最容易出错,在执行安装脚本时就会报错,经反复测试,只要保证以下规律就能出现”Successfully Setup Software“,
在执行此步操作时,最好再次执行下以下命令:
$cd /u01/database export DISTRIB=`pwd`
oracle静默安装时会需找此变量,另外附加个安装成功的db_install.rsp的响应文件,点击下载
11、在root用户下运行脚本
$cd /u01/oraInventory/ ./orainstRoot.sh $cd /u01/oracle/ ./root.sh
12、静默配置监听
# 切换到oracle用户 su - oracle # 执行监听的响应文件安装 $ORACLE_HOME/bin/netca /silent /responsefile /u01/database/response/netca.rsp # 查看是否已经生成listener.ora和sqlnet.ora监听文件 ll $ORACLE_HOME/network/admin/*.ora # 检查监听启动状态 lsnrctl status
13、静默建库
$vi /u01/database/response/dbca.rsp #以下参数必须设置 [CREATEDATABASE] GDBNAME = "ORCL.LK" TEMPLATENAME = "General_Purpose.dbc" #以下参数不设置则使用默认值,建议设置 CHARACTERSET = "utf8" TOTALMEMORY = "1024"
执行静默安装
$ORACLE_HOME/bin/dbca -silent -responseFile /u01/database/response/dbca.rsp Enter SYS user password: Enter SYSTEM user password:
由于没有更改dbca.rsp文件中的SYS和SYSTEM的密码,所以oracle缺省密码分别为chang_on_install和manager
14、检查建库实列
ps -ef | grep ora_ | grep -v grep | wc -l ps -ef | grep ora_ | grep -v grep
监听、进程正常,启动成功。关于创建用户、表空间和分配权限,请点击。
创建Oracle表空间,临时表空间,用户名
CREATE SMALLFILE TEMPORARY TABLESPACE TQBAY_TEMP TEMPFILE '/bosyun/u01/oradata/orcl11g/TQBAY_TEMP' SIZE 2048M AUTOEXTEND ON NEXT 512M MAXSIZE UNLIMITED EXTENT MANAGEMENT LOCAL UNIFORM SIZE 1M; CREATE SMALLFILE TABLESPACE TQBAY_DATA DATAFILE '/bosyun/u01/oradata/orcl11g/TQBAY_DATA' SIZE 2048M AUTOEXTEND ON NEXT 512M MAXSIZE UNLIMITED LOGGING EXTENT MANAGEMENT LOCAL SEGMENT SPACE MANAGEMENT AUTO; CREATE USER 用户名 PROFILE "DEFAULT" IDENTIFIED BY 密码 DEFAULT TABLESPACE TQBAY_DATA TEMPORARY TABLESPACE TQBAY_TEMP ACCOUNT UNLOCK; GRANT CONNECT TO 用户名 WITH ADMIN OPTION; GRANT DBA TO 用户名; GRANT RESOURCE TO 用户名;
FAQ:
FAQ1: [SEVERE] - Email Address Not Specified
DECLINE_SECURITY_UPDATES=true
FAQ2: SEVERE: [FATAL] [INS-35071] Global database name cannot be left blank.
oracle.install.db.config.starterdb.globalDBName
FAQ3: HOSTNAME
#查看当前主机名 $ echo $HOSTNAME
$vi /etc/hosts #添加127.0.0.1 对应主机名,如: 127.0.0.1 213.49.153.219.cq.cq.cta.net.cn
/etc/hosts
FAQ1:[FATAL] [INS-13013] Target environment do not meet some mandatory requirements
解决安装是:安装命令中加入选项-ignorePrereq
FAQ2: LRM-00109: could not open parameter file '/home/oracle/oracle10g/dbs/initoms
今天连接Oracle数据库的时候,发现数据没启动,利用startup命令,出现错误提示如下:
SQL> startup
ORA-01078: failure in processing system parameters
LRM-00109: could not open parameter file '/oracle/10g/dbs/init10g.ora'
解决方法:
将$ORACLE_BASE/admin/你的数据库名称/pfile/init.ora.628201264542(这串数字未必一样)
copy到$ORACLE_HOME/dbs目录下,并改名为你的数据库实例名即可。
例如:上面提示找不到init10g.ora这个文件,就改成 init10g.ora
参考命令:
export $ORACLE_HOME --输出使用中的环境变量Home
cat /home/oracle/.bash_profile --或.bashrc文件,务必确定$ORACLE_HOME的值与当前使用的一致
(我就遇到过不一致的)
mv $ORACLE_BASE/admin/orcl/pfile/init.ora.628201264542 /oracle/10g/dbs/init10g.ora
--复制文件到指定目录
sqlplus "/as sysdba"
startup
搞定!
FAQ3: SQL> shutdown immediate;
ORA-01507: database not mounted
[oracle@iZ286r3394hZ orcl11g]$ ps -ef | grep oracle oracle 29729 1 0 10:17 ? 00:00:00 /bosyun/u01/app/oracle/bin/tnsl nr LISTENER -inherit root 30074 30038 0 10:34 pts/0 00:00:00 su - oracle oracle 30075 30074 0 10:34 pts/0 00:00:00 -bash oracle 30831 1 0 10:37 ? 00:00:00 ora_pmon_orcl11g oracle 30833 1 0 10:37 ? 00:00:01 ora_vktm_orcl11g oracle 30837 1 0 10:37 ? 00:00:00 ora_gen0_orcl11g oracle 30839 1 0 10:37 ? 00:00:00 ora_diag_orcl11g oracle 30841 1 0 10:37 ? 00:00:00 ora_dbrm_orcl11g oracle 30843 1 0 10:37 ? 00:00:00 ora_psp0_orcl11g oracle 30845 1 0 10:37 ? 00:00:00 ora_dia0_orcl11g oracle 30847 1 0 10:37 ? 00:00:00 ora_mman_orcl11g oracle 30849 1 0 10:37 ? 00:00:00 ora_dbw0_orcl11g oracle 30851 1 0 10:37 ? 00:00:00 ora_lgwr_orcl11g oracle 30853 1 0 10:37 ? 00:00:00 ora_ckpt_orcl11g oracle 30855 1 0 10:37 ? 00:00:00 ora_smon_orcl11g oracle 30857 1 0 10:37 ? 00:00:00 ora_reco_orcl11g oracle 30859 1 0 10:37 ? 00:00:00 ora_mmon_orcl11g oracle 30861 1 0 10:37 ? 00:00:00 ora_mmnl_orcl11g oracle 30863 1 0 10:37 ? 00:00:00 ora_d000_orcl11g oracle 30865 1 0 10:37 ? 00:00:00 ora_s000_orcl11g oracle 30971 1 0 10:37 ? 00:00:00 ora_qmnc_orcl11g oracle 30986 1 0 10:37 ? 00:00:00 ora_cjq0_orcl11g oracle 30988 1 0 10:37 ? 00:00:00 ora_q000_orcl11g oracle 30990 1 0 10:37 ? 00:00:00 ora_q001_orcl11g oracle 31041 1 0 10:47 ? 00:00:00 ora_smco_orcl11g oracle 31043 1 0 10:47 ? 00:00:00 ora_w000_orcl11g oracle 31285 30075 0 10:56 pts/0 00:00:00 ps -ef oracle 31286 30075 0 10:56 pts/0 00:00:00 grep --color=auto oracle [oracle@iZ286r3394hZ orcl11g]$ kill -9 30831 [oracle@iZ286r3394hZ orcl11g]$ ps -ef | grep oracle oracle 29729 1 0 10:17 ? 00:00:00 /bosyun/u01/app/oracle/bin/tnsls nr LISTENER -inherit root 30074 30038 0 10:34 pts/0 00:00:00 su - oracle oracle 30075 30074 0 10:34 pts/0 00:00:00 -bash oracle 31293 30075 0 10:57 pts/0 00:00:00 ps -ef oracle 31294 30075 0 10:57 pts/0 00:00:00 grep --color=auto oracle [oracle@iZ286r3394hZ orcl11g]$ ipcs -s ------ Semaphore Arrays -------- key semid owner perms nsems [oracle@iZ286r3394hZ orcl11g]$ ipcs -mp ------ Shared Memory Creator/Last-op PIDs -------- shmid owner cpid lpid [oracle@iZ286r3394hZ orcl11g]$ ps -ef | grep ora_ oracle 31300 30075 0 10:58 pts/0 00:00:00 grep --color=auto ora_ [oracle@iZ286r3394hZ orcl11g]$ sqlplus /nolog SQL> connect / as sysdba SQL> startup ORACLE instance started. Total System Global Area 1068937216 bytes Fixed Size 2220200 bytes Variable Size 616566616 bytes Database Buffers 444596224 bytes Redo Buffers 5554176 bytes Database mounted. Database opened.
4.Preparing to launch Oracle Universal Installer from /tmp/OraInstall2016-09-21_10-07-07AM. Please wait ...[oracle@iZ94dzd0zvxZ database]$ [SEVERE] - Email Address Not Specified
DECLINE_SECURITY_UPDATES = true
5.#查看当前服务器名
$hostname
#db_install.rsp中ORACLE_HOSTNAME设置为当前服务器名
ORACLE_HOSTNAME=iZ94dzd0zvxZ
6.[FATAL] [INS-35175] No value given for the allocated memory of the database.
#db_install.rsp中memoryLimit设置
oracle.install.db.config.starterdb.memoryLimit=512
7.[FATAL] [INS-35376] Passsword cannot be empty for ASMSNMP user
oracle.install.db.config.asm.ASMSNMPPassword=LED_ASM_SYSTEM
8.[FATAL] [INS-30501] Automatic Storage Management software is not configured on this system.
INVENTORY_LOCATION=/bosyun/u01/oraInventory
oracle.install.option=INSTALL_DB_SWONLY
9.SQL> startup mount;
ORA-01078: failure in processing system parameters
LRM-00109: could not open parameter file '/bosyun/u01/oracle/dbs/initLED.ora'
cp /bosyun/u01/admin/ORCL/pfile/init.ora.821201615331 /bosyun/u01/oracle/dbs/initLED.ora
10.
SQL> startup mount;
ORACLE instance started.
Total System Global Area 1068937216 bytes
Fixed Size 2220200 bytes
Variable Size 616566616 bytes
Database Buffers 444596224 bytes
Redo Buffers 5554176 bytes
11. ORA-01102: cannot mount database in EXCLUSIVE mode
SQL> alter system set db_unique_name=tmp scope=spfile;
9.ORA-29702:error occurred in Cluster Group Service operation错误解决
$ cd $ORACLE_HOME/rdbms/lib
$ make -f ins_rdbms.mk no_parropt
$ make -f ins_rdbms.mk install
http://www.xuebuyuan.com/1027125.html
http://itbull.blog.51cto.com/669746/1131184/