Oracle软件安装及手工建库
时间:2016-07-23 16:52 来源:linux.it.net.cn 作者:IT
一、阅读官方文档
二、安装数据库软件(参考实验手册)
1、上传oracle软件包并解压缩
unzip p10404530_112030_Linux-x86-64_1of7.zip
unzip p10404530_112030_Linux-x86-64_2of7.zip
2、建组、用户
groupadd oinstall
groupadd dba
useradd -d /home/oracle -g oinstall -G dba -m oracle
3、设置环境变量
(1)系统环境变量(不须要设置)
(2)ORACLE用户环境变量
vi .bash_profile
export ORACLE_BASE=/u01/app/oracle
export ORACLE_HOME=$ORACLE_BASE/product/11.2.0
export ORACLE_SID=ocp
export NLS_LANG="SIMPLIFIED CHINESE_CHINA".ZHS16GBK
export PATH=$ORACLE_HOME/bin:$PATH
4、建目录
mkdir -p /u01/app/oracle/product/11.2.0
5、授权
chown -R oracle:oinstall /u01/app/oracle
chmod -R 755 /u01/app/oracle
6、开始安装
(1)从root切到oracle用户前操作:
xhost +
(2)切换到oracle用户
su - oracle
(3)开始安装
cd /backup/database
./runInstaller
(4)安装到94左右%会提示要执行两个脚本:
/u01/app/oracle/oraInventory/orainstRoot.sh
/u01/app/oracle/product/11.2.0/root.sh
三、创建数据库步骤
1、方法一:DBCA建库
2、方法二:手工建库
(1)设置Oracle用户环境变量
export ORACLE_BASE=/u01/app/oracle
export ORACLE_HOME=$ORACLE_BASE/product/11g
export ORACLE_SID=test
export PATH=$ORACLE_HOME/bin:$PATH
(2)创建密码文件
orapwd file=orapwocp password=oracle;
(3)设置参数文件
CONTROL_FILES='/u01/app/oracle/oradata/ocp/control01.ctl','/u01/app/oracle/oradata/ocp/control02.ctl','/u01/app/oracle/oradata/ocp/control03.ctl'
DB_BLOCK_SIZE=8192
DB_NAME=ocp
PROCESSES=150
MEMORY_TARGET=800M
SGA_MAX_SIZE=600M
SGA_TARGET=600M
UNDO_TABLESPACE=UNDOTBS1
(4)建库脚本
CREATE DATABASE ocp
USER SYS IDENTIFIED BY oracle
USER SYSTEM IDENTIFIED BY oracle
LOGFILE GROUP 1 ('/u01/app/oracle/oradata/ocp/redo01.log') SIZE 50M,
GROUP 2 ('/u01/app/oracle/oradata/ocp/redo02.log') SIZE 50M,
GROUP 3 ('/u01/app/oracle/oradata/ocp/redo03.log') SIZE 50M
MAXLOGFILES 5
MAXLOGMEMBERS 5
MAXLOGHISTORY 1
MAXDATAFILES 100
CHARACTER SET US7ASCII
NATIONAL CHARACTER SET AL16UTF16
EXTENT MANAGEMENT LOCAL
DATAFILE '/u01/app/oracle/oradata/ocp/system01.dbf' SIZE 500M REUSE
SYSAUX DATAFILE '/u01/app/oracle/oradata/ocp/sysaux01.dbf' SIZE 500M REUSE
DEFAULT TEMPORARY TABLESPACE temp
TEMPFILE '/u01/app/oracle/oradata/ocp/temp01.dbf'
SIZE 20M REUSE
UNDO TABLESPACE undotbs1
DATAFILE '/u01/app/oracle/oradata/ocp/undotbs01.dbf'
SIZE 200M REUSE AUTOEXTEND ON MAXSIZE UNLIMITED;
(6)执行脚本
@?/rdbms/admin/catalog.sql
@?/rdbms/admin/catproc.sql
conn system/oracle
@?/sqlplus/admin/pupbld.sql
四、重建OEM
1、注意四个检查:
(1)检查密码文件
(2)检查/etc/hosts
(3)检查system表空间
(4)检查监听lsnrctl status
(5)export ORACLE_HOSTNAME=ocp --hostname
2、创建OEM
emca -config dbcontrol db -repos recreate
3、开启OEM
emctl start dbconsole
4、关闭OEM
emctl stop dbconsole
5、检查OEM状态
emctl status dbconsole
6、检查代理状态
emctl status agent
7、上传到OMS
emctl upload agent
(责任编辑:IT)
一、阅读官方文档 二、安装数据库软件(参考实验手册)
1、上传oracle软件包并解压缩 2、建组、用户 groupadd oinstall groupadd dba useradd -d /home/oracle -g oinstall -G dba -m oracle 3、设置环境变量 (1)系统环境变量(不须要设置) (2)ORACLE用户环境变量 vi .bash_profile export ORACLE_BASE=/u01/app/oracle export ORACLE_HOME=$ORACLE_BASE/product/11.2.0 export ORACLE_SID=ocp export NLS_LANG="SIMPLIFIED CHINESE_CHINA".ZHS16GBK export PATH=$ORACLE_HOME/bin:$PATH 4、建目录 mkdir -p /u01/app/oracle/product/11.2.0 5、授权 chown -R oracle:oinstall /u01/app/oracle chmod -R 755 /u01/app/oracle 6、开始安装 (1)从root切到oracle用户前操作: xhost + (2)切换到oracle用户 su - oracle (3)开始安装 cd /backup/database ./runInstaller (4)安装到94左右%会提示要执行两个脚本: /u01/app/oracle/oraInventory/orainstRoot.sh /u01/app/oracle/product/11.2.0/root.sh
三、创建数据库步骤 1、方法一:DBCA建库 2、方法二:手工建库 (1)设置Oracle用户环境变量 export ORACLE_BASE=/u01/app/oracle export ORACLE_HOME=$ORACLE_BASE/product/11g export ORACLE_SID=test export PATH=$ORACLE_HOME/bin:$PATH (2)创建密码文件 orapwd file=orapwocp password=oracle; (3)设置参数文件 CONTROL_FILES='/u01/app/oracle/oradata/ocp/control01.ctl','/u01/app/oracle/oradata/ocp/control02.ctl','/u01/app/oracle/oradata/ocp/control03.ctl' DB_BLOCK_SIZE=8192 DB_NAME=ocp PROCESSES=150 MEMORY_TARGET=800M SGA_MAX_SIZE=600M SGA_TARGET=600M UNDO_TABLESPACE=UNDOTBS1 (4)建库脚本 CREATE DATABASE ocp USER SYS IDENTIFIED BY oracle USER SYSTEM IDENTIFIED BY oracle LOGFILE GROUP 1 ('/u01/app/oracle/oradata/ocp/redo01.log') SIZE 50M, GROUP 2 ('/u01/app/oracle/oradata/ocp/redo02.log') SIZE 50M, GROUP 3 ('/u01/app/oracle/oradata/ocp/redo03.log') SIZE 50M MAXLOGFILES 5 MAXLOGMEMBERS 5 MAXLOGHISTORY 1 MAXDATAFILES 100 CHARACTER SET US7ASCII NATIONAL CHARACTER SET AL16UTF16 EXTENT MANAGEMENT LOCAL DATAFILE '/u01/app/oracle/oradata/ocp/system01.dbf' SIZE 500M REUSE SYSAUX DATAFILE '/u01/app/oracle/oradata/ocp/sysaux01.dbf' SIZE 500M REUSE DEFAULT TEMPORARY TABLESPACE temp TEMPFILE '/u01/app/oracle/oradata/ocp/temp01.dbf' SIZE 20M REUSE UNDO TABLESPACE undotbs1 DATAFILE '/u01/app/oracle/oradata/ocp/undotbs01.dbf' SIZE 200M REUSE AUTOEXTEND ON MAXSIZE UNLIMITED; (6)执行脚本 @?/rdbms/admin/catalog.sql @?/rdbms/admin/catproc.sql conn system/oracle @?/sqlplus/admin/pupbld.sql 四、重建OEM 1、注意四个检查: (1)检查密码文件 (2)检查/etc/hosts (3)检查system表空间 (4)检查监听lsnrctl status (5)export ORACLE_HOSTNAME=ocp --hostname 2、创建OEM emca -config dbcontrol db -repos recreate 3、开启OEM emctl start dbconsole 4、关闭OEM emctl stop dbconsole 5、检查OEM状态 emctl status dbconsole 6、检查代理状态 emctl status agent 7、上传到OMS emctl upload agent (责任编辑:IT) |