http://blog.csdn.net/bo5509/article/details/8438766 2012 1.確認(rèn)oracle實(shí)例名,如orcl
2.創(chuàng)建相關(guān)的目錄,在$ORACLE_BASE/oradata
主要有 $ORACLE_BASE/oradata/orcl/admin/adump
$ORACLE_BASE/oradata/orcl/admin/bdump
$ORACLE_BASE/oradata/orcl/admin/cdump
$ORACLE_BASE/oradata/orcl/admin/pfile
$ORACLE_BASE/oradata/orcl/admin/udump
創(chuàng)建閃存目錄
$ORACLE_BASE/oradata/flash_recovery_area
mkdir -p $ORACLE_BASE/oradata/orcl/admin/adump
3.創(chuàng)建初始化文件
在$ORACLE_HOME/dbs目錄下
命名方法
init實(shí)例名.ora 本例中initorcl.ora
cp init.ora initorcl.ora 即可以生成
vi initorcl.ora 進(jìn)行編輯
db_name='實(shí)例名' 本例中orcl,必須填寫(xiě)
給出各個(gè)文件位置
內(nèi)容如下:
db_name='orcl' #必須給出的名字
memory_target=1G
processes = 150
audit_file_dest='/opt/oracle/oradata/admin/orcl/adump' #必須給出的名字
audit_trail ='db'
db_block_size=8192
db_domain=''
db_recovery_file_dest='/opt/oracle/oradata/flash_recovery_area' #必須給出的名字
db_recovery_file_dest_size=2G
diagnostic_dest='/opt/oracle' #必須給出的名字
dispatchers='(PROTOCOL=TCP) (SERVICE=orcl)'
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 = (orcl_control1, orcl_control2)
compatible ='11.2.0'
4 設(shè)置ORACLE_SID變量
修改.bash_profile
export ORACLE_SID=orcl
5. 建立創(chuàng)建數(shù)據(jù)庫(kù)腳本 createdb.sql
create database orcl ==數(shù)據(jù)SID名稱(chēng)
MAXINSTANCES 1
MAXLOGHISTORY 1
MAXLOGFILES 5
MAXLOGMEMBERS 5
MAXDATAFILES 100
DATAFILE
'/opt/oracle/oradata/orcl/system01.dbf' size 100m reuse autoextend on next 1m maxsize unlimited
sysaux datafile
'/opt/oracle/oradata/orcl/syaux01.dbf' size 100m reuse autoextend on next 1m maxsize unlimited
default temporary tablespace TEMP tempfile
'/opt/oracle/oradata/orcl/temp01.dbf' size 20m reuse autoextend on next 64k maxsize unlimited
undo tablespace UNDOTBS1 datafile
'/opt/oracle/oradata/orcl/undo01.dbf' size 20m reuse autoextend on next 5m maxsize unlimited
logfile
GROUP 1 ('/opt/oracle/oradata/orcl/redo01.dbf') size 10m,
GROUP 2 ('/opt/oracle/oradata/orcl/redo02.dbf') size 10m,
GROUP 3 ('/opt/oracle/oradata/orcl/redo03.dbf') size 10m
CHARACTER SET ZHS16GBK ==字符集
NATIONAL CHARACTER SET AL16UTF16
6 .sqlplus "/as sysdba"
startup nomount;
執(zhí)行創(chuàng)建createdb.sql
@?$ORACLE_BASE/oradata/createdb.sql
7.創(chuàng)建數(shù)據(jù)字典
@?/rdbms/admin/catalog.sql;
@?/rdbms/admin/catproc.sql;
切換用戶system/manager
執(zhí)行 本人沒(méi)有執(zhí)行此腳本,
@?/sqlplus/admin/pupbld.sql;
8.安裝全文檢索
用sys以sysdba身份登錄
創(chuàng)建全文檢索表空間
create tablespace ctxsys logging datafile='/opt/oracle/oradata/orcl/ctxsys01.dbf' size 200m autoextend on maxsize unlimited;
執(zhí)行腳本
@?/ctx/admin/catctx.sql ctxsys ctxsys temp nolock; --參數(shù)說(shuō)明 密碼,表空間 臨時(shí)表空間 用戶狀態(tài)
connect ctxsys/ctxsys;
@?/ctx/admin/defaults/drdefus.sql
9.配置監(jiān)聽(tīng)
$ORACLE_HOME/network/admin
vi listener.ora
SID_LIST_orcl=
(SID_DESC=
(SID_NAME=orcl)
(ORACLE_HOME=/opt/oracle/product/11.2.0/db_1)
)
)
orcl=
(DESCRIPTIONI_LIST=
(DESCRIPTION=
(ADDRESS=(PROTOCOL=TCP)
(HOST=192.168.56.100)(PORT=1521)
)
)
10 配置tnsnames.ora
orcl=
(
DESCRIPTION=
(ADDRESS_LIST=
(ADDRESS=(PROTOCOL=TCP)(HOST=192.168.56.100)(PORT=1521)))
(CONNECT_DATA=(SERVICE_NAME=orcl)
)
)
11 手工啟停
啟動(dòng)監(jiān)聽(tīng):lsnrctl start
停止監(jiān)聽(tīng):lsnrctl stop
啟動(dòng)數(shù)據(jù)庫(kù)
sqlplus "/as sysdba"
startup
關(guān)閉數(shù)據(jù)庫(kù)
sqlplus "/as sysdba"
shutdown
|