Step 1: Specify an Instance Identifier (SID) :
[
oracle@200-168-1-4 ~]$ env
HOSTNAME=200-168-1-4.speedyterra.com.br
SHELL=/bin/bash
TERM=vt100
HISTSIZE=1000
TMPDIR=/tmp
USER=oracle
LD_LIBRARY_PATH=/usr/u01/app/product/11.2.0/dbhome_1/lib:/lib:/usr/lib
LS_COLORS=no=00:fi=00:di=01;34:ln=01;36:pi=40;33:so=01;35:bd=40;33;01:cd=40;33;01:or=01;05;37;41:mi=01;05;37;41:ex=01;32:*.cmd=01;32:*.exe=01;32:*.com=01;32:*.btm=01;32:*.bat=01;32:*.sh=01;32:*.csh=01;32:*.tar=01;31:*.tgz=01;31:*.arj=01;31:*.taz=01;31:*.lzh=01;31:*.zip=01;31:*.z=01;31:*.Z=01;31:*.gz=01;31:*.bz2=01;31:*.bz=01;31:*.tz=01;31:*.rpm=01;31:*.cpio=01;31:*.jpg=01;35:*.gif=01;35:*.bmp=01;35:*.xbm=01;35:*.xpm=01;35:*.png=01;35:*.tif=01;35:
ORACLE_SID=lubinsu
ORACLE_BASE=/usr/u01/app
MAIL=/var/spool/mail/oracle
PATH=/usr/u01/app/product/11.2.0/dbhome_1/bin:/usr/sbin:/usr/kerberos/bin:/usr/local/bin:/bin:/usr/bin:/home/oracle/bin:/home/lubinsu/soft/app/jdk7/bin
INPUTRC=/etc/inputrc
PWD=/home/oracle
JAVA_HOME=/home/lubinsu/soft/app/jdk7
LANG=en_US.UTF-8
ORACLE_TERM=xterm
SSH_ASKPASS=/usr/libexec/openssh/gnome-ssh-askpass
SHLVL=1
HOME=/home/oracle
TMP=/tmp
LOGNAME=oracle
CVS_RSH=ssh
CLASSPATH=/usr/u01/app/product/11.2.0/dbhome_1/JRE:/usr/u01/app/product/11.2.0/dbhome_1/jlib:/usr/u01/app/product/11.2.0/dbhome_1/rdbms/jlib
LESSOPEN=|/usr/bin/lesspipe.sh %s
ORACLE_HOME=/usr/u01/app/product/11.2.0/dbhome_1
G_BROKEN_FILENAMES=1
_=/bin/env
HOSTNAME=200-168-1-4.speedyterra.com.br
SHELL=/bin/bash
TERM=vt100
HISTSIZE=1000
TMPDIR=/tmp
USER=oracle
LD_LIBRARY_PATH=/usr/u01/app/product/11.2.0/dbhome_1/lib:/lib:/usr/lib
LS_COLORS=no=00:fi=00:di=01;34:ln=01;36:pi=40;33:so=01;35:bd=40;33;01:cd=40;33;01:or=01;05;37;41:mi=01;05;37;41:ex=01;32:*.cmd=01;32:*.exe=01;32:*.com=01;32:*.btm=01;32:*.bat=01;32:*.sh=01;32:*.csh=01;32:*.tar=01;31:*.tgz=01;31:*.arj=01;31:*.taz=01;31:*.lzh=01;31:*.zip=01;31:*.z=01;31:*.Z=01;31:*.gz=01;31:*.bz2=01;31:*.bz=01;31:*.tz=01;31:*.rpm=01;31:*.cpio=01;31:*.jpg=01;35:*.gif=01;35:*.bmp=01;35:*.xbm=01;35:*.xpm=01;35:*.png=01;35:*.tif=01;35:
ORACLE_SID=lubinsu
ORACLE_BASE=/usr/u01/app
MAIL=/var/spool/mail/oracle
PATH=/usr/u01/app/product/11.2.0/dbhome_1/bin:/usr/sbin:/usr/kerberos/bin:/usr/local/bin:/bin:/usr/bin:/home/oracle/bin:/home/lubinsu/soft/app/jdk7/bin
INPUTRC=/etc/inputrc
PWD=/home/oracle
JAVA_HOME=/home/lubinsu/soft/app/jdk7
LANG=en_US.UTF-8
ORACLE_TERM=xterm
SSH_ASKPASS=/usr/libexec/openssh/gnome-ssh-askpass
SHLVL=1
HOME=/home/oracle
TMP=/tmp
LOGNAME=oracle
CVS_RSH=ssh
CLASSPATH=/usr/u01/app/product/11.2.0/dbhome_1/JRE:/usr/u01/app/product/11.2.0/dbhome_1/jlib:/usr/u01/app/product/11.2.0/dbhome_1/rdbms/jlib
LESSOPEN=|/usr/bin/lesspipe.sh %s
ORACLE_HOME=/usr/u01/app/product/11.2.0/dbhome_1
G_BROKEN_FILENAMES=1
_=/bin/env
Step 2: Ensure That the Required Environment Variables Are Set
[
oracle@200-168-1-4 bin]$ echo $ORACLE_HOME
/usr/u01/app/product/11.2.0/dbhome_1
[ oracle@200-168-1-4 bin]$ echo $ORACLE_SID
lubinsu
[ oracle@200-168-1-4 bin]$ echo $PATH
/usr/u01/app/product/11.2.0/dbhome_1/bin:/usr/sbin:/usr/kerberos/bin:/usr/local/bin:/bin:/usr/bin:/home/oracle/bin:/home/lubinsu/soft/app/jdk7/bin
/usr/u01/app/product/11.2.0/dbhome_1
[ oracle@200-168-1-4 bin]$ echo $ORACLE_SID
lubinsu
[ oracle@200-168-1-4 bin]$ echo $PATH
/usr/u01/app/product/11.2.0/dbhome_1/bin:/usr/sbin:/usr/kerberos/bin:/usr/local/bin:/bin:/usr/bin:/home/oracle/bin:/home/lubinsu/soft/app/jdk7/bin
Step 3: Choose a Database Administrator Authentication Method
orapwd file=pwdlubinsu entries=30 force=y ignorecase=n
Step 4: Create the Initialization Parameter File
[
oracle@200-168-1-4 lubinsu]$ ll
total 20
drwxr-xr-x 2 oracle oinstall 4096 Sep 10 08:09 adump
drwxr-xr-x 2 oracle oinstall 4096 Sep 10 08:09 bdump
drwxr-xr-x 2 oracle oinstall 4096 Sep 10 08:09 cdump
drwxr-xr-x 2 oracle oinstall 4096 Sep 10 08:09 pfile
drwxr-xr-x 2 oracle oinstall 4096 Sep 10 08:09 udump
[ oracle@200-168-1-4 lubinsu]$ pwd
/usr/u01/app/oradata/admin/lubinsu
total 20
drwxr-xr-x 2 oracle oinstall 4096 Sep 10 08:09 adump
drwxr-xr-x 2 oracle oinstall 4096 Sep 10 08:09 bdump
drwxr-xr-x 2 oracle oinstall 4096 Sep 10 08:09 cdump
drwxr-xr-x 2 oracle oinstall 4096 Sep 10 08:09 pfile
drwxr-xr-x 2 oracle oinstall 4096 Sep 10 08:09 udump
[ oracle@200-168-1-4 lubinsu]$ pwd
/usr/u01/app/oradata/admin/lubinsu
--从usr/u01/app/product/11.2.0/dbhome_1/dbs/init.ora复制一份
[
oracle@200-168-1-4 lubinsu]$ cat /usr/u01/app/product/11.2.0/dbhome_1/dbs/initlubinsu.ora
#
# $Header: rdbms/admin/init.ora /main/23 2009/05/15 13:35:38 ysarig Exp $
#
# Copyright (c) 1991, 1997, 1998 by Oracle Corporation
# NAME
# init.ora
# FUNCTION
# NOTES
# MODIFIED
# ysarig 05/14/09 - Updating compatible to 11.2
# ysarig 08/13/07 - Fixing the sample for 11g
# atsukerm 08/06/98 - fix for 8.1.
# hpiao 06/05/97 - fix for 803
# glavash 05/12/97 - add oracle_trace_enable comment
# hpiao 04/22/97 - remove ifile=, events=, etc.
# alingelb 09/19/94 - remove vms-specific stuff
# dpawson 07/07/93 - add more comments regarded archive start
# maporter 10/29/92 - Add vms_sga_use_gblpagfile=TRUE
# jloaiza 03/07/92 - change ALPHA to BETA
# danderso 02/26/92 - change db_block_cache_protect to _db_block_cache_p
# ghallmar 02/03/92 - db_directory -> db_domain
# maporter 01/12/92 - merge changes from branch 1.8.308.1
# maporter 12/21/91 - bug 76493: Add control_files parameter
# wbridge 12/03/91 - use of %c in archive format is discouraged
# ghallmar 12/02/91 - add global_names=true, db_directory=us.acme.com
# thayes 11/27/91 - Change default for cache_clone
# jloaiza 08/13/91 - merge changes from branch 1.7.100.1
# jloaiza 07/31/91 - add debug stuff
# rlim 04/29/91 - removal of char_is_varchar2
# Bridge 03/12/91 - log_allocation no longer exists
# Wijaya 02/05/91 - remove obsolete parameters
#
##############################################################################
# Example INIT.ORA file
#
# This file is provided by Oracle Corporation to help you start by providing
# a starting point to customize your RDBMS installation for your site.
#
# NOTE: The values that are used in this file are only intended to be used
# as a starting point. You may want to adjust/tune those values to your
# specific hardware and needs. You may also consider using Database
# Configuration Assistant tool (DBCA) to create INIT file and to size your
# initial set of tablespaces based on the user input.
###############################################################################
# Change '<ORACLE_BASE>' to point to the oracle base (the one you specify at
# install time)
db_name='lubinsu'
memory_target=1G
processes = 150
audit_file_dest='/usr/u01/app/oradata/admin/lubinsu/adump'
audit_trail ='db'
db_block_size=8192
db_domain=' www.lubinsu.com'
db_recovery_file_dest='/usr/u01/app/flash_recovery_area'
db_recovery_file_dest_size=2G
diagnostic_dest='/usr/u01/app'
dispatchers='(PROTOCOL=TCP) (SERVICE=ORCLXDB)'
open_cursors=300
remote_login_passwordfile='EXCLUSIVE'
undo_tablespace='UNDOTBS1'
# You may want to ensure that control files are created on separate physical
# devices
control_files = ('/usr/u01/app/oradata/lubinsu/control01.ctl', '/usr/u01/app/oradata/lubinsu/control02.ctl','/usr/u01/app/oradata/lubinsu/control03.ctl')
compatible ='11.2.0'
#
# $Header: rdbms/admin/init.ora /main/23 2009/05/15 13:35:38 ysarig Exp $
#
# Copyright (c) 1991, 1997, 1998 by Oracle Corporation
# NAME
# init.ora
# FUNCTION
# NOTES
# MODIFIED
# ysarig 05/14/09 - Updating compatible to 11.2
# ysarig 08/13/07 - Fixing the sample for 11g
# atsukerm 08/06/98 - fix for 8.1.
# hpiao 06/05/97 - fix for 803
# glavash 05/12/97 - add oracle_trace_enable comment
# hpiao 04/22/97 - remove ifile=, events=, etc.
# alingelb 09/19/94 - remove vms-specific stuff
# dpawson 07/07/93 - add more comments regarded archive start
# maporter 10/29/92 - Add vms_sga_use_gblpagfile=TRUE
# jloaiza 03/07/92 - change ALPHA to BETA
# danderso 02/26/92 - change db_block_cache_protect to _db_block_cache_p
# ghallmar 02/03/92 - db_directory -> db_domain
# maporter 01/12/92 - merge changes from branch 1.8.308.1
# maporter 12/21/91 - bug 76493: Add control_files parameter
# wbridge 12/03/91 - use of %c in archive format is discouraged
# ghallmar 12/02/91 - add global_names=true, db_directory=us.acme.com
# thayes 11/27/91 - Change default for cache_clone
# jloaiza 08/13/91 - merge changes from branch 1.7.100.1
# jloaiza 07/31/91 - add debug stuff
# rlim 04/29/91 - removal of char_is_varchar2
# Bridge 03/12/91 - log_allocation no longer exists
# Wijaya 02/05/91 - remove obsolete parameters
#
##############################################################################
# Example INIT.ORA file
#
# This file is provided by Oracle Corporation to help you start by providing
# a starting point to customize your RDBMS installation for your site.
#
# NOTE: The values that are used in this file are only intended to be used
# as a starting point. You may want to adjust/tune those values to your
# specific hardware and needs. You may also consider using Database
# Configuration Assistant tool (DBCA) to create INIT file and to size your
# initial set of tablespaces based on the user input.
###############################################################################
# Change '<ORACLE_BASE>' to point to the oracle base (the one you specify at
# install time)
db_name='lubinsu'
memory_target=1G
processes = 150
audit_file_dest='/usr/u01/app/oradata/admin/lubinsu/adump'
audit_trail ='db'
db_block_size=8192
db_domain=' www.lubinsu.com'
db_recovery_file_dest='/usr/u01/app/flash_recovery_area'
db_recovery_file_dest_size=2G
diagnostic_dest='/usr/u01/app'
dispatchers='(PROTOCOL=TCP) (SERVICE=ORCLXDB)'
open_cursors=300
remote_login_passwordfile='EXCLUSIVE'
undo_tablespace='UNDOTBS1'
# You may want to ensure that control files are created on separate physical
# devices
control_files = ('/usr/u01/app/oradata/lubinsu/control01.ctl', '/usr/u01/app/oradata/lubinsu/control02.ctl','/usr/u01/app/oradata/lubinsu/control03.ctl')
compatible ='11.2.0'
Step 5: (Windows Only) Create an Instance
跳过
Step 6: Connect to the Instance
[
oracle@200-168-1-4 app]$ sqlplus sys/30039736 as sysdba
SQL*Plus: Release 11.2.0.1.0 Production on Wed Sep 10 08:21:47 2014
Copyright (c) 1982, 2009, Oracle. All rights reserved.
Connected to an idle instance.
SQL> startup nomount
ORA-00845: MEMORY_TARGET not supported on this system
SQL> exit
Disconnected
SQL*Plus: Release 11.2.0.1.0 Production on Wed Sep 10 08:21:47 2014
Copyright (c) 1982, 2009, Oracle. All rights reserved.
Connected to an idle instance.
SQL> startup nomount
ORA-00845: MEMORY_TARGET not supported on this system
SQL> exit
Disconnected
[
oracle@200-168-1-4 dev]$ su - root
Password:
[ root@200-168-1-4 ~]# vi /etc/fstab
LABEL=/ / ext3 defaults 1 1
LABEL=/boot /boot ext3 defaults 1 2
tmpfs /dev/shm tmpfs defaults,size=1G 0 0
devpts /dev/pts devpts gid=5,mode=620 0 0
sysfs /sys sysfs defaults 0 0
proc /proc proc defaults 0 0
LABEL=SWAP-sda3 swap swap defaults 0 0
/home/oracle/swapfile swap swap defaults 0 0
Password:
[ root@200-168-1-4 ~]# vi /etc/fstab
LABEL=/ / ext3 defaults 1 1
LABEL=/boot /boot ext3 defaults 1 2
tmpfs /dev/shm tmpfs defaults,size=1G 0 0
devpts /dev/pts devpts gid=5,mode=620 0 0
sysfs /sys sysfs defaults 0 0
proc /proc proc defaults 0 0
LABEL=SWAP-sda3 swap swap defaults 0 0
/home/oracle/swapfile swap swap defaults 0 0
--修改初始化文件:memory_target=512M
[
oracle@200-168-1-4 dbs]$ sqlplus sys/30039736 as sysdba
SQL*Plus: Release 11.2.0.1.0 Production on Wed Sep 10 08:33:45 2014
Copyright (c) 1982, 2009, Oracle. All rights reserved.
Connected to an idle instance.
SQL> startup nomount
ORACLE instance started.
Total System Global Area 534462464 bytes
Fixed Size 2215064 bytes
Variable Size 327156584 bytes
Database Buffers 197132288 bytes
Redo Buffers 7958528 bytes
SQL>
SQL*Plus: Release 11.2.0.1.0 Production on Wed Sep 10 08:33:45 2014
Copyright (c) 1982, 2009, Oracle. All rights reserved.
Connected to an idle instance.
SQL> startup nomount
ORACLE instance started.
Total System Global Area 534462464 bytes
Fixed Size 2215064 bytes
Variable Size 327156584 bytes
Database Buffers 197132288 bytes
Redo Buffers 7958528 bytes
SQL>
--启动成功!
Step 7: Create a Server Parameter File
SQL> create spfile from pfile;
File created.
SQL> host ls $ORACLE_HOME/dbs
hc_lubinsu.dat initlubinsu.ora init.ora pwdlubinsu spfilelubinsu.ora
Step 8: Start the Instance
Step 9: Issue the CREATE DATABASE Statement
[
oracle@200-168-1-4 script]$ vi create_db.sql
CREATE DATABASE lubinsu
USER SYS IDENTIFIED BY 30039736
USER SYSTEM IDENTIFIED BY 30039736
LOGFILE GROUP 1 ('/usr/u01/app/oradata/lubinsu/redo01a.log','/usr/u01/app/oradata/lubinsu/redo01b.log') SIZE 50M BLOCKSIZE 512,
GROUP 2 ('/usr/u01/app/oradata/lubinsu/redo02a.log','/usr/u01/app/oradata/lubinsu/redo02b.log') SIZE 50M BLOCKSIZE 512,
GROUP 3 ('/usr/u01/app/oradata/lubinsu/redo03a.log','/usr/u01/app/oradata/lubinsu/redo03b.log') SIZE 50M BLOCKSIZE 512
MAXLOGFILES 5
MAXLOGMEMBERS 5
MAXLOGHISTORY 1
MAXDATAFILES 100
CHARACTER SET UTF8
NATIONAL CHARACTER SET AL16UTF16
EXTENT MANAGEMENT LOCAL
DATAFILE '/usr/u01/app/oradata/lubinsu/system01.dbf' SIZE 125M REUSE
SYSAUX DATAFILE '/usr/u01/app/oradata/lubinsu/sysaux01.dbf' SIZE 125M REUSE
DEFAULT TABLESPACE users
DATAFILE '/usr/u01/app/oradata/lubinsu/users01.dbf'
SIZE 250M REUSE AUTOEXTEND ON MAXSIZE UNLIMITED
DEFAULT TEMPORARY TABLESPACE tempts1
TEMPFILE '/usr/u01/app/oradata/lubinsu/temp01.dbf'
SIZE 20M REUSE
UNDO TABLESPACE undotbs1
DATAFILE '/usr/u01/app/oradata/lubinsu/undotbs01.dbf'
SIZE 200M REUSE AUTOEXTEND ON MAXSIZE UNLIMITED;
CREATE DATABASE lubinsu
USER SYS IDENTIFIED BY 30039736
USER SYSTEM IDENTIFIED BY 30039736
LOGFILE GROUP 1 ('/usr/u01/app/oradata/lubinsu/redo01a.log','/usr/u01/app/oradata/lubinsu/redo01b.log') SIZE 50M BLOCKSIZE 512,
GROUP 2 ('/usr/u01/app/oradata/lubinsu/redo02a.log','/usr/u01/app/oradata/lubinsu/redo02b.log') SIZE 50M BLOCKSIZE 512,
GROUP 3 ('/usr/u01/app/oradata/lubinsu/redo03a.log','/usr/u01/app/oradata/lubinsu/redo03b.log') SIZE 50M BLOCKSIZE 512
MAXLOGFILES 5
MAXLOGMEMBERS 5
MAXLOGHISTORY 1
MAXDATAFILES 100
CHARACTER SET UTF8
NATIONAL CHARACTER SET AL16UTF16
EXTENT MANAGEMENT LOCAL
DATAFILE '/usr/u01/app/oradata/lubinsu/system01.dbf' SIZE 125M REUSE
SYSAUX DATAFILE '/usr/u01/app/oradata/lubinsu/sysaux01.dbf' SIZE 125M REUSE
DEFAULT TABLESPACE users
DATAFILE '/usr/u01/app/oradata/lubinsu/users01.dbf'
SIZE 250M REUSE AUTOEXTEND ON MAXSIZE UNLIMITED
DEFAULT TEMPORARY TABLESPACE tempts1
TEMPFILE '/usr/u01/app/oradata/lubinsu/temp01.dbf'
SIZE 20M REUSE
UNDO TABLESPACE undotbs1
DATAFILE '/usr/u01/app/oradata/lubinsu/undotbs01.dbf'
SIZE 200M REUSE AUTOEXTEND ON MAXSIZE UNLIMITED;
注意:
这里的undo tablespace的名字必须和你在初始化参数文件中写的名称是一致的!
Step 10: Create Additional Tablespaces
SQL> CREATE TABLESPACE apps_tbs LOGGING
2 DATAFILE '/usr/u01/app/oradata/lubinsu/lubinsu.dbf'
3 SIZE 500M REUSE AUTOEXTEND ON NEXT 1280K MAXSIZE UNLIMITED
4 EXTENT MANAGEMENT LOCAL;
Tablespace created.
Step 11: Run Scripts to Build Data Dictionary Views
@?/rdbms/admin/catalog.sql
@?/rdbms/admin/catproc.sql
conn system/30039736
@?/sqlplus/admin/pupbld.sql
EXIT
Step 12: (Optional) Run Scripts to Install Additional Options
Step 13: Back Up the Database.
Step 14: (Optional) Enable Automatic Instance Startup