标签:row set ext 创建数据库 管理 process TE add pup
在node1进行如下操作:
su - oracle
1)使用vi init11grac.ora创建pifle,内容如下:
*.audit_file_dest=‘/u01/app/oracle/admin/prod/adump‘
*.audit_trail=‘db‘
*.control_files=‘+proddata/prod/controlfile/control01.ctl‘,‘+proddata/prod/controlfile/control02.ctl‘,‘+proddata/prod/controlfile/control03.ctl‘
*.db_block_size=8192
*.db_domain=‘‘
*.db_name=‘prod‘
*.db_recovery_file_dest_size=32212254720
*.db_recovery_file_dest=‘+proddata‘
*.diagnostic_dest=‘/u01/app/oracle‘
*.log_archive_dest_1=‘location=+proddata‘
*.open_cursors=500
*.optimizer_mode=‘FIRST_ROWS_100‘
*.PGA_AGGREGATE_TARGET=100m
*.processes=500
*.remote_login_passwordfile=‘EXCLUSIVE‘
*.sec_case_sensitive_logon=FALSE
*.sga_target=280m
*.undo_management=‘auto‘
*.undo_retention=10800
*.lock_sga=true
prod1.undo_tablespace=‘UNDOTBS1‘
prod2.undo_tablespace=‘UNDOTBS2‘
prod1.thread=1
prod2.thread=2
prod1.instance_number=1
prod2.instance_number=2
*.cluster_database=false
*.CLUSTER_DATABASE_INSTANCES=2
相关参数可根据自己需要修改
若有*.audit_file_dest=‘/u01/app/oracle/admin/prod/adump‘ *.audit_trail=‘db‘参数则根据需要分别在两个节点创建相应目录
使用本文附件提供的pfile文件init11grac.ora将数据库启动到nomount状态
sqlplus / as sysdba
startup nomount pfile=‘/home/oracle/init11grac.ora‘
2)使用vi crtdbrac.sql创建建库脚本,脚本内容如下,可根据自己需要进行修改:
create database prod
user sys identified by oracle
user system identified by oracle
controlfile reuse
maxdatafiles 3000
maxinstances 8
character set AL32UTF8
national character set AL16UTF16
set time_zone=‘+8:00‘
datafile ‘+proddata/prod/datafile/system01.dbf‘ size 300m autoextend on next 10m maxsize unlimited extent management local
sysaux datafile ‘+proddata/prod/datafile/sysaux01.dbf‘ size 300m autoextend on next 10m maxsize unlimited
undo tablespace undotbs1 datafile ‘+proddata/prod/datafile/undotbs1_01.dbf‘ size 100m autoextend on next 10m maxsize unlimited
default temporary tablespace temp tempfile ‘+proddata/prod/tempfile/temp01.dbf‘ size 100m autoextend on next 10m maxsize unlimited
maxlogfiles 30
maxlogmembers 5
maxloghistory 1000
logfile
group 1 (‘+proddata/prod/onlinelog/redo1_1.rdo‘,‘+proddata/prod/onlinelog/redo1_2.rdo‘) size 50m,
group 2 (‘+proddata/prod/onlinelog/redo2_1.rdo‘,‘+proddata/prod/onlinelog/redo2_2.rdo‘) size 50m,
group 3 (‘+proddata/prod/onlinelog/redo3_1.rdo‘,‘+proddata/prod/onlinelog/redo3_2.rdo‘) size 50m;
在sqlplus中运行该建库脚本
SQL>@crtdbrac.sql
库建完后创建相应视图
SQL>@?/rdbms/admin/catalog
SQL>@?/rdbms/admin/catproc
SQL>@?/rdbms/admin/owminst.plb
SQL>@?/rdbms/admin/catclust.sql
切换到system用户运行以下脚本
SQL>conn system/oracle
SQL>@?/sqlplus/admin/pupbld
SQL>@?/sqlplus/admin/help/hlpbld.sql helpus.sql
3)创建SPFILE
SQL>create spfile=‘+PRODDATA/prod/PARAMETERFILE/spfileprod.ora‘ from pfile=‘/home/oracle/init11grac.ora‘
分别在两个节点的$ORACLE_HOME/dbs下创建initprod1.ora和initprod2.ora内容为
spfile=‘+PRODDATA/prod/PARAMETERFILE/spfileprod.ora‘
在node1使用默认路径$ORACLE_HOME/dbs下的pfile文件initprod1.ora重启数据库
4)创建数据库默认表空间users
SQL>create tablespace users datafile ‘+proddata/prod/datafile/users01.dbf‘ size 100m autoextend on next 10m maxsize unlimited segment space management auto;
SQL>alter database default tablespace users;
5)创建节点2的undo表空间undotbs2
SQL>create undo tablespace undotbs2 datafile ‘+proddata/prod/datafile/undotbs2_01.dbf‘ size 100m autoextend on next 10m maxsize unlimited segment space management auto;
6)创建thread 2的3组redo日志组并启用thread 2
SQL>alter database add logfile thread 2 (‘+proddata‘,‘+proddata‘) size 50m;
SQL>alter database add logfile thread 2 (‘+proddata‘,‘+proddata‘) size 50m;
SQL>alter database add logfile thread 2 (‘+proddata‘,‘+proddata‘) size 50m;
SQL>alter database enable thread 2;
7)开启归档和flashback
在node1上将数据库重启到mount状态,然后开启归档和flashback
SQL>alter database archivelog;
SQL>alter database flashback on;
7)node2使用默认路径$ORACLE_HOME/dbs下的pfile文件initprod2.ora启动数据库
SQL>startup
8)将数据库资源添加到CRS管理
在任意节点上以oracle用户执行以下命令
srvctl add database -d prod -o /u01/app/oracle/product/11.2/db_1/ -c RAC -y AUTOMATIC
9)将两个节点的实例资源添加到CRS管理
在任意节点上以ORACLE用户执行以下命令
srvctl add instance -d prod -i prod1 -n ora1
srvctl add instance -d prod -i prod2 -n ora2
10)使用sqlplus关闭两节点实例,使用crs启动数据库
从11GR2开始,instance资源在crs_stat -t中是看不到的,只能看到DB的资源
可以使用srvctl start database -d prod 来检查数据库实例的运行状况
关闭两个节点后,在任意节点以oracle或root帐户使用以下命令启动数据库
srvctl start database -d prod
或者
crs_start ora.prod.db
标签:row set ext 创建数据库 管理 process TE add pup
原文地址:https://www.cnblogs.com/dayu-liu/p/9143980.html