Home > Database > Mysql Tutorial > 手动创建数据库的整体流程 Oracle 11g

手动创建数据库的整体流程 Oracle 11g

WBOY
Release: 2016-06-07 17:28:30
Original
1019 people have browsed it

环境:OEL+Oracle 11.2.0.1 由于当前环境已有一个数据库实例,但这并不影响我们创建一个新的实例sun 当前系统实例 [oracle@DBA2

环境:OEL+Oracle 11.2.0.1

由于当前环境已有一个数据库实例,但这并不影响我们创建一个新的实例sun

当前系统实例

[oracle@DBA2 dbs]$ env |grep ORACLE
ORACLE_SID=orcl1
ORACLE_BASE=/u/oracle
ORACLE_HOME=/u/oracle/product/11.2
[oracle@DBA2 dbs]$

 

1、首先设置我们要创建的数据库ORACLE_SID

export $ORACLE_SID=sun

 

2、为新实例创建密码文件

orapwd file=$ORACLE_HOME/dbs/orapwsun password=oracle entries=10

 

3、创建初始化参数文件(pfile)

[oracle@DBA2 dbs]$ vi initsun.ora
db_name=sun
control_files='/oradata/sun/control01.ctl'
sga_target=250M
undo_management=auto
undo_tablespace=undotbs

其中最主要的参数是db_name、control_files和sga_target

 

4、创建实例相关的目录(数据文件,日志文件,控制文件等)

我将数据文件和日志文件和控制文件放在了一个目录下,我这里只用了一个控制文件。当然,最好使用两个或三个控制文件并存放在不同路径下,,以保证数据文件的冗余。

[oracle@DBA2 ~]$ mkdir /oradata/sun

[oracle@DBA2 admin]$ mkdir /u/oracle/admin/adump

[oracle@DBA2 admin]$ mkdir /u/oracle/admin/bdump

[oracle@DBA2 admin]$ mkdir /u/oracle/admin/pfile

 

5、创建spfile文件并将数据库启动到nomount 状态

SQL> create spfile from pfile;

File created.

SQL> startup nomount
ORACLE instance started.

Total System Global Area 418484224 bytes
Fixed Size 1336932 bytes
Variable Size 281020828 bytes
Database Buffers 130023424 bytes
Redo Buffers 6103040 bytes
SQL>

6、创建数据库(附脚本)

CREATE DATABASE sun
USER SYS IDENTIFIED BY oracle
USER SYSTEM IDENTIFIED BY oracle
LOGFILE GROUP 1 ('/oradata/sun/redo01a.log') SIZE 20M,
GROUP 2 ('/oradata/sun/redo02a.log') SIZE 20M,
GROUP 3 ('/oradata/sun/redo03a.log') SIZE 20M
MAXLOGFILES 5
MAXLOGMEMBERS 5
MAXLOGHISTORY 1
MAXDATAFILES 100
MAXINSTANCES 2
CHARACTER SET AL32UTF8
DATAFILE '/oradata/sun/system01.dbf' SIZE 400M REUSE
EXTENT MANAGEMENT LOCAL
SYSAUX DATAFILE '/oradata/sun/sysaux01.dbf' SIZE 400M REUSE
DEFAULT TABLESPACE users
DATAFILE '/oradata/sun/users01.dbf' SIZE 20M REUSE AUTOEXTEND ON MAXSIZE UNLIMITED
DEFAULT TEMPORARY TABLESPACE tempts01
TEMPFILE '/oradata/sun/tempts01.dbf' SIZE 20M REUSE
UNDO TABLESPACE undotbs
DATAFILE '/oradata/sun/undotbs01.dbf' SIZE 200M REUSE AUTOEXTEND ON MAXSIZE UNLIMITED
/

 

7、执行相关数据字典试图

@?/rdbms/admin/catalog.sql
@?/rdbms/admin/catproc.sql
@?/sqlplus/admin/pupbld.sql

 

OK,至此手动创建Oracle数据库完成,实验证明手动建库比DBCA建库要来的方便和快速,基本流程也就分以上几个步骤

linux

source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template