阿里云-云小站(无限量代金券发放中)
【腾讯云】云服务器、云数据库、COS、CDN、短信等热卖云产品特惠抢购

手动创建Oracle实例

190次阅读
没有评论

共计 4376 个字符,预计需要花费 11 分钟才能阅读完成。

手工建库步骤

Step 1: Specify an Instance Identifier (SID)(指定一个实例的标识符 SID)
Step 2: Ensure That the Required Environment Variables Are Set(确认环境变量的设置)
Step 3: Choose a Database Administrator Authentication Method(决定数据库管理员的认证方法)
Step 4: Create the Initialization Parameter File(创建初始化的参数文件信息)
Step 5: (Windows Only) Create an Instance
Step 6: Connect to the Instance(连接实例)
Step 7: Create a Server Parameter File(创建 spfile)
Step 8: Start the Instance(启动实例)
Step 9: Issue the CREATE DATABASE Statement(创建 DATABASE 的语句)
Step 10: Create Additional Tablespaces(创建额外的表空间)
Step 11: Run Scripts to Build Data Dictionary Views(运行脚本创建数据库字典视图)
Step 12: (Optional) Run Scripts to Install Additional Options
Step 13: Back Up the Database.
Step 14: (Optional) Enable Automatic Instance Startup

Step 1: Specify an Instance Identifier (SID)(指定一个实例的标识符 SID)
export Oracle_SID=lenovo
echo $ORACLE_SID

mkdir -p /u01/app/oracle/admin/lenovo/adump
orapwd file=”/u01/app/oracle/product/11.2.0/dbhome_1/dbs/orapwLENOVO” password=oracle entries=30
Step 2: Ensure That the Required Environment Variables Are Set(确认环境变量的设置)
[oracle@RedHat3 lenovo]$ mkdir datafile
[oracle@redhat3 lenovo]$ mkdir redolog
[oracle@redhat3 lenovo]$ pwd
/u01/app/oracle/oradata/lenovo
[oracle@redhat3 ~]$ cat .bash_profile
# .bash_profile

# Get the aliases and functions
if [-f ~/.bashrc]; then
 . ~/.bashrc
fi

# User specific environment and startup programs

PATH=$PATH:$HOME/bin

export PATH

#Oracle Settings
export TMP=/tmp
export TMPDIR=/tmp
export ORACLE_BASE=/u01/app/oracle
export ORACLE_HOME=$ORACLE_BASE/product/11.2.0/db_1
export ORACLE_SID=lenovo
export ORACLE_TERM=xterm
export PATH=/usr/sbin:$PATH
export PATH=$ORACLE_HOME/bin:$PATH
export LD_LIBRARY_PATH=$ORACLE_HOME/lib:/lib:/usr/lib:/usr/local/lib:/usr/X11R6/lib/
export CLASSPATH=$ORACLE_HOME/JRE:$ORACLE_HOME/jlib:$ORACLE_HOME/rdbms/jlib
export NLS_LANG=AMERICAN_AMERICA.ZHS16GBK
export LANG=C
umask 022

alias date=’date +%Y-%m-%d%t%A%t%T ‘

Step 3: Choose a Database Administrator Authentication Method(决定数据库管理员的认证方法)
[oracle@redhat3 bin]$ pwd
/u01/app/oracle/product/11.2.0/db_1/bin
[oracle@redhat3 bin]$ orapwd file=orapwdlenovo password=oracle entries=30

Step 4: Create the Initialization Parameter File(创建初始化的参数文件信息)
[oracle@redhat3 dbs]$ cat initlenovo.ora
db_name=’LENOVO’
memory_target=808M
control_files = (‘/u01/app/oracle/oradata/lenovo/controlfile/control01.ctl’)

Step 6: Connect to the Instance(连接实例)
[oracle@redhat3 dbs]$ echo $ORACLE_SID
lenovo
[oracle@redhat3 dbs]$ sqlplus / as sysdba

SQL*Plus: Release 11.2.0.4.0 Production on Tue Nov 1 19:28:17 2016

Copyright (c) 1982, 2013, Oracle. All rights reserved.

Connected to an idle instance.

SQL>

Step 7: Create a Server Parameter File(创建 spfile)
SQL> create spfile from pfile=’/u01/app/oracle/product/11.2.0/db_1/dbs/initlenovo.ora’;

Step 8: Start the Instance(启动实例)
SQL> startup nomount
ORACLE instance started.

Total System Global Area 843456512 bytes
Fixed Size 2257920 bytes
Variable Size 494930944 bytes
Database Buffers 343932928 bytes
Redo Buffers 2334720 bytes

Step 9: Issue the CREATE DATABASE Statement(创建 DATABASE 的语句)
create_db.sql

CREATE DATABASE lenovo
USER SYS IDENTIFIED BY oracle
USER SYSTEM IDENTIFIED BY oracle
LOGFILE GROUP 1 (‘/u01/app/oracle/oradata/lenovo/redolog/redo01a.log’) SIZE 100M BLOCKSIZE 512,
GROUP 2 (‘/u01/app/oracle/oradata/lenovo/redolog/redo02a.log’) SIZE 100M BLOCKSIZE 512,
GROUP 3 (‘/u01/app/oracle/oradata/lenovo/redolog/redo03a.log’) SIZE 100M BLOCKSIZE 512
MAXLOGFILES 5
MAXLOGMEMBERS 5
MAXLOGHISTORY 1
MAXDATAFILES 100
CHARACTER SET AL32UTF8
NATIONAL CHARACTER SET AL16UTF16
EXTENT MANAGEMENT LOCAL
DATAFILE ‘/u01/app/oracle/oradata/lenovo/datafile/system01.dbf’ SIZE 325M REUSE
SYSAUX DATAFILE ‘/u01/app/oracle/oradata/lenovo/datafile/sysaux01.dbf’ SIZE 325M REUSE
DEFAULT TABLESPACE users
DATAFILE ‘/u01/app/oracle/oradata/lenovo/datafile/users01.dbf’
SIZE 50M REUSE AUTOEXTEND ON MAXSIZE UNLIMITED
DEFAULT TEMPORARY TABLESPACE tempts1
TEMPFILE ‘/u01/app/oracle/oradata/lenovo/datafile/temp01.dbf’
SIZE 20M REUSE
UNDO TABLESPACE undotbs1
DATAFILE ‘/u01/app/oracle/oradata/lenovo/datafile/undotbs01.dbf’
SIZE 100M REUSE AUTOEXTEND ON MAXSIZE UNLIMITED;

SQL> @/home/oracle/create_db.sql

Database created.

Step 10: Create Additional Tablespaces(创建额外的表空间)
SQL>CREATE TABLESPACE zstest DATAFILE ‘/u01/app/oracle/oradata/lenovo/datafile/test01.dbf’ SIZE 50M EXTENT MANAGEMENT LOCAL SEGMENT SPACE MANAGEMENT AUTO;
SQL> select open_mode from v$database;

OPEN_MODE
—————————————-
READ WRITE

Step 11: Run Scripts to Build Data Dictionary Views(运行脚本创建数据库字典视图)
SYSDBA 用户执行如下脚本
@?/rdbms/admin/catalog.sql
@?/rdbms/admin/catproc.sql
@?/rdbms/admin/utlrp.sql

SYSTEM 用户执行如下脚本
@?/sqlplus/admin/pupbld.sql

更多 Oracle 相关信息见 Oracle 专题页面 http://www.linuxidc.com/topicnews.aspx?tid=12

本文永久更新链接地址 :http://www.linuxidc.com/Linux/2016-11/137350.htm

正文完
星哥玩云-微信公众号
post-qrcode
 0
星锅
版权声明:本站原创文章,由 星锅 于2022-01-22发表,共计4376字。
转载说明:除特殊说明外本站文章皆由CC-4.0协议发布,转载请注明出处。
【腾讯云】推广者专属福利,新客户无门槛领取总价值高达2860元代金券,每种代金券限量500张,先到先得。
阿里云-最新活动爆款每日限量供应
评论(没有评论)
验证码
【腾讯云】云服务器、云数据库、COS、CDN、短信等云产品特惠热卖中