当前位置:  数据库>oracle

手动创建Oracle实例

    来源: 互联网  发布时间:2017-06-25

    本文导语: 手工建库步骤 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 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


    
 
 
 
本站(WWW.)旨在分享和传播互联网科技相关的资讯和技术,将尽最大努力为读者提供更好的信息聚合和浏览方式。
本站(WWW.)站内文章除注明原创外,均为转载、整理或搜集自网络。欢迎任何形式的转载,转载请注明出处。












  • 相关文章推荐
  • 如何手动调整网卡的half duplex & full duplex ?如何手动调整网卡的10/100M速度?
  • shell 脚本 date 手动执行 和 放在init.d中自动执行的时间不一样
  • FileUpload 控件禁止手动输入
  • Linux打开的文件描述符必须手动close吗
  • 如何手动清除一个对象
  • 请问,怎么手动启动Apache?? 在线等候
  • 关于shell脚本手动运行和自动运行的区别
  • 怎样手动清除磁盘高速缓冲?
  • 手动改写了lilo.conf,启动时无法进入linux了,怎么解决?
  • 如何手动控制wu-ftp的启动(100分)
  • 用什么命令可以知道,哪些软件包是自己手动安装的?
  • 2000下怎样手动更改JSWDK 的缺省IP和 缺省端口?
  • 在安装linux7.2时忘了选择FTP,怎样手动安装FTP?
  • 机子的内存需要手动配置吗,请指教!
  • 如何在linux shell 下启动/停止samba共享服务,如何手动配置?
  • 不能识别猫,如何手动配置?
  • 问一个crontab中不能运行手动可以运行的问题
  • linux中手动启动进程
  • 红帽企业Linux.5.4的手动安装
  • 如何在redhat系统中手动断开一个TCP连接


  • 站内导航:


    特别声明:169IT网站部分信息来自互联网,如果侵犯您的权利,请及时告知,本站将立即删除!

    ©2012-2021,,E-mail:www_#163.com(请将#改为@)

    浙ICP备11055608号-3