赞
踩
使用oracle用户登录,或su到oracle用户
#$ORACLE_BASE=/home/oracle/app
mkdir /data/orcltest/test
mkdir -p $ORACLE_BASE/admin/test
mkdir -p $ORACLE_BASE/admin/test/{a,b,c,u}dump
mkdir -p $ORACLE_BASE/admin/test/pfile
mkdir -p $ORACLE_BASE/oradata/test
命名方法:init实例名.ora 本例中inittest.ora
cp init.ora inittest.ora 即可以生成
vi inittest.ora 进行编辑,将里面的内容对应修改一下,我的修改完如下:
db_name='test'
memory_target=1G
processes = 150
audit_file_dest='/home/oracle/app/admin/test/adump'
audit_trail ='db'
db_block_size=8192
db_domain=''
db_recovery_file_dest='/home/oracle/app/flash_recovery_area'
db_recovery_file_dest_size=2G
diagnostic_dest='/home/oracle/app'
dispatchers='(PROTOCOL=TCP) (SERVICE=testXDB)'
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_control9, ora_control10)
compatible ='11.2.0'
注意不要用原来的<ORACLE_BASE>作为路径,修改为对应的绝对路径,否则会报错
而且注意control_files应该是新的文件,否则会报文件已存在的错误
orapwd file=$ORACLE_HOME/dbs/orapwtest password=test2017 entries=5 force=y
这里设置的是sys用户,密码是test2017
脚本文件createdb.sql,内容如下,可以放在$ORACLE_BASE/oradata/test下面
vi $ORACLE_BASE/oradata/test/createdb.sql
create database test
MAXINSTANCES 1
MAXLOGHISTORY 1
MAXLOGFILES 5
MAXLOGMEMBERS 5
MAXDATAFILES 100
DATAFILE
'/data/orcltest/test/system01.dbf' size 200m reuse autoextend on next 5m maxsize unlimited extent management local
sysaux datafile
'/data/orcltest/test/sysaux01.dbf' size 200m reuse autoextend on next 5m maxsize unlimited
default temporary tablespace TEMP tempfile
'/data/orcltest/test/temp01.dbf' size 30m reuse autoextend on next 640k maxsize unlimited undo tablespace UNDOTBS1 datafile
'/data/orcltest/test/undo01.dbf' size 30m reuse autoextend on next 5M maxsize unlimited
logfile
GROUP 1 ('/data/orcltest/test/redo1.dbf') size 20m,
GROUP 2 ('/data/orcltest/test/redo2.dbf') size 20m,
GROUP 3 ('/data/orcltest/test/redo3.dbf') size 20m
CHARACTER SET ZHS16GBK
NATIONAL CHARACTER SET AL16UTF16
以sysdba进入:
sqlplus / as sysdba
执行下面命令:
startup nomout;
@$ORACLE_BASE/oradata/test/createdb.sql
@?/rdbms/admin/catalog.sql;
@?/rdbms/admin/catproc.sql;
@?/rdbms/admin/catexp.sql;
到$ORACLE_HOME/network/admin目录下:vi listener.ora
test =
(DESCRIPTION_LIST =
(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC1522))
)
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = TCP)(HOST = 114.55.30.70)(PORT = 1522))
)
)
)
SID_LIST_test =
(SID_LIST =
(SID_DESC =
(GLOBAL_DBNAME = test)
(ORACLE_HOME = /data/install/oracle/product/11.2.0/db_1)
(SID_NAME = test)
)
)
启停监听
lsnrctl start test
lsnrctl stop test
启停实例
export ORACLE_SID=test
sqlplus / as sysdba
>startup
>shutdown
create tablespace test datafile '/data/orcltest/test/test.dbf' size 1024m autoextend on next 1024m maxsize 32767m extent management local;
create user test identified by test2017 default tablespace test;
grant dba,connect,resource,create session to test;
alter tablespace USERS add datafile '/data/orcltest/test/user2.dbf' size 1024m autoextend on next 1024m maxsize 32767m;
欢迎关注交流:
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。