10g手动创建数据库

1、建立目录
1)日志存放目录
[oracle@ocmserver]cd $ORACLE_BASE
[oracle@ocmserver]cd admin/
[oracle@ocmserver]ls
ibm
[oracle@ocmserver]mkdir hp
[oracle@ocmserver]cd hp
[oracle@ocmserver]mkdir {a,b,c,u}dump
[oracle@ocmserver]ls
adump    bdump    cdump    udump
[oracle@ocmserver]pwd
/opt/oracle/admin/hp
[oracle@ocmserver]
2)创建数据文件存放目录
[oracle@ocmserver]cd $ORACLE_BASE/oradata
[oracle@ocmserver]mkdir hp
[oracle@ocmserver]ls
hp     ibm
[oracle@ocmserver]
2、建立密码文件
[oracle@ocmserver]cd $ORACLE_HOME/dbs
[oracle@ocmserver]orapwd file=orapwhp password=oracle
[oracle@ocmserver]ls
hc_ibm.dat         init.ora             initaiobs.ora    initdw.ora         initibm.ora        lkIBM                    orapwhp                orapwibm             spfileibm.ora
[oracle@ocmserver]
3、创建参数文件pfile
vi inithp.ora
4、创建spfile
sqlplus / as sysdba
create spfile from pfile
5、启动数据库为nomount,并创建数据库
SQL>startup nomount
SQL>get $ORACLE_HOME/sql/crt_hp.sql
----<脚本如下>----
CREATE DATABASE hp
USER SYS IDENTIFIED BY oracle
USER SYSTEM IDENTIFIED BY oracle
LOGFILE GROUP 1 ('/opt/oracle/oradata/hp/redo01.log') SIZE 100M,
GROUP 2 ('/opt/oracle/oradata/hp/redo02.log') SIZE 100M,
GROUP 3 ('/opt/oracle/oradata/hp/redo03.log') SIZE 100M
MAXLOGFILES 5
MAXLOGMEMBERS 5
MAXLOGHISTORY 1
MAXDATAFILES 100
MAXINSTANCES 1
CHARACTER SET US7ASCII
NATIONAL CHARACTER SET UTF8
DATAFILE '/opt/oracle/oradata/hp/system01.dbf' SIZE 325M REUSE
EXTENT MANAGEMENT LOCAL
SYSAUX DATAFILE '/opt/oracle/oradata/hp/sysaux01.dbf' SIZE 325M REUSE
DEFAULT TABLESPACE tbs_1
datafile '/opt/oracle/oradata/hp/tbs_1.dbf' size 50m
DEFAULT TEMPORARY TABLESPACE tempts01
TEMPFILE '/opt/oracle/oradata/hp/temp01.dbf'SIZE 20M REUSE
UNDO TABLESPACE undotbs
DATAFILE '/opt/oracle/oradata/hp/undotbs01.dbf'SIZE 200M REUSE
AUTOEXTEND ON MAXSIZE UNLIMITED;
6、运行脚本
get $ORACLE_HOME/rdbms/admin/catalog.sql
get $ORACLE_HOME/rdbms/admin/catproc.sql
7、修改数据库状态
alter database mount
alter database open
8、查看数据库
select instance_name,status from v$instance

你可能感兴趣的:(10g)