码迷,mamicode.com
首页 > 数据库 > 详细

怎样手动创建oracle数据库

时间:2017-05-29 21:43:08      阅读:248      评论:0      收藏:0      [点我收藏+]

标签:pat   release   ash   su -   pop   document   user   sys   name   

以下的实验室是怎样不要通过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数据库的password文件
[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数据库

标签:pat   release   ash   su -   pop   document   user   sys   name   

原文地址:http://www.cnblogs.com/jzdwajue/p/6919048.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!