欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页  >  IT编程

Oracle 19c RAC 手工建库的搭建过程

程序员文章站 2022-06-09 19:38:02
数据库环境:数据库版本(ru): 19.10grid_home:       /u01/app/19.0.0/gridoracle_home:     /u01/app/oracle/product/...

数据库环境:

数据库版本(ru):  19.10

grid_home:       /u01/app/19.0.0/grid
oracle_home:     /u01/app/oracle/product/19.0.0/db_1
db_name:      orcl

1.创建adump目录(每个节点执行)

mkdir -p /u01/app/oracle/admin/orcl/adump

2.修改$oracle_home/bin/oracle文件权限(每个节点执行)

/u01/app/19.0.0/grid/bin/setasmgidwrap o=/u01/app/oracle/product/19.0.0/db_1/bin/oracle

3.创建密码文件,添加数据库到集群资源中

/u01/app/oracle/product/19.0.0/db_1/bin/srvctl add database -d orcl -pwfile +dg_data/orcl/orapworcl -o \ /u01/app/oracle/product/19.0.0/db_1 -n orcl -a "dg_data"  (此处与上面为同一行)
/u01/app/oracle/product/19.0.0/db_1/bin/srvctl add instance -d orcl -i orcl1 -n ora19c-rac1
/u01/app/oracle/product/19.0.0/db_1/bin/srvctl add instance -d orcl -i orcl2 -n ora19c-rac2
/u01/app/oracle/product/19.0.0/db_1/bin/srvctl disable database -d orcl
/u01/app/oracle/product/19.0.0/db_1/bin/orapwd file=+dg_data/orcl/orapworcl force=y format=12 dbuniquename=orcl password=oracle321#

4.编辑临时初始化参数文件init.ora(根据实际需要添加需要调整的参数)

vi /home/oracle/init.ora

db_block_size=8192
open_cursors=300
db_name="orcl"
control_files=("+dg_data/orcl/control01.ctl", "+dg_data/orcl/control02.ctl")
compatible=19.0.0
diagnostic_dest=/u01/app/oracle
nls_language="american"
nls_territory="america"
processes=500
sga_target=1398m
audit_file_dest="/u01/app/oracle/admin/orcl/adump"
audit_trail=db
remote_login_passwordfile=exclusive
pga_aggregate_target=467m
undo_tablespace=undotbs1
family:dw_helper.instance_mode=read-only
orcl1.instance_number=1
orcl2.instance_number=2
orcl1.thread=1
orcl2.thread=2
orcl1.undo_tablespace=undotbs1
orcl2.undo_tablespace=undotbs2

5.启动实例到nomount状态,创建数据库(根据实际需要设置文件大小,和日志组数量与大小)

sqlplus / as sysdba
startup nomount pfile="/home/oracle/init.ora";
create database "orcl"
maxinstances 32
maxloghistory 1
maxlogfiles 192
maxlogmembers 3
maxdatafiles 1024
datafile '+dg_data/orcl/system01.dbf' size 700m reuse autoextend on next 10240k maxsize unlimited
extent management local
sysaux datafile '+dg_data/orcl/sysaux01.dbf' size 550m reuse autoextend on next 10240k maxsize unlimited
smallfile default temporary tablespace temp tempfile '+dg_data/orcl/temp01.dbf' size 20m reuse autoextend on next 640k maxsize unlimited
smallfile undo tablespace "undotbs1" datafile '+dg_data/orcl/undotbs01.dbf' size 200m reuse autoextend on next 5120k maxsize unlimited
character set al32utf8
national character set al16utf16
logfile group 1 ('+dg_data/orcl/redo01.log') size 300m,
group 2 ('+dg_data/orcl/redo02.log') size 300m
user sys identified by "oracle321#" user system identified by "oracle321#";

6.创建undotbs2和users表空间,并设置users表空间为数据库默认表空间

create smallfile undo tablespace "undotbs2" datafile '+dg_data/orcl/undotbs02.dbf' size 200m reuse autoextend on next 5120k maxsize unlimited;
create smallfile tablespace "users" logging datafile '+dg_data/orcl/users01.dbf' size 5m reuse autoextend on next 1280k maxsize unlimited extent management local segment space management auto;
alter database default tablespace "users";

7.创建数据字典 vi createcatalog.sql

set echo on
spool /home/oracle/createdbcatalog.log append
@/u01/app/oracle/product/19.0.0/db_1/rdbms/admin/catalog.sql;
@/u01/app/oracle/product/19.0.0/db_1/rdbms/admin/catproc.sql;
@/u01/app/oracle/product/19.0.0/db_1/rdbms/admin/catoctk.sql;
@/u01/app/oracle/product/19.0.0/db_1/rdbms/admin/owminst.plb;
connect "system"/"oracle321#"
@/u01/app/oracle/product/19.0.0/db_1/sqlplus/admin/pupbld.sql;
connect "sys"/"oracle321#" as sysdba
@/u01/app/oracle/product/19.0.0/db_1/sqlplus/admin/pupdel.sql;
connect "system"/"oracle321#"
spool off
set echo on
spool /home/oracle/sqlplushelp.log append
@/u01/app/oracle/product/19.0.0/db_1/sqlplus/admin/help/hlpbld.sql helpus.sql;
spool off
@createcatalog.sql

8.创建cluster数据字典

set echo on
spool /home/oracle/createclustdbviews.log append
@/u01/app/oracle/product/19.0.0/db_1/rdbms/admin/catclust.sql;
spool off

9.执行datapatch ,添加thread 2日志组并启用thread 2 (根据实际需要设置日志组数量与大小)

set verify off
spool /home/oracle/postdbcreation.log append
host /u01/app/oracle/product/19.0.0/db_1/opatch/datapatch -skip_upgrade_check
alter database add logfile thread 2 group 3 ('+dg_data/orcl/redo03.log') size 300m, group 4 ('+dg_data/orcl/redo04.log') size 300m;
alter database enable public thread 2;
host echo cluster_database=true >>/home/oracle/init.ora;
connect "sys"/"oracle321#" as sysdba
set echo on
create spfile='+dg_data/orcl/spfileorcl.ora' from pfile='/home/oracle/init.ora';
connect "sys"/"oracle321#" as sysdba
select 'utlrp_begin: ' || to_char(sysdate, 'hh:mi:ss') from dual;
@/u01/app/oracle/product/19.0.0/db_1/rdbms/admin/utlrp.sql;
select 'utlrp_end: ' || to_char(sysdate, 'hh:mi:ss') from dual;
select comp_id, status from dba_registry;
shutdown immediate;
host /u01/app/oracle/product/19.0.0/db_1/bin/srvctl enable database -d orcl;
host /u01/app/oracle/product/19.0.0/db_1/bin/srvctl start database -d orcl;
spool off
exit;

10.添加数据库实例信息到/etc/oratab文件中

vi /etc/oratab
orcl1:/u01/app/oracle/product/19.0.0/db_1:n   ##节点1添加
orcl2:/u01/app/oracle/product/19.0.0/db_1:n   ##节点2添加

到此这篇关于oracle 19c rac 手工建库的文章就介绍到这了,更多相关oracle 19c rac内容请搜索以前的文章或继续浏览下面的相关文章希望大家以后多多支持!

相关标签: Oracle 19c RAC