注册 登录  
 加关注
   显示下一条  |  关闭
温馨提示!由于新浪微博认证机制调整,您的新浪微博帐号绑定已过期,请重新绑定!立即重新绑定新浪微博》  |  关闭

gmd20的个人空间

// 编程和生活

 
 
 

日志

 
 

Oracle RAC常用管理命令  

2010-10-18 20:13:59|  分类: 程序设计 |  标签: |举报 |字号 订阅

  下载LOFTER 我的照片书  |

1. 可以配置一些Oracle用到的变量

export ORACLE_BASE=/u01/app/oracle
export ORACLE_HOME=/u01/app/oracle/product/11.1.0/db_1
export ORACLE_SID=NEWRAC2
        ORACLE_HOSTNAME="newrac01.hq.lumigent.int"

export PATH=/u01/app/oracle/product/11.1.0/db_1/bin:$PATH

export ORA_CRS_HOME=/u01/app/crs/product/11.1.0/crs

export PATH=/u01/app/crs/product/11.1.0/crs/bin:$PATH
export ORACLE_USER=orarac

2.   crsctl     ,检查crs

crsctl check crs    检查crs状态

crsctl start crs     启动crs

crsctl stop crs

crsctl check crsd

crs_stat -t

等等,其 /etc/init.d/init.crs stop   /etc/init.d/init.crsd stop    等开机启动service 脚本如果

如果你发现crs不能正常工作可以检查调试一下这些脚本,检查一下进程是不是这个脚本可以正常工作。

crs的启动log 在 $ORA_CRS_HOME/log    $ORA_CRS_HOME/log/client 下面可以找到。出现错误可以检查一下对应的log

3. srvctl 启动数据库与实例

srvctl start database -d NEWRAC 启动名字为NEWRAC的数据库

查看当前数据库的状态

[root@newrac02 ~]# srvctl status database -d NEWRAC
Instance NEWRAC1 is running on node newrac01
Instance NEWRAC2 is running on node newrac02

srvctl start instance -d NEWRAC   -i newrac1 启动某一个实例

4、检查rac的配置文件 ,可以在里面找到数据库的名字等

/u01/oradata/NEWRAC/spfileNEWRAC.ora

/u01/app/oracle/admin/NEWRAC/pfile/init.ora.5302010204445

另附网络上找到的几篇文章:

Day-to-day management of Oracle 10G RAC   原文地址 http://www.6api.com/day-to-day-management-of-oracle-10g-rac/

==================================================

Day-to-day management of Oracle 10G RAC

CRS management
rnCRSCTL command control of the CRS Services local node (Oracle clusterware processes)
rn stop CRS:
rn $ crsctl stop crs or
rn $ / etc / init.crs stop or
rn $ crs_stop-all
rn start CRS:
rn $ crsctl start crs or
rn $ / etc / init.crs start
rn prohibited Clusterware restart automatically at system startup methods:
rn $ / etc / init.crs disable
rn start Clusterware restart automatically at system startup methods:
rn $ / etc / init.crs enable
rn view the status CRS Services
rn $ crsctl check crs
rnOCR resource management
rnOCR resources, when the RAC cluster up and running successfully, you can use the instrument crs_stat see the following:
rn $ ORA_CRS_HOME / bin / crs_stat
rn general, the status of all resources should be online. In addition, OCR will be four hours each to back up first. Have some cases you can restore the OCR configuration file to restore problems OCR.
rn such as the use of the following situations occur:
rn $ crs_stat-t
rnCRS-0184: Cannot communicate with the CRS daemon.
rn $ crsctl check boot
rnFailure 4 at procr_open_key with status 4.
rnPROC-4: The cluster registry key to be operated on does not exist.
rn $ crsctl check crs
rnFailure 1 contacting CSS daemon
rnCannot communicate with CRS
rnCannot communicate with EVM
rn caused this error may be due to a lost OCR configuration. We can use this backup to restore the previous configuration.
rn # / etc / init.crs disable
rn # / etc / init.crs stop
rn before the crs process to ensure that all stopped.
rn # su - oracle
rn $ cd $ ORA_CRS_HOME / bin
rn $. / ocrconfig-restore / opt / app / oracle / crs / cdata / crs / week.ocr
rn then switch to the root user, the re-enable CRS
rn # / etc / init.crs enable
Finally reboot both node rn
Introduction rnSRVCTL order
rnSRVCTL order to control the RAC database instance, listener, as well as services.
rn at SRVCTL usually carried out under ORACLE user. Us to introduce the following command srvctl.
rn1, through SRVCTL command to start / stop / check all of the examples:
rn $ srvctl start | stop | status database-d
rn2, start / stop the specified instance:
rn $ srvctl start | stop | status instance-d-i
rn3, list all of the current RAC
rn $ srvctl config database-d
rn4, start / stop / check all nodeapps, such as: VIP, GSD, listener, ONS:
rn $ srvctl start | stop | status nodeapps-n
rn5, if you use ASM, srvctl can also start / stop ASM instance:
rn $ srvctl start | stop asm-n [-i] [-o]
rn6, access to all environmental information:
rn $ srvctl getenv database-d [-i]
rn7, set the overall environment and the variables:
rn $ srvctl setenv database-d-t LANG = en
rn8, have been deleted from the OCR databases:
rn $ srvctl remove database-d
rn9, to the OCR to add a database:
rn $ srvctl add database-d-o
rn [-m] [-p] [-A / netmask] [-r (PRIMARY | PHYSICAL_STANDBY | LOGICAL_STANDBY)] [-s]
rn10, to the OCR to add a database instance:
rn $ srvctl add instance-d-i-n
rn $ srvctl add instance-d-i-n
rn11, to the OCR Add a ASM instance:
rn $ srvctl add asm-n-i-o
rn12, add a service
rn $ srvctl add service-d-s-r [-a] [-P] [-u]
rn13, modified on other nodes in the service
rn $ srvctl modify service-d-s-I-t
rn14, relocate a service node to other nodes
rnsrvctl relocate service-d-s-I
and related services rnCRS common command demo
rn1, view order status
rn # su-oracle - to switch to the oracle user
rn $ crs_stat-t - check crs and all of the service status
rn $ crsctl check crs - use crsctl order to check the status of related services crs
rn $ srvctl status nodeapps-n db01 (db02) - use srvctl to view the services on all nodes and whether it is normal
rn $ srvctl status database-d db - the database using srvctl status view
rn turn off start-up and related services in order
rn # su - oracle
rn $ crs_start-all - start all crs Service
rn $ crs_stop-all - to stop all of the Services crs
rn $ crsctl start crs - Services start crs
rn $ crsctl stop crs - stop crs Service
rn $ srvctl start nodeapps-n db01 (db02) - Start a node on the application of all
rn $ srvctl stop nodeapps-n db01 (db02) - stop a node on the application of all
rn $ srvctl start listener-n db01 (db02) - Start a node listener
rn $ srvctl stop listener-n db01 (db02) - The listener to stop a node
rn $ srvctl start instance-d db-i db01 (db02) - start an instance
rn $ srvctl stop instance-d db-i db01 (db02) - to stop a particular instance
rn $ srvctl start database-d db - startup database
rn $ srvctl stop database-d db - to stop the database

=========================================================

RAC common command description 原文地址http://www.6api.com/rac-common-command-description/

oracle rac database of commonly used commands:
1. The state of all instances and services
srvclt status database-d orcl
A single instance of state:
srvctl status instance-d orcl-i orcl1/orcl2
Global names in the database status of the service:
srvctl status service-d orcl-s orcltest
Application-specific node state:
srvctl status nodeapps-n linux1
srvctl status nodeapps-n linux2
ASM instance state
srvctl status asm-n linux1
Lists all database configuration:
srvctl config database
Display RAC database configuration information:
srvctl config database-d orcl
Show all services specified cluster database
srvctl config service-d orcl
Display node application configuration information (VIP, GSD, ONS, Listener, etc.)
srvctl config nodeapps-n linux1-a-g-s-l
Shows the configuration of ASM instance
srvctl config asm-n linux1
Cluster all running instances:
select
inst_id, instance_number inst_no, instance_name is inst_name,
parallel, status, database_status db_status,
active_state state, host_name host from gv $ instance
order by inst_id;
In the disk group, all data files:
select name from v $ datafile
union
select member from v $ logfile
union
select name from v $ controlfile
union
select name from v $ tempfile;

Start and stop RAC databases:
su - oracle
hostname
Stop oracle rac 10g environment:
The first step: stop oracle instance, when this instance (and related services) closed, shut down ASM instances, and finally, close the node applications (Virtual IP, GSD, TNS Listener, and ONS)
export oracle_sid = orcl
emctl stop dbconsole
srvclt stop instance-d orcl-i orcl1
srvctl stop asm-n rac1
srvctl stop nodeapps-n rac1
Start RAC environment:
The first step is to start the node applications (Virtual IP, GSD, TNS listener and ONS
). When the successful launch of the node application, start the ASM instance, and finally, start the ORACLE instance (and related services), and Enterprise Manager Database console.
export oracle_sid = orcl1
srvctl start nodeapps-n rac1
srvctl start asm-n rac1
srvctl start instance-d orcl-i orcl1
emctl start dbconsole
Practical srvclt start to stop all instances of:
srvclt start database-d orcl
srvctl stop database-d orcl
Start stop the listener:
lsnrctl start listener_hostb
lsnrctl stop listener
************************************************** ************************************************** ************************
Oracle 10G R2 RAC daily management
CRS management
CRSCTL command controls the local node's CRS services (Oracle clusterware processes)
Stop CRS:
$ Crsctl stop crs or
$ / Etc / init.crs stop or
$ Crs_stop-all
Start CRS:
$ Crsctl start crs or
$ / Etc / init.crs start
Prohibition Clusterware restart automatically after system start method:
$ / Etc / init.crs disable
Start Clusterware automatically start after reboot the system approach:
$ / Etc / init.crs enable
See CRS service status
$ Crsctl check crs
OCR resource management
OCR resources, when the RAC cluster up and running after success, you can use crs_stat tools see the following:
$ ORA_CRS_HOME / bin / crs_stat
Typically, the state of all resources should be online. In addition, OCR will backup every 4 hours once. In some cases you can restore the OCR configuration file to restore the problem of OCR.
Such as use of the following situations occur:
$ Crs_stat-t
CRS-0184: Cannot communicate with the CRS daemon.
$ Crsctl check boot
Failure 4 at procr_open_key with status 4.
PROC-4: The cluster registry key to be operated on does not exist.
$ Crsctl check crs
Failure 1 contacting CSS daemon
Cannot communicate with CRS
Cannot communicate with EVM
A possible cause of this error because the OCR configuration lost. We can use this backup to restore the previous configuration.
# / Etc / init.crs disable
# / Etc / init.crs stop
First ensure that all of the crs process all the stops.
# Su - oracle
$ Cd $ ORA_CRS_HOME / bin
$. / Ocrconfig-restore / opt / app / oracle / crs / cdata / crs / week.ocr
Then switch to the root user, the re-enable CRS
# / Etc / init.crs enable
Finally reboot the two nodes
SRVCTL command description
SRVCTL command can control the RAC database instance, listener, and services.
Usually SRVCTL executed in the ORACLE user. Here's a srvctl command.
1, by SRVCTL command to start / stop / check all of the examples:
$ Srvctl start | stop | status database-d <db_name>
2, start / stop the specified instance:
$ Srvctl start | stop | status instance-d <db_name>-i <instance_name>
3, lists all the current RAC under
$ Srvctl config database-d <db_name>
4, start / stop / check all the nodeapps, such as: VIP, GSD, listener, ONS:
$ Srvctl start | stop | status nodeapps-n <node_name>
5, if you use ASM, srvctl can also start / stop ASM instance:
$ Srvctl start | stop asm-n <node_name> [-i <asm_inst_name>] [-o <oracle_home>]
6, can get all of the environmental information:
$ Srvctl getenv database-d <db_name> [-i <instance_name>]
7, set the global environment and the variables:
$ Srvctl setenv database-d <db_name>-t LANG = en
8, to remove from the existing OCR databases:
$ Srvctl remove database-d <db_name>
9, add a database to OCR:
$ Srvctl add database-d <db_name>-o <oracle_home>
[-M <domain_name>] [-p <spfile>] [-A <name|ip> / netmask] [-r (PRIMARY | PHYSICAL_STANDBY | LOGICAL_STANDBY)] [-s <start_options>]
10, to the OCR to add a database instance:
$ Srvctl add instance-d <db_name>-i <instance_name>-n <node1>
$ Srvctl add instance-d <db_name>-i <instance_name>-n <node2>
11, to add an OCR ASM instance:
$ Srvctl add asm-n <node_name>-i <asm_inst_name>-o <oracle_home>
12, add a service
$ Srvctl add service-d <db_name>-s <service_name>-r <preferred_list> [-a <available_list>] [-P <TAF_policy>] [-u]
13, modify the service to other nodes
$ Srvctl modify service-d <db_name>-s <service_name>-I <orig_instance_name>-t <target_instance_name>
14, relocate to a service node to other nodes
srvctl relocate service-d <db_name>-s <service_name>-I
CRS and related services, a demonstration of common commands
1, view the status of the command
# Su-oracle - first switch to the oracle user
$ Crs_stat-t - View crs and all the service of the state
$ Crsctl check crs - use crsctl command to check the status of related services crs
$ Srvctl status nodeapps-n db01 (db02) - use the srvctl view the services on all nodes are normal
$ Srvctl status database-d db - the database using srvctl view the status of startup and shutdown commands related services
# Su - oracle
$ Crs_start-all - start all the crs service
$ Crs_stop-all - to stop all the crs service
$ Crsctl start crs - starts crs Service
$ Crsctl stop crs - stop crs service
$ Srvctl start nodeapps-n db01 (db02) - start all applications in a node
$ Srvctl stop nodeapps-n db01 (db02) - Stop all applications on a node
$ Srvctl start listener-n db01 (db02) - Start a node listener
$ Srvctl stop listener-n db01 (db02) - The listener to stop a node
$ Srvctl start instance-d db-i db01 (db02) - start an instance
$ Srvctl stop instance-d db-i db01 (db02) - stop an instance
$ Srvctl start database-d db - Startup Database
$ Srvctl stop database-d db - Stop database

===================================================================

oracle rac管理基本命令    http://space.itpub.net/12020513/viewspace-630224

  评论这张
 
阅读(820)| 评论(0)
推荐 转载

历史上的今天

评论

<#--最新日志,群博日志--> <#--推荐日志--> <#--引用记录--> <#--博主推荐--> <#--随机阅读--> <#--首页推荐--> <#--历史上的今天--> <#--被推荐日志--> <#--上一篇,下一篇--> <#-- 热度 --> <#-- 网易新闻广告 --> <#--右边模块结构--> <#--评论模块结构--> <#--引用模块结构--> <#--博主发起的投票-->
 
 
 
 
 
 
 
 
 
 
 
 
 
 

页脚

网易公司版权所有 ©1997-2017