Objectives:

•Describe your role as a database administrator (DBA) and explain typical tasks and tools

The approach for designing, implementing, and maintaining an Oracle database involves the following tasks:
1. Evaluating the database server hardware
2. Installing the Oracle software
3. Planning the database and security strategy
4. Creating, migrating, and opening the database
5. Backing up the database
6. Enrolling system users and planning for their Oracle Network access
7. Implementing the database design
8. Recovering from database failure
9. Monitoring database performance

Tools:
1.Oracle Universal Installer(OUI)
2.Database Configuration Assistant(DBCA)
3.Database Upgrade Assistant(DBUA)
4.Oracle Net Manager(netmgr)
5.Oracle Net Configuration Assistant(NetCA)
6.Oracle Enterprise Manager(EM)
7.Server Control Utility(srvctl)
8.SQL*Plus
9.Recovery Manager(RMAN)
10.Data Pump
11.SQL*Loader
12.Command-line tools:
emctl start | status | stop dbconsole
lsnrctl start | status | stop

Plan an Oracle software installation
•Install Oracle Grid Infrastructure for a standalone server
Install the Oracle database software

安装Linux

虚拟机配置:删除打印机,USB等
硬盘:40G
三个5G

分区:定制分区
/ 8000
/boot 512
/tmp 4096
/swap 4096
/u01 (所有其余的空间)

软件包选取:
Development--Development Tools/ gcc开头的
Services--FTP Server
Language--Chine Support

Firewall: Disabled
SELinux:Disabled
Do not create users

chkconfig --del sendmail

安装VMware工具
cd /media
ls
cd VMware Tools
ls
cp VMware+tab /mnt
cd /mnt
tar -zxvf VMware+tab
cd vm+tab
./vmware-install.pl

安装Grid
xhost +
su - grid
cd /u01/app/grid/grid
./runInstaller

DATA
External /dev/raw/raw1

cd /media/
cd RHEL_5.5\ x86_64\ DVD/
cd /Server

rpm -ivh *.* --nodeps(安装缺失的3个包,然后重新检测)

ctl+a
ctl+e分别到每一行的首部和尾部

su - grid
crs_stat -t

安装Oracle数据库
Installation Option: Install database software only

dbca配置数据库
dbca

Storage Type: File System
Sample Schemas

如果需要添加asm
su - grid
asmca

linux下cpio.gz文件的解压方法linux解压cpiocpio.gz
今天下载了 10201_database_linux_x86_64.cpio.gz 文件,解压方法如下:
1. gunzip 10201_database_linux_x86_64.cpio.gz
得到10201_database_linux_x86_64.cpio文件
2. cpio -idmv <10201_database_linux_x86_64.cpio
即可在当前目录下解压出来

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

第三步、配置Linux系统环境和oracle用户环境变量

对于Oracle软件在Linux 5系统下的安装,需要用户提前在Linux系统下做一些配置,从而满足安装Oracle软件的基本需求。

以下0、1、2、3、4步使用root用户,第5和6步使用分别使用grid用户和oracle用户

0.要配置/etc/hosts 添加ip地址、 主机,否则grid的netca配置的时候会报错。

[root@instuctor ~]# vi /etc/hosts

# Do not remove the following line, or various programs

# that require network functionality will fail.

127.0.0.1      localhost.localdomain localhost

192.168.1.60    student

 

1.创建oracle用户和组

/usr/sbin/groupadd -g 501 oinstall

/usr/sbin/groupadd -g 502 dba

/usr/sbin/groupadd -g 503 oper

/usr/sbin/groupadd -g 504 asmadmin

/usr/sbin/groupadd -g 505 asmoper

/usr/sbin/groupadd -g 506 asmdba

/usr/sbin/useradd -g oinstall -G dba,asmdba,oper oracle

/usr/sbin/useradd -g oinstall -G asmadmin,asmdba,asmoper,oper,dba grid

passwd grid

passwd oracle

 

2.创建安装grid软件和oracle软件的目录,并授予相应的权限

mkdir -p /u01/app/oracle/product/11.2.0/db

mkdir -p /u01/app/grid/product/11.2.0/grid

chown -R oracle:oinstall /u01/app/

chown -R grid:oinstall /u01/app/grid

chmod -R 775 /u01/

 

3.配置系统文件和进程限制,配置内核参数

cat >> /etc/security/limits.conf <<EOF

#ORACLE SETTING

grid                 soft    nproc   2047

grid                 hard    nproc   16384

grid                 soft    nofile  1024

grid                 hard    nofile  65536

oracle               soft    nproc   2047

oracle               hard    nproc   16384

oracle               soft    nofile  1024

oracle               hard    nofile  65536

EOF

 

cat >>/etc/pam.d/login<<EOF

#ORACLE SETTING

session    required     pam_limits.so

EOF

 

cat >>/etc/sysctl.conf<<EOF

#ORACLE SETTING

fs.aio-max-nr = 1048576

fs.file-max = 6815744

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

EOF

 

使配置的内核参数生效,使用sysctl -p命令

sysctl -p

 

4.关闭NTP服务和删除NTP配置文件

grid时间同步所需要的设置

Network Time Protocol Setting

/sbin/service ntpd stop

chkconfig ntpd off

rm /etc/ntp.conf

 

or, mv /etc/ntp.conf to /etc/ntp.conf.org.

5.用户grid的环境变量的设置

grid 用户配置文件 ORACLE_HOSTNAME请自行设置,这个配置使用grid用户

#su - grid

$vi .bash_profile

export LD_ASSUME_KERNEL=2.6.18

export TMP=/tmp

export TMPDIR=$TMP

export ORACLE_HOSTNAME=student

export ORACLE_BASE=/u01/app/grid

export ORACLE_HOME=$ORACLE_BASE/product/11.2.0/grid

export ORACLE_SID=+ASM

export ORACLE_TERM=xterm

export PATH=$PATH:$ORACLE_HOME/bin

umask 022

if [ $USER = "oracle" ] || [ $USER = "grid" ]; then

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

              ulimit -p 16384

              ulimit -n 65536

        else

              ulimit -u 16384 -n 65536

        fi

        umask 022

fi

使用source命令是环境变量生效

source  .bash_profile

6.用户oracle的环境变量的设置

oracle用户配置文件 ORACLE_HOSTNAME请自行设置,这个配置使用oacle用户

#su - oracle

$vi .bash_profile

# Oracle Settings oracle

export LD_ASSUME_KERNEL=2.6.18

export TMP=/tmp

export TMPDIR=$TMP

export ORACLE_HOSTNAME=student

export ORACLE_BASE=/u01/app/oracle

export ORACLE_HOME=$ORACLE_BASE/product/11.2.0/db

export ORACLE_SID=db01

export ORACLE_TERM=xterm

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

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

export PATH=/usr/sbin:$PATH

export PATH=$ORACLE_HOME/bin:$PATH

if [ $USER = "oracle" ] || [ $USER = "grid" ]; then

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

              ulimit -p 16384

              ulimit -n 65536

        else

              ulimit -u 16384 -n 65536

        fi

        umask 022

fi

使用source使环境变量立即生效

source  .bash_profile

第四步、安装和配置ASM

关闭虚拟机,添加硬盘sdb、sdc和sdd,大小都是3G,启动虚拟机,使用fdisk对添加的硬盘分区,使用wincp上传相应内核的asmlib软件到服务器,并安装

[root@stu1 asm]# fdisk /dev/sdb

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.

 

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): 1

First cylinder (1-391, default 1):

Using default value 1

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

Using default value 391

 

Command (m for help): w

The partition table has been altered!

 

Calling ioctl() to re-read partition table.

Syncing disks.

[root@stu1 asm]# fdisk /dev/sdc

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.

 

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): 1

First cylinder (1-391, default 1):

Using default value 1

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

Using default value 391

 

Command (m for help): w

The partition table has been altered!

 

Calling ioctl() to re-read partition table.

Syncing disks.

[root@stu1 asm]# fdisk /dev/sdd

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.

 

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): 1

First cylinder (1-391, default 1):

Using default value 1

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

Using default value 391

 

Command (m for help): w

The partition table has been altered!

 

Calling ioctl() to re-read partition table.

Syncing disks.

 

[root@stu1 asm]# ll

oracleasm-2.6.18-194.el5-2.0.5-1.el5.x86_64.rpm

oracleasmlib-2.0.4-1.el5.x86_64.rpm

oracleasm-support-2.1.7-1.el5.x86_64.rpm

 

[root@stu1 asm]# rpm -Uvh *.rpm

warning: oracleasm-2.6.18-194.el5-2.0.5-1.el5.x86_64.rpm: Header V3 DSA signature: NOKEY, key ID 1e5e0159

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

   1:oracleasm-support      ################################## [ 33%]

   2:oracleasm-2.6.18-194.el################################## [ 67%]

   3:oracleasmlib           ################################## [100%]

[root@stu1 asm]# /etc/init.d/oracleasm configure

Configuring the Oracle ASM library driver.

 

This will configure the on-boot properties of the Oracle ASM library

driver.  The following questions will determine whether the driver is

loaded on boot and what permissions it will have.  The current values

will be shown in brackets ('[]').  Hitting <ENTER> without typing an

answer will keep that current value.  Ctrl-C will abort.

 

Default user to own the driver interface []: grid

Default group to own the driver interface []: asmadmin

Start Oracle ASM library driver on boot (y/n) [n]: y

Scan for Oracle ASM disks on boot (y/n) [y]: y

Writing Oracle ASM library driver configuration: done

Initializing the Oracle ASMLib driver: [  OK  ]

Scanning the system for Oracle ASMLib disks: [  OK  ]

[root@stu1 asm]#

[root@stu1 asm]# /etc/init.d/oracleasm createdisk VOL1 /dev/sdb1

Marking disk "VOL1" as an ASM disk: [  OK  ]

[root@stu1 asm]# /etc/init.d/oracleasm createdisk VOL2 /dev/sdc1

Marking disk "VOL2" as an ASM disk: [  OK  ]

[root@stu1 asm]# /etc/init.d/oracleasm createdisk VOL3 /dev/sdd1

Marking disk "VOL3" as an ASM disk: [  OK  ]

[root@stu1 asm]# /etc/init.d/oracleasm scandisks

Scanning the system for Oracle ASMLib disks: [  OK  ]

[root@stu1 asm]# /etc/init.d/oracleasm listdisks

VOL1

VOL2

VOL3

第五步、安装grid软件

第六步、添加磁盘组fradata

第七部、安装oracle软件

第八步、使用dbca创建数据库库

posted on 2013-10-08 20:44  逝者如斯(乎)  阅读(410)  评论(0编辑  收藏  举报