OracleRAC日常基本维护命令

OracleRAC日常基本维护命令,第1张

所有实例和服务的状态

$ srvctl status database d orcl

Instance orcl is running on node linux

Instance orcl is running on node linux

单个实例的状态

$ srvctl status instance d orcl i orcl

Instance orcl is running on node linux

数据库全局命名服务的状态

$ srvctl status service d orcl s orcltest

Service orcltest is running on instance(s) orcl orcl

特定节点上节点应用程序的状态

$ srvctl status nodeapps n linux

VIP is running on node: linux

GSD is running on node: linux

Listener is running on node: linux

ONS daemon is running on node: linux

ASM 实例的状态

$ srvctl status a n linux

ASM instance +ASM is running on node linux

列出配置的所有数据库

$ srvctl config database

orcl

显示 RAC 数据库的配置

$ srvctl config database d orcl

linux orcl /u /app/oracle/product/ /db_

linux orcl /u /app/oracle/product/ /db_

显示指定集群数据库的所有服务

$ srvctl config service d orcl

orcltest PREF: orcl orcl AVAIL:

显示节点应用程序的配置 —(VIP GSD ONS 监听器)

$ srvctl config nodeapps n linux a g s l

VIP exists : /linux vip/ / /eth :eth

GSD exists

ONS daemon exists

Listener exists

显示 ASM 实例的配置

$ srvctl config a n linux

+ASM /u /app/oracle/product/ /db_

集群中所有正在运行的实例

SELECT

inst_id

instance_number inst_no

instance_name inst_name

parallel

status

database_status db_status

active_state state

host_name host

FROM gv$instance

ORDER BY inst_id;

INST_ID INST_NO INST_NAME PAR STATUS DB_STATUS STATE HOST

orcl YES OPEN ACTIVE NORMAL rac

orcl YES OPEN ACTIVE NORMAL rac

位于磁盘组中的所有数据文件

select name from v$datafile

union

select member from v$logfile

union

select name from v$controlfile

union

select name from v$tempfile;

NAME

+FLASH_RECOVERY_AREA/orcl/controlfile/current

+FLASH_RECOVERY_AREA/orcl/onlinelog/group_

+FLASH_RECOVERY_AREA/orcl/onlinelog/group_

+FLASH_RECOVERY_AREA/orcl/onlinelog/group_

+FLASH_RECOVERY_AREA/orcl/onlinelog/group_

+ORCL_DATA /orcl/controlfile/current

+ORCL_DATA /orcl/datafile/example

+ORCL_DATA /orcl/datafile/indx

+ORCL_DATA /orcl/datafile/sysaux

+ORCL_DATA /orcl/datafile/system

+ORCL_DATA /orcl/datafile/undotbs

+ORCL_DATA /orcl/datafile/undotbs

+ORCL_DATA /orcl/datafile/undotbs

+ORCL_DATA /orcl/datafile/undotbs

+ORCL_DATA /orcl/datafile/users

+ORCL_DATA /orcl/datafile/users

+ORCL_DATA /orcl/onlinelog/group_

+ORCL_DATA /orcl/onlinelog/group_

+ORCL_DATA /orcl/onlinelog/group_

+ORCL_DATA /orcl/onlinelog/group_

+ORCL_DATA /orcl/tempfile/temp

rows selected

属于 ORCL_DATA 磁盘组的所有 ASM 磁盘

SELECT path

FROM v$a _disk

WHERE group_number IN (select group_number

from v$a _diskgroup

where name = ORCL_DATA );

PATH

ORCL:VOL

ORCL:VOL

启动/停止RAC集群

确保是以 oracle UNIX 用户登录的 我们将从rac 节点运行所有命令

# su – oracle

$ hostname

Rac

停止 Oracle RAC g 环境

第一步是停止 Oracle 实例 当此实例(和相关服务)关闭后 关闭 ASM 实例 最后 关闭节点应用程序(虚拟IP GSD TNS 监听器和 ONS)

$ export ORACLE_SID=orcl

$ emctl stop dbconsole

$ srvctl stop instance d orcl i orcl

$ srvctl stop a n rac

$ srvctl stop nodeapps –n rac

启动 Oracle RAC g 环境

第一步是启动节点应用程序(虚拟 IP GSD TNS 监听器和 ONS) 当成功启动节点应用程序后 启动 ASM 实例 最后 启动 Oracle 实例(和相关服务)以及企业管理器数据库控制台

$ export ORACLE_SID=orcl

$ srvctl start nodeapps n rac

$ srvctl start a n rac

$ srvctl start instance d orcl i orcl

$ emctl start dbconsole

使用 SRVCTL 启动/停止所有实例

启动/停止所有实例及其启用的服务 我只是觉得有意思就把此步骤作为关闭所有实例的一种方法加进来了!

$ srvctl start database d orcl

lishixinzhi/Article/program/Oracle/201311/16967

rac不是分布式数据库,rac结构无论多少个实例都是一个数据库,事务间不需要协调,而所谓的分布式数据库是多个数据库协同工作,事务间需要协调机制。

1、数据库中建立的表是在机器1还是在机器2呢?

答:机器1和机器上2看到的数据库实际上是同一个数据库,所以表既可以在机器1上看到也可以在机器2上看到。

2、如果有个表,在做机器1停机维护时(此时机器2仍可供访问),对这个机器上的表做索引重建,那么是否会影响机器2的使用?

答:如果机器1上的实例对表重建索引,其效果等于机器2上的实例对表重建索引,所以会影响机器2对该表的使用。例如你在机器1上重建索引时没有加上online关键字,重建过程中机器2不能对该表进行dml。

补充:

机器1和机器2看到的库实际上是同一个库,所以在机器1上给某表重建索引时对该表加的锁,也会影响机器2对该表的使用。就像我前面说的,假如你在机器1上重建索引时没有加上online关键字,重建过程中机器2不能对该表进行dml。再进一步说明,你在机器1上重建索引的过程中,机器2也不能将这个表drop掉,原因就是机器1在这个表上加上了ddl锁。

这篇文章主要介绍如何使用jdbc配置连接数据库(oracle的RAC配置的数据库)达到负载均衡的情况 该例子是以 个NODE的情况说明 希望对大家有所帮助

我的问题是我需要设置oracle x的thin客户端连接到oracle的RAC环境上

注:这样连接可以通过RAC自动平衡负载

原文如下:

Hi Tom

I couldn t find this information easily on the net   So I m submitting it hereand hope you make it available for anyone else looking for this information

My problem was I needed to configure the Oracle x thin driver (type IV) toconnect to an Oracle Real Application Cluster (RAC) environment

For example assuming you have a database called RAC_DB with o nodes node and node

You would need to configure your tnsnames ora with the following information inthe following way:

RAC_DB =  (DESCRIPTION =    (ADDRESS_LIST =      (ADDRESS = (PROTOCOL = TCP)(HOST = node )(PORT = ))      (ADDRESS = (PROTOCOL = TCP)(HOST = node )(PORT = ))      (LOAD_BALANCE = yes)      (FAILOVER = on)    )    (CONNECT_DATA =      (SERVICE_NAME = RAC_DB)      (FAILOVER_MODE = (TYPE = SELECT)                       (METHOD = BASIC)                       (RETRIES = )                       (DELAY = )      )    )  )

Now if you start a SQLPLUS session then you should see a connection on thenode instance   If you start another SQLPLUS session then Oracle shouldconnect you to the node instance (automatic load balancing)   It s actuallypretty cool to see the first time

To pass this same information to the Oracle s JDBC thin driver you essentiallyconcatenate a shorten version of the tnsnames information above and pass this tothe driver

String userid = scott ;  String password = tiger ;

String tnsnames_info =    (DESCRIPTION=(ADDRESS_LIST= +    (ADDRESS=(PROTOCOL=TCP)(HOST=node )(PORT= )) +    (ADDRESS=(PROTOCOL=TCP)(HOST=node )(PORT= )) +    (LOAD_BALANCE=yes)(FAILOVER=on)) +    (CONNECT_DATA=(SERVICE_NAME=rac_db))) ;

String url = jdbc:oracle:thin:@ + tnsnames_info;

DriverManager registerDriver(new oracle jdbc OracleDriver());  Connection dbConnection = DriverManager getConnection(url userid password);

That s it   If your application creates multiple connection to the database then you should see these connections load balance across the o instances

One last note Oracle only supports connection to a RAC configuration with the i drivers so you should try to get the latest Oracle JDBC thin driver

HTH Peter

and we said

you made it really hard   you just needed the service!  the load balancing andall could be/should be setup on the listener side!

you have one listener both databases register with it as a service

that would be another option

Reviews

I think we tried that and it didn t work   September Reviewer:  Peter Tran  from Houston TX USA

Hi Tom

I m pretty sure we tried that but it didn t work with the thin driver   Thatapproach will work if you use the OCI driver but not with the thin driver

Please send me an example of what you mean or what files I should configure totest it out

I m always opened to easier options

Thanks Peter

Followup:you need to set up mts and a single listener thats it

pmon on each of the rac instances will tell the listener about the load and awayit goes   you might not see the round robin right off (both are not yetloaded ) so it ll be an unbalanced load balance initially but as the systemramps it ll balance out

Unknown territory   September Reviewer:  Peter Tran  from Houston TX USA

I m sorry but I really lost you with that last remendation   Rather thanfrustrate you with my ignorance can you remend the Oracle documentation thatI should read to brush up on this information

I ll read this first and e back with questions if I m still lost

For example I don t understand why you want me to setup the database as MTS Why can t I use dedicated server mode

Thanks for the quick response

Peter

Followup:in order for a single listener to service many instances on differentmachines the listener must be servicing shared server connections thelistener cannot fork/exec a dedicated server since the listener may well notbe running on the machine the instance is on   it needs to know dispatcheraddresses to redirect the client request to

lishixinzhi/Article/program/Oracle/201311/17131

以上就是关于OracleRAC日常基本维护命令全部的内容,包括:OracleRAC日常基本维护命令、oracle rac问题、关于JDBC客户端如何连接ORACLE数据库RAC的负载均衡等相关内容解答,如果想了解更多相关内容,可以关注我们,你们的支持是我们更新的动力!

欢迎分享,转载请注明来源:内存溢出

原文地址: http://outofmemory.cn/sjk/9464954.html

(0)
打赏 微信扫一扫 微信扫一扫 支付宝扫一扫 支付宝扫一扫
上一篇 2023-04-28
下一篇 2023-04-28

发表评论

登录后才能评论

评论列表(0条)

保存