手动创建Oracle实例

Linux公社

 

 

首页数据库技术

背景:

阅读新闻

手动创建Oracle实例

[日期:2016-11-20]   来源:Linux社区  作者:bicewow   [字体:]  

手工建库步骤

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.

内容版权声明:除非注明,否则皆为本站原创文章。

转载注明出处:https://www.heiqu.com/65d10aa5dc70ab09941cffa129ae11ff.html