Manual database creation (including oracle rac)

Source: Internet
Author: User


The simplest way to create a database manually (including oracle rac) is to use dbca to create database scripts and then execute these scripts manually. The specific process is as follows: 1. manually create related directories and environment variables [SQL] #! /Bin/sh OLD_UMASK = 'umrequest' umask 0027 mkdir-p/oracle/app/oracle/admin/hrdb/adump mkdir-p/oracle/app/oracle/admin/hrdb/ dpdump mkdir-p/oracle/app/oracle/admin/hrdb/hdump mkdir-p/oracle/app/oracle/admin/hrdb/pfile mkdir-p/oracle/app/oracle /export toollogs/dbca/hrdb umask $ {OLD_UMASK} www.2cto.com ORACLE_SID = hrdb1; export ORACLE_SID PATH = $ ORACLE_HOME/bin: $ PATH; whether export PATH is automatically started by the database. Here, it is set to false echo You shoshould Add this entry in the/etc/oratab: hrdb: /oracle/app/oracle/product/11.2.0/db_1: N 2, create the parameter file and password file [SQL] Password file/oracle/app/oracle/product/11.2.0/db_1/bin/orapwd file =/oracle/app/oracle/product/11.2.0/ db_1/dbs/orapwhrdb1 force = y parameter file $ ORACLE_HOME/dbs/inithrdb1.ora *. audit_file_dest = '/oracle/app/oracle/admin/hrdb/adump '*. audit_trail = 'db '*. cluster_database = false *. compatible = '11. 2.0.0.0 '*. cpu_count = 8 *. create_stored_outlines = ''*. db_block_size = 8192 *. db_create_file_dest = '+ data '*. db_domain = ''*. db_name = 'hrdb '*. db_recovery_file_dest = '+ fra '*. db_recovery_file_dest_size = 107374182400 *. diagnostic_dest = '/oracle/app/oracle' hrdb1.instance _ number = 1 *. log_archive_format = '% t _ % s _ % r. dbf '*. nls_language = 'simplified CHINESE '*. nls_territory = 'China '*. open_cursors = 1000 *. pga_aggregate_target = 1610612736 *. processes = 500 www.2cto.com *. remote_listener = 'dtydb-scan2: 100 '*. sga_target = 4399824896 start to nomount status sqlplus "/as sysdba" startup nomount pfile = "/oracle/app/oracle/product/11.2.0/db_1/dbs/inithrdb1.ora"; 3, start DATABASE creation [SQL] CREATE DATABASE "hrdb" MAXINSTANCES 32 MAXLOGHISTORY 1 MAXLOGFILES 192 MAXLOGMEMBERS 3 MAXDATAFILES 1024 DATAFILE SIZE 700 M AUTOEXTEND ON NEXT 10240 K MAXSIZE UNLIMITED EXTENT MANAGEMENT LOCAL SYSAUX DATAFILE SIZE 600 M AUTOEXTEND on next 10240 k maxsize unlimited smallfile default temporary tablespace temp tempfile size 20 m autoextend on next 640 k maxsize unlimited smallfile undo tablespace "UNDOTBS1" datafile size 1024 m autoextend on next 5120 K MAXSIZE UNLIMITED CHARACTER SET ZHS16GBK national character set AL16UTF16 logfile group 1 SIZE 512 M, GROUP 2 SIZE 512 M, GROUP 7 SIZE 512 m user sys identified by oracle user system identified by oracle; 4, add the control file option [SQL] hrdb1> column ctl_files NEW_VALUE ctl_files; hrdb1> select concat ('control _ files = ''', concat (replace (value ,', ', ''', '''), ''') ctl_files from v $ parameter where name = 'control _ files '; www.2cto.com CTL_FILES ------------------------------------------------------------------------- control_files = '+ DATA/hrdb/controlfile/current.388.791301537 ', '+ FRA/hrdb/controlfile/current.361.791301537' host echo & ctl_files>/oracle/app/oracle/product/11.2.0/db_1/dbs/inithrdb1.ora; 5, create a data dictionary [SQL] connect/as sysdba; spool/tmp/CreateDBCatalog. log append @/oracle/app/oracle/product/11.2.0/db_1/rdbms/admin/catalog. SQL; @/oracle/app/oracle/product/11.2.0/db_1/rdbms/admin/catblock. SQL; @/oracle/app/oracle/product/11.2.0/db_1/rdbms/admin/catproc. SQL; @/oracle/app/oracle/product/11.2.0/db_1/rdbms/admin/catoctk. SQL; @/oracle/app/oracle/product/11.2.0/db_1/rdbms/admin/owminst. plb; spool off connect "SYSTEM"/"oracle" spool/tmp/system. log append @/oracle/app/oracle/product/11.2.0/db_1/sqlplus/admin/pupbld. SQL; @/oracle/app/oracle/product/11.2.0/db_1/sqlplus/admin/help/hlpbld. SQL helpus. SQL; spool off 6. create a spfile and store it on the asm disk [SQL] create spfile from pfile = '/oracle/app/oracle/product/11.2.0/db_1/dbs/inithrdb1.ora '; cp/oracle/app/oracle/product/11.2.0/db_1/dbs/inithrdb1.ora/oracle/app/oracle/product/11.2.0/db_1/dbs/inithrdb1.ora. bak echo "SPFILE = '+ DATA/hrdb/spfilehrdb. ora '">/oracle/app/oracle/product/11.2.0/db_1/dbs/inithrdb1.ora www.2cto.com 7. Upgrade psu and re-compile [SQL] spool/tmp/postDBCreation. log append @/oracle/app/oracle/product/11.2.0/db_1/rdbms/admin/catbundle. SQL psu apply; select 'utl _ recomp_begin: '| to_char (sysdate, 'hh: MI: ss') from dual; execute utl_recomp.recomp_serial (); select 'utl _ recomp_end: '| to_char (sysdate, 'hh: MI: ss') from dual; 8. Restart, start from spfile, and change to archive mode [SQL] shutdown immediate; connect "SYS"/"& sysPassword" as SYSDBA startup mount pfile = "/oracle/app/oracle/admin/hrdb/scripts/init. ora "; startup mount; alter database archivelog; alter database open; the database of a single instance has been started normally. If it is a rac database, you also need to add log file and undo [SQL] <span style = "font-size: 12px; "> -- ADD log thread 3 alter database add logfile thread 3 GROUP 5 SIZE 512 M, GROUP 6 SIZE 512 M, GROUP 9 SIZE 512 M; alter database enable public thread 3; -- ADD log thread 3 alter database add logfile thread 2 GROUP 3 SIZE 512 M, www.2cto.com GROUP 4 SIZE 512 M, GROUP 8 SIZE 512 M; alter database enable public thread 2; undo tablespace create smallfile undo tablespace "UNDOTBS2" datafile size 1024 m autoextend on next 5120 k maxsize unlimited; create smallfile undo tablespace "UNDOTBS3" datafile size 1024 m autoextend on next 5120 k maxsize unlimited; </span> 10. CreateClustDBViews [SQL] spool/oracle/app/oracle/admin/epmdb/scripts/CreateClustDBViews. log append @/oracle/app/oracle/product/11.2.0/db_1/rdbms/admin/catclust. SQL; spool off 11, modify rac-related parameters [SQL] alter system set cluster_database = true scope = spfile; alter system set remote_listener = "dtydb-scan2: 1521" scope = spfile; alter system set instance_number = 2 scope = spfile sid = 'hrdb'; alter system set instance_number = 3 scope = spfile sid = 'hrdb3 '; alter system set thread = 2 scope = spfile sid = 'hrdb'; alter system set thread = 3 scope = spfile sid = 'hrdb3 '; alter system set undo_tablespace = UNDOTBS2 scope = spfile sid = 'hrdb'; alter system set undo_tablespace = UNDOTBS3 scope = spfile sid = 'hrdb3'; create pfile = '/tmp/init. ora 'from spfile; create spfile = '+ DATA/hrdb/spfilehrdb. ora 'from pfile = '/tmp/init. ora '; you can also modify the pfile file to complete epmdb3.instance _ number = 3 epmdb2.instance _ number = 2 epmdb1.instance _ number = 1 epmdb3.thread = 3 epmdb2.thread = 2 epmdb1.thread = 1 prop _ tablespace = UNDOTBS3 release _ table = UNDOTBS1 epmdb2.undo _ tablespace = UNDOTBS2 12, delete the default spfile to enable the database to start from pfile, and actually start [SQL] shutdown immediate; mv spfilehrdb1.ora spfilehrdb1.ora from the spfile on asm. on bak db2, vi inithrdb2.ora SPFILE = '+ DATA/hrdb/spfilehrdb. ora 'db3 vi inithrdb3.ora SPFILE = '+ DATA/hrdb/spfilehrdb. ora '13, register with crs [SQL]/oracle/11.2.0/grid/bin/setasmgidwrap o =/oracle/app/oracle/product/11.2.0/db_1/bin/oracle/app/oracle /product/11.2.0/db_1/bin/srvctl add database-d hrdb-o/oracle/app/oracle/product/11.2.0/db_1-p + DATA/hrdb/spfilehrdb. ora-n hrdb-a DATA, FRA www.2cto.com/oracle/app/oracle/product/11.2.0/db_1/bin/srvctl add instance-d hrdb-I hrdb1-n dtydb3/oracle/app/oracle/product/11.2.0/ db_1/bin/srvctl add instance-d hrdb-I hrdb2-n dtydb4/oracle/app/oracle/product/11.2.0/db_1/bin/srvctl add instance-d hrdb-I hrdb3 -n dtydb5/oracle/app/oracle/product/11.2.0/db_1/bin/srvctl enable database-d hrdb; /oracle/app/oracle/product/11.2.0/db_1/bin/srvctl start database-d hrdb; end. author hijk139

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.