Step 1: Specify an Instance Identifier (SID)
export ORACLE_SID=maomi
Step 2: Ensure That the Required Environment Variables Are Set
export ORACLE_HOME=/u01/app/oracle/product/11.2.0.3/dbhome_1
export ORACLE_BASE=/u01/app/oracle
mkdir -p /u01/app/oracle/admin/maomi/adump
Step 3: Choose a Database Administrator Authentication Method
orapwd file=orapwmaomi password=oracle entries=5 force=y
Step 4: Create the Initialization Parameter File
db_name='maomi'
memory_target=400m
processes = 150
audit_file_dest='/u01/app/oracle/admin/maomi/adump'
audit_trail ='db'
db_block_size=8192
db_domain=''
log_archive_dest_1='location=+FRA'
DB_CREATE_ONLINE_LOG_DEST_1='+DATA'
DB_CREATE_ONLINE_LOG_DEST_2='+FRA'
db_create_file_dest='+DATA'
db_recovery_file_dest='+FRA'
db_recovery_file_dest_size=2G
diagnostic_dest='/u01/app/oracle'
dispatchers='(PROTOCOL=TCP) (SERVICE=ORCLXDB)'
open_cursors=300
remote_login_passwordfile='EXCLUSIVE'
undo_tablespace='UNDOTBS1'
undo_management='AUTO'
local_listener='(DESCRIPTION=(ADDRESS_LIST=(ADDRESS=(PROTOCOL=TCP)(HOST=192.168.8.21)(PORT=1521))))'
remote_listener='rac-scan:1521'
# You may want to ensure that control files are created on separate physical
# devices
#control_files = ('control01.ctl', 'control02.ctl') --to use OMF, you cannot include this parameter in pfile or spfile.
compatible ='11.2.0'
spfile='+DATA/prod/spfilemaomi.ora'
Step 5: (Windows Only) Create an Instance
oradim -NEW -SID sid -STARTMODE MANUAL -PFILE pfile
Step 6: Connect to the Instance
[oracle@rac1 dbs]$ echo $ORACLE_SID
maomi
[oracle@rac1 dbs]$ sqlplus / as sysdba
SQL*Plus: Release 11.2.0.3.0 Production on Wed Dec 18 21:09:02 2013
Copyright (c) 1982, 2011, Oracle. All rights reserved.
Connected to an idle instance.
Step 7: Create a Server Parameter File
SQL> create spfile from pfile;
File created.
Step 8: Start the Instance
STARTUP NOMOUNT
Step 9: Issue the CREATE DATABASE Statement
CREATE DATABASE maomi
USER SYS IDENTIFIED BY oracle
USER SYSTEM IDENTIFIED BY oracle
LOGFILE GROUP 1 ('+DATA','+FRA') SIZE 10M BLOCKSIZE 512,
GROUP 2 ('+DATA','+FRA') SIZE 10M BLOCKSIZE 512,
GROUP 3 ('+DATA','+FRA') SIZE 10M BLOCKSIZE 512
MAXLOGFILES 5
MAXLOGMEMBERS 5
MAXLOGHISTORY 1
MAXDATAFILES 100
CHARACTER SET AL32UTF8
NATIONAL CHARACTER SET AL16UTF16
EXTENT MANAGEMENT LOCAL
DATAFILE '+DATA' SIZE 325M REUSE
SYSAUX DATAFILE '+DATA' SIZE 325M REUSE
DEFAULT TABLESPACE users
DATAFILE '+DATA'
SIZE 100M REUSE AUTOEXTEND ON MAXSIZE UNLIMITED
DEFAULT TEMPORARY TABLESPACE tempts1
TEMPFILE '+DATA'
SIZE 20M REUSE
UNDO TABLESPACE UNDOTBS1
DATAFILE '+DATA'
SIZE 200M REUSE AUTOEXTEND ON MAXSIZE UNLIMITED;
使用 Oracle-managed-files
CREATE DATABASE maomi
USER SYS IDENTIFIED BY oracle
USER SYSTEM IDENTIFIED BY oracle
EXTENT MANAGEMENT LOCAL
UNDO TABLESPACE undotbs1
DEFAULT TEMPORARY TABLESPACE temp01
DEFAULT TABLESPACE users;
DB_CREATE_ONLINE_LOG_DEST_1='+DATA'
DB_CREATE_ONLINE_LOG_DEST_2='+FRA'
db_create_file_dest='+DATA'
?If no CONTROL_FILES initialization parameter is specified in the initialization parameter file, then the database also creates an Oracle managed control file.
如果指定了 control_files 则控制文件会创建在如下目录
SQL> show parameter control_files
NAME TYPE VALUE
------------------------------------ --------------------------------- ------------------------------
control_files string /u01/app/oracle/product/11.2.0
.3/dbhome_1/dbs/control01.ctl,
/u01/app/oracle/product/11.2.
0.3/dbhome_1/dbs/control02.ctl
how to migrate controlfile from OS file system to ASM
1.shutdown immediate
2.修改 pfile 和 spfile 的 control_files 参数
control_files=('+DATA/maomi/controlfile/control01.ctl','+FRA/prod/controlfile/control02.ctl'
3.startup nomount
4.restore 控制文件
rman target /
restore controlfile from '/u01/app/oracle/product/11.2.0.3/dbhome_1/dbs/control01.ctl';
5.打开数据块
alter database mount;
alter database open;
Step 10: Create Additional Tablespaces
Step 11: Run Scripts to Build Data Dictionary Views
CATALOG.SQL
Creates the views of the data dictionary tables, the dynamic performance views, and public synonyms for many of the views. Grants PUBLIC access to the synonyms.
CATPROC.SQL
Runs all scripts required for or used with PL/SQL.
PUPBLD.SQL
Required for SQL*Plus. Enables SQL*Plus to disable commands by user.
Step 12: Add database, instance and service to the cluster
[oracle@rac1 dbs]$ srvctl add database -d maomi -o '/u01/app/oracle/product/11.2.0.3/dbhome_1' -i maomi -s 'OPEN' -y AUTOMATIC
[oracle@rac1 dbs]$ srvctl add instance -d maomi -i maomi -n rac1
[oracle@rac1 dbs]$ srvctl add service -h
转载请注明作者出处及原文链接,否则将追究法律责任:
作者:xiangsir
原文链接:http://blog.csdn.net/xiangsir/article/details/17404181
QQ:444367417
MSN:xiangsir@hotmail.com