2008-7-8
实例名称ORACLE_SID=mytest
数据库名称DB_NAME= mytest
1、修改oracle的.bash_profile文件
export ORACLE_BASE=/oracle
export ORACLE_HOME=$ORACLE_BASE/product/10.2.0/db_1
export ORACLE_SID=mytest
export PATH=$PATH:$HOME/bin:$ORACLE_HOME/bin
export LD_LIBRARY_PATH=$ORACLE_HOME/lib:/usr/lib
2、手工创建如下目录(这些目录在create database时都会用到)
/oracle/admin/mytest/adump
/oracle/admin/mytest/cdump
/oracle/admin/mytest/bdump
/oracle/admin/mytest/udump
/oracle/admin/mytest/pfile
/oracle/oradata/mytest/
/oracle/oradata/mytest/archive
/oracle/oradata/mytest/redo
3、修改参数文件
使用其他DB的pfile,修改成mytest 的pfile,然后存放到:/oracle/admin/mytest/pfile/init.ora
*._disable_logging=FALSE
*.audit_file_dest='/oracle/admin/mytest/adump'
*.background_dump_dest='/oracle/admin/mytest/bdump'
*.compatible='10.2.0.1.0'
*.control_files='/oracle/oradata/mytest/system/control01.ctl','/oracle/oradata/mytest/system/control02.ctl','/oracle/oradata/mytest/system/control03.ctl'
*.core_dump_dest='/oracle/admin/mytest/cdump'
*.db_block_size=8192
*.db_domain=''
*.db_file_multiblock_read_count=16
*.db_name='mytest'
*.dispatchers='(PROTOCOL=TCP) (SERVICE=mytestXDB)'
*.job_queue_processes=10
*.log_archive_dest_1='LOCATION=/oracle/oradata/mytest/archive REOPEN=5'
*.log_archive_format='mytest%t_%s_%r.arc'
*.nls_date_format='DD-MON-RR'
*.open_cursors=300
*.open_links=10
*.pga_aggregate_target=83676364
*.processes=150
*.remote_login_passwordfile='EXCLUSIVE'
*.sga_target=214748364
*.undo_management='AUTO'
*.undo_retention=10800
*.undo_tablespace='UNDOTBS1'
*.user_dump_dest='/oracle/admin/mytest/udump'
4、登陆oracle
> sqlplus / as sysdba
5、启动实例
SQL> startup nomount pfile='/oracle/admin/mytest/pfile/init.ora'
6、创建数据库的脚本
CREATE DATABASE mytest
LOGFILE
GROUP 1 ('/oracle/oradata/mytest/redo/redo01.log','/oracle/oradata/mytest/redo/redo01_1.log') size 100m reuse,
GROUP 2 ('/oracle/oradata/mytest/redo/redo02.log','/oracle/oradata/mytest/redo/redo02_1.log') size 100m reuse,
GROUP 3 ('/oracle/oradata/mytest/redo/redo03.log','/oracle/oradata/mytest/redo/redo03_1.log') size 100m reuse
MAXLOGFILES 50
MAXLOGMEMBERS 5
MAXLOGHISTORY 200
MAXDATAFILES 500
MAXINSTANCES 5
ARCHIVELOG
CHARACTER SET UTF8
NATIONAL CHARACTER SET UTF8
DATAFILE '/oracle/oradata/mytest/system/system01.dbf' size 200M AUTOEXTEND ON NEXT 100M MAXSIZE 500M
SYSAUX DATAFILE '/oracle/oradata/mytest/system/sysaux01.dbf' size 200M AUTOEXTEND ON NEXT 100M MAXSIZE 500M
UNDO TABLESPACE UNDOTBS1 DATAFILE '/oracle/oradata/mytest/system/undo.dbf' size 10M AUTOEXTEND ON NEXT 10M MAXSIZE 50M
DEFAULT TEMPORARY TABLESPACE TEMP TEMPFILE '/oracle/oradata/mytest/system/temp.dbf' size 10M AUTOEXTEND ON NEXT 10M MAXSIZE 50M
;
7、创建数据字典,sys用户
Creates data dictionary views.
SQL> Spool /worktmp/install080708.log
SQL> @?/rdbms/admin/catalog.sql
Run all sql scripts for the procedural option
SQL> @?/rdbms/admin/catproc.sql
SQL>spool off
8、创建spfile,用spfile 启动
SQL>create spfile from pfile='/oracle/admin/mytest/pfile/init.ora';
Shutdown immediate
Startup
9、创建相关表空间与用户
CREATE TABLESPACE DAT1 DATAFILE '/oracle/oradata/mytest/dat101.dbf' SIZE 10M AUTOEXTEND ON NEXT 10M MAXSIZE 100M;
CREATE TABLESPACE IDX1 DATAFILE '/oracle/oradata/mytest/idx101.dbf' SIZE 10M AUTOEXTEND ON NEXT 10M MAXSIZE 100M;
CREATE USER test IDENTIFIED BY test DEFAULT TABLESPACE DAT1;
GRANT CONNECT,RESOURCE TO test;