Oracle10g 手工建库

#手工删除库
SQL> shutdown immediate;
SQL> startup mount;
SQL> alter system enable restricted session;
SQL> drop database;

#手工建库
1.[oracle@sq ~]$ vi .bash_profile
ORACLE_SID=zbk;
退出oracle用户 重新登陆

2.建立初始化文件
[oracle@sq ~]$ vi $ORACLE_HOME/dbs/init$ORACLE_SID.ora
control_files = (/oracle/app/oradata/zbk/control1.ctl,/oracle/app/oradata/zbk/control2.ctl,/oracle/app/oradata/zbk/control3.ctl)
undo_management = AUTO
undo_tablespace = UNDOTBS1
db_name = zbk
db_unique_name = zbk1
db_block_size = 8192
sga_max_size = 320M
sga_target = 320M

3.建立密码文件
[oracle@sq ~]$ orapwd file=$ORACLE_HOME/dbs/orapw$ORACLE_SID password=123456 force=y

4.建立所需目录
[oracle@sq ~]$ mkdir -p $ORACLE_BASE/admin/$ORACLE_SID/adump
[oracle@sq ~]$ mkdir -p $ORACLE_BASE/admin/$ORACLE_SID/bdump
[oracle@sq ~]$ mkdir -p $ORACLE_BASE/admin/$ORACLE_SID/pfile
[oracle@sq ~]$ mkdir -p $ORACLE_BASE/admin/$ORACLE_SID/cdump
[oracle@sq ~]$ mkdir -p $ORACLE_BASE/admin/$ORACLE_SID/dpdump
[oracle@sq ~]$ mkdir -p $ORACLE_BASE/admin/$ORACLE_SID/udump

5.建立spfile
SQL> startup nomount
SQL> create spfile from pfile;

6.建立数据库
[oracle@sq ~]$ vi /home/oracle/createDB.sql
内容为:
create database zbk
logfile group 1 ('$ORACLE_BASE/oradata/zbk/redo01.log') size 100m,
        group 2 ('$ORACLE_BASE/oradata/zbk/redo02.log') size 100m,
        group 3 ('$ORACLE_BASE/oradata/zbk/redo03.log') size 100m
maxlogfiles 10
maxlogmembers 5
maxloghistory 5
maxdatafiles 100
maxinstances 1
character set zhs16gbk
national character set al16utf16
datafile '$ORACLE_BASE/oradata/zbk/system01.dbf' size 350m reuse autoextend on next 1m maxsize unlimited extent management local sysaux datafile '$ORACLE_BASE/oradata/sysaux01.dbf' size 350m reuse autoextend on next 1m maxsize unlimited default temporary tablespace temp01 tempfile '$ORACLE_BASE/oradata/zbk/temp01.dbf' size 50m reuse autoextend on next 1m maxsize 500m undo tablespace undotbs1 datafile '$ORACLE_BASE/oradata/zbk/undotbs01.dbf' size 500m reuse autoextend on next 1m maxsize unlimited;

SQL> @/home/oracle/createDB.sql

7.SQL> select name from v$database;

8.SQL> @/oracle/app/oracle/product/10.2.0/db_1/rdbms/admin/catalog.sql(建数据字典视图)

SQL> @/oracle/app/oracle/product/10.2.0/db_1/rdbms/admin/catproc.sql(建存储过程包)

你可能感兴趣的:(oracle,10g,手工建库)