oracle 11g 手工建庫

1.環境變量設置[oracle]$

cat >> /home/oracle/.bash_profile <<EOFhtml

export ORACLE_BASE=/u01/app/oracle sql

export ORACLE_HOME=/u01/app/oracle/product/11.2.0/db_1 數據庫

export ORACLE_SID=std1 bash

export PATH=$ORACLE_HOME/bin:/sbin:/usr/sbin:$PATH oracle

EOF app

source /home/oracle/.bash_profile dom

cat >> /home/oracle/.bashrc <<EOF ide

alias dbn='cd $ORACLE_HOME/network/admin' spa

alias dbs='cd $ORACLE_HOME/dbs' code

alias sql='sqlplus / as sysdba'

EOF

source /home/oracle/.bashrc

cat >> $ORACLE_HOME/sqlplus/admin/glogin.sql <<EOF

Define _editor='vi'

Set sqlprompt "_user'@'_connect_identifier> "

set time on

set timing on

set pagesize 40

set linesize 120

EOF

2.建立所需目錄[oracle]$

mkdir -p $ORACLE_BASE/admin/std1/adump && mkdir -p $ORACLE_BASE/oradata/std1 && mkdir -p $ORACLE_BASE/flash_recovery_area

3.生成密碼文件[oracle]$

dbs

orapwd file=orapwstd1 password=oracle entries=30

4.建立pfile參數文件[oracle]$

cat init.ora | grep -v ^# | grep -v ^$ > initstd1.ora

%s/ORCL/std1/g

%s/orcl/std1/g

%s#<ORACLE_BASE>#$ORACLE_BASE#g

%s#ora_control1#/u01/app/oracle/oradata/std1/ora_control1.ctl#g

%s#ora_control2#/u01/app/oracle/oradata/std1/ora_control2.ctl#g

db_name='std1'

memory_target=1G

processes = 150

audit_file_dest='$ORACLE_BASE/admin/std1/adump'

audit_trail ='db'

db_block_size=8192

db_domain=''

db_recovery_file_dest='$ORACLE_BASE/flash_recovery_area'

db_recovery_file_dest_size=2G

diagnostic_dest='$ORACLE_BASE'

dispatchers='(PROTOCOL=TCP) (SERVICE=std1XDB)'

open_cursors=300

remote_login_passwordfile='EXCLUSIVE'

undo_tablespace='UNDOTBS1'

control_files = (/u01/app/oracle/oradata/std1/ora_control1.ctl,/u01/app/oracle/oradata/std1/ora_control2.ctl)

compatible ='11.2.0'

5.生成spfile參數文件[oracle]$

mount -o remount,size=4g /dev/shm

sqlplus / as sysdba

startup nomount

create spfile from pfile;

6.執行建立數據庫語句[oracle]$

vi crtdb.sql

CREATE DATABASE std1

   USER SYS IDENTIFIED BY oracle

   USER SYSTEM IDENTIFIED BY oracle

   LOGFILE GROUP 1 ('/u01/app/oracle/oradata/std1/redo01a.log','/u01/app/oracle/oradata/std1/redo01b.log') SIZE 100M BLOCKSIZE 512,

           GROUP 2 ('/u01/app/oracle/oradata/std1/redo02a.log','/u01/app/oracle/oradata/std1/redo02b.log') SIZE 100M BLOCKSIZE 512

   MAXLOGFILES 5

   MAXLOGMEMBERS 5

   MAXLOGHISTORY 1

   MAXDATAFILES 100

   CHARACTER SET US7ASCII

   NATIONAL CHARACTER SET AL16UTF16

   EXTENT MANAGEMENT LOCAL

   DATAFILE '/u01/app/oracle/oradata/std1/system01.dbf' SIZE 325M REUSE

   SYSAUX DATAFILE '/u01/app/oracle/oradata/std1/sysaux01.dbf' SIZE 325M REUSE

   DEFAULT TABLESPACE users

      DATAFILE '/u01/app/oracle/oradata/std1/users01.dbf'

      SIZE 500M REUSE AUTOEXTEND ON MAXSIZE UNLIMITED

   DEFAULT TEMPORARY TABLESPACE tempts1

      TEMPFILE '/u01/app/oracle/oradata/std1/temp01.dbf'

      SIZE 20M REUSE

   UNDO TABLESPACE undotbs1

      DATAFILE '/u01/app/oracle/oradata/std1/undotbs01.dbf'      SIZE 200M REUSE AUTOEXTEND ON MAXSIZE UNLIMITED;

@crtdb.sql

7.生成數據字典[oracle]$

vi crtdic.sql

@?/rdbms/admin/catalog.sql

@?/rdbms/admin/catproc.sql

conn system/oracle

@?/sqlplus/admin/pupbld.sql

exit

@crtdic.sql

8.檢查一哈

select * from v$version;


ps:

手工建立scott方案

@?/rdbms/admin/utlsampl.sql

alter user scott account unlock identified by tiger;


ps2:

手工刪庫

http://www.javashuo.com/article/p-rnyvhwwk-go.html

相關文章
相關標籤/搜索