Oracle 10G手工创建数据库(Helloblock写作)

Oracle 10G手工创建数据库(Helloblock写作)


1、设置实例名:
修改/home/oracle/.bash_profile文件,添加下列这行内容。
export ORACLE_SID=orcl
修改之后使用命令source /home/oracle/.bash_profile让它生效。

2、创建相关目录:
mkdir /u01/app/oracle/oradata/orcl
mkdir /u01/app/oracle/admin/orcl
mkdir /u01/app/oracle/admin/orcl/adump
mkdir /u01/app/oracle/admin/orcl/bdump
mkdir /u01/app/oracle/admin/orcl/cdump
mkdir /u01/app/oracle/admin/orcl/udump

3、创建密码文件:
cd /u01/app/oracle/product/10.2.0/db_1/dbs
orapwd file=orapworcl password=oracle entries=10 force=y

4、创建参数文件:
cd /u01/app/oracle/product/10.2.0/db_1/dbs
cat init.ora|grep -v ^#|grep -v ^$>initorcl.ora

修改initorcl.ora文件,内容如下:
db_name=orcl
db_block_size=8192
undo_management=auto
undo_tablespace=undotbs
sga_target=500m
control_files=('/u01/app/oracle/oradata/orcl/control01.ctl','/u01/app/oracle/oradata/orcl/control02.ctl')
audit_file_dest='/u01/app/oracle/admin/orcl/adump'
background_dump_dest='/u01/app/oracle/admin/orcl/bdump'
core_dump_dest='/u01/app/oracle/admin/orcl/cdump'
user_dump_dest='/u01/app/oracle/admin/orcl/udump'

5、生成spfile文件,并启动到nomount状态:
sqlplus / as sysdba
create spfile from pfile;
startup nomount;

6、创建数据库:
CREATE DATABASE orcl
   USER SYS IDENTIFIED BY oracle
   USER SYSTEM IDENTIFIED BY oracle
   LOGFILE GROUP 1 ('/u01/app/oracle/oradata/orcl/redo01a.log','/u01/app/oracle/oradata/orcl/redo01b.log') SIZE 300M,
           GROUP 2 ('/u01/app/oracle/oradata/orcl/redo02a.log','/u01/app/oracle/oradata/orcl/redo02b.log') SIZE 300M,
           GROUP 3 ('/u01/app/oracle/oradata/orcl/redo03a.log','/u01/app/oracle/oradata/orcl/redo03b.log') SIZE 300M
   MAXLOGFILES 20
   MAXLOGMEMBERS 5
   MAXLOGHISTORY 1
   MAXDATAFILES 500
   MAXINSTANCES 5
   CHARACTER SET AL32UTF8
   NATIONAL CHARACTER SET AL16UTF16
   DATAFILE '/u01/app/oracle/oradata/orcl/system01.dbf' 
      SIZE 500M REUSE AUTOEXTEND ON NEXT 10M MAXSIZE UNLIMITED
   EXTENT MANAGEMENT LOCAL
   SYSAUX DATAFILE '/u01/app/oracle/oradata/orcl/sysaux01.dbf' 
      SIZE 500M REUSE AUTOEXTEND ON NEXT 10M MAXSIZE UNLIMITED
   DEFAULT TABLESPACE users
      DATAFILE '/u01/app/oracle/oradata/orcl/users01.dbf'
      SIZE 500M REUSE AUTOEXTEND ON NEXT 10M MAXSIZE UNLIMITED
   DEFAULT TEMPORARY TABLESPACE temp
      TEMPFILE '/u01/app/oracle/oradata/orcl/temp01.dbf'  
      SIZE 300M REUSE AUTOEXTEND ON NEXT 10M MAXSIZE UNLIMITED
   UNDO TABLESPACE undotbs 
      DATAFILE '/u01/app/oracle/oradata/orcl/undotbs01.dbf'
      SIZE 200M REUSE AUTOEXTEND ON NEXT 10M MAXSIZE UNLIMITED;   
  
7、执行脚本:   
sqlplus / as sysdba
@?/rdbms/admin/catalog;
@?/rdbms/admin/catproc;
@?/rdbms/admin/catblock;
@?/rdbms/admin/catoctk;
@?/rdbms/admin/owminst.plb;

sqlplus system
@?/sqlplus/admin/pupbld.sql;

8、设置默认表空间和默认临时表空间:
alter database default tablespace users;
alter database default temporary tablespace temp;


博主:Helloblock
Linux/Oracle
即是一块数据块,也是一块系统块。

mail[email protected]

QQ1654294099


你可能感兴趣的:(Oracle数据库管理)