ITPub博客

首页 > Linux操作系统 > Linux操作系统 > oracle手動建庫

oracle手動建庫

原创 Linux操作系统 作者:ygzhou518 时间:2012-01-11 14:44:29 0 删除 编辑

ORACLE VERSION:10.2.0.4

DB_NAME=ygzhou
ORACLE_SID=ygzhou
Step 1: create directory of DB
mkdir –p /u01/app/oracle/oradata/ygzhou/datafile/
mkdir –p /u01/app/oracle/oradata/ygzhou/onlinelog01/
mkdir –p /u01/app/oracle/oradata/ygzhou/onlinelog02/
mkdir –p /u01/app/oracle/oradata/ygzhou/controlfile/
mkdir –p /u01/app/oracle/admin/ygzhou/adump/
Step 2: set oracle_sid and create passwordfile
    export ORACLE_SID=ygzhou
    $ORACLE_HOME/bin/orapwd file=$ORACLE_HOME/dbs/orapwygzhou password=system
Step 3:
    vi initygzhou.ora
*.db_domain=''
*.db_name='ygzhou'
*.control_files=('/u01/app/oracle/oradata/ygzhou/controlfile/control01.ctl','/u01/app/oracle/oradata/ygzhou/controlfile/control02.ctl')
*.sga_target=1000M
*.db_block_size=8192
*.audit_file_dest='/u01/app/oracle/admin/ygzhou/adump/'
*.audit_trail='db'
*.processes=150
*.open_cursors=300
*.remote_login_passwordfile='EXCLUSIVE'
Step 4:
Sqlplus / as sysdba
SQL>Create spfile from pfile;
SQL>Startup nomount
SQL>@createdb.sql

strings createdb.sql

CREATE DATABASE ygzhou
USER SYS IDENTIFIED BY system
USER SYSTEM IDENTIFIED BY system
LOGFILE GROUP 1('/u01/app/oracle/oradata/ygzhou/onlinelog01/redo01a.log','/u01/app/oracle/oradata/ygzhou/onlinelog02/redo01b.log') SIZE 50M,
        GROUP 2('/u01/app/oracle/oradata/ygzhou/onlinelog01/redo02a.log','/u01/app/oracle/oradata/ygzhou/onlinelog02/redo02b.log') SIZE 50M,
        GROUP 3('/u01/app/oracle/oradata/ygzhou/onlinelog01/redo03a.log','/u01/app/oracle/oradata/ygzhou/onlinelog02/redo03b.log') SIZE 50M
MAXLOGFILES 5
MAXLOGMEMBERS 5
MAXLOGHISTORY 1
MAXDATAFILES 100
CHARACTER SET ZHT16BIG5         
NATIONAL CHARACTER SET AL16UTF16
EXTENT MANAGEMENT LOCAL
DATAFILE '/u01/app/oracle/oradata/ygzhou/datafile/system01.dbf' size 500M REUSE AUTOEXTEND ON NEXT 5M
SYSAUX DATAFILE '/u01/app/oracle/oradata/ygzhou/datafile/sysaux01.dbf' size 500M REUSE AUTOEXTEND ON NEXT 5M
DEFAULT TABLESPACE users
         DATAFILE '/u01/app/oracle/oradata/ygzhou/datafile/users01.dbf' size 10M REUSE AUTOEXTEND ON NEXT 10M
DEFAULT TEMPORARY TABLESPACE tempts1
         TEMPFILE '/u01/app/oracle/oradata/ygzhou/datafile/temp01.dbf' size 10M REUSE AUTOEXTEND ON NEXT 1M
UNDO TABLESPACE undotbs
         DATAFILE '/u01/app/oracle/oradata/ygzhou/datafile/undotbs01.dbf' size 10M REUSE AUTOEXTEND ON MAXSIZE UNLIMITED;
[oracle@ygzhou02 dbs]$
SQL>@?/rdbms/admin/catalog.sql;
SQL>@?/rdbms/admin/catproc.sql
SQL>@?/sqlplus/admin/pupbld.sql

ORACLE VERSION:11.2.0.1

DB_NAME=mynewdb
ORACLE_SID=mynewdb
STEP1:
export ORACLE_SID=mynewdb
mkdir -p /u01/app/oracle/oradata/mynewdb/
mkdir -p /u01/app/oracle/admin/mynewdb/adump
mkdir -p /u01/app/oracle/logs/myredo/

strings initmynewdb.ora
*.audit_file_dest='/u01/app/oracle/admin/mynewdb/adump'
*.audit_trail='db'
*.compatible='11.2.0.0.0'
*.control_files='/u01/app/oracle/oradata/mynewdb/control01.ctl','/u01/app/oracle/oradata/mynewdb/control02.ctl'
*.db_block_size=8192
*.db_domain=''
*.db_name='mynewdb'
*.diagnostic_dest='/u01/app/oracle/'
*.dispatchers='(PROTOCOL=TCP)(SERVICE=ORCLXDB)'
*.job_queue_processes=10
*.memory_target=519493888
*.open_cursors=300
*.processes=150
*.remote_login_passwordfile='EXCLUSIVE'

step2:
$ORACLE_HOME/bin/orapwd file=$ORACLE_HOME/dbs/orapwmynewdb password=system

step3;
#db_name='mynewdb'
#control_files='/u01/app/oracle/oradata/mynewdb/control01.ctl'
#control_files='/u01/app/oracle/oradata/mynewdb/control02.ctl'

CREATE DATABASE mynewdb
   USER SYS IDENTIFIED BY system
   USER SYSTEM IDENTIFIED BY system
   LOGFILE GROUP 1 ('/u01/app/oracle/logs/myredo/redo01a.log','/u01/app/oracle/logs/myredo/redo01b.log') SIZE 50M BLOCKSIZE 512,
           GROUP 2 ('/u01/app/oracle/logs/myredo/redo02a.log','/u01/app/oracle/logs/myredo/redo02b.log') SIZE 50M BLOCKSIZE 512,
           GROUP 3 ('/u01/app/oracle/logs/myredo/redo03a.log','/u01/app/oracle/logs/myredo/redo03b.log') SIZE 50M BLOCKSIZE 512
   MAXLOGFILES 5
   MAXLOGMEMBERS 5
   MAXLOGHISTORY 1
   MAXDATAFILES 100
   CHARACTER SET ZHT16BIG5
   NATIONAL CHARACTER SET AL16UTF16
   EXTENT MANAGEMENT LOCAL
   DATAFILE '/u01/app/oracle/oradata/mynewdb/system01.dbf' SIZE 325M REUSE
   SYSAUX DATAFILE '/u01/app/oracle/oradata/mynewdb/sysaux01.dbf' SIZE 325M REUSE
   DEFAULT TABLESPACE users
      DATAFILE '/u01/app/oracle/oradata/mynewdb/users01.dbf'
      SIZE 500M REUSE AUTOEXTEND ON MAXSIZE UNLIMITED
   DEFAULT TEMPORARY TABLESPACE tempts1
      TEMPFILE '/u01/app/oracle/oradata/mynewdb/temp01.dbf'
      SIZE 20M REUSE
   UNDO TABLESPACE undotbs
      DATAFILE '/u01/app/oracle/oradata/mynewdb/undotbs01.dbf'
      SIZE 200M REUSE AUTOEXTEND ON MAXSIZE UNLIMITED;

@?/rdbms/admin/catalog.sql
@?/rdbms/admin/catproc.sql
@?/sqlplus/admin/pupbld.sql

来自 “ ITPUB博客 ” ,链接:http://blog.itpub.net/24867586/viewspace-714739/,如需转载,请注明出处,否则将追究法律责任。

请登录后发表评论 登录
全部评论

注册时间:2011-02-11

  • 博文量
    167
  • 访问量
    360256