如何手动创建oracle数据库

下面的实验室是如何不要通过DBCA创建ORACLE 数据库,而是通过ORACLE ONLINE HELP DOCUMENT进行手动的创建数据库的详细步骤:

1,编辑Oracle profile
[root@vmoel5u4 ~]# su - oracle
[oracle@vmoel5u4 ~]$ vi ./.bash_profile
PATH=$PATH:$HOME/bin

export PATH
export ORACLE_BASE=/u01/app/oracle
export ORACLE_HOME=$ORACLE_BASE/product/10.2.0/db_1
export ORACLE_SID=PROD
export PATH=$ORACLE_HOME/jdk/bin:$ORACLE_HOME/bin:$PATH
export LD_LIBRARY_PATH=$ORACLE_HOME/lib

2,创建相应的ORACLE数据文件的目录
[oracle@vmoel5u4 ~]$ mkdir -p /u01/app/oracle/oradata/PROD/DISK1
[oracle@vmoel5u4 ~]$ mkdir -p /u01/app/oracle/oradata/PROD/DISK2
[oracle@vmoel5u4 ~]$ mkdir -p /u01/app/oracle/oradata/PROD/DISK3
[oracle@vmoel5u4 ~]$ mkdir -p /u01/app/oracle/admin/PROD/{a,b,c,u,dp}dump

3,创建ORACLE数据库的密码文件
[oracle@vmoel5u4 ~]$ cd $ORACLE_HOME/dbs
[oracle@vmoel5u4 dbs]$ ll
total 28
-rw-r----- 1 oracle oinstall 12920 May  3  2001 initdw.ora
-rw-r----- 1 oracle oinstall  8385 Sep 11  1998 init.ora
[oracle@vmoel5u4 dbs]$ orapwd
Usage: orapwd file=<fname> password=<password> entries=<users> force=<y/n>

  where
    file - name of password file (mand),
    password - password for SYS (mand),
    entries - maximum number of distinct DBA and     force - whether to overwrite existing file (opt),
OPERs (opt),
  There are no spaces around the equal-to (=) character.
[oracle@vmoel5u4 dbs]$ orapwd file=orapwPROD password=oracle entries=5 force=y;
[oracle@vmoel5u4 dbs]$ ll
total 32
-rw-r----- 1 oracle oinstall 12920 May  3  2001 initdw.ora
-rw-r----- 1 oracle oinstall  8385 Sep 11  1998 init.ora
-rw-r----- 1 oracle oinstall  2048 Nov 25 20:45 orapwPROD

4,创建启动数据库的参数文件
[oracle@vmoel5u4 dbs]$ vi initPROD.ora
db_block_size=8192
db_name=PROD
control_files=(‘/u01/app/oracle/oradata/PROD/DISK1/control01.ctl‘,‘/u01/app/oracle/oradata/PROD/DISK2/control02.ctl‘)
compatible=10.2.0.1.0
processes=150
pga_aggregate_target=90m
UNDO_TABLESPACE=UNDOTBS
undo_management=AUTO
sga_target=300m

5,在帮助文档里查找手动创建数据库的脚本,并做相应的修改。

[oracle@vmoel5u4 dbs]$ vi createDB.sql
CREATE DATABASE PROD
   USER SYS IDENTIFIED BY oracle
   USER SYSTEM IDENTIFIED BY oracle
   LOGFILE GROUP 1 (‘/u01/app/oracle/oradata/PROD/DISK1/redo01a.log‘,‘/u01/app/oracle/oradata/PROD/DISK2/redo01b.log‘) SIZE

100M,
           GROUP 2 (‘/u01/app/oracle/oradata/PROD/DISK1/redo02a.log‘,‘/u01/app/oracle/oradata/PROD/DISK2/redo02b.log‘) SIZE

100M,
           GROUP 3 (‘/u01/app/oracle/oradata/PROD/DISK1/redo03a.log‘,‘/u01/app/oracle/oradata/PROD/DISK2/redo03b.log‘) SIZE

100M
   MAXLOGFILES 15
   MAXLOGMEMBERS 5
   MAXLOGHISTORY 1
   MAXDATAFILES 100
   MAXINSTANCES 1
   CHARACTER SET AL32UTF8
   NATIONAL CHARACTER SET AL16UTF16
   DATAFILE ‘/u01/app/oracle/oradata/PROD/DISK1/system01.dbf‘ SIZE 325M REUSE
   EXTENT MANAGEMENT LOCAL
   SYSAUX DATAFILE ‘/u01/app/oracle/oradata/PROD/DISK1/sysaux01.dbf‘ SIZE 325M REUSE
   DEFAULT TEMPORARY TABLESPACE TEMP
      TEMPFILE ‘/u01/app/oracle/oradata/PROD/DISK1/temp01.dbf‘
      SIZE 20M REUSE
   UNDO TABLESPACE UNDOTBS
      DATAFILE ‘/u01/app/oracle/oradata/PROD/DISK1/undotbs01.dbf‘
      SIZE 200M REUSE AUTOEXTEND ON MAXSIZE UNLIMITED;


6,把数据库启动到nomount状态下进行创建数据库
[oracle@vmoel5u4 dbs]$ sqlplus / as sysdba

SQL*Plus: Release 10.2.0.1.0 - Production on Sun Nov 25 21:06:32 2012

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

Connected to an idle instance.

SQL> startup nomount;
ORACLE instance started.

Total System Global Area  314572800 bytes
Fixed Size                  1219160 bytes
Variable Size              96470440 bytes
Database Buffers          213909504 bytes
Redo Buffers                2973696 bytes
SQL> @createDB.sql

Database created.


7,运行相应的数据库的基础脚本
下面的5个脚本是在sys schema下执行的:
创建数据字典视图
@/u01/app/oracle/product/10.2.0/db_1/rdbms/admin/catalog.sql;(必须先执行它,才可以执行catproc.sql)
创建ORACLE中一些锁机制相关的视图
@/u01/app/oracle/product/10.2.0/db_1/rdbms/admin/catblock.sql;
创建ORACLE一些存储过程和包
@/u01/app/oracle/product/10.2.0/db_1/rdbms/admin/catproc.sql;
创建需要使用PL/ SQL加密工具的接口
@/u01/app/oracle/product/10.2.0/db_1/rdbms/admin/catoctk.sql;
安装SQL*Plus的表PRODUCT_USER_PROFILE, 好像是与数据仓库有关的东西.
@/u01/app/oracle/product/10.2.0/db_1/rdbms/admin/owminst.plb;

下面的2个脚本是在system schema下执行的。
connect system/oracle
@/u01/app/oracle/product/10.2.0/db_1/sqlplus/admin/pupbld.sql;
connect system/oracle
@/u01/app/oracle/product/10.2.0/db_1/sqlplus/admin/help/hlpbld.sql helpus.sql;


8,创建spfile文件
SQL> conn / as sysdba
Connected.
SQL> create spfile from pfile;

File created.


9,关闭数据库,重新用spfile启动数据库
SQL> shutdown immediate
Database closed.
Database dismounted.
ORACLE instance shut down.
SQL> startup
ORACLE instance started.

Total System Global Area  314572800 bytes
Fixed Size                  1219160 bytes
Variable Size              96470440 bytes
Database Buffers          213909504 bytes
Redo Buffers                2973696 bytes
Database mounted.
Database opened.

到此手动创建数据库成功!

如何手动创建oracle数据库,古老的榕树,5-wow.com

郑重声明:本站内容如果来自互联网及其他传播媒体,其版权均属原媒体及文章作者所有。转载目的在于传递更多信息及用于网络分享,并不代表本站赞同其观点和对其真实性负责,也不构成任何其他建议。