当前位置:Gxlcms > mysql > 在RedHat5上手动创建数据库

在RedHat5上手动创建数据库

时间:2021-07-01 10:21:17 帮助过:39人阅读

我们这道在Linux上我们可以通过dbca创建数据库,但是我们也能以命令行的模式创建数据库,下面我们说说他的方法1,首先查看以下我

我们这道在Linux上我们可以通过dbca创建数据库,但是我们也能以命令行的模式创建数据库,下面我们说说他的方法

1,首先查看以下我们要创建的数据库名

[Oracle@oracle ~]$ echo $ORACLE_SID
orcl
如果没有设置可以作如下设置
export ORACLE_SID=orcl

2,首先创建一个实例参数文件(pfile)这里命名为pfileorcl.ora
#vim $ORACLE_HOME/dbs/pfileorcl.ora在里面输入下面内容
db_name=orcl
db_domain=example.com
db_files=1000
processes=600
statistics_level=typical
db_block_size=8192
audit_trail=none
background_dump_dest='/u01/app/admin/orcl/bdump'
core_dump_dest='/u01/app/admin/orcl/adump'
control_files=('/u02/oradata/orcl/control01.ctl',
'/u02/oradata/orcl/control02.ctl','/u02/oradata/orcl/control03.ctl')
sga_target=400M
pga_aggregate_target=400M
db_file_multiblock_read_count=16
log_archive_format='log%t_%s_%r.arc'
optimizer_mode=all_rows
remote_login_passwordfile=none
undo_management=auto
undo_retention=7200

3,创建必要的目录
# mkdir -pv /u01/app/admin/orcl/{adump,bdump,dbump}
mkdir: created directory `/u01/app/admin'
mkdir: created directory `/u01/app/admin/orcl'
mkdir: created directory `/u01/app/admin/orcl/adump'
mkdir: created directory `/u01/app/admin/orcl/bdump'
mkdir: created directory `/u01/app/admin/orcl/dbump'
更改它们的权限
# chmod 775 -Rv /u01/app/admin/
mode of `/u01/app/admin/' changed to 0775 (rwxrwxr-x)
mode of `/u01/app/admin/orcl' changed to 0775 (rwxrwxr-x)
mode of `/u01/app/admin/orcl/adump' changed to 0775 (rwxrwxr-x)
mode of `/u01/app/admin/orcl/bdump' changed to 0775 (rwxrwxr-x)
mode of `/u01/app/admin/orcl/dbump' changed to 0775 (rwxrwxr-x)
更改他们的所属主组
# chown oracle:oinstall -Rv /u01/app/admin/
changed ownership of `/u01/app/admin/orcl/adump' to oracle:oinstall
changed ownership of `/u01/app/admin/orcl/bdump' to oracle:oinstall
changed ownership of `/u01/app/admin/orcl/dbump' to oracle:oinstall
changed ownership of `/u01/app/admin/orcl' to oracle:oinstall
changed ownership of `/u01/app/admin/' to oracle:oinstall
# mkdir /u02/oradata/orcl
# mkdir /u02/oradata/orcl/arch -pv
mkdir: created directory `/u02/oradata/orcl'
# chmod 775 -Rv /u02/oradata/orcl/
mode of `/u02/oradata/orcl/' changed to 0775 (rwxrwxr-x)
mode of `/u02/oradata/orcl/arch' changed to 0775 (rwxrwxr-x)
# chown oracle:oinstall -Rv /u02/oradata/orcl/
changed ownership of `/u02/oradata/orcl/' to oracle:oinstall

3,,创建spfile文件
$ sqlplus / as sysdba
SQL*Plus: Release 10.2.0.1.0 - Production on Thu Mar 25 20:46:42 2010
Copyright (c) 1982, 2005, Oracle. All rights reserved.
Connected to an idle instance.
SQL> create SPFILE='/u01/app/oracle/product/10.2.0/db_1/dbs/spfileorcl.ora' FROM PFILE='/u01/app/oracle/product/10.2.0/db_1/dbs/pfileorcl.ora';
File created.

4,开启实例,不挂载数据库
SQL> startup nomount;
ORACLE instance started.
Total System Global Area 419430400 bytes
Fixed Size 1219736 bytes
Variable Size 121635688 bytes
Database Buffers 289406976 bytes
Redo Buffers 7168000 bytes

linux

人气教程排行