linux手工创建Oracle实例操作说明

合集下载
  1. 1、下载文档前请自行甄别文档内容的完整性,平台不提供额外的编辑、内容补充、找答案等附加服务。
  2. 2、"仅部分预览"的文档,不可在线预览部分如存在完整性等问题,可反馈申请退款(可完整预览的文档不适用该条件!)。
  3. 3、如文档侵犯您的权益,请联系客服反馈,我们会尽快为您处理(人工客服工作时间:9:00-18:30)。

第一步 设置环境变量,可加在.bash_profile文件中
export ORACLE_SID=orcl
第二步 创建需要的目录:
[oracle@localhost oracle]$ mkdir -p $ORACLE_BASE/oradata/ORCL
[oracle@localhost oracle]$ mkdir -p $ORACLE_BASE/admin/orcl/adump
[oracle@localhost oracle]$ mkdir -p $ORACLE_BASE/admin/orcl/bdump
[oracle@localhost oracle]$ mkdir -p $ORACLE_BASE/admin/orcl/cdump
[oracle@localhost oracle]$ mkdir -p $ORACLE_BASE/admin/orcl/udump
[oracle@localhost oracle]$ mkdir -p $ORACLE_BASE/admin/orcl/pfile
第三步 创建需要的目录:在$ORACLE_HOME/dbs目录下创建ORACLE的参数文件initSID.ora,可先拷贝数据库自带的init.ora文件,在修改:
cp init.ora initORCL.ora
用vi命令编辑initORCL.ora文件,修改如下:
# Change '' to point to the oracle base (the one you specify at
# install time)
db_name='ORCL'
memory_target=1G
processes = 150
audit_file_dest='/opt/oracle/admin/orcl/adump'
audit_trail ='db'
db_block_size=8192
db_domain=''
db_recovery_file_dest='/opt/oracle/flash_recovery_area'
db_recovery_file_dest_size=2G
diagnostic_dest='/opt/oracle'
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 = (ora_control1, ora_control2)
compatible ='11.2.0'

第四步 创建密码文件:
orapwd file=orapwdORCL password=oracle entries=5

第五步 创建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
'/opt/oracle/oradata/ORCL/system01.dbf' size 500M
SYSAUX DATAFILE '/opt/oracle/oradata/ORCL/sysaux01.dbf' SIZE 100M
UNDO TABLESPACE "UNDOTBS1"
DATAFILE '/opt/oracle/oradata/ORCL/undotbs01.dbf' SIZE 200M
DEFAULT TEMPORARY TABLESPACE temp TEMPFILE '/opt/oracle/oradata/ORCL/temp01.dbf' SIZE 300M
DEFAULT TABLESPACE uses DATAFILE '/opt/oracle/oradata/ORCL/user01.dbf' SIZE 20m
logfile
GROUP 1 (
'/opt/oracle/oradata/ORCL/redo01a.log',
'/opt/oracle/oradata/ORCL/redo01b.log'
) SIZE 100M,
GROUP 2 (
'/opt/oracle/oradata/ORCL/redo02a.log',
'/opt/oracle/oradata/ORCL/redo02b.log'
) SIZE 100M,
GROUP 3 (
'/opt/oracle/oradata/ORCL/redo03a.log',
'/opt/oracle/oradata/ORCL/redo03b.log'
) SIZE 100M
;
spool off

[oracle@localhost dbs]$ sqlplus / as sysdba
SQL>startup nomount
SQL> @$ORACLE_HOME/dbs/create.sql;

Database created.
第六步 数据库创建完成后,再创建ORACLE的数据字典。
SQL>@?/rdbms/admin/catalog.sql
SQL>@?/rdbms/admin/catproc.sql
SQL>@?/rdbms/admin/catexp.sql
SQL>@?/rdbms/admin/scott.sql

第七步 创建表空间
create tablespace LGGY_DAT datafile '/opt/oracle/oradata/ORCL/LGGY_DAT01.dbf' size 1g autoextend on next 200m maxsize unlimited;
create tablespace USERS

datafile '/opt/oracle/oradata/ORCL/USERS_DAT01.dbf' size 1g autoextend on next 200m maxsize unlimited;

第八步 创建用户

create user lggy identified by lggy default tablespace LGGY_DAT temporary tablespace temp;
grant connect,resource,dba to lggy;
grant execute any procedure to lggy;
grant insert any table to lggy;
grant select any table to lggy;
grant delete any table to lggy;
grant update any table to lggy;
grant unlimited tablespace to lggy;

drop user lggy cascade;

相关文档
最新文档