导读 这篇文章主要介绍了Oracle 19c RAC 手工建库搭建过程,本文给大家介绍的非常详细,对大家的学习或工作具有一定的参考借鉴价值,需要的朋友可以参考下
数据库环境:

数据库版本(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 手工建库的文章就介绍到这了

原文来自:

本文地址://lrxjmw.cn/oracle-nine-rac.html编辑:xiangping wu,审核员:逄增宝

Linux大全:

Linux系统大全:

红帽认证RHCE考试心得: