oracle 安装

oracle_install.txt

RACLE_BASE是oracle的根目录,ORACLE_HOME是oracle产品的目录。

ORACLE_BASE下是admin和product  admin用来放日志和跟踪文件,oracle出了问题来这找原因就对了
ORACLE_HOME下则是ORACLE的命令、连接库、安装助手、l监听等等一系列的东西。

ORACLE_HOME比ORACLE_BASE目录要更深一些。也就是说:ORACLE_HOME=$ORACLE_BASE/product/oracle_version
oracle是属于某用户的,通常该用户是oracle。所以用时要切换用户

1.下载oracle database

http://www.oracle.com/technetwork/database/enterprise-edition/downloads/index.html


2.oracle 10g/11g官方文档


3.oracle开发和管理工具

plsql developer---window系统
toad for oracle

4.安装oracle

先安装oraclelinux的虚拟机
memory>3GB 选择4096M
磁盘SATA .vdi 80G
swap=2倍memory  8192M
/dev/sda2             30G  6.9G  2.4G  75% /
/dev/sda5              43G  180M   41G   1% /u01
/dev/sda1             190M   13M  168M   7% /boot

(1)系统版本

建议安装oracle11g

[root@ora66 ~]# cat /etc/redhat-release
Red Hat Enterprise Linux Server release 5.7 (Tikanga)

[root@ora66 ~]# uname -a
Linux ora66 2.6.18-274.el5 #1 SMP Mon Jul 25 13:17:49 EDT 2011 x86_64 x86_64 x86_64 GNU/Linux
(2)更改主机名
 vim /etc/hosts
10.10.54.66 ora66
 vim /etc/sysconfig/network
(3)创建oracle用户和用户组

[root@ora66 ~]# groupadd oinstall
[root@ora66 ~]# groupadd dba
[root@ora66 ~]# groupadd oper
[root@ora66 ~]# groupadd asmadmin
[root@ora66 ~]# useradd -g oinstall -G dba,oper,asmadmin oracle
[root@ora66 ~]# echo "oracle"|passwd --stdin oracle

(4)解压缩oracle软件包
[root@ora66 soft]# unzip linux.x64_11gR2_database_1of2.zip
[root@ora66 soft]# unzip linux.x64_11gR2_database_2of2.zip
[root@ora66 soft]$ ll
total 2297848
drwxr-xr-x 8 root root       4096 2009-08-21 database  解压出来的数据库
-rw-r--r-- 1 root root 1239269270 03-31 05:47 linux.x64_11gR2_database_1of2.zip
-rw-r--r-- 1 root root 1111416131 03-31 05:48 linux.x64_11gR2_database_2of2.zip

5.安装oracle数据库的依赖包
yum install -y oracle-validated.x86_64   ---软件包依赖,系统内核参数,limits.conf

安装完后应该有下列内容,没有的话手动添加:
 vim /etc/security/limits.conf
# Oracle-Validated setting for nofile soft limit is 131072
oracle   soft   nofile    131072

# Oracle-Validated setting for nofile hard limit is 131072
oracle   hard   nofile    131072

# Oracle-Validated setting for nproc soft limit is 131072
oracle   soft   nproc    131072

# Oracle-Validated setting for nproc hard limit is 131072
oracle   hard   nproc    131072

# Oracle-Validated setting for core soft limit is unlimited
oracle   soft   core    unlimited

# Oracle-Validated setting for core hard limit is unlimited
oracle   hard   core    unlimited

# Oracle-Validated setting for memlock soft limit is 50000000
oracle   soft   memlock    50000000

# Oracle-Validated setting for memlock hard limit is 50000000
oracle   hard   memlock    50000000

6.创建目录
[root@ora66 soft]# mkdir -p /u01/app/oracle
[root@ora66 soft]# chown oracle.oinstall /u01 -R

7.指定oracle环境变量
[root@ora66 soft]#  vim /home/oracle/.bash_profile
export ORACLE_BASE=/u01/app/oracle
export ORACLE_HOME=$ORACLE_BASE/11.2.0/db_1
export ORACLE_SID=orcl
export path=$PATH:$HOME/bin:$ORACLE_HOME/bin
[root@ora66 soft]# source /etc/profile

//验证环境变量生效
export |grep ORACLE_SID
declare -x ORACLE_SID="orcl"

export |grep ORACLE_BASE
declare -x ORACLE_BASE="/u01/app/oracle"

export |grep ORACLE_HOME
declare -x ORACLE_HOME="/u01/app/oracle/11.2.0/db_1"



[root@ora66 soft]# vim /etc/sysctl.conf

net.ipv4.ip_forward = 0
net.ipv4.conf.default.rp_filter = 2
net.ipv4.conf.default.accept_source_route = 0
kernel.sysrq = 0
kernel.core_uses_pid = 1
net.ipv4.tcp_syncookies = 1
fs.file-max = 6815744
kernel.msgmni = 2878
kernel.msgmax = 8192
kernel.msgmnb = 65536
kernel.sem = 250 32000 100 142
kernel.shmmni = 4096
kernel.shmall = 1073741824
kernel.shmmax = 4398046511104
kernel.sysrq = 1
net.core.rmem_default = 262144
net.core.rmem_max = 4194304
net.core.wmem_default = 262144
net.core.wmem_max = 1048576
fs.aio-max-nr = 3145728
net.ipv4.ip_local_port_range = 9000 65500
vm.min_free_kbytes = 51200

[root@ora66 soft]# sysctl -p

8.远程登录调用图形界面

gyf@gyf :~$ ssh -X [email protected]
 
[oracle@ora66 ~]$ cd /soft/database/
drwxr-xr-x 12 root root 4096 2009-08-17 doc
drwxr-xr-x  4 root root 4096 2009-08-15 install
drwxrwxr-x  2 root root 4096 2009-08-15 response
drwxr-xr-x  2 root root 4096 2009-08-15 rpm
-rwxr-xr-x  1 root root 3226 2009-08-15 runInstaller
drwxrwxr-x  2 root root 4096 2009-08-15 sshsetup
drwxr-xr-x 14 root root 4096 2009-08-15 stage
-rw-r--r--  1 root root 5402 2009-08-18 welcome.html

[oracle@ora66 database]$ ./runInstaller

#设置sqplus全局环境
cd /u01/app/oracle/11.2.0/db_1/sqlplus/admin
vim glogin.sql
alter session set nls_date_format = 'HH:MI:SS';
set sqlprompt "_user'@'_connect_identifier _date>"

set pagesize 24
set linesize 78





DC数据库控制界面
https://10.10.54.66:1158/em
错误后重新安装
cd /u01/app/oracl/11.2.0/db_1/deinstall/
./deinstall
gyf@gyf :~$ ssh -X [email protected]
[oracle@ora66 ~]$ cd /soft/database/
[oracle@ora66 database]$ ./runInstaller

创建数据库
[oracle@ora66 admin]$ dbca server_id=shiwei passwd=aaa12345
[oracle@ora66 admin]$ sql sys/aaa12345@shiwei as sysdba

SYS@shiwei 08:55:56>select name,log_mode,created,open_mode from v$database;
select name,log_mode,created,open_mode from v$database;

NAME      LOG_MODE     CREATED    OPEN_MODE
--------- ------------ -------- --------------------
SHIWEI      NOARCHIVELOG 08:49:20 READ WRITE



默认的系统管理账户
sys
system
sysman
dbsnmp
###########################################
###
用户:sys/change_on_install。。。不修改密码时密码

角色:SYSDBA 或 SYSOPER

不能以 NORMAL 登录,可作为默认的系统管理员

###
system/manager

SYSDBA 或 NORMAL

不能以 SYSOPER 登录,可作为默认的系统管理员

###
sysman/oem_temp

sysman

为 oms 的用户名

####
scott/tiger

NORMAL

普通用户

###
aqadm /aqadm

SYSDBA 或 NORMAL

高级队列管理员

###
Dbsnmp/dbsnmp

SYSDBA 或 NORMAL

复制管理员
###
登录身份:指登录时的Role指定,oracle11g中分 SYSDBA 和normal 两种。

PS:在安装Oracle 10g的时候,提示创建数据库,在创建的同时提示你输入口令,若此时你输入了密码,在登录数据库的时候用户名sys 对应的密码就应该是你创建数据库时候输入的口令。而非默认的manager.


######sql plus实现历史命令切换

下载需要如下三个软件
Term-ReadLine-Gnu-1.16.tar.gz
http://download.csdn.net/detail/wentasy/6677803

IO-Tty-1.07.tar.gz  
http://download.csdn.net/detail/wentasy/6677797

uniread-1.01.tar.gz  。。。要最后安装

1.安装perl
yum install perl* -y
---编译安装命令
2.解压这三个文件
tar -xzvf IO-Tty-1.07.tar.gz
tar -xzvf Term-ReadLine-Gnu-1.16.tar.gz
tar -xzvf uniread-1.01.tar.gz
3.进入IO-Tty-1.07目录,安装IO-Tty-1.07
 cd IO-Tty-1.07
 perl Makefile.PL
 make && make install

4.安装Term-ReadLine-Gnu-1.16

cd Term-ReadLine-Gnu-1.16
perl Makefile.PL
错误:Could not find neither libtermcap.a, libncurses.a, or libcurses.
yum install cyrus-imapd* -y
yum install ncurses* -y
yum install "*readline*" -y
perl Makefile.PL
make && make install
5.安装uniread-1.01

cd uniread-1.01
perl Makefile.PL
make && make install
6.在执行sqlplus / as sysdba之前加上uniread命令,就可以使用上下键翻页
我们还可以在环境变量添加别名
[root@ora66 uniread-1.01]# su - oracle
[oracle@ora66 ~]$ vim /home/oracle/.bash_profile
vim .bash_profile   ---在该配置文件添加
alias sql="/usr/bin/uniread sqlplus
"
alias rman="/usr/bin/uniread rman"
[oracle@ora66 ~]$ source /home/oracle/.bash_profile


###解锁SCOTT普通账户帐号


SQL> select username,ACCOUNT_STATUS from dba_users where username='SCOTT';

USERNAME               ACCOUNT_STATUS
------------------------------ --------------------------------
SCOTT                   EXPIRED & LOCKED



SQL> alter user scott account unlock;

User altered.

SQL> alter user scott identified by tiger;

User altered.

SQL> grant connect,resource,unlimited tablespace to scott;


SQL> col object_name for a30;
SQL> select object_name,object_type from user_objects;

OBJECT_NAME               OBJECT_TYPE
------------------------------ -------------------
SALGRADE               TABLE
BONUS                   TABLE
PK_EMP                   INDEX
EMP                   TABLE
DEPT                   TABLE
PK_DEPT                INDEX

quit



###解锁HR用户
[oracle@ora66 ~]$ sql /  as sysdba #默认是sys登录
SQL> conn sys/aaa12345 as sysdba
Connected.
select username,ACCOUNT_STATUS from dba_users where username='HR';

USERNAME               ACCOUNT_STATUS
------------------------------ --------------------------------
HR                   EXPIRED & LOCKED

SQL> alter user hr account unlock;

User altere

SQL> alter user hr identified by hr; #hr不要引号


User altered.

SQL> grant connect,resource,unlimited tablespace to hr;








你可能感兴趣的:(oracle的安装)