Chinaunix首页 | 论坛 | 博客
  • 博客访问: 296262
  • 博文数量: 60
  • 博客积分: 1437
  • 博客等级: 中尉
  • 技术积分: 632
  • 用 户 组: 普通用户
  • 注册时间: 2011-02-10 14:12
文章存档

2012年(7)

2011年(53)

分类: Oracle

2011-02-13 14:04:48

目录

5.编辑/etc/security/limits.conf文件... 9

安装相关系统包

[root@taolin ~]# umount /mnt

[root@taolin ~]# df -h

Filesystem            Size  Used Avail Use% Mounted on

/dev/hda3             6.7G  2.4G  4.1G  37% /

/dev/hda1              99M  9.8M   84M  11% /boot

tmpfs                 125M     0  125M   0% /dev/shm

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

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

[root@taolin ~]# df -h

Filesystem            Size  Used Avail Use% Mounted on

/dev/hda3             6.7G  2.4G  4.1G  37% /

/dev/hda1              99M  9.8M   84M  11% /boot

tmpfs                 125M     0  125M   0% /dev/shm

/dev/hdc              2.7G  2.7G     0 100% /mnt

[root@taolin ~]# cd /mnt/Server/

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

setarch-2.0-1.1

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

make-3.81-1.1

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

glibc-2.5-12

glibc-common-2.5-12

[root@taolin Server]# rpm -qa|grep libaio

libaio-0.3.106-3.2

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

[root@taolin Server]# rpm -ivh compat-libstdc++-

compat-libstdc++-296-2.96-138.i386.rpm  compat-libstdc++-33-3.2.3-61.i386.rpm  

[root@taolin Server]# rpm -ivh compat-libstdc++-33-3.2.3-61.i386.rpm

warning: compat-libstdc++-33-3.2.3-61.i386.rpm: Header V3 DSA signature: NOKEY, key ID 37017186

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

   1:compat-libstdc++-33    ########################################### [100%]

[root@taolin Server]# rpm -qa|grep compat-gcc-34

[root@taolin Server]# rpm -ivh compat-gcc-34-3.4.6-4.i386.rpm

warning: compat-gcc-34-3.4.6-4.i386.rpm: Header V3 DSA signature: NOKEY, key ID 37017186

error: Failed dependencies:

        glibc-devel >= 2.2.90-12 is needed by compat-gcc-34-3.4.6-4.i386

[root@taolin Server]# rpm -ivh glibc-devel-2.5-12.i386.rpm

warning: glibc-devel-2.5-12.i386.rpm: Header V3 DSA signature: NOKEY, key ID 37017186

error: Failed dependencies:

        glibc-headers is needed by glibc-devel-2.5-12.i386

        glibc-headers = 2.5-12 is needed by glibc-devel-2.5-12.i386

[root@taolin Server]# rpm -ivh glibc-devel-2.5-12.i386.rpm  glibc-headers-2.5-12.i386.rpm

warning: glibc-devel-2.5-12.i386.rpm: Header V3 DSA signature: NOKEY, key ID 37017186

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

   1:glibc-headers          ########################################### [ 50%]

   2:glibc-devel            ########################################### [100%]

[root@taolin Server]# rpm -ivh compat-gcc-34-3.4.6-4.i386.rpm

warning: compat-gcc-34-3.4.6-4.i386.rpm: Header V3 DSA signature: NOKEY, key ID 37017186

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

   1:compat-gcc-34          ########################################### [100%]

[root@taolin Server]# rpm -ivh compat-gcc-34-c++-3.4.6-4.i386.rpm

warning: compat-gcc-34-c++-3.4.6-4.i386.rpm: Header V3 DSA signature: NOKEY, key ID 37017186

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

   1:compat-gcc-34-c++      ########################################### [100%]

[root@taolin Server]# rpm -ivh gcc-4.1.1-52.el5.i386.rpm

warning: gcc-4.1.1-52.el5.i386.rpm: Header V3 DSA signature: NOKEY, key ID 37017186

error: Failed dependencies:

        libgomp = 4.1.1-52.el5 is needed by gcc-4.1.1-52.el5.i386

        libgomp.so.1 is needed by gcc-4.1.1-52.el5.i386

[root@taolin Server]# rpm -ivh libgomp-4.1.1-52.el5.i386.rpm

warning: libgomp-4.1.1-52.el5.i386.rpm: Header V3 DSA signature: NOKEY, key ID 37017186

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

   1:libgomp                ########################################### [100%]

[root@taolin Server]# rpm -ivh gcc-4.1.1-52.el5.i386.rpm

warning: gcc-4.1.1-52.el5.i386.rpm: Header V3 DSA signature: NOKEY, key ID 37017186

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

   1:gcc                    ########################################### [100%]

[root@taolin Server]# rpm -qa|grep libXp

libXpm-3.5.5-3

[root@taolin Server]# rpm -ivh libXp-

libXp-1.0.0-8.i386.rpm        libXp-devel-1.0.0-8.i386.rpm 

[root@taolin Server]# rpm -ivh libXp-1.0.0-8.i386.rpm

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

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

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

[root@taolin Server]# rpm -qa|grep openmotif

[root@taolin Server]# rpm -ivh openmotif-2.3.0-0.3.el5.i386.rpm

warning: openmotif-2.3.0-0.3.el5.i386.rpm: Header V3 DSA signature: NOKEY, key ID 37017186

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

   1:openmotif              ########################################### [100%]

[root@taolin 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@taolin Server]# groupadd oinstall

[root@taolin Server]# groupadd dba

[root@taolin Server]# useradd -g oinstall -G dba oracle

[root@taolin Server]# pwaaswd oracle

-bash: pwaaswd: command not found

[root@taolin Server]# passwd oracle

Changing password for user oracle.

New UNIX password:

BAD PASSWORD: it is based on a dictionary word

Retype new UNIX password:

passwd: all authentication tokens updated successfully.

添加存储空间

[root@taolin ~]# fdisk –l

 

Disk /dev/hda: 8589 MB, 8589934592 bytes

255 heads, 63 sectors/track, 1044 cylinders

Units = cylinders of 16065 * 512 = 8225280 bytes

 

   Device Boot      Start         End      Blocks   Id  System

/dev/hda1   *           1          13      104391   83  Linux

/dev/hda2              14         144     1052257+  82  Linux swap / Solaris

/dev/hda3             145        1044     7229250   83  Linux

 

Disk /dev/hdb: 12.8 GB, 12884901888 bytes

15 heads, 63 sectors/track, 26630 cylinders

Units = cylinders of 945 * 512 = 483840 bytes

 

Disk /dev/hdb doesn't contain a valid partition table

[root@taolin ~]# fdisk /dev/hdb

Device contains neither a valid DOS partition table, nor Sun, SGI or OSF disklabel

Building a new DOS disklabel. Changes will remain in memory only,

until you decide to write them. After that, of course, the previous

content won't be recoverable.

 

 

The number of cylinders for this disk is set to 26630.

There is nothing wrong with that, but this is larger than 1024,

and could in certain setups cause problems with:

1) software that runs at boot time (e.g., old versions of LILO)

2) booting and partitioning software from other OSs

   (e.g., DOS FDISK, OS/2 FDISK)

Warning: invalid flag 0x0000 of partition table 4 will be corrected by w(rite)

 

Command (m for help): n

Command action

   e   extended

   p   primary partition (1-4)

p

Partition number (1-4): w

Partition number (1-4): 1

First cylinder (1-26630, default 1):

Using default value 1

Last cylinder or +size or +sizeM or +sizeK (1-26630, default 26630):

Using default value 26630

 

Command (m for help): p

 

Disk /dev/hdb: 12.8 GB, 12884901888 bytes

15 heads, 63 sectors/track, 26630 cylinders

Units = cylinders of 945 * 512 = 483840 bytes

 

   Device Boot      Start         End      Blocks   Id  System

/dev/hdb1               1       26630    12582643+  83  Linux

 

Command (m for help): w

The partition table has been altered!

 

Calling ioctl() to re-read partition table.

Syncing disks.

[root@taolin ~]# mkfs.ext3 /dev/hdb1

mke2fs 1.39 (29-May-2006)

Filesystem label=

OS type: Linux

Block size=4096 (log=2)

Fragment size=4096 (log=2)

1572864 inodes, 3145660 blocks

157283 blocks (5.00%) reserved for the super user

First data block=0

Maximum filesystem blocks=3221225472

96 block groups

32768 blocks per group, 32768 fragments per group

16384 inodes per group

Superblock backups stored on blocks:

        32768, 98304, 163840, 229376, 294912, 819200, 884736, 1605632, 2654208

 

Writing inode tables: done                           

Creating journal (32768 blocks): done

Writing superblocks and filesystem accounting information: done

 

This filesystem will be automatically checked every 25 mounts or

180 days, whichever comes first.  Use tune2fs -c or -i to override.

[root@taolin ~]# mkdir /u01

[root@taolin ~]# mount /dev/hdb1 /u01

[root@taolin ~]# df -h

Filesystem            Size  Used Avail Use% Mounted on

/dev/hda3             6.7G  2.4G  4.0G  38% /

/dev/hda1              99M  9.8M   84M  11% /boot

tmpfs                 298M     0  298M   0% /dev/shm

/dev/hdb1              12G  159M   12G   2% /u01

[root@taolin ~]# vi /etc/fstab

[root@taolin ~]# cat /etc/fstab

LABEL=/                 /                       ext3    defaults        1 1

LABEL=/boot             /boot                   ext3    defaults        1 2

devpts                  /dev/pts                devpts  gid=5,mode=620  0 0

tmpfs                   /dev/shm                tmpfs   defaults        0 0

proc                    /proc                   proc    defaults        0 0

sysfs                   /sys                    sysfs   defaults        0 0

LABEL=SWAP-hda2         swap                    swap    defaults        0 0

/dev/hdb1               /u01                    ext3    defaults        0 0

[root@taolin ~]# mkdir -p /u01/app/oracle/product/10.2.0/db_1

[root@taolin ~]# chown -R oracle:oinstall /u01

[root@taolin ~]#

设置内核参数

#sysctl -p 使之生效

kernel.shmmni = 4096

# semaphores: semmsl, semmns, semopm, semmni

kernel.sem = 250 32000 100 128

fs.file-max = 65536

net.ipv4.ip_local_port_range = 1024 65000

net.core.rmem_default=262144

net.core.rmem_max=262144

net.core.wmem_default=262144

net.core.wmem_max=262144

编辑/etc/security/limits.conf文件

添加如下内容:

*               soft    nproc   2047

*               hard    nproc   16384

*               soft    nofile  1024

*               hard    nofile  65536

编辑/etc/pam.d/login文件

添加如下内容:

session    required     /lib/security/pam_limits.so

如果有这个selinux,则禁用之:

[root@taolin ~]# cat /etc/selinux/config

# This file controls the state of SELinux on the system.

# SELINUX= can take one of these three values:

#       enforcing - SELinux security policy is enforced.

#       permissive - SELinux prints warnings instead of enforcing.

#       disabled - SELinux is fully disabled.

SELINUX=disabled

# SELINUXTYPE= type of policy in use. Possible values are:

#       targeted - Only targeted network daemons are protected.

#       strict - Full SELinux protection.

SELINUXTYPE=targeted

[root@taolin ~]#

编辑oracle用户的.bash_profile文件

添加如下内容:

# Oracle Settings

TMP=/tmp; export TMP

TMPDIR=$TMP; export TMPDIR

 

ORACLE_BASE=/u01/app/oracle; export ORACLE_BASE

ORACLE_HOME=$ORACLE_BASE/product/10.2.0/db_1; export ORACLE_HOME

ORACLE_SID=nico1; export ORACLE_SID

ORACLE_TERM=xterm; export ORACLE_TERM

PATH=/usr/sbin:$PATH; export PATH

PATH=$ORACLE_HOME/bin:$PATH; export PATH

 

LD_LIBRARY_PATH=$ORACLE_HOME/lib:/lib:/usr/lib; export LD_LIBRARY_PATH

CLASSPATH=$ORACLE_HOME/JRE:$ORACLE_HOME/jlib:$ORACLE_HOME/rdbms/jlib; export CLASSPATH

 

if [ $USER = "oracle" ]; then

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

    ulimit -p 16384

    ulimit -n 65536

  else

    ulimit -u 16384 -n 65536

  fi

fi

编辑/etc/redhat-release文件

5改为4

[root@taolin ~]# cat /etc/redhat-release

Red Hat Enterprise Linux Server release 4 (Tikanga)

 

 

开始安装

[oracle@taolin database]$ ./runInstaller -silent   \

> -responseFile /u01/10g/db/database/response/enterprise.rsp \

> ORACLE_HOME=/u01/app/oracle/product/10.2.0/db_1 \

> ORACLE_HOME_NAME=OraDb10g_home1                 \

> n_configurationOption=3

 

注意:

指定的目录要是空的,否则会报如下错误:

SEVERE:OUI-10029:You have specified a non-empty directory to install this product. It is recommended to specify either an empty or a non-existent directory. You may, however, choose to ignore this message if the directory contains Operating System generated files or subdirectories like lost+found.

报这个错误的时候,只需要删除相应目录中的文件及目录即可!

 

安装完成后,提示你运行相关脚本:

… …

Installation in progress (Sun Sep 27 21:06:43 CST 2009)

...............................................................  18% Done.

...............................................................  36% Done.

...............................................................  54% Done.

...............................................................  73% Done.

............                                                     76% Done.

Install successful

 

Linking in progress (Sun Sep 27 21:08:10 CST 2009)

Link successful

 

Setup in progress (Sun Sep 27 21:09:02 CST 2009)

..............                                                  100% Done.

Setup successful

 

End of install phases.(Sun Sep 27 21:09:07 CST 2009)

WARNING:A new inventory has been created in this session. However, it has not yet been registered as the central inventory of this system.

To register the new inventory please run the script '/u01/app/oracle/oraInventory/orainstRoot.sh' with root privileges.

If you do not register the inventory, you may not be able to update or patch the products you installed.

 

The following configuration scripts

/u01/app/oracle/product/10.2.0/db_1/root.sh

need to be executed as root for configuring the system. If you skip the execution of the configuration tools, the configuration will not be complete and the product wont function properly. In order to get the product to function properly, you will be required to execute the scripts and the configuration tools after exiting the OUI.

 

The installation of Oracle Database 10g was successful.

Please check '/u01/app/oracle/oraInventory/logs/silentInstall2009-09-27_09-06-32PM.log' for more details.

 

运行相关脚本:

[root@taolin ~]# /u01/app/oracle/oraInventory/orainstRoot.sh

Changing permissions of /u01/app/oracle/oraInventory to 770.

Changing groupname of /u01/app/oracle/oraInventory to oinstall.

The execution of the script is complete

[root@taolin ~]# /u01/app/oracle/product/10.2.0/db_1/root.sh

Running Oracle10 root.sh script...

 

The following environment variables are set as:

    ORACLE_OWNER= oracle

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

 

Enter the full pathname of the local bin directory: [/usr/local/bin]:

   Copying dbhome to /usr/local/bin ...

   Copying oraenv to /usr/local/bin ...

   Copying coraenv to /usr/local/bin ...

 

 

Creating /etc/oratab file...

Entries will be added to the /etc/oratab file as needed by

Database Configuration Assistant when a database is created

Finished running generic part of root.sh script.

Now product-specific root actions will be performed.

[root@taolin ~]#

 

至此RDBMS软件安装完成:

[oracle@taolin database]$ sqlplus /nolog

 SQL*Plus: Release 10.2.0.1.0 - Production on Sun Sep 27 21:13:16 2009

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

 SQL>

升级至10.2.0.4

./runInstaller -silent \

> -responseFile/u01/10g/patch/Disk1/response/patchset.rsp \

> ORACLE_HOME=$ORACLE_HOME \

> ORACLE_HOME_NAME=OraDb10g_home1

 

… …

Deinstall in progress (Sunday, September 27, 2009 9:18:45 PM CST)

...............................................................   0% Done.

...............................................................  18% Done.

...............................................................  37% Done.

...............................................................  56% Done.

...............................................................  75% Done.

.................                                               100% Done.

 

Deinstall successful

 

Installation in progress (Sunday, September 27, 2009 9:18:45 PM CST)

...............................................................  18% Done.

...............................................................  37% Done.

...............................................................  56% Done.

...............................................................  75% Done.

........................................                         87% Done.

Install successful

 

Linking in progress (Sunday, September 27, 2009 9:20:09 PM CST)

..                                                               88% Done.

Link successful

 

Setup in progress (Sunday, September 27, 2009 9:20:55 PM CST)

........                                                        100% Done.

Setup successful

 

End of install phases.(Sunday, September 27, 2009 9:20:59 PM CST)

WARNING:

The following configuration scripts need to be executed as the "root" user.

#!/bin/sh

#Root script to run

/u01/app/oracle/product/10.2.0/db_1/root.sh

To execute the configuration scripts:

    1. Open a terminal window

    2. Log in as "root"

    3. Run the scripts

 

The installation of Oracle Database 10g Release 2 Patch Set 3 was successful.

Please check '/u01/app/oracle/oraInventory/logs/silentInstall2009-09-27_09-18-28PM.log' for more details.

 

[oracle@taolin Disk1]$

提示运行root.sh脚本:

[root@taolin ~]# /u01/app/oracle/product/10.2.0/db_1/root.sh

Running Oracle10 root.sh script...

 

The following environment variables are set as:

    ORACLE_OWNER= oracle

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

 

Enter the full pathname of the local bin directory: [/usr/local/bin]:

   Copying dbhome to /usr/local/bin ...

   Copying oraenv to /usr/local/bin ...

   Copying coraenv to /usr/local/bin ...

 

 

Creating /etc/oratab file...

Entries will be added to the /etc/oratab file as needed by

Database Configuration Assistant when a database is created

Finished running generic part of root.sh script.

Now product-specific root actions will be performed.

[root@taolin ~]# /u01/app/oracle/product/10.2.0/db_1/root.sh

Running Oracle10 root.sh script...

 

The following environment variables are set as:

    ORACLE_OWNER= oracle

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

 

Enter the full pathname of the local bin directory: [/usr/local/bin]:

The file "dbhome" already exists in /usr/local/bin.  Overwrite it? (y/n)

[n]: y

   Copying dbhome to /usr/local/bin ...

The file "oraenv" already exists in /usr/local/bin.  Overwrite it? (y/n)

[n]: y

   Copying oraenv to /usr/local/bin ...

The file "coraenv" already exists in /usr/local/bin.  Overwrite it? (y/n)

[n]: y

   Copying coraenv to /usr/local/bin ...

 

Entries will be added to the /etc/oratab file as needed by

Database Configuration Assistant when a database is created

Finished running generic part of root.sh script.

Now product-specific root actions will be performed.

[root@taolin ~]#

 

至此,数据库已经升级至10.2.0.4

[oracle@taolin Disk1]$ sqlplus /nolog

 SQL*Plus: Release 10.2.0.4.0 - Production on Sun Sep 27 21:25:30 2009

 Copyright (c) 1982, 2007, Oracle.  All Rights Reserved.

 SQL>

 

模式创建数据库

[root@taolin ~]# locate General_Purpose.dbc

/u01/app/oracle/product/10.2.0/db_1/assistants/dbca/templates/General_Purpose.dbc

[root@taolin ~]# cd /u01/app/oracle/product/10.2.0/db_1/assistants/dbca/templates/

[root@taolin templates]# ll

total 114104

-rw-r--r-- 1 oracle oinstall     5728 Feb 17  2008 Data_Warehouse.dbc

-rw-r--r-- 1 oracle oinstall 13017088 Feb 17  2008 example01.dfb

-rw-r--r-- 1 oracle oinstall  1048576 Feb 17  2008 example.dmp

-rw-r--r-- 1 oracle oinstall     5608 Feb 17  2008 General_Purpose.dbc

-rw-r--r-- 1 oracle oinstall    12050 Aug 18  2006 New_Database.dbt

-rw-r--r-- 1 oracle oinstall  7061504 Feb 17  2008 Seed_Database.ctl

-rw-r--r-- 1 oracle oinstall 95543296 Feb 17  2008 Seed_Database.dfb

-rw-r--r-- 1 oracle oinstall     5665 Feb 17  2008 Transaction_Processing.dbc

 

[oracle@taolin ~]$ dbca -silent –createDatabase \

> -templatename General_Purpose.dbc   \

> -gdbname nico1 -sid nico1            \

> -SysPassword oracle -SystemPassword oracle \

> -emConfiguration NONE  \

> -characterSet ZHS16GBK

Copying database files

1% complete

3% complete

11% complete

18% complete

26% complete

37% complete

Creating and starting Oracle instance

40% complete

45% complete

50% complete

55% complete

56% complete

60% complete

62% complete

Completing Database Creation

66% complete

70% complete

73% complete

85% complete

96% complete

100% complete

Look at the log file "/u01/app/oracle/product/10.2.0/db_1/cfgtoollogs/dbca/nico1/nico1.log" for further details.

[oracle@taolin ~]$

 

升级数据库

    很多情况下,我们的数据库是在10.2.0.1下就创建好了的,这个时候,升级RDBMS的时候只要停止相关服务即可,比如:数据库、监听器、EMisqlplus等,停止完后,升级的方法和安装后升级一样。

    对于数据库,我们使用DBUA来升级,过程如下:

[oracle@nicodb1 ~]$ dbua -silent -dbname $ORACLE_SID \

> -oracleHome $ORACLE_HOME -sysDBAUserName sys \

> -sysDBAPassword admin -recompile_invalid_objects true

Log files for the upgrade operation are located at: /u01/app/oracle/product/10.2.0/db_1/cfgtoollogs/dbua/db1/upgrade

Performing Pre Upgrade

1% complete

7% complete

Upgrading Oracle Server

8% complete

9% complete

10% complete

10% complete

11% complete

12% complete

13% complete

13% complete

14% complete

15% complete

16% complete

16% complete

17% complete

18% complete

19% complete

20% complete

20% complete

21% complete

22% complete

23% complete

23% complete

24% complete

Upgrading JServer JAVA Virtual Machine

26% complete

26% complete

27% complete

28% complete

29% complete

30% complete

Upgrading Oracle XDK for Java

31% complete

32% complete

Upgrading Oracle Java Packages

33% complete

Upgrading Oracle Text

35% complete

Upgrading Oracle XML Database

36% complete

37% complete

38% complete

39% complete

Upgrading Oracle Workspace Manager

40% complete

Upgrading Oracle Data Mining

42% complete

43% complete

43% complete

44% complete

Upgrading OLAP Analytic Workspace

46% complete

Upgrading OLAP Catalog

47% complete

48% complete

49% complete

50% complete

50% complete

51% complete

Upgrading Oracle OLAP API

53% complete

53% complete

54% complete

Upgrading Oracle interMedia

56% complete

56% complete

57% complete

58% complete

59% complete

Upgrading Spatial

60% complete

61% complete

62% complete

Upgrading Expression Filter

63% complete

Upgrading EM Repository

65% complete

66% complete

66% complete

67% complete

68% complete

69% complete

70% complete

70% complete

Upgrading Rule Manager

72% complete

Performing Post Upgrade

73% complete

84% complete

85% complete

86% complete

86% complete

92% complete

Generating Summary

Database upgrade has been completed successfully, and the database is ready to use.

100% complete

Check the log file "/u01/app/oracle/product/10.2.0/db_1/cfgtoollogs/dbua/logs/silent.log" for upgrade details.

阅读(3719) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~