[Oracle@ora10g ~]$ export ORACLE_SID=wwl02
[oracle@ora10g ~]$ echo $ORACLE_SID
wwl02
[oracle@ora10g wwl02]$ sqlplus / as sysdba
SQL*Plus: Release 10.2.0.1.0 - Production on Sat Nov 19 03:18:47 2011
Copyright (c) 1982, 2005, Oracle. All rights reserved.
Connected to an idle instance.
SQL> startup nomount pfile = /orasoft/product/10.2.0/db_1/dbs/initwwl02.ora
ORACLE instance started.
Total System Global Area 218103808 bytes
Fixed Size 1218604 bytes
Variable Size 109053908 bytes
Database Buffers 104857600 bytes
Redo Buffers 2973696 bytes
5、创建数据库,数据库名称为wwl02
SQL> create database wwl02
2 user sys identified by oracle
3 user system identified by oracle
4 datafile '/oradata/wwl02/data/system01.dbf' size 300m
5 sysaux datafile '/oradata/wwl02/data/sysaux01.dbf' size 100m
6 default temporary tablespace temp tempfile '/oradata/wwl02/data/temp01.dbf' size 100m
7 undo tablespace undotbs datafile '/oradata/wwl02/data/undotbs01.dbf' size 100m
8 logfile
9 group 1 '/oradata/wwl02/data/redo01a.log' size 10m,
10 group 2 '/oradata/wwl02/data/redo02a.log' size 10m,
group 3 '/oradata/wwl02/data/redo03a.log' size 10m
character set zhs16gbk; 11 12
Database created.
6、执行建库后的脚本,创建系统的视图和数据字典
SQL> @?/rdbms/admin/catalog.sql
SQL> @?/rdbms/admin/catproc.sql
conn system/oracle
SQL> @?/sqlplus/admin/pupbld.sql
7、检查数据库现在是否open状态。
SQL> select instance_name,status from v$instance;
INSTANCE_NAME STATUS
---------------- ------------
wwl02 OPEN
1 row selected.
8、将创建数据库用的pfile参数创建成spfile
SQL> show parameter spfile
NAME TYPE VALUE
------------------------------------ ----------- ------------------------------
spfile string
SQL> create spfile from pfile = '/orasoft/product/10.2.0/db_1/dbs/initwwl02.ora';
File created.
9、重启数据库后,数据库开始默认使用spfile启动数据库。
SQL> shutdown immediate
Database closed.
Database dismounted.
ORACLE instance shut down.
SQL> startup
ORACLE instance started.
Total System Global Area 218103808 bytes
Fixed Size 1218604 bytes
Variable Size 109053908 bytes
Database Buffers 104857600 bytes
Redo Buffers 2973696 bytes
Database mounted.
Database opened.
SQL> show parameter spfile
NAME TYPE VALUE
------------------------------------ ----------- ------------------------------
spfile string /orasoft/product/10.2.0/db_1/d
bs/spfilewwl02.ora
SQL>
SQL> exit
Disconnected from Oracle Database 10g Enterprise Edition Release 10.2.0.1.0 - Production
With the Partitioning, OLAP and Data Mining options
[oracle@ora10g wwl02]$ exit
logout
[root@ora10g ~]# exit
logout
10、至此,手工建库已完成。
