手工创建数据库

删除数据库
SQL> shutdown immediate;
SQL> startup mount;
SQL> alter system enable restricted session;
SQL> drop database;
手工建库
1。修改oracle的环境变量文件
 vi .bash_profile
 ORACLE_SID=vfast;
 source .bash_profile (使该文件生效)
2。建立初始化文件
  vi $ORACLE_HOME/dbs/init$ORACLE_SID.ora
  processes                = 150
  sga_max_size             = 524288000
  __shared_pool_size       = 71303168
  __large_pool_size        = 4194304
  __java_pool_size         = 4194304
  __streams_pool_size      = 0
  sga_target               = 285212672
  control_files            = /oracle/app/oradata/vfast/control01.ctl, /oracle/app/oradata/vfast/control02.ctl, 

/oracle/app/oradata/vfast/control03.ctl
  db_block_size            = 8192
  __db_cache_size          = 201326592
  compatible               = 10.2.0.1.0
  db_file_multiblock_read_count= 16
  db_recovery_file_dest    = /oracle/app/flash_recovery_area
  db_recovery_file_dest_size= 2147483648
  undo_management          = AUTO
  undo_tablespace          = UNDOTBS1
  remote_login_passwordfile= EXCLUSIVE
  db_name=vfast
  pga_aggregate_target     = 94371840
  该文件内容来自/oracle/app/admin/TEST/bdump/alert_TEST.log  (TEST原来的数据库)
3。建立密码文件
 echo $ORACLE_SID (vfast)
 orapwd file=$ORACLE_HOME/dbs/orapw$ORACLE_SID password=123456 force=y
4。建立所需目录
 mkdir -p $ORACLE_BASE/admin/$ORACLE_SID/adump
 mkdir -p $ORACLE_BASE/admin/$ORACLE_SID/bdump
 mkdir -p $ORACLE_BASE/admin/$ORACLE_SID/pfile
 mkdir -p $ORACLE_BASE/admin/$ORACLE_SID/cdump
 mkdir -p $ORACLE_BASE/admin/$ORACLE_SID/dpdump
 mkdir -p $ORACLE_BASE/admin/$ORACLE_SID/udump
 mkdir -p $ORACLE_BASE/oradata/vfast
5。建立spfile
 sqlplus / as sysdba
 SQL> startup nomount
 SQL> create spfile from pfile;
 $ORACLE_HOME/dbs/目录下多出spilevfast.ora文件
6。建立数据库
[oracle@sq ~]$ vi /home/oracle/createDB.sql
create database vfast
logfile group 1 ('$ORACLE_BASE/oradata/vfast/redo01.log') size 100m,
        group 2 ('$ORACLE_BASE/oradata/vfast/redo02.log') size 100m,
        group 3 ('$ORACLE_BASE/oradata/vfast/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/vfast/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/vfast/temp01.dbf' size 50m reuse autoextend on

next 1m maxsize 500m
undo tablespace undotbs1 datafile '$ORACLE_BASE/oradata/vfast/undotbs01.dbf' size 500m reuse autoextend on next 1m

maxsize unlimited;
SQL> @/home/oracle/createDB.sql
ls -lh $ORACLE_BASE/oradata/vfast/system01.dbf 显示文件大小为351m
7。创建数据字典视图,创建存储过程包
SQL> @$ORACLE_HOME/rdbms/admin/catalog.sql(建数据字典视图)
SQL> @$ORACLE_HOME/rdbms/admin/catproc.sql(建存储过程包)
 

 

你可能感兴趣的:(手工创建数据库)