日期:2014-05-16  浏览次数:20539 次

oracle10g之手工建库的方法

                                                      oracle10g之手工建库的方法

      一般来说,建库比较方便的工具是使用oracle自带的dbca工具,真的非常方便。但是,有些行业(比如:电信,金融)的生产库却有手工建库的要求,这同样也是考验一个DBA技术功底是否扎实的重要一环。 

      同时手工建库也是OCM考试的第一关,作为DBA或者准DBA熟练掌握oracle的手工建库技能也是必须的。

 

一、手工建库前的准备工作

1.操作系统环境:RHEL6.3 x86_64Bit

2.oracle版本:oracle10g Release 10.2.0.4.0

3.oacle软件:10201_database_linux_x86_64.cpio + p6810189_10204_Linux-x86-64.zip

4.设置好环境变量,并生效。

[root@oracle10g oracle]# cat /home/oracle/.bash_profile
# .bash_profile

# Get the aliases and functions
if [ -f ~/.bashrc ]; then
 . ~/.bashrc
fi

# User specific environment and startup programs

PATH=$PATH:$HOME/bin

export PATH

#for oracle
export TMP=/tmp
export TMPDIR=$TMP
export ORACLE_BASE=/u01/oracle
export ORACLE_HOME=/u01/oracle/product/10.2.0/db_1
export ORACLE_SID=ORCL
export ORACLE_TERM=xterm
export PATH=/usr/sbin:$PATH
export PATH=$ORACLE_HOME/bin:$PATH
export LD_LIBRARY_PATH=$ORACLE_HOME/lib:/lib:/usr/lib
export CLASSPATH=$ORACLE_HOME/jre:$ORACLE_HOME/jlib:$ORACLE_HOME/rdbms/jlib
export EDITOR=vi
export NLS_LANG=AMERICAN_AMERICA.ZHS16GBK
export NLS_DATE_FORMAT='YYYY-MM-DD HH24:MI:SS

[oracle@oracle10g ~]$ source /home/oracle/.bash_profile

5.规划表空间及数据文件路径及大小

system表空间大小350M,sysaux表空间300M,temp临时表空间100M,undo表空间200M,users表空间100M。

创建相关文件的存储路径

[oracle@oracle10g u01]$mkdir -p /u01/oracle/oradata/ORCL

[oracle@oracle10g u01]$mkdir -p /u01/oracle/flash_recovery_area

[oracle@oracle10g u01]$mkdir -p /u01/oracle/admin/ORCL/{adump,bdump,cdump,udump}

 

二、手工建库过程

1.设置ORACLE_SID环境变量

[oracle@oracle10g u01]$ export ORACLE_SID=ORCL

2.修改oratab文件如下

[oracle@oracle10g etc]$ cat oratab

# This file is used by ORACLE utilities.  It is created by root.sh
# and updated by the Database Configuration Assistant when creating
# a database.

# A colon, ':', is used as the field terminator.  A new line terminates
# the entry.  Lines beginning with a pound sign, '#', are comments.
#
# Entries are of the form:
#   $ORACLE_SID:$ORACLE_HOME:<N|Y>:
#
# The first and second fields are the system identifier and home
# directory of the database respectively.  The third filed indicates
# to the dbstart utility that the database should , "Y", or should not,
# "N", be brought up at system boot time.
#
# Multiple entries with the same $ORACLE_SID are not allowed.
#
#增加以下内容:$ORACLE_SID:$ORACLE_HOME:<N|Y>:
ORCL:/u01/oracle/product/10.2.0/db_1:Y

3.创建orapwd远程登陆密码文件,路径为/u01/oracle/product/10.2.0/db_1/dbs

[oracle@oracle10g dbs]$ orapwd
Usage: orapwd file=<fname> password=<password> entries=<users> force=<y/n> nosysdba=<y/n>

  where
    file - name of password file (mand),
    password - password for SYS (mand),
    entries - maximum number of distinct DBA,
    force - whether to overwrite existing file (opt),
    nosysdba - whether to shut out the SYSDBA logon (opt for Database Vault only).
  There are no spaces around the equal-to (=) character.
[oracle@oracle10g dbs]$ orapwd file=orapwORCL password='sys' entries=5

[oracle@oracle10g dbs]$ ll
total 52
-rw-r--r-- 1 oracle oinstall 12920 May&n