Step01: 设置环境变量,可加在.bash_profile文件中:
export ORACLE_SID=ORCL
Step02: 创建需要的目录:
$ mkdir -p $ORACLE_BASE/oradata/ORCL
$ mkdir -p $ORACLE_BASE/admin/ORCL/adump
$ mkdir -p $ORACLE_BASE/admin/ORCL/bdump
$ mkdir -p $ORACLE_BASE/admin/ORCL/cdump
$ mkdir -p $ORACLE_BASE/admin/ORCL/udump
$ mkdir -p $ORACLE_BASE/admin/ORCL/pfile
Step03: 在$ORACLE_HOME/dbs目录下创建ORACLE的参数文件initSID.ora,可先拷贝数据库自带的init.ora文件,在修改:
$ cp init.ora initORCL.ora
用vi命令编辑initORCL.ora文件,修改如下:
# Change '<ORACLE_BASE>' to point to the oracle base (the one you specify at
# install time)
db_name='ORCL'
memory_target=700M
processes = 150
audit_file_dest='/u01/admin/ORCL/adump/'
#audit_file_dest='/u01/oracle/rdbms/audit/'
audit_trail ='db'
db_block_size=8192
db_domain=''
db_recovery_file_dest='/u01/flash_recovery_area/'
db_recovery_file_dest_size=2G
diagnostic_dest='/u01'
dispatchers='(PROTOCOL=TCP) (SERVICE=ORCLXDB)'
open_cursors=300
remote_login_passwordfile='EXCLUSIVE'
undo_tablespace='UNDOTBS1'
# You may want to ensure that control files are created on separate physical
# devices
control_files = ('/u01/oradata/ORCL/control01.ctl','/u01/oradata/ORCL/control02.ctl', '/u01/oradata/ORCL/control03.ctl')
compatible ='11.2.0'
Step04: 创建密码文件:
$orapwd file=orapwdORCL password=oracle entries=5
Step05: 创建oracle的建库角本create.sql,内容如下:
spool orcl_dbcreate.log;
create database "ORCL"
maxdatafiles 500
maxinstances 8
MAXLOGHISTORY 4000
maxlogfiles 32
character set "UTF8"
national character set AL16UTF16
datafile
'/u01/oradata/ORCL/system01.dbf' size 500M
SYSAUX DATAFILE '/u01/oradata/ORCL/sysaux01.dbf' SIZE 100M
UNDO TABLESPACE "UNDOTBS1"(注意:UNDOTBS1的名称一定要与initORCL中的相同,否则会出错)
DATAFILE '/u01/oradata/ORCL/undotbs01.dbf' SIZE 200M
DEFAULT TEMPORARY TABLESPACE temp TEMPFILE '/u01/oradata/ORCL/temp01.dbf' SIZE 300M
DEFAULT TABLESPACE uses DATAFILE '/u01/oradata/ORCL/user01.dbf' SIZE 20m
logfile
GROUP 1 (
'/u01/oradata/ORCL/redo01a.log',
'/u01/oradata/ORCL/redo01b.log'
) SIZE 100M,
GROUP 2 (
'/u01/oradata/ORCL/redo02a.log',
'/u01/oradata/ORCL/redo02b.log'
) SIZE 100M,
GROUP 3 (
'/u01/oradata/ORCL/redo03a.log',
'/u01/oradata/ORCL/redo03b.log'
) SIZE 100M
; spool off
Step06: 数据库创建完成后,再创建ORACLE的数据字典。
SQL>@?/rdbms/admin/catalog.sql
SQL>@?/rdbms/admin/catproc.sql
SQL>@?/rdbms/admin/catexp.sql
至此,ORACLE数据库手动创建成功。
详细解决方案
xxxxxxxx
热度:33 发布时间:2023-12-12 01:47:02.0