ORACLE RAC 手动建库

简介: 环境 11.2.0.1 RAC 前提条件 Grid Infrastructure已经安装 ASM已经创建 DB软件已经安装 通过手动创建RAC可以更深的理解单实例DB和RAC...

环境

11.2.0.1 RAC

前提条件

Grid Infrastructure已经安装 ASM已经创建 DB软件已经安装

通过手动创建RAC可以更深的理解单实例DBRAC DB 的一些区别,DBCA无法使用的场景中,也需要手动的方式创建,创建步骤如下:

大概思路:先创建单实例DB再转为RAC DB

1.       创建目录

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

2.       编辑参数文件

*.audit_file_dest='/u01/app/oracle/admin/orcl/adump'

*.audit_trail='db'

*.control_files=’+DATA/orcl/controlfile/control01.ctl’, ‘+DATA/orcl/controlfile/control02.ctl’                                             

*.db_block_size=8192

*.db_create_file_dest='+DATA'

*.db_domain=''

*.db_name='orcl'

*.db_recovery_file_dest='+DATA'

*.db_recovery_file_dest_size=10737418240

*.diagnostic_dest='/u01/app/oracle'

*.memory_target=1658847232

*.open_cursors=300

*.processes=150

*.remote_listener='scanip:1521'

*.remote_login_passwordfile='exclusive'

3.       创建ASM目录和创建spfile

[oracle@node1 ~]$ export ORACLE_SID=orcl1

[oracle@node1 ~]$ sqlplus / as sysdba   

SQL*Plus: Release 11.2.0.1.0 Production on Thu Dec 12 08:03:22 2013

Copyright (c) 1982, 2009, Oracle.  All rights reserved.

Connected to an idle instance.

SQL> create spfile='+DATA/orcl/spfileorcl.ora' from pfile='/home/oracle/orcl.ora';

create spfile='+DATA/orcl/spfileorcl.ora' from pfile='/home/oracle/orcl.ora'

*

ERROR at line 1:

ORA-17502: ksfdcre:4 Failed to create file +DATA/orcl/spfileorcl.ora

ORA-15056: additional error message

ORA-17502: ksfdcre:4 Failed to create file +DATA/orcl/spfileorcl.ora

ORA-15173: entry 'orcl' does not exist in directory '/'

ORA-06512: at line 4

SQL> exit

Disconnected

[oracle@node1 ~]$ su - grid

Password:

su: incorrect password

[oracle@node1 ~]$ su - grid

Password:

[grid@node1 ~]$ asmcmd

ASMCMD> ls

CRS/

DATA/

ASMCMD> cd DATA

ASMCMD> ls

RACDB/

ASMCMD> mkdir ORCL

ASMCMD> exit

[grid@node1 ~]$

[grid@node1 ~]$

[grid@node1 ~]$ exit

logout

[oracle@node1 ~]$ export ORACLE_SID=orcl1

[oracle@node1 ~]$ sqlplus / as sysdba   

SQL*Plus: Release 11.2.0.1.0 Production on Thu Dec 12 08:05:10 2013

Copyright (c) 1982, 2009, Oracle.  All rights reserved.

Connected to an idle instance.

SQL> create spfile='+DATA/orcl/spfileorcl.ora' from pfile='/home/oracle/orcl.ora';

File created.

SQL>

创建init文件

节点1

vi initorcl1.ora

SPFILE='+DATA/orcl/spfileorcl.ora'

节点2

vi initorcl2.ora

SPFILE='+DATA/orcl/spfileorcl.ora'

4.       创建密码文件

cd $ORACLE_HOME/dbs

节点1

orapwd file=orapwORCL1 password=oracle

节点

orapwd file=orapwORCL2 password=oracle

5.       创建DB

CREATE DATABASE orcl

   USER SYS IDENTIFIED BY oracle

   USER SYSTEM IDENTIFIED BY oracle

   LOGFILE GROUP 1  SIZE 100M,

           GROUP 2  SIZE 100M,

           GROUP 3  SIZE 100M

   MAXLOGFILES 5

   MAXLOGMEMBERS 5

   MAXLOGHISTORY 1

   MAXDATAFILES 100

   CHARACTER SET US7ASCII

   NATIONAL CHARACTER SET AL16UTF16

   EXTENT MANAGEMENT LOCAL

   DATAFILE  SIZE 325M

   SYSAUX DATAFILE  SIZE 325M

   DEFAULT TABLESPACE users

      DATAFILE

      SIZE 500M  AUTOEXTEND ON MAXSIZE UNLIMITED

   DEFAULT TEMPORARY TABLESPACE tempts1

      TEMPFILE

      SIZE 20M

   UNDO TABLESPACE undotbs1

      DATAFILE

      SIZE 200M  AUTOEXTEND ON MAXSIZE UNLIMITED;

6.       创建undo 和添加redo

CREATE UNDO TABLESPACE UNDOTBS2 DATAFILE SIZE 200M;

ALTER DATABASE ADD LOGFILE THREAD 2 GROUP 4 SIZE 100M; 

ALTER DATABASE ADD LOGFILE THREAD 2 GROUP 5 SIZE 100M;

ALTER DATABASE ADD LOGFILE THREAD 2 GROUP 6 SIZE 100M; 

(以下转单实例dbRAC DB)

7.       添加rac 参数

*.cluster_database=true

orcl1.instance_number=1

orcl2.instance_number=2

orcl2.thread=2

orcl1.thread=1

orcl1.undo_tablespace='UNDOTBS1'

orcl2.undo_tablespace='UNDOTBS2'

8.       启动所有节点实例

 [oracle@node1 ~]$ sqlplus / as sysdba

SQL> startup

ORACLE instance started.

Total System Global Area 1653518336 bytes

Fixed Size                  2213896 bytes

Variable Size             956303352 bytes

Database Buffers          687865856 bytes

Redo Buffers                7135232 bytes

Database mounted.

Database opened.

SQL> ALTER DATABASE ENABLE PUBLIC THREAD 2;

Database altered.

[oracle@node1 ~]$

[oracle@node1 ~]$

[oracle@node1 ~]$ ssh node2         

Last login: Thu Dec 12 09:43:51 2013 from node1

[oracle@node2 ~]$ sqlplus / as sysdba

SQL*Plus: Release 11.2.0.1.0 Production on Thu Dec 12 10:00:33 2013

Copyright (c) 1982, 2009, Oracle.  All rights reserved.

Connected to an idle instance.

SQL> startup

ORACLE instance started.

Total System Global Area 1653518336 bytes

Fixed Size                  2213896 bytes

Variable Size             956303352 bytes

Database Buffers          687865856 bytes

Redo Buffers                7135232 bytes

Database mounted.

Database opened.

SQL>

SQL>

SQL>

SQL> select instance_name from gv$instance;

INSTANCE_NAME

----------------

orcl2

orcl1

9.       执行创建数据字典脚本

@$ORACLE_HOME/rdbms/admin/catalog.sql

@$ORACLE_HOME/rdbms/admin/catproc.sql

@$ORACLE_HOME/rdbms/admin/catclust.sql

--rac 相关字典

@$ORACLE_HOME/rdbms/admin/utlrp.sql

10. 注册数据库到Clusterware 

[oracle@node1 ~]$ srvctl add database -d orcl -o $ORACLE_HOME

[oracle@node1 ~]$ srvctl add instance -d orcl -i orcl1 -n node1

[oracle@node1 ~]$ srvctl add instance -d orcl -i orcl2 -n node2

[oracle@node1 ~]$ srvctl enable database -d orcl

PRCC-1010 : orcl was already enabled

[oracle@node1 ~]$ srvctl start database -d orcl    

 

[grid@node1 ~]$ crsctl stat res -t

--------------------------------------------------------------------------------

NAME           TARGET  STATE        SERVER                   STATE_DETAILS      

--------------------------------------------------------------------------------

Local Resources

--------------------------------------------------------------------------------

ora.CRS.dg

               ONLINE  ONLINE       node1                                       

               ONLINE  ONLINE       node2                                       

ora.DATA.dg

               ONLINE  ONLINE       node1                                       

               ONLINE  ONLINE       node2                                       

ora.LISTENER.lsnr

               ONLINE  ONLINE       node1                                       

               ONLINE  ONLINE       node2                                       

ora.asm

               ONLINE  ONLINE       node1                    Started            

               ONLINE  ONLINE       node2                                       

ora.eons

               ONLINE  ONLINE       node1                                       

               ONLINE  ONLINE       node2                                       

ora.gsd

               OFFLINE OFFLINE      node1                                        

               OFFLINE OFFLINE      node2                                       

ora.net1.network

               ONLINE  ONLINE       node1                                       

               ONLINE  ONLINE       node2                                        

ora.ons

               ONLINE  ONLINE       node1                                       

               ONLINE  ONLINE       node2                                       

ora.registry.acfs

               ONLINE  ONLINE       node1                                       

               ONLINE  ONLINE       node2                                       

--------------------------------------------------------------------------------

Cluster Resources

--------------------------------------------------------------------------------

ora.LISTENER_SCAN1.lsnr

      1        ONLINE  ONLINE       node2                                       

ora.node1.vip

      1        ONLINE  ONLINE       node1                                        

ora.node2.vip

      1        ONLINE  ONLINE       node2                                       

ora.oc4j

      1        OFFLINE OFFLINE                                                  

ora.orcl.db

      1        ONLINE  ONLINE       node1                    Open               

      2        ONLINE  ONLINE       node2                    Open               

ora.scan1.vip

      1        ONLINE  ONLINE       node2                                       

11. 两个节点配置tnsnames.ora

目录
相关文章
|
19天前
|
Oracle 关系型数据库
oracle rac 手工安装补丁,不适用auto
oracle rac 手工安装补丁,不适用auto
14 3
|
4月前
|
Oracle 关系型数据库 Java
分享一个 Oracle RAC 模式下客户端建立JDBC初始连接时因ONS造成应用启动时卡顿30秒问题的排查分析案例
分享一个 Oracle RAC 模式下客户端建立JDBC初始连接时因ONS造成应用启动时卡顿30秒问题的排查分析案例
|
9月前
|
存储 Oracle 关系型数据库
|
文字识别 Oracle 关系型数据库
Oracle rac重新执行root.sh脚本
Oracle rac重新执行root.sh脚本
633 0
|
网络协议 Oracle 关系型数据库
Oracle rac 修改SCAN IP
Oracle rac 修改SCAN IP
617 0
|
网络协议 Oracle 关系型数据库
Oracle rac不能监听public ip
Oracle rac不能监听public ip
218 0
|
负载均衡 Oracle 网络协议
Oracle RAC中REMOTE_LISTENER和local_listener的作用是什么?
Oracle RAC中REMOTE_LISTENER和local_listener的作用是什么?
374 0
|
SQL Oracle 关系型数据库
Oracle手动建库常见问题
Oracle手动建库常见问题 BLOG文档结构图 前言部分 导读和注意事项 各位技术...
1078 0
|
6天前
|
SQL Oracle 关系型数据库
【Oracle】玩转Oracle数据库:装上去,飞起来!
本文是一篇关于Oracle数据库安装和使用的博文摘要。作者以轻松幽默的笔调介绍了自己在实验中掌握的Oracle数据库基本操作,包括使用组件查看命令、配置数据库监听器等。作者也分享了在实验中遇到的一些有趣问题,如SQL语句缺少分号导致的意外错误。此外,作者还强调了登录sys用户和启动实例加载数据库的注意事项,并鼓励读者面对挑战时保持乐观,不断提升自己的能力。整体风格风趣严谨,引人入胜。
63 0
|
1月前
|
SQL 分布式计算 Oracle
使用Sqoop从Oracle数据库导入数据
使用Sqoop从Oracle数据库导入数据
使用Sqoop从Oracle数据库导入数据