Http://www.cnblogs.com/beanbee/archive/2012/09/22/2697689.html
To manually build a ORACLE11GR2 database using the command line
Build a database through the command line can help to better understand the database building process, today try to build ORACLE11GR2 database, feel and 10g manual build library process still have a certain difference, 10g database manual way to establish can refer to Hou (secooler) " http://space.itpub.net/519536/viewspace-667563 "
Here is my build process:
First, the test environment
Os:suse SP1
Db:oracle Database 11g R2 (11.2.0.4.0)
Instance Name: Zfox
Ii. Steps of implementation
1. Configuring environment variables (Reference)
$ VI. bash_profile
. bash_profile
Export Oracle_base=/opt/oracle
Export oracle_home=/opt/oracle/product/11gr2/db
Export Grid_home=/opt/oracrs/product/11gr2/grid
#export oracle_sid=ndscdb
Export Oracle_sid=zfox
Export Oracle_term=xterm
#LD_LIBRARY_PATH = $ORACLE _home/lib:/lib:/usr/lib: $ORACLE _home/rdbms/lib
Ld_library_path= $ORACLE _home/lib: $ORACLE _home/lib32:/lib:/usr/lib: $ORACLE _home/rdbms/lib
Export Ld_library_path
Shlib_path= $ORACLE _home/lib: $ORACLE _home/rdbms/lib
Export Shlib_path
# Set Shell search paths:
Export path= $ORACLE _home/bin:/usr/sbin: $PATH:/usr/local/bin
# CLASSPATH must include the following JRE locations:
Classpath= $ORACLE _home/jre: $ORACLE _home/jlib: $ORACLE _home/rdbms/jlib
Export classpath= $CLASSPATH: $ORACLE _home/network/jlib
Export Nls_lang=american_america. Al32utf8
$ source ~/.bash_profile
2. Create dump Directory
Compared to 10g, 11GR2 only need to build adump a directory.
$ mkdir-p $ORACLE _base/admin/zfox/adump
3. Storage directory of data files and control files
ASM storage or bare devices do not need to be created
Note: Oracle storage uses local storage to create the following
$ mkdir-p/u01/app/oracle/oradata/prod
4. Create a password file
$ cd $ORACLE _home/dbs
$ orapwd File=orapwzfox password=oracle entries=30
5. Create a parameter file
Similar to the following:
$ cat Initzfox.ora
zfox.__db_cache_size=45365592064
zfox.__java_pool_size=536870912
zfox.__large_pool_size=134217728
Zfox.__oracle_base= '/opt/oracle ' #ORACLE_BASE set from environment
zfox.__pga_aggregate_target=16911433728
zfox.__sga_target=50465865728
Zfox.__shared_io_pool_size=0
zfox.__shared_pool_size=4160749568
Zfox.__streams_pool_size=0
*.audit_file_dest= '/opt/oracle/admin/zfox/adump '
*.audit_trail= ' DB '
*.compatible= ' 11.2.0.0.0 '
*.control_file_record_keep_time=20
*.control_files= ' +dg_data/zfox/controlfile/control01 '
*.cursor_sharing= ' Force '
*.db_block_size=8192
*.db_create_file_dest= ' +dg_data '
*.db_domain= "
*.db_file_multiblock_read_count=64
*.db_name= ' Zfox '
*.db_writer_processes=8
*.diagnostic_dest= '/opt/oracle '
*.dispatchers= "
*.dml_locks=6756
*.filesystemio_options= ' ASYNCH '
*.job_queue_processes=20
*.open_cursors=1000
*.pga_aggregate_target=16814964736
*.processes=1000
*.recyclebin= ' OFF '
*.remote_login_passwordfile= ' EXCLUSIVE '
*.resource_limit=true
*.sessions=1536
*.sga_target=50446991360
*.shared_servers=0
*.transactions=1689
*.undo_retention=5400
*.undo_tablespace= ' UNDOTBS1 '
6. Start the database to the Nomount state using the parameter file created earlier
$ Export Oracle_sid=zfox
$ sqlplus/as SYSDBA
Sql> create SPFile from Pfile;
sql> startup Nomount;
7, in 10GR2 need to manually modify the parameters such as Undo_management,job_queue_processes, in 11GR2 has met the requirements, no need to modify the
sql> show parameter Undo_ Management--auto
sql> Show parameter job_queue_processes--1000
sql> show Parameter _dump_--/opt/oracle/ Diag/rdbms/zfox/zfox/trace
8. Create a Database
$ VI Dbcreate_zofx.sql
CREATE DATABASE Zfox
USER SYS identified by Oracle
USER SYSTEM identified by Oracle
LOGFILE GROUP 1 (' +dg_data ') SIZE 100M BLOCKSIZE 512,
GROUP 2 (' +dg_data ') SIZE 100M BLOCKSIZE 512,
GROUP 3 (' +dg_data ') SIZE 100M BLOCKSIZE 512
Maxlogfiles 30
Maxlogmembers 5
Maxloghistory 1
Maxdatafiles 100
CHARACTER SET Us7ascii
National CHARACTER SET AL16UTF16
EXTENT MANAGEMENT LOCAL
DataFile ' +dg_data ' SIZE 325M reuse
Sysaux datafile ' +dg_data ' SIZE 325M reuse
DEFAULT tablespace Users
DataFile ' +dg_data '
SIZE 500M Reuse autoextend on MAXSIZE UNLIMITED
DEFAULT Temporary Tablespace Temp
Tempfile ' +dg_data '
SIZE 20M Reuse
UNDO tablespace UNDOTBS1
DataFile ' +dg_data '
SIZE 200M Reuse autoextend on MAXSIZE UNLIMITED;
---Execute the build script, you need to execute it under Nomount
Sql> @/home/oracle/dbcreate_zofx.sql
---Query the database state and confirm that the creation was successful.
Sql> select Instance_name,status from V$instance;
Col Tablespace_name for A10
Col Tablespace_file for A60
Select A.name tablespace_name,b.name tablespace_file from v$tablespace a,v$datafile b where a.ts#=b.ts#;
9. Execute a data dictionary script
@?/rdbms/admin/catalog.sql
@?/rdbms/admin/catproc.sql
@?/sqlplus/admin/pupbld.sql #需使用system用户执行
10. Reset the SPFile file to the ASM storage.
$ cd $ORACLE _home/dbs
$ cat Initzfox.ora
Spfile= ' +dg_data/zfox/spfilezfox.ora '
$ mv Spfilezfox.ora Spfilezfox.ora.bak
sql> create spfile= ' +dg_data/zfox/spfilezfox.ora ' from pfile= '/home/oracle/initzfox.ora '
With a DBCA silent build method, you can quickly build a library:
$ dbca-silent-createdatabase-templatename $ORACLE _home/assistants/dbca/templates/general_purpose.dbc-gdbname DG- Sid Dg-characterset Zhs16gbk
You can also manually edit the DBCA.RSP in the response directory to customize the database
ORACLE11GR2 Manual creation of Oracle instances based on ASM storage