1024programmer Oracle Manually create the database (including oraclerac)

Manually create the database (including oraclerac)

Manually create databases (including oracle rac)
the
The easiest way is to use dbca to generate database building scripts, and then manually execute these scripts. The specific process is as follows
1, Manually create relevant directories and environment variables
[sql]
#!/bin/sh
the
OLD_UMASK=`umask`
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/cfgtoollogs/dbca/hrdb
umask ${OLD_UMASK} www.2cto.com
ORACLE_SID=hrdb1; export ORACLE_SID
PATH=$ORACLE_HOME/bin:$PATH; export PATH
Whether to use the database to start automatically, here is set to false
echo You should Add this entry in the /etc/oratab: hrdb:/oracle/app/oracle/product/11.2.0/db_1:N
the
2. Create parameter files and password files
[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=’#39;+DATA’
*.db_domain=’#39;’
*.db_name=’#39;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:1521'
*.sga_target=4399824896
the
Boot to nomount state
sqlplus “/as sysdba”
the
startup nomount pfile=”/oracle/app/oracle/product/11.2.0/db_1/dbs/inithrdb1.ora”;
the
3. Start building the library
[sql]
CREATE DATABASE “hrdb”
MAX INSTANCES 32
MAXLOGHISTORY 1
MAXLOGFILES 192
MAXLOGMEMBERS 3
MAXDATAFILES 1024
DATAFILE SIZE 700M AUTOEXTEND ON NEXT 10240K MAXSIZE UNLIMITED
EXTENT MANAGEMENT LOCAL
SYSAUX DATAFILE SIZE 600M AUTOEXTEND ON NEXT 10240K MAXSIZE UNLIMITED
SMALLFILE DEFAULT TEMPORARY TABLESPACE TEMP TEMPFILE SIZE 20M AUTOEXTEND ON NEXT 640K MAXSIZE UNLIMITED
SMALLFILE UNDO TABLESPACE “UNDOTBS1” DATAFILE SIZE 1024M AUTOEXTEND ON NEXT 5120K MAXSIZE UNLIMITED
CHARACTER SET ZHS16GBK
NATIONAL CHARACTER SET AL16UTF16
LOGFILE GROUP 1 SIZE 512M,
GROUP 2 SIZE 512M,
GROUP 7 SIZE 512M
USER SYS IDENTIFIED BY oracle USER SYSTEM IDENTIFIED BY oracle;
the
4. Add control file options to the parameter file
[sql]
hrdb1>column ctl_files NEW_VALUE ctl_files;
hrdb1>select concat('control_files=''', concat(replace(value, ', ', ''''# 39;,'''), '''')) ctl_files from v$parameter where name ='control_files&#39 ;;
www.2cto.com
CTL_FILES
————————————————– ————————————————– ————————————————– ————————————————–
control_files='+DATA/hrdb/controlfile/current.388.791301537','+FRA/hrdb/controlfile/current.361.791301537'
the
host echo &ctl_files >> /oracle/app/oracle/product/11.2.0/db_1/dbs/inithrdb1.ora;
the
5. Create a data dictionary
[sql]
connect / as sysdba;
spool /tmp/CreateDBCatalog.log append
the
@/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
the
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
the
6. Create spfile and store it on asm disk
[sql]
create spfile from pfile='/oracle/app/oracle/product/11.2.0/db_1/dbs/inithrdb1.ora';
the
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
the
echo “SPFILE='+DATA/hrdb/spfilehrdb.ora'” > /oracle/app/oracle/product/11.2.0/db_1/dbs/inithrdb1.ora
www.2cto.com
7, psu upgrade, recompile
[sql]
spool /tmp/postDBCreation.log append
@/oracle/app/oracle/product/11.2.0/db_1/rdbms/admin/catbundle.sql psu apply;
the
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;
the
8. Restart, start from spfile, modify 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
The single-instance database has been started normally. If it is a rac database, the following process is required
9. Add log file and undo
the
[sql]
–add log thread 3
ALTER DATABASE ADD LOGFILE THREAD 3
GROUP 5 SIZE 512M,
GROUP 6 SIZE 512M,
GROUP 9 SIZE 512M;
ALTER DATABASE ENABLE PUBLIC THREAD 3;
–Add log thread 3
ALTER DATABASE ADD LOGFILE THREAD 2
GROUP 3 SIZE 512M, www.2cto.com
GROUP 4 SIZE 512M,
GROUP 8 SIZE 512M;
ALTER DATABASE ENABLE PUBLIC THREAD 2;
the
undo tablespace
CREATE SMALLFILE UNDO TABLESPACE “UNDOTBS2” DATAFILE SIZE 1024M AUTOEXTEND ON NEXT 5120K MAXSIZE UNLIMITED;
CREATE SMALLFILE UNDO TABLESPACE “UNDOTBS3” DATAFILE SIZE 1024M AUTOEXTEND ON NEXT 5120K MAXSIZE UNLIMITED;
 
10. CreateClustDBViews
the
[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
the
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='hrdb2';
alter system set instance_number=3 scope=spfile sid='hrdb3';
alter system set thread=2 scope=spfile sid='hrdb2';
alter system set thread=3 scope=spfile sid='hrdb3';
alter system set undo_tablespace=UNDOTBS2 scope=spfile sid='hrdb2';
alter system set undo_tablespace=UNDOTBS3 scope=spfile sid='hrdb3';
the
create pfile = '/tmp/init.ora' from spfile;
create spfile='+DATA/hrdb/spfilehrdb.ora' FROM pfile='/tmp/init.ora';
www.2cto.com
It can also be done by modifying the pfile file
epmdb3.instance_number=3
epmdb2.instance_number=2
epmdb1.instance_number=1
epmdb3.thread=3
epmdb2.thread=2
epmdb1.thread=1
epmdb3.undo_tablespace=UNDOTBS3
epmdb1.undo_tablespace=UNDOTBS1
epmdb2.undo_tablespace=UNDOTBS2
12. Delete the default spfile, let the database start from the pfile, and actually start from the spfile on the asm
[sql]
shutdown immediate;
mv spfilehrdb1.ora spfilehrdb1.ora.bak
the
on db2
vi inithrdb2.ora
SPFILE='+DATA/hrdb/spfilehrdb.ora'
on db3
vi inithrdb3.ora
SPFILE='+DATA/hrdb/spfilehrdb.ora'
the
13. Register to crs
[sql]
/oracle/11.2.0/grid/bin/setasmgidwrap o=/oracle/app/oracle/product/11.2.0/db_1/bin/oracle
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
the
/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;
the
Finish.
the
the
Author hijk139

This article is from the internet and does not represent1024programmerPosition, please indicate the source when reprinting:https://www.1024programmer.com/manually-create-the-database-including-oraclerac/

author: admin

Previous article
Next article

Leave a Reply

Your email address will not be published. Required fields are marked *

Contact Us

Contact us

181-3619-1160

Online consultation: QQ交谈

E-mail: [email protected]

Working hours: Monday to Friday, 9:00-17:30, holidays off

Follow wechat
Scan wechat and follow us

Scan wechat and follow us

Follow Weibo
Back to top
首页
微信
电话
搜索