linux中oracle的安装

1:以root登录,挂载linux iso文件

[root@localhost ~]# mkdir /mnt/cdrom

[root@localhost ~]# mount /dev/cdrom /mnt/cdrom/

mount: block device /dev/cdrom is write-protected, mounting read-only

2:检查包是否安装 (软件包源码位于iso下的server目录下)如果没有安装则需要安装:

需要安装的包:Red Hat Enterprise Linux 4.0 and Asianux 2.0:

binutils-2.15.92.0.2-13.EL4

compat-db-4.1.25-9

compat-libstdc++-296-2.96-132.7.2

control-center-2.8.0-12

gcc-3.4.3-22.1.EL4

gcc-c++-3.4.3-22.1.EL44

glibc-2.3.4-2.9

glibc-common-2.3.4-2.9

gnome-libs-1.4.1.2.90-44.1

libstdc++-3.4.3-22.1

libstdc++-devel-3.4.3-22.1

make-3.80-5

pdksh-5.2.14-30

sysstat-5.0.5-1

xscreensaver-4.18-5.rhel4.2

setarch-1.6-1

[root@localhost ~]# rpm -q compat-db

package compat-db is not installed

[root@localhost ~]# rpm -qa |grep compat  

compat-libgcc-296-2.96-138

avahi-compat-libdns_sd-0.6.16-6.el5

compat-libstdc++-296-2.96-138

java-1.4.2-gcj-compat-1.4.2.0-40jpp.115

compat-libstdc++-33-3.2.3-61

[root@localhost ~]# rpm -qa |grep binutils

binutils-2.17.50.0.6-12.el5

[root@localhost ~]# cd /mnt/cdrom/Server/

[root@localhost Server]# rpm -ivh compat-db-4.2.52-5.1.i386.rpm

warning: compat-db-4.2.52-5.1.i386.rpm: Header V3 DSA signature: NOKEY, key ID 37017186

Preparing...                ########################################### [100%]

   1:compat-db              ########################################### [100%]

[root@localhost Server]# rpm -qa |grep control

control-center-2.16.0-16.el5

[root@localhost Server]# rpm -qa |grep gcc   

compat-libgcc-296-2.96-138

libgcc-4.1.2-46.el5

gcc-4.1.2-46.el5

gcc-gfortran-4.1.2-46.el5

gcc-c++-4.1.2-46.el5

[root@localhost Server]# rpm -qa |grep glibc

glibc-headers-2.5-42

glibc-2.5-42

glibc-common-2.5-42

glibc-devel-2.5-42

[root@localhost Server]# rpm -qa |grep libstdc

libstdc++-devel-4.1.2-46.el5

compat-libstdc++-296-2.96-138

libstdc++-4.1.2-46.el5

compat-libstdc++-33-3.2.3-61

[root@localhost Server]# rpm -qa |grep make  

automake16-1.6.3-8

automake15-1.5-16

automake17-1.7.9-7

make-3.81-3.el5

automake14-1.4p6-13

automake-1.9.6-2.1

imake-1.0.2-3

[root@localhost Server]# rpm -qa |grep pdksh

[root@localhost Server]# rpm -ivh pdksh-5.2.14-36.el5.i386.rpm

warning: pdksh-5.2.14-36.el5.i386.rpm: Header V3 DSA signature: NOKEY, key ID 37017186

Preparing...                ########################################### [100%]

   1:pdksh                  ########################################### [100%]

[root@localhost Server]# rpm -qa |grep sysstat

[root@localhost Server]# rpm -ivh sysstat-7.0.2-3.el5.i386.rpm

warning: sysstat-7.0.2-3.el5.i386.rpm: Header V3 DSA signature: NOKEY, key ID 37017186

Preparing...                ########################################### [100%]

   1:sysstat                ########################################### [100%]

[root@localhost Server]# rpm -qa |grep setarch

setarch-2.0-1.1

3:vim /etc/hosts   编辑

[root@localhost Server]# vim /etc/hosts

192.168.101.200         myhost.us.mycompany.com myhost

127.0.0.1               localhost.localdomain localhost

::1             localhost6.localdomain6 localhost6

4:Creating Required Operating System Groups and Users

[root@localhost Server]# groupadd dba

[root@localhost Server]# groupadd oinstall

[root@localhost Server]# groupadd oper

5:Creating an Oracle Software Owner User

[root@localhost Server]# useradd -g oinstall -G dba,oper oracle

[root@localhost Server]# passwd oracle

Changing password for user oracle.

New UNIX password:

BAD PASSWORD: it is too simplistic/systematic

Retype new UNIX password:

passwd: all authentication tokens updated successfully.

6:vim /etc/sysctl.conf 添加以下内容:

[root@localhost Server]# vim /etc/sysctl.conf

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 = 1048576

net.core.rmem_max = 1048576

net.core.wmem_default = 262144

net.core.wmem_max = 262144

7:vim /etc/security/limits.conf  添加以下内容:

[root@localhost Server]# vim /etc/security/limits.conf

oracle              soft    nproc   2047

oracle              hard    nproc   16384

oracle              soft    nofile  1024

oracle              hard    nofile  65536

8:vim /etc/pam.d/login   添加以下内容:

[root@localhost Server]# vim /etc/pam.d/login

session    required     /lib/security/pam_limits.so

session    required     pam_limits.so

9:vim /etc/profile   添加以下内容:

if [ $USER = "oracle" ]; then

        if [ $SHELL = "/bin/ksh" ]; then

              ulimit -p 16384

              ulimit -n 65536

        else

              ulimit -u 16384 -n 65536

        fi

fi

10:

[root@localhost Server]# mkdir /u01

[root@localhost Server]# mkdir -p /u01/app/oracle

[root@localhost Server]# chown -R oracle:oinstall /u01/app/oracle

You have mail in /var/spool/mail/root

[root@localhost Server]# chmod -R 755 /u01/app/oracle

[root@localhost Server]# mkdir /u01/flash_recovery_area

[root@localhost Server]# chown -R oracle:oinstall /u01/flash_recovery_area/

[root@localhost Server]# chmod -R 755 /u01/flash_recovery_area/

11:

[root@localhost Server]# su - oracle

[oracle@localhost ~]$ vim .bash_profile

export ORACLE_BASE=/u01/app/oracle

export ORACLE_HOME=/u01/app/oracle/product/10.2.0

export ORACLE_SID=teacher

12:env | grep ORA 若无生效,则需 . .bash_profile

[oracle@localhost ~]$ . .bash_profile

[oracle@localhost ~]$ env | grep ORA

ORACLE_SID=teacher

ORACLE_BASE=/u01/app/oracle

ORACLE_HOME=/u01/app/oracle/product/10.2.0

13:测试图形界面($)

若不成功则:

exit

#xhost local:oracle(后到VM中测试)

[oracle@localhost ~]$ exit

logout

[root@localhost ~]# xclock

wps_clip_image-13314

14:换光盘(ora102forlinux)

[root@myhost ~]# cd /mnt/cdrom/Server/

[root@myhost Server]# rpm -ivh libXp-1.0.0-8.1.el5.i386.rpm

warning: libXp-1.0.0-8.1.el5.i386.rpm: Header V3 DSA signature: NOKEY, key ID 37017186

Preparing...                ########################################### [100%]

   1:libXp                  ########################################### [100%]

[root@myhost ~]# umount /dev/cdrom

[root@myhost ~]# mount /dev/cdrom /mnt/cdrom/

mount: block device /dev/cdrom is write-protected, mounting read-only

15:安装 安装时不选择装数据库

[root@myhost ~]# xhost local:oracle

non-network local connections being added to access control list

[root@myhost ~]# xclock

[root@myhost ~]# su - oracle

[oracle@myhost ~]$ xclock

[oracle@myhost ~]$ /mnt/cdrom/database/runinstaller

wps_clip_image-3846

wps_clip_image-15020

wps_clip_image-17496

wps_clip_image-31084

16:创建监听器

netca

无法使用时,先配置.bash_profile

wps_clip_image-15384

wps_clip_image-1487

wps_clip_image-3370

wps_clip_image-15495 wps_clip_image-17744

wps_clip_image-28871

17:建库 dbca

wps_clip_image-15777

wps_clip_image-18246 wps_clip_image-32746

wps_clip_image-8882

wps_clip_image-11251

密码:dsl123

wps_clip_image-29780

wps_clip_image-1013

wps_clip_image-6961

wps_clip_image-16846

wps_clip_image-3320

wps_clip_image-8875

wps_clip_image-8045

wps_clip_image-17737

wps_clip_image-15932

wps_clip_image-5886

[oracle@myhost ~]$ sqlplus

SQL*Plus: Release 10.2.0.1.0 - Production on Mon May 14 22:02:42 2012

Copyright (c) 1982, 2005, Oracle.  All rights reserved.

Enter user-name: sys as sysdba

Enter password: dsl123

Connected to:

Oracle Database 10g Enterprise Edition Release 10.2.0.1.0 - Production

With the Partitioning, OLAP and Data Mining options

SQL> select * from scott.emp;

  EMPNO ENAME      JOB              MGR HIREDATE         SAL       COMM

---------- ---------- --------- ---------- --------- ---------- ----------

    DEPTNO

----------

      7369 SMITH      CLERK           7902 17-DEC-80        800

        20

      7499 ALLEN      SALESMAN        7698 20-FEB-81       1600        300

       30

      7521 WARD       SALESMAN        7698 22-FEB-81       1250        500

        30

     EMPNO ENAME      JOB              MGR HIREDATE         SAL       COMM

---------- ---------- --------- ---------- --------- ---------- ----------

    DEPTNO

----------

      7566 JONES      MANAGER         7839 02-APR-81       2975

        20

      7654 MARTIN     SALESMAN        7698 28-SEP-81       1250       1400

        30

      7698 BLAKE      MANAGER         7839 01-MAY-81       2850

        30

     EMPNO ENAME      JOB              MGR HIREDATE         SAL       COMM

---------- ---------- --------- ---------- --------- ---------- ----------

    DEPTNO

----------

      7782 CLARK      MANAGER         7839 09-JUN-81       2450

        10

      7788 SCOTT      ANALYST         7566 19-APR-87       3000

        20

      7839 KING       PRESIDENT            17-NOV-81       5000

        10

     EMPNO ENAME      JOB              MGR HIREDATE         SAL       COMM

---------- ---------- --------- ---------- --------- ---------- ----------

    DEPTNO

----------

      7844 TURNER     SALESMAN        7698 08-SEP-81       1500          0

        30

      7876 ADAMS      CLERK           7788 23-MAY-87       1100

        20

      7900 JAMES      CLERK           7698 03-DEC-81        950

        30

     EMPNO ENAME      JOB              MGR HIREDATE         SAL       COMM

---------- ---------- --------- ---------- --------- ---------- ----------

    DEPTNO

----------

      7902 FORD       ANALYST         7566 03-DEC-81       3000

        20

      7934 MILLER     CLERK           7782 23-JAN-82       1300

        10

14 rows selected.

SQL> conn scott

Enter password: tiger

ERROR:tiger

ORA-28001: the password has expired

Changing password for scott

New password:tiger

Retype new password: tiger

Password changed

Connected.

SQL> show user

USER is "SCOTT"

SQL> select * from scott.emp;

  EMPNO ENAME      JOB              MGR HIREDATE         SAL       COMM

---------- ---------- --------- ---------- --------- ---------- ----------

    DEPTNO

----------

      7369 SMITH      CLERK           7902 17-DEC-80        800

        20

      7499 ALLEN      SALESMAN        7698 20-FEB-81       1600        300

        30

      7521 WARD       SALESMAN        7698 22-FEB-81       1250        500

        30

     EMPNO ENAME      JOB              MGR HIREDATE         SAL       COMM

---------- ---------- --------- ---------- --------- ---------- ----------

    DEPTNO

----------

      7566 JONES      MANAGER         7839 02-APR-81       2975

        20

      7654 MARTIN     SALESMAN        7698 28-SEP-81       1250       1400

        30

      7698 BLAKE      MANAGER         7839 01-MAY-81       2850

        30

     EMPNO ENAME      JOB              MGR HIREDATE         SAL       COMM

---------- ---------- --------- ---------- --------- ---------- ----------

    DEPTNO

----------

      7782 CLARK      MANAGER         7839 09-JUN-81       2450

        10

      7788 SCOTT      ANALYST         7566 19-APR-87       3000

        20

      7839 KING       PRESIDENT            17-NOV-81       5000

        10

     EMPNO ENAME      JOB              MGR HIREDATE         SAL       COMM

---------- ---------- --------- ---------- --------- ---------- ----------

    DEPTNO

----------

      7844 TURNER     SALESMAN        7698 08-SEP-81       1500          0

        30

      7876 ADAMS      CLERK           7788 23-MAY-87       1100

        20

      7900 JAMES      CLERK           7698 03-DEC-81        950

        30

     EMPNO ENAME      JOB              MGR HIREDATE         SAL       COMM

---------- ---------- --------- ---------- --------- ---------- ----------

    DEPTNO

----------

      7902 FORD       ANALYST         7566 03-DEC-81       3000

        20

      7934 MILLER     CLERK           7782 23-JAN-82       1300

        10

14 rows selected.

用oracle登陆:

[root@myhost ~]# su - oracle

[oracle@myhost ~]$ lsnrctl status

LSNRCTL for Linux: Version 10.2.0.1.0 - Production on 15-MAY-2012 13:43:08

Copyright (c) 1991, 2005, Oracle.  All rights reserved.

Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=myhost.us.mycompany.com)(PORT=1521)))

STATUS of the LISTENER

------------------------

Alias                     LISTENER

Version                   TNSLSNR for Linux: Version 10.2.0.1.0 - Production

Start Date                14-MAY-2012 20:27:43

Uptime                    0 days 17 hr. 15 min. 25 sec

Trace Level               off

Security                  ON: Local OS Authentication

SNMP                      OFF

Listener Parameter File   /u01/app/oracle/product/10.2.0/network/admin/listener.ora

Listener Log File         /u01/app/oracle/product/10.2.0/network/log/listener.log

Listening Endpoints Summary...  (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=myhost.us.mycompany.com)(PORT=1521)))

  (DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=EXTPROC0)))

Services Summary...

Service "PLSExtProc" has 1 instance(s).

  Instance "PLSExtProc", status UNKNOWN, has 1 handler(s) for this service...

Service "teacher.com" has 1 instance(s).

  Instance "teacher", status READY, has 1 handler(s) for this service...

Service "teacherXDB.com" has 1 instance(s).

  Instance "teacher", status READY, has 1 handler(s) for this service...

Service "teacher_XPT.com" has 1 instance(s).

  Instance "teacher", status READY, has 1 handler(s) for this service...

The command completed successfully

[oracle@myhost ~]$ sqlplus

SQL*Plus: Release 10.2.0.1.0 - Production on Tue May 15 13:44:22 2012

Copyright (c) 1982, 2005, Oracle.  All rights reserved.

Enter user-name: sys as sysdba

Enter password: dsl123

Connected to:

Oracle Database 10g Enterprise Edition Release 10.2.0.1.0 - Production

With the Partitioning, OLAP and Data Mining options

SQL> alter user scott account lock;       把用户锁住

User altered.

SQL> conn scott                       用用户scott登陆

Enter password: tiger

ERROR:

ORA-28000: the account is locked

Warning: You are no longer connected to ORACLE.

SQL> show user

USER is ""              用户为空

SQL> conn sys as sysdba

Enter password: dsl123

Connected.

SQL> alter user scott account unlock;          把用户解锁

User altered.

SQL> conn scott

Enter password: tiger

Connected.

管理员登陆页面:

wps_clip_image-17537

更改密码:

SQL> conn sys as sysdba    必须要用sys登陆更改

Enter password: dsl123

Connected.

SQL> alter user hr identified by hr123;

User altered.

SQL> conn hr

Enter password: hr123

Connected.

SQL>

普通用户登陆页面:

[oracle@myhost ~]$ isqlplusctl start  启动

iSQL*Plus 10.2.0.1.0

Copyright (c) 2003, 2005, Oracle.  All rights reserved.

getnameinfo failed

Starting iSQL*Plus ...

iSQL*Plus started.

wps_clip_image-7904

不用安装ORACLE客户端(不执行*.exe)安装PL/SQL Developer的说明

具体过程:

下载程序包:instantclient-basic-win32-10.2.0.3-20061115并解压到一个盘下

安装ORACLE客户端

     客户端的安装很简单,即将下载的Oracle Client Package程序包压缩文件,解压到指定的文件夹即可(例如:F:\实训\数据库\soft)

新建sqlnet.ora和tnsnames.ora文件

在ORACEL客户端安装文件夹下新建sqlnet.ora和tnsnames.ora,并配置相关内容

(F:\实训\数据库\soft\instantclient-basic-win32-10.2.0.3-20061115\instantclient_10_2)

sqlnet.ora文件内容一般为:

SQLNET.AUTHENTICATION_SERVICES= (NTS)
NAMES.DIRECTORY_PATH= (TNSNAMES, EZCONNECT)

tnsnames.ora文件内容:

[oracle@myhost ~]$ cd /u01/app/oracle/

[oracle@myhost oracle]$ cd product

[oracle@myhost product]$ ls

10.2.0

[oracle@myhost product]$ cd 10.2.0/

[oracle@myhost 10.2.0]$ cd network

[oracle@myhost network]$ ls

admin  doc  install  jlib  lib  log  mesg  tools  trace

[oracle@myhost network]$ cd admin

[oracle@myhost admin]$ ls

listener.ora  samples  shrept.lst  tnsnames.ora

[oracle@myhost admin]$ cat tnsnames.ora  查看这个文件并复制到tnsnames.ora文档中

TEACHER =

  (DESCRIPTION =

    (ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.101.200)(PORT = 1521))

    (CONNECT_DATA =

      (SERVER = DEDICATED)

      (SERVICE_NAME = teacher.com)

    )

  )

EXTPROC_CONNECTION_DATA =

  (DESCRIPTION =

    (ADDRESS_LIST =

      (ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC0))

    )

    (CONNECT_DATA =

      (SID = PLSExtProc)

      (PRESENTATION = RO)

    )

  )

配置环境变量

主要设置系统两个变量TNS_ADMIN和NLS_LANG

TNS_ADMIN =F:\实训\数据库\soft\instantclient-basic-win32-10.2.0.3-20061115\instantclient_10_2

NLS_LANG = SIMPLIFIED CHINESE_CHINA.ZHS16GBK

wps_clip_image-11954

wps_clip_image-1761

安装pl/sql软件

把( [PLSQL.Developer].PLSQL.Developer.7 )这个文件解压打开zwt.nfo (其中含有机器码 KF466HV42UACYYEBR82Y6JB4JVNHWH)然后再安装setup.exe需要用到:

wps_clip_image-31253

wps_clip_image-13605

配置pl/sql的Oracle连接参数:

选择pl/sql的工具/首选项(tool/ preference/)里的连接,在右面设置Oracle主目录名(即安装目录)和OCI库。

Oracle主目录名: F:\实训\数据库\soft\instantclient-basic-win32-10.2.0.3-20061115\instantclient_10_2
OCI库: F:\实训\数据库\soft\instantclient-basic-win32-10.2.0.3-20061115\instantclient_10_2\oci.dll

wps_clip_image-28190

wps_clip_image-19492

wps_clip_image-246

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章